DXIL Debugger extended support for GPU Sampling instructions

DXOp::Sample
DXOp::SampleBias
DXOp::SampleLevel
DXOp::SampleGrad
DXOp::SampleCmp
DXOp::SampleCmpBias
DXOp::SampleCmpLevel
DXOp::SampleCmpGrad
DXOp::SampleCmpLevelZero
DXOp::TextureGather
DXOp::TextureGatherCmp
This commit is contained in:
Jake Turner
2024-10-24 12:54:10 +01:00
parent a5b63f2f26
commit f538e91b05
6 changed files with 276 additions and 97 deletions
+11 -7
View File
@@ -397,13 +397,17 @@ cbuffer DebugSampleOperation REG(b0)
#define DEBUG_SAMPLE_TEX_SAMPLE_GRAD 103
#define DEBUG_SAMPLE_TEX_SAMPLE_CMP 104
#define DEBUG_SAMPLE_TEX_SAMPLE_CMP_LEVEL_ZERO 105
#define DEBUG_SAMPLE_TEX_GATHER4 106
#define DEBUG_SAMPLE_TEX_GATHER4_CMP 107
#define DEBUG_SAMPLE_TEX_GATHER4_PO 108
#define DEBUG_SAMPLE_TEX_GATHER4_PO_CMP 109
#define DEBUG_SAMPLE_TEX_LOD 110
#define DEBUG_SAMPLE_TEX_LOAD 111
#define DEBUG_SAMPLE_TEX_LOAD_MS 112
#define DEBUG_SAMPLE_TEX_SAMPLE_CMP_LEVEL 106 // SM 6.7
#define DEBUG_SAMPLE_TEX_SAMPLE_CMP_BIAS 107 // SM 6.8
#define DEBUG_SAMPLE_TEX_SAMPLE_CMP_GRAD 108 // SM 6.8
#define DEBUG_SAMPLE_TEX_GATHER4 109
#define DEBUG_SAMPLE_TEX_GATHER4_CMP 110
#define DEBUG_SAMPLE_TEX_GATHER4_PO 111
#define DEBUG_SAMPLE_TEX_GATHER4_PO_CMP 112
#define DEBUG_SAMPLE_TEX_LOD 113
#define DEBUG_SAMPLE_TEX_LOAD 114
#define DEBUG_SAMPLE_TEX_LOAD_MS 115
#define DEBUG_SAMPLE_TEX1D 1
#define DEBUG_SAMPLE_TEX2D 2
+97 -1
View File
@@ -269,7 +269,7 @@ float4 DoFloatOpcode(float4 uv)
}
}
}
else if(opcode == DEBUG_SAMPLE_TEX_SAMPLE_CMP)
else if(opcode == DEBUG_SAMPLE_TEX_SAMPLE_CMP || opcode == DEBUG_SAMPLE_TEX_SAMPLE_CMP_BIAS)
{
switch(debugSampleTexDim)
{
@@ -660,6 +660,102 @@ float4 DoFloatOpcode(float4 uv)
}
}
}
#if __SHADER_TARGET_MAJOR >= 6
#if __SHADER_TARGET_MINOR >= 7
else if(opcode == DEBUG_SAMPLE_TEX_SAMPLE_CMP_LEVEL) // SM6.7
{
switch(debugSampleTexDim)
{
default:
case DEBUG_SAMPLE_TEX1D:
{
switch(debugSampleRetType)
{
case DEBUG_SAMPLE_UNORM:
return t1D_unorm.SampleCmpLevel(sc, uv.xy, compare, lod, offsets.x);
case DEBUG_SAMPLE_SNORM:
return t1D_snorm.SampleCmpLevel(sc, uv.xy, compare, lod, offsets.x);
default: return t1D_float.SampleCmpLevel(sc, uv.xy, compare, lod, offsets.x);
}
}
case DEBUG_SAMPLE_TEX2D:
{
switch(debugSampleRetType)
{
case DEBUG_SAMPLE_UNORM:
return t2D_unorm.SampleCmpLevel(sc, uv.xyz, compare, lod, offsets.xy);
case DEBUG_SAMPLE_SNORM:
return t2D_snorm.SampleCmpLevel(sc, uv.xyz, compare, lod, offsets.xy);
default: return t2D_float.SampleCmpLevel(sc, uv.xyz, compare, lod, offsets.xy);
}
}
case DEBUG_SAMPLE_TEXCUBE:
{
switch(debugSampleRetType)
{
case DEBUG_SAMPLE_UNORM: return tCube_unorm.SampleCmpLevel(sc, uv, compare, lod);
case DEBUG_SAMPLE_SNORM: return tCube_snorm.SampleCmpLevel(sc, uv, compare, lod);
default: return tCube_float.SampleCmpLevel(sc, uv, compare, lod);
}
}
}
}
#endif // #if __SHADER_TARGET_MINOR >= 7
#if __SHADER_TARGET_MINOR >= 8
else if(opcode == DEBUG_SAMPLE_TEX_SAMPLE_CMP_GRAD) // SM6.8
{
switch(debugSampleTexDim)
{
default:
case DEBUG_SAMPLE_TEX1D:
{
switch(debugSampleRetType)
{
case DEBUG_SAMPLE_UNORM:
return t1D_unorm.SampleCmpGrad(s, uv.xy, compare, ddx_.x, ddy_.x, offsets.x);
case DEBUG_SAMPLE_SNORM:
return t1D_snorm.SampleCmpGrad(s, uv.xy, compare, ddx_.x, ddy_.x, offsets.x);
default: return t1D_float.SampleCmpGrad(s, uv.xy, compare, ddx_.x, ddy_.x, offsets.x);
}
}
case DEBUG_SAMPLE_TEX2D:
{
switch(debugSampleRetType)
{
case DEBUG_SAMPLE_UNORM:
return t2D_unorm.SampleCmpGrad(s, uv.xyz, compare, ddx_.xy, ddy_.xy, offsets.xy);
case DEBUG_SAMPLE_SNORM:
return t2D_snorm.SampleCmpGrad(s, uv.xyz, compare, ddx_.xy, ddy_.xy, offsets.xy);
default: return t2D_float.SampleCmpGrad(s, uv.xyz, compare, ddx_.xy, ddy_.xy, offsets.xy);
}
}
case DEBUG_SAMPLE_TEX3D:
{
switch(debugSampleRetType)
{
case DEBUG_SAMPLE_UNORM:
return t3D_unorm.SampleCmpGrad(s, uv.xyz, compare, ddx_.xyz, ddy_.xyz, offsets.xyz);
case DEBUG_SAMPLE_SNORM:
return t3D_snorm.SampleCmpGrad(s, uv.xyz, compare, ddx_.xyz, ddy_.xyz, offsets.xyz);
default:
return t3D_float.SampleCmpGrad(s, uv.xyz, compare, ddx_.xyz, ddy_.xyz, offsets.xyz);
}
}
case DEBUG_SAMPLE_TEXCUBE:
{
switch(debugSampleRetType)
{
case DEBUG_SAMPLE_UNORM:
return tCube_unorm.SampleCmpGrad(s, uv, compare, ddx_.xyz, ddy_.xyz);
case DEBUG_SAMPLE_SNORM:
return tCube_snorm.SampleCmpGrad(s, uv, compare, ddx_.xyz, ddy_.xyz);
default: return tCube_float.SampleCmpGrad(s, uv, compare, ddx_.xyz, ddy_.xyz);
}
}
}
}
#endif // #if __SHADER_TARGET_MINOR >= 8
#endif // #if __SHADER_TARGET_MAJOR >= 6
else
{
return float4(0, 0, 0, 0);