From 8f9918ea0d3fdfd539d04bcd8465696343948ee2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 21 Apr 2016 12:15:17 +0200 Subject: [PATCH] DebugTools, TextureTools: no pixel_center_integer in GLSL ES. This seems like yet another pointless restriction. Aargh. --- src/Magnum/DebugTools/TextureImage.frag | 6 ++++++ src/Magnum/TextureTools/DistanceFieldShader.frag | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/Magnum/DebugTools/TextureImage.frag b/src/Magnum/DebugTools/TextureImage.frag index 836a03aa1..e7c5f67f3 100644 --- a/src/Magnum/DebugTools/TextureImage.frag +++ b/src/Magnum/DebugTools/TextureImage.frag @@ -1,12 +1,18 @@ uniform highp int level; uniform highp sampler2D textureData; +#ifndef GL_ES layout(pixel_center_integer) in highp vec4 gl_FragCoord; +#endif out highp uvec4 fragmentOutput; void main() { + #ifndef GL_ES ivec2 pos = ivec2(gl_FragCoord.xy); + #else + ivec2 pos = ivec2(gl_FragCoord.xy - vec2(0.5)); + #endif fragmentOutput = floatBitsToUint(texelFetch(textureData, pos, level)); } diff --git a/src/Magnum/TextureTools/DistanceFieldShader.frag b/src/Magnum/TextureTools/DistanceFieldShader.frag index 14be6d217..448213855 100644 --- a/src/Magnum/TextureTools/DistanceFieldShader.frag +++ b/src/Magnum/TextureTools/DistanceFieldShader.frag @@ -52,7 +52,9 @@ uniform lowp sampler2D textureData; #endif #ifdef TEXELFETCH_USABLE +#ifndef GL_ES layout(pixel_center_integer) in mediump vec4 gl_FragCoord; +#endif #else #ifdef EXPLICIT_UNIFORM_LOCATION layout(location = 2) uniform vec2 imageSizeInverted; @@ -85,8 +87,12 @@ bool hasValue(const mediump vec2 position, const mediump vec2 offset) { void main() { #ifdef TEXELFETCH_USABLE + #ifndef GL_ES const mediump ivec2 position = ivec2(gl_FragCoord.xy*scaling); #else + const mediump ivec2 position = ivec2((gl_FragCoord.xy - vec2(0.5))*scaling); + #endif + #else const mediump vec2 position = (gl_FragCoord.xy - vec2(0.5))*scaling*imageSizeInverted; #endif