#include "gpu/command_buffer/client/shared_image_interface.h"
#include <GLES2/gl2.h>
#include "base/functional/callback_helpers.h"
#include "base/notreached.h"
#include "gpu/command_buffer/client/client_shared_image.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
#if BUILDFLAG(IS_WIN)
#include "ui/gfx/win/d3d_shared_fence.h"
#endif
namespace gpu {
SharedImageInterface::SwapChainSharedImages::SwapChainSharedImages(
scoped_refptr<gpu::ClientSharedImage> front_buffer,
scoped_refptr<gpu::ClientSharedImage> back_buffer)
: … { … }
SharedImageInterface::SwapChainSharedImages::SwapChainSharedImages(
const SwapChainSharedImages& shared_images) = default;
SharedImageInterface::SwapChainSharedImages::~SwapChainSharedImages() = default;
SharedImageInterface::SharedImageInterface()
: … { … }
SharedImageInterface::~SharedImageInterface() = default;
scoped_refptr<ClientSharedImage> SharedImageInterface::CreateSharedImage(
const SharedImageInfo& si_info,
gpu::SurfaceHandle surface_handle,
gfx::BufferUsage buffer_usage) { … }
SharedImageUsageSet SharedImageInterface::UsageForMailbox(
const Mailbox& mailbox) { … }
scoped_refptr<ClientSharedImage>
SharedImageInterface::AddReferenceToSharedImage(
const SyncToken& sync_token,
const Mailbox& mailbox,
viz::SharedImageFormat format,
const gfx::Size& size,
const gfx::ColorSpace& color_space,
GrSurfaceOrigin surface_origin,
SkAlphaType alpha_type,
SharedImageUsageSet usage,
uint32_t texture_target) { … }
scoped_refptr<ClientSharedImage> SharedImageInterface::NotifyMailboxAdded(
const Mailbox& ,
viz::SharedImageFormat ,
const gfx::Size& ,
const gfx::ColorSpace& ,
GrSurfaceOrigin ,
SkAlphaType ,
SharedImageUsageSet ) { … }
scoped_refptr<ClientSharedImage> SharedImageInterface::NotifyMailboxAdded(
const Mailbox& ,
viz::SharedImageFormat ,
const gfx::Size& ,
const gfx::ColorSpace& ,
GrSurfaceOrigin ,
SkAlphaType ,
SharedImageUsageSet ,
uint32_t ) { … }
void SharedImageInterface::CopyToGpuMemoryBuffer(const SyncToken& sync_token,
const Mailbox& mailbox) { … }
void SharedImageInterface::CopyToGpuMemoryBufferAsync(
const SyncToken& sync_token,
const Mailbox& mailbox,
base::OnceCallback<void(bool)> callback) { … }
void SharedImageInterface::Release() const { … }
#if BUILDFLAG(IS_WIN)
void SharedImageInterface::UpdateSharedImage(
const SyncToken& sync_token,
scoped_refptr<gfx::D3DSharedFence> d3d_shared_fence,
const Mailbox& mailbox) {
NOTIMPLEMENTED_LOG_ONCE();
}
#endif
SharedImageInterface::SharedImageMapping::SharedImageMapping() = default;
SharedImageInterface::SharedImageMapping::SharedImageMapping(
SharedImageInterface::SharedImageMapping&& mapped) = default;
SharedImageInterface::SharedImageMapping::SharedImageMapping(
scoped_refptr<ClientSharedImage> shared_image,
base::WritableSharedMemoryMapping mapping)
: … { … }
SharedImageInterface::SharedImageMapping&
SharedImageInterface::SharedImageMapping::operator=(
SharedImageInterface::SharedImageMapping&& mapped) = default;
SharedImageInterface::SharedImageMapping::~SharedImageMapping() = default;
SharedImageInterfaceHolder::SharedImageInterfaceHolder(
SharedImageInterface* sii)
: … { … }
SharedImageInterfaceHolder::~SharedImageInterfaceHolder() = default;
scoped_refptr<SharedImageInterface> SharedImageInterfaceHolder::Get() { … }
void SharedImageInterfaceHolder::OnDestroy() { … }
}