diff --git a/src/shader_recompiler/frontend/copy_shader.cpp b/src/shader_recompiler/frontend/copy_shader.cpp index 4b5869e1d..152ba196b 100644 --- a/src/shader_recompiler/frontend/copy_shader.cpp +++ b/src/shader_recompiler/frontend/copy_shader.cpp @@ -14,7 +14,7 @@ CopyShaderData ParseCopyShader(std::span code) { constexpr u32 token_mov_vcchi = 0xBEEB03FF; ASSERT_MSG(code[0] == token_mov_vcchi, "First instruction is not s_mov_b32 vcc_hi, #imm"); - std::array offsets{}; + std::array offsets{}; offsets.fill(-1); std::array sources{}; @@ -52,6 +52,8 @@ CopyShaderData ParseCopyShader(std::span code) { break; } case Gcn::Opcode::BUFFER_LOAD_DWORD: { + ASSERT_MSG(inst.src[1].code < offsets.size(), + "offsets array for geometry shaders is too short"); offsets[inst.src[1].code] = inst.control.mubuf.offset; if (inst.src[3].field != Gcn::OperandField::ConstZero) { const u32 index = inst.src[3].code; @@ -65,7 +67,7 @@ CopyShaderData ParseCopyShader(std::span code) { } } - if (last_attr != IR::Attribute::Position0) { + if (!IsPosition(last_attr)) { data.num_attrs = static_cast(last_attr) - static_cast(IR::Attribute::Param0) + 1; const auto it = data.attr_map.begin(); const u32 comp_stride = std::next(it)->first - it->first; diff --git a/src/video_core/amdgpu/pm4_cmds.h b/src/video_core/amdgpu/pm4_cmds.h index 23c1b8f21..3df73f3d6 100644 --- a/src/video_core/amdgpu/pm4_cmds.h +++ b/src/video_core/amdgpu/pm4_cmds.h @@ -699,7 +699,7 @@ struct PM4CmdWaitRegMem { struct PM4CmdWriteData { PM4Type3Header header; union { - BitField<8, 11, u32> dst_sel; + BitField<8, 4, u32> dst_sel; BitField<16, 1, u32> wr_one_addr; BitField<20, 1, u32> wr_confirm; BitField<30, 1, u32> engine_sel;