Merge pull request #5286 from ReinUsesLisp/rename-vk-device

renderer_vulkan: Rename VKDevice to Device
This commit is contained in:
Rodrigo Locatti 2021-01-04 02:22:02 -03:00 committed by GitHub
commit 4801f4250d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 166 additions and 169 deletions

View file

@ -225,7 +225,7 @@ constexpr std::array<VkPipelineShaderStageCreateInfo, 2> MakeStages(
}; };
} }
void UpdateOneTextureDescriptorSet(const VKDevice& device, VkDescriptorSet descriptor_set, void UpdateOneTextureDescriptorSet(const Device& device, VkDescriptorSet descriptor_set,
VkSampler sampler, VkImageView image_view) { VkSampler sampler, VkImageView image_view) {
const VkDescriptorImageInfo image_info{ const VkDescriptorImageInfo image_info{
.sampler = sampler, .sampler = sampler,
@ -247,7 +247,7 @@ void UpdateOneTextureDescriptorSet(const VKDevice& device, VkDescriptorSet descr
device.GetLogical().UpdateDescriptorSets(write_descriptor_set, nullptr); device.GetLogical().UpdateDescriptorSets(write_descriptor_set, nullptr);
} }
void UpdateTwoTexturesDescriptorSet(const VKDevice& device, VkDescriptorSet descriptor_set, void UpdateTwoTexturesDescriptorSet(const Device& device, VkDescriptorSet descriptor_set,
VkSampler sampler, VkImageView image_view_0, VkSampler sampler, VkImageView image_view_0,
VkImageView image_view_1) { VkImageView image_view_1) {
const VkDescriptorImageInfo image_info_0{ const VkDescriptorImageInfo image_info_0{
@ -326,7 +326,7 @@ void BindBlitState(vk::CommandBuffer cmdbuf, VkPipelineLayout layout,
} // Anonymous namespace } // Anonymous namespace
BlitImageHelper::BlitImageHelper(const VKDevice& device_, VKScheduler& scheduler_, BlitImageHelper::BlitImageHelper(const Device& device_, VKScheduler& scheduler_,
StateTracker& state_tracker_, VKDescriptorPool& descriptor_pool) StateTracker& state_tracker_, VKDescriptorPool& descriptor_pool)
: device{device_}, scheduler{scheduler_}, state_tracker{state_tracker_}, : device{device_}, scheduler{scheduler_}, state_tracker{state_tracker_},
one_texture_set_layout(device.GetLogical().CreateDescriptorSetLayout( one_texture_set_layout(device.GetLogical().CreateDescriptorSetLayout(

View file

@ -15,12 +15,11 @@ namespace Vulkan {
using VideoCommon::Offset2D; using VideoCommon::Offset2D;
class VKDevice; class Device;
class VKScheduler;
class StateTracker;
class Framebuffer; class Framebuffer;
class ImageView; class ImageView;
class StateTracker;
class VKScheduler;
struct BlitImagePipelineKey { struct BlitImagePipelineKey {
constexpr auto operator<=>(const BlitImagePipelineKey&) const noexcept = default; constexpr auto operator<=>(const BlitImagePipelineKey&) const noexcept = default;
@ -31,7 +30,7 @@ struct BlitImagePipelineKey {
class BlitImageHelper { class BlitImageHelper {
public: public:
explicit BlitImageHelper(const VKDevice& device, VKScheduler& scheduler, explicit BlitImageHelper(const Device& device, VKScheduler& scheduler,
StateTracker& state_tracker, VKDescriptorPool& descriptor_pool); StateTracker& state_tracker, VKDescriptorPool& descriptor_pool);
~BlitImageHelper(); ~BlitImageHelper();
@ -67,7 +66,7 @@ private:
void ConvertColorToDepthPipeline(vk::Pipeline& pipeline, VkRenderPass renderpass); void ConvertColorToDepthPipeline(vk::Pipeline& pipeline, VkRenderPass renderpass);
const VKDevice& device; const Device& device;
VKScheduler& scheduler; VKScheduler& scheduler;
StateTracker& state_tracker; StateTracker& state_tracker;

View file

@ -47,7 +47,7 @@ VkSamplerMipmapMode MipmapMode(Tegra::Texture::TextureMipmapFilter mipmap_filter
return {}; return {};
} }
VkSamplerAddressMode WrapMode(const VKDevice& device, Tegra::Texture::WrapMode wrap_mode, VkSamplerAddressMode WrapMode(const Device& device, Tegra::Texture::WrapMode wrap_mode,
Tegra::Texture::TextureFilter filter) { Tegra::Texture::TextureFilter filter) {
switch (wrap_mode) { switch (wrap_mode) {
case Tegra::Texture::WrapMode::Wrap: case Tegra::Texture::WrapMode::Wrap:
@ -222,7 +222,7 @@ constexpr bool IsZetaFormat(PixelFormat pixel_format) {
} // Anonymous namespace } // Anonymous namespace
FormatInfo SurfaceFormat(const VKDevice& device, FormatType format_type, PixelFormat pixel_format) { FormatInfo SurfaceFormat(const Device& device, FormatType format_type, PixelFormat pixel_format) {
ASSERT(static_cast<std::size_t>(pixel_format) < std::size(tex_format_tuples)); ASSERT(static_cast<std::size_t>(pixel_format) < std::size(tex_format_tuples));
auto tuple = tex_format_tuples[static_cast<std::size_t>(pixel_format)]; auto tuple = tex_format_tuples[static_cast<std::size_t>(pixel_format)];
@ -280,7 +280,7 @@ VkShaderStageFlagBits ShaderStage(Tegra::Engines::ShaderType stage) {
return {}; return {};
} }
VkPrimitiveTopology PrimitiveTopology([[maybe_unused]] const VKDevice& device, VkPrimitiveTopology PrimitiveTopology([[maybe_unused]] const Device& device,
Maxwell::PrimitiveTopology topology) { Maxwell::PrimitiveTopology topology) {
switch (topology) { switch (topology) {
case Maxwell::PrimitiveTopology::Points: case Maxwell::PrimitiveTopology::Points:
@ -526,7 +526,7 @@ VkCompareOp ComparisonOp(Maxwell::ComparisonOp comparison) {
return {}; return {};
} }
VkIndexType IndexFormat(const VKDevice& device, Maxwell::IndexFormat index_format) { VkIndexType IndexFormat(const Device& device, Maxwell::IndexFormat index_format) {
switch (index_format) { switch (index_format) {
case Maxwell::IndexFormat::UnsignedByte: case Maxwell::IndexFormat::UnsignedByte:
if (!device.IsExtIndexTypeUint8Supported()) { if (!device.IsExtIndexTypeUint8Supported()) {

View file

@ -22,7 +22,7 @@ VkFilter Filter(Tegra::Texture::TextureFilter filter);
VkSamplerMipmapMode MipmapMode(Tegra::Texture::TextureMipmapFilter mipmap_filter); VkSamplerMipmapMode MipmapMode(Tegra::Texture::TextureMipmapFilter mipmap_filter);
VkSamplerAddressMode WrapMode(const VKDevice& device, Tegra::Texture::WrapMode wrap_mode, VkSamplerAddressMode WrapMode(const Device& device, Tegra::Texture::WrapMode wrap_mode,
Tegra::Texture::TextureFilter filter); Tegra::Texture::TextureFilter filter);
VkCompareOp DepthCompareFunction(Tegra::Texture::DepthCompareFunc depth_compare_func); VkCompareOp DepthCompareFunction(Tegra::Texture::DepthCompareFunc depth_compare_func);
@ -35,17 +35,17 @@ struct FormatInfo {
bool storage; bool storage;
}; };
FormatInfo SurfaceFormat(const VKDevice& device, FormatType format_type, PixelFormat pixel_format); FormatInfo SurfaceFormat(const Device& device, FormatType format_type, PixelFormat pixel_format);
VkShaderStageFlagBits ShaderStage(Tegra::Engines::ShaderType stage); VkShaderStageFlagBits ShaderStage(Tegra::Engines::ShaderType stage);
VkPrimitiveTopology PrimitiveTopology(const VKDevice& device, Maxwell::PrimitiveTopology topology); VkPrimitiveTopology PrimitiveTopology(const Device& device, Maxwell::PrimitiveTopology topology);
VkFormat VertexFormat(Maxwell::VertexAttribute::Type type, Maxwell::VertexAttribute::Size size); VkFormat VertexFormat(Maxwell::VertexAttribute::Type type, Maxwell::VertexAttribute::Size size);
VkCompareOp ComparisonOp(Maxwell::ComparisonOp comparison); VkCompareOp ComparisonOp(Maxwell::ComparisonOp comparison);
VkIndexType IndexFormat(const VKDevice& device, Maxwell::IndexFormat index_format); VkIndexType IndexFormat(const Device& device, Maxwell::IndexFormat index_format);
VkStencilOp StencilOp(Maxwell::StencilOp stencil_op); VkStencilOp StencilOp(Maxwell::StencilOp stencil_op);

View file

@ -42,7 +42,7 @@ std::string GetReadableVersion(u32 version) {
VK_VERSION_PATCH(version)); VK_VERSION_PATCH(version));
} }
std::string GetDriverVersion(const VKDevice& device) { std::string GetDriverVersion(const Device& device) {
// Extracted from // Extracted from
// https://github.com/SaschaWillems/vulkan.gpuinfo.org/blob/5dddea46ea1120b0df14eef8f15ff8e318e35462/functions.php#L308-L314 // https://github.com/SaschaWillems/vulkan.gpuinfo.org/blob/5dddea46ea1120b0df14eef8f15ff8e318e35462/functions.php#L308-L314
const u32 version = device.GetDriverVersion(); const u32 version = device.GetDriverVersion();
@ -184,7 +184,7 @@ void RendererVulkan::InitializeDevice() {
throw vk::Exception(VK_ERROR_INITIALIZATION_FAILED); throw vk::Exception(VK_ERROR_INITIALIZATION_FAILED);
} }
const vk::PhysicalDevice physical_device(devices[static_cast<size_t>(device_index)], dld); const vk::PhysicalDevice physical_device(devices[static_cast<size_t>(device_index)], dld);
device = std::make_unique<VKDevice>(*instance, physical_device, *surface, dld); device = std::make_unique<Device>(*instance, physical_device, *surface, dld);
} }
void RendererVulkan::Report() const { void RendererVulkan::Report() const {

View file

@ -27,9 +27,9 @@ class GPU;
namespace Vulkan { namespace Vulkan {
class Device;
class StateTracker; class StateTracker;
class VKBlitScreen; class VKBlitScreen;
class VKDevice;
class VKMemoryManager; class VKMemoryManager;
class VKSwapchain; class VKSwapchain;
class VKScheduler; class VKScheduler;
@ -74,7 +74,7 @@ private:
VKScreenInfo screen_info; VKScreenInfo screen_info;
vk::DebugUtilsMessenger debug_callback; vk::DebugUtilsMessenger debug_callback;
std::unique_ptr<VKDevice> device; std::unique_ptr<Device> device;
std::unique_ptr<VKMemoryManager> memory_manager; std::unique_ptr<VKMemoryManager> memory_manager;
std::unique_ptr<StateTracker> state_tracker; std::unique_ptr<StateTracker> state_tracker;
std::unique_ptr<VKScheduler> scheduler; std::unique_ptr<VKScheduler> scheduler;

View file

@ -114,7 +114,7 @@ struct VKBlitScreen::BufferData {
VKBlitScreen::VKBlitScreen(Core::Memory::Memory& cpu_memory_, VKBlitScreen::VKBlitScreen(Core::Memory::Memory& cpu_memory_,
Core::Frontend::EmuWindow& render_window_, Core::Frontend::EmuWindow& render_window_,
VideoCore::RasterizerInterface& rasterizer_, const VKDevice& device_, VideoCore::RasterizerInterface& rasterizer_, const Device& device_,
VKMemoryManager& memory_manager_, VKSwapchain& swapchain_, VKMemoryManager& memory_manager_, VKSwapchain& swapchain_,
VKScheduler& scheduler_, const VKScreenInfo& screen_info_) VKScheduler& scheduler_, const VKScreenInfo& screen_info_)
: cpu_memory{cpu_memory_}, render_window{render_window_}, rasterizer{rasterizer_}, : cpu_memory{cpu_memory_}, render_window{render_window_}, rasterizer{rasterizer_},

View file

@ -33,8 +33,8 @@ namespace Vulkan {
struct ScreenInfo; struct ScreenInfo;
class Device;
class RasterizerVulkan; class RasterizerVulkan;
class VKDevice;
class VKScheduler; class VKScheduler;
class VKSwapchain; class VKSwapchain;
@ -42,7 +42,7 @@ class VKBlitScreen final {
public: public:
explicit VKBlitScreen(Core::Memory::Memory& cpu_memory, explicit VKBlitScreen(Core::Memory::Memory& cpu_memory,
Core::Frontend::EmuWindow& render_window, Core::Frontend::EmuWindow& render_window,
VideoCore::RasterizerInterface& rasterizer, const VKDevice& device, VideoCore::RasterizerInterface& rasterizer, const Device& device,
VKMemoryManager& memory_manager, VKSwapchain& swapchain, VKMemoryManager& memory_manager, VKSwapchain& swapchain,
VKScheduler& scheduler, const VKScreenInfo& screen_info); VKScheduler& scheduler, const VKScreenInfo& screen_info);
~VKBlitScreen(); ~VKBlitScreen();
@ -85,7 +85,7 @@ private:
Core::Memory::Memory& cpu_memory; Core::Memory::Memory& cpu_memory;
Core::Frontend::EmuWindow& render_window; Core::Frontend::EmuWindow& render_window;
VideoCore::RasterizerInterface& rasterizer; VideoCore::RasterizerInterface& rasterizer;
const VKDevice& device; const Device& device;
VKMemoryManager& memory_manager; VKMemoryManager& memory_manager;
VKSwapchain& swapchain; VKSwapchain& swapchain;
VKScheduler& scheduler; VKScheduler& scheduler;

View file

@ -34,13 +34,13 @@ constexpr VkAccessFlags UPLOAD_ACCESS_BARRIERS =
constexpr VkAccessFlags TRANSFORM_FEEDBACK_WRITE_ACCESS = constexpr VkAccessFlags TRANSFORM_FEEDBACK_WRITE_ACCESS =
VK_ACCESS_TRANSFORM_FEEDBACK_WRITE_BIT_EXT | VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_WRITE_BIT_EXT; VK_ACCESS_TRANSFORM_FEEDBACK_WRITE_BIT_EXT | VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_WRITE_BIT_EXT;
std::unique_ptr<VKStreamBuffer> CreateStreamBuffer(const VKDevice& device, VKScheduler& scheduler) { std::unique_ptr<VKStreamBuffer> CreateStreamBuffer(const Device& device, VKScheduler& scheduler) {
return std::make_unique<VKStreamBuffer>(device, scheduler); return std::make_unique<VKStreamBuffer>(device, scheduler);
} }
} // Anonymous namespace } // Anonymous namespace
Buffer::Buffer(const VKDevice& device_, VKMemoryManager& memory_manager, VKScheduler& scheduler_, Buffer::Buffer(const Device& device_, VKMemoryManager& memory_manager, VKScheduler& scheduler_,
VKStagingBufferPool& staging_pool_, VAddr cpu_addr_, std::size_t size_) VKStagingBufferPool& staging_pool_, VAddr cpu_addr_, std::size_t size_)
: BufferBlock{cpu_addr_, size_}, device{device_}, scheduler{scheduler_}, staging_pool{ : BufferBlock{cpu_addr_, size_}, device{device_}, scheduler{scheduler_}, staging_pool{
staging_pool_} { staging_pool_} {
@ -168,7 +168,7 @@ void Buffer::CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst
VKBufferCache::VKBufferCache(VideoCore::RasterizerInterface& rasterizer_, VKBufferCache::VKBufferCache(VideoCore::RasterizerInterface& rasterizer_,
Tegra::MemoryManager& gpu_memory_, Core::Memory::Memory& cpu_memory_, Tegra::MemoryManager& gpu_memory_, Core::Memory::Memory& cpu_memory_,
const VKDevice& device_, VKMemoryManager& memory_manager_, const Device& device_, VKMemoryManager& memory_manager_,
VKScheduler& scheduler_, VKStreamBuffer& stream_buffer_, VKScheduler& scheduler_, VKStreamBuffer& stream_buffer_,
VKStagingBufferPool& staging_pool_) VKStagingBufferPool& staging_pool_)
: VideoCommon::BufferCache<Buffer, VkBuffer, VKStreamBuffer>{rasterizer_, gpu_memory_, : VideoCommon::BufferCache<Buffer, VkBuffer, VKStreamBuffer>{rasterizer_, gpu_memory_,

View file

@ -15,13 +15,13 @@
namespace Vulkan { namespace Vulkan {
class VKDevice; class Device;
class VKMemoryManager; class VKMemoryManager;
class VKScheduler; class VKScheduler;
class Buffer final : public VideoCommon::BufferBlock { class Buffer final : public VideoCommon::BufferBlock {
public: public:
explicit Buffer(const VKDevice& device, VKMemoryManager& memory_manager, VKScheduler& scheduler, explicit Buffer(const Device& device, VKMemoryManager& memory_manager, VKScheduler& scheduler,
VKStagingBufferPool& staging_pool, VAddr cpu_addr_, std::size_t size_); VKStagingBufferPool& staging_pool, VAddr cpu_addr_, std::size_t size_);
~Buffer(); ~Buffer();
@ -41,7 +41,7 @@ public:
} }
private: private:
const VKDevice& device; const Device& device;
VKScheduler& scheduler; VKScheduler& scheduler;
VKStagingBufferPool& staging_pool; VKStagingBufferPool& staging_pool;
@ -52,7 +52,7 @@ class VKBufferCache final : public VideoCommon::BufferCache<Buffer, VkBuffer, VK
public: public:
explicit VKBufferCache(VideoCore::RasterizerInterface& rasterizer, explicit VKBufferCache(VideoCore::RasterizerInterface& rasterizer,
Tegra::MemoryManager& gpu_memory, Core::Memory::Memory& cpu_memory, Tegra::MemoryManager& gpu_memory, Core::Memory::Memory& cpu_memory,
const VKDevice& device, VKMemoryManager& memory_manager, const Device& device, VKMemoryManager& memory_manager,
VKScheduler& scheduler, VKStreamBuffer& stream_buffer, VKScheduler& scheduler, VKStreamBuffer& stream_buffer,
VKStagingBufferPool& staging_pool); VKStagingBufferPool& staging_pool);
~VKBufferCache(); ~VKBufferCache();
@ -63,7 +63,7 @@ protected:
std::shared_ptr<Buffer> CreateBlock(VAddr cpu_addr, std::size_t size) override; std::shared_ptr<Buffer> CreateBlock(VAddr cpu_addr, std::size_t size) override;
private: private:
const VKDevice& device; const Device& device;
VKMemoryManager& memory_manager; VKMemoryManager& memory_manager;
VKScheduler& scheduler; VKScheduler& scheduler;
VKStagingBufferPool& staging_pool; VKStagingBufferPool& staging_pool;

View file

@ -17,7 +17,7 @@ struct CommandPool::Pool {
vk::CommandBuffers cmdbufs; vk::CommandBuffers cmdbufs;
}; };
CommandPool::CommandPool(MasterSemaphore& master_semaphore_, const VKDevice& device_) CommandPool::CommandPool(MasterSemaphore& master_semaphore_, const Device& device_)
: ResourcePool(master_semaphore_, COMMAND_BUFFER_POOL_SIZE), device{device_} {} : ResourcePool(master_semaphore_, COMMAND_BUFFER_POOL_SIZE), device{device_} {}
CommandPool::~CommandPool() = default; CommandPool::~CommandPool() = default;

View file

@ -12,12 +12,12 @@
namespace Vulkan { namespace Vulkan {
class Device;
class MasterSemaphore; class MasterSemaphore;
class VKDevice;
class CommandPool final : public ResourcePool { class CommandPool final : public ResourcePool {
public: public:
explicit CommandPool(MasterSemaphore& master_semaphore_, const VKDevice& device_); explicit CommandPool(MasterSemaphore& master_semaphore_, const Device& device_);
~CommandPool() override; ~CommandPool() override;
void Allocate(size_t begin, size_t end) override; void Allocate(size_t begin, size_t end) override;
@ -27,7 +27,7 @@ public:
private: private:
struct Pool; struct Pool;
const VKDevice& device; const Device& device;
std::vector<Pool> pools; std::vector<Pool> pools;
}; };

View file

@ -86,7 +86,7 @@ VkDescriptorUpdateTemplateEntryKHR BuildInputOutputDescriptorUpdateTemplate() {
} // Anonymous namespace } // Anonymous namespace
VKComputePass::VKComputePass(const VKDevice& device, VKDescriptorPool& descriptor_pool, VKComputePass::VKComputePass(const Device& device, VKDescriptorPool& descriptor_pool,
vk::Span<VkDescriptorSetLayoutBinding> bindings, vk::Span<VkDescriptorSetLayoutBinding> bindings,
vk::Span<VkDescriptorUpdateTemplateEntryKHR> templates, vk::Span<VkDescriptorUpdateTemplateEntryKHR> templates,
vk::Span<VkPushConstantRange> push_constants, vk::Span<VkPushConstantRange> push_constants,
@ -162,7 +162,7 @@ VkDescriptorSet VKComputePass::CommitDescriptorSet(
return set; return set;
} }
QuadArrayPass::QuadArrayPass(const VKDevice& device_, VKScheduler& scheduler_, QuadArrayPass::QuadArrayPass(const Device& device_, VKScheduler& scheduler_,
VKDescriptorPool& descriptor_pool_, VKDescriptorPool& descriptor_pool_,
VKStagingBufferPool& staging_buffer_pool_, VKStagingBufferPool& staging_buffer_pool_,
VKUpdateDescriptorQueue& update_descriptor_queue_) VKUpdateDescriptorQueue& update_descriptor_queue_)
@ -211,7 +211,7 @@ std::pair<VkBuffer, VkDeviceSize> QuadArrayPass::Assemble(u32 num_vertices, u32
return {*buffer.handle, 0}; return {*buffer.handle, 0};
} }
Uint8Pass::Uint8Pass(const VKDevice& device, VKScheduler& scheduler_, Uint8Pass::Uint8Pass(const Device& device, VKScheduler& scheduler_,
VKDescriptorPool& descriptor_pool, VKStagingBufferPool& staging_buffer_pool_, VKDescriptorPool& descriptor_pool, VKStagingBufferPool& staging_buffer_pool_,
VKUpdateDescriptorQueue& update_descriptor_queue_) VKUpdateDescriptorQueue& update_descriptor_queue_)
: VKComputePass(device, descriptor_pool, BuildInputOutputDescriptorSetBindings(), : VKComputePass(device, descriptor_pool, BuildInputOutputDescriptorSetBindings(),
@ -255,7 +255,7 @@ std::pair<VkBuffer, u64> Uint8Pass::Assemble(u32 num_vertices, VkBuffer src_buff
return {*buffer.handle, 0}; return {*buffer.handle, 0};
} }
QuadIndexedPass::QuadIndexedPass(const VKDevice& device_, VKScheduler& scheduler_, QuadIndexedPass::QuadIndexedPass(const Device& device_, VKScheduler& scheduler_,
VKDescriptorPool& descriptor_pool_, VKDescriptorPool& descriptor_pool_,
VKStagingBufferPool& staging_buffer_pool_, VKStagingBufferPool& staging_buffer_pool_,
VKUpdateDescriptorQueue& update_descriptor_queue_) VKUpdateDescriptorQueue& update_descriptor_queue_)

View file

@ -15,14 +15,14 @@
namespace Vulkan { namespace Vulkan {
class VKDevice; class Device;
class VKScheduler; class VKScheduler;
class VKStagingBufferPool; class VKStagingBufferPool;
class VKUpdateDescriptorQueue; class VKUpdateDescriptorQueue;
class VKComputePass { class VKComputePass {
public: public:
explicit VKComputePass(const VKDevice& device, VKDescriptorPool& descriptor_pool, explicit VKComputePass(const Device& device, VKDescriptorPool& descriptor_pool,
vk::Span<VkDescriptorSetLayoutBinding> bindings, vk::Span<VkDescriptorSetLayoutBinding> bindings,
vk::Span<VkDescriptorUpdateTemplateEntryKHR> templates, vk::Span<VkDescriptorUpdateTemplateEntryKHR> templates,
vk::Span<VkPushConstantRange> push_constants, std::span<const u32> code); vk::Span<VkPushConstantRange> push_constants, std::span<const u32> code);
@ -43,7 +43,7 @@ private:
class QuadArrayPass final : public VKComputePass { class QuadArrayPass final : public VKComputePass {
public: public:
explicit QuadArrayPass(const VKDevice& device_, VKScheduler& scheduler_, explicit QuadArrayPass(const Device& device_, VKScheduler& scheduler_,
VKDescriptorPool& descriptor_pool_, VKDescriptorPool& descriptor_pool_,
VKStagingBufferPool& staging_buffer_pool_, VKStagingBufferPool& staging_buffer_pool_,
VKUpdateDescriptorQueue& update_descriptor_queue_); VKUpdateDescriptorQueue& update_descriptor_queue_);
@ -59,7 +59,7 @@ private:
class Uint8Pass final : public VKComputePass { class Uint8Pass final : public VKComputePass {
public: public:
explicit Uint8Pass(const VKDevice& device_, VKScheduler& scheduler_, explicit Uint8Pass(const Device& device_, VKScheduler& scheduler_,
VKDescriptorPool& descriptor_pool_, VKDescriptorPool& descriptor_pool_,
VKStagingBufferPool& staging_buffer_pool_, VKStagingBufferPool& staging_buffer_pool_,
VKUpdateDescriptorQueue& update_descriptor_queue_); VKUpdateDescriptorQueue& update_descriptor_queue_);
@ -75,7 +75,7 @@ private:
class QuadIndexedPass final : public VKComputePass { class QuadIndexedPass final : public VKComputePass {
public: public:
explicit QuadIndexedPass(const VKDevice& device_, VKScheduler& scheduler_, explicit QuadIndexedPass(const Device& device_, VKScheduler& scheduler_,
VKDescriptorPool& descriptor_pool_, VKDescriptorPool& descriptor_pool_,
VKStagingBufferPool& staging_buffer_pool_, VKStagingBufferPool& staging_buffer_pool_,
VKUpdateDescriptorQueue& update_descriptor_queue_); VKUpdateDescriptorQueue& update_descriptor_queue_);

View file

@ -15,7 +15,7 @@
namespace Vulkan { namespace Vulkan {
VKComputePipeline::VKComputePipeline(const VKDevice& device_, VKScheduler& scheduler_, VKComputePipeline::VKComputePipeline(const Device& device_, VKScheduler& scheduler_,
VKDescriptorPool& descriptor_pool_, VKDescriptorPool& descriptor_pool_,
VKUpdateDescriptorQueue& update_descriptor_queue_, VKUpdateDescriptorQueue& update_descriptor_queue_,
const SPIRVShader& shader_) const SPIRVShader& shader_)

View file

@ -11,13 +11,13 @@
namespace Vulkan { namespace Vulkan {
class VKDevice; class Device;
class VKScheduler; class VKScheduler;
class VKUpdateDescriptorQueue; class VKUpdateDescriptorQueue;
class VKComputePipeline final { class VKComputePipeline final {
public: public:
explicit VKComputePipeline(const VKDevice& device_, VKScheduler& scheduler_, explicit VKComputePipeline(const Device& device_, VKScheduler& scheduler_,
VKDescriptorPool& descriptor_pool_, VKDescriptorPool& descriptor_pool_,
VKUpdateDescriptorQueue& update_descriptor_queue_, VKUpdateDescriptorQueue& update_descriptor_queue_,
const SPIRVShader& shader_); const SPIRVShader& shader_);
@ -48,7 +48,7 @@ private:
vk::Pipeline CreatePipeline() const; vk::Pipeline CreatePipeline() const;
const VKDevice& device; const Device& device;
VKScheduler& scheduler; VKScheduler& scheduler;
ShaderEntries entries; ShaderEntries entries;

View file

@ -32,7 +32,7 @@ void DescriptorAllocator::Allocate(std::size_t begin, std::size_t end) {
descriptors_allocations.push_back(descriptor_pool.AllocateDescriptors(layout, end - begin)); descriptors_allocations.push_back(descriptor_pool.AllocateDescriptors(layout, end - begin));
} }
VKDescriptorPool::VKDescriptorPool(const VKDevice& device_, VKScheduler& scheduler) VKDescriptorPool::VKDescriptorPool(const Device& device_, VKScheduler& scheduler)
: device{device_}, master_semaphore{scheduler.GetMasterSemaphore()}, active_pool{ : device{device_}, master_semaphore{scheduler.GetMasterSemaphore()}, active_pool{
AllocateNewPool()} {} AllocateNewPool()} {}

View file

@ -11,7 +11,7 @@
namespace Vulkan { namespace Vulkan {
class VKDevice; class Device;
class VKDescriptorPool; class VKDescriptorPool;
class VKScheduler; class VKScheduler;
@ -39,7 +39,7 @@ class VKDescriptorPool final {
friend DescriptorAllocator; friend DescriptorAllocator;
public: public:
explicit VKDescriptorPool(const VKDevice& device, VKScheduler& scheduler); explicit VKDescriptorPool(const Device& device, VKScheduler& scheduler);
~VKDescriptorPool(); ~VKDescriptorPool();
VKDescriptorPool(const VKDescriptorPool&) = delete; VKDescriptorPool(const VKDescriptorPool&) = delete;
@ -50,7 +50,7 @@ private:
vk::DescriptorSets AllocateDescriptors(VkDescriptorSetLayout layout, std::size_t count); vk::DescriptorSets AllocateDescriptors(VkDescriptorSetLayout layout, std::size_t count);
const VKDevice& device; const Device& device;
MasterSemaphore& master_semaphore; MasterSemaphore& master_semaphore;
std::vector<vk::DescriptorPool> pools; std::vector<vk::DescriptorPool> pools;

View file

@ -206,8 +206,8 @@ std::unordered_map<VkFormat, VkFormatProperties> GetFormatProperties(
} // Anonymous namespace } // Anonymous namespace
VKDevice::VKDevice(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR surface, Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR surface,
const vk::InstanceDispatch& dld_) const vk::InstanceDispatch& dld_)
: instance{instance_}, dld{dld_}, physical{physical_}, properties{physical.GetProperties()}, : instance{instance_}, dld{dld_}, physical{physical_}, properties{physical.GetProperties()},
format_properties{GetFormatProperties(physical, dld)} { format_properties{GetFormatProperties(physical, dld)} {
CheckSuitability(); CheckSuitability();
@ -449,10 +449,10 @@ VKDevice::VKDevice(VkInstance instance_, vk::PhysicalDevice physical_, VkSurface
use_asynchronous_shaders = Settings::values.use_asynchronous_shaders.GetValue(); use_asynchronous_shaders = Settings::values.use_asynchronous_shaders.GetValue();
} }
VKDevice::~VKDevice() = default; Device::~Device() = default;
VkFormat VKDevice::GetSupportedFormat(VkFormat wanted_format, VkFormatFeatureFlags wanted_usage, VkFormat Device::GetSupportedFormat(VkFormat wanted_format, VkFormatFeatureFlags wanted_usage,
FormatType format_type) const { FormatType format_type) const {
if (IsFormatSupported(wanted_format, wanted_usage, format_type)) { if (IsFormatSupported(wanted_format, wanted_usage, format_type)) {
return wanted_format; return wanted_format;
} }
@ -483,18 +483,18 @@ VkFormat VKDevice::GetSupportedFormat(VkFormat wanted_format, VkFormatFeatureFla
return wanted_format; return wanted_format;
} }
void VKDevice::ReportLoss() const { void Device::ReportLoss() const {
LOG_CRITICAL(Render_Vulkan, "Device loss occurred!"); LOG_CRITICAL(Render_Vulkan, "Device loss occured!");
// Wait for the log to flush and for Nsight Aftermath to dump the results // Wait for the log to flush and for Nsight Aftermath to dump the results
std::this_thread::sleep_for(std::chrono::seconds{15}); std::this_thread::sleep_for(std::chrono::seconds{15});
} }
void VKDevice::SaveShader(const std::vector<u32>& spirv) const { void Device::SaveShader(const std::vector<u32>& spirv) const {
nsight_aftermath_tracker.SaveShader(spirv); nsight_aftermath_tracker.SaveShader(spirv);
} }
bool VKDevice::IsOptimalAstcSupported(const VkPhysicalDeviceFeatures& features) const { bool Device::IsOptimalAstcSupported(const VkPhysicalDeviceFeatures& features) const {
// Disable for now to avoid converting ASTC twice. // Disable for now to avoid converting ASTC twice.
static constexpr std::array astc_formats = { static constexpr std::array astc_formats = {
VK_FORMAT_ASTC_4x4_UNORM_BLOCK, VK_FORMAT_ASTC_4x4_SRGB_BLOCK, VK_FORMAT_ASTC_4x4_UNORM_BLOCK, VK_FORMAT_ASTC_4x4_SRGB_BLOCK,
@ -528,7 +528,7 @@ bool VKDevice::IsOptimalAstcSupported(const VkPhysicalDeviceFeatures& features)
return true; return true;
} }
bool VKDevice::TestDepthStencilBlits() const { bool Device::TestDepthStencilBlits() const {
static constexpr VkFormatFeatureFlags required_features = static constexpr VkFormatFeatureFlags required_features =
VK_FORMAT_FEATURE_BLIT_SRC_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT; VK_FORMAT_FEATURE_BLIT_SRC_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT;
const auto test_features = [](VkFormatProperties props) { const auto test_features = [](VkFormatProperties props) {
@ -538,8 +538,8 @@ bool VKDevice::TestDepthStencilBlits() const {
test_features(format_properties.at(VK_FORMAT_D24_UNORM_S8_UINT)); test_features(format_properties.at(VK_FORMAT_D24_UNORM_S8_UINT));
} }
bool VKDevice::IsFormatSupported(VkFormat wanted_format, VkFormatFeatureFlags wanted_usage, bool Device::IsFormatSupported(VkFormat wanted_format, VkFormatFeatureFlags wanted_usage,
FormatType format_type) const { FormatType format_type) const {
const auto it = format_properties.find(wanted_format); const auto it = format_properties.find(wanted_format);
if (it == format_properties.end()) { if (it == format_properties.end()) {
UNIMPLEMENTED_MSG("Unimplemented format query={}", wanted_format); UNIMPLEMENTED_MSG("Unimplemented format query={}", wanted_format);
@ -549,7 +549,7 @@ bool VKDevice::IsFormatSupported(VkFormat wanted_format, VkFormatFeatureFlags wa
return (supported_usage & wanted_usage) == wanted_usage; return (supported_usage & wanted_usage) == wanted_usage;
} }
void VKDevice::CheckSuitability() const { void Device::CheckSuitability() const {
std::bitset<REQUIRED_EXTENSIONS.size()> available_extensions; std::bitset<REQUIRED_EXTENSIONS.size()> available_extensions;
for (const VkExtensionProperties& property : physical.EnumerateDeviceExtensionProperties()) { for (const VkExtensionProperties& property : physical.EnumerateDeviceExtensionProperties()) {
for (std::size_t i = 0; i < REQUIRED_EXTENSIONS.size(); ++i) { for (std::size_t i = 0; i < REQUIRED_EXTENSIONS.size(); ++i) {
@ -614,7 +614,7 @@ void VKDevice::CheckSuitability() const {
} }
} }
std::vector<const char*> VKDevice::LoadExtensions() { std::vector<const char*> Device::LoadExtensions() {
std::vector<const char*> extensions; std::vector<const char*> extensions;
extensions.reserve(7 + REQUIRED_EXTENSIONS.size()); extensions.reserve(7 + REQUIRED_EXTENSIONS.size());
extensions.insert(extensions.begin(), REQUIRED_EXTENSIONS.begin(), REQUIRED_EXTENSIONS.end()); extensions.insert(extensions.begin(), REQUIRED_EXTENSIONS.begin(), REQUIRED_EXTENSIONS.end());
@ -767,7 +767,7 @@ std::vector<const char*> VKDevice::LoadExtensions() {
return extensions; return extensions;
} }
void VKDevice::SetupFamilies(VkSurfaceKHR surface) { void Device::SetupFamilies(VkSurfaceKHR surface) {
const std::vector queue_family_properties = physical.GetQueueFamilyProperties(); const std::vector queue_family_properties = physical.GetQueueFamilyProperties();
std::optional<u32> graphics; std::optional<u32> graphics;
std::optional<u32> present; std::optional<u32> present;
@ -798,14 +798,14 @@ void VKDevice::SetupFamilies(VkSurfaceKHR surface) {
present_family = *present; present_family = *present;
} }
void VKDevice::SetupFeatures() { void Device::SetupFeatures() {
const auto supported_features{physical.GetFeatures()}; const auto supported_features{physical.GetFeatures()};
is_formatless_image_load_supported = supported_features.shaderStorageImageReadWithoutFormat; is_formatless_image_load_supported = supported_features.shaderStorageImageReadWithoutFormat;
is_blit_depth_stencil_supported = TestDepthStencilBlits(); is_blit_depth_stencil_supported = TestDepthStencilBlits();
is_optimal_astc_supported = IsOptimalAstcSupported(supported_features); is_optimal_astc_supported = IsOptimalAstcSupported(supported_features);
} }
void VKDevice::CollectTelemetryParameters() { void Device::CollectTelemetryParameters() {
VkPhysicalDeviceDriverPropertiesKHR driver{ VkPhysicalDeviceDriverPropertiesKHR driver{
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES_KHR, .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES_KHR,
.pNext = nullptr, .pNext = nullptr,
@ -832,7 +832,7 @@ void VKDevice::CollectTelemetryParameters() {
} }
} }
void VKDevice::CollectToolingInfo() { void Device::CollectToolingInfo() {
if (!ext_tooling_info) { if (!ext_tooling_info) {
return; return;
} }
@ -858,7 +858,7 @@ void VKDevice::CollectToolingInfo() {
} }
} }
std::vector<VkDeviceQueueCreateInfo> VKDevice::GetDeviceQueueCreateInfos() const { std::vector<VkDeviceQueueCreateInfo> Device::GetDeviceQueueCreateInfos() const {
static constexpr float QUEUE_PRIORITY = 1.0f; static constexpr float QUEUE_PRIORITY = 1.0f;
std::unordered_set<u32> unique_queue_families{graphics_family, present_family}; std::unordered_set<u32> unique_queue_families{graphics_family, present_family};

View file

@ -22,11 +22,11 @@ enum class FormatType { Linear, Optimal, Buffer };
const u32 GuestWarpSize = 32; const u32 GuestWarpSize = 32;
/// Handles data specific to a physical device. /// Handles data specific to a physical device.
class VKDevice final { class Device final {
public: public:
explicit VKDevice(VkInstance instance, vk::PhysicalDevice physical, VkSurfaceKHR surface, explicit Device(VkInstance instance, vk::PhysicalDevice physical, VkSurfaceKHR surface,
const vk::InstanceDispatch& dld); const vk::InstanceDispatch& dld);
~VKDevice(); ~Device();
/** /**
* Returns a format supported by the device for the passed requeriments. * Returns a format supported by the device for the passed requeriments.

View file

@ -14,11 +14,11 @@
namespace Vulkan { namespace Vulkan {
InnerFence::InnerFence(const VKDevice& device_, VKScheduler& scheduler_, u32 payload_, InnerFence::InnerFence(const Device& device_, VKScheduler& scheduler_, u32 payload_,
bool is_stubbed_) bool is_stubbed_)
: FenceBase{payload_, is_stubbed_}, device{device_}, scheduler{scheduler_} {} : FenceBase{payload_, is_stubbed_}, device{device_}, scheduler{scheduler_} {}
InnerFence::InnerFence(const VKDevice& device_, VKScheduler& scheduler_, GPUVAddr address_, InnerFence::InnerFence(const Device& device_, VKScheduler& scheduler_, GPUVAddr address_,
u32 payload_, bool is_stubbed_) u32 payload_, bool is_stubbed_)
: FenceBase{address_, payload_, is_stubbed_}, device{device_}, scheduler{scheduler_} {} : FenceBase{address_, payload_, is_stubbed_}, device{device_}, scheduler{scheduler_} {}
@ -75,7 +75,7 @@ bool InnerFence::IsEventSignalled() const {
VKFenceManager::VKFenceManager(VideoCore::RasterizerInterface& rasterizer_, Tegra::GPU& gpu_, VKFenceManager::VKFenceManager(VideoCore::RasterizerInterface& rasterizer_, Tegra::GPU& gpu_,
Tegra::MemoryManager& memory_manager_, TextureCache& texture_cache_, Tegra::MemoryManager& memory_manager_, TextureCache& texture_cache_,
VKBufferCache& buffer_cache_, VKQueryCache& query_cache_, VKBufferCache& buffer_cache_, VKQueryCache& query_cache_,
const VKDevice& device_, VKScheduler& scheduler_) const Device& device_, VKScheduler& scheduler_)
: GenericFenceManager{rasterizer_, gpu_, texture_cache_, buffer_cache_, query_cache_}, : GenericFenceManager{rasterizer_, gpu_, texture_cache_, buffer_cache_, query_cache_},
device{device_}, scheduler{scheduler_} {} device{device_}, scheduler{scheduler_} {}

View file

@ -21,16 +21,16 @@ class RasterizerInterface;
namespace Vulkan { namespace Vulkan {
class Device;
class VKBufferCache; class VKBufferCache;
class VKDevice;
class VKQueryCache; class VKQueryCache;
class VKScheduler; class VKScheduler;
class InnerFence : public VideoCommon::FenceBase { class InnerFence : public VideoCommon::FenceBase {
public: public:
explicit InnerFence(const VKDevice& device_, VKScheduler& scheduler_, u32 payload_, explicit InnerFence(const Device& device_, VKScheduler& scheduler_, u32 payload_,
bool is_stubbed_); bool is_stubbed_);
explicit InnerFence(const VKDevice& device_, VKScheduler& scheduler_, GPUVAddr address_, explicit InnerFence(const Device& device_, VKScheduler& scheduler_, GPUVAddr address_,
u32 payload_, bool is_stubbed_); u32 payload_, bool is_stubbed_);
~InnerFence(); ~InnerFence();
@ -43,7 +43,7 @@ public:
private: private:
bool IsEventSignalled() const; bool IsEventSignalled() const;
const VKDevice& device; const Device& device;
VKScheduler& scheduler; VKScheduler& scheduler;
vk::Event event; vk::Event event;
u64 ticks = 0; u64 ticks = 0;
@ -58,7 +58,7 @@ public:
explicit VKFenceManager(VideoCore::RasterizerInterface& rasterizer_, Tegra::GPU& gpu_, explicit VKFenceManager(VideoCore::RasterizerInterface& rasterizer_, Tegra::GPU& gpu_,
Tegra::MemoryManager& memory_manager_, TextureCache& texture_cache_, Tegra::MemoryManager& memory_manager_, TextureCache& texture_cache_,
VKBufferCache& buffer_cache_, VKQueryCache& query_cache_, VKBufferCache& buffer_cache_, VKQueryCache& query_cache_,
const VKDevice& device_, VKScheduler& scheduler_); const Device& device_, VKScheduler& scheduler_);
protected: protected:
Fence CreateFence(u32 value, bool is_stubbed) override; Fence CreateFence(u32 value, bool is_stubbed) override;
@ -68,7 +68,7 @@ protected:
void WaitFence(Fence& fence) override; void WaitFence(Fence& fence) override;
private: private:
const VKDevice& device; const Device& device;
VKScheduler& scheduler; VKScheduler& scheduler;
}; };

View file

@ -94,7 +94,7 @@ VkSampleCountFlagBits ConvertMsaaMode(Tegra::Texture::MsaaMode msaa_mode) {
} // Anonymous namespace } // Anonymous namespace
VKGraphicsPipeline::VKGraphicsPipeline(const VKDevice& device_, VKScheduler& scheduler_, VKGraphicsPipeline::VKGraphicsPipeline(const Device& device_, VKScheduler& scheduler_,
VKDescriptorPool& descriptor_pool_, VKDescriptorPool& descriptor_pool_,
VKUpdateDescriptorQueue& update_descriptor_queue_, VKUpdateDescriptorQueue& update_descriptor_queue_,
const GraphicsPipelineCacheKey& key, const GraphicsPipelineCacheKey& key,

View file

@ -40,8 +40,8 @@ static_assert(std::has_unique_object_representations_v<GraphicsPipelineCacheKey>
static_assert(std::is_trivially_copyable_v<GraphicsPipelineCacheKey>); static_assert(std::is_trivially_copyable_v<GraphicsPipelineCacheKey>);
static_assert(std::is_trivially_constructible_v<GraphicsPipelineCacheKey>); static_assert(std::is_trivially_constructible_v<GraphicsPipelineCacheKey>);
class Device;
class VKDescriptorPool; class VKDescriptorPool;
class VKDevice;
class VKScheduler; class VKScheduler;
class VKUpdateDescriptorQueue; class VKUpdateDescriptorQueue;
@ -49,7 +49,7 @@ using SPIRVProgram = std::array<std::optional<SPIRVShader>, Maxwell::MaxShaderSt
class VKGraphicsPipeline final { class VKGraphicsPipeline final {
public: public:
explicit VKGraphicsPipeline(const VKDevice& device_, VKScheduler& scheduler_, explicit VKGraphicsPipeline(const Device& device_, VKScheduler& scheduler_,
VKDescriptorPool& descriptor_pool, VKDescriptorPool& descriptor_pool,
VKUpdateDescriptorQueue& update_descriptor_queue_, VKUpdateDescriptorQueue& update_descriptor_queue_,
const GraphicsPipelineCacheKey& key, const GraphicsPipelineCacheKey& key,
@ -85,7 +85,7 @@ private:
vk::Pipeline CreatePipeline(const SPIRVProgram& program, VkRenderPass renderpass, vk::Pipeline CreatePipeline(const SPIRVProgram& program, VkRenderPass renderpass,
u32 num_color_buffers) const; u32 num_color_buffers) const;
const VKDevice& device; const Device& device;
VKScheduler& scheduler; VKScheduler& scheduler;
const GraphicsPipelineCacheKey cache_key; const GraphicsPipelineCacheKey cache_key;
const u64 hash; const u64 hash;

View file

@ -14,7 +14,7 @@ namespace Vulkan {
using namespace std::chrono_literals; using namespace std::chrono_literals;
MasterSemaphore::MasterSemaphore(const VKDevice& device) { MasterSemaphore::MasterSemaphore(const Device& device) {
static constexpr VkSemaphoreTypeCreateInfoKHR semaphore_type_ci{ static constexpr VkSemaphoreTypeCreateInfoKHR semaphore_type_ci{
.sType = VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO_KHR, .sType = VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO_KHR,
.pNext = nullptr, .pNext = nullptr,

View file

@ -12,11 +12,11 @@
namespace Vulkan { namespace Vulkan {
class VKDevice; class Device;
class MasterSemaphore { class MasterSemaphore {
public: public:
explicit MasterSemaphore(const VKDevice& device); explicit MasterSemaphore(const Device& device);
~MasterSemaphore(); ~MasterSemaphore();
/// Returns the current logical tick. /// Returns the current logical tick.

View file

@ -29,7 +29,7 @@ u64 GetAllocationChunkSize(u64 required_size) {
class VKMemoryAllocation final { class VKMemoryAllocation final {
public: public:
explicit VKMemoryAllocation(const VKDevice& device_, vk::DeviceMemory memory_, explicit VKMemoryAllocation(const Device& device_, vk::DeviceMemory memory_,
VkMemoryPropertyFlags properties_, u64 allocation_size_, u32 type_) VkMemoryPropertyFlags properties_, u64 allocation_size_, u32 type_)
: device{device_}, memory{std::move(memory_)}, properties{properties_}, : device{device_}, memory{std::move(memory_)}, properties{properties_},
allocation_size{allocation_size_}, shifted_type{ShiftType(type_)} {} allocation_size{allocation_size_}, shifted_type{ShiftType(type_)} {}
@ -104,7 +104,7 @@ private:
return std::nullopt; return std::nullopt;
} }
const VKDevice& device; ///< Vulkan device. const Device& device; ///< Vulkan device.
const vk::DeviceMemory memory; ///< Vulkan memory allocation handler. const vk::DeviceMemory memory; ///< Vulkan memory allocation handler.
const VkMemoryPropertyFlags properties; ///< Vulkan properties. const VkMemoryPropertyFlags properties; ///< Vulkan properties.
const u64 allocation_size; ///< Size of this allocation. const u64 allocation_size; ///< Size of this allocation.
@ -117,7 +117,7 @@ private:
std::vector<const VKMemoryCommitImpl*> commits; std::vector<const VKMemoryCommitImpl*> commits;
}; };
VKMemoryManager::VKMemoryManager(const VKDevice& device_) VKMemoryManager::VKMemoryManager(const Device& device_)
: device{device_}, properties{device_.GetPhysical().GetMemoryProperties()} {} : device{device_}, properties{device_.GetPhysical().GetMemoryProperties()} {}
VKMemoryManager::~VKMemoryManager() = default; VKMemoryManager::~VKMemoryManager() = default;
@ -207,7 +207,7 @@ VKMemoryCommit VKMemoryManager::TryAllocCommit(const VkMemoryRequirements& requi
return {}; return {};
} }
VKMemoryCommitImpl::VKMemoryCommitImpl(const VKDevice& device_, VKMemoryAllocation* allocation_, VKMemoryCommitImpl::VKMemoryCommitImpl(const Device& device_, VKMemoryAllocation* allocation_,
const vk::DeviceMemory& memory_, u64 begin_, u64 end_) const vk::DeviceMemory& memory_, u64 begin_, u64 end_)
: device{device_}, memory{memory_}, interval{begin_, end_}, allocation{allocation_} {} : device{device_}, memory{memory_}, interval{begin_, end_}, allocation{allocation_} {}

View file

@ -13,8 +13,8 @@
namespace Vulkan { namespace Vulkan {
class Device;
class MemoryMap; class MemoryMap;
class VKDevice;
class VKMemoryAllocation; class VKMemoryAllocation;
class VKMemoryCommitImpl; class VKMemoryCommitImpl;
@ -22,7 +22,7 @@ using VKMemoryCommit = std::unique_ptr<VKMemoryCommitImpl>;
class VKMemoryManager final { class VKMemoryManager final {
public: public:
explicit VKMemoryManager(const VKDevice& device_); explicit VKMemoryManager(const Device& device_);
VKMemoryManager(const VKMemoryManager&) = delete; VKMemoryManager(const VKMemoryManager&) = delete;
~VKMemoryManager(); ~VKMemoryManager();
@ -49,7 +49,7 @@ private:
VKMemoryCommit TryAllocCommit(const VkMemoryRequirements& requirements, VKMemoryCommit TryAllocCommit(const VkMemoryRequirements& requirements,
VkMemoryPropertyFlags wanted_properties); VkMemoryPropertyFlags wanted_properties);
const VKDevice& device; ///< Device handler. const Device& device; ///< Device handler.
const VkPhysicalDeviceMemoryProperties properties; ///< Physical device properties. const VkPhysicalDeviceMemoryProperties properties; ///< Physical device properties.
std::vector<std::unique_ptr<VKMemoryAllocation>> allocations; ///< Current allocations. std::vector<std::unique_ptr<VKMemoryAllocation>> allocations; ///< Current allocations.
}; };
@ -59,7 +59,7 @@ class VKMemoryCommitImpl final {
friend MemoryMap; friend MemoryMap;
public: public:
explicit VKMemoryCommitImpl(const VKDevice& device_, VKMemoryAllocation* allocation_, explicit VKMemoryCommitImpl(const Device& device_, VKMemoryAllocation* allocation_,
const vk::DeviceMemory& memory_, u64 begin_, u64 end_); const vk::DeviceMemory& memory_, u64 begin_, u64 end_);
~VKMemoryCommitImpl(); ~VKMemoryCommitImpl();
@ -85,7 +85,7 @@ private:
/// Unmaps memory. /// Unmaps memory.
void Unmap() const; void Unmap() const;
const VKDevice& device; ///< Vulkan device. const Device& device; ///< Vulkan device.
const vk::DeviceMemory& memory; ///< Vulkan device memory handler. const vk::DeviceMemory& memory; ///< Vulkan device memory handler.
std::pair<u64, u64> interval{}; ///< Interval where the commit exists. std::pair<u64, u64> interval{}; ///< Interval where the commit exists.
VKMemoryAllocation* allocation{}; ///< Pointer to the large memory allocation. VKMemoryAllocation* allocation{}; ///< Pointer to the large memory allocation.

View file

@ -149,7 +149,7 @@ Shader::~Shader() = default;
VKPipelineCache::VKPipelineCache(RasterizerVulkan& rasterizer_, Tegra::GPU& gpu_, VKPipelineCache::VKPipelineCache(RasterizerVulkan& rasterizer_, Tegra::GPU& gpu_,
Tegra::Engines::Maxwell3D& maxwell3d_, Tegra::Engines::Maxwell3D& maxwell3d_,
Tegra::Engines::KeplerCompute& kepler_compute_, Tegra::Engines::KeplerCompute& kepler_compute_,
Tegra::MemoryManager& gpu_memory_, const VKDevice& device_, Tegra::MemoryManager& gpu_memory_, const Device& device_,
VKScheduler& scheduler_, VKDescriptorPool& descriptor_pool_, VKScheduler& scheduler_, VKDescriptorPool& descriptor_pool_,
VKUpdateDescriptorQueue& update_descriptor_queue_) VKUpdateDescriptorQueue& update_descriptor_queue_)
: VideoCommon::ShaderCache<Shader>{rasterizer_}, gpu{gpu_}, maxwell3d{maxwell3d_}, : VideoCommon::ShaderCache<Shader>{rasterizer_}, gpu{gpu_}, maxwell3d{maxwell3d_},

View file

@ -33,10 +33,10 @@ class System;
namespace Vulkan { namespace Vulkan {
class Device;
class RasterizerVulkan; class RasterizerVulkan;
class VKComputePipeline; class VKComputePipeline;
class VKDescriptorPool; class VKDescriptorPool;
class VKDevice;
class VKScheduler; class VKScheduler;
class VKUpdateDescriptorQueue; class VKUpdateDescriptorQueue;
@ -121,7 +121,7 @@ public:
explicit VKPipelineCache(RasterizerVulkan& rasterizer, Tegra::GPU& gpu, explicit VKPipelineCache(RasterizerVulkan& rasterizer, Tegra::GPU& gpu,
Tegra::Engines::Maxwell3D& maxwell3d, Tegra::Engines::Maxwell3D& maxwell3d,
Tegra::Engines::KeplerCompute& kepler_compute, Tegra::Engines::KeplerCompute& kepler_compute,
Tegra::MemoryManager& gpu_memory, const VKDevice& device, Tegra::MemoryManager& gpu_memory, const Device& device,
VKScheduler& scheduler, VKDescriptorPool& descriptor_pool, VKScheduler& scheduler, VKDescriptorPool& descriptor_pool,
VKUpdateDescriptorQueue& update_descriptor_queue); VKUpdateDescriptorQueue& update_descriptor_queue);
~VKPipelineCache() override; ~VKPipelineCache() override;
@ -148,7 +148,7 @@ private:
Tegra::Engines::KeplerCompute& kepler_compute; Tegra::Engines::KeplerCompute& kepler_compute;
Tegra::MemoryManager& gpu_memory; Tegra::MemoryManager& gpu_memory;
const VKDevice& device; const Device& device;
VKScheduler& scheduler; VKScheduler& scheduler;
VKDescriptorPool& descriptor_pool; VKDescriptorPool& descriptor_pool;
VKUpdateDescriptorQueue& update_descriptor_queue; VKUpdateDescriptorQueue& update_descriptor_queue;

View file

@ -27,7 +27,7 @@ constexpr VkQueryType GetTarget(QueryType type) {
} // Anonymous namespace } // Anonymous namespace
QueryPool::QueryPool(const VKDevice& device_, VKScheduler& scheduler, QueryType type_) QueryPool::QueryPool(const Device& device_, VKScheduler& scheduler, QueryType type_)
: ResourcePool{scheduler.GetMasterSemaphore(), GROW_STEP}, device{device_}, type{type_} {} : ResourcePool{scheduler.GetMasterSemaphore(), GROW_STEP}, device{device_}, type{type_} {}
QueryPool::~QueryPool() = default; QueryPool::~QueryPool() = default;
@ -68,7 +68,7 @@ void QueryPool::Reserve(std::pair<VkQueryPool, u32> query) {
VKQueryCache::VKQueryCache(VideoCore::RasterizerInterface& rasterizer_, VKQueryCache::VKQueryCache(VideoCore::RasterizerInterface& rasterizer_,
Tegra::Engines::Maxwell3D& maxwell3d_, Tegra::MemoryManager& gpu_memory_, Tegra::Engines::Maxwell3D& maxwell3d_, Tegra::MemoryManager& gpu_memory_,
const VKDevice& device_, VKScheduler& scheduler_) const Device& device_, VKScheduler& scheduler_)
: QueryCacheBase{rasterizer_, maxwell3d_, gpu_memory_}, device{device_}, scheduler{scheduler_}, : QueryCacheBase{rasterizer_, maxwell3d_, gpu_memory_}, device{device_}, scheduler{scheduler_},
query_pools{ query_pools{
QueryPool{device_, scheduler_, QueryType::SamplesPassed}, QueryPool{device_, scheduler_, QueryType::SamplesPassed},
@ -96,9 +96,9 @@ void VKQueryCache::Reserve(QueryType type, std::pair<VkQueryPool, u32> query) {
HostCounter::HostCounter(VKQueryCache& cache_, std::shared_ptr<HostCounter> dependency_, HostCounter::HostCounter(VKQueryCache& cache_, std::shared_ptr<HostCounter> dependency_,
QueryType type_) QueryType type_)
: HostCounterBase{std::move(dependency_)}, cache{cache_}, type{type_}, : HostCounterBase{std::move(dependency_)}, cache{cache_}, type{type_},
query{cache_.AllocateQuery(type_)}, tick{cache_.Scheduler().CurrentTick()} { query{cache_.AllocateQuery(type_)}, tick{cache_.GetScheduler().CurrentTick()} {
const vk::Device* logical = &cache_.Device().GetLogical(); const vk::Device* logical = &cache.GetDevice().GetLogical();
cache_.Scheduler().Record([logical, query = query](vk::CommandBuffer cmdbuf) { cache.GetScheduler().Record([logical, query = query](vk::CommandBuffer cmdbuf) {
logical->ResetQueryPoolEXT(query.first, query.second, 1); logical->ResetQueryPoolEXT(query.first, query.second, 1);
cmdbuf.BeginQuery(query.first, query.second, VK_QUERY_CONTROL_PRECISE_BIT); cmdbuf.BeginQuery(query.first, query.second, VK_QUERY_CONTROL_PRECISE_BIT);
}); });
@ -109,17 +109,17 @@ HostCounter::~HostCounter() {
} }
void HostCounter::EndQuery() { void HostCounter::EndQuery() {
cache.Scheduler().Record( cache.GetScheduler().Record(
[query = query](vk::CommandBuffer cmdbuf) { cmdbuf.EndQuery(query.first, query.second); }); [query = query](vk::CommandBuffer cmdbuf) { cmdbuf.EndQuery(query.first, query.second); });
} }
u64 HostCounter::BlockingQuery() const { u64 HostCounter::BlockingQuery() const {
if (tick >= cache.Scheduler().CurrentTick()) { if (tick >= cache.GetScheduler().CurrentTick()) {
cache.Scheduler().Flush(); cache.GetScheduler().Flush();
} }
u64 data; u64 data;
const VkResult query_result = cache.Device().GetLogical().GetQueryResults( const VkResult query_result = cache.GetDevice().GetLogical().GetQueryResults(
query.first, query.second, 1, sizeof(data), &data, sizeof(data), query.first, query.second, 1, sizeof(data), &data, sizeof(data),
VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT); VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT);
@ -127,7 +127,7 @@ u64 HostCounter::BlockingQuery() const {
case VK_SUCCESS: case VK_SUCCESS:
return data; return data;
case VK_ERROR_DEVICE_LOST: case VK_ERROR_DEVICE_LOST:
cache.Device().ReportLoss(); cache.GetDevice().ReportLoss();
[[fallthrough]]; [[fallthrough]];
default: default:
throw vk::Exception(query_result); throw vk::Exception(query_result);

View file

@ -21,8 +21,8 @@ class RasterizerInterface;
namespace Vulkan { namespace Vulkan {
class CachedQuery; class CachedQuery;
class Device;
class HostCounter; class HostCounter;
class VKDevice;
class VKQueryCache; class VKQueryCache;
class VKScheduler; class VKScheduler;
@ -30,7 +30,7 @@ using CounterStream = VideoCommon::CounterStreamBase<VKQueryCache, HostCounter>;
class QueryPool final : public ResourcePool { class QueryPool final : public ResourcePool {
public: public:
explicit QueryPool(const VKDevice& device, VKScheduler& scheduler, VideoCore::QueryType type); explicit QueryPool(const Device& device, VKScheduler& scheduler, VideoCore::QueryType type);
~QueryPool() override; ~QueryPool() override;
std::pair<VkQueryPool, u32> Commit(); std::pair<VkQueryPool, u32> Commit();
@ -43,7 +43,7 @@ protected:
private: private:
static constexpr std::size_t GROW_STEP = 512; static constexpr std::size_t GROW_STEP = 512;
const VKDevice& device; const Device& device;
const VideoCore::QueryType type; const VideoCore::QueryType type;
std::vector<vk::QueryPool> pools; std::vector<vk::QueryPool> pools;
@ -55,23 +55,23 @@ class VKQueryCache final
public: public:
explicit VKQueryCache(VideoCore::RasterizerInterface& rasterizer_, explicit VKQueryCache(VideoCore::RasterizerInterface& rasterizer_,
Tegra::Engines::Maxwell3D& maxwell3d_, Tegra::MemoryManager& gpu_memory_, Tegra::Engines::Maxwell3D& maxwell3d_, Tegra::MemoryManager& gpu_memory_,
const VKDevice& device_, VKScheduler& scheduler_); const Device& device_, VKScheduler& scheduler_);
~VKQueryCache(); ~VKQueryCache();
std::pair<VkQueryPool, u32> AllocateQuery(VideoCore::QueryType type); std::pair<VkQueryPool, u32> AllocateQuery(VideoCore::QueryType type);
void Reserve(VideoCore::QueryType type, std::pair<VkQueryPool, u32> query); void Reserve(VideoCore::QueryType type, std::pair<VkQueryPool, u32> query);
const VKDevice& Device() const noexcept { const Device& GetDevice() const noexcept {
return device; return device;
} }
VKScheduler& Scheduler() const noexcept { VKScheduler& GetScheduler() const noexcept {
return scheduler; return scheduler;
} }
private: private:
const VKDevice& device; const Device& device;
VKScheduler& scheduler; VKScheduler& scheduler;
std::array<QueryPool, VideoCore::NumQueryTypes> query_pools; std::array<QueryPool, VideoCore::NumQueryTypes> query_pools;
}; };

View file

@ -62,7 +62,7 @@ namespace {
constexpr auto COMPUTE_SHADER_INDEX = static_cast<size_t>(Tegra::Engines::ShaderType::Compute); constexpr auto COMPUTE_SHADER_INDEX = static_cast<size_t>(Tegra::Engines::ShaderType::Compute);
VkViewport GetViewportState(const VKDevice& device, const Maxwell& regs, size_t index) { VkViewport GetViewportState(const Device& device, const Maxwell& regs, size_t index) {
const auto& src = regs.viewport_transform[index]; const auto& src = regs.viewport_transform[index];
const float width = src.scale_x * 2.0f; const float width = src.scale_x * 2.0f;
const float height = src.scale_y * 2.0f; const float height = src.scale_y * 2.0f;
@ -239,7 +239,7 @@ public:
index.type = type; index.type = type;
} }
void Bind(const VKDevice& device, VKScheduler& scheduler) const { void Bind(const Device& device, VKScheduler& scheduler) const {
// Use this large switch case to avoid dispatching more memory in the record lambda than // Use this large switch case to avoid dispatching more memory in the record lambda than
// what we need. It looks horrible, but it's the best we can do on standard C++. // what we need. It looks horrible, but it's the best we can do on standard C++.
switch (vertex.num_buffers) { switch (vertex.num_buffers) {
@ -330,7 +330,7 @@ private:
} index; } index;
template <size_t N> template <size_t N>
void BindStatic(const VKDevice& device, VKScheduler& scheduler) const { void BindStatic(const Device& device, VKScheduler& scheduler) const {
if (device.IsExtExtendedDynamicStateSupported()) { if (device.IsExtExtendedDynamicStateSupported()) {
if (index.buffer) { if (index.buffer) {
BindStatic<N, true, true>(scheduler); BindStatic<N, true, true>(scheduler);
@ -409,7 +409,7 @@ void RasterizerVulkan::DrawParameters::Draw(vk::CommandBuffer cmdbuf) const {
RasterizerVulkan::RasterizerVulkan(Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_, RasterizerVulkan::RasterizerVulkan(Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_,
Tegra::MemoryManager& gpu_memory_, Tegra::MemoryManager& gpu_memory_,
Core::Memory::Memory& cpu_memory_, VKScreenInfo& screen_info_, Core::Memory::Memory& cpu_memory_, VKScreenInfo& screen_info_,
const VKDevice& device_, VKMemoryManager& memory_manager_, const Device& device_, VKMemoryManager& memory_manager_,
StateTracker& state_tracker_, VKScheduler& scheduler_) StateTracker& state_tracker_, VKScheduler& scheduler_)
: RasterizerAccelerated{cpu_memory_}, gpu{gpu_}, : RasterizerAccelerated{cpu_memory_}, gpu{gpu_},
gpu_memory{gpu_memory_}, maxwell3d{gpu.Maxwell3D()}, kepler_compute{gpu.KeplerCompute()}, gpu_memory{gpu_memory_}, maxwell3d{gpu.Maxwell3D()}, kepler_compute{gpu.KeplerCompute()},

View file

@ -55,7 +55,7 @@ class RasterizerVulkan final : public VideoCore::RasterizerAccelerated {
public: public:
explicit RasterizerVulkan(Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_, explicit RasterizerVulkan(Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_,
Tegra::MemoryManager& gpu_memory_, Core::Memory::Memory& cpu_memory_, Tegra::MemoryManager& gpu_memory_, Core::Memory::Memory& cpu_memory_,
VKScreenInfo& screen_info_, const VKDevice& device_, VKScreenInfo& screen_info_, const Device& device_,
VKMemoryManager& memory_manager_, StateTracker& state_tracker_, VKMemoryManager& memory_manager_, StateTracker& state_tracker_,
VKScheduler& scheduler_); VKScheduler& scheduler_);
~RasterizerVulkan() override; ~RasterizerVulkan() override;
@ -212,7 +212,7 @@ private:
Tegra::Engines::KeplerCompute& kepler_compute; Tegra::Engines::KeplerCompute& kepler_compute;
VKScreenInfo& screen_info; VKScreenInfo& screen_info;
const VKDevice& device; const Device& device;
VKMemoryManager& memory_manager; VKMemoryManager& memory_manager;
StateTracker& state_tracker; StateTracker& state_tracker;
VKScheduler& scheduler; VKScheduler& scheduler;

View file

@ -37,7 +37,7 @@ void VKScheduler::CommandChunk::ExecuteAll(vk::CommandBuffer cmdbuf) {
last = nullptr; last = nullptr;
} }
VKScheduler::VKScheduler(const VKDevice& device_, StateTracker& state_tracker_) VKScheduler::VKScheduler(const Device& device_, StateTracker& state_tracker_)
: device{device_}, state_tracker{state_tracker_}, : device{device_}, state_tracker{state_tracker_},
master_semaphore{std::make_unique<MasterSemaphore>(device)}, master_semaphore{std::make_unique<MasterSemaphore>(device)},
command_pool{std::make_unique<CommandPool>(*master_semaphore, device)} { command_pool{std::make_unique<CommandPool>(*master_semaphore, device)} {

View file

@ -17,17 +17,17 @@
namespace Vulkan { namespace Vulkan {
class CommandPool; class CommandPool;
class Device;
class Framebuffer; class Framebuffer;
class MasterSemaphore; class MasterSemaphore;
class StateTracker; class StateTracker;
class VKDevice;
class VKQueryCache; class VKQueryCache;
/// The scheduler abstracts command buffer and fence management with an interface that's able to do /// The scheduler abstracts command buffer and fence management with an interface that's able to do
/// OpenGL-like operations on Vulkan command buffers. /// OpenGL-like operations on Vulkan command buffers.
class VKScheduler { class VKScheduler {
public: public:
explicit VKScheduler(const VKDevice& device, StateTracker& state_tracker); explicit VKScheduler(const Device& device, StateTracker& state_tracker);
~VKScheduler(); ~VKScheduler();
/// Returns the current command buffer tick. /// Returns the current command buffer tick.
@ -179,7 +179,7 @@ private:
void AcquireNewChunk(); void AcquireNewChunk();
const VKDevice& device; const Device& device;
StateTracker& state_tracker; StateTracker& state_tracker;
std::unique_ptr<MasterSemaphore> master_semaphore; std::unique_ptr<MasterSemaphore> master_semaphore;

View file

@ -274,7 +274,7 @@ bool IsPrecise(Operation operand) {
class SPIRVDecompiler final : public Sirit::Module { class SPIRVDecompiler final : public Sirit::Module {
public: public:
explicit SPIRVDecompiler(const VKDevice& device_, const ShaderIR& ir_, ShaderType stage_, explicit SPIRVDecompiler(const Device& device_, const ShaderIR& ir_, ShaderType stage_,
const Registry& registry_, const Specialization& specialization_) const Registry& registry_, const Specialization& specialization_)
: Module(0x00010300), device{device_}, ir{ir_}, stage{stage_}, header{ir_.GetHeader()}, : Module(0x00010300), device{device_}, ir{ir_}, stage{stage_}, header{ir_.GetHeader()},
registry{registry_}, specialization{specialization_} { registry{registry_}, specialization{specialization_} {
@ -2742,7 +2742,7 @@ private:
}; };
static_assert(operation_decompilers.size() == static_cast<std::size_t>(OperationCode::Amount)); static_assert(operation_decompilers.size() == static_cast<std::size_t>(OperationCode::Amount));
const VKDevice& device; const Device& device;
const ShaderIR& ir; const ShaderIR& ir;
const ShaderType stage; const ShaderType stage;
const Tegra::Shader::Header header; const Tegra::Shader::Header header;
@ -3130,7 +3130,7 @@ ShaderEntries GenerateShaderEntries(const VideoCommon::Shader::ShaderIR& ir) {
return entries; return entries;
} }
std::vector<u32> Decompile(const VKDevice& device, const VideoCommon::Shader::ShaderIR& ir, std::vector<u32> Decompile(const Device& device, const VideoCommon::Shader::ShaderIR& ir,
ShaderType stage, const VideoCommon::Shader::Registry& registry, ShaderType stage, const VideoCommon::Shader::Registry& registry,
const Specialization& specialization) { const Specialization& specialization) {
return SPIRVDecompiler(device, ir, stage, registry, specialization).Assemble(); return SPIRVDecompiler(device, ir, stage, registry, specialization).Assemble();

View file

@ -15,10 +15,8 @@
#include "video_core/shader/shader_ir.h" #include "video_core/shader/shader_ir.h"
namespace Vulkan { namespace Vulkan {
class VKDevice;
}
namespace Vulkan { class Device;
using Maxwell = Tegra::Engines::Maxwell3D::Regs; using Maxwell = Tegra::Engines::Maxwell3D::Regs;
using UniformTexelEntry = VideoCommon::Shader::SamplerEntry; using UniformTexelEntry = VideoCommon::Shader::SamplerEntry;
@ -109,7 +107,7 @@ struct SPIRVShader {
ShaderEntries GenerateShaderEntries(const VideoCommon::Shader::ShaderIR& ir); ShaderEntries GenerateShaderEntries(const VideoCommon::Shader::ShaderIR& ir);
std::vector<u32> Decompile(const VKDevice& device, const VideoCommon::Shader::ShaderIR& ir, std::vector<u32> Decompile(const Device& device, const VideoCommon::Shader::ShaderIR& ir,
Tegra::Engines::ShaderType stage, Tegra::Engines::ShaderType stage,
const VideoCommon::Shader::Registry& registry, const VideoCommon::Shader::Registry& registry,
const Specialization& specialization); const Specialization& specialization);

View file

@ -13,7 +13,7 @@
namespace Vulkan { namespace Vulkan {
vk::ShaderModule BuildShader(const VKDevice& device, std::span<const u32> code) { vk::ShaderModule BuildShader(const Device& device, std::span<const u32> code) {
return device.GetLogical().CreateShaderModule({ return device.GetLogical().CreateShaderModule({
.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO, .sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
.pNext = nullptr, .pNext = nullptr,

View file

@ -11,8 +11,8 @@
namespace Vulkan { namespace Vulkan {
class VKDevice; class Device;
vk::ShaderModule BuildShader(const VKDevice& device, std::span<const u32> code); vk::ShaderModule BuildShader(const Device& device, std::span<const u32> code);
} // namespace Vulkan } // namespace Vulkan

View file

@ -19,7 +19,7 @@ namespace Vulkan {
VKStagingBufferPool::StagingBuffer::StagingBuffer(std::unique_ptr<VKBuffer> buffer_) VKStagingBufferPool::StagingBuffer::StagingBuffer(std::unique_ptr<VKBuffer> buffer_)
: buffer{std::move(buffer_)} {} : buffer{std::move(buffer_)} {}
VKStagingBufferPool::VKStagingBufferPool(const VKDevice& device_, VKMemoryManager& memory_manager_, VKStagingBufferPool::VKStagingBufferPool(const Device& device_, VKMemoryManager& memory_manager_,
VKScheduler& scheduler_) VKScheduler& scheduler_)
: device{device_}, memory_manager{memory_manager_}, scheduler{scheduler_} {} : device{device_}, memory_manager{memory_manager_}, scheduler{scheduler_} {}

View file

@ -14,7 +14,7 @@
namespace Vulkan { namespace Vulkan {
class VKDevice; class Device;
class VKScheduler; class VKScheduler;
struct VKBuffer final { struct VKBuffer final {
@ -24,7 +24,7 @@ struct VKBuffer final {
class VKStagingBufferPool final { class VKStagingBufferPool final {
public: public:
explicit VKStagingBufferPool(const VKDevice& device, VKMemoryManager& memory_manager, explicit VKStagingBufferPool(const Device& device, VKMemoryManager& memory_manager,
VKScheduler& scheduler); VKScheduler& scheduler);
~VKStagingBufferPool(); ~VKStagingBufferPool();
@ -58,7 +58,7 @@ private:
u64 ReleaseLevel(StagingBuffersCache& cache, std::size_t log2); u64 ReleaseLevel(StagingBuffersCache& cache, std::size_t log2);
const VKDevice& device; const Device& device;
VKMemoryManager& memory_manager; VKMemoryManager& memory_manager;
VKScheduler& scheduler; VKScheduler& scheduler;

View file

@ -60,7 +60,7 @@ u32 GetMemoryType(const VkPhysicalDeviceMemoryProperties& properties,
} // Anonymous namespace } // Anonymous namespace
VKStreamBuffer::VKStreamBuffer(const VKDevice& device_, VKScheduler& scheduler_) VKStreamBuffer::VKStreamBuffer(const Device& device_, VKScheduler& scheduler_)
: device{device_}, scheduler{scheduler_} { : device{device_}, scheduler{scheduler_} {
CreateBuffers(); CreateBuffers();
ReserveWatches(current_watches, WATCHES_INITIAL_RESERVE); ReserveWatches(current_watches, WATCHES_INITIAL_RESERVE);

View file

@ -13,13 +13,13 @@
namespace Vulkan { namespace Vulkan {
class VKDevice; class Device;
class VKFenceWatch; class VKFenceWatch;
class VKScheduler; class VKScheduler;
class VKStreamBuffer final { class VKStreamBuffer final {
public: public:
explicit VKStreamBuffer(const VKDevice& device, VKScheduler& scheduler); explicit VKStreamBuffer(const Device& device, VKScheduler& scheduler);
~VKStreamBuffer(); ~VKStreamBuffer();
/** /**
@ -54,7 +54,7 @@ private:
void WaitPendingOperations(u64 requested_upper_bound); void WaitPendingOperations(u64 requested_upper_bound);
const VKDevice& device; ///< Vulkan device manager. const Device& device; ///< Vulkan device manager.
VKScheduler& scheduler; ///< Command scheduler. VKScheduler& scheduler; ///< Command scheduler.
vk::Buffer buffer; ///< Mapped buffer. vk::Buffer buffer; ///< Mapped buffer.

View file

@ -56,7 +56,7 @@ VkExtent2D ChooseSwapExtent(const VkSurfaceCapabilitiesKHR& capabilities, u32 wi
} // Anonymous namespace } // Anonymous namespace
VKSwapchain::VKSwapchain(VkSurfaceKHR surface_, const VKDevice& device_, VKScheduler& scheduler_) VKSwapchain::VKSwapchain(VkSurfaceKHR surface_, const Device& device_, VKScheduler& scheduler_)
: surface{surface_}, device{device_}, scheduler{scheduler_} {} : surface{surface_}, device{device_}, scheduler{scheduler_} {}
VKSwapchain::~VKSwapchain() = default; VKSwapchain::~VKSwapchain() = default;

View file

@ -15,12 +15,12 @@ struct FramebufferLayout;
namespace Vulkan { namespace Vulkan {
class VKDevice; class Device;
class VKScheduler; class VKScheduler;
class VKSwapchain { class VKSwapchain {
public: public:
explicit VKSwapchain(VkSurfaceKHR surface, const VKDevice& device, VKScheduler& scheduler); explicit VKSwapchain(VkSurfaceKHR surface, const Device& device, VKScheduler& scheduler);
~VKSwapchain(); ~VKSwapchain();
/// Creates (or recreates) the swapchain with a given size. /// Creates (or recreates) the swapchain with a given size.
@ -73,7 +73,7 @@ private:
void Destroy(); void Destroy();
const VkSurfaceKHR surface; const VkSurfaceKHR surface;
const VKDevice& device; const Device& device;
VKScheduler& scheduler; VKScheduler& scheduler;
vk::SwapchainKHR swapchain; vk::SwapchainKHR swapchain;

View file

@ -93,7 +93,7 @@ constexpr VkBorderColor ConvertBorderColor(const std::array<float, 4>& color) {
} }
} }
[[nodiscard]] VkImageCreateInfo MakeImageCreateInfo(const VKDevice& device, const ImageInfo& info) { [[nodiscard]] VkImageCreateInfo MakeImageCreateInfo(const Device& device, const ImageInfo& info) {
const auto format_info = MaxwellToVK::SurfaceFormat(device, FormatType::Optimal, info.format); const auto format_info = MaxwellToVK::SurfaceFormat(device, FormatType::Optimal, info.format);
VkImageCreateFlags flags = VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT; VkImageCreateFlags flags = VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
if (info.type == ImageType::e2D && info.resources.layers >= 6 && if (info.type == ImageType::e2D && info.resources.layers >= 6 &&
@ -146,14 +146,14 @@ constexpr VkBorderColor ConvertBorderColor(const std::array<float, 4>& color) {
}; };
} }
[[nodiscard]] vk::Image MakeImage(const VKDevice& device, const ImageInfo& info) { [[nodiscard]] vk::Image MakeImage(const Device& device, const ImageInfo& info) {
if (info.type == ImageType::Buffer) { if (info.type == ImageType::Buffer) {
return vk::Image{}; return vk::Image{};
} }
return device.GetLogical().CreateImage(MakeImageCreateInfo(device, info)); return device.GetLogical().CreateImage(MakeImageCreateInfo(device, info));
} }
[[nodiscard]] vk::Buffer MakeBuffer(const VKDevice& device, const ImageInfo& info) { [[nodiscard]] vk::Buffer MakeBuffer(const Device& device, const ImageInfo& info) {
if (info.type != ImageType::Buffer) { if (info.type != ImageType::Buffer) {
return vk::Buffer{}; return vk::Buffer{};
} }
@ -205,7 +205,7 @@ constexpr VkBorderColor ConvertBorderColor(const std::array<float, 4>& color) {
} }
} }
[[nodiscard]] VkAttachmentDescription AttachmentDescription(const VKDevice& device, [[nodiscard]] VkAttachmentDescription AttachmentDescription(const Device& device,
const ImageView* image_view) { const ImageView* image_view) {
const auto pixel_format = image_view->format; const auto pixel_format = image_view->format;
return VkAttachmentDescription{ return VkAttachmentDescription{

View file

@ -19,11 +19,11 @@ using VideoCommon::Offset2D;
using VideoCommon::RenderTargets; using VideoCommon::RenderTargets;
using VideoCore::Surface::PixelFormat; using VideoCore::Surface::PixelFormat;
class VKDevice;
class VKScheduler; class VKScheduler;
class VKStagingBufferPool; class VKStagingBufferPool;
class BlitImageHelper; class BlitImageHelper;
class Device;
class Image; class Image;
class ImageView; class ImageView;
class Framebuffer; class Framebuffer;
@ -68,7 +68,7 @@ struct ImageBufferMap {
}; };
struct TextureCacheRuntime { struct TextureCacheRuntime {
const VKDevice& device; const Device& device;
VKScheduler& scheduler; VKScheduler& scheduler;
VKMemoryManager& memory_manager; VKMemoryManager& memory_manager;
VKStagingBufferPool& staging_buffer_pool; VKStagingBufferPool& staging_buffer_pool;
@ -177,7 +177,7 @@ public:
private: private:
[[nodiscard]] vk::ImageView MakeDepthStencilView(VkImageAspectFlags aspect_mask); [[nodiscard]] vk::ImageView MakeDepthStencilView(VkImageAspectFlags aspect_mask);
const VKDevice* device = nullptr; const Device* device = nullptr;
std::array<vk::ImageView, VideoCommon::NUM_IMAGE_VIEW_TYPES> image_views; std::array<vk::ImageView, VideoCommon::NUM_IMAGE_VIEW_TYPES> image_views;
vk::ImageView depth_view; vk::ImageView depth_view;
vk::ImageView stencil_view; vk::ImageView stencil_view;

View file

@ -14,7 +14,7 @@
namespace Vulkan { namespace Vulkan {
VKUpdateDescriptorQueue::VKUpdateDescriptorQueue(const VKDevice& device_, VKScheduler& scheduler_) VKUpdateDescriptorQueue::VKUpdateDescriptorQueue(const Device& device_, VKScheduler& scheduler_)
: device{device_}, scheduler{scheduler_} {} : device{device_}, scheduler{scheduler_} {}
VKUpdateDescriptorQueue::~VKUpdateDescriptorQueue() = default; VKUpdateDescriptorQueue::~VKUpdateDescriptorQueue() = default;

View file

@ -12,7 +12,7 @@
namespace Vulkan { namespace Vulkan {
class VKDevice; class Device;
class VKScheduler; class VKScheduler;
struct DescriptorUpdateEntry { struct DescriptorUpdateEntry {
@ -31,7 +31,7 @@ struct DescriptorUpdateEntry {
class VKUpdateDescriptorQueue final { class VKUpdateDescriptorQueue final {
public: public:
explicit VKUpdateDescriptorQueue(const VKDevice& device_, VKScheduler& scheduler_); explicit VKUpdateDescriptorQueue(const Device& device_, VKScheduler& scheduler_);
~VKUpdateDescriptorQueue(); ~VKUpdateDescriptorQueue();
void TickFrame(); void TickFrame();
@ -69,7 +69,7 @@ public:
} }
private: private:
const VKDevice& device; const Device& device;
VKScheduler& scheduler; VKScheduler& scheduler;
const DescriptorUpdateEntry* upload_start = nullptr; const DescriptorUpdateEntry* upload_start = nullptr;

View file

@ -134,7 +134,7 @@ void AsyncShaders::QueueOpenGLShader(const OpenGL::Device& device,
} }
void AsyncShaders::QueueVulkanShader(Vulkan::VKPipelineCache* pp_cache, void AsyncShaders::QueueVulkanShader(Vulkan::VKPipelineCache* pp_cache,
const Vulkan::VKDevice& device, Vulkan::VKScheduler& scheduler, const Vulkan::Device& device, Vulkan::VKScheduler& scheduler,
Vulkan::VKDescriptorPool& descriptor_pool, Vulkan::VKDescriptorPool& descriptor_pool,
Vulkan::VKUpdateDescriptorQueue& update_descriptor_queue, Vulkan::VKUpdateDescriptorQueue& update_descriptor_queue,
std::vector<VkDescriptorSetLayoutBinding> bindings, std::vector<VkDescriptorSetLayoutBinding> bindings,

View file

@ -94,7 +94,7 @@ public:
CompilerSettings compiler_settings, const Registry& registry, CompilerSettings compiler_settings, const Registry& registry,
VAddr cpu_addr); VAddr cpu_addr);
void QueueVulkanShader(Vulkan::VKPipelineCache* pp_cache, const Vulkan::VKDevice& device, void QueueVulkanShader(Vulkan::VKPipelineCache* pp_cache, const Vulkan::Device& device,
Vulkan::VKScheduler& scheduler, Vulkan::VKScheduler& scheduler,
Vulkan::VKDescriptorPool& descriptor_pool, Vulkan::VKDescriptorPool& descriptor_pool,
Vulkan::VKUpdateDescriptorQueue& update_descriptor_queue, Vulkan::VKUpdateDescriptorQueue& update_descriptor_queue,
@ -123,7 +123,7 @@ private:
// For Vulkan // For Vulkan
Vulkan::VKPipelineCache* pp_cache; Vulkan::VKPipelineCache* pp_cache;
const Vulkan::VKDevice* vk_device; const Vulkan::Device* vk_device;
Vulkan::VKScheduler* scheduler; Vulkan::VKScheduler* scheduler;
Vulkan::VKDescriptorPool* descriptor_pool; Vulkan::VKDescriptorPool* descriptor_pool;
Vulkan::VKUpdateDescriptorQueue* update_descriptor_queue; Vulkan::VKUpdateDescriptorQueue* update_descriptor_queue;