diff options
Diffstat (limited to '')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 274c2dbcf..e37acbfac 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -484,8 +484,13 @@ void RasterizerOpenGL::DrawArrays() { | |||
| 484 | GLintptr index_buffer_offset = 0; | 484 | GLintptr index_buffer_offset = 0; |
| 485 | if (is_indexed) { | 485 | if (is_indexed) { |
| 486 | MICROPROFILE_SCOPE(OpenGL_Index); | 486 | MICROPROFILE_SCOPE(OpenGL_Index); |
| 487 | index_buffer_offset = | 487 | |
| 488 | buffer_cache.UploadMemory(regs.index_array.StartAddress(), index_buffer_size); | 488 | // Adjust the index buffer offset so it points to the first desired index. |
| 489 | auto index_start = regs.index_array.StartAddress(); | ||
| 490 | index_start += static_cast<size_t>(regs.index_array.first) * | ||
| 491 | static_cast<size_t>(regs.index_array.FormatSizeInBytes()); | ||
| 492 | |||
| 493 | index_buffer_offset = buffer_cache.UploadMemory(index_start, index_buffer_size); | ||
| 489 | } | 494 | } |
| 490 | 495 | ||
| 491 | SetupShaders(); | 496 | SetupShaders(); |
| @@ -499,10 +504,6 @@ void RasterizerOpenGL::DrawArrays() { | |||
| 499 | if (is_indexed) { | 504 | if (is_indexed) { |
| 500 | const GLint base_vertex{static_cast<GLint>(regs.vb_element_base)}; | 505 | const GLint base_vertex{static_cast<GLint>(regs.vb_element_base)}; |
| 501 | 506 | ||
| 502 | // Adjust the index buffer offset so it points to the first desired index. | ||
| 503 | index_buffer_offset += static_cast<GLintptr>(regs.index_array.first) * | ||
| 504 | static_cast<GLintptr>(regs.index_array.FormatSizeInBytes()); | ||
| 505 | |||
| 506 | if (gpu.state.current_instance > 0) { | 507 | if (gpu.state.current_instance > 0) { |
| 507 | glDrawElementsInstancedBaseVertexBaseInstance( | 508 | glDrawElementsInstancedBaseVertexBaseInstance( |
| 508 | primitive_mode, regs.index_array.count, | 509 | primitive_mode, regs.index_array.count, |