mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-14 17:28:52 -05:00
shader_compiler: support const buffer indirect addressing in GLSL
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user