Skip to content

Commit eba1a12

Browse files
committed
DXIL Shader Debugger test using enum
1 parent 80cce82 commit eba1a12

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

util/test/demos/d3d12/d3d12_shader_debug_zoo.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,39 @@ float4 main(v2f IN) : SV_Target0
10931093
Color.y = smiley.CalculateLevelOfDetailUnclamped(linearclamp, uv);
10941094
return Color;
10951095
}
1096+
#if (SM_6_0 || SM_6_2 || SM_6_6)
1097+
enum TestEnum
1098+
{
1099+
ON,
1100+
OFF
1101+
};
1102+
struct TestStructEnum
1103+
{
1104+
bool bTest;
1105+
TestEnum eTest;
1106+
};
1107+
TestEnum testEnum = (IN.s.x > 1.0) ? ON : OFF;
1108+
TestStructEnum tStructEnum;
1109+
tStructEnum.bTest = (IN.s.x < 0.5);
1110+
tStructEnum.eTest = (IN.s.x < 1.0) ? ON : OFF;
1111+
if(IN.tri == 110)
1112+
{
1113+
float4 Color = float4(0,0,0,1);
1114+
if (testEnum == ON)
1115+
Color += float4(0.5, 0.0, 0.0, 0.0);
1116+
else if (testEnum == OFF)
1117+
Color += float4(0.2, 0.0, 0.0, 0.0);
1118+
if (tStructEnum.bTest)
1119+
Color += float4(0.0, 0.5, 0.0, 0.0);
1120+
else
1121+
Color += float4(0.0, 0.2, 0.0, 0.0);
1122+
if (tStructEnum.eTest == ON)
1123+
Color += float4(0.0, 0.0, 0.5, 0.0);
1124+
else if (tStructEnum.eTest == OFF)
1125+
Color += float4(0.0, 0.0, 0.2, 0.0);
1126+
return Color;
1127+
}
1128+
#endif // #if (SM_6_0 || SM_6_2 || SM_6_6)
10961129
return float4(0.4f, 0.4f, 0.4f, 0.4f);
10971130
}
10981131
)EOSHADER";

0 commit comments

Comments
 (0)