Search Issue Tracker

By Design

Votes

0

Found in

5.5.1f1

Issue ID

885599

Regression

No

[OpenGL] VAOs are not reused, causing a GL_INVALID_OPERATION when binding them

OpenGL

-

VAOs are not reused, but instead generated, binded, and deleted every frame, instead of being reused.

Steps to reproduce:
1) Open the attached project (VAOBugReport/UnityProject_VAOBug) on a Windows machine.
2) Open 'VAOBug' scene.
3) Enter play mode.

- A Command Prompt window, logging the GL_INVALID_OPERATION message appears, Unity crashes after a couple seconds.
The code that triggers the crash is as follows (in main.cpp attached in ~/VAOBugReport/src):
oglBindVertexArray(_vertex_array_id);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
oglBindVertexArray(0);

Replacing it with the following code and recompiling the .dll prevents it from crashing:
oglBindBuffer(GL_ARRAY_BUFFER, locations[loc_vert_pos].id);
oglEnableVertexAttribArray(loc_vert_pos);
oglVertexAttribPointer(loc_vert_pos, 3, GL_FLOAT, GL_FALSE, 0, reinterpret_cast<void*>(0));
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
oglDisableVertexAttribArray(loc_vert_pos);

Reproduced on:
2017.1.0a5, 5.5.3f1, 5.2.4f1

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.