summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-05-20 21:59:05 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:32 +0200
commit690b1841e6a1437335c0aae6d934f3fdcdb1680c (patch)
tree97a1aea2c97f3d42015ec59c68794f85611f9db0
parentrenderer_opengl: State track assembly programs (diff)
downloadyuzu-690b1841e6a1437335c0aae6d934f3fdcdb1680c.tar
yuzu-690b1841e6a1437335c0aae6d934f3fdcdb1680c.tar.gz
yuzu-690b1841e6a1437335c0aae6d934f3fdcdb1680c.tar.bz2
yuzu-690b1841e6a1437335c0aae6d934f3fdcdb1680c.tar.lz
yuzu-690b1841e6a1437335c0aae6d934f3fdcdb1680c.tar.xz
yuzu-690b1841e6a1437335c0aae6d934f3fdcdb1680c.tar.zst
yuzu-690b1841e6a1437335c0aae6d934f3fdcdb1680c.zip
Diffstat (limited to '')
-rw-r--r--src/video_core/renderer_opengl/gl_compute_program.cpp5
-rw-r--r--src/video_core/renderer_opengl/gl_shader_manager.h19
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp1
3 files changed, 21 insertions, 4 deletions
diff --git a/src/video_core/renderer_opengl/gl_compute_program.cpp b/src/video_core/renderer_opengl/gl_compute_program.cpp
index fb54618a4..ce52a0052 100644
--- a/src/video_core/renderer_opengl/gl_compute_program.cpp
+++ b/src/video_core/renderer_opengl/gl_compute_program.cpp
@@ -125,10 +125,7 @@ void ComputeProgram::Configure() {
texture_cache.FillComputeImageViews(indices_span, image_view_ids);
if (assembly_program.handle != 0) {
- // FIXME: State track this
- glEnable(GL_COMPUTE_PROGRAM_NV);
- glBindProgramARB(GL_COMPUTE_PROGRAM_NV, assembly_program.handle);
- program_manager.BindProgram(0);
+ program_manager.BindComputeAssemblyProgram(assembly_program.handle);
} else {
program_manager.BindProgram(source_program.handle);
}
diff --git a/src/video_core/renderer_opengl/gl_shader_manager.h b/src/video_core/renderer_opengl/gl_shader_manager.h
index 48669b3cd..df7e1f644 100644
--- a/src/video_core/renderer_opengl/gl_shader_manager.h
+++ b/src/video_core/renderer_opengl/gl_shader_manager.h
@@ -10,6 +10,7 @@
#include <glad/glad.h>
#include "video_core/renderer_opengl/gl_resource_manager.h"
+#include "video_core/renderer_opengl/gl_device.h"
#pragma optimize("", off)
@@ -24,6 +25,12 @@ class ProgramManager {
};
public:
+ explicit ProgramManager(const Device& device) {
+ if (device.UseAssemblyShaders()) {
+ glEnable(GL_COMPUTE_PROGRAM_NV);
+ }
+ }
+
void BindProgram(GLuint program) {
if (current_source_program == program) {
return;
@@ -32,6 +39,17 @@ public:
glUseProgram(program);
}
+ void BindComputeAssemblyProgram(GLuint program) {
+ if (current_compute_assembly_program != program) {
+ current_compute_assembly_program = program;
+ glBindProgramARB(GL_COMPUTE_PROGRAM_NV, program);
+ }
+ if (current_source_program != 0) {
+ current_source_program = 0;
+ glUseProgram(0);
+ }
+ }
+
void BindAssemblyPrograms(std::span<const OGLAssemblyProgram, NUM_STAGES> programs,
u32 stage_mask) {
const u32 changed_mask = current_assembly_mask ^ stage_mask;
@@ -67,6 +85,7 @@ private:
u32 current_assembly_mask = 0;
std::array<GLuint, NUM_STAGES> current_assembly_programs;
+ GLuint current_compute_assembly_program = 0;
};
} // namespace OpenGL
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index 4e77ef808..a4805f3da 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.cpp
+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp
@@ -130,6 +130,7 @@ RendererOpenGL::RendererOpenGL(Core::TelemetrySession& telemetry_session_,
std::unique_ptr<Core::Frontend::GraphicsContext> context_)
: RendererBase{emu_window_, std::move(context_)}, telemetry_session{telemetry_session_},
emu_window{emu_window_}, cpu_memory{cpu_memory_}, gpu{gpu_}, state_tracker{gpu},
+ program_manager{device},
rasterizer(emu_window, gpu, cpu_memory, device, screen_info, program_manager, state_tracker) {
if (Settings::values.renderer_debug && GLAD_GL_KHR_debug) {
glEnable(GL_DEBUG_OUTPUT);