Question

In my game engine, I draw to a framebuffer before drawing to the actual screen, and then use a post processing shader to draw to the actual framebuffer. However, there's an issue I'm having with AMD drivers where my quad is rendering incorrectly.

The code works as expected on both Nvidia and Intel GPUs across multiple operating systems. Here's an example: http://i.stack.imgur.com/5fiJk.png It's been reproduced across 3 systems with different AMD gpus, and hasn't been seen on non-AMD systems.

The code that created the quad is here:

static int data[] = {
    0, 0,
    0, 1,
    1, 1,
    1, 0
};
GLuint vao, vbo;
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
glGenBuffers(1, &vbo);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(data), &data, GL_STATIC_DRAW);
glVertexAttribPointer(0, 2, GL_INT, GL_FALSE, 0, NULL);
glVertexAttribPointer(1, 2, GL_INT, GL_FALSE, 0, NULL);
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
/* code which draws it */
glBindVertexArray(vao);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);

I have tried other options such as using two independent triangles, but nothing thus far has worked. I'm completely lost as to why this behaviour would occur in the AMD drivers.

Was it helpful?

Solution

Then stop sending them as GL_INT. You're already using 8 bytes per position, so you may as well use GL_FLOAT and floating-point values. If you want to save space, use GL_SHORT or GL_BYTE.

Yes, this is technically a driver bug. But you're not gaining anything by using GL_INT.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top