diff options
| author | 2021-07-01 20:32:30 -0400 | |
|---|---|---|
| committer | 2021-07-22 21:51:40 -0400 | |
| commit | dbee32d302a5944bc8e99b55d956013503b66c6c (patch) | |
| tree | 30e53e6986fd78f52917385c187e23cee6b29f6c | |
| parent | vulkan_device: Enable VK_EXT_extended_dynamic_state on RADV 21.2 onward (diff) | |
| download | yuzu-dbee32d302a5944bc8e99b55d956013503b66c6c.tar.gz yuzu-dbee32d302a5944bc8e99b55d956013503b66c6c.tar.xz yuzu-dbee32d302a5944bc8e99b55d956013503b66c6c.zip | |
gl_shader_cache: Fixes for async shaders
| -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() { | |||
| 328 | if (is_new) { | 328 | if (is_new) { |
| 329 | pipeline = CreateGraphicsPipeline(); | 329 | pipeline = CreateGraphicsPipeline(); |
| 330 | } | 330 | } |
| 331 | if (!pipeline) { | ||
| 332 | return nullptr; | ||
| 333 | } | ||
| 331 | current_pipeline = pipeline.get(); | 334 | current_pipeline = pipeline.get(); |
| 332 | if (!pipeline || !pipeline->IsBuilt()) { | 335 | return BuiltPipeline(current_pipeline); |
| 336 | } | ||
| 337 | |||
| 338 | GraphicsPipeline* ShaderCache::BuiltPipeline(GraphicsPipeline* pipeline) const noexcept { | ||
| 339 | if (pipeline->IsBuilt()) { | ||
| 340 | return pipeline; | ||
| 341 | } | ||
| 342 | if (!use_asynchronous_shaders) { | ||
| 343 | return pipeline; | ||
| 344 | } | ||
| 345 | // If something is using depth, we can assume that games are not rendering anything which | ||
| 346 | // will be used one time. | ||
| 347 | if (maxwell3d.regs.zeta_enable) { | ||
| 333 | return nullptr; | 348 | return nullptr; |
| 334 | } | 349 | } |
| 335 | return pipeline.get(); | 350 | // If games are using a small index count, we can assume these are full screen quads. |
| 351 | // Usually these shaders are only used once for building textures so we can assume they | ||
| 352 | // can't be built async | ||
| 353 | if (maxwell3d.regs.index_array.count <= 6 || maxwell3d.regs.vertex_buffer.count <= 6) { | ||
| 354 | return pipeline; | ||
| 355 | } | ||
| 356 | return nullptr; | ||
| 336 | } | 357 | } |
| 337 | 358 | ||
| 338 | ComputePipeline* ShaderCache::CurrentComputePipeline() { | 359 | 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: | |||
| 54 | private: | 54 | private: |
| 55 | GraphicsPipeline* CurrentGraphicsPipelineSlowPath(); | 55 | GraphicsPipeline* CurrentGraphicsPipelineSlowPath(); |
| 56 | 56 | ||
| 57 | [[nodiscard]] GraphicsPipeline* BuiltPipeline(GraphicsPipeline* pipeline) const noexcept; | ||
| 58 | |||
| 57 | std::unique_ptr<GraphicsPipeline> CreateGraphicsPipeline(); | 59 | std::unique_ptr<GraphicsPipeline> CreateGraphicsPipeline(); |
| 58 | 60 | ||
| 59 | std::unique_ptr<GraphicsPipeline> CreateGraphicsPipeline( | 61 | std::unique_ptr<GraphicsPipeline> CreateGraphicsPipeline( |