mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-14 17:10:06 +00:00
shader: Fix address register offset behavior in GLSL. (#6920)
This commit is contained in:
parent
d2260bafef
commit
81a5e2355a
@ -334,7 +334,7 @@ private:
|
|||||||
return fmt::format("reg_tmp{}", index);
|
return fmt::format("reg_tmp{}", index);
|
||||||
case RegisterType::FloatUniform:
|
case RegisterType::FloatUniform:
|
||||||
if (address_register_index != 0) {
|
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]);
|
"xyz"[address_register_index - 1]);
|
||||||
}
|
}
|
||||||
return fmt::format("uniforms.f[{}]", index);
|
return fmt::format("uniforms.f[{}]", index);
|
||||||
@ -835,6 +835,14 @@ private:
|
|||||||
#endif
|
#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
|
// Add declarations for registers
|
||||||
shader.AddLine("bvec2 conditional_code = bvec2(false);");
|
shader.AddLine("bvec2 conditional_code = bvec2(false);");
|
||||||
shader.AddLine("ivec3 address_registers = ivec3(0);");
|
shader.AddLine("ivec3 address_registers = ivec3(0);");
|
||||||
|
Loading…
Reference in New Issue
Block a user