summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2023-06-26 00:43:23 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2023-06-26 00:43:23 +0200
commit82107b33a2251eb4f55ab2006a8fc0cb47cc39e8 (patch)
tree75eacbc92cbe0f276bfca41425447dfc9cc9d91a /src/video_core/renderer_opengl
parentMerge pull request #10891 from german77/sdl28v2 (diff)
downloadyuzu-82107b33a2251eb4f55ab2006a8fc0cb47cc39e8.tar
yuzu-82107b33a2251eb4f55ab2006a8fc0cb47cc39e8.tar.gz
yuzu-82107b33a2251eb4f55ab2006a8fc0cb47cc39e8.tar.bz2
yuzu-82107b33a2251eb4f55ab2006a8fc0cb47cc39e8.tar.lz
yuzu-82107b33a2251eb4f55ab2006a8fc0cb47cc39e8.tar.xz
yuzu-82107b33a2251eb4f55ab2006a8fc0cb47cc39e8.tar.zst
yuzu-82107b33a2251eb4f55ab2006a8fc0cb47cc39e8.zip
Diffstat (limited to 'src/video_core/renderer_opengl')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp2
-rw-r--r--src/video_core/renderer_opengl/gl_shader_manager.cpp10
-rw-r--r--src/video_core/renderer_opengl/gl_shader_manager.h3
3 files changed, 14 insertions, 1 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index fc711c44a..d03288516 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -222,6 +222,7 @@ void RasterizerOpenGL::PrepareDraw(bool is_indexed, Func&& draw_func) {
gpu.TickWork();
std::scoped_lock lock{buffer_cache.mutex, texture_cache.mutex};
+ program_manager.LocalMemoryWarmup();
pipeline->SetEngine(maxwell3d, gpu_memory);
pipeline->Configure(is_indexed);
@@ -371,6 +372,7 @@ void RasterizerOpenGL::DispatchCompute() {
if (!pipeline) {
return;
}
+ program_manager.LocalMemoryWarmup();
pipeline->SetEngine(kepler_compute, gpu_memory);
pipeline->Configure();
const auto& qmd{kepler_compute->launch_description};
diff --git a/src/video_core/renderer_opengl/gl_shader_manager.cpp b/src/video_core/renderer_opengl/gl_shader_manager.cpp
index 98841ae65..2f6ba6823 100644
--- a/src/video_core/renderer_opengl/gl_shader_manager.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_manager.cpp
@@ -3,7 +3,9 @@
#include <glad/glad.h>
+#include "video_core/host_shaders/opengl_lmem_warmup_comp.h"
#include "video_core/renderer_opengl/gl_shader_manager.h"
+#include "video_core/renderer_opengl/gl_shader_util.h"
namespace OpenGL {
@@ -12,7 +14,8 @@ static constexpr std::array ASSEMBLY_PROGRAM_ENUMS{
GL_GEOMETRY_PROGRAM_NV, GL_FRAGMENT_PROGRAM_NV,
};
-ProgramManager::ProgramManager(const Device& device) {
+ProgramManager::ProgramManager(const Device& device)
+ : lmem_warmup_program(CreateProgram(HostShaders::OPENGL_LMEM_WARMUP_COMP, GL_COMPUTE_SHADER)) {
glCreateProgramPipelines(1, &pipeline.handle);
if (device.UseAssemblyShaders()) {
glEnable(GL_COMPUTE_PROGRAM_NV);
@@ -98,6 +101,11 @@ void ProgramManager::BindAssemblyPrograms(std::span<const OGLAssemblyProgram, NU
void ProgramManager::RestoreGuestCompute() {}
+void ProgramManager::LocalMemoryWarmup() {
+ BindComputeProgram(lmem_warmup_program.handle);
+ glDispatchCompute(1, 1, 1);
+}
+
void ProgramManager::BindPipeline() {
if (!is_pipeline_bound) {
is_pipeline_bound = true;
diff --git a/src/video_core/renderer_opengl/gl_shader_manager.h b/src/video_core/renderer_opengl/gl_shader_manager.h
index 07ffab77f..852d8c88e 100644
--- a/src/video_core/renderer_opengl/gl_shader_manager.h
+++ b/src/video_core/renderer_opengl/gl_shader_manager.h
@@ -30,6 +30,8 @@ public:
void RestoreGuestCompute();
+ void LocalMemoryWarmup();
+
private:
void BindPipeline();
@@ -44,6 +46,7 @@ private:
u32 current_stage_mask = 0;
std::array<GLuint, NUM_STAGES> current_programs{};
GLuint current_assembly_compute_program = 0;
+ OGLProgram lmem_warmup_program;
};
} // namespace OpenGL