Browse Source

DebugTools, TextureTools: no pixel_center_integer in GLSL ES.

This seems like yet another pointless restriction. Aargh.
pull/141/head
Vladimír Vondruš 10 years ago
parent
commit
8f9918ea0d
  1. 6
      src/Magnum/DebugTools/TextureImage.frag
  2. 6
      src/Magnum/TextureTools/DistanceFieldShader.frag

6
src/Magnum/DebugTools/TextureImage.frag

@ -1,12 +1,18 @@
uniform highp int level; uniform highp int level;
uniform highp sampler2D textureData; uniform highp sampler2D textureData;
#ifndef GL_ES
layout(pixel_center_integer) in highp vec4 gl_FragCoord; layout(pixel_center_integer) in highp vec4 gl_FragCoord;
#endif
out highp uvec4 fragmentOutput; out highp uvec4 fragmentOutput;
void main() { void main() {
#ifndef GL_ES
ivec2 pos = ivec2(gl_FragCoord.xy); ivec2 pos = ivec2(gl_FragCoord.xy);
#else
ivec2 pos = ivec2(gl_FragCoord.xy - vec2(0.5));
#endif
fragmentOutput = floatBitsToUint(texelFetch(textureData, pos, level)); fragmentOutput = floatBitsToUint(texelFetch(textureData, pos, level));
} }

6
src/Magnum/TextureTools/DistanceFieldShader.frag

@ -52,7 +52,9 @@ uniform lowp sampler2D textureData;
#endif #endif
#ifdef TEXELFETCH_USABLE #ifdef TEXELFETCH_USABLE
#ifndef GL_ES
layout(pixel_center_integer) in mediump vec4 gl_FragCoord; layout(pixel_center_integer) in mediump vec4 gl_FragCoord;
#endif
#else #else
#ifdef EXPLICIT_UNIFORM_LOCATION #ifdef EXPLICIT_UNIFORM_LOCATION
layout(location = 2) uniform vec2 imageSizeInverted; layout(location = 2) uniform vec2 imageSizeInverted;
@ -85,8 +87,12 @@ bool hasValue(const mediump vec2 position, const mediump vec2 offset) {
void main() { void main() {
#ifdef TEXELFETCH_USABLE #ifdef TEXELFETCH_USABLE
#ifndef GL_ES
const mediump ivec2 position = ivec2(gl_FragCoord.xy*scaling); const mediump ivec2 position = ivec2(gl_FragCoord.xy*scaling);
#else #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; const mediump vec2 position = (gl_FragCoord.xy - vec2(0.5))*scaling*imageSizeInverted;
#endif #endif

Loading…
Cancel
Save