2022-04-23 10:59:50 +02:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2020-01-07 01:25:14 +01:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2021-04-01 06:36:22 +02:00
|
|
|
#include <atomic>
|
2021-04-10 08:32:55 +02:00
|
|
|
#include <condition_variable>
|
|
|
|
#include <mutex>
|
2021-04-01 06:36:22 +02:00
|
|
|
|
2020-01-07 01:25:14 +01:00
|
|
|
#include "common/common_types.h"
|
2021-04-01 06:36:22 +02:00
|
|
|
#include "common/thread_worker.h"
|
2021-02-17 04:59:28 +01:00
|
|
|
#include "shader_recompiler/shader_info.h"
|
|
|
|
#include "video_core/renderer_vulkan/vk_buffer_cache.h"
|
2020-01-07 01:25:14 +01:00
|
|
|
#include "video_core/renderer_vulkan/vk_descriptor_pool.h"
|
2021-03-08 22:31:53 +01:00
|
|
|
#include "video_core/renderer_vulkan/vk_texture_cache.h"
|
2021-02-17 04:59:28 +01:00
|
|
|
#include "video_core/renderer_vulkan/vk_update_descriptor.h"
|
2020-12-25 01:30:11 +01:00
|
|
|
#include "video_core/vulkan_common/vulkan_wrapper.h"
|
2020-01-07 01:25:14 +01:00
|
|
|
|
2021-06-06 05:11:36 +02:00
|
|
|
namespace VideoCore {
|
|
|
|
class ShaderNotify;
|
|
|
|
}
|
|
|
|
|
2020-01-07 01:25:14 +01:00
|
|
|
namespace Vulkan {
|
|
|
|
|
2020-12-26 05:10:53 +01:00
|
|
|
class Device;
|
2021-07-28 00:15:32 +02:00
|
|
|
class PipelineStatistics;
|
2022-06-26 06:34:24 +02:00
|
|
|
class Scheduler;
|
2020-01-07 01:25:14 +01:00
|
|
|
|
2021-03-19 23:28:31 +01:00
|
|
|
class ComputePipeline {
|
2020-01-07 01:25:14 +01:00
|
|
|
public:
|
2021-04-25 05:15:32 +02:00
|
|
|
explicit ComputePipeline(const Device& device, DescriptorPool& descriptor_pool,
|
2022-06-26 06:51:37 +02:00
|
|
|
UpdateDescriptorQueue& update_descriptor_queue,
|
2021-06-06 05:11:36 +02:00
|
|
|
Common::ThreadWorker* thread_worker,
|
2021-07-28 00:15:32 +02:00
|
|
|
PipelineStatistics* pipeline_statistics,
|
2021-06-06 05:11:36 +02:00
|
|
|
VideoCore::ShaderNotify* shader_notify, const Shader::Info& info,
|
2021-04-01 06:36:22 +02:00
|
|
|
vk::ShaderModule spv_module);
|
2021-02-17 04:59:28 +01:00
|
|
|
|
2021-04-01 06:36:22 +02:00
|
|
|
ComputePipeline& operator=(ComputePipeline&&) noexcept = delete;
|
|
|
|
ComputePipeline(ComputePipeline&&) noexcept = delete;
|
2021-02-17 04:59:28 +01:00
|
|
|
|
|
|
|
ComputePipeline& operator=(const ComputePipeline&) = delete;
|
|
|
|
ComputePipeline(const ComputePipeline&) = delete;
|
|
|
|
|
2021-04-01 06:36:22 +02:00
|
|
|
void Configure(Tegra::Engines::KeplerCompute& kepler_compute, Tegra::MemoryManager& gpu_memory,
|
2022-06-26 06:34:24 +02:00
|
|
|
Scheduler& scheduler, BufferCache& buffer_cache, TextureCache& texture_cache);
|
2021-02-17 04:59:28 +01:00
|
|
|
|
|
|
|
private:
|
2021-04-25 06:04:49 +02:00
|
|
|
const Device& device;
|
2022-06-26 06:51:37 +02:00
|
|
|
UpdateDescriptorQueue& update_descriptor_queue;
|
2021-02-17 04:59:28 +01:00
|
|
|
Shader::Info info;
|
|
|
|
|
2021-06-02 07:15:07 +02:00
|
|
|
VideoCommon::ComputeUniformBufferSizes uniform_buffer_sizes{};
|
|
|
|
|
2021-02-17 04:59:28 +01:00
|
|
|
vk::ShaderModule spv_module;
|
|
|
|
vk::DescriptorSetLayout descriptor_set_layout;
|
|
|
|
DescriptorAllocator descriptor_allocator;
|
|
|
|
vk::PipelineLayout pipeline_layout;
|
|
|
|
vk::DescriptorUpdateTemplateKHR descriptor_update_template;
|
|
|
|
vk::Pipeline pipeline;
|
2021-04-04 02:41:49 +02:00
|
|
|
|
|
|
|
std::condition_variable build_condvar;
|
|
|
|
std::mutex build_mutex;
|
|
|
|
std::atomic_bool is_built{false};
|
2020-01-07 01:25:14 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Vulkan
|