mirror of
https://github.com/PabloMK7/citra
synced 2024-11-15 05:08:23 +00:00
shader: Fix address register offset behavior in GLSL. (#6920)
This commit is contained in:
parent
d2260bafef
commit
81a5e2355a
1 changed files with 9 additions and 1 deletions
|
@ -334,7 +334,7 @@ private:
|
|||
return fmt::format("reg_tmp{}", index);
|
||||
case RegisterType::FloatUniform:
|
||||
if (address_register_index != 0) {
|
||||
return fmt::format("uniforms.f[{} + address_registers.{}]", index,
|
||||
return fmt::format("get_offset_register({}, address_registers.{})", index,
|
||||
"xyz"[address_register_index - 1]);
|
||||
}
|
||||
return fmt::format("uniforms.f[{}]", index);
|
||||
|
@ -835,6 +835,14 @@ private:
|
|||
#endif
|
||||
}
|
||||
|
||||
shader.AddLine("vec4 get_offset_register(int base_index, int offset) {{");
|
||||
++shader.scope;
|
||||
shader.AddLine("int fixed_offset = offset >= -128 && offset <= 127 ? offset : 0;");
|
||||
shader.AddLine("uint index = uint((base_index + fixed_offset) & 0x7F);");
|
||||
shader.AddLine("return index < 96u ? uniforms.f[index] : vec4(1.0);");
|
||||
--shader.scope;
|
||||
shader.AddLine("}}\n");
|
||||
|
||||
// Add declarations for registers
|
||||
shader.AddLine("bvec2 conditional_code = bvec2(false);");
|
||||
shader.AddLine("ivec3 address_registers = ivec3(0);");
|
||||
|
|
Loading…
Reference in a new issue