0

Simply my problem is that on NVIDIA cards, my openGL stuff works perfectly, on AMD cards it seems to completely jump the geometry shader. In my geo shader I had it so it adds an extra point to triangles to form a quad which is outputted as a trianglestrip. On AMD cards that extra point never happens, but the fragment shader still works fine as all the textures are still the correct colours for the triangles.

I have checked that the shader compiles with absolutely no errors.

Also my shader version is:

#version 330 core

I hoping this is a common problem because I can't find a single thing on Google about it.

#version 330 core
layout(triangles) in;
layout(triangle_strip, max_vertices=4) out;


in vec3 texCoord[];
out vec3 texCord;

uniform mat4 MVP;

void main()
{
texCord = vec3(0,0,0);  
for(int i=0; i<3; i++)
{
    gl_Position =MVP * gl_in[i].gl_Position;
    switch(i)
    {
        case 0: texCord = vec3(0,1,0);
                break;
        case 1: texCord = vec3(0,0,0);
                break;
        case 2: texCord = vec3(1,1,0);
                break;
    }
EmitVertex();
}
gl_Position =MVP * vec4(gl_in[0].gl_Position.x += 0.5, gl_in[0].gl_Position.y -= 0.5, gl_in[0].gl_Position.z, gl_in[0].gl_Position.w);
texCord = vec3(1,0,0);
EmitVertex();
EndPrimitive();
} 
DeanOC
  • 7,142
  • 6
  • 42
  • 56
  • It would help if you included the geometry shader in question. You may be doing something undefined, like trying to re-use the values of the last emitted vertex. – Andon M. Coleman Feb 07 '14 at 09:57
  • Updated the original post – The Empire Strikes Back Feb 07 '14 at 10:08
  • Yeah... this really is not a good shader. You are trying to modify the first of the three input vertices with `+=` and `-=`. ***Why?*** I would expect a good compiler to see that and generate a warning of some sort. Geometry shader invocations run in parallel so even if this were possible, it would be pretty difficult to do meaningfully. – Andon M. Coleman Feb 07 '14 at 10:16
  • How do you suggest I generate my forth point then? Its not actually meant to modify the gl_in, its meant to create a new vec4 with the values of gl_in plus/minus offsets – The Empire Strikes Back Feb 07 '14 at 10:36
  • 1
    Certainly not by modifying one of your input vertices. `gl_Position =MVP * vec4(gl_in[0].gl_Position.x + 0.5, gl_in[0].gl_Position.y - 0.5, gl_in[0].gl_Position.z, gl_in[0].gl_Position.w);` would make *much* more sense. It is not an error to modify something with `in` storage qualification, but the change will not propagate beyond the scope of the input. In other words, another GS invocation that shares vertex 0 is not going to see the changes you made. – Andon M. Coleman Feb 07 '14 at 10:41
  • Yeah sorry I completing rewrote that comment and bloody forgot to hit save. But yeah that += stuff was a complete error and I have no reason why I did it in the first place. I'm just waiting on a mate to test if this makes a difference on his AMD machine. – The Empire Strikes Back Feb 07 '14 at 10:52
  • 1
    Yep that was the problem! Thanks for that, I would of never spotted it. – The Empire Strikes Back Feb 07 '14 at 11:14

0 Answers0