summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2023-06-26 01:06:51 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2023-06-26 01:06:51 +0200
commit4f160633d369b702a45ace9b6ff133312761c5f8 (patch)
treeb8de8656e3c47f0c8cb0576b607eadc8685a9222 /src
parentshaders: Track local memory usage (diff)
downloadyuzu-4f160633d369b702a45ace9b6ff133312761c5f8.tar
yuzu-4f160633d369b702a45ace9b6ff133312761c5f8.tar.gz
yuzu-4f160633d369b702a45ace9b6ff133312761c5f8.tar.bz2
yuzu-4f160633d369b702a45ace9b6ff133312761c5f8.tar.lz
yuzu-4f160633d369b702a45ace9b6ff133312761c5f8.tar.xz
yuzu-4f160633d369b702a45ace9b6ff133312761c5f8.tar.zst
yuzu-4f160633d369b702a45ace9b6ff133312761c5f8.zip
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_device.cpp1
-rw-r--r--src/video_core/renderer_opengl/gl_device.h5
-rw-r--r--src/video_core/renderer_opengl/gl_shader_manager.cpp13
3 files changed, 15 insertions, 4 deletions
diff --git a/src/video_core/renderer_opengl/gl_device.cpp b/src/video_core/renderer_opengl/gl_device.cpp
index 03d234f2f..33e63c17d 100644
--- a/src/video_core/renderer_opengl/gl_device.cpp
+++ b/src/video_core/renderer_opengl/gl_device.cpp
@@ -194,6 +194,7 @@ Device::Device(Core::Frontend::EmuWindow& emu_window) {
has_bool_ref_bug = true;
}
}
+ has_lmem_perf_bug = is_nvidia;
strict_context_required = emu_window.StrictContextRequired();
// Blocks AMD and Intel OpenGL drivers on Windows from using asynchronous shader compilation.
diff --git a/src/video_core/renderer_opengl/gl_device.h b/src/video_core/renderer_opengl/gl_device.h
index ad27264e5..a5a6bbbba 100644
--- a/src/video_core/renderer_opengl/gl_device.h
+++ b/src/video_core/renderer_opengl/gl_device.h
@@ -192,6 +192,10 @@ public:
return supports_conditional_barriers;
}
+ bool HasLmemPerfBug() const {
+ return has_lmem_perf_bug;
+ }
+
private:
static bool TestVariableAoffi();
static bool TestPreciseBug();
@@ -238,6 +242,7 @@ private:
bool can_report_memory{};
bool strict_context_required{};
bool supports_conditional_barriers{};
+ bool has_lmem_perf_bug{};
std::string vendor_name;
};
diff --git a/src/video_core/renderer_opengl/gl_shader_manager.cpp b/src/video_core/renderer_opengl/gl_shader_manager.cpp
index 2f6ba6823..03d4b9d06 100644
--- a/src/video_core/renderer_opengl/gl_shader_manager.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_manager.cpp
@@ -14,12 +14,15 @@ static constexpr std::array ASSEMBLY_PROGRAM_ENUMS{
GL_GEOMETRY_PROGRAM_NV, GL_FRAGMENT_PROGRAM_NV,
};
-ProgramManager::ProgramManager(const Device& device)
- : lmem_warmup_program(CreateProgram(HostShaders::OPENGL_LMEM_WARMUP_COMP, GL_COMPUTE_SHADER)) {
+ProgramManager::ProgramManager(const Device& device) {
glCreateProgramPipelines(1, &pipeline.handle);
if (device.UseAssemblyShaders()) {
glEnable(GL_COMPUTE_PROGRAM_NV);
}
+ if (device.HasLmemPerfBug()) {
+ lmem_warmup_program =
+ CreateProgram(HostShaders::OPENGL_LMEM_WARMUP_COMP, GL_COMPUTE_SHADER);
+ }
}
void ProgramManager::BindComputeProgram(GLuint program) {
@@ -102,8 +105,10 @@ void ProgramManager::BindAssemblyPrograms(std::span<const OGLAssemblyProgram, NU
void ProgramManager::RestoreGuestCompute() {}
void ProgramManager::LocalMemoryWarmup() {
- BindComputeProgram(lmem_warmup_program.handle);
- glDispatchCompute(1, 1, 1);
+ if (lmem_warmup_program.handle != 0) {
+ BindComputeProgram(lmem_warmup_program.handle);
+ glDispatchCompute(1, 1, 1);
+ }
}
void ProgramManager::BindPipeline() {