shader_compiler: support const buffer indirect addressing in GLSL
This commit is contained in:
parent
a45baa0e78
commit
7d5a38ea6c
4 changed files with 38 additions and 9 deletions
|
@ -359,6 +359,7 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile
|
|||
header += "layout(location=0) uniform vec4 scaling;";
|
||||
}
|
||||
DefineConstantBuffers(bindings);
|
||||
DefineConstantBufferIndirect();
|
||||
DefineStorageBuffers(bindings);
|
||||
SetupImages(bindings);
|
||||
SetupTextures(bindings);
|
||||
|
@ -436,6 +437,24 @@ void EmitContext::DefineConstantBuffers(Bindings& bindings) {
|
|||
}
|
||||
}
|
||||
|
||||
void EmitContext::DefineConstantBufferIndirect() {
|
||||
if (!info.uses_cbuf_indirect) {
|
||||
return;
|
||||
}
|
||||
|
||||
header += profile.has_gl_cbuf_ftou_bug ? "uvec4 " : "vec4 ";
|
||||
header += "GetCbufIndirect(uint binding, uint offset){"
|
||||
"switch(binding){"
|
||||
"default:";
|
||||
|
||||
for (const auto& desc : info.constant_buffer_descriptors) {
|
||||
header +=
|
||||
fmt::format("case {}:return {}_cbuf{}[offset];", desc.index, stage_name, desc.index);
|
||||
}
|
||||
|
||||
header += "}}";
|
||||
}
|
||||
|
||||
void EmitContext::DefineStorageBuffers(Bindings& bindings) {
|
||||
if (info.storage_buffers_descriptors.empty()) {
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue