Specific DXIL disassembly handling for WaveActiveOp

After
  int _WaveActiveOp11 = WaveActiveSum(_WaveGetLaneIndex); // Unsigned

Before
  int _WaveActiveOp11 = WaveActiveOp(/*value*/ _WaveGetLaneIndex, /*op*/ 0, /*sop*/ 1);
This commit is contained in:
Jake Turner
2025-04-03 15:31:11 +01:00
parent 88752e2c20
commit 8eba23875e
3 changed files with 53 additions and 0 deletions
@@ -647,6 +647,12 @@ enum class WaveMultiPrefixOpCode : uint32_t
Product = 4,
};
enum class SignedOpKind : uint32_t
{
Signed = 0, // signed integer or floating-point operands
Unsigned = 1, // unsigned integer operands
};
enum class QuadOpKind : uint32_t
{
ReadAcrossX = 0, // returns the value from the other lane in the quad in the
@@ -1844,6 +1850,8 @@ void SanitiseName(rdcstr &name);
DECLARE_REFLECTION_ENUM(DXIL::Attribute);
DECLARE_STRINGISE_TYPE(DXIL::InstructionFlags);
DECLARE_STRINGISE_TYPE(DXIL::AtomicBinOpCode);
DECLARE_STRINGISE_TYPE(DXIL::WaveOpCode);
DECLARE_STRINGISE_TYPE(DXIL::SignedOpKind);
DECLARE_STRINGISE_TYPE(DXIL::QuadOpKind);
DECLARE_STRINGISE_TYPE(DXIL::PackMode);
DECLARE_STRINGISE_TYPE(DXIL::UnpackMode);
@@ -4160,6 +4160,27 @@ void Program::MakeRDDisassemblyString(const DXBC::Reflection *reflection)
}
break;
}
case DXOp::WaveActiveOp:
{
// WaveActiveOp(value, i8 waveOp, i8 sign)
WaveOpCode waveOpCode;
SignedOpKind sop;
if(getival<SignedOpKind>(inst.args[3], sop))
commentStr += ToStr(sop);
if(getival<WaveOpCode>(inst.args[2], waveOpCode))
{
lineStr += "WaveActive" + ToStr(waveOpCode);
lineStr += "(";
lineStr += GetArgId(inst, 1);
lineStr += ")";
}
else
{
showDxFuncName = true;
}
break;
}
case DXOp::Pack4x8:
{
// Pack4x8(packMode,x,y,z,w)
@@ -828,3 +828,27 @@ rdcstr DoStringise(const DXIL::ResourceKind &el)
}
END_ENUM_STRINGISE();
};
template <>
rdcstr DoStringise(const DXIL::WaveOpCode &el)
{
BEGIN_ENUM_STRINGISE(DXIL::WaveOpCode)
{
STRINGISE_ENUM_CLASS(Sum)
STRINGISE_ENUM_CLASS(Product)
STRINGISE_ENUM_CLASS(Min)
STRINGISE_ENUM_CLASS(Max)
}
END_ENUM_STRINGISE();
}
template <>
rdcstr DoStringise(const DXIL::SignedOpKind &el)
{
BEGIN_ENUM_STRINGISE(DXIL::SignedOpKind)
{
STRINGISE_ENUM_CLASS(Signed)
STRINGISE_ENUM_CLASS(Unsigned)
}
END_ENUM_STRINGISE();
}