forked from suyu/suyu
Remove unneeded newlines, optional Registry in shader params
Addressing feedback from Rodrigo
This commit is contained in:
parent
f49ffdd648
commit
fde8102a41
5 changed files with 9 additions and 14 deletions
|
@ -78,15 +78,14 @@ VKGraphicsPipeline::VKGraphicsPipeline(const VKDevice& device, VKScheduler& sche
|
||||||
const GraphicsPipelineCacheKey& key,
|
const GraphicsPipelineCacheKey& key,
|
||||||
vk::Span<VkDescriptorSetLayoutBinding> bindings,
|
vk::Span<VkDescriptorSetLayoutBinding> bindings,
|
||||||
const SPIRVProgram& program)
|
const SPIRVProgram& program)
|
||||||
: device{device}, scheduler{scheduler}, hash{key.Hash()}, cache_key{key},
|
: device{device}, scheduler{scheduler}, cache_key{key}, hash{cache_key.Hash()},
|
||||||
descriptor_set_layout{CreateDescriptorSetLayout(bindings)},
|
descriptor_set_layout{CreateDescriptorSetLayout(bindings)},
|
||||||
descriptor_allocator{descriptor_pool, *descriptor_set_layout},
|
descriptor_allocator{descriptor_pool, *descriptor_set_layout},
|
||||||
update_descriptor_queue{update_descriptor_queue}, layout{CreatePipelineLayout()},
|
update_descriptor_queue{update_descriptor_queue}, layout{CreatePipelineLayout()},
|
||||||
descriptor_template{CreateDescriptorUpdateTemplate(program)}, modules{CreateShaderModules(
|
descriptor_template{CreateDescriptorUpdateTemplate(program)}, modules{CreateShaderModules(
|
||||||
program)},
|
program)},
|
||||||
renderpass{renderpass_cache.GetRenderPass(key.renderpass_params)}, pipeline{CreatePipeline(
|
renderpass{renderpass_cache.GetRenderPass(cache_key.renderpass_params)},
|
||||||
key.renderpass_params,
|
pipeline{CreatePipeline(cache_key.renderpass_params, program)} {}
|
||||||
program)} {}
|
|
||||||
|
|
||||||
VKGraphicsPipeline::~VKGraphicsPipeline() = default;
|
VKGraphicsPipeline::~VKGraphicsPipeline() = default;
|
||||||
|
|
||||||
|
|
|
@ -94,8 +94,8 @@ private:
|
||||||
|
|
||||||
const VKDevice& device;
|
const VKDevice& device;
|
||||||
VKScheduler& scheduler;
|
VKScheduler& scheduler;
|
||||||
|
const GraphicsPipelineCacheKey cache_key;
|
||||||
const u64 hash;
|
const u64 hash;
|
||||||
GraphicsPipelineCacheKey cache_key;
|
|
||||||
|
|
||||||
vk::DescriptorSetLayout descriptor_set_layout;
|
vk::DescriptorSetLayout descriptor_set_layout;
|
||||||
DescriptorAllocator descriptor_allocator;
|
DescriptorAllocator descriptor_allocator;
|
||||||
|
|
|
@ -298,9 +298,9 @@ VKComputePipeline& VKPipelineCache::GetComputePipeline(const ComputePipelineCach
|
||||||
}
|
}
|
||||||
|
|
||||||
void VKPipelineCache::EmplacePipeline(std::unique_ptr<VKGraphicsPipeline> pipeline) {
|
void VKPipelineCache::EmplacePipeline(std::unique_ptr<VKGraphicsPipeline> pipeline) {
|
||||||
|
system.GPU().ShaderNotify().MarkShaderComplete();
|
||||||
std::unique_lock lock{pipeline_cache};
|
std::unique_lock lock{pipeline_cache};
|
||||||
graphics_cache.at(pipeline->GetCacheKey()) = std::move(pipeline);
|
graphics_cache.at(pipeline->GetCacheKey()) = std::move(pipeline);
|
||||||
system.GPU().ShaderNotify().MarkShaderComplete();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VKPipelineCache::OnShaderRemoval(Shader* shader) {
|
void VKPipelineCache::OnShaderRemoval(Shader* shader) {
|
||||||
|
|
|
@ -128,7 +128,7 @@ void AsyncShaders::QueueOpenGLShader(const OpenGL::Device& device,
|
||||||
.code_b = std::move(code_b),
|
.code_b = std::move(code_b),
|
||||||
.main_offset = main_offset,
|
.main_offset = main_offset,
|
||||||
.compiler_settings = compiler_settings,
|
.compiler_settings = compiler_settings,
|
||||||
.registry = ®istry,
|
.registry = registry,
|
||||||
.cpu_address = cpu_addr,
|
.cpu_address = cpu_addr,
|
||||||
};
|
};
|
||||||
std::unique_lock lock(queue_mutex);
|
std::unique_lock lock(queue_mutex);
|
||||||
|
@ -144,7 +144,6 @@ void AsyncShaders::QueueVulkanShader(Vulkan::VKPipelineCache* pp_cache,
|
||||||
std::vector<VkDescriptorSetLayoutBinding> bindings,
|
std::vector<VkDescriptorSetLayoutBinding> bindings,
|
||||||
Vulkan::SPIRVProgram program,
|
Vulkan::SPIRVProgram program,
|
||||||
Vulkan::GraphicsPipelineCacheKey key) {
|
Vulkan::GraphicsPipelineCacheKey key) {
|
||||||
|
|
||||||
WorkerParams params{
|
WorkerParams params{
|
||||||
.backend = Backend::Vulkan,
|
.backend = Backend::Vulkan,
|
||||||
.pp_cache = pp_cache,
|
.pp_cache = pp_cache,
|
||||||
|
@ -186,11 +185,10 @@ void AsyncShaders::ShaderCompilerThread(Core::Frontend::GraphicsContext* context
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
|
||||||
if (work.backend == Backend::OpenGL || work.backend == Backend::GLASM) {
|
if (work.backend == Backend::OpenGL || work.backend == Backend::GLASM) {
|
||||||
VideoCommon::Shader::Registry registry = *work.registry;
|
const ShaderIR ir(work.code, work.main_offset, work.compiler_settings, *work.registry);
|
||||||
const ShaderIR ir(work.code, work.main_offset, work.compiler_settings, registry);
|
|
||||||
const auto scope = context->Acquire();
|
const auto scope = context->Acquire();
|
||||||
auto program =
|
auto program =
|
||||||
OpenGL::BuildShader(*work.device, work.shader_type, work.uid, ir, registry);
|
OpenGL::BuildShader(*work.device, work.shader_type, work.uid, ir, *work.registry);
|
||||||
Result result{};
|
Result result{};
|
||||||
result.backend = work.backend;
|
result.backend = work.backend;
|
||||||
result.cpu_address = work.cpu_address;
|
result.cpu_address = work.cpu_address;
|
||||||
|
@ -210,7 +208,6 @@ void AsyncShaders::ShaderCompilerThread(Core::Frontend::GraphicsContext* context
|
||||||
finished_work.push_back(std::move(result));
|
finished_work.push_back(std::move(result));
|
||||||
}
|
}
|
||||||
} else if (work.backend == Backend::Vulkan) {
|
} else if (work.backend == Backend::Vulkan) {
|
||||||
|
|
||||||
auto pipeline = std::make_unique<Vulkan::VKGraphicsPipeline>(
|
auto pipeline = std::make_unique<Vulkan::VKGraphicsPipeline>(
|
||||||
*work.vk_device, *work.scheduler, *work.descriptor_pool,
|
*work.vk_device, *work.scheduler, *work.descriptor_pool,
|
||||||
*work.update_descriptor_queue, *work.renderpass_cache, work.key, work.bindings,
|
*work.update_descriptor_queue, *work.renderpass_cache, work.key, work.bindings,
|
||||||
|
|
|
@ -55,7 +55,6 @@ public:
|
||||||
std::vector<u64> code;
|
std::vector<u64> code;
|
||||||
std::vector<u64> code_b;
|
std::vector<u64> code_b;
|
||||||
Tegra::Engines::ShaderType shader_type;
|
Tegra::Engines::ShaderType shader_type;
|
||||||
std::unique_ptr<Vulkan::VKGraphicsPipeline> pipeline;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit AsyncShaders(Core::Frontend::EmuWindow& emu_window);
|
explicit AsyncShaders(Core::Frontend::EmuWindow& emu_window);
|
||||||
|
@ -110,7 +109,7 @@ private:
|
||||||
std::vector<u64> code_b;
|
std::vector<u64> code_b;
|
||||||
u32 main_offset;
|
u32 main_offset;
|
||||||
VideoCommon::Shader::CompilerSettings compiler_settings;
|
VideoCommon::Shader::CompilerSettings compiler_settings;
|
||||||
const VideoCommon::Shader::Registry* registry;
|
std::optional<VideoCommon::Shader::Registry> registry;
|
||||||
VAddr cpu_address;
|
VAddr cpu_address;
|
||||||
|
|
||||||
// For Vulkan
|
// For Vulkan
|
||||||
|
|
Loading…
Reference in a new issue