Skip to content

Commit 2aa584f

Browse files
remove the firstIndex SSBO from the actual descriptor set layout
1 parent 32e56f7 commit 2aa584f

File tree

2 files changed

+17
-19
lines changed

2 files changed

+17
-19
lines changed

examples_tests/22.RaytracedAO/Renderer.cpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,15 @@ Renderer::Renderer(IVideoDriver* _driver, IAssetManager* _assetManager, scene::I
136136
}
137137

138138
{
139-
constexpr auto raytracingCommonDescriptorCount = 7u;
139+
constexpr auto raytracingCommonDescriptorCount = 6u;
140140
IGPUDescriptorSetLayout::SBinding bindings[raytracingCommonDescriptorCount];
141141
fillIotaDescriptorBindingDeclarations(bindings,ISpecializedShader::ESS_COMPUTE,raytracingCommonDescriptorCount);
142142
bindings[0].type = asset::EDT_UNIFORM_BUFFER;
143-
bindings[1].type = asset::EDT_STORAGE_BUFFER;
144-
bindings[2].type = asset::EDT_STORAGE_IMAGE;
145-
bindings[3].type = asset::EDT_UNIFORM_TEXEL_BUFFER;
146-
bindings[4].type = asset::EDT_STORAGE_IMAGE;
143+
bindings[1].type = asset::EDT_STORAGE_IMAGE;
144+
bindings[2].type = asset::EDT_UNIFORM_TEXEL_BUFFER;
145+
bindings[3].type = asset::EDT_STORAGE_IMAGE;
146+
bindings[4].type = asset::EDT_STORAGE_BUFFER;
147147
bindings[5].type = asset::EDT_STORAGE_BUFFER;
148-
bindings[6].type = asset::EDT_STORAGE_BUFFER;
149148

150149
m_commonRaytracingDSLayout = m_driver->createGPUDescriptorSetLayout(bindings,bindings+raytracingCommonDescriptorCount);
151150
}
@@ -837,7 +836,7 @@ void Renderer::init(const SAssetBundle& meshes, core::smart_refctd_ptr<ICPUBuffe
837836

838837
//
839838
constexpr uint32_t descriptorUpdates = 5;
840-
constexpr uint32_t descriptorUpdateCounts[descriptorUpdates] = {2u,7u,2u,2u,3u};
839+
constexpr uint32_t descriptorUpdateCounts[descriptorUpdates] = {2u,6u,2u,2u,3u};
841840
constexpr uint32_t descriptorUpdateMaxCount = *std::max_element(descriptorUpdateCounts,descriptorUpdateCounts+descriptorUpdates);
842841

843842
//
@@ -933,23 +932,22 @@ void Renderer::init(const SAssetBundle& meshes, core::smart_refctd_ptr<ICPUBuffe
933932
region.imageExtent = {m_staticViewData.imageDimensions.x,m_staticViewData.imageDimensions.y,1u};
934933
auto scrambleKeys = createScreenSizedTexture(EF_R32G32_UINT,2u);
935934
m_driver->copyBufferToImage(tmpBuff.get(),scrambleKeys->getCreationParameters().image.get(),1u,&region);
936-
setImageInfo(infos+2,asset::EIL_GENERAL,std::move(scrambleKeys));
935+
setImageInfo(infos+1,asset::EIL_GENERAL,std::move(scrambleKeys));
937936
}
938937
{
939938
// TODO: maybe use the sample limit in the future to stop a converged render
940939
const auto maxSamples = sampleSequence->getSize()/(sizeof(uint32_t)*MaxDimensions);
941940
assert(maxSamples==MAX_ACCUMULATED_SAMPLES);
942941
// upload sequence to GPU (TODO: clip its size to the dimensions we'll actually use)
943942
auto gpubuf = m_driver->createFilledDeviceLocalGPUBufferOnDedMem(sampleSequence->getSize(),sampleSequence->getPointer());
944-
infos[3].desc = m_driver->createGPUBufferView(gpubuf.get(),asset::EF_R32G32B32_UINT); // TODO: maybe try to pack into 64bits?
943+
infos[2].desc = m_driver->createGPUBufferView(gpubuf.get(),asset::EF_R32G32B32_UINT); // TODO: maybe try to pack into 64bits?
945944
}
946-
setImageInfo(infos+4,asset::EIL_GENERAL,core::smart_refctd_ptr(m_accumulation));
947-
createEmptyInteropBufferAndSetUpInfo(infos+5,m_rayBuffer[0],raygenBufferSize);
948-
setBufferInfo(infos+6,m_rayCountBuffer);
945+
setImageInfo(infos+3,asset::EIL_GENERAL,core::smart_refctd_ptr(m_accumulation));
946+
createEmptyInteropBufferAndSetUpInfo(infos+4,m_rayBuffer[0],raygenBufferSize);
947+
setBufferInfo(infos+5,m_rayCountBuffer);
949948

950949
setDstSetAndDescTypesOnWrites(m_commonRaytracingDS[0].get(),writes,infos,{
951950
EDT_UNIFORM_BUFFER,
952-
EDT_STORAGE_BUFFER,
953951
EDT_STORAGE_IMAGE,
954952
EDT_UNIFORM_TEXEL_BUFFER,
955953
EDT_STORAGE_IMAGE,
@@ -958,7 +956,7 @@ void Renderer::init(const SAssetBundle& meshes, core::smart_refctd_ptr<ICPUBuffe
958956
});
959957
m_driver->updateDescriptorSets(descriptorUpdateCounts[1],writes,0u,nullptr);
960958
// set up second DS
961-
createEmptyInteropBufferAndSetUpInfo(infos+5,m_rayBuffer[1],raygenBufferSize);
959+
createEmptyInteropBufferAndSetUpInfo(infos+4,m_rayBuffer[1],raygenBufferSize);
962960
for (auto i=0u; i<descriptorUpdateCounts[1]; i++)
963961
writes[i].dstSet = m_commonRaytracingDS[1].get();
964962
m_driver->updateDescriptorSets(descriptorUpdateCounts[1],writes,0u,nullptr);

examples_tests/22.RaytracedAO/raytraceCommon.glsl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@ layout(set = 2, binding = 0, row_major) uniform StaticViewData
2424
StaticViewData_t staticViewData;
2525
};
2626
// rng
27-
layout(set = 2, binding = 2, rg32ui) uniform uimage2DArray scramblebuf;
28-
layout(set = 2, binding = 3) uniform usamplerBuffer sampleSequence;
27+
layout(set = 2, binding = 1, rg32ui) uniform uimage2DArray scramblebuf;
28+
layout(set = 2, binding = 2) uniform usamplerBuffer sampleSequence;
2929
// accumulation
30-
layout(set = 2, binding = 4, rg32ui) restrict uniform uimage2DArray accumulation;
30+
layout(set = 2, binding = 3, rg32ui) restrict uniform uimage2DArray accumulation;
3131
// ray data
3232
#include <nbl/builtin/glsl/ext/RadeonRays/ray.glsl>
33-
layout(set = 2, binding = 5, std430) restrict writeonly buffer SinkRays
33+
layout(set = 2, binding = 4, std430) restrict writeonly buffer SinkRays
3434
{
3535
nbl_glsl_ext_RadeonRays_ray sinkRays[];
3636
};
3737
#include <nbl/builtin/glsl/utils/indirect_commands.glsl>
38-
layout(set = 2, binding = 6) restrict coherent buffer RayCount // maybe remove coherent keyword
38+
layout(set = 2, binding = 5) restrict coherent buffer RayCount // maybe remove coherent keyword
3939
{
4040
uint rayCount[RAYCOUNT_N_BUFFERING];
4141
};

0 commit comments

Comments
 (0)