AMD access violation when using GL_PATCHES

Hello!

I am getting a seg fault in the following line, while using an AMD 5700XT:

glDrawArraysInstanced(GL_PATCHES, 0, static_cast <GLsizei>(4), static_cast <GLsizei>(renderDepth));

However, if i change it to:
glDrawArraysInstanced(GL_TRIANGLES, 0, static_cast <GLsizei>(4), static_cast <GLsizei>(renderDepth));

I have also set the required patches param before rendering:
glPatchParameteri(GL_PATCH_VERTICES, 4);

It runs without any problems (obviously i dont get the expected rendering result but also no crashes).

I have tested this on 3 different GPUs:

Nvidia 940m - Works
AMD R9 280x - Works
AMD 5700XT - Seg fault.

I have checked everything (VAO, attribs, sizes of the buffers, any debug messages/ linking errors) and everything seems correct to me. Also i used the same code (and GL version) for all the cards and only the 5700XT gives me trouble.

Any ideas?

If the OpenGL state is such that rendering with patches could possibly work, then any attempt to render with any other primitive would result in a GL_INVALID_OPERATION error. So, do you get such an error?

Thanks for your reply! Yes! That’s exactly what I get if I change from GL_PATCHES to GL_TRIANGLES. What I meant by that is that I don’t get a driver crash. It generates that error but no crash on the amd driver.

I am already using a debug callback function to log all the messages (and its working fine i because i am getting diagnostic and other small warnings from it). But when it gets to that line (i used the VS debugger), the screens go to black for a couple of seconds and then comes back again without any error messages. Is there some kind of GPU log in windows that i can check?

This is what i get on initialization (on the working cards), but nothing after initializing:

Looking at it i dont see anything worrying happening there.

Is this on a MS Windows OS? Sounds like a TDR:(a feature of the WDDM), except that you’re not getting a dialog pop-up about Windows restarting the display driver:

This can be triggered by driver bugs, or app bugs that the driver didn’t catch and prevent from becoming serious low-level errors. Anytime WDDM thinks that the GPU has become unresponsive, a TDR may be triggered to reset the driver+GPU.

If it is a TDR, you should be able to find more info in the Windows event log. Check out psloglist (cmd-line app; from Microsoft Sysinternals) or Event Viewer (GUI app).

1 Like

Hello!

Yes indeed i think its a TDR, but i am definitively not getting the error pop up.
This is what i get from the event viewer, its indeed crashing inside the radeon app:

More on this here:

This response was tagged as the “solution”:

amdmatt:

1 Like

Yeah i have been tracking that thread but i think there isn’t a proper solution yet, although it confirms that there are a lot of driver issues regarding the 5700XT.

For the time being i am using both GPUs inside the case, with the R9 280x connected to the main monitor, which makes it the “master” and everything runs fine, although its ridiculous to say the least i cant use a 400$ GPU which i bought specifically for game development because of the drivers.