summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Lioncash2020-11-20 04:41:27 -0500
committerGravatar Lioncash2020-11-20 04:41:29 -0500
commit3fcc98e11adc1cafc4644483a81b29e55e90d11a (patch)
tree1d918c8a7d8ac715b00a53a7c2c4f165a3c30ad7
parentasync_shaders: std::move data within QueueVulkanShader() (diff)
downloadyuzu-3fcc98e11adc1cafc4644483a81b29e55e90d11a.tar.gz
yuzu-3fcc98e11adc1cafc4644483a81b29e55e90d11a.tar.xz
yuzu-3fcc98e11adc1cafc4644483a81b29e55e90d11a.zip
async_shaders: Simplify moving data into the pending queue
Diffstat (limited to '')
-rw-r--r--src/video_core/shader/async_shaders.cpp21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/video_core/shader/async_shaders.cpp b/src/video_core/shader/async_shaders.cpp
index c106b2a20..c6bd75b7c 100644
--- a/src/video_core/shader/async_shaders.cpp
+++ b/src/video_core/shader/async_shaders.cpp
@@ -116,11 +116,10 @@ std::vector<AsyncShaders::Result> AsyncShaders::GetCompletedWork() {
116void AsyncShaders::QueueOpenGLShader(const OpenGL::Device& device, 116void AsyncShaders::QueueOpenGLShader(const OpenGL::Device& device,
117 Tegra::Engines::ShaderType shader_type, u64 uid, 117 Tegra::Engines::ShaderType shader_type, u64 uid,
118 std::vector<u64> code, std::vector<u64> code_b, 118 std::vector<u64> code, std::vector<u64> code_b,
119 u32 main_offset, 119 u32 main_offset, CompilerSettings compiler_settings,
120 VideoCommon::Shader::CompilerSettings compiler_settings, 120 const Registry& registry, VAddr cpu_addr) {
121 const VideoCommon::Shader::Registry& registry, 121 std::unique_lock lock(queue_mutex);
122 VAddr cpu_addr) { 122 pending_queue.push({
123 WorkerParams params{
124 .backend = device.UseAssemblyShaders() ? Backend::GLASM : Backend::OpenGL, 123 .backend = device.UseAssemblyShaders() ? Backend::GLASM : Backend::OpenGL,
125 .device = &device, 124 .device = &device,
126 .shader_type = shader_type, 125 .shader_type = shader_type,
@@ -131,9 +130,7 @@ void AsyncShaders::QueueOpenGLShader(const OpenGL::Device& device,
131 .compiler_settings = compiler_settings, 130 .compiler_settings = compiler_settings,
132 .registry = registry, 131 .registry = registry,
133 .cpu_address = cpu_addr, 132 .cpu_address = cpu_addr,
134 }; 133 });
135 std::unique_lock lock(queue_mutex);
136 pending_queue.push(std::move(params));
137 cv.notify_one(); 134 cv.notify_one();
138} 135}
139 136
@@ -145,7 +142,8 @@ void AsyncShaders::QueueVulkanShader(Vulkan::VKPipelineCache* pp_cache,
145 std::vector<VkDescriptorSetLayoutBinding> bindings, 142 std::vector<VkDescriptorSetLayoutBinding> bindings,
146 Vulkan::SPIRVProgram program, 143 Vulkan::SPIRVProgram program,
147 Vulkan::GraphicsPipelineCacheKey key) { 144 Vulkan::GraphicsPipelineCacheKey key) {
148 WorkerParams params{ 145 std::unique_lock lock(queue_mutex);
146 pending_queue.push({
149 .backend = Backend::Vulkan, 147 .backend = Backend::Vulkan,
150 .pp_cache = pp_cache, 148 .pp_cache = pp_cache,
151 .vk_device = &device, 149 .vk_device = &device,
@@ -156,10 +154,7 @@ void AsyncShaders::QueueVulkanShader(Vulkan::VKPipelineCache* pp_cache,
156 .bindings = std::move(bindings), 154 .bindings = std::move(bindings),
157 .program = std::move(program), 155 .program = std::move(program),
158 .key = key, 156 .key = key,
159 }; 157 });
160
161 std::unique_lock lock(queue_mutex);
162 pending_queue.push(std::move(params));
163 cv.notify_one(); 158 cv.notify_one();
164} 159}
165 160