From c65c8ac45e1e795549942cde6d455a0437635f31 Mon Sep 17 00:00:00 2001 From: Zephyron Date: Wed, 8 Jan 2025 19:13:03 +1000 Subject: [PATCH] vulkan: Add bindless texture constant buffer support in compute pipeline Add support for bindless texture constant buffers in the compute pipeline creation process. When storage buffer descriptors are present, create a constant buffer descriptor to handle bindless textures. This fixes the "Failed to track bindless texture constant buffer" error. Changes: - Add constant buffer descriptor with index 0 and count 1 when storage buffers are present - Place descriptor creation before SPIR-V code generation to ensure proper shader compilation This resolves issues with bindless texture access in compute shaders. --- src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index 30e0ee6ec..d1f06ce50 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp @@ -767,6 +767,15 @@ std::unique_ptr PipelineCache::CreateComputePipeline( } auto program{TranslateProgram(pools.inst, pools.block, env, cfg, host_info)}; + + // Add support for bindless texture constant buffer + 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); + } + const std::vector code{EmitSPIRV(profile, program)}; device.SaveShader(code); vk::ShaderModule spv_module{BuildShader(device, code)};