From 8f0468547081cd746b914188cef0836ca4daa759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 25 Jul 2023 11:14:25 +0200 Subject: [PATCH] Shaders: prefix GLSL workaround macros with MAGNUM_. In order to prepare them for being included for all shader code, not just own builtin shaders. --- src/Magnum/DebugTools/TextureImage.vert | 4 ++-- src/Magnum/Shaders/FullScreenTriangle.glsl | 4 ++-- .../Shaders/Implementation/CreateCompatibilityShader.h | 8 ++++---- src/Magnum/Shaders/compatibility.glsl | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Magnum/DebugTools/TextureImage.vert b/src/Magnum/DebugTools/TextureImage.vert index 8a9274808..33d3c174a 100644 --- a/src/Magnum/DebugTools/TextureImage.vert +++ b/src/Magnum/DebugTools/TextureImage.vert @@ -23,12 +23,12 @@ DEALINGS IN THE SOFTWARE. */ -#ifdef DISABLE_GL_MAGNUM_shader_vertex_id +#ifdef MAGNUM_DISABLE_GL_MAGNUM_shader_vertex_id in lowp vec4 position; #endif void main() { - #ifndef DISABLE_GL_MAGNUM_shader_vertex_id + #ifndef MAGNUM_DISABLE_GL_MAGNUM_shader_vertex_id gl_Position = vec4((gl_VertexID == 2) ? 3.0 : -1.0, (gl_VertexID == 1) ? -3.0 : 1.0, 0.0, 1.0); #else diff --git a/src/Magnum/Shaders/FullScreenTriangle.glsl b/src/Magnum/Shaders/FullScreenTriangle.glsl index c1273747c..df3370fa8 100644 --- a/src/Magnum/Shaders/FullScreenTriangle.glsl +++ b/src/Magnum/Shaders/FullScreenTriangle.glsl @@ -25,7 +25,7 @@ /* Inputs */ -#if !defined(NEW_GLSL) || defined(DISABLE_GL_MAGNUM_shader_vertex_id) +#if !defined(NEW_GLSL) || defined(MAGNUM_DISABLE_GL_MAGNUM_shader_vertex_id) #ifndef NEW_GLSL #define in attribute #endif @@ -33,7 +33,7 @@ in lowp vec4 position; #endif void fullScreenTriangle() { - #if defined(NEW_GLSL) && !defined(DISABLE_GL_MAGNUM_shader_vertex_id) + #if defined(NEW_GLSL) && !defined(MAGNUM_DISABLE_GL_MAGNUM_shader_vertex_id) gl_Position = vec4((gl_VertexID == 2) ? 3.0 : -1.0, (gl_VertexID == 1) ? -3.0 : 1.0, 0.0, 1.0); #else diff --git a/src/Magnum/Shaders/Implementation/CreateCompatibilityShader.h b/src/Magnum/Shaders/Implementation/CreateCompatibilityShader.h index 19f118886..d7b1a0151 100644 --- a/src/Magnum/Shaders/Implementation/CreateCompatibilityShader.h +++ b/src/Magnum/Shaders/Implementation/CreateCompatibilityShader.h @@ -49,16 +49,16 @@ inline GL::Shader createCompatibilityShader(const Utility::Resource& rs, GL::Ver #ifndef MAGNUM_TARGET_GLES if(GL::Context::current().isExtensionDisabled(version)) - shader.addSource("#define DISABLE_GL_ARB_explicit_attrib_location\n"_s); + shader.addSource("#define MAGNUM_DISABLE_GL_ARB_explicit_attrib_location\n"_s); if(GL::Context::current().isExtensionDisabled(version)) - shader.addSource("#define DISABLE_GL_ARB_shading_language_420pack\n"_s); + shader.addSource("#define MAGNUM_DISABLE_GL_ARB_shading_language_420pack\n"_s); if(GL::Context::current().isExtensionDisabled(version)) - shader.addSource("#define DISABLE_GL_ARB_explicit_uniform_location\n"_s); + shader.addSource("#define MAGNUM_DISABLE_GL_ARB_explicit_uniform_location\n"_s); #endif #ifndef MAGNUM_TARGET_GLES2 if(type == GL::Shader::Type::Vertex && GL::Context::current().isExtensionDisabled(version)) - shader.addSource("#define DISABLE_GL_MAGNUM_shader_vertex_id\n"_s); + shader.addSource("#define MAGNUM_DISABLE_GL_MAGNUM_shader_vertex_id\n"_s); #endif shader.addSource(rs.getString("compatibility.glsl"_s)); diff --git a/src/Magnum/Shaders/compatibility.glsl b/src/Magnum/Shaders/compatibility.glsl index 7f5b9eb24..d32a01d6e 100644 --- a/src/Magnum/Shaders/compatibility.glsl +++ b/src/Magnum/Shaders/compatibility.glsl @@ -27,18 +27,18 @@ #define NEW_GLSL #endif -#if !defined(GL_ES) && defined(GL_ARB_explicit_attrib_location) && !defined(DISABLE_GL_ARB_explicit_attrib_location) +#if !defined(GL_ES) && defined(GL_ARB_explicit_attrib_location) && !defined(MAGNUM_DISABLE_GL_ARB_explicit_attrib_location) #extension GL_ARB_explicit_attrib_location: enable #define EXPLICIT_ATTRIB_LOCATION #endif -#if !defined(GL_ES) && defined(GL_ARB_shading_language_420pack) && !defined(DISABLE_GL_ARB_shading_language_420pack) +#if !defined(GL_ES) && defined(GL_ARB_shading_language_420pack) && !defined(MAGNUM_DISABLE_GL_ARB_shading_language_420pack) #extension GL_ARB_shading_language_420pack: enable #define RUNTIME_CONST #define EXPLICIT_BINDING #endif -#if !defined(GL_ES) && defined(GL_ARB_explicit_uniform_location) && !defined(DISABLE_GL_ARB_explicit_uniform_location) +#if !defined(GL_ES) && defined(GL_ARB_explicit_uniform_location) && !defined(MAGNUM_DISABLE_GL_ARB_explicit_uniform_location) #extension GL_ARB_explicit_uniform_location: enable #define EXPLICIT_UNIFORM_LOCATION #endif