mirror of
https://git.h3cjp.net/H3cJP/yuzu.git
synced 2024-11-14 20:22:58 +00:00
GPU: Fixed the index offset rendering, and implemented the base vertex functionality.
This fixes Stardew Valley.
This commit is contained in:
parent
cc73bad293
commit
fca3d1cc65
|
@ -412,12 +412,14 @@ void RasterizerOpenGL::DrawArrays() {
|
||||||
|
|
||||||
const GLenum primitive_mode{MaxwellToGL::PrimitiveTopology(regs.draw.topology)};
|
const GLenum primitive_mode{MaxwellToGL::PrimitiveTopology(regs.draw.topology)};
|
||||||
if (is_indexed) {
|
if (is_indexed) {
|
||||||
const GLint index_min{static_cast<GLint>(regs.index_array.first)};
|
const GLint base_vertex{static_cast<GLint>(regs.vb_element_base)};
|
||||||
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,
|
// Adjust the index buffer offset so it points to the first desired index.
|
||||||
MaxwellToGL::IndexFormat(regs.index_array.format),
|
index_buffer_offset += regs.index_array.first * regs.index_array.FormatSizeInBytes();
|
||||||
reinterpret_cast<const void*>(index_buffer_offset),
|
|
||||||
-index_min);
|
glDrawElementsBaseVertex(primitive_mode, regs.index_array.count,
|
||||||
|
MaxwellToGL::IndexFormat(regs.index_array.format),
|
||||||
|
reinterpret_cast<const void*>(index_buffer_offset), base_vertex);
|
||||||
} else {
|
} else {
|
||||||
glDrawArrays(primitive_mode, 0, regs.vertex_buffer.count);
|
glDrawArrays(primitive_mode, 0, regs.vertex_buffer.count);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue