oscarbarenys1

geometry shader and integer texture fetches not working..

Discussion created by oscarbarenys1 on Aug 20, 2009
Latest reply on Sep 15, 2009 by TiKu

Hi,

I was testing support of EXT_geometry_shader4 in Catalyst 9.8 on Windows and using this nice GLSL implementation of Marching Cubes as example of this support:

http://www.icare3d.org/blog_techno/gpu/opengl_geometry_shader_marching_cubes.html

which uses EXT_geometry_shader4 and EXT_gpu_shader4 features..

I have fixed some minor changes to GLSL code to compile on ATI  but I can't remove this one:

Compilation error: Geometry shader failed to compile with the following errors:
ERROR: 0:60: 'texelFetch2D' : no matching overloaded function found

is due to this simple code on the geometry_shader (testg80_gs2.glsl):

//Triangles table texture
uniform isampler2D triTableTex;

int triTableValue(int i, int j){
    return texelFetch2D(triTableTex, ivec2(j, i), 0).a;
}

but I have found that texelFetch2D is supported since changing this:

1. Floating integer texture.  isampler2D triTableTex -> sampler2D triTableTex

2. Converting to int the result of the texel fetch:

return int( texelFetch2D(triTableTex, ivec2(j, i), 0).a);

the geometry shader compiles fine.

I have used at the start:

#version 120
//New G80 extensions
#extension GL_EXT_geometry_shader4 : enable
#extension GL_EXT_gpu_shader4 : enable

but changing this simple code to version 1.30 or 1.40 compatible doesn't solve that (of course changing from texelFetch2D to texelFetch and the required changes)..

but in GLSL spec 1.40 (latest supported by AMD..) says it must support

gvec4 texelFetch (gsampler2D sampler, ivec2 P, int lod) where gsampler2D

can be a integer texture..

Of course I know since 1.40 doesn't support geometry shaders and seeing

EXT_geometry_shader4 I don't know if this is supported by the standard 1.40+EXT_geometry_shader4+EXT_gpu_shader4..

 

Anyway for GLSL 1.50 (OpenGL 3.2) support this must be supported

since 1.50 spec says that

gvec4 texelFetch (gsampler2D sampler, ivec2 P, int lod)

must be supported in geometry shaders also..

 

Any comment from any one at AMD if this is a bug in their implementation would be welcome..

 

Thanks

 

 

 

Outcomes