diff options
| author | 2019-01-09 02:40:19 -0300 | |
|---|---|---|
| committer | 2019-01-09 02:40:19 -0300 | |
| commit | 877a978a221d0418953338fe9644dc2b1d8b7b15 (patch) | |
| tree | d803100fe974bce85007e9d41a07f0944207bde0 /src | |
| parent | gl_stream_buffer: Use DSA for buffer management (diff) | |
| download | yuzu-877a978a221d0418953338fe9644dc2b1d8b7b15.tar.gz yuzu-877a978a221d0418953338fe9644dc2b1d8b7b15.tar.xz yuzu-877a978a221d0418953338fe9644dc2b1d8b7b15.zip | |
gl_rasterizer: Workaround Intel VAO DSA bug
There is a bug on Intel's blob driver where it fails to properly build a
vertex array object if it's not bound even after creating it with
glCreateVertexArrays. This workaround binds it after creating it to
bypass the issue.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 6 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_state.cpp | 13 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_state.h | 4 |
3 files changed, 16 insertions, 7 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 7ce8c2bcc..61ccfa104 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -153,6 +153,12 @@ GLuint RasterizerOpenGL::SetupVertexFormat() { | |||
| 153 | vao_entry.Create(); | 153 | vao_entry.Create(); |
| 154 | const GLuint vao = vao_entry.handle; | 154 | const GLuint vao = vao_entry.handle; |
| 155 | 155 | ||
| 156 | // Eventhough we are using DSA to create this vertex array, there is a bug on Intel's blob | ||
| 157 | // that fails to properly create the vertex array if it's not bound even after creating it | ||
| 158 | // with glCreateVertexArrays | ||
| 159 | state.draw.vertex_array = vao; | ||
| 160 | state.ApplyVertexArrayState(); | ||
| 161 | |||
| 156 | glVertexArrayElementBuffer(vao, buffer_cache.GetHandle()); | 162 | glVertexArrayElementBuffer(vao, buffer_cache.GetHandle()); |
| 157 | 163 | ||
| 158 | // Use the vertex array as-is, assumes that the data is formatted correctly for OpenGL. | 164 | // Use the vertex array as-is, assumes that the data is formatted correctly for OpenGL. |
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp index 79bb52ddf..b7ba59350 100644 --- a/src/video_core/renderer_opengl/gl_state.cpp +++ b/src/video_core/renderer_opengl/gl_state.cpp | |||
| @@ -503,7 +503,6 @@ void OpenGLState::ApplySamplers() const { | |||
| 503 | } | 503 | } |
| 504 | 504 | ||
| 505 | void OpenGLState::ApplyFramebufferState() const { | 505 | void OpenGLState::ApplyFramebufferState() const { |
| 506 | // Framebuffer | ||
| 507 | if (draw.read_framebuffer != cur_state.draw.read_framebuffer) { | 506 | if (draw.read_framebuffer != cur_state.draw.read_framebuffer) { |
| 508 | glBindFramebuffer(GL_READ_FRAMEBUFFER, draw.read_framebuffer); | 507 | glBindFramebuffer(GL_READ_FRAMEBUFFER, draw.read_framebuffer); |
| 509 | } | 508 | } |
| @@ -512,6 +511,12 @@ void OpenGLState::ApplyFramebufferState() const { | |||
| 512 | } | 511 | } |
| 513 | } | 512 | } |
| 514 | 513 | ||
| 514 | void OpenGLState::ApplyVertexArrayState() const { | ||
| 515 | if (draw.vertex_array != cur_state.draw.vertex_array) { | ||
| 516 | glBindVertexArray(draw.vertex_array); | ||
| 517 | } | ||
| 518 | } | ||
| 519 | |||
| 515 | void OpenGLState::ApplyDepthClamp() const { | 520 | void OpenGLState::ApplyDepthClamp() const { |
| 516 | if (depth_clamp.far_plane == cur_state.depth_clamp.far_plane && | 521 | if (depth_clamp.far_plane == cur_state.depth_clamp.far_plane && |
| 517 | depth_clamp.near_plane == cur_state.depth_clamp.near_plane) { | 522 | depth_clamp.near_plane == cur_state.depth_clamp.near_plane) { |
| @@ -529,11 +534,7 @@ void OpenGLState::ApplyDepthClamp() const { | |||
| 529 | 534 | ||
| 530 | void OpenGLState::Apply() const { | 535 | void OpenGLState::Apply() const { |
| 531 | ApplyFramebufferState(); | 536 | ApplyFramebufferState(); |
| 532 | 537 | ApplyVertexArrayState(); | |
| 533 | // Vertex array | ||
| 534 | if (draw.vertex_array != cur_state.draw.vertex_array) { | ||
| 535 | glBindVertexArray(draw.vertex_array); | ||
| 536 | } | ||
| 537 | 538 | ||
| 538 | // Shader program | 539 | // Shader program |
| 539 | if (draw.shader_program != cur_state.draw.shader_program) { | 540 | if (draw.shader_program != cur_state.draw.shader_program) { |
diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h index 9dc3f0cc8..a5a7c0920 100644 --- a/src/video_core/renderer_opengl/gl_state.h +++ b/src/video_core/renderer_opengl/gl_state.h | |||
| @@ -204,8 +204,10 @@ public: | |||
| 204 | } | 204 | } |
| 205 | /// Apply this state as the current OpenGL state | 205 | /// Apply this state as the current OpenGL state |
| 206 | void Apply() const; | 206 | void Apply() const; |
| 207 | /// Apply only the state afecting the framebuffer | 207 | /// Apply only the state affecting the framebuffer |
| 208 | void ApplyFramebufferState() const; | 208 | void ApplyFramebufferState() const; |
| 209 | /// Apply only the state affecting the vertex array | ||
| 210 | void ApplyVertexArrayState() const; | ||
| 209 | /// Set the initial OpenGL state | 211 | /// Set the initial OpenGL state |
| 210 | static void ApplyDefaultState(); | 212 | static void ApplyDefaultState(); |
| 211 | /// Resets any references to the given resource | 213 | /// Resets any references to the given resource |