Skip to content

Commit 3a652bb

Browse files
authored
Fixed issue when gl_PrimitiveID and gl_FrontFacing are used together. Issue #3509. (#3510)
1 parent 8a60697 commit 3a652bb

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

tools/shaderc/shaderc.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1977,37 +1977,37 @@ namespace bgfx
19771977
);
19781978
}
19791979

1980-
if (hasFrontFacing)
1980+
if (hasPrimitiveId)
19811981
{
1982-
if (profile->id < 400)
1982+
if (profile->id >= 400)
19831983
{
19841984
preprocessor.writef(
1985-
" \\\n\t%sfloat __vface : VFACE"
1985+
" \\\n\t%suint gl_PrimitiveID : SV_PrimitiveID"
19861986
, arg++ > 0 ? ", " : " "
19871987
);
19881988
}
19891989
else
19901990
{
1991-
preprocessor.writef(
1992-
" \\\n\t%sbool gl_FrontFacing : SV_IsFrontFace"
1993-
, arg++ > 0 ? ", " : " "
1994-
);
1991+
bx::write(_messageWriter, &messageErr, "gl_PrimitiveID builtin is not supported by D3D9 HLSL.\n");
1992+
return false;
19951993
}
19961994
}
19971995

1998-
if (hasPrimitiveId)
1996+
if (hasFrontFacing)
19991997
{
2000-
if (profile->id >= 400)
1998+
if (profile->id < 400)
20011999
{
20022000
preprocessor.writef(
2003-
" \\\n\t%suint gl_PrimitiveID : SV_PrimitiveID"
2001+
" \\\n\t%sfloat __vface : VFACE"
20042002
, arg++ > 0 ? ", " : " "
20052003
);
20062004
}
20072005
else
20082006
{
2009-
bx::write(_messageWriter, &messageErr, "gl_PrimitiveID builtin is not supported by D3D9 HLSL.\n");
2010-
return false;
2007+
preprocessor.writef(
2008+
" \\\n\t%sbool gl_FrontFacing : SV_IsFrontFace"
2009+
, arg++ > 0 ? ", " : " "
2010+
);
20112011
}
20122012
}
20132013

0 commit comments

Comments
 (0)