diff options
author | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-02 02:32:30 +0200 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-23 03:51:40 +0200 |
commit | dbee32d302a5944bc8e99b55d956013503b66c6c (patch) | |
tree | 30e53e6986fd78f52917385c187e23cee6b29f6c | |
parent | vulkan_device: Enable VK_EXT_extended_dynamic_state on RADV 21.2 onward (diff) | |
download | yuzu-dbee32d302a5944bc8e99b55d956013503b66c6c.tar yuzu-dbee32d302a5944bc8e99b55d956013503b66c6c.tar.gz yuzu-dbee32d302a5944bc8e99b55d956013503b66c6c.tar.bz2 yuzu-dbee32d302a5944bc8e99b55d956013503b66c6c.tar.lz yuzu-dbee32d302a5944bc8e99b55d956013503b66c6c.tar.xz yuzu-dbee32d302a5944bc8e99b55d956013503b66c6c.tar.zst yuzu-dbee32d302a5944bc8e99b55d956013503b66c6c.zip |
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_cache.cpp | 25 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_cache.h | 2 |
2 files changed, 25 insertions, 2 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp index 2ea9c9f07..2d7eb3e33 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp @@ -328,11 +328,32 @@ GraphicsPipeline* ShaderCache::CurrentGraphicsPipelineSlowPath() { if (is_new) { pipeline = CreateGraphicsPipeline(); } + if (!pipeline) { + return nullptr; + } current_pipeline = pipeline.get(); - if (!pipeline || !pipeline->IsBuilt()) { + return BuiltPipeline(current_pipeline); +} + +GraphicsPipeline* ShaderCache::BuiltPipeline(GraphicsPipeline* pipeline) const noexcept { + if (pipeline->IsBuilt()) { + return pipeline; + } + if (!use_asynchronous_shaders) { + return pipeline; + } + // If something is using depth, we can assume that games are not rendering anything which + // will be used one time. + if (maxwell3d.regs.zeta_enable) { return nullptr; } - return pipeline.get(); + // If games are using a small index count, we can assume these are full screen quads. + // Usually these shaders are only used once for building textures so we can assume they + // can't be built async + if (maxwell3d.regs.index_array.count <= 6 || maxwell3d.regs.vertex_buffer.count <= 6) { + return pipeline; + } + return nullptr; } ComputePipeline* ShaderCache::CurrentComputePipeline() { diff --git a/src/video_core/renderer_opengl/gl_shader_cache.h b/src/video_core/renderer_opengl/gl_shader_cache.h index 9d5306293..a34110b37 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.h +++ b/src/video_core/renderer_opengl/gl_shader_cache.h @@ -54,6 +54,8 @@ public: private: GraphicsPipeline* CurrentGraphicsPipelineSlowPath(); + [[nodiscard]] GraphicsPipeline* BuiltPipeline(GraphicsPipeline* pipeline) const noexcept; + std::unique_ptr<GraphicsPipeline> CreateGraphicsPipeline(); std::unique_ptr<GraphicsPipeline> CreateGraphicsPipeline( |