mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-27 09:12:46 +01:00
Shaders: Explicitly conform to PICA semantics in MAX/MIN
This commit is contained in:
parent
76247170df
commit
082b74fa24
2 changed files with 10 additions and 2 deletions
|
@ -177,7 +177,10 @@ void RunInterpreter(UnitState<Debug>& state) {
|
||||||
if (!swizzle.DestComponentEnabled(i))
|
if (!swizzle.DestComponentEnabled(i))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
dest[i] = std::max(src1[i], src2[i]);
|
// NOTE: Exact form required to match NaN semantics to hardware:
|
||||||
|
// max(0, NaN) -> NaN
|
||||||
|
// max(NaN, 0) -> 0
|
||||||
|
dest[i] = (src1[i] > src2[i]) ? src1[i] : src2[i];
|
||||||
}
|
}
|
||||||
Record<DebugDataRecord::DEST_OUT>(state.debug, iteration, dest);
|
Record<DebugDataRecord::DEST_OUT>(state.debug, iteration, dest);
|
||||||
break;
|
break;
|
||||||
|
@ -190,7 +193,10 @@ void RunInterpreter(UnitState<Debug>& state) {
|
||||||
if (!swizzle.DestComponentEnabled(i))
|
if (!swizzle.DestComponentEnabled(i))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
dest[i] = std::min(src1[i], src2[i]);
|
// NOTE: Exact form required to match NaN semantics to hardware:
|
||||||
|
// min(0, NaN) -> NaN
|
||||||
|
// min(NaN, 0) -> 0
|
||||||
|
dest[i] = (src1[i] < src2[i]) ? src1[i] : src2[i];
|
||||||
}
|
}
|
||||||
Record<DebugDataRecord::DEST_OUT>(state.debug, iteration, dest);
|
Record<DebugDataRecord::DEST_OUT>(state.debug, iteration, dest);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -467,6 +467,7 @@ void JitCompiler::Compile_FLR(Instruction instr) {
|
||||||
void JitCompiler::Compile_MAX(Instruction instr) {
|
void JitCompiler::Compile_MAX(Instruction instr) {
|
||||||
Compile_SwizzleSrc(instr, 1, instr.common.src1, SRC1);
|
Compile_SwizzleSrc(instr, 1, instr.common.src1, SRC1);
|
||||||
Compile_SwizzleSrc(instr, 2, instr.common.src2, SRC2);
|
Compile_SwizzleSrc(instr, 2, instr.common.src2, SRC2);
|
||||||
|
// SSE semantics match PICA200 ones: In case of NaN, SRC2 is returned.
|
||||||
MAXPS(SRC1, R(SRC2));
|
MAXPS(SRC1, R(SRC2));
|
||||||
Compile_DestEnable(instr, SRC1);
|
Compile_DestEnable(instr, SRC1);
|
||||||
}
|
}
|
||||||
|
@ -474,6 +475,7 @@ void JitCompiler::Compile_MAX(Instruction instr) {
|
||||||
void JitCompiler::Compile_MIN(Instruction instr) {
|
void JitCompiler::Compile_MIN(Instruction instr) {
|
||||||
Compile_SwizzleSrc(instr, 1, instr.common.src1, SRC1);
|
Compile_SwizzleSrc(instr, 1, instr.common.src1, SRC1);
|
||||||
Compile_SwizzleSrc(instr, 2, instr.common.src2, SRC2);
|
Compile_SwizzleSrc(instr, 2, instr.common.src2, SRC2);
|
||||||
|
// SSE semantics match PICA200 ones: In case of NaN, SRC2 is returned.
|
||||||
MINPS(SRC1, R(SRC2));
|
MINPS(SRC1, R(SRC2));
|
||||||
Compile_DestEnable(instr, SRC1);
|
Compile_DestEnable(instr, SRC1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue