mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-08-19 06:52:36 +00:00
shader_recompiler: remove legacy SPIR-V emitter
This commit is contained in:
@@ -4142,79 +4142,6 @@ void TestNewShaderRecompilerImageSampleA16ExceptionComponents() {
|
||||
}
|
||||
}
|
||||
|
||||
void TestNewShaderRecompilerImageSampleA16Rdna2AddressOrder() {
|
||||
namespace Decoder = Libs::Graphics::ShaderRecompiler::Decoder;
|
||||
namespace Emitter = Libs::Graphics::ShaderRecompiler::Spirv::Emitter;
|
||||
namespace IR = Libs::Graphics::ShaderRecompiler::IR;
|
||||
|
||||
auto make_inst = [](uint32_t flags) {
|
||||
IR::Instruction inst{};
|
||||
inst.src[0] = Emitter::MakeRegisterOperand(IR::RegisterFile::Vector, 20);
|
||||
inst.memory.image_sample_flags = flags | Decoder::ImageSampleFlagA16;
|
||||
inst.memory.image_address_components = 5;
|
||||
return inst;
|
||||
};
|
||||
auto check_vgpr = [](const IR::Operand &operand, uint32_t expected,
|
||||
const char *message) {
|
||||
Check(operand.kind == IR::OperandKind::Register &&
|
||||
operand.reg.file == IR::RegisterFile::Vector &&
|
||||
operand.reg.index == expected,
|
||||
message);
|
||||
};
|
||||
|
||||
{
|
||||
auto inst = make_inst(Decoder::ImageSampleFlagBias |
|
||||
Decoder::ImageSampleFlagCompare);
|
||||
const auto layout =
|
||||
Emitter::MakeImageSampleLayout(inst, Emitter::ImageViewKind::Dim2D);
|
||||
Check(layout.bias == 0u,
|
||||
"RDNA2 sample_c_b A16 bias must precede PCF reference");
|
||||
Check(layout.dref == 1u,
|
||||
"RDNA2 sample_c_b A16 PCF reference must follow bias");
|
||||
Check(layout.coord == 2u,
|
||||
"RDNA2 sample_c_b A16 body must follow bias and PCF");
|
||||
Check(Emitter::ImageAddressHalfComponent(inst, layout.bias) == 0u,
|
||||
"A16 bias should use the first packed half");
|
||||
Check(Emitter::ImageAddressHalfComponent(inst, layout.dref) == 2u,
|
||||
"32-bit PCF reference must align to the next VGPR after A16 bias");
|
||||
Check(Emitter::ImageAddressHalfComponent(inst, layout.coord) == 4u,
|
||||
"A16 coordinates must start after the aligned PCF reference");
|
||||
check_vgpr(Emitter::ImageAddressOperand(inst, inst.src[0], layout.bias), 20,
|
||||
"A16 sample_c_b bias should read v20");
|
||||
check_vgpr(Emitter::ImageAddressOperand(inst, inst.src[0], layout.dref), 21,
|
||||
"A16 sample_c_b PCF reference should read v21");
|
||||
check_vgpr(Emitter::ImageAddressOperand(inst, inst.src[0], layout.coord),
|
||||
22, "A16 sample_c_b x/y coordinates should start in v22");
|
||||
}
|
||||
|
||||
{
|
||||
auto inst = make_inst(Decoder::ImageSampleFlagOffset |
|
||||
Decoder::ImageSampleFlagBias |
|
||||
Decoder::ImageSampleFlagCompare);
|
||||
const auto layout =
|
||||
Emitter::MakeImageSampleLayout(inst, Emitter::ImageViewKind::Dim2D);
|
||||
Check(layout.offset == 0u && layout.bias == 1u && layout.dref == 2u &&
|
||||
layout.coord == 3u,
|
||||
"RDNA2 sample_c_b_o order must be offset, bias, PCF, body");
|
||||
Check(Emitter::ImageAddressHalfComponent(inst, layout.offset) == 0u,
|
||||
"texel offset should stay a packed 32-bit VGPR");
|
||||
Check(Emitter::ImageAddressHalfComponent(inst, layout.bias) == 2u,
|
||||
"A16 bias should follow the 32-bit texel offset");
|
||||
Check(Emitter::ImageAddressHalfComponent(inst, layout.dref) == 4u,
|
||||
"PCF reference should align after A16 bias");
|
||||
Check(Emitter::ImageAddressHalfComponent(inst, layout.coord) == 6u,
|
||||
"A16 coordinates should start after offset, bias, and PCF");
|
||||
check_vgpr(Emitter::ImageAddressOperand(inst, inst.src[0], layout.offset),
|
||||
20, "A16 sample_c_b_o offset should read v20");
|
||||
check_vgpr(Emitter::ImageAddressOperand(inst, inst.src[0], layout.bias), 21,
|
||||
"A16 sample_c_b_o bias should read v21");
|
||||
check_vgpr(Emitter::ImageAddressOperand(inst, inst.src[0], layout.dref), 22,
|
||||
"A16 sample_c_b_o PCF reference should read v22");
|
||||
check_vgpr(Emitter::ImageAddressOperand(inst, inst.src[0], layout.coord),
|
||||
23, "A16 sample_c_b_o x/y coordinates should start in v23");
|
||||
}
|
||||
}
|
||||
|
||||
void TestNewShaderRecompilerImageLoadA16UintCoords() {
|
||||
const uint32_t shader[] = {
|
||||
EncodeMimg0(0x00, 0x3),
|
||||
|
||||
Reference in New Issue
Block a user