Handle barycentrics not being available in demos test

This commit is contained in:
baldurk
2026-05-18 15:28:08 +01:00
parent 5bee6d799a
commit 0365585f1e
@@ -1686,7 +1686,11 @@ struct v2f
float2 uv : TEXCOORD0;
};
float4 main(v2f IN, uint samp : SV_SampleIndex, float3 bary : SV_Barycentrics) : SV_Target0
float4 main(v2f IN, uint samp : SV_SampleIndex
#if SUPPORTS_BARY
, float3 bary : SV_Barycentrics
#endif
) : SV_Target0
{
float2 uvCentroid = EvaluateAttributeCentroid(IN.uv);
float2 uvSamp0 = EvaluateAttributeAtSample(IN.uv, 0) - IN.uv;
@@ -1697,7 +1701,9 @@ float4 main(v2f IN, uint samp : SV_SampleIndex, float3 bary : SV_Barycentrics) :
float y = (uvSamp0.x + uvSamp0.y) * 0.5f;
float z = (uvSampThis.x + uvSampThis.y) * 0.5f;
float w = (uvOffset.x + uvOffset.y) * 0.5f;
#if SUPPORTS_BARY
w += x * bary.x + y * bary.y + z * bary.z;
#endif
// Test sampleinfo with a MSAA rasterizer
uint numSamples = GetRenderTargetSampleCount();
@@ -1944,6 +1950,7 @@ void main(uint3 inDTID : SV_DispatchThreadID, uint3 inGID : SV_GroupThreadID, ui
bool supportSM60 = (m_HighestShaderModel >= D3D_SHADER_MODEL_6_0) && m_DXILSupport;
bool supportSM61 = (m_HighestShaderModel >= D3D_SHADER_MODEL_6_1) && m_DXILSupport;
bool supportBary = (opts3.BarycentricsSupported) && m_DXILSupport;
bool supportSM62 = (m_HighestShaderModel >= D3D_SHADER_MODEL_6_2) && m_DXILSupport;
bool supportSM66 = (m_HighestShaderModel >= D3D_SHADER_MODEL_6_6) && m_DXILSupport;
TEST_ASSERT(!supportSM62 || supportSM60, "SM 6.2 requires SM 6.0 support");
@@ -2590,11 +2597,16 @@ void main(uint3 inDTID : SV_DispatchThreadID, uint3 inGID : SV_GroupThreadID, ui
if(supportSM61)
{
std::string defines = "#define SUPPORTS_BARY ";
defines += supportBary ? "1" : "0";
defines += "\n";
msaaPSOs[2] = MakePSO()
.RootSig(sigmsaa)
.InputLayout()
.VS(Compile(D3DDefaultVertex, "main", "vs_6_1"))
.PS(Compile(msaaPixel61, "main", "ps_6_1"))
.PS(Compile(defines + msaaPixel61, "main", "ps_6_1"))
.SampleCount(4)
.RTVs({DXGI_FORMAT_R32G32B32A32_FLOAT});
}