DXIL Debugger Implement DXOp::Ubfe

This commit is contained in:
Jake Turner
2024-12-15 12:04:15 +00:00
parent 4e64459273
commit 8d2c3669d5
2 changed files with 39 additions and 2 deletions
+39 -1
View File
@@ -3366,8 +3366,46 @@ bool ThreadState::ExecuteInstruction(DebugAPIWrapper *apiWrapper,
}
break;
}
// Likely to implement when required
case DXOp::Ubfe:
{
// Ubfe(a,b,c)
// Given a range of bits in a number:
// shift those bits to the LSB, sign extend the MSB of the range.
// width : The LSB 5 bits of a (0-31).
// offset: The LSB 5 bits of b (0-31)
RDCASSERTEQUAL(inst.args[1]->type->type, Type::TypeKind::Scalar);
RDCASSERTEQUAL(inst.args[1]->type->scalarType, Type::Int);
RDCASSERTEQUAL(inst.args[2]->type->type, Type::TypeKind::Scalar);
RDCASSERTEQUAL(inst.args[2]->type->scalarType, Type::Int);
RDCASSERTEQUAL(inst.args[3]->type->type, Type::TypeKind::Scalar);
RDCASSERTEQUAL(inst.args[3]->type->scalarType, Type::Int);
ShaderVariable a;
ShaderVariable b;
ShaderVariable c;
RDCASSERT(GetShaderVariable(inst.args[1], opCode, dxOpCode, a));
RDCASSERT(GetShaderVariable(inst.args[2], opCode, dxOpCode, b));
RDCASSERT(GetShaderVariable(inst.args[3], opCode, dxOpCode, c));
RDCASSERTEQUAL(a.type, b.type);
RDCASSERTEQUAL(a.type, c.type);
uint32_t width = a.value.u32v[0] & 0x1f;
uint32_t offset = b.value.u32v[0] & 0x1f;
if(width == 0)
{
result.value.u32v[0] = 0;
}
else if(width + offset < 32)
{
result.value.u32v[0] = c.value.u32v[0] << (32 - (width + offset));
result.value.u32v[0] = result.value.u32v[0] >> (32 - width);
}
else
{
result.value.u32v[0] = c.value.u32v[0] >> offset;
}
break;
}
// Likely to implement when required
case DXOp::Bfi:
case DXOp::MakeDouble:
case DXOp::SplitDouble:
@@ -1816,7 +1816,6 @@ rdcstr Program::GetDebugStatus()
case DXOp::TempRegStore:
case DXOp::MinPrecXRegLoad:
case DXOp::MinPrecXRegStore:
case DXOp::Ubfe:
case DXOp::Bfi:
case DXOp::CBufferLoad:
case DXOp::BufferUpdateCounter: