mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-12-10 13:48:40 +00:00
shader_recompiler: Support for more offset layouts (#1270)
This commit is contained in:
@@ -15,18 +15,18 @@ CopyShaderData ParseCopyShader(const std::span<const u32>& code) {
|
||||
ASSERT_MSG(code[0] == token_mov_vcchi, "First instruction is not s_mov_b32 vcc_hi, #imm");
|
||||
|
||||
std::array<s32, 32> offsets{};
|
||||
std::fill(offsets.begin(), offsets.end(), -1);
|
||||
offsets.fill(-1);
|
||||
|
||||
std::array<s32, 256> sources{};
|
||||
sources.fill(-1);
|
||||
|
||||
CopyShaderData data{};
|
||||
Gcn::OperandField sgpr{};
|
||||
auto last_attr{IR::Attribute::Position0};
|
||||
s32 soffset{0};
|
||||
while (!code_slice.atEnd()) {
|
||||
auto inst = decoder.decodeInstruction(code_slice);
|
||||
switch (inst.opcode) {
|
||||
case Gcn::Opcode::S_MOVK_I32: {
|
||||
sgpr = inst.dst[0].field;
|
||||
soffset = inst.control.sopk.simm;
|
||||
sources[inst.dst[0].code] = inst.control.sopk.simm;
|
||||
break;
|
||||
}
|
||||
case Gcn::Opcode::EXP: {
|
||||
@@ -46,8 +46,9 @@ CopyShaderData ParseCopyShader(const std::span<const u32>& code) {
|
||||
case Gcn::Opcode::BUFFER_LOAD_DWORD: {
|
||||
offsets[inst.src[1].code] = inst.control.mubuf.offset;
|
||||
if (inst.src[3].field != Gcn::OperandField::ConstZero) {
|
||||
ASSERT(inst.src[3].field == sgpr);
|
||||
offsets[inst.src[1].code] += soffset;
|
||||
const u32 index = inst.src[3].code;
|
||||
ASSERT(sources[index] != -1);
|
||||
offsets[inst.src[1].code] += sources[index];
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -59,6 +60,7 @@ CopyShaderData ParseCopyShader(const std::span<const u32>& code) {
|
||||
if (last_attr != IR::Attribute::Position0) {
|
||||
data.num_attrs = static_cast<u32>(last_attr) - static_cast<u32>(IR::Attribute::Param0) + 1;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user