shader: support DS_WRITE_B8_D16_HI (#794)

Decode GFX10 DS opcode 0xa0 as DS_WRITE_B8_D16_HI (next to
DS_WRITE_B16_D16_HI at 0xa1) and lower it through the existing 8-bit
shared-memory write. The stored byte is bits 23:16 of the data VGPR,
selected with SDWA BYTE_2 on src1.

Add captured-instruction decode coverage (from GTA V, PPSA04264) and a
runtime regression that writes one byte of a distinctive source value
into a pre-filled LDS dword.
This commit is contained in:
Deniz ŞAHİN
2026-09-23 23:44:39 +03:00
committed by GitHub
parent 569ec04d1a
commit fc86509aac
6 changed files with 60 additions and 1 deletions
+17
View File
@@ -4458,6 +4458,23 @@ void TestNewShaderDecoderArchitecture() {
d16_hi_write.src1.sdwa_sel == 5u,
"DS decoder rejected the captured high-half D16 write");
// Captured from GTA V (PPSA04264) compute shader, pc 0x1598.
const uint32_t d16_hi_byte_write_ds[] = {0xda800200u, 0x00001413u};
Instruction d16_hi_byte_write;
ShaderRecompiler::Decoder::DecodeInstruction(d16_hi_byte_write_ds, 0u,
d16_hi_byte_write);
Check(d16_hi_byte_write.family == Family::DS &&
d16_hi_byte_write.opcode == Opcode::DS_WRITE_B8_D16_HI &&
d16_hi_byte_write.word_count == 2u &&
d16_hi_byte_write.src_count == 2u &&
d16_hi_byte_write.data_dwords == 1u &&
d16_hi_byte_write.data_bits == 8u &&
d16_hi_byte_write.offset == 0x200u && !d16_hi_byte_write.gds &&
d16_hi_byte_write.src0.reg == 19u &&
d16_hi_byte_write.src1.reg == 20u &&
d16_hi_byte_write.src1.sdwa_sel == 2u,
"DS decoder rejected the captured high-half byte write");
constexpr uint32_t packed_source_selectors[][2] = {
{0xcc0e0000u, 0x0c0a0300u}, // Source 0: instruction bit 59.
{0xcc0e0000u, 0x140a0300u}, // Source 1: instruction bit 60.