mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-28 13:56:59 +01:00
Fix signed sampler comparisons
This commit is contained in:
@@ -125,6 +125,7 @@ bool IsRuntimeUniformOp(ValueOpcode op) {
|
|||||||
case ValueOpcode::ULessThan32:
|
case ValueOpcode::ULessThan32:
|
||||||
case ValueOpcode::IEqual32:
|
case ValueOpcode::IEqual32:
|
||||||
case ValueOpcode::UGreaterThan32:
|
case ValueOpcode::UGreaterThan32:
|
||||||
|
case ValueOpcode::SGreaterThanEqual32:
|
||||||
case ValueOpcode::INotEqual32:
|
case ValueOpcode::INotEqual32:
|
||||||
case ValueOpcode::LogicalOr:
|
case ValueOpcode::LogicalOr:
|
||||||
case ValueOpcode::LogicalAnd:
|
case ValueOpcode::LogicalAnd:
|
||||||
@@ -930,6 +931,13 @@ private:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
case ValueOpcode::SGreaterThanEqual32:
|
||||||
|
if (binary()) {
|
||||||
|
result = std::bit_cast<int32_t>(static_cast<uint32_t>(a)) >=
|
||||||
|
std::bit_cast<int32_t>(static_cast<uint32_t>(b));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
case ValueOpcode::LogicalAnd:
|
case ValueOpcode::LogicalAnd:
|
||||||
if (binary()) {
|
if (binary()) {
|
||||||
result = (a != 0u) && (b != 0u);
|
result = (a != 0u) && (b != 0u);
|
||||||
|
|||||||
@@ -1246,7 +1246,7 @@ ResourcePlan ConditionalSamplerPlan(bool diamond, bool reverse, bool reverse_phi
|
|||||||
flag = fixture.Emit(ValueOpcode::LaneId);
|
flag = fixture.Emit(ValueOpcode::LaneId);
|
||||||
}
|
}
|
||||||
fixture.program.block_info[0].condition =
|
fixture.program.block_info[0].condition =
|
||||||
fixture.Emit(ValueOpcode::IEqual32, {flag, Value(0u)});
|
fixture.Emit(ValueOpcode::SGreaterThanEqual32, {flag, Value(0u)});
|
||||||
if (writable) {
|
if (writable) {
|
||||||
MemoryInfo memory;
|
MemoryInfo memory;
|
||||||
memory.kind = ResourceKind::Buffer;
|
memory.kind = ResourceKind::Buffer;
|
||||||
@@ -1324,9 +1324,10 @@ void TestConditionalSamplerPhi() {
|
|||||||
.userdata = &memory,
|
.userdata = &memory,
|
||||||
.read_specialization_memory =
|
.read_specialization_memory =
|
||||||
ReadLinearTestMemory};
|
ReadLinearTestMemory};
|
||||||
for (uint32_t flag = 0; flag < 2; ++flag) {
|
// Sampler selection compares a signed value against zero.
|
||||||
memory.words[(0x1000 + 196) / 4] = flag;
|
for (const auto flag : {-1, 0, 1, INT32_MIN, INT32_MAX}) {
|
||||||
const uint32_t first = (flag != 0u) != reverse ? 480 / 4 : 448 / 4;
|
memory.words[(0x1000 + 196) / 4] = std::bit_cast<uint32_t>(flag);
|
||||||
|
const uint32_t first = (flag < 0) != reverse ? 480 / 4 : 448 / 4;
|
||||||
memory.fail_address = 0x1000 + (first == 448 / 4 ? 480u : 448u);
|
memory.fail_address = 0x1000 + (first == 448 / 4 ? 480u : 448u);
|
||||||
DescriptorValue selected;
|
DescriptorValue selected;
|
||||||
Check(EvaluateDescriptorSource(plan, source, runtime, selected),
|
Check(EvaluateDescriptorSource(plan, source, runtime, selected),
|
||||||
|
|||||||
Reference in New Issue
Block a user