summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/video_core/renderer_opengl/gl_shader_cache.cpp25
-rw-r--r--src/video_core/renderer_opengl/gl_shader_cache.h2
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
338GraphicsPipeline* 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
338ComputePipeline* ShaderCache::CurrentComputePipeline() { 359ComputePipeline* 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:
54private: 54private:
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(