From c0b6427b120fb53f0eada08da86494f562afcaa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Lu=C3=ADs=20Vaz=20Silva?= Date: Wed, 16 Apr 2025 13:18:37 -0300 Subject: [PATCH] print warning for texture2d usage --- .../rendering/hwrenderer/data/hw_shaderpatcher.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/common/rendering/hwrenderer/data/hw_shaderpatcher.cpp b/src/common/rendering/hwrenderer/data/hw_shaderpatcher.cpp index 24ffa23f3..3bef81e0b 100644 --- a/src/common/rendering/hwrenderer/data/hw_shaderpatcher.cpp +++ b/src/common/rendering/hwrenderer/data/hw_shaderpatcher.cpp @@ -134,6 +134,8 @@ FString RemoveLegacyUserUniforms(FString code) DPrintf(DMSG_WARNING, TEXTCOLOR_ORANGE "timer and tex uniforms should not be explicitly declared.\n"); } + bool foundtexture2d = false; + // Also remove all occurences of the token 'texture2d'. Some shaders may still use this deprecated function to access a sampler. // Modern GLSL only allows use of 'texture'. while (true) @@ -142,6 +144,8 @@ FString RemoveLegacyUserUniforms(FString code) if (matchIndex == -1) break; + foundtexture2d = true; + // Check if this is a real token. bool isKeywordStart = matchIndex == 0 || !isalnum(chars[matchIndex - 1] & 255); bool isKeywordEnd = matchIndex + 9 == len || !isalnum(chars[matchIndex + 9] & 255); @@ -152,6 +156,11 @@ FString RemoveLegacyUserUniforms(FString code) startIndex = matchIndex + 9; } + if(foundtexture2d) + { + DPrintf(DMSG_WARNING, TEXTCOLOR_ORANGE "texture2d is deprecated, use texture instead.\n"); + } + code.UnlockBuffer(); return code;