1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44

gpu / command_buffer / service / shared_image / texture_holder_vk.h [blame]

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef GPU_COMMAND_BUFFER_SERVICE_SHARED_IMAGE_TEXTURE_HOLDER_VK_H_
#define GPU_COMMAND_BUFFER_SERVICE_SHARED_IMAGE_TEXTURE_HOLDER_VK_H_

#include <memory>

#include "third_party/skia/include/gpu/ganesh/GrBackendSurface.h"
#include "third_party/skia/include/gpu/ganesh/vk/GrVkTypes.h"
#include "third_party/skia/include/private/chromium/GrPromiseImageTexture.h"

namespace gfx {
class ColorSpace;
}  // namespace gfx

namespace viz {
class SharedImageFormat;
}  // namespace viz

namespace gpu {

class VulkanImage;

// Holds VulkanImage + skia representations of it.
struct TextureHolderVk {
  explicit TextureHolderVk(std::unique_ptr<VulkanImage> image,
                           const viz::SharedImageFormat& si_format,
                           const gfx::ColorSpace& color_space);
  TextureHolderVk(TextureHolderVk&& other);
  TextureHolderVk& operator=(TextureHolderVk&& other);
  ~TextureHolderVk();

  GrVkImageInfo GetGrVkImageInfo() const;

  std::unique_ptr<VulkanImage> vulkan_image;
  GrBackendTexture backend_texture;
  sk_sp<GrPromiseImageTexture> promise_texture;
};

}  // namespace gpu

#endif  // GPU_COMMAND_BUFFER_SERVICE_SHARED_IMAGE_TEXTURE_HOLDER_VK_H_