From 87fd766c33a7d9bc9940529ae65481f7f7cb63be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Fri, 24 May 2024 16:42:41 -0700 Subject: [PATCH] shaderc: Fix integer vecs. --- tools/shaderc/shaderc.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/tools/shaderc/shaderc.cpp b/tools/shaderc/shaderc.cpp index 4ead8003f..e21148fb7 100644 --- a/tools/shaderc/shaderc.cpp +++ b/tools/shaderc/shaderc.cpp @@ -293,10 +293,13 @@ namespace bgfx NULL }; - static const char* s_unsignedVecs[] = + static const char* s_integerVecs[] = { + "ivec2", "uvec2", + "ivec3", "uvec3", + "ivec4", "uvec4", NULL }; @@ -2259,7 +2262,7 @@ namespace bgfx const bool usesTextureArray = !bx::findIdentifierMatch(input, s_textureArray).isEmpty(); const bool usesPacking = !bx::findIdentifierMatch(input, s_ARB_shading_language_packing).isEmpty(); const bool usesViewportLayerArray = !bx::findIdentifierMatch(input, s_ARB_shader_viewport_layer_array).isEmpty(); - const bool usesUnsignedVecs = !bx::findIdentifierMatch(preprocessedInput, s_unsignedVecs).isEmpty(); + const bool usesIntegerVecs = !bx::findIdentifierMatch(preprocessedInput, s_integerVecs).isEmpty(); if (profile->lang != ShadingLang::ESSL) { @@ -2267,7 +2270,7 @@ namespace bgfx || !bx::findIdentifierMatch(input, s_130).isEmpty() || usesInterpolationQualifiers || usesTexelFetch - || usesUnsignedVecs + || usesIntegerVecs ) ); bx::stringPrintf(code, "#version %d\n", need130 ? 130 : glsl_profile); @@ -2349,15 +2352,6 @@ namespace bgfx ); } - if (130 > glsl_profile) - { - bx::stringPrintf(code, - "#define ivec2 vec2\n" - "#define ivec3 vec3\n" - "#define ivec4 vec4\n" - ); - } - if (ARB_shader_texture_lod) { bx::stringPrintf(code, @@ -2395,7 +2389,7 @@ namespace bgfx else { if (glsl_profile < 300 - && usesUnsignedVecs) + && usesIntegerVecs) { glsl_profile = 300; }