From ea4928393f164723e904cf2192a5b724f11ef844 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Sun, 6 Jan 2019 00:28:01 -0300 Subject: gl_state: Drop uniform buffer state tracking --- src/video_core/renderer_opengl/gl_state.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src/video_core/renderer_opengl/gl_state.cpp') diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp index dc0a5ed5e..e54aff995 100644 --- a/src/video_core/renderer_opengl/gl_state.cpp +++ b/src/video_core/renderer_opengl/gl_state.cpp @@ -84,7 +84,6 @@ OpenGLState::OpenGLState() { draw.draw_framebuffer = 0; draw.vertex_array = 0; draw.vertex_buffer = 0; - draw.uniform_buffer = 0; draw.shader_program = 0; draw.program_pipeline = 0; @@ -544,10 +543,6 @@ void OpenGLState::ApplyDepthClamp() const { void OpenGLState::Apply() const { ApplyFramebufferState(); ApplyVertexBufferState(); - // Uniform buffer - if (draw.uniform_buffer != cur_state.draw.uniform_buffer) { - glBindBuffer(GL_UNIFORM_BUFFER, draw.uniform_buffer); - } // Shader program if (draw.shader_program != cur_state.draw.shader_program) { @@ -642,9 +637,6 @@ OpenGLState& OpenGLState::ResetBuffer(GLuint handle) { if (draw.vertex_buffer == handle) { draw.vertex_buffer = 0; } - if (draw.uniform_buffer == handle) { - draw.uniform_buffer = 0; - } return *this; } -- cgit v1.2.3 From 35c095898bf51098d9b2a71447850f3e1b0fc350 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Sun, 6 Jan 2019 01:53:27 -0300 Subject: gl_rasterizer: Use DSA for vertex array objects --- src/video_core/renderer_opengl/gl_state.cpp | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) (limited to 'src/video_core/renderer_opengl/gl_state.cpp') diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp index e54aff995..79bb52ddf 100644 --- a/src/video_core/renderer_opengl/gl_state.cpp +++ b/src/video_core/renderer_opengl/gl_state.cpp @@ -83,7 +83,6 @@ OpenGLState::OpenGLState() { draw.read_framebuffer = 0; draw.draw_framebuffer = 0; draw.vertex_array = 0; - draw.vertex_buffer = 0; draw.shader_program = 0; draw.program_pipeline = 0; @@ -513,18 +512,6 @@ void OpenGLState::ApplyFramebufferState() const { } } -void OpenGLState::ApplyVertexBufferState() const { - // Vertex array - if (draw.vertex_array != cur_state.draw.vertex_array) { - glBindVertexArray(draw.vertex_array); - } - - // Vertex buffer - if (draw.vertex_buffer != cur_state.draw.vertex_buffer) { - glBindBuffer(GL_ARRAY_BUFFER, draw.vertex_buffer); - } -} - void OpenGLState::ApplyDepthClamp() const { if (depth_clamp.far_plane == cur_state.depth_clamp.far_plane && depth_clamp.near_plane == cur_state.depth_clamp.near_plane) { @@ -542,7 +529,11 @@ void OpenGLState::ApplyDepthClamp() const { void OpenGLState::Apply() const { ApplyFramebufferState(); - ApplyVertexBufferState(); + + // Vertex array + if (draw.vertex_array != cur_state.draw.vertex_array) { + glBindVertexArray(draw.vertex_array); + } // Shader program if (draw.shader_program != cur_state.draw.shader_program) { @@ -633,13 +624,6 @@ OpenGLState& OpenGLState::ResetPipeline(GLuint handle) { return *this; } -OpenGLState& OpenGLState::ResetBuffer(GLuint handle) { - if (draw.vertex_buffer == handle) { - draw.vertex_buffer = 0; - } - return *this; -} - OpenGLState& OpenGLState::ResetVertexArray(GLuint handle) { if (draw.vertex_array == handle) { draw.vertex_array = 0; -- cgit v1.2.3 From 877a978a221d0418953338fe9644dc2b1d8b7b15 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Wed, 9 Jan 2019 02:40:19 -0300 Subject: 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. --- src/video_core/renderer_opengl/gl_state.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/video_core/renderer_opengl/gl_state.cpp') 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 { } void OpenGLState::ApplyFramebufferState() const { - // Framebuffer if (draw.read_framebuffer != cur_state.draw.read_framebuffer) { glBindFramebuffer(GL_READ_FRAMEBUFFER, draw.read_framebuffer); } @@ -512,6 +511,12 @@ void OpenGLState::ApplyFramebufferState() const { } } +void OpenGLState::ApplyVertexArrayState() const { + if (draw.vertex_array != cur_state.draw.vertex_array) { + glBindVertexArray(draw.vertex_array); + } +} + void OpenGLState::ApplyDepthClamp() const { if (depth_clamp.far_plane == cur_state.depth_clamp.far_plane && depth_clamp.near_plane == cur_state.depth_clamp.near_plane) { @@ -529,11 +534,7 @@ void OpenGLState::ApplyDepthClamp() const { void OpenGLState::Apply() const { ApplyFramebufferState(); - - // Vertex array - if (draw.vertex_array != cur_state.draw.vertex_array) { - glBindVertexArray(draw.vertex_array); - } + ApplyVertexArrayState(); // Shader program if (draw.shader_program != cur_state.draw.shader_program) { -- cgit v1.2.3