diff --git a/src/graphics/shader/recompiler/ir/passes/SrtWalker.cpp b/src/graphics/shader/recompiler/ir/passes/SrtWalker.cpp index f799257a6..77a7c194b 100644 --- a/src/graphics/shader/recompiler/ir/passes/SrtWalker.cpp +++ b/src/graphics/shader/recompiler/ir/passes/SrtWalker.cpp @@ -125,6 +125,7 @@ bool IsRuntimeUniformOp(ValueOpcode op) { case ValueOpcode::ULessThan32: case ValueOpcode::IEqual32: case ValueOpcode::UGreaterThan32: + case ValueOpcode::SGreaterThanEqual32: case ValueOpcode::INotEqual32: case ValueOpcode::LogicalOr: case ValueOpcode::LogicalAnd: @@ -930,6 +931,13 @@ private: return true; } return false; + case ValueOpcode::SGreaterThanEqual32: + if (binary()) { + result = std::bit_cast(static_cast(a)) >= + std::bit_cast(static_cast(b)); + return true; + } + return false; case ValueOpcode::LogicalAnd: if (binary()) { result = (a != 0u) && (b != 0u); diff --git a/tests/ResourceTrackingTests.cpp b/tests/ResourceTrackingTests.cpp index cd8de932e..87cf3a922 100644 --- a/tests/ResourceTrackingTests.cpp +++ b/tests/ResourceTrackingTests.cpp @@ -1246,7 +1246,7 @@ ResourcePlan ConditionalSamplerPlan(bool diamond, bool reverse, bool reverse_phi flag = fixture.Emit(ValueOpcode::LaneId); } fixture.program.block_info[0].condition = - fixture.Emit(ValueOpcode::IEqual32, {flag, Value(0u)}); + fixture.Emit(ValueOpcode::SGreaterThanEqual32, {flag, Value(0u)}); if (writable) { MemoryInfo memory; memory.kind = ResourceKind::Buffer; @@ -1324,9 +1324,10 @@ void TestConditionalSamplerPhi() { .userdata = &memory, .read_specialization_memory = ReadLinearTestMemory}; - for (uint32_t flag = 0; flag < 2; ++flag) { - memory.words[(0x1000 + 196) / 4] = flag; - const uint32_t first = (flag != 0u) != reverse ? 480 / 4 : 448 / 4; + // Sampler selection compares a signed value against zero. + for (const auto flag : {-1, 0, 1, INT32_MIN, INT32_MAX}) { + memory.words[(0x1000 + 196) / 4] = std::bit_cast(flag); + const uint32_t first = (flag < 0) != reverse ? 480 / 4 : 448 / 4; memory.fail_address = 0x1000 + (first == 448 / 4 ? 480u : 448u); DescriptorValue selected; Check(EvaluateDescriptorSource(plan, source, runtime, selected),