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.
This commit is contained in:
Zephyron 2025-01-08 19:13:03 +10:00
parent dae1524eb5
commit c65c8ac45e
No known key found for this signature in database
GPG key ID: 8DA271B6A74353F1

View file

@ -767,6 +767,15 @@ std::unique_ptr<ComputePipeline> PipelineCache::CreateComputePipeline(
} }
auto program{TranslateProgram(pools.inst, pools.block, env, cfg, host_info)}; 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<u32> code{EmitSPIRV(profile, program)}; const std::vector<u32> code{EmitSPIRV(profile, program)};
device.SaveShader(code); device.SaveShader(code);
vk::ShaderModule spv_module{BuildShader(device, code)}; vk::ShaderModule spv_module{BuildShader(device, code)};