mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-20 19:07:01 +02:00
shader: correct DS float min/max operands and special values
Co-authored-by: shadowbeat070 <70843316+shadowbeat070@users.noreply.github.com>
This commit is contained in:
+13
-34
@@ -7741,40 +7741,18 @@ void TestNewShaderRecompilerDsAddtidTranslation() {
|
||||
CheckSpirvBinaryValidates(result.spirv);
|
||||
}
|
||||
|
||||
void TestNewShaderRecompilerDsFloatMinMaxTranslation() {
|
||||
const uint32_t shader[] = {
|
||||
EncodeDs0(0x12, 4), EncodeDs1Ex(0, 9, 7, 1), // ds_min_f32 v7, v9, v1
|
||||
EncodeDs0(0x13, 8), EncodeDs1Ex(0, 10, 8, 1), // ds_max_f32 v8, v10, v1
|
||||
0xbf810000u,
|
||||
};
|
||||
|
||||
auto options = MakeCompileOptions(ShaderType::Compute);
|
||||
options.dump_ir = true;
|
||||
|
||||
auto result = RecompileForTest(shader, options);
|
||||
Check((result.decoded_dump.find("ds_min_f32") != std::string::npos),
|
||||
"new decoder did not decode DS float min");
|
||||
Check((result.decoded_dump.find("ds_max_f32") != std::string::npos),
|
||||
"new decoder did not decode DS float max");
|
||||
Check((result.ir_dump.find("DsMinF32 null, v7, v1") != std::string::npos),
|
||||
"DS float min did not lower to explicit IR");
|
||||
Check((result.ir_dump.find("DsMaxF32 null, v8, v1") != std::string::npos),
|
||||
"DS float max did not lower to explicit IR");
|
||||
Check((result.ir_dump.find("v9") != std::string::npos),
|
||||
"DS float min did not retain DATA1 compare operand");
|
||||
Check((result.ir_dump.find("v10") != std::string::npos),
|
||||
"DS float max did not retain DATA1 compare operand");
|
||||
Check(SpirvContainsOpcode(result.spirv, 12),
|
||||
"SPIR-V binary does not contain OpExtInst");
|
||||
Check(SpirvContainsOpcode(result.spirv, 61),
|
||||
"SPIR-V binary does not contain OpLoad");
|
||||
Check(SpirvContainsOpcode(result.spirv, 62),
|
||||
"SPIR-V binary does not contain OpStore");
|
||||
Check(SpirvContainsOpcode(result.spirv, 65),
|
||||
"SPIR-V binary does not contain OpAccessChain");
|
||||
Check(SpirvContainsOpcode(result.spirv, 124),
|
||||
"SPIR-V binary does not contain OpBitcast");
|
||||
CheckSpirvBinaryValidates(result.spirv);
|
||||
void TestDsFloatMinMaxDecoder() {
|
||||
using namespace ShaderRecompiler::Decoder;
|
||||
for (bool max_value : {false, true}) {
|
||||
const uint32_t shader[] = {
|
||||
EncodeDs0(max_value ? 0x13 : 0x12, 4), EncodeDs1Ex(0, 250, 7, 1)};
|
||||
Instruction decoded;
|
||||
DecodeInstruction(shader, 0u, decoded);
|
||||
Check(decoded.opcode == (max_value ? Opcode::DS_MAX_F32 : Opcode::DS_MIN_F32) &&
|
||||
decoded.src_count == 2u && decoded.src0.reg == 1u &&
|
||||
decoded.src1.reg == 7u && decoded.offset == 4u,
|
||||
"DS float min/max must read only address and DATA0");
|
||||
}
|
||||
}
|
||||
|
||||
void TestNewShaderRecompilerCfgStraightLine() {
|
||||
@@ -14805,6 +14783,7 @@ int main() {
|
||||
// here.
|
||||
TestScalarAshrI64Decoder();
|
||||
TestImageAtomicWidthDecoder();
|
||||
TestDsFloatMinMaxDecoder();
|
||||
TestNewShaderDecoderArchitecture();
|
||||
TestImageAddressOperands();
|
||||
TestSopkCompareImmediateExtension();
|
||||
|
||||
Reference in New Issue
Block a user