mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-20 10:56:58 +02:00
refactor(shader): remove register-state compatibility paths
This commit is contained in:
@@ -7,10 +7,7 @@ namespace Libs::Graphics::ShaderRecompiler::IR {
|
||||
enum class ScalarReg : uint16_t {};
|
||||
enum class VectorReg : uint16_t {};
|
||||
|
||||
// Architectural SGPRs occupy the low range. The current shader-only migration also accepts the
|
||||
// scalar shadow registers produced by Kyty's pre-existing read-lane pass; that pass disappears
|
||||
// once read-lane elimination operates on the SSA graph.
|
||||
constexpr uint32_t NumScalarRegs = 512;
|
||||
constexpr uint32_t NumScalarRegs = 106;
|
||||
constexpr uint32_t NumVectorRegs = 256;
|
||||
|
||||
constexpr uint32_t RegIndex(ScalarReg reg) {
|
||||
|
||||
@@ -12,20 +12,32 @@ using ShaderError::Fail;
|
||||
|
||||
namespace {
|
||||
|
||||
bool IsRegisterGet(ValueOpcode opcode) {
|
||||
bool IsRegisterStatePseudo(ValueOpcode opcode) {
|
||||
switch (opcode) {
|
||||
case ValueOpcode::GetThreadBitScalarRegister:
|
||||
case ValueOpcode::SetThreadBitScalarRegister:
|
||||
case ValueOpcode::GetScalarRegister:
|
||||
case ValueOpcode::SetScalarRegister:
|
||||
case ValueOpcode::GetVectorRegister:
|
||||
case ValueOpcode::SetVectorRegister:
|
||||
case ValueOpcode::GetGotoVariable:
|
||||
case ValueOpcode::SetGotoVariable:
|
||||
case ValueOpcode::GetScc:
|
||||
case ValueOpcode::SetScc:
|
||||
case ValueOpcode::GetExec:
|
||||
case ValueOpcode::SetExec:
|
||||
case ValueOpcode::GetExecLo:
|
||||
case ValueOpcode::SetExecLo:
|
||||
case ValueOpcode::GetExecHi:
|
||||
case ValueOpcode::SetExecHi:
|
||||
case ValueOpcode::GetVcc:
|
||||
case ValueOpcode::SetVcc:
|
||||
case ValueOpcode::GetVccLo:
|
||||
case ValueOpcode::SetVccLo:
|
||||
case ValueOpcode::GetVccHi:
|
||||
case ValueOpcode::GetM0: return true;
|
||||
case ValueOpcode::SetVccHi:
|
||||
case ValueOpcode::GetM0:
|
||||
case ValueOpcode::SetM0: return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
@@ -137,8 +149,8 @@ bool ValidateValueProgram(const ValueProgram& program, bool require_ssa, std::st
|
||||
if (inst.Parent() != block) {
|
||||
return Fail(error, "value IR instruction has the wrong parent block");
|
||||
}
|
||||
if (require_ssa && IsRegisterGet(inst.GetOpcode())) {
|
||||
return Fail(error, fmt::format("register getter {} survived SSA rewrite",
|
||||
if (require_ssa && IsRegisterStatePseudo(inst.GetOpcode())) {
|
||||
return Fail(error, fmt::format("register-state pseudo {} survived SSA rewrite",
|
||||
ValueOpcodeName(inst.GetOpcode())));
|
||||
}
|
||||
if (inst.GetOpcode() != ValueOpcode::Phi && inst.GetOpcode() != ValueOpcode::Identity &&
|
||||
|
||||
@@ -74,8 +74,6 @@ bool HasSideEffects(ValueOpcode opcode) {
|
||||
switch (opcode) {
|
||||
case ValueOpcode::Reference:
|
||||
case ValueOpcode::ReferenceU32:
|
||||
case ValueOpcode::Prologue:
|
||||
case ValueOpcode::Epilogue:
|
||||
case ValueOpcode::StoreAddressU8:
|
||||
case ValueOpcode::StoreAddressU16:
|
||||
case ValueOpcode::StoreAddressU32:
|
||||
|
||||
@@ -7,8 +7,6 @@ VALUE_OPCODE(Reference, Void, U1)
|
||||
VALUE_OPCODE(ReferenceU32, Void, U32)
|
||||
|
||||
// Translation and register-state pseudo operations.
|
||||
VALUE_OPCODE(Prologue, Void)
|
||||
VALUE_OPCODE(Epilogue, Void)
|
||||
VALUE_OPCODE(GetUserData, U32, ScalarReg)
|
||||
VALUE_OPCODE(GetShaderBase, U64)
|
||||
VALUE_OPCODE(GetBuiltin, U32, U32, U32)
|
||||
|
||||
Reference in New Issue
Block a user