summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl/gl_rasterizer.cpp
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2019-12-29 03:08:40 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-02-28 21:56:42 +0100
commit69ad6279e45db408ba3add0b540660ae34ba8e3f (patch)
treeb01bb91ad48fc64ca68cc23c609741dd7d72cf8e /src/video_core/renderer_opengl/gl_rasterizer.cpp
parentgl_state_tracker: Implement dirty flags for color masks (diff)
downloadyuzu-69ad6279e45db408ba3add0b540660ae34ba8e3f.tar
yuzu-69ad6279e45db408ba3add0b540660ae34ba8e3f.tar.gz
yuzu-69ad6279e45db408ba3add0b540660ae34ba8e3f.tar.bz2
yuzu-69ad6279e45db408ba3add0b540660ae34ba8e3f.tar.lz
yuzu-69ad6279e45db408ba3add0b540660ae34ba8e3f.tar.xz
yuzu-69ad6279e45db408ba3add0b540660ae34ba8e3f.tar.zst
yuzu-69ad6279e45db408ba3add0b540660ae34ba8e3f.zip
Diffstat (limited to '')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index b4cec274d..211b11489 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -120,7 +120,11 @@ void RasterizerOpenGL::CheckExtensions() {
void RasterizerOpenGL::SetupVertexFormat() {
auto& gpu = system.GPU().Maxwell3D();
- const auto& regs = gpu.regs;
+ auto& flags = gpu.dirty.flags;
+ if (!flags[Dirty::VertexFormats]) {
+ return;
+ }
+ flags[Dirty::VertexFormats] = false;
MICROPROFILE_SCOPE(OpenGL_VAO);
@@ -130,25 +134,31 @@ void RasterizerOpenGL::SetupVertexFormat() {
// avoid OpenGL errors.
// TODO(Subv): Analyze the shader to identify which attributes are actually used and don't
// assume every shader uses them all.
- for (u32 index = 0; index < 16; ++index) {
- const auto& attrib = regs.vertex_attrib_format[index];
+ for (std::size_t index = 0; index < 16; ++index) {
+ if (!flags[Dirty::VertexFormat0 + index]) {
+ continue;
+ }
+ flags[Dirty::VertexFormat0 + index] = false;
+
+ const auto attrib = gpu.regs.vertex_attrib_format[index];
+ const auto gl_index = static_cast<GLuint>(index);
// Ignore invalid attributes.
if (!attrib.IsValid()) {
- glDisableVertexAttribArray(index);
+ glDisableVertexAttribArray(gl_index);
continue;
}
- glEnableVertexAttribArray(index);
+ glEnableVertexAttribArray(gl_index);
if (attrib.type == Maxwell::VertexAttribute::Type::SignedInt ||
attrib.type == Maxwell::VertexAttribute::Type::UnsignedInt) {
- glVertexAttribIFormat(index, attrib.ComponentCount(), MaxwellToGL::VertexType(attrib),
- attrib.offset);
+ glVertexAttribIFormat(gl_index, attrib.ComponentCount(),
+ MaxwellToGL::VertexType(attrib), attrib.offset);
} else {
- glVertexAttribFormat(index, attrib.ComponentCount(), MaxwellToGL::VertexType(attrib),
+ glVertexAttribFormat(gl_index, attrib.ComponentCount(), MaxwellToGL::VertexType(attrib),
attrib.IsNormalized() ? GL_TRUE : GL_FALSE, attrib.offset);
}
- glVertexAttribBinding(index, attrib.buffer);
+ glVertexAttribBinding(gl_index, attrib.buffer);
}
}