diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-06-20 08:44:06 +0200 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-07-06 05:37:55 +0200 |
commit | 9cdc576f6055cbb308551f09e3566b34233b226e (patch) | |
tree | 7106c6ef615e0771a070afc3180d30cade558e74 /src/video_core/renderer_opengl/gl_rasterizer.cpp | |
parent | gl_buffer_cache: Implement with generic buffer cache (diff) | |
download | yuzu-9cdc576f6055cbb308551f09e3566b34233b226e.tar yuzu-9cdc576f6055cbb308551f09e3566b34233b226e.tar.gz yuzu-9cdc576f6055cbb308551f09e3566b34233b226e.tar.bz2 yuzu-9cdc576f6055cbb308551f09e3566b34233b226e.tar.lz yuzu-9cdc576f6055cbb308551f09e3566b34233b226e.tar.xz yuzu-9cdc576f6055cbb308551f09e3566b34233b226e.tar.zst yuzu-9cdc576f6055cbb308551f09e3566b34233b226e.zip |
Diffstat (limited to 'src/video_core/renderer_opengl/gl_rasterizer.cpp')
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index b57d60856..f3527d65b 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -198,9 +198,8 @@ void RasterizerOpenGL::SetupVertexBuffer(GLuint vao) { const auto [vertex_buffer, vertex_buffer_offset] = buffer_cache.UploadMemory(start, size); // Bind the vertex array to the buffer at the current offset. - // FIXME(Rodrigo): This dereferenced pointer might be invalidated in future uploads. - glVertexArrayVertexBuffer(vao, index, *vertex_buffer, vertex_buffer_offset, - vertex_array.stride); + vertex_array_pushbuffer.SetVertexBuffer(index, vertex_buffer, vertex_buffer_offset, + vertex_array.stride); if (regs.instanced_arrays.IsInstancingEnabled(index) && vertex_array.divisor != 0) { // Enable vertex buffer instancing with the specified divisor. @@ -214,7 +213,7 @@ void RasterizerOpenGL::SetupVertexBuffer(GLuint vao) { gpu.dirty_flags.vertex_array.reset(); } -GLintptr RasterizerOpenGL::SetupIndexBuffer(GLuint vao) { +GLintptr RasterizerOpenGL::SetupIndexBuffer() { if (accelerate_draw != AccelDraw::Indexed) { return 0; } @@ -222,8 +221,7 @@ GLintptr RasterizerOpenGL::SetupIndexBuffer(GLuint vao) { const auto& regs = system.GPU().Maxwell3D().regs; const std::size_t size = CalculateIndexBufferSize(); const auto [buffer, offset] = buffer_cache.UploadMemory(regs.index_array.IndexStart(), size); - // FIXME(Rodrigo): This dereferenced pointer might be invalidated in future uploads. - glVertexArrayElementBuffer(vao, *buffer); + vertex_array_pushbuffer.SetIndexBuffer(buffer); return offset; } @@ -644,10 +642,11 @@ void RasterizerOpenGL::DrawArrays() { // Prepare vertex array format. const GLuint vao = SetupVertexFormat(); + vertex_array_pushbuffer.Setup(vao); // Upload vertex and index data. SetupVertexBuffer(vao); - const GLintptr index_buffer_offset = SetupIndexBuffer(vao); + const GLintptr index_buffer_offset = SetupIndexBuffer(); // Setup draw parameters. It will automatically choose what glDraw* method to use. const DrawParameters params = SetupDraw(index_buffer_offset); @@ -667,6 +666,7 @@ void RasterizerOpenGL::DrawArrays() { const bool invalidate = buffer_cache.Unmap(); // Now that we are no longer uploading data, we can safely bind the buffers to OpenGL. + vertex_array_pushbuffer.Bind(); bind_ubo_pushbuffer.Bind(); bind_ssbo_pushbuffer.Bind(); |