From 5170aa4978e8f963c7d6ecfbfee7c43abfdff760 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 29 Oct 2015 22:35:56 +0100 Subject: [PATCH] TextureTools: fix distance field converter on 3.0 <= GL < 3.2. The shader code took the image size from uniform if the GL was older than version 3.2 (GLSL 1.50). But the shader class was setting that uniform only if the GL was older than version 3.0. Thus the distance field converter worked only on GL 2.1 and GL >= 3.2. This was discovered only by accident, thanks to the quite recent attempts to create core contexts by default. Because apparently setting explicit version requirements (core GL 3.1) on AMDwill make wglCreateContext() stay on that version and not choosing any later compatible version, similarly to how NVidia behaves. That's another bug for later. Before the application was just creating the context the old way, thus all cards compatible with GL3 were at least on GL 3.2 and thus the missing uniform setting did not affect anybody, thus the bug was effectively hidden. --- src/Magnum/TextureTools/DistanceField.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Magnum/TextureTools/DistanceField.cpp b/src/Magnum/TextureTools/DistanceField.cpp index 21175e774..55a049470 100644 --- a/src/Magnum/TextureTools/DistanceField.cpp +++ b/src/Magnum/TextureTools/DistanceField.cpp @@ -127,7 +127,7 @@ DistanceFieldShader::DistanceFieldShader(): radiusUniform(0), scalingUniform(1) scalingUniform = uniformLocation("scaling"); #ifndef MAGNUM_TARGET_GLES - if(!Context::current()->isVersionSupported(Version::GL300)) + if(!Context::current()->isVersionSupported(Version::GL320)) #else if(!Context::current()->isVersionSupported(Version::GLES300)) #endif @@ -179,7 +179,7 @@ void distanceField(Texture2D& input, Texture2D& output, const Range2Di& rectangl .setTexture(input); #ifndef MAGNUM_TARGET_GLES - if(!Context::current()->isVersionSupported(Version::GL300)) + if(!Context::current()->isVersionSupported(Version::GL320)) #else if(!Context::current()->isVersionSupported(Version::GLES300)) #endif