Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: nVidia : input-dependent texelFetch in multisample texture always retrieve sample 0

  1. #1
    Intern Newbie
    Join Date
    Jun 2010
    Posts
    41

    nVidia : input-dependent texelFetch in multisample texture always retrieve sample 0

    Hello,

    I'm encoutering a strange bug on an nVidia card while trying to make an input-dependent texelFetch from a multisample texture in a geometry shader.
    The shader has the following input:
    Code :
    flat in ivec3 iGBufferCoord[];
    ... and a 2D multisample texture sampler:
    Code :
    uniform sampler2DMS sNormal;

    Now, in the main function of the geometry shader, I have the following:
    Code :
    vec3 normal = texelFetch( sNormal, iGBufferCoord[0].xy, iGBufferCoord[0].z ).xyz;
    This will always behave as if iGBufferCoord[0].z was 0, even when forcing it to some other value from the vertex shader (so I'm sure the code was not feeding 0's for this value).

    It looks to me like a broken optimization for compile-time constant expressions.
    Is there a pragma on nVidia to disable such optimizations that I suspect are the culprit?

    Note that at some other places in my shaders I iterate over sample indices and fetch texels, and that works just fine (when sample index is a local variable). If I copy gBufferCoord.z to a local variable then use that as layer index, it still doesn't work.

    Any help greatly appreciated.

  2. #2
    Intern Newbie
    Join Date
    Jun 2010
    Posts
    41
    I found a workaround.

    In vertex shader:
    Code :
    in ivec3 aGBufferCoord;
    out ivec2 iGBufferCoord; // used to be ivec3
    out int iSampleIndex;    // new
     
    main() {
      iGBufferCoord = aGBufferCoord.xy;
      iSampleIndex = aGBufferCoord.z;
    }

    Geometry shader:
    Code :
    vec3 normal = texelFetch( sNormal, iGBufferCoord[0], iSampleIndex[0] ).xyz;

    So passing an ivec3 from VS to GS seems buggy on nVidia (GTX280 with drivers 301.42 on Win7 x64).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •