summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Markus Wick2018-11-06 19:15:44 +0100
committerGravatar Markus Wick2018-11-06 22:31:33 +0100
commit359db6a673b1fa13c80e6b8bf54d5c29bc3b25db (patch)
treeade5874bcf54c42c7afaf8ab47d5cbd33e8a440a /src
parentgl_rasterizer: Split VAO and VB setup functions. (diff)
downloadyuzu-359db6a673b1fa13c80e6b8bf54d5c29bc3b25db.tar.gz
yuzu-359db6a673b1fa13c80e6b8bf54d5c29bc3b25db.tar.xz
yuzu-359db6a673b1fa13c80e6b8bf54d5c29bc3b25db.zip
gl_rasterizer: Skip VAO binding if the state is clean.
Diffstat (limited to 'src')
-rw-r--r--src/video_core/engines/maxwell_3d.cpp8
-rw-r--r--src/video_core/engines/maxwell_3d.h6
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp9
3 files changed, 21 insertions, 2 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index d79c50919..41e554998 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -92,8 +92,16 @@ void Maxwell3D::WriteReg(u32 method, u32 value, u32 remaining_params) {
92 debug_context->OnEvent(Tegra::DebugContext::Event::MaxwellCommandLoaded, nullptr); 92 debug_context->OnEvent(Tegra::DebugContext::Event::MaxwellCommandLoaded, nullptr);
93 } 93 }
94 94
95 u32 old = regs.reg_array[method];
95 regs.reg_array[method] = value; 96 regs.reg_array[method] = value;
96 97
98 if (value != old) {
99 if (method >= MAXWELL3D_REG_INDEX(vertex_attrib_format) &&
100 method < MAXWELL3D_REG_INDEX(vertex_attrib_format) + regs.vertex_attrib_format.size()) {
101 dirty_flags.vertex_attrib_format = true;
102 }
103 }
104
97 switch (method) { 105 switch (method) {
98 case MAXWELL3D_REG_INDEX(macros.data): { 106 case MAXWELL3D_REG_INDEX(macros.data): {
99 ProcessMacroUpload(value); 107 ProcessMacroUpload(value);
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h
index 50873813e..f2052b4c7 100644
--- a/src/video_core/engines/maxwell_3d.h
+++ b/src/video_core/engines/maxwell_3d.h
@@ -983,6 +983,12 @@ public:
983 State state{}; 983 State state{};
984 MemoryManager& memory_manager; 984 MemoryManager& memory_manager;
985 985
986 struct DirtyFlags {
987 bool vertex_attrib_format = true;
988 };
989
990 DirtyFlags dirty_flags;
991
986 /// Reads a register value located at the input method address 992 /// Reads a register value located at the input method address
987 u32 GetRegisterValue(u32 method) const; 993 u32 GetRegisterValue(u32 method) const;
988 994
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index d4c7191b3..6ae2adfab 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -124,10 +124,15 @@ RasterizerOpenGL::RasterizerOpenGL(Core::Frontend::EmuWindow& window, ScreenInfo
124RasterizerOpenGL::~RasterizerOpenGL() {} 124RasterizerOpenGL::~RasterizerOpenGL() {}
125 125
126void RasterizerOpenGL::SetupVertexFormat() { 126void RasterizerOpenGL::SetupVertexFormat() {
127 MICROPROFILE_SCOPE(OpenGL_VAO); 127 auto& gpu = Core::System::GetInstance().GPU().Maxwell3D();
128 const auto& gpu = Core::System::GetInstance().GPU().Maxwell3D();
129 const auto& regs = gpu.regs; 128 const auto& regs = gpu.regs;
130 129
130 if (!gpu.dirty_flags.vertex_attrib_format)
131 return;
132 gpu.dirty_flags.vertex_attrib_format = false;
133
134 MICROPROFILE_SCOPE(OpenGL_VAO);
135
131 auto [iter, is_cache_miss] = vertex_array_cache.try_emplace(regs.vertex_attrib_format); 136 auto [iter, is_cache_miss] = vertex_array_cache.try_emplace(regs.vertex_attrib_format);
132 auto& VAO = iter->second; 137 auto& VAO = iter->second;
133 138