#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "ui/ozone/demo/vulkan_overlay_renderer.h"
#include <vulkan/vulkan.h>
#include <memory>
#include <utility>
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/task/single_thread_task_runner.h"
#include "base/trace_event/trace_event.h"
#include "gpu/vulkan/init/vulkan_factory.h"
#include "gpu/vulkan/vulkan_command_buffer.h"
#include "gpu/vulkan/vulkan_command_pool.h"
#include "gpu/vulkan/vulkan_device_queue.h"
#include "gpu/vulkan/vulkan_function_pointers.h"
#include "gpu/vulkan/vulkan_implementation.h"
#include "gpu/vulkan/vulkan_surface.h"
#include "gpu/vulkan/vulkan_swap_chain.h"
#include "ui/display/types/display_snapshot.h"
#include "ui/gfx/native_pixmap.h"
#include "ui/ozone/public/overlay_plane.h"
#include "ui/ozone/public/overlay_surface.h"
#include "ui/ozone/public/ozone_platform.h"
#include "ui/ozone/public/platform_window_surface.h"
#include "ui/ozone/public/surface_factory_ozone.h"
namespace ui {
namespace {
constexpr int kMinimumBuffersForForwardProgress = …;
}
VulkanOverlayRenderer::VulkanOverlayRenderer(
std::unique_ptr<PlatformWindowSurface> window_surface,
std::unique_ptr<OverlaySurface> overlay_surface,
SurfaceFactoryOzone* surface_factory_ozone,
gpu::VulkanImplementation* vulkan_implementation,
gfx::AcceleratedWidget widget,
const gfx::Size& size)
: … { … }
VulkanOverlayRenderer::~VulkanOverlayRenderer() { … }
bool VulkanOverlayRenderer::Initialize() { … }
void VulkanOverlayRenderer::DestroyRenderPass() { … }
void VulkanOverlayRenderer::DestroyBuffers() { … }
void VulkanOverlayRenderer::RecreateBuffers() { … }
void VulkanOverlayRenderer::RenderFrame() { … }
std::unique_ptr<gfx::GpuFence> VulkanOverlayRenderer::SubmitFence(
VkFence fence) { … }
void VulkanOverlayRenderer::SubmitFrame(
const VulkanOverlayRenderer::Buffer* buffer) { … }
void VulkanOverlayRenderer::PostRenderFrameTask() { … }
void VulkanOverlayRenderer::OnFrameSubmitted(uint64_t frame_sequence,
gfx::SwapResult swap_result) { … }
void VulkanOverlayRenderer::OnFramePresented(
uint64_t frame_sequence,
const gfx::PresentationFeedback& feedback) { … }
void VulkanOverlayRenderer::OnFrameReleased(uint64_t frame_sequence) { … }
VulkanOverlayRenderer::Buffer::Buffer(
const gfx::Size& size,
scoped_refptr<gfx::NativePixmap> native_pixmap,
VkDeviceMemory vk_device_memory,
VkImage vk_image,
VkImageView vk_image_view,
VkFramebuffer vk_framebuffer,
std::unique_ptr<gpu::VulkanCommandBuffer> command_buffer,
VkFence fence)
: … { … }
VulkanOverlayRenderer::Buffer::~Buffer() { … }
std::unique_ptr<VulkanOverlayRenderer::Buffer>
VulkanOverlayRenderer::Buffer::Create(
SurfaceFactoryOzone* surface_factory_ozone,
gpu::VulkanImplementation* vulkan_implementation,
gpu::VulkanDeviceQueue* vulkan_device_queue,
gpu::VulkanCommandPool* vulkan_command_pool,
VkRenderPass vk_render_pass,
gfx::AcceleratedWidget widget,
const gfx::Size& size) { … }
}