mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-21 11:26:56 +02:00
Decode unsigned byte sources for SDWA half-float conversion
This commit is contained in:
@@ -19624,6 +19624,33 @@ TestCase VectorMinMaxF16Ops() {
|
||||
O::S_ENDPGM}};
|
||||
}
|
||||
|
||||
TestCase VectorCvtF16U16CapturedByteSource() {
|
||||
using O = ShaderOpcode;
|
||||
|
||||
constexpr std::array inputs = {0xff123456u, 0x80123456u, 0x00123456u};
|
||||
std::vector<u32> code;
|
||||
AppendVMovLiteral(&code, 16, 0xa5a55a5au);
|
||||
for (u32 i = 0; i < inputs.size(); i++) {
|
||||
AppendVMovU32(&code, 30, i * 4u);
|
||||
AppendBufferLoadDword(&code, 18, 30);
|
||||
// Captured shader 0x15082e211725205f: unsigned byte3 -> FP16 word0,
|
||||
// preserving word1 of v16.
|
||||
code.insert(code.end(), {0x7e20a0f9u, 0x00031412u});
|
||||
AppendStoreVgpr(&code, 16, i);
|
||||
}
|
||||
AppendEnd(&code);
|
||||
|
||||
TestCase test;
|
||||
test.name = "VectorCvtF16U16CapturedByteSource";
|
||||
test.code = std::move(code);
|
||||
test.initial.assign(inputs.begin(), inputs.end());
|
||||
test.expected = {0xa5a55bf8u, 0xa5a55800u, 0xa5a50000u};
|
||||
test.opcodes = {O::V_MOV_B32, O::BUFFER_LOAD_DWORD, O::V_CVT_F16_U16,
|
||||
O::BUFFER_STORE_DWORD, O::S_ENDPGM};
|
||||
test.required_spirv = {"OpBitFieldUExtract", "OpConvertUToF"};
|
||||
return test;
|
||||
}
|
||||
|
||||
TestCase VectorCvtU16F16Sdwa() {
|
||||
using O = ShaderOpcode;
|
||||
|
||||
@@ -27458,6 +27485,7 @@ std::vector<TestCase> MakeCases() {
|
||||
AddCase(CvtPkrtzF16F32SdwaAndOutputModifiers);
|
||||
AddCase(PackedMinMaxF16NanAndSignedZeroEdges);
|
||||
AddCase(VectorMinMaxF16Ops);
|
||||
AddCase(VectorCvtF16U16CapturedByteSource);
|
||||
AddCase(VectorCvtU16F16Sdwa);
|
||||
AddCase(NativeAndSdwa16BitDestinationWrites);
|
||||
AddCase(VectorMinMaxMed3F16Ops);
|
||||
|
||||
@@ -3466,6 +3466,13 @@ void TestNewShaderRecompilerCapturedVop1SdwaByteConvert() {
|
||||
Check(SpirvContainsOpcode(result.spirv, 112),
|
||||
"captured SDWA byte conversion did not emit OpConvertUToF");
|
||||
CheckSpirvBinaryValidates(result.spirv);
|
||||
|
||||
const uint32_t byte_sext[] = {0x7e20a0f9u, 0x000b1412u};
|
||||
ShaderRecompiler::Decoder::Instruction decoded;
|
||||
ShaderRecompiler::Decoder::DecodeInstruction(byte_sext, 0, decoded);
|
||||
Check(decoded.word_count == 2u &&
|
||||
decoded.opcode == ShaderRecompiler::Decoder::Opcode::UNSUPPORTED,
|
||||
"V_CVT_F16_U16 accepted unimplemented SDWA byte sign extension");
|
||||
}
|
||||
|
||||
void TestNewShaderRecompilerVop1SdwaNotDestination() {
|
||||
|
||||
Reference in New Issue
Block a user