#include "gpu/vulkan/vulkan_swap_chain.h"
#include "base/compiler_specific.h"
#include "base/debug/crash_logging.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "base/threading/scoped_blocking_call.h"
#include "gpu/vulkan/vulkan_device_queue.h"
#include "gpu/vulkan/vulkan_fence_helper.h"
#include "gpu/vulkan/vulkan_function_pointers.h"
namespace gpu {
namespace {
VkSemaphore CreateSemaphore(VkDevice vk_device) { … }
}
VulkanSwapChain::VulkanSwapChain(uint64_t acquire_next_image_timeout_ns)
: … { … }
VulkanSwapChain::~VulkanSwapChain() { … }
bool VulkanSwapChain::Initialize(
VulkanDeviceQueue* device_queue,
VkSurfaceKHR surface,
const VkSurfaceFormatKHR& surface_format,
const gfx::Size& image_size,
uint32_t min_image_count,
VkImageUsageFlags image_usage_flags,
VkSurfaceTransformFlagBitsKHR pre_transform,
VkCompositeAlphaFlagBitsKHR composite_alpha,
std::unique_ptr<VulkanSwapChain> old_swap_chain) { … }
void VulkanSwapChain::Destroy() { … }
gfx::SwapResult VulkanSwapChain::PostSubBuffer(const gfx::Rect& rect) { … }
void VulkanSwapChain::PostSubBufferAsync(
const gfx::Rect& rect,
PostSubBufferCompletionCallback callback) { … }
bool VulkanSwapChain::InitializeSwapChain(
VkSurfaceKHR surface,
const VkSurfaceFormatKHR& surface_format,
const gfx::Size& image_size,
uint32_t min_image_count,
VkImageUsageFlags image_usage_flags,
VkSurfaceTransformFlagBitsKHR pre_transform,
VkCompositeAlphaFlagBitsKHR composite_alpha,
std::unique_ptr<VulkanSwapChain> old_swap_chain) { … }
void VulkanSwapChain::DestroySwapChain() { … }
bool VulkanSwapChain::InitializeSwapImages(
const VkSurfaceFormatKHR& surface_format) { … }
void VulkanSwapChain::DestroySwapImages() { … }
bool VulkanSwapChain::BeginWriteCurrentImage(VkImage* image,
uint32_t* image_index,
VkImageLayout* image_layout,
VkImageUsageFlags* image_usage,
VkSemaphore* begin_semaphore,
VkSemaphore* end_semaphore) { … }
void VulkanSwapChain::EndWriteCurrentImage() { … }
bool VulkanSwapChain::PresentBuffer(const gfx::Rect& rect) { … }
bool VulkanSwapChain::AcquireNextImage() { … }
void VulkanSwapChain::WaitUntilPostSubBufferAsyncFinished() { … }
bool VulkanSwapChain::GetOrCreateSemaphores(VkSemaphore* acquire_semaphore,
VkSemaphore* present_semaphore) { … }
void VulkanSwapChain::ReturnSemaphores(VkSemaphore acquire_semaphore,
VkSemaphore present_semaphore) { … }
VulkanSwapChain::ScopedWrite::ScopedWrite(VulkanSwapChain* swap_chain)
: … { … }
VulkanSwapChain::ScopedWrite::ScopedWrite(ScopedWrite&& other) { … }
VulkanSwapChain::ScopedWrite::~ScopedWrite() { … }
const VulkanSwapChain::ScopedWrite& VulkanSwapChain::ScopedWrite::operator=(
ScopedWrite&& other) { … }
void VulkanSwapChain::ScopedWrite::Reset() { … }
}