summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/video_core/renderer_vulkan/vk_pipeline_cache.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
index d1f06ce50..17583249f 100644
--- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
@@ -768,12 +768,20 @@ std::unique_ptr<ComputePipeline> PipelineCache::CreateComputePipeline(
auto program{TranslateProgram(pools.inst, pools.block, env, cfg, host_info)};
- // Add support for bindless texture constant buffer
+ // Add support for bindless texture constant buffer only if needed
if (program.info.storage_buffers_descriptors.size() > 0) {
- Shader::ConstantBufferDescriptor desc;
- desc.index = 0;
- desc.count = 1;
- program.info.constant_buffer_descriptors.push_back(desc);
+ // Check if a constant buffer at index 0 already exists
+ const bool has_cb0 = std::any_of(program.info.constant_buffer_descriptors.begin(),
+ program.info.constant_buffer_descriptors.end(),
+ [](const auto& cb) { return cb.index == 0; });
+
+ // Only add if not already present
+ if (!has_cb0) {
+ Shader::ConstantBufferDescriptor desc;
+ desc.index = 0;
+ desc.count = 1;
+ program.info.constant_buffer_descriptors.push_back(desc);
+ }
}
const std::vector<u32> code{EmitSPIRV(profile, program)};