summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp7
-rw-r--r--src/video_core/renderer_vulkan/vk_graphics_pipeline.h2
-rw-r--r--src/video_core/renderer_vulkan/vk_pipeline_cache.cpp2
-rw-r--r--src/video_core/shader/async_shaders.cpp9
-rw-r--r--src/video_core/shader/async_shaders.h3
5 files changed, 9 insertions, 14 deletions
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp
index 5dc4cd5af..2e46c6278 100644
--- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp
+++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp
@@ -78,15 +78,14 @@ VKGraphicsPipeline::VKGraphicsPipeline(const VKDevice& device, VKScheduler& sche
78 const GraphicsPipelineCacheKey& key, 78 const GraphicsPipelineCacheKey& key,
79 vk::Span<VkDescriptorSetLayoutBinding> bindings, 79 vk::Span<VkDescriptorSetLayoutBinding> bindings,
80 const SPIRVProgram& program) 80 const SPIRVProgram& program)
81 : device{device}, scheduler{scheduler}, hash{key.Hash()}, cache_key{key}, 81 : device{device}, scheduler{scheduler}, cache_key{key}, hash{cache_key.Hash()},
82 descriptor_set_layout{CreateDescriptorSetLayout(bindings)}, 82 descriptor_set_layout{CreateDescriptorSetLayout(bindings)},
83 descriptor_allocator{descriptor_pool, *descriptor_set_layout}, 83 descriptor_allocator{descriptor_pool, *descriptor_set_layout},
84 update_descriptor_queue{update_descriptor_queue}, layout{CreatePipelineLayout()}, 84 update_descriptor_queue{update_descriptor_queue}, layout{CreatePipelineLayout()},
85 descriptor_template{CreateDescriptorUpdateTemplate(program)}, modules{CreateShaderModules( 85 descriptor_template{CreateDescriptorUpdateTemplate(program)}, modules{CreateShaderModules(
86 program)}, 86 program)},
87 renderpass{renderpass_cache.GetRenderPass(key.renderpass_params)}, pipeline{CreatePipeline( 87 renderpass{renderpass_cache.GetRenderPass(cache_key.renderpass_params)},
88 key.renderpass_params, 88 pipeline{CreatePipeline(cache_key.renderpass_params, program)} {}
89 program)} {}
90 89
91VKGraphicsPipeline::~VKGraphicsPipeline() = default; 90VKGraphicsPipeline::~VKGraphicsPipeline() = default;
92 91
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.h b/src/video_core/renderer_vulkan/vk_graphics_pipeline.h
index 9d462db0a..58aa35efd 100644
--- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.h
+++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.h
@@ -94,8 +94,8 @@ private:
94 94
95 const VKDevice& device; 95 const VKDevice& device;
96 VKScheduler& scheduler; 96 VKScheduler& scheduler;
97 const GraphicsPipelineCacheKey cache_key;
97 const u64 hash; 98 const u64 hash;
98 GraphicsPipelineCacheKey cache_key;
99 99
100 vk::DescriptorSetLayout descriptor_set_layout; 100 vk::DescriptorSetLayout descriptor_set_layout;
101 DescriptorAllocator descriptor_allocator; 101 DescriptorAllocator descriptor_allocator;
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
index 20ffbeb38..cfdcdd6ab 100644
--- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
@@ -298,9 +298,9 @@ VKComputePipeline& VKPipelineCache::GetComputePipeline(const ComputePipelineCach
298} 298}
299 299
300void VKPipelineCache::EmplacePipeline(std::unique_ptr<VKGraphicsPipeline> pipeline) { 300void VKPipelineCache::EmplacePipeline(std::unique_ptr<VKGraphicsPipeline> pipeline) {
301 system.GPU().ShaderNotify().MarkShaderComplete();
301 std::unique_lock lock{pipeline_cache}; 302 std::unique_lock lock{pipeline_cache};
302 graphics_cache.at(pipeline->GetCacheKey()) = std::move(pipeline); 303 graphics_cache.at(pipeline->GetCacheKey()) = std::move(pipeline);
303 system.GPU().ShaderNotify().MarkShaderComplete();
304} 304}
305 305
306void VKPipelineCache::OnShaderRemoval(Shader* shader) { 306void VKPipelineCache::OnShaderRemoval(Shader* shader) {
diff --git a/src/video_core/shader/async_shaders.cpp b/src/video_core/shader/async_shaders.cpp
index 91d1b6bbd..6c19eaf07 100644
--- a/src/video_core/shader/async_shaders.cpp
+++ b/src/video_core/shader/async_shaders.cpp
@@ -128,7 +128,7 @@ void AsyncShaders::QueueOpenGLShader(const OpenGL::Device& device,
128 .code_b = std::move(code_b), 128 .code_b = std::move(code_b),
129 .main_offset = main_offset, 129 .main_offset = main_offset,
130 .compiler_settings = compiler_settings, 130 .compiler_settings = compiler_settings,
131 .registry = &registry, 131 .registry = registry,
132 .cpu_address = cpu_addr, 132 .cpu_address = cpu_addr,
133 }; 133 };
134 std::unique_lock lock(queue_mutex); 134 std::unique_lock lock(queue_mutex);
@@ -144,7 +144,6 @@ void AsyncShaders::QueueVulkanShader(Vulkan::VKPipelineCache* pp_cache,
144 std::vector<VkDescriptorSetLayoutBinding> bindings, 144 std::vector<VkDescriptorSetLayoutBinding> bindings,
145 Vulkan::SPIRVProgram program, 145 Vulkan::SPIRVProgram program,
146 Vulkan::GraphicsPipelineCacheKey key) { 146 Vulkan::GraphicsPipelineCacheKey key) {
147
148 WorkerParams params{ 147 WorkerParams params{
149 .backend = Backend::Vulkan, 148 .backend = Backend::Vulkan,
150 .pp_cache = pp_cache, 149 .pp_cache = pp_cache,
@@ -186,11 +185,10 @@ void AsyncShaders::ShaderCompilerThread(Core::Frontend::GraphicsContext* context
186 lock.unlock(); 185 lock.unlock();
187 186
188 if (work.backend == Backend::OpenGL || work.backend == Backend::GLASM) { 187 if (work.backend == Backend::OpenGL || work.backend == Backend::GLASM) {
189 VideoCommon::Shader::Registry registry = *work.registry; 188 const ShaderIR ir(work.code, work.main_offset, work.compiler_settings, *work.registry);
190 const ShaderIR ir(work.code, work.main_offset, work.compiler_settings, registry);
191 const auto scope = context->Acquire(); 189 const auto scope = context->Acquire();
192 auto program = 190 auto program =
193 OpenGL::BuildShader(*work.device, work.shader_type, work.uid, ir, registry); 191 OpenGL::BuildShader(*work.device, work.shader_type, work.uid, ir, *work.registry);
194 Result result{}; 192 Result result{};
195 result.backend = work.backend; 193 result.backend = work.backend;
196 result.cpu_address = work.cpu_address; 194 result.cpu_address = work.cpu_address;
@@ -210,7 +208,6 @@ void AsyncShaders::ShaderCompilerThread(Core::Frontend::GraphicsContext* context
210 finished_work.push_back(std::move(result)); 208 finished_work.push_back(std::move(result));
211 } 209 }
212 } else if (work.backend == Backend::Vulkan) { 210 } else if (work.backend == Backend::Vulkan) {
213
214 auto pipeline = std::make_unique<Vulkan::VKGraphicsPipeline>( 211 auto pipeline = std::make_unique<Vulkan::VKGraphicsPipeline>(
215 *work.vk_device, *work.scheduler, *work.descriptor_pool, 212 *work.vk_device, *work.scheduler, *work.descriptor_pool,
216 *work.update_descriptor_queue, *work.renderpass_cache, work.key, work.bindings, 213 *work.update_descriptor_queue, *work.renderpass_cache, work.key, work.bindings,
diff --git a/src/video_core/shader/async_shaders.h b/src/video_core/shader/async_shaders.h
index 5b58dd9bd..d5ae814d5 100644
--- a/src/video_core/shader/async_shaders.h
+++ b/src/video_core/shader/async_shaders.h
@@ -55,7 +55,6 @@ public:
55 std::vector<u64> code; 55 std::vector<u64> code;
56 std::vector<u64> code_b; 56 std::vector<u64> code_b;
57 Tegra::Engines::ShaderType shader_type; 57 Tegra::Engines::ShaderType shader_type;
58 std::unique_ptr<Vulkan::VKGraphicsPipeline> pipeline;
59 }; 58 };
60 59
61 explicit AsyncShaders(Core::Frontend::EmuWindow& emu_window); 60 explicit AsyncShaders(Core::Frontend::EmuWindow& emu_window);
@@ -110,7 +109,7 @@ private:
110 std::vector<u64> code_b; 109 std::vector<u64> code_b;
111 u32 main_offset; 110 u32 main_offset;
112 VideoCommon::Shader::CompilerSettings compiler_settings; 111 VideoCommon::Shader::CompilerSettings compiler_settings;
113 const VideoCommon::Shader::Registry* registry; 112 std::optional<VideoCommon::Shader::Registry> registry;
114 VAddr cpu_address; 113 VAddr cpu_address;
115 114
116 // For Vulkan 115 // For Vulkan