From 2e4beb361c3a23692722454cc2dfb28ffe980ff1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 19 Jul 2018 15:35:17 +0200 Subject: [PATCH] TextureTools: don't require more than 8 texture units in distanceField(). ES2 contexts on iOS don't have more than that. It's weird, because ES3 contexts have 16. --- doc/changelog.dox | 6 ++++++ src/Magnum/TextureTools/DistanceField.cpp | 4 +++- src/Magnum/TextureTools/DistanceFieldShader.frag | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/doc/changelog.dox b/doc/changelog.dox index 65f197657..57255ac32 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -122,6 +122,12 @@ See also: @ref Shaders::VertexColor::Color4 attribute specifiers for more convenient distinction between three- and four-component vertex color attribute. +@subsubsection changelog-latest-changes-texturetools TextureTools library + +- Fixed @ref TextureTools::distanceField() to not require more than 8 texture + units, which is the limit on all iOS ES2 contexts, independently on the + device (ES3 contexts have 16). + @subsubsection changelog-latest-changes-trade Trade library - @ref Trade::PhongMaterialData now contains well-defined color values diff --git a/src/Magnum/TextureTools/DistanceField.cpp b/src/Magnum/TextureTools/DistanceField.cpp index 01a53dee7..1289dcaf9 100644 --- a/src/Magnum/TextureTools/DistanceField.cpp +++ b/src/Magnum/TextureTools/DistanceField.cpp @@ -75,7 +75,9 @@ class DistanceFieldShader: public GL::AbstractShaderProgram { } private: - enum: Int { TextureUnit = 8 }; + /* ES2 on iOS (apparently independent on the device) has only 8 texture + units, so be careful to not step over that. ES3 has 16. */ + enum: Int { TextureUnit = 7 }; Int radiusUniform{0}, scalingUniform{1}, diff --git a/src/Magnum/TextureTools/DistanceFieldShader.frag b/src/Magnum/TextureTools/DistanceFieldShader.frag index f48500048..c2b3e87e7 100644 --- a/src/Magnum/TextureTools/DistanceFieldShader.frag +++ b/src/Magnum/TextureTools/DistanceFieldShader.frag @@ -46,7 +46,7 @@ uniform mediump vec2 scaling; #endif #ifdef EXPLICIT_TEXTURE_LAYER -layout(binding = 8) uniform sampler2D textureData; +layout(binding = 7) uniform sampler2D textureData; #else uniform lowp sampler2D textureData; #endif