diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2023-02-02 04:38:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-02 04:38:13 +0100 |
commit | 8a33f8bd303221fdcbdebe2579e3fbefa03b385e (patch) | |
tree | 47c1df67181d5f6752b9f532c5c4284510d4aff1 /src/video_core/renderer_opengl/gl_compute_pipeline.cpp | |
parent | Merge pull request #9703 from ameerj/txq-ms (diff) | |
parent | gl_compute_pipeline: Force context flush when loading shader cache (diff) | |
download | yuzu-8a33f8bd303221fdcbdebe2579e3fbefa03b385e.tar yuzu-8a33f8bd303221fdcbdebe2579e3fbefa03b385e.tar.gz yuzu-8a33f8bd303221fdcbdebe2579e3fbefa03b385e.tar.bz2 yuzu-8a33f8bd303221fdcbdebe2579e3fbefa03b385e.tar.lz yuzu-8a33f8bd303221fdcbdebe2579e3fbefa03b385e.tar.xz yuzu-8a33f8bd303221fdcbdebe2579e3fbefa03b385e.tar.zst yuzu-8a33f8bd303221fdcbdebe2579e3fbefa03b385e.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_opengl/gl_compute_pipeline.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/video_core/renderer_opengl/gl_compute_pipeline.cpp b/src/video_core/renderer_opengl/gl_compute_pipeline.cpp index 26d066004..1a0cea9b7 100644 --- a/src/video_core/renderer_opengl/gl_compute_pipeline.cpp +++ b/src/video_core/renderer_opengl/gl_compute_pipeline.cpp @@ -30,7 +30,7 @@ bool ComputePipelineKey::operator==(const ComputePipelineKey& rhs) const noexcep ComputePipeline::ComputePipeline(const Device& device, TextureCache& texture_cache_, BufferCache& buffer_cache_, ProgramManager& program_manager_, const Shader::Info& info_, std::string code, - std::vector<u32> code_v) + std::vector<u32> code_v, bool force_context_flush) : texture_cache{texture_cache_}, buffer_cache{buffer_cache_}, program_manager{program_manager_}, info{info_} { switch (device.GetShaderBackend()) { @@ -63,6 +63,15 @@ ComputePipeline::ComputePipeline(const Device& device, TextureCache& texture_cac writes_global_memory = !use_storage_buffers && std::ranges::any_of(info.storage_buffers_descriptors, [](const auto& desc) { return desc.is_written; }); + if (force_context_flush) { + std::scoped_lock lock{built_mutex}; + built_fence.Create(); + // Flush this context to ensure compilation commands and fence are in the GPU pipe. + glFlush(); + built_condvar.notify_one(); + } else { + is_built = true; + } } void ComputePipeline::Configure() { @@ -142,6 +151,9 @@ void ComputePipeline::Configure() { } texture_cache.FillComputeImageViews(std::span(views.data(), views.size())); + if (!is_built) { + WaitForBuild(); + } if (assembly_program.handle != 0) { program_manager.BindComputeAssemblyProgram(assembly_program.handle); } else { @@ -223,4 +235,13 @@ void ComputePipeline::Configure() { } } +void ComputePipeline::WaitForBuild() { + if (built_fence.handle == 0) { + std::unique_lock lock{built_mutex}; + built_condvar.wait(lock, [this] { return built_fence.handle != 0; }); + } + ASSERT(glClientWaitSync(built_fence.handle, 0, GL_TIMEOUT_IGNORED) != GL_WAIT_FAILED); + is_built = true; +} + } // namespace OpenGL |