summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2018-07-02 18:22:17 +0200
committerSubv <subv2112@gmail.com>2018-07-02 18:22:17 +0200
commitfca3d1cc65c3a0a838cf57b716063d9d803c5788 (patch)
treea7b852c45f1f172347cab1ba45e5ce93249ff6b4
parentGPU: Added register definitions for the vertex buffer base element. (diff)
downloadyuzu-fca3d1cc65c3a0a838cf57b716063d9d803c5788.tar
yuzu-fca3d1cc65c3a0a838cf57b716063d9d803c5788.tar.gz
yuzu-fca3d1cc65c3a0a838cf57b716063d9d803c5788.tar.bz2
yuzu-fca3d1cc65c3a0a838cf57b716063d9d803c5788.tar.lz
yuzu-fca3d1cc65c3a0a838cf57b716063d9d803c5788.tar.xz
yuzu-fca3d1cc65c3a0a838cf57b716063d9d803c5788.tar.zst
yuzu-fca3d1cc65c3a0a838cf57b716063d9d803c5788.zip
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp14
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() {
const GLenum primitive_mode{MaxwellToGL::PrimitiveTopology(regs.draw.topology)};
if (is_indexed) {
- const GLint index_min{static_cast<GLint>(regs.index_array.first)};
- const GLint index_max{static_cast<GLint>(regs.index_array.first + regs.index_array.count)};
- glDrawRangeElementsBaseVertex(primitive_mode, index_min, index_max, regs.index_array.count,
- MaxwellToGL::IndexFormat(regs.index_array.format),
- reinterpret_cast<const void*>(index_buffer_offset),
- -index_min);
+ const GLint base_vertex{static_cast<GLint>(regs.vb_element_base)};
+
+ // Adjust the index buffer offset so it points to the first desired index.
+ index_buffer_offset += regs.index_array.first * regs.index_array.FormatSizeInBytes();
+
+ glDrawElementsBaseVertex(primitive_mode, regs.index_array.count,
+ MaxwellToGL::IndexFormat(regs.index_array.format),
+ reinterpret_cast<const void*>(index_buffer_offset), base_vertex);
} else {
glDrawArrays(primitive_mode, 0, regs.vertex_buffer.count);
}