PDA

View Full Version : texelFetch problem



xernobyl
02-11-2011, 10:05 AM
#version 150

in ivec2 A0;
out vec3 C;
uniform sampler2DRect I;

void main()
{
...
C = texelFetch(I, A0).rgb; // doesn't work
C = texture(I, vec2(A0)).rgb; // works
}


Check the "works" and "doesn't work" lines :)
Any idea why?

FlorianR
02-13-2011, 01:06 AM
I think I remember having had problems like that, because integers should be as "flat in/out ivec*" when given from one shader stage to another, the AMD compiler gave a warning about that. If don't want flat shading, try passing it as vec2 and converting it to ivec in that shader stage.
I can't find it in the GLSL 1.5 spec right now, but i found the following: "Varying variables can now be (unsigned) integers. If declared as such, they have to be flat shaded." in the EXT_gpu_shader_4 spec.
Just give it a shot :)

mobeen
02-13-2011, 06:04 AM
Are u r passing the attribute using

glVertexAttribIPointer

for integer types (ivec*). Note there is an I in there.

Chris Lux
02-13-2011, 08:04 AM
C = texelFetch(I, A0, 0).rgb; // works

read the spec!

xernobyl
02-14-2011, 09:28 AM
@FlorianR flat gives an error. it's the default with ints;
@morbeen I was using that already;
@Chris Lux no it doesn't. Not with rect samplers.

It's working now. I'm not sure that it was... probably something else was causing the error.