From 76c19a7676d2cb1ade8c6471fb88643d6dea85c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Tue, 5 Jun 2018 17:41:10 -0700 Subject: [PATCH] shaderc: Fixed issues with VFACE that cause X4576: Non system-generated input signature parameter... error --- tools/shaderc/shaderc.cpp | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/tools/shaderc/shaderc.cpp b/tools/shaderc/shaderc.cpp index 6bfc8962a..a255a6a44 100644 --- a/tools/shaderc/shaderc.cpp +++ b/tools/shaderc/shaderc.cpp @@ -18,7 +18,7 @@ extern "C" #define BGFX_CHUNK_MAGIC_VSH BX_MAKEFOURCC('V', 'S', 'H', 0x5) #define BGFX_SHADERC_VERSION_MAJOR 1 -#define BGFX_SHADERC_VERSION_MINOR 12 +#define BGFX_SHADERC_VERSION_MINOR 13 namespace bgfx { @@ -1596,18 +1596,27 @@ namespace bgfx ); } - if (hasFrontFacing - && hlsl >= 3) + if (hasFrontFacing) { - preprocessor.writef( - " \\\n\t%sfloat __vface : VFACE" - , arg++ > 0 ? ", " : " " - ); + if (hlsl == 3) + { + preprocessor.writef( + " \\\n\t%sfloat __vface : VFACE" + , arg++ > 0 ? ", " : " " + ); + } + else + { + preprocessor.writef( + " \\\n\t%sbool gl_FrontFacing : SV_IsFrontFace" + , arg++ > 0 ? ", " : " " + ); + } } if (hasPrimitiveId) { - if (d3d > 9) + if (hlsl > 3) { preprocessor.writef( " \\\n\t%suint gl_PrimitiveID : SV_PrimitiveID" @@ -1627,18 +1636,12 @@ namespace bgfx if (hasFrontFacing) { - if (hlsl >= 3) + if (hlsl == 3) { preprocessor.writef( "#define gl_FrontFacing (__vface <= 0.0)\n" ); } - else - { - preprocessor.writef( - "#define gl_FrontFacing false\n" - ); - } } } else if ('v' == _options.shaderType)