Skip to content

Commit 9095a31

Browse files
committed
Disable dynamic buffer offsets for buffer views in Vulkan because of offset duplication in descriptor
1 parent e0f15d7 commit 9095a31

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Modules/Graphics/RHI/Vulkan/Sources/Methane/Graphics/Vulkan/ProgramBindings.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ Vulkan implementation of the program bindings interface.
3535

3636
#include <algorithm>
3737

38+
#define DYNAMIC_BUFFER_OFFSETS_ENABLED 0
39+
3840
namespace Methane::Graphics::Vulkan
3941
{
4042

@@ -265,7 +267,8 @@ void ProgramBindings::UpdateDynamicDescriptorOffsets()
265267
(const Rhi::ProgramArgument&, const ArgumentBinding& argument_binding)
266268
{
267269
const Rhi::ProgramArgumentAccessor& program_argument_accessor = argument_binding.GetSettings().argument;
268-
if (!program_argument_accessor.IsAddressable())
270+
if (!program_argument_accessor.IsAddressable() &&
271+
!program_argument_accessor.IsRootConstant())
269272
return;
270273

271274
const Program::DescriptorSetLayoutInfo& layout_info = program.GetDescriptorSetLayoutInfo(program_argument_accessor.GetAccessorType());
@@ -275,9 +278,13 @@ void ProgramBindings::UpdateDynamicDescriptorOffsets()
275278
dynamic_offsets.clear();
276279

277280
const Rhi::ResourceViews& resource_views = argument_binding.GetResourceViews();
281+
#if DYNAMIC_BUFFER_OFFSETS_ENABLED
278282
std::transform(resource_views.begin(), resource_views.end(), std::back_inserter(dynamic_offsets),
279283
[](const Rhi::IResource::View& resource_view)
280284
{ return resource_view.GetOffset(); });
285+
#else
286+
dynamic_offsets.resize(resource_views.size(), 0U);
287+
#endif
281288
});
282289

283290
m_dynamic_offsets.clear();

0 commit comments

Comments
 (0)