diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 62ee45a36..fe78f4226 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -412,12 +412,14 @@ void RasterizerOpenGL::DrawArrays() { | |||
| 412 | 412 | ||
| 413 | const GLenum primitive_mode{MaxwellToGL::PrimitiveTopology(regs.draw.topology)}; | 413 | const GLenum primitive_mode{MaxwellToGL::PrimitiveTopology(regs.draw.topology)}; |
| 414 | if (is_indexed) { | 414 | if (is_indexed) { |
| 415 | const GLint index_min{static_cast<GLint>(regs.index_array.first)}; | 415 | const GLint base_vertex{static_cast<GLint>(regs.vb_element_base)}; |
| 416 | const GLint index_max{static_cast<GLint>(regs.index_array.first + regs.index_array.count)}; | 416 | |
| 417 | glDrawRangeElementsBaseVertex(primitive_mode, index_min, index_max, regs.index_array.count, | 417 | // Adjust the index buffer offset so it points to the first desired index. |
| 418 | MaxwellToGL::IndexFormat(regs.index_array.format), | 418 | index_buffer_offset += regs.index_array.first * regs.index_array.FormatSizeInBytes(); |
| 419 | reinterpret_cast<const void*>(index_buffer_offset), | 419 | |
| 420 | -index_min); | 420 | glDrawElementsBaseVertex(primitive_mode, regs.index_array.count, |
| 421 | MaxwellToGL::IndexFormat(regs.index_array.format), | ||
| 422 | reinterpret_cast<const void*>(index_buffer_offset), base_vertex); | ||
| 421 | } else { | 423 | } else { |
| 422 | glDrawArrays(primitive_mode, 0, regs.vertex_buffer.count); | 424 | glDrawArrays(primitive_mode, 0, regs.vertex_buffer.count); |
| 423 | } | 425 | } |