I managed to reproduce the issue (or at least an issue) systematically with the following:
public void TestAMD(ref uint line1List, ref uint line2List, ref uint line3List, bool gen)
{
if (gen)
{
//---------------------- LINE 1 COMPILE ---------------------- //
gl.DeleteLists(line1List, 1);
line1List = gl.GenLists(1);
gl.NewList(line1List, gl.COMPILE);
gl.Begin(gl.LINES);
{
gl.Vertex3f(0, 0, 0);
gl.Vertex3f(1, 1, 0);
}
gl.End();
gl.EndList();
//---------------------- LINE 2 COMPILE ---------------------- //
gl.DeleteLists(line2List, 1);
line2List = gl.GenLists(1);
gl.NewList(line2List, gl.COMPILE);
gl.Begin(gl.LINES);
{
gl.Vertex3f(0, 0, 0);
gl.Vertex3f(-1, -1, 0);
}
gl.End();
gl.EndList();
//---------------------- LINE 3 COMPILE ---------------------- //
gl.DeleteLists(line3List, 1);
line3List = gl.GenLists(1);
gl.NewList(line3List, gl.COMPILE);
gl.Begin(gl.LINES);
{
gl.Vertex3f(0.5f, 0.5f, 0);
gl.Vertex3f(0.5f, -0.5f, 0);
}
gl.End();
gl.EndList();
}
gl.UseProgram(...);
gl.ClearColor(0.25f, 0.25f, 0.25f, 1.0f);
gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
gl.Color4ub(255, 0, 0, 255);
gl.CallList(line1List);
gl.Color4ub(0, 255, 0, 255);
gl.CallList(line2List);
gl.Color4ub(0, 0, 255, 255);
gl.CallList(line3List);
SwapBuffers();
}
This is the shader I’m using:
// VERTEX
void main(void)
{
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
gl_ClipVertex = ecPosition; // userclipping
gl_FrontColor = gl_Color;
gl_Position = ftransform();
}
// FRAGMENT
void main(void)
{
vec4 finalColor;
finalColor = gl_Color;
finalColor = clamp (finalColor, 0.0, 1.0);
gl_FragColor = finalColor;
}
If I use the TestAMD method as follows:
uint line1, line2, line3;
line1 = line2 = line3 = 0;
TestAMD(ref line1, ref line2, ref line3, true);
TestAMD(ref line1, ref line2, ref line3, false);
the first invocation results in an incorrect drawing where line3List is green, while the second invocation gets the line drawn right (blue).
I’m missing something. You said the problem doesn’t occur on NVIDIA cards. And the app doesn’t exhibit the problem in NVIDIA NSight Graphics. Nsight Graphics (AFAIK) only runs on NVIDIA cards. So… it’s unclear why you mentioned the latter.
You are right, NSight Graphics only runs on NVidia Cards but I didn’t know with certainty so I tried to launch the application from NSight and it actually allowed me to run the program (without the possibility to capture and analyze a frame however) and the issue is not there when doing so, so I was wondering about the effect that NSight Graphics may have on an application.