Use std::bitset for shader bit-iterations

Uses `std::bitset` for bool-uniforms and component-mask iteration:
https://en.cppreference.com/w/cpp/utility/bitset
This commit is contained in:
Wunkolo 2024-03-22 23:04:26 -07:00
parent 5284109fd4
commit 0015227f96
No known key found for this signature in database
3 changed files with 73 additions and 71 deletions

View file

@ -73,7 +73,7 @@ class ShaderInterpreterTest {
[[nodiscard]] std::array<std::array<Floats::f24, 4>, 96>& floatUniforms() const { return shader->floatUniforms; }
[[nodiscard]] std::array<std::array<u8, 4>, 4>& intUniforms() const { return shader->intUniforms; }
[[nodiscard]] u32& boolUniforms() const { return shader->boolUniform; }
[[nodiscard]] std::bitset<16>& boolUniforms() const { return shader->boolUniform; }
static std::unique_ptr<ShaderInterpreterTest> assembleTest(std::initializer_list<nihstro::InlineAsm> code) {
return std::make_unique<ShaderInterpreterTest>(code);
@ -346,7 +346,7 @@ SHADER_TEST_CASE("Address Register Offset", "[video_core][shader][shader_jit]")
}
// Bool uniforms(bools packed into an integer)
else if (i >= 0x70 && i < 0x80) {
shader->boolUniforms() |= (i >= 0x78) << (i - 0x70);
shader->boolUniforms()[i - 0x70] = (i >= 0x78);
}
}