From 3a652bbc7a3c19d981ecf8fc8e454a630596ab78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Wed, 3 Dec 2025 18:27:44 -0800 Subject: [PATCH] Fixed issue when gl_PrimitiveID and gl_FrontFacing are used together. Issue #3509. (#3510) --- tools/shaderc/shaderc.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tools/shaderc/shaderc.cpp b/tools/shaderc/shaderc.cpp index 3ecf850b7..307643867 100644 --- a/tools/shaderc/shaderc.cpp +++ b/tools/shaderc/shaderc.cpp @@ -1977,6 +1977,22 @@ namespace bgfx ); } + if (hasPrimitiveId) + { + if (profile->id >= 400) + { + preprocessor.writef( + " \\\n\t%suint gl_PrimitiveID : SV_PrimitiveID" + , arg++ > 0 ? ", " : " " + ); + } + else + { + bx::write(_messageWriter, &messageErr, "gl_PrimitiveID builtin is not supported by D3D9 HLSL.\n"); + return false; + } + } + if (hasFrontFacing) { if (profile->id < 400) @@ -1995,22 +2011,6 @@ namespace bgfx } } - if (hasPrimitiveId) - { - if (profile->id >= 400) - { - preprocessor.writef( - " \\\n\t%suint gl_PrimitiveID : SV_PrimitiveID" - , arg++ > 0 ? ", " : " " - ); - } - else - { - bx::write(_messageWriter, &messageErr, "gl_PrimitiveID builtin is not supported by D3D9 HLSL.\n"); - return false; - } - } - preprocessor.writef( " \\\n\t)\n" );