#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "gpu/vulkan/vulkan_surface.h"
#include <vulkan/vulkan.h>
#include <algorithm>
#include "base/logging.h"
#include "base/task/single_thread_task_runner.h"
#include "base/threading/scoped_blocking_call.h"
#include "build/build_config.h"
#include "gpu/vulkan/vulkan_device_queue.h"
#include "gpu/vulkan/vulkan_function_pointers.h"
#include "gpu/vulkan/vulkan_swap_chain.h"
namespace gpu {
namespace {
const VkFormat kPreferredVkFormats32[] = …;
const VkFormat kPreferredVkFormats16[] = …;
VkSurfaceTransformFlagBitsKHR ToVkSurfaceTransformFlag(
gfx::OverlayTransform transform) { … }
gfx::OverlayTransform FromVkSurfaceTransformFlag(
VkSurfaceTransformFlagBitsKHR transform) { … }
uint32_t kMinImageCount = …;
}
VulkanSurface::~VulkanSurface() { … }
VulkanSurface::VulkanSurface(VkInstance vk_instance,
gfx::AcceleratedWidget accelerated_widget,
VkSurfaceKHR surface,
uint64_t acquire_next_image_timeout_ns,
std::unique_ptr<gfx::VSyncProvider> vsync_provider)
: … { … }
bool VulkanSurface::Initialize(VulkanDeviceQueue* device_queue,
VulkanSurface::Format format) { … }
void VulkanSurface::Destroy() { … }
gfx::SwapResult VulkanSurface::SwapBuffers(
PresentationCallback presentation_callback) { … }
gfx::SwapResult VulkanSurface::PostSubBuffer(
const gfx::Rect& rect,
PresentationCallback presentation_callback) { … }
void VulkanSurface::PostSubBufferAsync(
const gfx::Rect& rect,
VulkanSwapChain::PostSubBufferCompletionCallback completion_callback,
PresentationCallback presentation_callback) { … }
void VulkanSurface::Finish() { … }
bool VulkanSurface::Reshape(const gfx::Size& size,
gfx::OverlayTransform transform) { … }
base::TimeDelta VulkanSurface::GetDisplayRefreshInterval() { … }
bool VulkanSurface::CreateSwapChain(const gfx::Size& size,
gfx::OverlayTransform transform) { … }
void VulkanSurface::PostSubBufferCompleted(
VulkanSwapChain::PostSubBufferCompletionCallback completion_callback,
PresentationCallback presentation_callback,
gfx::SwapResult result) { … }
}