shader: Handle out-of-bounds uniform access via address register. (#16)
This commit is contained in:
@ -333,8 +333,9 @@ 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,
|
// TODO: Verify hardware behavior of out-of-bounds register number.
|
||||||
"xyz"[address_register_index - 1]);
|
return fmt::format("({0} + address_registers.{1} < 96 ? uniforms.f[{0} + address_registers.{1}] : vec4(0))",
|
||||||
|
index, "xyz"[address_register_index - 1]);
|
||||||
}
|
}
|
||||||
return fmt::format("uniforms.f[{}]", index);
|
return fmt::format("uniforms.f[{}]", index);
|
||||||
default:
|
default:
|
||||||
|
Reference in New Issue
Block a user