Selaa lähdekoodia

Fixed issue when gl_PrimitiveID and gl_FrontFacing are used together. Issue #3509. (#3510)

Branimir Karadžić 1 viikko sitten
vanhempi
sitoutus
3a652bbc7a
1 muutettua tiedostoa jossa 12 lisäystä ja 12 poistoa
  1. 12 12
      tools/shaderc/shaderc.cpp

+ 12 - 12
tools/shaderc/shaderc.cpp

@@ -1977,37 +1977,37 @@ namespace bgfx
 								);
 						}
 
-						if (hasFrontFacing)
+						if (hasPrimitiveId)
 						{
-							if (profile->id < 400)
+							if (profile->id >= 400)
 							{
 								preprocessor.writef(
-									" \\\n\t%sfloat __vface : VFACE"
+									" \\\n\t%suint gl_PrimitiveID : SV_PrimitiveID"
 									, arg++ > 0 ? ", " : "  "
 									);
 							}
 							else
 							{
-								preprocessor.writef(
-									" \\\n\t%sbool gl_FrontFacing : SV_IsFrontFace"
-									, arg++ > 0 ? ", " : "  "
-									);
+								bx::write(_messageWriter, &messageErr, "gl_PrimitiveID builtin is not supported by D3D9 HLSL.\n");
+								return false;
 							}
 						}
 
-						if (hasPrimitiveId)
+						if (hasFrontFacing)
 						{
-							if (profile->id >= 400)
+							if (profile->id < 400)
 							{
 								preprocessor.writef(
-									" \\\n\t%suint gl_PrimitiveID : SV_PrimitiveID"
+									" \\\n\t%sfloat __vface : VFACE"
 									, arg++ > 0 ? ", " : "  "
 									);
 							}
 							else
 							{
-								bx::write(_messageWriter, &messageErr, "gl_PrimitiveID builtin is not supported by D3D9 HLSL.\n");
-								return false;
+								preprocessor.writef(
+									" \\\n\t%sbool gl_FrontFacing : SV_IsFrontFace"
+									, arg++ > 0 ? ", " : "  "
+									);
 							}
 						}