early-access version 2806
This commit is contained in:
@@ -349,7 +349,7 @@ VkExtent2D GetConversionExtent(const ImageView& src_image_view) {
|
||||
}
|
||||
} // Anonymous namespace
|
||||
|
||||
BlitImageHelper::BlitImageHelper(const Device& device_, VKScheduler& scheduler_,
|
||||
BlitImageHelper::BlitImageHelper(const Device& device_, Scheduler& scheduler_,
|
||||
StateTracker& state_tracker_, DescriptorPool& descriptor_pool)
|
||||
: device{device_}, scheduler{scheduler_}, state_tracker{state_tracker_},
|
||||
one_texture_set_layout(device.GetLogical().CreateDescriptorSetLayout(
|
||||
|
@@ -16,7 +16,7 @@ class Device;
|
||||
class Framebuffer;
|
||||
class ImageView;
|
||||
class StateTracker;
|
||||
class VKScheduler;
|
||||
class Scheduler;
|
||||
|
||||
struct BlitImagePipelineKey {
|
||||
constexpr auto operator<=>(const BlitImagePipelineKey&) const noexcept = default;
|
||||
@@ -27,7 +27,7 @@ struct BlitImagePipelineKey {
|
||||
|
||||
class BlitImageHelper {
|
||||
public:
|
||||
explicit BlitImageHelper(const Device& device, VKScheduler& scheduler,
|
||||
explicit BlitImageHelper(const Device& device, Scheduler& scheduler,
|
||||
StateTracker& state_tracker, DescriptorPool& descriptor_pool);
|
||||
~BlitImageHelper();
|
||||
|
||||
@@ -82,7 +82,7 @@ private:
|
||||
vk::ShaderModule& module);
|
||||
|
||||
const Device& device;
|
||||
VKScheduler& scheduler;
|
||||
Scheduler& scheduler;
|
||||
StateTracker& state_tracker;
|
||||
|
||||
vk::DescriptorSetLayout one_texture_set_layout;
|
||||
|
@@ -168,7 +168,7 @@ private:
|
||||
};
|
||||
|
||||
inline void PushImageDescriptors(TextureCache& texture_cache,
|
||||
VKUpdateDescriptorQueue& update_descriptor_queue,
|
||||
UpdateDescriptorQueue& update_descriptor_queue,
|
||||
const Shader::Info& info, RescalingPushConstant& rescaling,
|
||||
const VkSampler*& samplers,
|
||||
const VideoCommon::ImageViewInOut*& views) {
|
||||
|
@@ -65,14 +65,14 @@ private:
|
||||
vk::DebugUtilsMessenger debug_callback;
|
||||
vk::SurfaceKHR surface;
|
||||
|
||||
VKScreenInfo screen_info;
|
||||
ScreenInfo screen_info;
|
||||
|
||||
Device device;
|
||||
MemoryAllocator memory_allocator;
|
||||
StateTracker state_tracker;
|
||||
VKScheduler scheduler;
|
||||
VKSwapchain swapchain;
|
||||
VKBlitScreen blit_screen;
|
||||
Scheduler scheduler;
|
||||
Swapchain swapchain;
|
||||
BlitScreen blit_screen;
|
||||
RasterizerVulkan rasterizer;
|
||||
};
|
||||
|
||||
|
@@ -108,7 +108,7 @@ VkFormat GetFormat(const Tegra::FramebufferConfig& framebuffer) {
|
||||
|
||||
} // Anonymous namespace
|
||||
|
||||
struct VKBlitScreen::BufferData {
|
||||
struct BlitScreen::BufferData {
|
||||
struct {
|
||||
std::array<f32, 4 * 4> modelview_matrix;
|
||||
} uniform;
|
||||
@@ -118,10 +118,9 @@ struct VKBlitScreen::BufferData {
|
||||
// Unaligned image data goes here
|
||||
};
|
||||
|
||||
VKBlitScreen::VKBlitScreen(Core::Memory::Memory& cpu_memory_,
|
||||
Core::Frontend::EmuWindow& render_window_, const Device& device_,
|
||||
MemoryAllocator& memory_allocator_, VKSwapchain& swapchain_,
|
||||
VKScheduler& scheduler_, const VKScreenInfo& screen_info_)
|
||||
BlitScreen::BlitScreen(Core::Memory::Memory& cpu_memory_, Core::Frontend::EmuWindow& render_window_,
|
||||
const Device& device_, MemoryAllocator& memory_allocator_,
|
||||
Swapchain& swapchain_, Scheduler& scheduler_, const ScreenInfo& screen_info_)
|
||||
: cpu_memory{cpu_memory_}, render_window{render_window_}, device{device_},
|
||||
memory_allocator{memory_allocator_}, swapchain{swapchain_}, scheduler{scheduler_},
|
||||
image_count{swapchain.GetImageCount()}, screen_info{screen_info_} {
|
||||
@@ -131,16 +130,16 @@ VKBlitScreen::VKBlitScreen(Core::Memory::Memory& cpu_memory_,
|
||||
CreateDynamicResources();
|
||||
}
|
||||
|
||||
VKBlitScreen::~VKBlitScreen() = default;
|
||||
BlitScreen::~BlitScreen() = default;
|
||||
|
||||
void VKBlitScreen::Recreate() {
|
||||
void BlitScreen::Recreate() {
|
||||
CreateDynamicResources();
|
||||
}
|
||||
|
||||
VkSemaphore VKBlitScreen::Draw(const Tegra::FramebufferConfig& framebuffer,
|
||||
const VkFramebuffer& host_framebuffer,
|
||||
const Layout::FramebufferLayout layout, VkExtent2D render_area,
|
||||
bool use_accelerated) {
|
||||
VkSemaphore BlitScreen::Draw(const Tegra::FramebufferConfig& framebuffer,
|
||||
const VkFramebuffer& host_framebuffer,
|
||||
const Layout::FramebufferLayout layout, VkExtent2D render_area,
|
||||
bool use_accelerated) {
|
||||
RefreshResources(framebuffer);
|
||||
|
||||
// Finish any pending renderpass
|
||||
@@ -419,20 +418,20 @@ VkSemaphore VKBlitScreen::Draw(const Tegra::FramebufferConfig& framebuffer,
|
||||
return *semaphores[image_index];
|
||||
}
|
||||
|
||||
VkSemaphore VKBlitScreen::DrawToSwapchain(const Tegra::FramebufferConfig& framebuffer,
|
||||
bool use_accelerated) {
|
||||
VkSemaphore BlitScreen::DrawToSwapchain(const Tegra::FramebufferConfig& framebuffer,
|
||||
bool use_accelerated) {
|
||||
const std::size_t image_index = swapchain.GetImageIndex();
|
||||
const VkExtent2D render_area = swapchain.GetSize();
|
||||
const Layout::FramebufferLayout layout = render_window.GetFramebufferLayout();
|
||||
return Draw(framebuffer, *framebuffers[image_index], layout, render_area, use_accelerated);
|
||||
}
|
||||
|
||||
vk::Framebuffer VKBlitScreen::CreateFramebuffer(const VkImageView& image_view, VkExtent2D extent) {
|
||||
vk::Framebuffer BlitScreen::CreateFramebuffer(const VkImageView& image_view, VkExtent2D extent) {
|
||||
return CreateFramebuffer(image_view, extent, renderpass);
|
||||
}
|
||||
|
||||
vk::Framebuffer VKBlitScreen::CreateFramebuffer(const VkImageView& image_view, VkExtent2D extent,
|
||||
vk::RenderPass& rd) {
|
||||
vk::Framebuffer BlitScreen::CreateFramebuffer(const VkImageView& image_view, VkExtent2D extent,
|
||||
vk::RenderPass& rd) {
|
||||
return device.GetLogical().CreateFramebuffer(VkFramebufferCreateInfo{
|
||||
.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
@@ -446,7 +445,7 @@ vk::Framebuffer VKBlitScreen::CreateFramebuffer(const VkImageView& image_view, V
|
||||
});
|
||||
}
|
||||
|
||||
void VKBlitScreen::CreateStaticResources() {
|
||||
void BlitScreen::CreateStaticResources() {
|
||||
CreateShaders();
|
||||
CreateSemaphores();
|
||||
CreateDescriptorPool();
|
||||
@@ -456,7 +455,7 @@ void VKBlitScreen::CreateStaticResources() {
|
||||
CreateSampler();
|
||||
}
|
||||
|
||||
void VKBlitScreen::CreateDynamicResources() {
|
||||
void BlitScreen::CreateDynamicResources() {
|
||||
CreateRenderPass();
|
||||
CreateFramebuffers();
|
||||
CreateGraphicsPipeline();
|
||||
@@ -466,7 +465,7 @@ void VKBlitScreen::CreateDynamicResources() {
|
||||
}
|
||||
}
|
||||
|
||||
void VKBlitScreen::RefreshResources(const Tegra::FramebufferConfig& framebuffer) {
|
||||
void BlitScreen::RefreshResources(const Tegra::FramebufferConfig& framebuffer) {
|
||||
if (Settings::values.scaling_filter.GetValue() == Settings::ScalingFilter::Fsr) {
|
||||
if (!fsr) {
|
||||
CreateFSR();
|
||||
@@ -486,7 +485,7 @@ void VKBlitScreen::RefreshResources(const Tegra::FramebufferConfig& framebuffer)
|
||||
CreateRawImages(framebuffer);
|
||||
}
|
||||
|
||||
void VKBlitScreen::CreateShaders() {
|
||||
void BlitScreen::CreateShaders() {
|
||||
vertex_shader = BuildShader(device, VULKAN_PRESENT_VERT_SPV);
|
||||
fxaa_vertex_shader = BuildShader(device, FXAA_VERT_SPV);
|
||||
fxaa_fragment_shader = BuildShader(device, FXAA_FRAG_SPV);
|
||||
@@ -500,12 +499,12 @@ void VKBlitScreen::CreateShaders() {
|
||||
}
|
||||
}
|
||||
|
||||
void VKBlitScreen::CreateSemaphores() {
|
||||
void BlitScreen::CreateSemaphores() {
|
||||
semaphores.resize(image_count);
|
||||
std::ranges::generate(semaphores, [this] { return device.GetLogical().CreateSemaphore(); });
|
||||
}
|
||||
|
||||
void VKBlitScreen::CreateDescriptorPool() {
|
||||
void BlitScreen::CreateDescriptorPool() {
|
||||
const std::array<VkDescriptorPoolSize, 2> pool_sizes{{
|
||||
{
|
||||
.type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
|
||||
@@ -545,11 +544,11 @@ void VKBlitScreen::CreateDescriptorPool() {
|
||||
aa_descriptor_pool = device.GetLogical().CreateDescriptorPool(ci_aa);
|
||||
}
|
||||
|
||||
void VKBlitScreen::CreateRenderPass() {
|
||||
void BlitScreen::CreateRenderPass() {
|
||||
renderpass = CreateRenderPassImpl(swapchain.GetImageViewFormat());
|
||||
}
|
||||
|
||||
vk::RenderPass VKBlitScreen::CreateRenderPassImpl(VkFormat format, bool is_present) {
|
||||
vk::RenderPass BlitScreen::CreateRenderPassImpl(VkFormat format, bool is_present) {
|
||||
const VkAttachmentDescription color_attachment{
|
||||
.flags = 0,
|
||||
.format = format,
|
||||
@@ -605,7 +604,7 @@ vk::RenderPass VKBlitScreen::CreateRenderPassImpl(VkFormat format, bool is_prese
|
||||
return device.GetLogical().CreateRenderPass(renderpass_ci);
|
||||
}
|
||||
|
||||
void VKBlitScreen::CreateDescriptorSetLayout() {
|
||||
void BlitScreen::CreateDescriptorSetLayout() {
|
||||
const std::array<VkDescriptorSetLayoutBinding, 2> layout_bindings{{
|
||||
{
|
||||
.binding = 0,
|
||||
@@ -660,7 +659,7 @@ void VKBlitScreen::CreateDescriptorSetLayout() {
|
||||
aa_descriptor_set_layout = device.GetLogical().CreateDescriptorSetLayout(ci_aa);
|
||||
}
|
||||
|
||||
void VKBlitScreen::CreateDescriptorSets() {
|
||||
void BlitScreen::CreateDescriptorSets() {
|
||||
const std::vector layouts(image_count, *descriptor_set_layout);
|
||||
const std::vector layouts_aa(image_count, *aa_descriptor_set_layout);
|
||||
|
||||
@@ -684,7 +683,7 @@ void VKBlitScreen::CreateDescriptorSets() {
|
||||
aa_descriptor_sets = aa_descriptor_pool.Allocate(ai_aa);
|
||||
}
|
||||
|
||||
void VKBlitScreen::CreatePipelineLayout() {
|
||||
void BlitScreen::CreatePipelineLayout() {
|
||||
const VkPipelineLayoutCreateInfo ci{
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
@@ -707,7 +706,7 @@ void VKBlitScreen::CreatePipelineLayout() {
|
||||
aa_pipeline_layout = device.GetLogical().CreatePipelineLayout(ci_aa);
|
||||
}
|
||||
|
||||
void VKBlitScreen::CreateGraphicsPipeline() {
|
||||
void BlitScreen::CreateGraphicsPipeline() {
|
||||
const std::array<VkPipelineShaderStageCreateInfo, 2> bilinear_shader_stages{{
|
||||
{
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
|
||||
@@ -980,7 +979,7 @@ void VKBlitScreen::CreateGraphicsPipeline() {
|
||||
scaleforce_pipeline = device.GetLogical().CreateGraphicsPipeline(scaleforce_pipeline_ci);
|
||||
}
|
||||
|
||||
void VKBlitScreen::CreateSampler() {
|
||||
void BlitScreen::CreateSampler() {
|
||||
const VkSamplerCreateInfo ci{
|
||||
.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
@@ -1027,7 +1026,7 @@ void VKBlitScreen::CreateSampler() {
|
||||
nn_sampler = device.GetLogical().CreateSampler(ci_nn);
|
||||
}
|
||||
|
||||
void VKBlitScreen::CreateFramebuffers() {
|
||||
void BlitScreen::CreateFramebuffers() {
|
||||
const VkExtent2D size{swapchain.GetSize()};
|
||||
framebuffers.resize(image_count);
|
||||
|
||||
@@ -1037,7 +1036,7 @@ void VKBlitScreen::CreateFramebuffers() {
|
||||
}
|
||||
}
|
||||
|
||||
void VKBlitScreen::ReleaseRawImages() {
|
||||
void BlitScreen::ReleaseRawImages() {
|
||||
for (const u64 tick : resource_ticks) {
|
||||
scheduler.Wait(tick);
|
||||
}
|
||||
@@ -1052,7 +1051,7 @@ void VKBlitScreen::ReleaseRawImages() {
|
||||
buffer_commit = MemoryCommit{};
|
||||
}
|
||||
|
||||
void VKBlitScreen::CreateStagingBuffer(const Tegra::FramebufferConfig& framebuffer) {
|
||||
void BlitScreen::CreateStagingBuffer(const Tegra::FramebufferConfig& framebuffer) {
|
||||
const VkBufferCreateInfo ci{
|
||||
.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
@@ -1069,7 +1068,7 @@ void VKBlitScreen::CreateStagingBuffer(const Tegra::FramebufferConfig& framebuff
|
||||
buffer_commit = memory_allocator.Commit(buffer, MemoryUsage::Upload);
|
||||
}
|
||||
|
||||
void VKBlitScreen::CreateRawImages(const Tegra::FramebufferConfig& framebuffer) {
|
||||
void BlitScreen::CreateRawImages(const Tegra::FramebufferConfig& framebuffer) {
|
||||
raw_images.resize(image_count);
|
||||
raw_image_views.resize(image_count);
|
||||
raw_buffer_commits.resize(image_count);
|
||||
@@ -1294,8 +1293,8 @@ void VKBlitScreen::CreateRawImages(const Tegra::FramebufferConfig& framebuffer)
|
||||
aa_pipeline = device.GetLogical().CreateGraphicsPipeline(fxaa_pipeline_ci);
|
||||
}
|
||||
|
||||
void VKBlitScreen::UpdateAADescriptorSet(std::size_t image_index, VkImageView image_view,
|
||||
bool nn) const {
|
||||
void BlitScreen::UpdateAADescriptorSet(std::size_t image_index, VkImageView image_view,
|
||||
bool nn) const {
|
||||
const VkDescriptorImageInfo image_info{
|
||||
.sampler = nn ? *nn_sampler : *sampler,
|
||||
.imageView = image_view,
|
||||
@@ -1331,8 +1330,8 @@ void VKBlitScreen::UpdateAADescriptorSet(std::size_t image_index, VkImageView im
|
||||
device.GetLogical().UpdateDescriptorSets(std::array{sampler_write, sampler_write_2}, {});
|
||||
}
|
||||
|
||||
void VKBlitScreen::UpdateDescriptorSet(std::size_t image_index, VkImageView image_view,
|
||||
bool nn) const {
|
||||
void BlitScreen::UpdateDescriptorSet(std::size_t image_index, VkImageView image_view,
|
||||
bool nn) const {
|
||||
const VkDescriptorBufferInfo buffer_info{
|
||||
.buffer = *buffer,
|
||||
.offset = offsetof(BufferData, uniform),
|
||||
@@ -1374,13 +1373,13 @@ void VKBlitScreen::UpdateDescriptorSet(std::size_t image_index, VkImageView imag
|
||||
device.GetLogical().UpdateDescriptorSets(std::array{ubo_write, sampler_write}, {});
|
||||
}
|
||||
|
||||
void VKBlitScreen::SetUniformData(BufferData& data, const Layout::FramebufferLayout layout) const {
|
||||
void BlitScreen::SetUniformData(BufferData& data, const Layout::FramebufferLayout layout) const {
|
||||
data.uniform.modelview_matrix =
|
||||
MakeOrthographicMatrix(static_cast<f32>(layout.width), static_cast<f32>(layout.height));
|
||||
}
|
||||
|
||||
void VKBlitScreen::SetVertexData(BufferData& data, const Tegra::FramebufferConfig& framebuffer,
|
||||
const Layout::FramebufferLayout layout) const {
|
||||
void BlitScreen::SetVertexData(BufferData& data, const Tegra::FramebufferConfig& framebuffer,
|
||||
const Layout::FramebufferLayout layout) const {
|
||||
const auto& framebuffer_transform_flags = framebuffer.transform_flags;
|
||||
const auto& framebuffer_crop_rect = framebuffer.crop_rect;
|
||||
|
||||
@@ -1432,7 +1431,7 @@ void VKBlitScreen::SetVertexData(BufferData& data, const Tegra::FramebufferConfi
|
||||
data.vertices[3] = ScreenRectVertex(x + w, y + h, texcoords.bottom * scale_u, right * scale_v);
|
||||
}
|
||||
|
||||
void VKBlitScreen::CreateFSR() {
|
||||
void BlitScreen::CreateFSR() {
|
||||
const auto& layout = render_window.GetFramebufferLayout();
|
||||
const VkExtent2D fsr_size{
|
||||
.width = layout.screen.GetWidth(),
|
||||
@@ -1441,12 +1440,12 @@ void VKBlitScreen::CreateFSR() {
|
||||
fsr = std::make_unique<FSR>(device, memory_allocator, image_count, fsr_size);
|
||||
}
|
||||
|
||||
u64 VKBlitScreen::CalculateBufferSize(const Tegra::FramebufferConfig& framebuffer) const {
|
||||
u64 BlitScreen::CalculateBufferSize(const Tegra::FramebufferConfig& framebuffer) const {
|
||||
return sizeof(BufferData) + GetSizeInBytes(framebuffer) * image_count;
|
||||
}
|
||||
|
||||
u64 VKBlitScreen::GetRawImageOffset(const Tegra::FramebufferConfig& framebuffer,
|
||||
std::size_t image_index) const {
|
||||
u64 BlitScreen::GetRawImageOffset(const Tegra::FramebufferConfig& framebuffer,
|
||||
std::size_t image_index) const {
|
||||
constexpr auto first_image_offset = static_cast<u64>(sizeof(BufferData));
|
||||
return first_image_offset + GetSizeInBytes(framebuffer) * image_index;
|
||||
}
|
||||
|
@@ -35,23 +35,22 @@ struct ScreenInfo;
|
||||
class Device;
|
||||
class FSR;
|
||||
class RasterizerVulkan;
|
||||
class VKScheduler;
|
||||
class VKSwapchain;
|
||||
class Scheduler;
|
||||
class Swapchain;
|
||||
|
||||
struct VKScreenInfo {
|
||||
struct ScreenInfo {
|
||||
VkImageView image_view{};
|
||||
u32 width{};
|
||||
u32 height{};
|
||||
bool is_srgb{};
|
||||
};
|
||||
|
||||
class VKBlitScreen {
|
||||
class BlitScreen {
|
||||
public:
|
||||
explicit VKBlitScreen(Core::Memory::Memory& cpu_memory,
|
||||
Core::Frontend::EmuWindow& render_window, const Device& device,
|
||||
MemoryAllocator& memory_manager, VKSwapchain& swapchain,
|
||||
VKScheduler& scheduler, const VKScreenInfo& screen_info);
|
||||
~VKBlitScreen();
|
||||
explicit BlitScreen(Core::Memory::Memory& cpu_memory, Core::Frontend::EmuWindow& render_window,
|
||||
const Device& device, MemoryAllocator& memory_manager, Swapchain& swapchain,
|
||||
Scheduler& scheduler, const ScreenInfo& screen_info);
|
||||
~BlitScreen();
|
||||
|
||||
void Recreate();
|
||||
|
||||
@@ -108,10 +107,10 @@ private:
|
||||
Core::Frontend::EmuWindow& render_window;
|
||||
const Device& device;
|
||||
MemoryAllocator& memory_allocator;
|
||||
VKSwapchain& swapchain;
|
||||
VKScheduler& scheduler;
|
||||
Swapchain& swapchain;
|
||||
Scheduler& scheduler;
|
||||
const std::size_t image_count;
|
||||
const VKScreenInfo& screen_info;
|
||||
const ScreenInfo& screen_info;
|
||||
|
||||
vk::ShaderModule vertex_shader;
|
||||
vk::ShaderModule fxaa_vertex_shader;
|
||||
|
@@ -124,8 +124,8 @@ VkBufferView Buffer::View(u32 offset, u32 size, VideoCore::Surface::PixelFormat
|
||||
}
|
||||
|
||||
BufferCacheRuntime::BufferCacheRuntime(const Device& device_, MemoryAllocator& memory_allocator_,
|
||||
VKScheduler& scheduler_, StagingBufferPool& staging_pool_,
|
||||
VKUpdateDescriptorQueue& update_descriptor_queue_,
|
||||
Scheduler& scheduler_, StagingBufferPool& staging_pool_,
|
||||
UpdateDescriptorQueue& update_descriptor_queue_,
|
||||
DescriptorPool& descriptor_pool)
|
||||
: device{device_}, memory_allocator{memory_allocator_}, scheduler{scheduler_},
|
||||
staging_pool{staging_pool_}, update_descriptor_queue{update_descriptor_queue_},
|
||||
|
@@ -16,7 +16,7 @@ namespace Vulkan {
|
||||
|
||||
class Device;
|
||||
class DescriptorPool;
|
||||
class VKScheduler;
|
||||
class Scheduler;
|
||||
|
||||
class BufferCacheRuntime;
|
||||
|
||||
@@ -58,8 +58,8 @@ class BufferCacheRuntime {
|
||||
|
||||
public:
|
||||
explicit BufferCacheRuntime(const Device& device_, MemoryAllocator& memory_manager_,
|
||||
VKScheduler& scheduler_, StagingBufferPool& staging_pool_,
|
||||
VKUpdateDescriptorQueue& update_descriptor_queue_,
|
||||
Scheduler& scheduler_, StagingBufferPool& staging_pool_,
|
||||
UpdateDescriptorQueue& update_descriptor_queue_,
|
||||
DescriptorPool& descriptor_pool);
|
||||
|
||||
void Finish();
|
||||
@@ -124,9 +124,9 @@ private:
|
||||
|
||||
const Device& device;
|
||||
MemoryAllocator& memory_allocator;
|
||||
VKScheduler& scheduler;
|
||||
Scheduler& scheduler;
|
||||
StagingBufferPool& staging_pool;
|
||||
VKUpdateDescriptorQueue& update_descriptor_queue;
|
||||
UpdateDescriptorQueue& update_descriptor_queue;
|
||||
|
||||
vk::Buffer quad_array_lut;
|
||||
MemoryCommit quad_array_lut_commit;
|
||||
|
@@ -200,9 +200,9 @@ ComputePass::ComputePass(const Device& device_, DescriptorPool& descriptor_pool,
|
||||
|
||||
ComputePass::~ComputePass() = default;
|
||||
|
||||
Uint8Pass::Uint8Pass(const Device& device_, VKScheduler& scheduler_,
|
||||
DescriptorPool& descriptor_pool, StagingBufferPool& staging_buffer_pool_,
|
||||
VKUpdateDescriptorQueue& update_descriptor_queue_)
|
||||
Uint8Pass::Uint8Pass(const Device& device_, Scheduler& scheduler_, DescriptorPool& descriptor_pool,
|
||||
StagingBufferPool& staging_buffer_pool_,
|
||||
UpdateDescriptorQueue& update_descriptor_queue_)
|
||||
: ComputePass(device_, descriptor_pool, INPUT_OUTPUT_DESCRIPTOR_SET_BINDINGS,
|
||||
INPUT_OUTPUT_DESCRIPTOR_UPDATE_TEMPLATE, INPUT_OUTPUT_BANK_INFO, {},
|
||||
VULKAN_UINT8_COMP_SPV),
|
||||
@@ -241,10 +241,10 @@ std::pair<VkBuffer, VkDeviceSize> Uint8Pass::Assemble(u32 num_vertices, VkBuffer
|
||||
return {staging.buffer, staging.offset};
|
||||
}
|
||||
|
||||
QuadIndexedPass::QuadIndexedPass(const Device& device_, VKScheduler& scheduler_,
|
||||
QuadIndexedPass::QuadIndexedPass(const Device& device_, Scheduler& scheduler_,
|
||||
DescriptorPool& descriptor_pool_,
|
||||
StagingBufferPool& staging_buffer_pool_,
|
||||
VKUpdateDescriptorQueue& update_descriptor_queue_)
|
||||
UpdateDescriptorQueue& update_descriptor_queue_)
|
||||
: ComputePass(device_, descriptor_pool_, INPUT_OUTPUT_DESCRIPTOR_SET_BINDINGS,
|
||||
INPUT_OUTPUT_DESCRIPTOR_UPDATE_TEMPLATE, INPUT_OUTPUT_BANK_INFO,
|
||||
COMPUTE_PUSH_CONSTANT_RANGE<sizeof(u32) * 2>, VULKAN_QUAD_INDEXED_COMP_SPV),
|
||||
@@ -303,10 +303,10 @@ std::pair<VkBuffer, VkDeviceSize> QuadIndexedPass::Assemble(
|
||||
return {staging.buffer, staging.offset};
|
||||
}
|
||||
|
||||
ASTCDecoderPass::ASTCDecoderPass(const Device& device_, VKScheduler& scheduler_,
|
||||
ASTCDecoderPass::ASTCDecoderPass(const Device& device_, Scheduler& scheduler_,
|
||||
DescriptorPool& descriptor_pool_,
|
||||
StagingBufferPool& staging_buffer_pool_,
|
||||
VKUpdateDescriptorQueue& update_descriptor_queue_,
|
||||
UpdateDescriptorQueue& update_descriptor_queue_,
|
||||
MemoryAllocator& memory_allocator_)
|
||||
: ComputePass(device_, descriptor_pool_, ASTC_DESCRIPTOR_SET_BINDINGS,
|
||||
ASTC_PASS_DESCRIPTOR_UPDATE_TEMPLATE_ENTRY, ASTC_BANK_INFO,
|
||||
|
@@ -20,8 +20,8 @@ namespace Vulkan {
|
||||
|
||||
class Device;
|
||||
class StagingBufferPool;
|
||||
class VKScheduler;
|
||||
class VKUpdateDescriptorQueue;
|
||||
class Scheduler;
|
||||
class UpdateDescriptorQueue;
|
||||
class Image;
|
||||
struct StagingBufferRef;
|
||||
|
||||
@@ -48,9 +48,9 @@ private:
|
||||
|
||||
class Uint8Pass final : public ComputePass {
|
||||
public:
|
||||
explicit Uint8Pass(const Device& device_, VKScheduler& scheduler_,
|
||||
explicit Uint8Pass(const Device& device_, Scheduler& scheduler_,
|
||||
DescriptorPool& descriptor_pool_, StagingBufferPool& staging_buffer_pool_,
|
||||
VKUpdateDescriptorQueue& update_descriptor_queue_);
|
||||
UpdateDescriptorQueue& update_descriptor_queue_);
|
||||
~Uint8Pass();
|
||||
|
||||
/// Assemble uint8 indices into an uint16 index buffer
|
||||
@@ -59,17 +59,17 @@ public:
|
||||
u32 src_offset);
|
||||
|
||||
private:
|
||||
VKScheduler& scheduler;
|
||||
Scheduler& scheduler;
|
||||
StagingBufferPool& staging_buffer_pool;
|
||||
VKUpdateDescriptorQueue& update_descriptor_queue;
|
||||
UpdateDescriptorQueue& update_descriptor_queue;
|
||||
};
|
||||
|
||||
class QuadIndexedPass final : public ComputePass {
|
||||
public:
|
||||
explicit QuadIndexedPass(const Device& device_, VKScheduler& scheduler_,
|
||||
explicit QuadIndexedPass(const Device& device_, Scheduler& scheduler_,
|
||||
DescriptorPool& descriptor_pool_,
|
||||
StagingBufferPool& staging_buffer_pool_,
|
||||
VKUpdateDescriptorQueue& update_descriptor_queue_);
|
||||
UpdateDescriptorQueue& update_descriptor_queue_);
|
||||
~QuadIndexedPass();
|
||||
|
||||
std::pair<VkBuffer, VkDeviceSize> Assemble(
|
||||
@@ -77,17 +77,17 @@ public:
|
||||
u32 base_vertex, VkBuffer src_buffer, u32 src_offset);
|
||||
|
||||
private:
|
||||
VKScheduler& scheduler;
|
||||
Scheduler& scheduler;
|
||||
StagingBufferPool& staging_buffer_pool;
|
||||
VKUpdateDescriptorQueue& update_descriptor_queue;
|
||||
UpdateDescriptorQueue& update_descriptor_queue;
|
||||
};
|
||||
|
||||
class ASTCDecoderPass final : public ComputePass {
|
||||
public:
|
||||
explicit ASTCDecoderPass(const Device& device_, VKScheduler& scheduler_,
|
||||
explicit ASTCDecoderPass(const Device& device_, Scheduler& scheduler_,
|
||||
DescriptorPool& descriptor_pool_,
|
||||
StagingBufferPool& staging_buffer_pool_,
|
||||
VKUpdateDescriptorQueue& update_descriptor_queue_,
|
||||
UpdateDescriptorQueue& update_descriptor_queue_,
|
||||
MemoryAllocator& memory_allocator_);
|
||||
~ASTCDecoderPass();
|
||||
|
||||
@@ -95,9 +95,9 @@ public:
|
||||
std::span<const VideoCommon::SwizzleParameters> swizzles);
|
||||
|
||||
private:
|
||||
VKScheduler& scheduler;
|
||||
Scheduler& scheduler;
|
||||
StagingBufferPool& staging_buffer_pool;
|
||||
VKUpdateDescriptorQueue& update_descriptor_queue;
|
||||
UpdateDescriptorQueue& update_descriptor_queue;
|
||||
MemoryAllocator& memory_allocator;
|
||||
};
|
||||
|
||||
|
@@ -25,7 +25,7 @@ using Shader::Backend::SPIRV::RESCALING_LAYOUT_WORDS_OFFSET;
|
||||
using Tegra::Texture::TexturePair;
|
||||
|
||||
ComputePipeline::ComputePipeline(const Device& device_, DescriptorPool& descriptor_pool,
|
||||
VKUpdateDescriptorQueue& update_descriptor_queue_,
|
||||
UpdateDescriptorQueue& update_descriptor_queue_,
|
||||
Common::ThreadWorker* thread_worker,
|
||||
PipelineStatistics* pipeline_statistics,
|
||||
VideoCore::ShaderNotify* shader_notify, const Shader::Info& info_,
|
||||
@@ -91,7 +91,7 @@ ComputePipeline::ComputePipeline(const Device& device_, DescriptorPool& descript
|
||||
}
|
||||
|
||||
void ComputePipeline::Configure(Tegra::Engines::KeplerCompute& kepler_compute,
|
||||
Tegra::MemoryManager& gpu_memory, VKScheduler& scheduler,
|
||||
Tegra::MemoryManager& gpu_memory, Scheduler& scheduler,
|
||||
BufferCache& buffer_cache, TextureCache& texture_cache) {
|
||||
update_descriptor_queue.Acquire();
|
||||
|
||||
|
@@ -24,12 +24,12 @@ namespace Vulkan {
|
||||
|
||||
class Device;
|
||||
class PipelineStatistics;
|
||||
class VKScheduler;
|
||||
class Scheduler;
|
||||
|
||||
class ComputePipeline {
|
||||
public:
|
||||
explicit ComputePipeline(const Device& device, DescriptorPool& descriptor_pool,
|
||||
VKUpdateDescriptorQueue& update_descriptor_queue,
|
||||
UpdateDescriptorQueue& update_descriptor_queue,
|
||||
Common::ThreadWorker* thread_worker,
|
||||
PipelineStatistics* pipeline_statistics,
|
||||
VideoCore::ShaderNotify* shader_notify, const Shader::Info& info,
|
||||
@@ -42,11 +42,11 @@ public:
|
||||
ComputePipeline(const ComputePipeline&) = delete;
|
||||
|
||||
void Configure(Tegra::Engines::KeplerCompute& kepler_compute, Tegra::MemoryManager& gpu_memory,
|
||||
VKScheduler& scheduler, BufferCache& buffer_cache, TextureCache& texture_cache);
|
||||
Scheduler& scheduler, BufferCache& buffer_cache, TextureCache& texture_cache);
|
||||
|
||||
private:
|
||||
const Device& device;
|
||||
VKUpdateDescriptorQueue& update_descriptor_queue;
|
||||
UpdateDescriptorQueue& update_descriptor_queue;
|
||||
Shader::Info info;
|
||||
|
||||
VideoCommon::ComputeUniformBufferSizes uniform_buffer_sizes{};
|
||||
|
@@ -121,7 +121,7 @@ vk::DescriptorSets DescriptorAllocator::AllocateDescriptors(size_t count) {
|
||||
throw vk::Exception(VK_ERROR_OUT_OF_POOL_MEMORY);
|
||||
}
|
||||
|
||||
DescriptorPool::DescriptorPool(const Device& device_, VKScheduler& scheduler)
|
||||
DescriptorPool::DescriptorPool(const Device& device_, Scheduler& scheduler)
|
||||
: device{device_}, master_semaphore{scheduler.GetMasterSemaphore()} {}
|
||||
|
||||
DescriptorPool::~DescriptorPool() = default;
|
||||
|
@@ -14,7 +14,7 @@
|
||||
namespace Vulkan {
|
||||
|
||||
class Device;
|
||||
class VKScheduler;
|
||||
class Scheduler;
|
||||
|
||||
struct DescriptorBank;
|
||||
|
||||
@@ -62,7 +62,7 @@ private:
|
||||
|
||||
class DescriptorPool {
|
||||
public:
|
||||
explicit DescriptorPool(const Device& device, VKScheduler& scheduler);
|
||||
explicit DescriptorPool(const Device& device, Scheduler& scheduler);
|
||||
~DescriptorPool();
|
||||
|
||||
DescriptorPool& operator=(const DescriptorPool&) = delete;
|
||||
|
@@ -11,7 +11,7 @@
|
||||
|
||||
namespace Vulkan {
|
||||
|
||||
InnerFence::InnerFence(VKScheduler& scheduler_, bool is_stubbed_)
|
||||
InnerFence::InnerFence(Scheduler& scheduler_, bool is_stubbed_)
|
||||
: FenceBase{is_stubbed_}, scheduler{scheduler_} {}
|
||||
|
||||
InnerFence::~InnerFence() = default;
|
||||
@@ -39,26 +39,25 @@ void InnerFence::Wait() {
|
||||
scheduler.Wait(wait_tick);
|
||||
}
|
||||
|
||||
VKFenceManager::VKFenceManager(VideoCore::RasterizerInterface& rasterizer_, Tegra::GPU& gpu_,
|
||||
TextureCache& texture_cache_, BufferCache& buffer_cache_,
|
||||
VKQueryCache& query_cache_, const Device& device_,
|
||||
VKScheduler& scheduler_)
|
||||
FenceManager::FenceManager(VideoCore::RasterizerInterface& rasterizer_, Tegra::GPU& gpu_,
|
||||
TextureCache& texture_cache_, BufferCache& buffer_cache_,
|
||||
QueryCache& query_cache_, const Device& device_, Scheduler& scheduler_)
|
||||
: GenericFenceManager{rasterizer_, gpu_, texture_cache_, buffer_cache_, query_cache_},
|
||||
scheduler{scheduler_} {}
|
||||
|
||||
Fence VKFenceManager::CreateFence(bool is_stubbed) {
|
||||
Fence FenceManager::CreateFence(bool is_stubbed) {
|
||||
return std::make_shared<InnerFence>(scheduler, is_stubbed);
|
||||
}
|
||||
|
||||
void VKFenceManager::QueueFence(Fence& fence) {
|
||||
void FenceManager::QueueFence(Fence& fence) {
|
||||
fence->Queue();
|
||||
}
|
||||
|
||||
bool VKFenceManager::IsFenceSignaled(Fence& fence) const {
|
||||
bool FenceManager::IsFenceSignaled(Fence& fence) const {
|
||||
return fence->IsSignaled();
|
||||
}
|
||||
|
||||
void VKFenceManager::WaitFence(Fence& fence) {
|
||||
void FenceManager::WaitFence(Fence& fence) {
|
||||
fence->Wait();
|
||||
}
|
||||
|
||||
|
@@ -20,12 +20,12 @@ class RasterizerInterface;
|
||||
namespace Vulkan {
|
||||
|
||||
class Device;
|
||||
class VKQueryCache;
|
||||
class VKScheduler;
|
||||
class QueryCache;
|
||||
class Scheduler;
|
||||
|
||||
class InnerFence : public VideoCommon::FenceBase {
|
||||
public:
|
||||
explicit InnerFence(VKScheduler& scheduler_, bool is_stubbed_);
|
||||
explicit InnerFence(Scheduler& scheduler_, bool is_stubbed_);
|
||||
~InnerFence();
|
||||
|
||||
void Queue();
|
||||
@@ -35,20 +35,18 @@ public:
|
||||
void Wait();
|
||||
|
||||
private:
|
||||
VKScheduler& scheduler;
|
||||
Scheduler& scheduler;
|
||||
u64 wait_tick = 0;
|
||||
};
|
||||
using Fence = std::shared_ptr<InnerFence>;
|
||||
|
||||
using GenericFenceManager =
|
||||
VideoCommon::FenceManager<Fence, TextureCache, BufferCache, VKQueryCache>;
|
||||
using GenericFenceManager = VideoCommon::FenceManager<Fence, TextureCache, BufferCache, QueryCache>;
|
||||
|
||||
class VKFenceManager final : public GenericFenceManager {
|
||||
class FenceManager final : public GenericFenceManager {
|
||||
public:
|
||||
explicit VKFenceManager(VideoCore::RasterizerInterface& rasterizer, Tegra::GPU& gpu,
|
||||
TextureCache& texture_cache, BufferCache& buffer_cache,
|
||||
VKQueryCache& query_cache, const Device& device,
|
||||
VKScheduler& scheduler);
|
||||
explicit FenceManager(VideoCore::RasterizerInterface& rasterizer, Tegra::GPU& gpu,
|
||||
TextureCache& texture_cache, BufferCache& buffer_cache,
|
||||
QueryCache& query_cache, const Device& device, Scheduler& scheduler);
|
||||
|
||||
protected:
|
||||
Fence CreateFence(bool is_stubbed) override;
|
||||
@@ -57,7 +55,7 @@ protected:
|
||||
void WaitFence(Fence& fence) override;
|
||||
|
||||
private:
|
||||
VKScheduler& scheduler;
|
||||
Scheduler& scheduler;
|
||||
};
|
||||
|
||||
} // namespace Vulkan
|
||||
|
@@ -172,7 +172,7 @@ FSR::FSR(const Device& device_, MemoryAllocator& memory_allocator_, size_t image
|
||||
CreatePipeline();
|
||||
}
|
||||
|
||||
VkImageView FSR::Draw(VKScheduler& scheduler, size_t image_index, VkImageView image_view,
|
||||
VkImageView FSR::Draw(Scheduler& scheduler, size_t image_index, VkImageView image_view,
|
||||
VkExtent2D input_image_extent, const Common::Rectangle<int>& crop_rect) {
|
||||
|
||||
UpdateDescriptorSet(image_index, image_view);
|
||||
|
@@ -10,13 +10,13 @@
|
||||
namespace Vulkan {
|
||||
|
||||
class Device;
|
||||
class VKScheduler;
|
||||
class Scheduler;
|
||||
|
||||
class FSR {
|
||||
public:
|
||||
explicit FSR(const Device& device, MemoryAllocator& memory_allocator, size_t image_count,
|
||||
VkExtent2D output_size);
|
||||
VkImageView Draw(VKScheduler& scheduler, size_t image_index, VkImageView image_view,
|
||||
VkImageView Draw(Scheduler& scheduler, size_t image_index, VkImageView image_view,
|
||||
VkExtent2D input_image_extent, const Common::Rectangle<int>& crop_rect);
|
||||
|
||||
private:
|
||||
|
@@ -215,9 +215,9 @@ ConfigureFuncPtr ConfigureFunc(const std::array<vk::ShaderModule, NUM_STAGES>& m
|
||||
} // Anonymous namespace
|
||||
|
||||
GraphicsPipeline::GraphicsPipeline(
|
||||
VKScheduler& scheduler_, BufferCache& buffer_cache_, TextureCache& texture_cache_,
|
||||
Scheduler& scheduler_, BufferCache& buffer_cache_, TextureCache& texture_cache_,
|
||||
VideoCore::ShaderNotify* shader_notify, const Device& device_, DescriptorPool& descriptor_pool,
|
||||
VKUpdateDescriptorQueue& update_descriptor_queue_, Common::ThreadWorker* worker_thread,
|
||||
UpdateDescriptorQueue& update_descriptor_queue_, Common::ThreadWorker* worker_thread,
|
||||
PipelineStatistics* pipeline_statistics, RenderPassCache& render_pass_cache,
|
||||
const GraphicsPipelineCacheKey& key_, std::array<vk::ShaderModule, NUM_STAGES> stages,
|
||||
const std::array<const Shader::Info*, NUM_STAGES>& infos)
|
||||
|
@@ -62,17 +62,17 @@ class Device;
|
||||
class PipelineStatistics;
|
||||
class RenderPassCache;
|
||||
class RescalingPushConstant;
|
||||
class VKScheduler;
|
||||
class VKUpdateDescriptorQueue;
|
||||
class Scheduler;
|
||||
class UpdateDescriptorQueue;
|
||||
|
||||
class GraphicsPipeline {
|
||||
static constexpr size_t NUM_STAGES = Tegra::Engines::Maxwell3D::Regs::MaxShaderStage;
|
||||
|
||||
public:
|
||||
explicit GraphicsPipeline(VKScheduler& scheduler, BufferCache& buffer_cache,
|
||||
explicit GraphicsPipeline(Scheduler& scheduler, BufferCache& buffer_cache,
|
||||
TextureCache& texture_cache, VideoCore::ShaderNotify* shader_notify,
|
||||
const Device& device, DescriptorPool& descriptor_pool,
|
||||
VKUpdateDescriptorQueue& update_descriptor_queue,
|
||||
UpdateDescriptorQueue& update_descriptor_queue,
|
||||
Common::ThreadWorker* worker_thread,
|
||||
PipelineStatistics* pipeline_statistics,
|
||||
RenderPassCache& render_pass_cache,
|
||||
@@ -131,8 +131,8 @@ private:
|
||||
const Device& device;
|
||||
TextureCache& texture_cache;
|
||||
BufferCache& buffer_cache;
|
||||
VKScheduler& scheduler;
|
||||
VKUpdateDescriptorQueue& update_descriptor_queue;
|
||||
Scheduler& scheduler;
|
||||
UpdateDescriptorQueue& update_descriptor_queue;
|
||||
|
||||
void (*configure_func)(GraphicsPipeline*, bool){};
|
||||
|
||||
|
@@ -260,8 +260,8 @@ bool GraphicsPipelineCacheKey::operator==(const GraphicsPipelineCacheKey& rhs) c
|
||||
}
|
||||
|
||||
PipelineCache::PipelineCache(RasterizerVulkan& rasterizer_, const Device& device_,
|
||||
VKScheduler& scheduler_, DescriptorPool& descriptor_pool_,
|
||||
VKUpdateDescriptorQueue& update_descriptor_queue_,
|
||||
Scheduler& scheduler_, DescriptorPool& descriptor_pool_,
|
||||
UpdateDescriptorQueue& update_descriptor_queue_,
|
||||
RenderPassCache& render_pass_cache_, BufferCache& buffer_cache_,
|
||||
TextureCache& texture_cache_, VideoCore::ShaderNotify& shader_notify_)
|
||||
: VideoCommon::ShaderCache{rasterizer_}, device{device_}, scheduler{scheduler_},
|
||||
|
@@ -81,8 +81,8 @@ class Device;
|
||||
class PipelineStatistics;
|
||||
class RasterizerVulkan;
|
||||
class RenderPassCache;
|
||||
class VKScheduler;
|
||||
class VKUpdateDescriptorQueue;
|
||||
class Scheduler;
|
||||
class UpdateDescriptorQueue;
|
||||
|
||||
using VideoCommon::ShaderInfo;
|
||||
|
||||
@@ -100,9 +100,9 @@ struct ShaderPools {
|
||||
|
||||
class PipelineCache : public VideoCommon::ShaderCache {
|
||||
public:
|
||||
explicit PipelineCache(RasterizerVulkan& rasterizer, const Device& device,
|
||||
VKScheduler& scheduler, DescriptorPool& descriptor_pool,
|
||||
VKUpdateDescriptorQueue& update_descriptor_queue,
|
||||
explicit PipelineCache(RasterizerVulkan& rasterizer, const Device& device, Scheduler& scheduler,
|
||||
DescriptorPool& descriptor_pool,
|
||||
UpdateDescriptorQueue& update_descriptor_queue,
|
||||
RenderPassCache& render_pass_cache, BufferCache& buffer_cache,
|
||||
TextureCache& texture_cache, VideoCore::ShaderNotify& shader_notify_);
|
||||
~PipelineCache();
|
||||
@@ -136,9 +136,9 @@ private:
|
||||
bool build_in_parallel);
|
||||
|
||||
const Device& device;
|
||||
VKScheduler& scheduler;
|
||||
Scheduler& scheduler;
|
||||
DescriptorPool& descriptor_pool;
|
||||
VKUpdateDescriptorQueue& update_descriptor_queue;
|
||||
UpdateDescriptorQueue& update_descriptor_queue;
|
||||
RenderPassCache& render_pass_cache;
|
||||
BufferCache& buffer_cache;
|
||||
TextureCache& texture_cache;
|
||||
|
@@ -26,7 +26,7 @@ constexpr VkQueryType GetTarget(QueryType type) {
|
||||
|
||||
} // Anonymous namespace
|
||||
|
||||
QueryPool::QueryPool(const Device& device_, VKScheduler& scheduler, QueryType type_)
|
||||
QueryPool::QueryPool(const Device& device_, Scheduler& scheduler, QueryType type_)
|
||||
: ResourcePool{scheduler.GetMasterSemaphore(), GROW_STEP}, device{device_}, type{type_} {}
|
||||
|
||||
QueryPool::~QueryPool() = default;
|
||||
@@ -65,14 +65,14 @@ void QueryPool::Reserve(std::pair<VkQueryPool, u32> query) {
|
||||
usage[pool_index * GROW_STEP + static_cast<std::ptrdiff_t>(query.second)] = false;
|
||||
}
|
||||
|
||||
VKQueryCache::VKQueryCache(VideoCore::RasterizerInterface& rasterizer_, const Device& device_,
|
||||
VKScheduler& scheduler_)
|
||||
QueryCache::QueryCache(VideoCore::RasterizerInterface& rasterizer_, const Device& device_,
|
||||
Scheduler& scheduler_)
|
||||
: QueryCacheBase{rasterizer_}, device{device_}, scheduler{scheduler_},
|
||||
query_pools{
|
||||
QueryPool{device_, scheduler_, QueryType::SamplesPassed},
|
||||
} {}
|
||||
|
||||
VKQueryCache::~VKQueryCache() {
|
||||
QueryCache::~QueryCache() {
|
||||
// TODO(Rodrigo): This is a hack to destroy all HostCounter instances before the base class
|
||||
// destructor is called. The query cache should be redesigned to have a proper ownership model
|
||||
// instead of using shared pointers.
|
||||
@@ -83,15 +83,15 @@ VKQueryCache::~VKQueryCache() {
|
||||
}
|
||||
}
|
||||
|
||||
std::pair<VkQueryPool, u32> VKQueryCache::AllocateQuery(QueryType type) {
|
||||
std::pair<VkQueryPool, u32> QueryCache::AllocateQuery(QueryType type) {
|
||||
return query_pools[static_cast<std::size_t>(type)].Commit();
|
||||
}
|
||||
|
||||
void VKQueryCache::Reserve(QueryType type, std::pair<VkQueryPool, u32> query) {
|
||||
void QueryCache::Reserve(QueryType type, std::pair<VkQueryPool, u32> query) {
|
||||
query_pools[static_cast<std::size_t>(type)].Reserve(query);
|
||||
}
|
||||
|
||||
HostCounter::HostCounter(VKQueryCache& cache_, std::shared_ptr<HostCounter> dependency_,
|
||||
HostCounter::HostCounter(QueryCache& cache_, std::shared_ptr<HostCounter> dependency_,
|
||||
QueryType type_)
|
||||
: HostCounterBase{std::move(dependency_)}, cache{cache_}, type{type_},
|
||||
query{cache_.AllocateQuery(type_)}, tick{cache_.GetScheduler().CurrentTick()} {
|
||||
|
@@ -22,14 +22,14 @@ namespace Vulkan {
|
||||
class CachedQuery;
|
||||
class Device;
|
||||
class HostCounter;
|
||||
class VKQueryCache;
|
||||
class VKScheduler;
|
||||
class QueryCache;
|
||||
class Scheduler;
|
||||
|
||||
using CounterStream = VideoCommon::CounterStreamBase<VKQueryCache, HostCounter>;
|
||||
using CounterStream = VideoCommon::CounterStreamBase<QueryCache, HostCounter>;
|
||||
|
||||
class QueryPool final : public ResourcePool {
|
||||
public:
|
||||
explicit QueryPool(const Device& device, VKScheduler& scheduler, VideoCore::QueryType type);
|
||||
explicit QueryPool(const Device& device, Scheduler& scheduler, VideoCore::QueryType type);
|
||||
~QueryPool() override;
|
||||
|
||||
std::pair<VkQueryPool, u32> Commit();
|
||||
@@ -49,12 +49,12 @@ private:
|
||||
std::vector<bool> usage;
|
||||
};
|
||||
|
||||
class VKQueryCache final
|
||||
: public VideoCommon::QueryCacheBase<VKQueryCache, CachedQuery, CounterStream, HostCounter> {
|
||||
class QueryCache final
|
||||
: public VideoCommon::QueryCacheBase<QueryCache, CachedQuery, CounterStream, HostCounter> {
|
||||
public:
|
||||
explicit VKQueryCache(VideoCore::RasterizerInterface& rasterizer_, const Device& device_,
|
||||
VKScheduler& scheduler_);
|
||||
~VKQueryCache();
|
||||
explicit QueryCache(VideoCore::RasterizerInterface& rasterizer_, const Device& device_,
|
||||
Scheduler& scheduler_);
|
||||
~QueryCache();
|
||||
|
||||
std::pair<VkQueryPool, u32> AllocateQuery(VideoCore::QueryType type);
|
||||
|
||||
@@ -64,19 +64,19 @@ public:
|
||||
return device;
|
||||
}
|
||||
|
||||
VKScheduler& GetScheduler() const noexcept {
|
||||
Scheduler& GetScheduler() const noexcept {
|
||||
return scheduler;
|
||||
}
|
||||
|
||||
private:
|
||||
const Device& device;
|
||||
VKScheduler& scheduler;
|
||||
Scheduler& scheduler;
|
||||
std::array<QueryPool, VideoCore::NumQueryTypes> query_pools;
|
||||
};
|
||||
|
||||
class HostCounter final : public VideoCommon::HostCounterBase<VKQueryCache, HostCounter> {
|
||||
class HostCounter final : public VideoCommon::HostCounterBase<QueryCache, HostCounter> {
|
||||
public:
|
||||
explicit HostCounter(VKQueryCache& cache_, std::shared_ptr<HostCounter> dependency_,
|
||||
explicit HostCounter(QueryCache& cache_, std::shared_ptr<HostCounter> dependency_,
|
||||
VideoCore::QueryType type_);
|
||||
~HostCounter();
|
||||
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
private:
|
||||
u64 BlockingQuery() const override;
|
||||
|
||||
VKQueryCache& cache;
|
||||
QueryCache& cache;
|
||||
const VideoCore::QueryType type;
|
||||
const std::pair<VkQueryPool, u32> query;
|
||||
const u64 tick;
|
||||
@@ -93,7 +93,7 @@ private:
|
||||
|
||||
class CachedQuery : public VideoCommon::CachedQueryBase<HostCounter> {
|
||||
public:
|
||||
explicit CachedQuery(VKQueryCache&, VideoCore::QueryType, VAddr cpu_addr_, u8* host_ptr_)
|
||||
explicit CachedQuery(QueryCache&, VideoCore::QueryType, VAddr cpu_addr_, u8* host_ptr_)
|
||||
: CachedQueryBase{cpu_addr_, host_ptr_} {}
|
||||
};
|
||||
|
||||
|
@@ -142,9 +142,9 @@ DrawParams MakeDrawParams(const Maxwell& regs, u32 num_instances, bool is_instan
|
||||
} // Anonymous namespace
|
||||
|
||||
RasterizerVulkan::RasterizerVulkan(Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_,
|
||||
Core::Memory::Memory& cpu_memory_, VKScreenInfo& screen_info_,
|
||||
Core::Memory::Memory& cpu_memory_, ScreenInfo& screen_info_,
|
||||
const Device& device_, MemoryAllocator& memory_allocator_,
|
||||
StateTracker& state_tracker_, VKScheduler& scheduler_)
|
||||
StateTracker& state_tracker_, Scheduler& scheduler_)
|
||||
: RasterizerAccelerated{cpu_memory_}, gpu{gpu_}, screen_info{screen_info_}, device{device_},
|
||||
memory_allocator{memory_allocator_}, state_tracker{state_tracker_}, scheduler{scheduler_},
|
||||
staging_pool(device, memory_allocator, scheduler), descriptor_pool(device, scheduler),
|
||||
|
@@ -39,7 +39,7 @@ class Maxwell3D;
|
||||
|
||||
namespace Vulkan {
|
||||
|
||||
struct VKScreenInfo;
|
||||
struct ScreenInfo;
|
||||
|
||||
class StateTracker;
|
||||
|
||||
@@ -59,9 +59,9 @@ class RasterizerVulkan final : public VideoCore::RasterizerAccelerated,
|
||||
protected VideoCommon::ChannelSetupCaches<VideoCommon::ChannelInfo> {
|
||||
public:
|
||||
explicit RasterizerVulkan(Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_,
|
||||
Core::Memory::Memory& cpu_memory_, VKScreenInfo& screen_info_,
|
||||
Core::Memory::Memory& cpu_memory_, ScreenInfo& screen_info_,
|
||||
const Device& device_, MemoryAllocator& memory_allocator_,
|
||||
StateTracker& state_tracker_, VKScheduler& scheduler_);
|
||||
StateTracker& state_tracker_, Scheduler& scheduler_);
|
||||
~RasterizerVulkan() override;
|
||||
|
||||
void Draw(bool is_indexed, bool is_instanced) override;
|
||||
@@ -143,15 +143,15 @@ private:
|
||||
|
||||
Tegra::GPU& gpu;
|
||||
|
||||
VKScreenInfo& screen_info;
|
||||
ScreenInfo& screen_info;
|
||||
const Device& device;
|
||||
MemoryAllocator& memory_allocator;
|
||||
StateTracker& state_tracker;
|
||||
VKScheduler& scheduler;
|
||||
Scheduler& scheduler;
|
||||
|
||||
StagingBufferPool staging_pool;
|
||||
DescriptorPool descriptor_pool;
|
||||
VKUpdateDescriptorQueue update_descriptor_queue;
|
||||
UpdateDescriptorQueue update_descriptor_queue;
|
||||
BlitImageHelper blit_image;
|
||||
ASTCDecoderPass astc_decoder_pass;
|
||||
RenderPassCache render_pass_cache;
|
||||
@@ -161,9 +161,9 @@ private:
|
||||
BufferCacheRuntime buffer_cache_runtime;
|
||||
BufferCache buffer_cache;
|
||||
PipelineCache pipeline_cache;
|
||||
VKQueryCache query_cache;
|
||||
QueryCache query_cache;
|
||||
AccelerateDMA accelerate_dma;
|
||||
VKFenceManager fence_manager;
|
||||
FenceManager fence_manager;
|
||||
|
||||
vk::Event wfi_event;
|
||||
|
||||
|
@@ -21,7 +21,7 @@ namespace Vulkan {
|
||||
|
||||
MICROPROFILE_DECLARE(Vulkan_WaitForWorker);
|
||||
|
||||
void VKScheduler::CommandChunk::ExecuteAll(vk::CommandBuffer cmdbuf) {
|
||||
void Scheduler::CommandChunk::ExecuteAll(vk::CommandBuffer cmdbuf) {
|
||||
auto command = first;
|
||||
while (command != nullptr) {
|
||||
auto next = command->GetNext();
|
||||
@@ -35,7 +35,7 @@ void VKScheduler::CommandChunk::ExecuteAll(vk::CommandBuffer cmdbuf) {
|
||||
last = nullptr;
|
||||
}
|
||||
|
||||
VKScheduler::VKScheduler(const Device& device_, StateTracker& state_tracker_)
|
||||
Scheduler::Scheduler(const Device& device_, StateTracker& state_tracker_)
|
||||
: device{device_}, state_tracker{state_tracker_},
|
||||
master_semaphore{std::make_unique<MasterSemaphore>(device)},
|
||||
command_pool{std::make_unique<CommandPool>(*master_semaphore, device)} {
|
||||
@@ -44,14 +44,14 @@ VKScheduler::VKScheduler(const Device& device_, StateTracker& state_tracker_)
|
||||
worker_thread = std::jthread([this](std::stop_token token) { WorkerThread(token); });
|
||||
}
|
||||
|
||||
VKScheduler::~VKScheduler() = default;
|
||||
Scheduler::~Scheduler() = default;
|
||||
|
||||
void VKScheduler::Flush(VkSemaphore signal_semaphore, VkSemaphore wait_semaphore) {
|
||||
void Scheduler::Flush(VkSemaphore signal_semaphore, VkSemaphore wait_semaphore) {
|
||||
SubmitExecution(signal_semaphore, wait_semaphore);
|
||||
AllocateNewContext();
|
||||
}
|
||||
|
||||
void VKScheduler::Finish(VkSemaphore signal_semaphore, VkSemaphore wait_semaphore) {
|
||||
void Scheduler::Finish(VkSemaphore signal_semaphore, VkSemaphore wait_semaphore) {
|
||||
const u64 presubmit_tick = CurrentTick();
|
||||
SubmitExecution(signal_semaphore, wait_semaphore);
|
||||
WaitWorker();
|
||||
@@ -59,7 +59,7 @@ void VKScheduler::Finish(VkSemaphore signal_semaphore, VkSemaphore wait_semaphor
|
||||
AllocateNewContext();
|
||||
}
|
||||
|
||||
void VKScheduler::WaitWorker() {
|
||||
void Scheduler::WaitWorker() {
|
||||
MICROPROFILE_SCOPE(Vulkan_WaitForWorker);
|
||||
DispatchWork();
|
||||
|
||||
@@ -67,7 +67,7 @@ void VKScheduler::WaitWorker() {
|
||||
wait_cv.wait(lock, [this] { return work_queue.empty(); });
|
||||
}
|
||||
|
||||
void VKScheduler::DispatchWork() {
|
||||
void Scheduler::DispatchWork() {
|
||||
if (chunk->Empty()) {
|
||||
return;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ void VKScheduler::DispatchWork() {
|
||||
AcquireNewChunk();
|
||||
}
|
||||
|
||||
void VKScheduler::RequestRenderpass(const Framebuffer* framebuffer) {
|
||||
void Scheduler::RequestRenderpass(const Framebuffer* framebuffer) {
|
||||
const VkRenderPass renderpass = framebuffer->RenderPass();
|
||||
const VkFramebuffer framebuffer_handle = framebuffer->Handle();
|
||||
const VkExtent2D render_area = framebuffer->RenderArea();
|
||||
@@ -114,11 +114,11 @@ void VKScheduler::RequestRenderpass(const Framebuffer* framebuffer) {
|
||||
renderpass_image_ranges = framebuffer->ImageRanges();
|
||||
}
|
||||
|
||||
void VKScheduler::RequestOutsideRenderPassOperationContext() {
|
||||
void Scheduler::RequestOutsideRenderPassOperationContext() {
|
||||
EndRenderPass();
|
||||
}
|
||||
|
||||
bool VKScheduler::UpdateGraphicsPipeline(GraphicsPipeline* pipeline) {
|
||||
bool Scheduler::UpdateGraphicsPipeline(GraphicsPipeline* pipeline) {
|
||||
if (state.graphics_pipeline == pipeline) {
|
||||
return false;
|
||||
}
|
||||
@@ -126,7 +126,7 @@ bool VKScheduler::UpdateGraphicsPipeline(GraphicsPipeline* pipeline) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VKScheduler::UpdateRescaling(bool is_rescaling) {
|
||||
bool Scheduler::UpdateRescaling(bool is_rescaling) {
|
||||
if (state.rescaling_defined && is_rescaling == state.is_rescaling) {
|
||||
return false;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ bool VKScheduler::UpdateRescaling(bool is_rescaling) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void VKScheduler::WorkerThread(std::stop_token stop_token) {
|
||||
void Scheduler::WorkerThread(std::stop_token stop_token) {
|
||||
Common::SetCurrentThreadName("yuzu:VulkanWorker");
|
||||
do {
|
||||
std::unique_ptr<CommandChunk> work;
|
||||
@@ -161,7 +161,7 @@ void VKScheduler::WorkerThread(std::stop_token stop_token) {
|
||||
} while (!stop_token.stop_requested());
|
||||
}
|
||||
|
||||
void VKScheduler::AllocateWorkerCommandBuffer() {
|
||||
void Scheduler::AllocateWorkerCommandBuffer() {
|
||||
current_cmdbuf = vk::CommandBuffer(command_pool->Commit(), device.GetDispatchLoader());
|
||||
current_cmdbuf.Begin({
|
||||
.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,
|
||||
@@ -171,7 +171,7 @@ void VKScheduler::AllocateWorkerCommandBuffer() {
|
||||
});
|
||||
}
|
||||
|
||||
void VKScheduler::SubmitExecution(VkSemaphore signal_semaphore, VkSemaphore wait_semaphore) {
|
||||
void Scheduler::SubmitExecution(VkSemaphore signal_semaphore, VkSemaphore wait_semaphore) {
|
||||
EndPendingOperations();
|
||||
InvalidateState();
|
||||
|
||||
@@ -225,25 +225,25 @@ void VKScheduler::SubmitExecution(VkSemaphore signal_semaphore, VkSemaphore wait
|
||||
DispatchWork();
|
||||
}
|
||||
|
||||
void VKScheduler::AllocateNewContext() {
|
||||
void Scheduler::AllocateNewContext() {
|
||||
// Enable counters once again. These are disabled when a command buffer is finished.
|
||||
if (query_cache) {
|
||||
query_cache->UpdateCounters();
|
||||
}
|
||||
}
|
||||
|
||||
void VKScheduler::InvalidateState() {
|
||||
void Scheduler::InvalidateState() {
|
||||
state.graphics_pipeline = nullptr;
|
||||
state.rescaling_defined = false;
|
||||
state_tracker.InvalidateCommandBufferState();
|
||||
}
|
||||
|
||||
void VKScheduler::EndPendingOperations() {
|
||||
void Scheduler::EndPendingOperations() {
|
||||
query_cache->DisableStreams();
|
||||
EndRenderPass();
|
||||
}
|
||||
|
||||
void VKScheduler::EndRenderPass() {
|
||||
void Scheduler::EndRenderPass() {
|
||||
if (!state.renderpass) {
|
||||
return;
|
||||
}
|
||||
@@ -280,7 +280,7 @@ void VKScheduler::EndRenderPass() {
|
||||
num_renderpass_images = 0;
|
||||
}
|
||||
|
||||
void VKScheduler::AcquireNewChunk() {
|
||||
void Scheduler::AcquireNewChunk() {
|
||||
std::scoped_lock lock{reserve_mutex};
|
||||
if (chunk_reserve.empty()) {
|
||||
chunk = std::make_unique<CommandChunk>();
|
||||
|
@@ -22,14 +22,14 @@ class Device;
|
||||
class Framebuffer;
|
||||
class GraphicsPipeline;
|
||||
class StateTracker;
|
||||
class VKQueryCache;
|
||||
class QueryCache;
|
||||
|
||||
/// The scheduler abstracts command buffer and fence management with an interface that's able to do
|
||||
/// OpenGL-like operations on Vulkan command buffers.
|
||||
class VKScheduler {
|
||||
class Scheduler {
|
||||
public:
|
||||
explicit VKScheduler(const Device& device, StateTracker& state_tracker);
|
||||
~VKScheduler();
|
||||
explicit Scheduler(const Device& device, StateTracker& state_tracker);
|
||||
~Scheduler();
|
||||
|
||||
/// Sends the current execution context to the GPU.
|
||||
void Flush(VkSemaphore signal_semaphore = nullptr, VkSemaphore wait_semaphore = nullptr);
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
void InvalidateState();
|
||||
|
||||
/// Assigns the query cache.
|
||||
void SetQueryCache(VKQueryCache& query_cache_) {
|
||||
void SetQueryCache(QueryCache& query_cache_) {
|
||||
query_cache = &query_cache_;
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ private:
|
||||
std::unique_ptr<MasterSemaphore> master_semaphore;
|
||||
std::unique_ptr<CommandPool> command_pool;
|
||||
|
||||
VKQueryCache* query_cache = nullptr;
|
||||
QueryCache* query_cache = nullptr;
|
||||
|
||||
vk::CommandBuffer current_cmdbuf;
|
||||
|
||||
|
@@ -85,7 +85,7 @@ size_t Region(size_t iterator) noexcept {
|
||||
} // Anonymous namespace
|
||||
|
||||
StagingBufferPool::StagingBufferPool(const Device& device_, MemoryAllocator& memory_allocator_,
|
||||
VKScheduler& scheduler_)
|
||||
Scheduler& scheduler_)
|
||||
: device{device_}, memory_allocator{memory_allocator_}, scheduler{scheduler_} {
|
||||
const vk::Device& dev = device.GetLogical();
|
||||
stream_buffer = dev.CreateBuffer(VkBufferCreateInfo{
|
||||
|
@@ -14,7 +14,7 @@
|
||||
namespace Vulkan {
|
||||
|
||||
class Device;
|
||||
class VKScheduler;
|
||||
class Scheduler;
|
||||
|
||||
struct StagingBufferRef {
|
||||
VkBuffer buffer;
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
static constexpr size_t NUM_SYNCS = 16;
|
||||
|
||||
explicit StagingBufferPool(const Device& device, MemoryAllocator& memory_allocator,
|
||||
VKScheduler& scheduler);
|
||||
Scheduler& scheduler);
|
||||
~StagingBufferPool();
|
||||
|
||||
StagingBufferRef Request(size_t size, MemoryUsage usage);
|
||||
@@ -82,7 +82,7 @@ private:
|
||||
|
||||
const Device& device;
|
||||
MemoryAllocator& memory_allocator;
|
||||
VKScheduler& scheduler;
|
||||
Scheduler& scheduler;
|
||||
|
||||
vk::Buffer stream_buffer;
|
||||
vk::DeviceMemory stream_memory;
|
||||
|
@@ -65,15 +65,15 @@ VkExtent2D ChooseSwapExtent(const VkSurfaceCapabilitiesKHR& capabilities, u32 wi
|
||||
|
||||
} // Anonymous namespace
|
||||
|
||||
VKSwapchain::VKSwapchain(VkSurfaceKHR surface_, const Device& device_, VKScheduler& scheduler_,
|
||||
u32 width, u32 height, bool srgb)
|
||||
Swapchain::Swapchain(VkSurfaceKHR surface_, const Device& device_, Scheduler& scheduler_, u32 width,
|
||||
u32 height, bool srgb)
|
||||
: surface{surface_}, device{device_}, scheduler{scheduler_} {
|
||||
Create(width, height, srgb);
|
||||
}
|
||||
|
||||
VKSwapchain::~VKSwapchain() = default;
|
||||
Swapchain::~Swapchain() = default;
|
||||
|
||||
void VKSwapchain::Create(u32 width, u32 height, bool srgb) {
|
||||
void Swapchain::Create(u32 width, u32 height, bool srgb) {
|
||||
is_outdated = false;
|
||||
is_suboptimal = false;
|
||||
|
||||
@@ -94,7 +94,7 @@ void VKSwapchain::Create(u32 width, u32 height, bool srgb) {
|
||||
resource_ticks.resize(image_count);
|
||||
}
|
||||
|
||||
void VKSwapchain::AcquireNextImage() {
|
||||
void Swapchain::AcquireNextImage() {
|
||||
const VkResult result = device.GetLogical().AcquireNextImageKHR(
|
||||
*swapchain, std::numeric_limits<u64>::max(), *present_semaphores[frame_index],
|
||||
VK_NULL_HANDLE, &image_index);
|
||||
@@ -115,7 +115,7 @@ void VKSwapchain::AcquireNextImage() {
|
||||
resource_ticks[image_index] = scheduler.CurrentTick();
|
||||
}
|
||||
|
||||
void VKSwapchain::Present(VkSemaphore render_semaphore) {
|
||||
void Swapchain::Present(VkSemaphore render_semaphore) {
|
||||
const auto present_queue{device.GetPresentQueue()};
|
||||
const VkPresentInfoKHR present_info{
|
||||
.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR,
|
||||
@@ -146,8 +146,8 @@ void VKSwapchain::Present(VkSemaphore render_semaphore) {
|
||||
}
|
||||
}
|
||||
|
||||
void VKSwapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities, u32 width,
|
||||
u32 height, bool srgb) {
|
||||
void Swapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities, u32 width, u32 height,
|
||||
bool srgb) {
|
||||
const auto physical_device{device.GetPhysical()};
|
||||
const auto formats{physical_device.GetSurfaceFormatsKHR(surface)};
|
||||
const auto present_modes{physical_device.GetSurfacePresentModesKHR(surface)};
|
||||
@@ -221,13 +221,13 @@ void VKSwapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities,
|
||||
image_view_format = srgb ? VK_FORMAT_B8G8R8A8_SRGB : VK_FORMAT_B8G8R8A8_UNORM;
|
||||
}
|
||||
|
||||
void VKSwapchain::CreateSemaphores() {
|
||||
void Swapchain::CreateSemaphores() {
|
||||
present_semaphores.resize(image_count);
|
||||
std::ranges::generate(present_semaphores,
|
||||
[this] { return device.GetLogical().CreateSemaphore(); });
|
||||
}
|
||||
|
||||
void VKSwapchain::CreateImageViews() {
|
||||
void Swapchain::CreateImageViews() {
|
||||
VkImageViewCreateInfo ci{
|
||||
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
@@ -259,7 +259,7 @@ void VKSwapchain::CreateImageViews() {
|
||||
}
|
||||
}
|
||||
|
||||
void VKSwapchain::Destroy() {
|
||||
void Swapchain::Destroy() {
|
||||
frame_index = 0;
|
||||
present_semaphores.clear();
|
||||
framebuffers.clear();
|
||||
@@ -267,11 +267,11 @@ void VKSwapchain::Destroy() {
|
||||
swapchain.reset();
|
||||
}
|
||||
|
||||
bool VKSwapchain::HasFpsUnlockChanged() const {
|
||||
bool Swapchain::HasFpsUnlockChanged() const {
|
||||
return current_fps_unlocked != Settings::values.disable_fps_limit.GetValue();
|
||||
}
|
||||
|
||||
bool VKSwapchain::NeedsPresentModeUpdate() const {
|
||||
bool Swapchain::NeedsPresentModeUpdate() const {
|
||||
// Mailbox present mode is the ideal for all scenarios. If it is not available,
|
||||
// A different present mode is needed to support unlocked FPS above the monitor's refresh rate.
|
||||
return present_mode != VK_PRESENT_MODE_MAILBOX_KHR && HasFpsUnlockChanged();
|
||||
|
@@ -15,13 +15,13 @@ struct FramebufferLayout;
|
||||
namespace Vulkan {
|
||||
|
||||
class Device;
|
||||
class VKScheduler;
|
||||
class Scheduler;
|
||||
|
||||
class VKSwapchain {
|
||||
class Swapchain {
|
||||
public:
|
||||
explicit VKSwapchain(VkSurfaceKHR surface, const Device& device, VKScheduler& scheduler,
|
||||
u32 width, u32 height, bool srgb);
|
||||
~VKSwapchain();
|
||||
explicit Swapchain(VkSurfaceKHR surface, const Device& device, Scheduler& scheduler, u32 width,
|
||||
u32 height, bool srgb);
|
||||
~Swapchain();
|
||||
|
||||
/// Creates (or recreates) the swapchain with a given size.
|
||||
void Create(u32 width, u32 height, bool srgb);
|
||||
@@ -94,7 +94,7 @@ private:
|
||||
|
||||
const VkSurfaceKHR surface;
|
||||
const Device& device;
|
||||
VKScheduler& scheduler;
|
||||
Scheduler& scheduler;
|
||||
|
||||
vk::SwapchainKHR swapchain;
|
||||
|
||||
|
@@ -648,7 +648,7 @@ struct RangedBarrierRange {
|
||||
return VK_FORMAT_R32_UINT;
|
||||
}
|
||||
|
||||
void BlitScale(VKScheduler& scheduler, VkImage src_image, VkImage dst_image, const ImageInfo& info,
|
||||
void BlitScale(Scheduler& scheduler, VkImage src_image, VkImage dst_image, const ImageInfo& info,
|
||||
VkImageAspectFlags aspect_mask, const Settings::ResolutionScalingInfo& resolution,
|
||||
bool up_scaling = true) {
|
||||
const bool is_2d = info.type == ImageType::e2D;
|
||||
@@ -788,7 +788,7 @@ void BlitScale(VKScheduler& scheduler, VkImage src_image, VkImage dst_image, con
|
||||
}
|
||||
} // Anonymous namespace
|
||||
|
||||
TextureCacheRuntime::TextureCacheRuntime(const Device& device_, VKScheduler& scheduler_,
|
||||
TextureCacheRuntime::TextureCacheRuntime(const Device& device_, Scheduler& scheduler_,
|
||||
MemoryAllocator& memory_allocator_,
|
||||
StagingBufferPool& staging_buffer_pool_,
|
||||
BlitImageHelper& blit_image_helper_,
|
||||
|
@@ -33,11 +33,11 @@ class ImageView;
|
||||
class Framebuffer;
|
||||
class RenderPassCache;
|
||||
class StagingBufferPool;
|
||||
class VKScheduler;
|
||||
class Scheduler;
|
||||
|
||||
class TextureCacheRuntime {
|
||||
public:
|
||||
explicit TextureCacheRuntime(const Device& device_, VKScheduler& scheduler_,
|
||||
explicit TextureCacheRuntime(const Device& device_, Scheduler& scheduler_,
|
||||
MemoryAllocator& memory_allocator_,
|
||||
StagingBufferPool& staging_buffer_pool_,
|
||||
BlitImageHelper& blit_image_helper_,
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
[[nodiscard]] VkBuffer GetTemporaryBuffer(size_t needed_size);
|
||||
|
||||
const Device& device;
|
||||
VKScheduler& scheduler;
|
||||
Scheduler& scheduler;
|
||||
MemoryAllocator& memory_allocator;
|
||||
StagingBufferPool& staging_buffer_pool;
|
||||
BlitImageHelper& blit_image_helper;
|
||||
@@ -154,7 +154,7 @@ private:
|
||||
|
||||
bool NeedsScaleHelper() const;
|
||||
|
||||
VKScheduler* scheduler{};
|
||||
Scheduler* scheduler{};
|
||||
TextureCacheRuntime* runtime{};
|
||||
|
||||
vk::Image original_image;
|
||||
|
@@ -12,18 +12,18 @@
|
||||
|
||||
namespace Vulkan {
|
||||
|
||||
VKUpdateDescriptorQueue::VKUpdateDescriptorQueue(const Device& device_, VKScheduler& scheduler_)
|
||||
UpdateDescriptorQueue::UpdateDescriptorQueue(const Device& device_, Scheduler& scheduler_)
|
||||
: device{device_}, scheduler{scheduler_} {
|
||||
payload_cursor = payload.data();
|
||||
}
|
||||
|
||||
VKUpdateDescriptorQueue::~VKUpdateDescriptorQueue() = default;
|
||||
UpdateDescriptorQueue::~UpdateDescriptorQueue() = default;
|
||||
|
||||
void VKUpdateDescriptorQueue::TickFrame() {
|
||||
void UpdateDescriptorQueue::TickFrame() {
|
||||
payload_cursor = payload.data();
|
||||
}
|
||||
|
||||
void VKUpdateDescriptorQueue::Acquire() {
|
||||
void UpdateDescriptorQueue::Acquire() {
|
||||
// Minimum number of entries required.
|
||||
// This is the maximum number of entries a single draw call migth use.
|
||||
static constexpr size_t MIN_ENTRIES = 0x400;
|
||||
|
@@ -10,7 +10,7 @@
|
||||
namespace Vulkan {
|
||||
|
||||
class Device;
|
||||
class VKScheduler;
|
||||
class Scheduler;
|
||||
|
||||
struct DescriptorUpdateEntry {
|
||||
struct Empty {};
|
||||
@@ -28,10 +28,10 @@ struct DescriptorUpdateEntry {
|
||||
};
|
||||
};
|
||||
|
||||
class VKUpdateDescriptorQueue final {
|
||||
class UpdateDescriptorQueue final {
|
||||
public:
|
||||
explicit VKUpdateDescriptorQueue(const Device& device_, VKScheduler& scheduler_);
|
||||
~VKUpdateDescriptorQueue();
|
||||
explicit UpdateDescriptorQueue(const Device& device_, Scheduler& scheduler_);
|
||||
~UpdateDescriptorQueue();
|
||||
|
||||
void TickFrame();
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
|
||||
private:
|
||||
const Device& device;
|
||||
VKScheduler& scheduler;
|
||||
Scheduler& scheduler;
|
||||
|
||||
DescriptorUpdateEntry* payload_cursor = nullptr;
|
||||
const DescriptorUpdateEntry* upload_start = nullptr;
|
||||
|
Reference in New Issue
Block a user