Compare commits

...

2 Commits

Author SHA1 Message Date
Morph
579fe06de1 vulkan_pipeline_cache: Remove asynchronous shader compilation 2023-01-25 20:49:59 -05:00
Morph
c97f33b28d config: Make asynchronous shaders OpenGL only
Since the release of Project Hades, the shader de/recompiler rewrite, shader compilation under the Vulkan API has improved significantly compared to the previous shader recompiler.
This setting was conceived when shader compilation was significantly slower than it is now, and thus, its utility is greatly diminished on the Vulkan backend.
This makes the setting exclusive to OpenGL, where its still provides a significant benefit.
2023-01-25 20:49:59 -05:00
4 changed files with 5 additions and 31 deletions

View File

@@ -284,7 +284,6 @@ PipelineCache::PipelineCache(RasterizerVulkan& rasterizer_, const Device& device
descriptor_pool{descriptor_pool_}, update_descriptor_queue{update_descriptor_queue_},
render_pass_cache{render_pass_cache_}, buffer_cache{buffer_cache_},
texture_cache{texture_cache_}, shader_notify{shader_notify_},
use_asynchronous_shaders{Settings::values.use_asynchronous_shaders.GetValue()},
use_vulkan_pipeline_cache{Settings::values.use_vulkan_driver_pipeline_cache.GetValue()},
workers(std::max(std::thread::hardware_concurrency(), 2U) - 1, "VkPipelineBuilder"),
serialization_thread(1, "VkPipelineSerialization") {
@@ -387,7 +386,7 @@ GraphicsPipeline* PipelineCache::CurrentGraphicsPipeline() {
GraphicsPipeline* const next{current_pipeline->Next(graphics_key)};
if (next) {
current_pipeline = next;
return BuiltPipeline(current_pipeline);
return current_pipeline;
}
}
return CurrentGraphicsPipelineSlowPath();
@@ -535,29 +534,7 @@ GraphicsPipeline* PipelineCache::CurrentGraphicsPipelineSlowPath() {
current_pipeline->AddTransition(pipeline.get());
}
current_pipeline = pipeline.get();
return BuiltPipeline(current_pipeline);
}
GraphicsPipeline* PipelineCache::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;
}
// 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
const auto& draw_state = maxwell3d->draw_manager->GetDrawState();
if (draw_state.index_buffer.count <= 6 || draw_state.vertex_buffer.count <= 6) {
return pipeline;
}
return nullptr;
return current_pipeline;
}
std::unique_ptr<GraphicsPipeline> PipelineCache::CreateGraphicsPipeline(

View File

@@ -117,8 +117,6 @@ public:
private:
[[nodiscard]] GraphicsPipeline* CurrentGraphicsPipelineSlowPath();
[[nodiscard]] GraphicsPipeline* BuiltPipeline(GraphicsPipeline* pipeline) const noexcept;
std::unique_ptr<GraphicsPipeline> CreateGraphicsPipeline();
std::unique_ptr<GraphicsPipeline> CreateGraphicsPipeline(
@@ -149,7 +147,6 @@ private:
BufferCache& buffer_cache;
TextureCache& texture_cache;
VideoCore::ShaderNotify& shader_notify;
bool use_asynchronous_shaders{};
bool use_vulkan_pipeline_cache{};
GraphicsPipelineCacheKey graphics_key{};

View File

@@ -92,10 +92,10 @@
<item>
<widget class="QCheckBox" name="use_asynchronous_shaders">
<property name="toolTip">
<string>Enables asynchronous shader compilation, which may reduce shader stutter. This feature is experimental.</string>
<string>Enables asynchronous shader compilation, which may reduce shader stutter. This feature is experimental and may cause graphical issues.</string>
</property>
<property name="text">
<string>Use asynchronous shader building (Hack)</string>
<string>Use asynchronous shader building (Hack, OpenGL only)</string>
</property>
</widget>
</item>

View File

@@ -314,7 +314,7 @@ use_vsync =
# 0: GLSL, 1 (default): GLASM, 2: SPIR-V
shader_backend =
# Whether to allow asynchronous shader building.
# (OpenGL) Whether to allow asynchronous shader building.
# 0 (default): Off, 1: On
use_asynchronous_shaders =