#include "gpu/vulkan/vulkan_image.h"
#include <vulkan/vulkan.h>
#include <algorithm>
#include <optional>
#include "base/logging.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "gpu/vulkan/vulkan_device_queue.h"
#include "gpu/vulkan/vulkan_function_pointers.h"
#include "gpu/vulkan/vulkan_util.h"
namespace gpu {
namespace {
VkImageAspectFlagBits to_plane_aspect(size_t plane) { … }
}
std::unique_ptr<VulkanImage> VulkanImage::Create(
VulkanDeviceQueue* device_queue,
const gfx::Size& size,
VkFormat format,
VkImageUsageFlags usage,
VkImageCreateFlags flags,
VkImageTiling image_tiling,
const void* extra_image_create_info,
const void* extra_memory_allocation_info) { … }
std::unique_ptr<VulkanImage> VulkanImage::CreateWithExternalMemory(
VulkanDeviceQueue* device_queue,
const gfx::Size& size,
VkFormat format,
VkImageUsageFlags usage,
VkImageCreateFlags flags,
VkImageTiling image_tiling,
const void* extra_image_create_info,
const void* extra_memory_allocation_info) { … }
std::unique_ptr<VulkanImage> VulkanImage::CreateFromGpuMemoryBufferHandle(
VulkanDeviceQueue* device_queue,
gfx::GpuMemoryBufferHandle gmb_handle,
const gfx::Size& size,
VkFormat format,
VkImageUsageFlags usage,
VkImageCreateFlags flags,
VkImageTiling image_tiling,
uint32_t queue_family_index) { … }
std::unique_ptr<VulkanImage> VulkanImage::Create(
VulkanDeviceQueue* device_queue,
VkImage vk_image,
VkDeviceMemory vk_device_memory,
const gfx::Size& size,
VkFormat format,
VkImageTiling image_tiling,
VkDeviceSize device_size,
uint32_t memory_type_index,
std::optional<VulkanYCbCrInfo>& ycbcr_info,
VkImageUsageFlags usage,
VkImageCreateFlags flags) { … }
VulkanImage::VulkanImage(base::PassKey<VulkanImage> pass_key) { … }
VulkanImage::~VulkanImage() { … }
void VulkanImage::Destroy() { … }
bool VulkanImage::CreateVkImage(const gfx::Size& size,
VkFormat format,
VkImageUsageFlags usage,
VkImageCreateFlags flags,
VkImageTiling image_tiling,
const void* extra_image_create_info) { … }
VkMemoryRequirements VulkanImage::GetMemoryRequirements(size_t plane) { … }
bool VulkanImage::BindMemory(size_t plane,
std::unique_ptr<VulkanMemory> memory) { … }
bool VulkanImage::AllocateAndBindMemory(
size_t plane,
const VkMemoryRequirements* requirements,
const void* extra_memory_allocation_info) { … }
bool VulkanImage::InitializeSingleOrJointPlanes(
VulkanDeviceQueue* device_queue,
const gfx::Size& size,
VkFormat format,
VkImageUsageFlags usage,
VkImageCreateFlags flags,
VkImageTiling image_tiling,
const void* extra_image_create_info,
const void* extra_memory_allocation_info,
const VkMemoryRequirements* requirements) { … }
bool VulkanImage::InitializeWithExternalMemory(
VulkanDeviceQueue* device_queue,
const gfx::Size& size,
VkFormat format,
VkImageUsageFlags usage,
VkImageCreateFlags flags,
VkImageTiling image_tiling,
const void* extra_image_create_info,
const void* extra_memory_allocation_info) { … }
}