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
   45
   46
   47
   48

gpu / ipc / common / gpu_memory_buffer_handle_info.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_IPC_COMMON_GPU_MEMORY_BUFFER_HANDLE_INFO_H_
#define GPU_IPC_COMMON_GPU_MEMORY_BUFFER_HANDLE_INFO_H_

#include "components/viz/common/resources/shared_image_format.h"
#include "ui/gfx/buffer_types.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/gpu_memory_buffer.h"

namespace gpu {
struct GpuMemoryBufferHandleInfo {
  GpuMemoryBufferHandleInfo() = default;
  GpuMemoryBufferHandleInfo(gfx::GpuMemoryBufferHandle handle,
                            viz::SharedImageFormat format,
                            gfx::Size size,
                            gfx::BufferUsage buffer_usage)
      : handle(std::move(handle)),
        format(format),
        size(size),
        buffer_usage(buffer_usage) {}
  ~GpuMemoryBufferHandleInfo() = default;

  GpuMemoryBufferHandleInfo(const GpuMemoryBufferHandleInfo& other) {
    handle = other.handle.Clone();
    format = other.format;
    size = other.size;
    buffer_usage = other.buffer_usage;
  }

  GpuMemoryBufferHandleInfo& operator=(const GpuMemoryBufferHandleInfo& other) {
    handle = other.handle.Clone();
    format = other.format;
    size = other.size;
    buffer_usage = other.buffer_usage;
    return *this;
  }

  gfx::GpuMemoryBufferHandle handle;
  viz::SharedImageFormat format;
  gfx::Size size;
  gfx::BufferUsage buffer_usage;
};
}  // namespace gpu

#endif  // GPU_IPC_COMMON_GPU_MEMORY_BUFFER_HANDLE_INFO_H_