mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-10 03:18:55 +02:00
[vk] unify VkSurfaceKHR with Android and the rest of platforms; remove technically incorrect nullptr() ctor for handles (#2971)
Removes some odd #ifdef-ing that just can use a shrimple opaque type. Also removes nullptr() ctor'ing for vulkan handles and such; it's not incorrect per se like how `void *p = 0;` isn't incorrect, just that, y'know, any static analyzer will go "woah". Also there isn't any guarantee that handles `sizeof(Handle) == sizeof(void*)` so may as well :) Signed-off-by: lizzie lizzie@eden-emu.dev Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2971 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: MaranBr <maranbr@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
parent
05f6942bef
commit
9a07bd0570
17 changed files with 104 additions and 182 deletions
|
|
@ -1032,7 +1032,7 @@ void BlitImageHelper::ConvertDepthToColorPipeline(vk::Pipeline& pipeline, VkRend
|
||||||
VkShaderModule frag_shader = *convert_float_to_depth_frag;
|
VkShaderModule frag_shader = *convert_float_to_depth_frag;
|
||||||
const std::array stages = MakeStages(*full_screen_vert, frag_shader);
|
const std::array stages = MakeStages(*full_screen_vert, frag_shader);
|
||||||
const VkPipelineInputAssemblyStateCreateInfo input_assembly_ci = GetPipelineInputAssemblyStateCreateInfo(device);
|
const VkPipelineInputAssemblyStateCreateInfo input_assembly_ci = GetPipelineInputAssemblyStateCreateInfo(device);
|
||||||
pipeline = device.GetLogical().CreateGraphicsPipeline({
|
pipeline = device.GetLogical().CreateGraphicsPipeline(VkGraphicsPipelineCreateInfo{
|
||||||
.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
|
||||||
.pNext = nullptr,
|
.pNext = nullptr,
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
|
|
@ -1062,7 +1062,7 @@ void BlitImageHelper::ConvertColorToDepthPipeline(vk::Pipeline& pipeline, VkRend
|
||||||
VkShaderModule frag_shader = *convert_depth_to_float_frag;
|
VkShaderModule frag_shader = *convert_depth_to_float_frag;
|
||||||
const std::array stages = MakeStages(*full_screen_vert, frag_shader);
|
const std::array stages = MakeStages(*full_screen_vert, frag_shader);
|
||||||
const VkPipelineInputAssemblyStateCreateInfo input_assembly_ci = GetPipelineInputAssemblyStateCreateInfo(device);
|
const VkPipelineInputAssemblyStateCreateInfo input_assembly_ci = GetPipelineInputAssemblyStateCreateInfo(device);
|
||||||
pipeline = device.GetLogical().CreateGraphicsPipeline({
|
pipeline = device.GetLogical().CreateGraphicsPipeline(VkGraphicsPipelineCreateInfo{
|
||||||
.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
|
||||||
.pNext = nullptr,
|
.pNext = nullptr,
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
|
|
@ -1093,7 +1093,7 @@ void BlitImageHelper::ConvertPipelineEx(vk::Pipeline& pipeline, VkRenderPass ren
|
||||||
}
|
}
|
||||||
const std::array stages = MakeStages(*full_screen_vert, *module);
|
const std::array stages = MakeStages(*full_screen_vert, *module);
|
||||||
const VkPipelineInputAssemblyStateCreateInfo input_assembly_ci = GetPipelineInputAssemblyStateCreateInfo(device);
|
const VkPipelineInputAssemblyStateCreateInfo input_assembly_ci = GetPipelineInputAssemblyStateCreateInfo(device);
|
||||||
pipeline = device.GetLogical().CreateGraphicsPipeline({
|
pipeline = device.GetLogical().CreateGraphicsPipeline(VkGraphicsPipelineCreateInfo{
|
||||||
.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
|
||||||
.pNext = nullptr,
|
.pNext = nullptr,
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
|
|
@ -1135,7 +1135,7 @@ void BlitImageHelper::ConvertPipeline(vk::Pipeline& pipeline, VkRenderPass rende
|
||||||
is_target_depth ? *convert_float_to_depth_frag : *convert_depth_to_float_frag;
|
is_target_depth ? *convert_float_to_depth_frag : *convert_depth_to_float_frag;
|
||||||
const std::array stages = MakeStages(*full_screen_vert, frag_shader);
|
const std::array stages = MakeStages(*full_screen_vert, frag_shader);
|
||||||
const VkPipelineInputAssemblyStateCreateInfo input_assembly_ci = GetPipelineInputAssemblyStateCreateInfo(device);
|
const VkPipelineInputAssemblyStateCreateInfo input_assembly_ci = GetPipelineInputAssemblyStateCreateInfo(device);
|
||||||
pipeline = device.GetLogical().CreateGraphicsPipeline({
|
pipeline = device.GetLogical().CreateGraphicsPipeline(VkGraphicsPipelineCreateInfo{
|
||||||
.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
|
||||||
.pNext = nullptr,
|
.pNext = nullptr,
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
|
|
|
||||||
|
|
@ -137,14 +137,8 @@ try
|
||||||
memory_allocator,
|
memory_allocator,
|
||||||
scheduler,
|
scheduler,
|
||||||
swapchain,
|
swapchain,
|
||||||
#ifdef ANDROID
|
|
||||||
surface)
|
|
||||||
,
|
|
||||||
#else
|
|
||||||
*surface)
|
*surface)
|
||||||
,
|
, blit_swapchain(device_memory,
|
||||||
#endif
|
|
||||||
blit_swapchain(device_memory,
|
|
||||||
device,
|
device,
|
||||||
memory_allocator,
|
memory_allocator,
|
||||||
present_manager,
|
present_manager,
|
||||||
|
|
|
||||||
|
|
@ -285,7 +285,7 @@ ComputePass::ComputePass(const Device& device_, DescriptorPool& descriptor_pool,
|
||||||
.requiredSubgroupSize = optional_subgroup_size ? *optional_subgroup_size : 32U,
|
.requiredSubgroupSize = optional_subgroup_size ? *optional_subgroup_size : 32U,
|
||||||
};
|
};
|
||||||
bool use_setup_size = device.IsExtSubgroupSizeControlSupported() && optional_subgroup_size;
|
bool use_setup_size = device.IsExtSubgroupSizeControlSupported() && optional_subgroup_size;
|
||||||
pipeline = device.GetLogical().CreateComputePipeline({
|
pipeline = device.GetLogical().CreateComputePipeline(VkComputePipelineCreateInfo{
|
||||||
.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO,
|
||||||
.pNext = nullptr,
|
.pNext = nullptr,
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
|
|
@ -299,7 +299,7 @@ ComputePass::ComputePass(const Device& device_, DescriptorPool& descriptor_pool,
|
||||||
.pSpecializationInfo = nullptr,
|
.pSpecializationInfo = nullptr,
|
||||||
},
|
},
|
||||||
.layout = *layout,
|
.layout = *layout,
|
||||||
.basePipelineHandle = nullptr,
|
.basePipelineHandle = {},
|
||||||
.basePipelineIndex = 0,
|
.basePipelineIndex = 0,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -944,7 +944,7 @@ MSAACopyPass::MSAACopyPass(const Device& device_, Scheduler& scheduler_,
|
||||||
.codeSize = static_cast<u32>(code.size_bytes()),
|
.codeSize = static_cast<u32>(code.size_bytes()),
|
||||||
.pCode = code.data(),
|
.pCode = code.data(),
|
||||||
});
|
});
|
||||||
pipelines[i] = device.GetLogical().CreateComputePipeline({
|
pipelines[i] = device.GetLogical().CreateComputePipeline(VkComputePipelineCreateInfo{
|
||||||
.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO,
|
||||||
.pNext = nullptr,
|
.pNext = nullptr,
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
|
|
@ -958,7 +958,7 @@ MSAACopyPass::MSAACopyPass(const Device& device_, Scheduler& scheduler_,
|
||||||
.pSpecializationInfo = nullptr,
|
.pSpecializationInfo = nullptr,
|
||||||
},
|
},
|
||||||
.layout = *layout,
|
.layout = *layout,
|
||||||
.basePipelineHandle = nullptr,
|
.basePipelineHandle = {},
|
||||||
.basePipelineIndex = 0,
|
.basePipelineIndex = 0,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -67,26 +67,24 @@ ComputePipeline::ComputePipeline(const Device& device_, vk::PipelineCache& pipel
|
||||||
if (device.IsKhrPipelineExecutablePropertiesEnabled() && Settings::values.renderer_debug.GetValue()) {
|
if (device.IsKhrPipelineExecutablePropertiesEnabled() && Settings::values.renderer_debug.GetValue()) {
|
||||||
flags |= VK_PIPELINE_CREATE_CAPTURE_STATISTICS_BIT_KHR;
|
flags |= VK_PIPELINE_CREATE_CAPTURE_STATISTICS_BIT_KHR;
|
||||||
}
|
}
|
||||||
pipeline = device.GetLogical().CreateComputePipeline(
|
pipeline = device.GetLogical().CreateComputePipeline(VkComputePipelineCreateInfo{
|
||||||
{
|
.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO,
|
||||||
.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO,
|
.pNext = nullptr,
|
||||||
.pNext = nullptr,
|
.flags = flags,
|
||||||
.flags = flags,
|
.stage{
|
||||||
.stage{
|
.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
|
||||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
|
.pNext =
|
||||||
.pNext =
|
device.IsExtSubgroupSizeControlSupported() ? &subgroup_size_ci : nullptr,
|
||||||
device.IsExtSubgroupSizeControlSupported() ? &subgroup_size_ci : nullptr,
|
.flags = 0,
|
||||||
.flags = 0,
|
.stage = VK_SHADER_STAGE_COMPUTE_BIT,
|
||||||
.stage = VK_SHADER_STAGE_COMPUTE_BIT,
|
.module = *spv_module,
|
||||||
.module = *spv_module,
|
.pName = "main",
|
||||||
.pName = "main",
|
.pSpecializationInfo = nullptr,
|
||||||
.pSpecializationInfo = nullptr,
|
|
||||||
},
|
|
||||||
.layout = *pipeline_layout,
|
|
||||||
.basePipelineHandle = 0,
|
|
||||||
.basePipelineIndex = 0,
|
|
||||||
},
|
},
|
||||||
*pipeline_cache);
|
.layout = *pipeline_layout,
|
||||||
|
.basePipelineHandle = 0,
|
||||||
|
.basePipelineIndex = 0,
|
||||||
|
}, *pipeline_cache);
|
||||||
|
|
||||||
// Log compute pipeline creation
|
// Log compute pipeline creation
|
||||||
if (Settings::values.gpu_logging_enabled.GetValue()) {
|
if (Settings::values.gpu_logging_enabled.GetValue()) {
|
||||||
|
|
|
||||||
|
|
@ -946,29 +946,27 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) {
|
||||||
flags |= VK_PIPELINE_CREATE_CAPTURE_STATISTICS_BIT_KHR;
|
flags |= VK_PIPELINE_CREATE_CAPTURE_STATISTICS_BIT_KHR;
|
||||||
}
|
}
|
||||||
|
|
||||||
pipeline = device.GetLogical().CreateGraphicsPipeline(
|
pipeline = device.GetLogical().CreateGraphicsPipeline({
|
||||||
{
|
.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
|
||||||
.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
|
.pNext = nullptr,
|
||||||
.pNext = nullptr,
|
.flags = flags,
|
||||||
.flags = flags,
|
.stageCount = static_cast<u32>(shader_stages.size()),
|
||||||
.stageCount = static_cast<u32>(shader_stages.size()),
|
.pStages = shader_stages.data(),
|
||||||
.pStages = shader_stages.data(),
|
.pVertexInputState = &vertex_input_ci,
|
||||||
.pVertexInputState = &vertex_input_ci,
|
.pInputAssemblyState = &input_assembly_ci,
|
||||||
.pInputAssemblyState = &input_assembly_ci,
|
.pTessellationState = &tessellation_ci,
|
||||||
.pTessellationState = &tessellation_ci,
|
.pViewportState = &viewport_ci,
|
||||||
.pViewportState = &viewport_ci,
|
.pRasterizationState = &rasterization_ci,
|
||||||
.pRasterizationState = &rasterization_ci,
|
.pMultisampleState = &multisample_ci,
|
||||||
.pMultisampleState = &multisample_ci,
|
.pDepthStencilState = &depth_stencil_ci,
|
||||||
.pDepthStencilState = &depth_stencil_ci,
|
.pColorBlendState = &color_blend_ci,
|
||||||
.pColorBlendState = &color_blend_ci,
|
.pDynamicState = &dynamic_state_ci,
|
||||||
.pDynamicState = &dynamic_state_ci,
|
.layout = *pipeline_layout,
|
||||||
.layout = *pipeline_layout,
|
.renderPass = render_pass,
|
||||||
.renderPass = render_pass,
|
.subpass = 0,
|
||||||
.subpass = 0,
|
.basePipelineHandle = nullptr,
|
||||||
.basePipelineHandle = nullptr,
|
.basePipelineIndex = 0,
|
||||||
.basePipelineIndex = 0,
|
}, *pipeline_cache);
|
||||||
},
|
|
||||||
*pipeline_cache);
|
|
||||||
|
|
||||||
// Log graphics pipeline creation
|
// Log graphics pipeline creation
|
||||||
if (Settings::values.gpu_logging_enabled.GetValue()) {
|
if (Settings::values.gpu_logging_enabled.GetValue()) {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
|
|
@ -101,22 +101,14 @@ PresentManager::PresentManager(const vk::Instance& instance_,
|
||||||
MemoryAllocator& memory_allocator_,
|
MemoryAllocator& memory_allocator_,
|
||||||
Scheduler& scheduler_,
|
Scheduler& scheduler_,
|
||||||
Swapchain& swapchain_,
|
Swapchain& swapchain_,
|
||||||
#ifdef ANDROID
|
VkSurfaceKHR_T* surface_)
|
||||||
vk::SurfaceKHR& surface_)
|
|
||||||
#else
|
|
||||||
VkSurfaceKHR_T* surface_handle_)
|
|
||||||
#endif
|
|
||||||
: instance{instance_}
|
: instance{instance_}
|
||||||
, render_window{render_window_}
|
, render_window{render_window_}
|
||||||
, device{device_}
|
, device{device_}
|
||||||
, memory_allocator{memory_allocator_}
|
, memory_allocator{memory_allocator_}
|
||||||
, scheduler{scheduler_}
|
, scheduler{scheduler_}
|
||||||
, swapchain{swapchain_}
|
, swapchain{swapchain_}
|
||||||
#ifdef ANDROID
|
|
||||||
, surface{surface_}
|
, surface{surface_}
|
||||||
#else
|
|
||||||
, surface_handle{surface_handle_}
|
|
||||||
#endif
|
|
||||||
, blit_supported{CanBlitToSwapchain(device.GetPhysical(), swapchain.GetImageViewFormat())}
|
, blit_supported{CanBlitToSwapchain(device.GetPhysical(), swapchain.GetImageViewFormat())}
|
||||||
, use_present_thread{Settings::values.async_presentation.GetValue()}
|
, use_present_thread{Settings::values.async_presentation.GetValue()}
|
||||||
{
|
{
|
||||||
|
|
@ -299,11 +291,7 @@ void PresentManager::PresentThread(std::stop_token token) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PresentManager::RecreateSwapchain(Frame* frame) {
|
void PresentManager::RecreateSwapchain(Frame* frame) {
|
||||||
#ifndef ANDROID
|
swapchain.Create(surface, frame->width, frame->height); // Pass raw pointer
|
||||||
swapchain.Create(surface_handle, frame->width, frame->height); // Pass raw pointer
|
|
||||||
#else
|
|
||||||
swapchain.Create(*surface, frame->width, frame->height); // Pass raw pointer
|
|
||||||
#endif
|
|
||||||
SetImageCount();
|
SetImageCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -322,7 +310,7 @@ void PresentManager::CopyToSwapchain(Frame* frame) {
|
||||||
// Recreate surface and swapchain if needed.
|
// Recreate surface and swapchain if needed.
|
||||||
if (requires_recreation) {
|
if (requires_recreation) {
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
surface = CreateSurface(instance, render_window.GetWindowInfo());
|
surface = *CreateSurface(instance, render_window.GetWindowInfo()).address();
|
||||||
#endif
|
#endif
|
||||||
RecreateSwapchain(frame);
|
RecreateSwapchain(frame);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
|
|
@ -15,8 +15,6 @@
|
||||||
#include "video_core/vulkan_common/vulkan_memory_allocator.h"
|
#include "video_core/vulkan_common/vulkan_memory_allocator.h"
|
||||||
#include "video_core/vulkan_common/vulkan_wrapper.h"
|
#include "video_core/vulkan_common/vulkan_wrapper.h"
|
||||||
|
|
||||||
struct VkSurfaceKHR_T;
|
|
||||||
|
|
||||||
namespace Core::Frontend {
|
namespace Core::Frontend {
|
||||||
class EmuWindow;
|
class EmuWindow;
|
||||||
} // namespace Core::Frontend
|
} // namespace Core::Frontend
|
||||||
|
|
@ -46,11 +44,7 @@ public:
|
||||||
MemoryAllocator& memory_allocator,
|
MemoryAllocator& memory_allocator,
|
||||||
Scheduler& scheduler,
|
Scheduler& scheduler,
|
||||||
Swapchain& swapchain,
|
Swapchain& swapchain,
|
||||||
#ifdef ANDROID
|
VkSurfaceKHR_T* surface);
|
||||||
vk::SurfaceKHR& surface);
|
|
||||||
#else
|
|
||||||
VkSurfaceKHR_T* surface_handle);
|
|
||||||
#endif
|
|
||||||
~PresentManager();
|
~PresentManager();
|
||||||
|
|
||||||
/// Returns the last used presentation frame
|
/// Returns the last used presentation frame
|
||||||
|
|
@ -84,11 +78,7 @@ private:
|
||||||
MemoryAllocator& memory_allocator;
|
MemoryAllocator& memory_allocator;
|
||||||
Scheduler& scheduler;
|
Scheduler& scheduler;
|
||||||
Swapchain& swapchain;
|
Swapchain& swapchain;
|
||||||
#ifdef ANDROID
|
VkSurfaceKHR_T* surface;
|
||||||
vk::SurfaceKHR& surface;
|
|
||||||
#else
|
|
||||||
VkSurfaceKHR_T* surface_handle;
|
|
||||||
#endif
|
|
||||||
vk::CommandPool cmdpool;
|
vk::CommandPool cmdpool;
|
||||||
std::vector<Frame> frames;
|
std::vector<Frame> frames;
|
||||||
boost::container::deque<Frame*> present_queue;
|
boost::container::deque<Frame*> present_queue;
|
||||||
|
|
|
||||||
|
|
@ -1280,7 +1280,7 @@ void QueryCacheRuntime::EndHostConditionalRendering() {
|
||||||
PauseHostConditionalRendering();
|
PauseHostConditionalRendering();
|
||||||
impl->hcr_is_set = false;
|
impl->hcr_is_set = false;
|
||||||
impl->is_hcr_running = false;
|
impl->is_hcr_running = false;
|
||||||
impl->hcr_buffer = nullptr;
|
impl->hcr_buffer = VkBuffer{};
|
||||||
impl->hcr_offset = 0;
|
impl->hcr_offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,6 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
|
@ -35,7 +38,7 @@ public:
|
||||||
~QueryCacheRuntime();
|
~QueryCacheRuntime();
|
||||||
|
|
||||||
template <typename SyncValuesType>
|
template <typename SyncValuesType>
|
||||||
void SyncValues(std::span<SyncValuesType> values, VkBuffer base_src_buffer = nullptr);
|
void SyncValues(std::span<SyncValuesType> values, VkBuffer base_src_buffer = VkBuffer{});
|
||||||
|
|
||||||
void Barriers(bool is_prebarrier);
|
void Barriers(bool is_prebarrier);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -377,7 +377,7 @@ void Scheduler::EndRenderPass()
|
||||||
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, 0, nullptr, nullptr, vk::Span(barriers.data(), num_images));
|
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, 0, nullptr, nullptr, vk::Span(barriers.data(), num_images));
|
||||||
});
|
});
|
||||||
|
|
||||||
state.renderpass = nullptr;
|
state.renderpass = VkRenderPass{};
|
||||||
num_renderpass_images = 0;
|
num_renderpass_images = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,10 +44,10 @@ public:
|
||||||
~Scheduler();
|
~Scheduler();
|
||||||
|
|
||||||
/// Sends the current execution context to the GPU.
|
/// Sends the current execution context to the GPU.
|
||||||
u64 Flush(VkSemaphore signal_semaphore = nullptr, VkSemaphore wait_semaphore = nullptr);
|
u64 Flush(VkSemaphore signal_semaphore = {}, VkSemaphore wait_semaphore = {});
|
||||||
|
|
||||||
/// Sends the current execution context to the GPU and waits for it to complete.
|
/// Sends the current execution context to the GPU and waits for it to complete.
|
||||||
void Finish(VkSemaphore signal_semaphore = nullptr, VkSemaphore wait_semaphore = nullptr);
|
void Finish(VkSemaphore signal_semaphore = {}, VkSemaphore wait_semaphore = {});
|
||||||
|
|
||||||
/// Waits for the worker thread to finish executing everything. After this function returns it's
|
/// Waits for the worker thread to finish executing everything. After this function returns it's
|
||||||
/// safe to touch worker resources.
|
/// safe to touch worker resources.
|
||||||
|
|
@ -237,8 +237,8 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
struct State {
|
struct State {
|
||||||
VkRenderPass renderpass = nullptr;
|
VkRenderPass renderpass{};
|
||||||
VkFramebuffer framebuffer = nullptr;
|
VkFramebuffer framebuffer{};
|
||||||
VkExtent2D render_area = {0, 0};
|
VkExtent2D render_area = {0, 0};
|
||||||
GraphicsPipeline* graphics_pipeline = nullptr;
|
GraphicsPipeline* graphics_pipeline = nullptr;
|
||||||
bool is_rescaling = false;
|
bool is_rescaling = false;
|
||||||
|
|
|
||||||
|
|
@ -109,38 +109,22 @@ VkCompositeAlphaFlagBitsKHR ChooseAlphaFlags(const VkSurfaceCapabilitiesKHR& cap
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
Swapchain::Swapchain(
|
Swapchain::Swapchain(
|
||||||
#ifdef ANDROID
|
VkSurfaceKHR_T* surface_,
|
||||||
VkSurfaceKHR surface_,
|
|
||||||
#else
|
|
||||||
VkSurfaceKHR_T* surface_handle_,
|
|
||||||
#endif
|
|
||||||
const Device& device_,
|
const Device& device_,
|
||||||
Scheduler& scheduler_,
|
Scheduler& scheduler_,
|
||||||
u32 width_,
|
u32 width_,
|
||||||
u32 height_)
|
u32 height_)
|
||||||
#ifdef ANDROID
|
|
||||||
: surface(surface_)
|
: surface(surface_)
|
||||||
#else
|
|
||||||
: surface_handle{surface_handle_}
|
|
||||||
#endif
|
|
||||||
, device{device_}
|
, device{device_}
|
||||||
, scheduler{scheduler_}
|
, scheduler{scheduler_}
|
||||||
{
|
{
|
||||||
#ifdef ANDROID
|
|
||||||
Create(surface, width_, height_);
|
Create(surface, width_, height_);
|
||||||
#else
|
|
||||||
Create(surface_handle, width_, height_);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Swapchain::~Swapchain() = default;
|
Swapchain::~Swapchain() = default;
|
||||||
|
|
||||||
void Swapchain::Create(
|
void Swapchain::Create(
|
||||||
#ifdef ANDROID
|
VkSurfaceKHR_T* surface_,
|
||||||
VkSurfaceKHR surface_,
|
|
||||||
#else
|
|
||||||
VkSurfaceKHR_T* surface_handle_,
|
|
||||||
#endif
|
|
||||||
u32 width_,
|
u32 width_,
|
||||||
u32 height_)
|
u32 height_)
|
||||||
{
|
{
|
||||||
|
|
@ -148,18 +132,10 @@ void Swapchain::Create(
|
||||||
is_suboptimal = false;
|
is_suboptimal = false;
|
||||||
width = width_;
|
width = width_;
|
||||||
height = height_;
|
height = height_;
|
||||||
#ifdef ANDROID
|
|
||||||
surface = surface_;
|
surface = surface_;
|
||||||
#else
|
|
||||||
surface_handle = surface_handle_;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const auto physical_device = device.GetPhysical();
|
const auto physical_device = device.GetPhysical();
|
||||||
#ifdef ANDROID
|
const auto capabilities{physical_device.GetSurfaceCapabilitiesKHR(VkSurfaceKHR(surface))};
|
||||||
const auto capabilities{physical_device.GetSurfaceCapabilitiesKHR(surface)};
|
|
||||||
#else
|
|
||||||
const auto capabilities{physical_device.GetSurfaceCapabilitiesKHR(surface_handle)};
|
|
||||||
#endif
|
|
||||||
if (capabilities.maxImageExtent.width == 0 || capabilities.maxImageExtent.height == 0) {
|
if (capabilities.maxImageExtent.width == 0 || capabilities.maxImageExtent.height == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -254,14 +230,8 @@ void Swapchain::Present(VkSemaphore render_semaphore) {
|
||||||
|
|
||||||
void Swapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities) {
|
void Swapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities) {
|
||||||
const auto physical_device{device.GetPhysical()};
|
const auto physical_device{device.GetPhysical()};
|
||||||
|
const auto formats{physical_device.GetSurfaceFormatsKHR(VkSurfaceKHR(surface))};
|
||||||
#ifdef ANDROID
|
const auto present_modes = physical_device.GetSurfacePresentModesKHR(VkSurfaceKHR(surface));
|
||||||
const auto formats{physical_device.GetSurfaceFormatsKHR(surface)};
|
|
||||||
const auto present_modes = physical_device.GetSurfacePresentModesKHR(surface);
|
|
||||||
#else
|
|
||||||
const auto formats{physical_device.GetSurfaceFormatsKHR(surface_handle)};
|
|
||||||
const auto present_modes = physical_device.GetSurfacePresentModesKHR(surface_handle);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
has_mailbox = std::find(present_modes.begin(), present_modes.end(), VK_PRESENT_MODE_MAILBOX_KHR)
|
has_mailbox = std::find(present_modes.begin(), present_modes.end(), VK_PRESENT_MODE_MAILBOX_KHR)
|
||||||
!= present_modes.end();
|
!= present_modes.end();
|
||||||
|
|
@ -290,11 +260,7 @@ void Swapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities) {
|
||||||
.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR,
|
.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR,
|
||||||
.pNext = nullptr,
|
.pNext = nullptr,
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
#ifdef ANDROID
|
.surface = VkSurfaceKHR(surface),
|
||||||
.surface = surface,
|
|
||||||
#else
|
|
||||||
.surface = surface_handle,
|
|
||||||
#endif
|
|
||||||
.minImageCount = requested_image_count,
|
.minImageCount = requested_image_count,
|
||||||
.imageFormat = surface_format.format,
|
.imageFormat = surface_format.format,
|
||||||
.imageColorSpace = surface_format.colorSpace,
|
.imageColorSpace = surface_format.colorSpace,
|
||||||
|
|
@ -313,7 +279,7 @@ void Swapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities) {
|
||||||
.compositeAlpha = alpha_flags,
|
.compositeAlpha = alpha_flags,
|
||||||
.presentMode = present_mode,
|
.presentMode = present_mode,
|
||||||
.clipped = VK_FALSE,
|
.clipped = VK_FALSE,
|
||||||
.oldSwapchain = nullptr,
|
.oldSwapchain = VkSwapchainKHR{},
|
||||||
};
|
};
|
||||||
const u32 graphics_family{device.GetGraphicsFamily()};
|
const u32 graphics_family{device.GetGraphicsFamily()};
|
||||||
const u32 present_family{device.GetPresentFamily()};
|
const u32 present_family{device.GetPresentFamily()};
|
||||||
|
|
@ -345,11 +311,7 @@ void Swapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities) {
|
||||||
swapchain_ci.flags |= VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR;
|
swapchain_ci.flags |= VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR;
|
||||||
}
|
}
|
||||||
// Request the size again to reduce the possibility of a TOCTOU race condition.
|
// Request the size again to reduce the possibility of a TOCTOU race condition.
|
||||||
#ifdef ANDROID
|
const auto updated_capabilities = physical_device.GetSurfaceCapabilitiesKHR(VkSurfaceKHR(surface));
|
||||||
const auto updated_capabilities = physical_device.GetSurfaceCapabilitiesKHR(surface);
|
|
||||||
#else
|
|
||||||
const auto updated_capabilities = physical_device.GetSurfaceCapabilitiesKHR(surface_handle);
|
|
||||||
#endif
|
|
||||||
swapchain_ci.imageExtent = ChooseSwapExtent(updated_capabilities, width, height);
|
swapchain_ci.imageExtent = ChooseSwapExtent(updated_capabilities, width, height);
|
||||||
// Don't add code within this and the swapchain creation.
|
// Don't add code within this and the swapchain creation.
|
||||||
swapchain = device.GetLogical().CreateSwapchainKHR(swapchain_ci);
|
swapchain = device.GetLogical().CreateSwapchainKHR(swapchain_ci);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
||||||
|
|
@ -11,8 +11,6 @@
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "video_core/vulkan_common/vulkan_wrapper.h"
|
#include "video_core/vulkan_common/vulkan_wrapper.h"
|
||||||
|
|
||||||
struct VkSurfaceKHR_T;
|
|
||||||
|
|
||||||
namespace Layout {
|
namespace Layout {
|
||||||
struct FramebufferLayout;
|
struct FramebufferLayout;
|
||||||
}
|
}
|
||||||
|
|
@ -25,11 +23,7 @@ class Scheduler;
|
||||||
class Swapchain {
|
class Swapchain {
|
||||||
public:
|
public:
|
||||||
explicit Swapchain(
|
explicit Swapchain(
|
||||||
#ifdef ANDROID
|
VkSurfaceKHR_T* surface,
|
||||||
VkSurfaceKHR surface,
|
|
||||||
#else
|
|
||||||
VkSurfaceKHR_T* surface_handle,
|
|
||||||
#endif
|
|
||||||
const Device& device,
|
const Device& device,
|
||||||
Scheduler& scheduler,
|
Scheduler& scheduler,
|
||||||
u32 width,
|
u32 width,
|
||||||
|
|
@ -38,11 +32,7 @@ public:
|
||||||
|
|
||||||
/// Creates (or recreates) the swapchain with a given size.
|
/// Creates (or recreates) the swapchain with a given size.
|
||||||
void Create(
|
void Create(
|
||||||
#ifdef ANDROID
|
VkSurfaceKHR_T* surface,
|
||||||
VkSurfaceKHR surface,
|
|
||||||
#else
|
|
||||||
VkSurfaceKHR_T* surface_handle,
|
|
||||||
#endif
|
|
||||||
u32 width,
|
u32 width,
|
||||||
u32 height);
|
u32 height);
|
||||||
|
|
||||||
|
|
@ -128,11 +118,7 @@ private:
|
||||||
|
|
||||||
bool NeedsPresentModeUpdate() const;
|
bool NeedsPresentModeUpdate() const;
|
||||||
|
|
||||||
#ifdef ANDROID
|
VkSurfaceKHR_T* surface;
|
||||||
VkSurfaceKHR surface;
|
|
||||||
#else
|
|
||||||
VkSurfaceKHR_T* surface_handle;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const Device& device;
|
const Device& device;
|
||||||
Scheduler& scheduler;
|
Scheduler& scheduler;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
|
|
@ -40,3 +40,6 @@
|
||||||
#undef False
|
#undef False
|
||||||
#undef None
|
#undef None
|
||||||
#undef True
|
#undef True
|
||||||
|
|
||||||
|
// "Catch-all" handle for both Android and.. the rest of platforms
|
||||||
|
struct VkSurfaceKHR_T;
|
||||||
|
|
|
||||||
|
|
@ -419,7 +419,7 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
|
||||||
: instance{instance_}, dld{dld_}, physical{physical_},
|
: instance{instance_}, dld{dld_}, physical{physical_},
|
||||||
format_properties(GetFormatProperties(physical)) {
|
format_properties(GetFormatProperties(physical)) {
|
||||||
// Get suitability and device properties.
|
// Get suitability and device properties.
|
||||||
const bool is_suitable = GetSuitability(surface != nullptr);
|
const bool is_suitable = GetSuitability(surface != VkSurfaceKHR{});
|
||||||
|
|
||||||
const VkDriverId driver_id = properties.driver.driverID;
|
const VkDriverId driver_id = properties.driver.driverID;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ vk::SurfaceKHR CreateSurface(
|
||||||
const vk::Instance& instance,
|
const vk::Instance& instance,
|
||||||
[[maybe_unused]] const Core::Frontend::EmuWindow::WindowSystemInfo& window_info) {
|
[[maybe_unused]] const Core::Frontend::EmuWindow::WindowSystemInfo& window_info) {
|
||||||
[[maybe_unused]] const vk::InstanceDispatch& dld = instance.Dispatch();
|
[[maybe_unused]] const vk::InstanceDispatch& dld = instance.Dispatch();
|
||||||
VkSurfaceKHR unsafe_surface = nullptr;
|
VkSurfaceKHR unsafe_surface = VkSurfaceKHR{};
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (window_info.type == Core::Frontend::WindowSystemType::Windows) {
|
if (window_info.type == Core::Frontend::WindowSystemType::Windows) {
|
||||||
|
|
|
||||||
|
|
@ -404,13 +404,13 @@ public:
|
||||||
|
|
||||||
/// Construct a handle transferring the ownership from another handle.
|
/// Construct a handle transferring the ownership from another handle.
|
||||||
Handle(Handle&& rhs) noexcept
|
Handle(Handle&& rhs) noexcept
|
||||||
: handle{std::exchange(rhs.handle, nullptr)}, owner{rhs.owner}, dld{rhs.dld} {}
|
: handle{std::exchange(rhs.handle, Type{})}, owner{rhs.owner}, dld{rhs.dld} {}
|
||||||
|
|
||||||
/// Assign the current handle transferring the ownership from another handle.
|
/// Assign the current handle transferring the ownership from another handle.
|
||||||
/// Destroys any previously held object.
|
/// Destroys any previously held object.
|
||||||
Handle& operator=(Handle&& rhs) noexcept {
|
Handle& operator=(Handle&& rhs) noexcept {
|
||||||
Release();
|
Release();
|
||||||
handle = std::exchange(rhs.handle, nullptr);
|
handle = std::exchange(rhs.handle, Type{});
|
||||||
owner = rhs.owner;
|
owner = rhs.owner;
|
||||||
dld = rhs.dld;
|
dld = rhs.dld;
|
||||||
return *this;
|
return *this;
|
||||||
|
|
@ -424,7 +424,7 @@ public:
|
||||||
/// Destroys any held object.
|
/// Destroys any held object.
|
||||||
void reset() noexcept {
|
void reset() noexcept {
|
||||||
Release();
|
Release();
|
||||||
handle = nullptr;
|
handle = Type{};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the address of the held object.
|
/// Returns the address of the held object.
|
||||||
|
|
@ -440,7 +440,7 @@ public:
|
||||||
|
|
||||||
/// Returns true when there's a held object.
|
/// Returns true when there's a held object.
|
||||||
explicit operator bool() const noexcept {
|
explicit operator bool() const noexcept {
|
||||||
return handle != nullptr;
|
return handle != Type{};
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef ANDROID
|
#ifndef ANDROID
|
||||||
|
|
@ -455,7 +455,7 @@ public:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Type handle = nullptr;
|
Type handle{};
|
||||||
OwnerType owner = nullptr;
|
OwnerType owner = nullptr;
|
||||||
const Dispatch* dld = nullptr;
|
const Dispatch* dld = nullptr;
|
||||||
|
|
||||||
|
|
@ -463,7 +463,7 @@ private:
|
||||||
/// Destroys the held object if it exists.
|
/// Destroys the held object if it exists.
|
||||||
void Release() noexcept {
|
void Release() noexcept {
|
||||||
if (handle) {
|
if (handle) {
|
||||||
Destroy(owner, handle, *dld);
|
Destroy(OwnerType(owner), Type(handle), *dld);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -506,7 +506,7 @@ public:
|
||||||
/// Destroys any held object.
|
/// Destroys any held object.
|
||||||
void reset() noexcept {
|
void reset() noexcept {
|
||||||
Release();
|
Release();
|
||||||
handle = nullptr;
|
handle = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the address of the held object.
|
/// Returns the address of the held object.
|
||||||
|
|
@ -522,7 +522,7 @@ public:
|
||||||
|
|
||||||
/// Returns true when there's a held object.
|
/// Returns true when there's a held object.
|
||||||
explicit operator bool() const noexcept {
|
explicit operator bool() const noexcept {
|
||||||
return handle != nullptr;
|
return handle != Type{};
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef ANDROID
|
#ifndef ANDROID
|
||||||
|
|
@ -537,7 +537,7 @@ public:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Type handle = nullptr;
|
Type handle{};
|
||||||
const Dispatch* dld = nullptr;
|
const Dispatch* dld = nullptr;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -607,7 +607,7 @@ private:
|
||||||
std::unique_ptr<AllocationType[]> allocations;
|
std::unique_ptr<AllocationType[]> allocations;
|
||||||
std::size_t num = 0;
|
std::size_t num = 0;
|
||||||
VkDevice device = nullptr;
|
VkDevice device = nullptr;
|
||||||
PoolType pool = nullptr;
|
PoolType pool{};
|
||||||
const DeviceDispatch* dld = nullptr;
|
const DeviceDispatch* dld = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -669,12 +669,12 @@ public:
|
||||||
Image& operator=(const Image&) = delete;
|
Image& operator=(const Image&) = delete;
|
||||||
|
|
||||||
Image(Image&& rhs) noexcept
|
Image(Image&& rhs) noexcept
|
||||||
: handle{std::exchange(rhs.handle, nullptr)}, usage{rhs.usage}, owner{rhs.owner},
|
: handle{std::exchange(rhs.handle, VkImage{})}, usage{rhs.usage}, owner{rhs.owner},
|
||||||
allocator{rhs.allocator}, allocation{rhs.allocation}, dld{rhs.dld} {}
|
allocator{rhs.allocator}, allocation{rhs.allocation}, dld{rhs.dld} {}
|
||||||
|
|
||||||
Image& operator=(Image&& rhs) noexcept {
|
Image& operator=(Image&& rhs) noexcept {
|
||||||
Release();
|
Release();
|
||||||
handle = std::exchange(rhs.handle, nullptr);
|
handle = std::exchange(rhs.handle, VkImage{});
|
||||||
usage = rhs.usage;
|
usage = rhs.usage;
|
||||||
owner = rhs.owner;
|
owner = rhs.owner;
|
||||||
allocator = rhs.allocator;
|
allocator = rhs.allocator;
|
||||||
|
|
@ -693,11 +693,11 @@ public:
|
||||||
|
|
||||||
void reset() noexcept {
|
void reset() noexcept {
|
||||||
Release();
|
Release();
|
||||||
handle = nullptr;
|
handle = VkImage{};
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit operator bool() const noexcept {
|
explicit operator bool() const noexcept {
|
||||||
return handle != nullptr;
|
return handle != VkImage{};
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetObjectNameEXT(const char* name) const;
|
void SetObjectNameEXT(const char* name) const;
|
||||||
|
|
@ -709,7 +709,7 @@ public:
|
||||||
private:
|
private:
|
||||||
void Release() const noexcept;
|
void Release() const noexcept;
|
||||||
|
|
||||||
VkImage handle = nullptr;
|
VkImage handle{};
|
||||||
VkImageUsageFlags usage{};
|
VkImageUsageFlags usage{};
|
||||||
VkDevice owner = nullptr;
|
VkDevice owner = nullptr;
|
||||||
VmaAllocator allocator = nullptr;
|
VmaAllocator allocator = nullptr;
|
||||||
|
|
@ -730,13 +730,13 @@ public:
|
||||||
Buffer& operator=(const Buffer&) = delete;
|
Buffer& operator=(const Buffer&) = delete;
|
||||||
|
|
||||||
Buffer(Buffer&& rhs) noexcept
|
Buffer(Buffer&& rhs) noexcept
|
||||||
: handle{std::exchange(rhs.handle, nullptr)}, owner{rhs.owner}, allocator{rhs.allocator},
|
: handle{std::exchange(rhs.handle, VkBuffer{})}, owner{rhs.owner}, allocator{rhs.allocator},
|
||||||
allocation{rhs.allocation}, mapped{rhs.mapped},
|
allocation{rhs.allocation}, mapped{rhs.mapped},
|
||||||
is_coherent{rhs.is_coherent}, dld{rhs.dld} {}
|
is_coherent{rhs.is_coherent}, dld{rhs.dld} {}
|
||||||
|
|
||||||
Buffer& operator=(Buffer&& rhs) noexcept {
|
Buffer& operator=(Buffer&& rhs) noexcept {
|
||||||
Release();
|
Release();
|
||||||
handle = std::exchange(rhs.handle, nullptr);
|
handle = std::exchange(rhs.handle, VkBuffer{});
|
||||||
owner = rhs.owner;
|
owner = rhs.owner;
|
||||||
allocator = rhs.allocator;
|
allocator = rhs.allocator;
|
||||||
allocation = rhs.allocation;
|
allocation = rhs.allocation;
|
||||||
|
|
@ -756,11 +756,11 @@ public:
|
||||||
|
|
||||||
void reset() noexcept {
|
void reset() noexcept {
|
||||||
Release();
|
Release();
|
||||||
handle = nullptr;
|
handle = VkBuffer{};
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit operator bool() const noexcept {
|
explicit operator bool() const noexcept {
|
||||||
return handle != nullptr;
|
return handle != VkBuffer{};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the host mapped memory, an empty span otherwise.
|
/// Returns the host mapped memory, an empty span otherwise.
|
||||||
|
|
@ -786,7 +786,7 @@ public:
|
||||||
private:
|
private:
|
||||||
void Release() const noexcept;
|
void Release() const noexcept;
|
||||||
|
|
||||||
VkBuffer handle = nullptr;
|
VkBuffer handle{};
|
||||||
VkDevice owner = nullptr;
|
VkDevice owner = nullptr;
|
||||||
VmaAllocator allocator = nullptr;
|
VmaAllocator allocator = nullptr;
|
||||||
VmaAllocation allocation = nullptr;
|
VmaAllocation allocation = nullptr;
|
||||||
|
|
@ -1020,10 +1020,10 @@ public:
|
||||||
[[nodiscard]] PipelineLayout CreatePipelineLayout(const VkPipelineLayoutCreateInfo& ci) const;
|
[[nodiscard]] PipelineLayout CreatePipelineLayout(const VkPipelineLayoutCreateInfo& ci) const;
|
||||||
|
|
||||||
[[nodiscard]] Pipeline CreateGraphicsPipeline(const VkGraphicsPipelineCreateInfo& ci,
|
[[nodiscard]] Pipeline CreateGraphicsPipeline(const VkGraphicsPipelineCreateInfo& ci,
|
||||||
VkPipelineCache cache = nullptr) const;
|
VkPipelineCache cache = {}) const;
|
||||||
|
|
||||||
[[nodiscard]] Pipeline CreateComputePipeline(const VkComputePipelineCreateInfo& ci,
|
[[nodiscard]] Pipeline CreateComputePipeline(const VkComputePipelineCreateInfo& ci,
|
||||||
VkPipelineCache cache = nullptr) const;
|
VkPipelineCache cache = {}) const;
|
||||||
|
|
||||||
[[nodiscard]] Sampler CreateSampler(const VkSamplerCreateInfo& ci) const;
|
[[nodiscard]] Sampler CreateSampler(const VkSamplerCreateInfo& ci) const;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue