   Is the number of texture lookups limited?
  Hi,my geometry shader code fails when calling texelFetch2D. There's no syntax error in the code and the texture coordinates are valid. The code reads from only 1 texture unit, but up to 12 times (with different coordinates each time) per primitive.Could this be the problem? Is the number of texture lookups limited?TiKu   
  Yes, it is. It depends on the Shader Model you're compiling for, and probably on the card, too. For shader model 2, you're allowed to have 32 texture accesses per pixel shader, but only to indirection level 6. So if you fetch a texel, calculate a new texcoord from it and use it to fetch another texel, that's an indirection level. These constraints are somewhat lifted in shader model 3, and are close to non-existent in shader model 4.   ;  Interesting. My card is a Geforce 8800 GTS. Geometry shaders are part of SM4.0 if I remember correctly, so I'm pretty sure I use shader model 4.0.I have 1 texture lookup in the fragment shader, none in the vertex shader and up to 12 in the geomtry shader. From what you've written, this shouldn't be a problem?!Maybe it's not the number of texture lookups that's too high, but the number of variables. I know that there is a limit for varying variables. Do variables defined inside a function count as varying? I have only 4 shader-wide uniform variables and 1 shader-wide varying variable, but inside the functions I declare some more variables.   ;  There really seems to be such a limit. I changed the shader code to heavily reuse variables and now it works.   