Skip to content

Commit

Permalink
TextureTools: don't require more than 8 texture units in distanceFiel…
Browse files Browse the repository at this point in the history
…d().

ES2 contexts on iOS don't have more than that. It's weird, because ES3
contexts have 16.
  • Loading branch information
mosra committed Jul 19, 2018
1 parent 4edb080 commit 2e4beb3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions doc/changelog.dox
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/Magnum/TextureTools/DistanceField.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
2 changes: 1 addition & 1 deletion src/Magnum/TextureTools/DistanceFieldShader.frag
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2e4beb3

Please sign in to comment.