Use std::span to pass vertex data

Starts utilizing
[std::span](https://en.cppreference.com/w/cpp/container/span) to
indicate a non-owning view of a contiguous array of elements rather than
`T* data, usize count`.
This commit is contained in:
Wunkolo 2023-06-16 07:28:35 -07:00
parent c6f5d19983
commit 553d23974a
5 changed files with 32 additions and 24 deletions

View file

@ -265,7 +265,7 @@ void Renderer::setupBlending() {
}
}
void Renderer::drawVertices(OpenGL::Primitives primType, Vertex* vertices, u32 count) {
void Renderer::drawVertices(OpenGL::Primitives primType, std::span<const Vertex> vertices) {
// Adjust alpha test if necessary
const u32 alphaControl = regs[PICAInternalRegs::AlphaTestConfig];
if (alphaControl != oldAlphaControl) {
@ -352,8 +352,8 @@ void Renderer::drawVertices(OpenGL::Primitives primType, Vertex* vertices, u32 c
}
}
vbo.bufferVertsSub(vertices, count);
OpenGL::draw(primType, count);
vbo.bufferVertsSub(vertices);
OpenGL::draw(primType, vertices.size());
}
constexpr u32 topScreenBuffer = 0x1f000000;