#include "third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider.h"
#include "base/logging.h"
#include "build/build_config.h"
#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/client/client_shared_image.h"
#include "gpu/command_buffer/client/raster_interface.h"
#include "gpu/command_buffer/client/shared_image_interface.h"
#include "gpu/command_buffer/client/webgpu_interface.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
namespace blink {
namespace {
viz::SharedImageFormat WGPUFormatToViz(wgpu::TextureFormat format) { … }
}
WebGPUSwapBufferProvider::WebGPUSwapBufferProvider(
Client* client,
scoped_refptr<DawnControlClientHolder> dawn_control_client,
const wgpu::Device& device,
wgpu::TextureUsage usage,
wgpu::TextureUsage internal_usage,
wgpu::TextureFormat format,
PredefinedColorSpace color_space,
const gfx::HDRMetadata& hdr_metadata)
: … { … }
WebGPUSwapBufferProvider::~WebGPUSwapBufferProvider() { … }
viz::SharedImageFormat WebGPUSwapBufferProvider::Format() const { … }
const gfx::Size& WebGPUSwapBufferProvider::Size() const { … }
cc::Layer* WebGPUSwapBufferProvider::CcLayer() { … }
void WebGPUSwapBufferProvider::SetFilterQuality(
cc::PaintFlags::FilterQuality filter_quality) { … }
void WebGPUSwapBufferProvider::ReleaseWGPUTextureAccessIfNeeded() { … }
void WebGPUSwapBufferProvider::DiscardCurrentSwapBuffer() { … }
void WebGPUSwapBufferProvider::Neuter() { … }
scoped_refptr<WebGPUSwapBufferProvider::SwapBuffer>
WebGPUSwapBufferProvider::NewOrRecycledSwapBuffer(
gpu::SharedImageInterface* sii,
base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider,
const gfx::Size& size,
SkAlphaType alpha_mode) { … }
void WebGPUSwapBufferProvider::RecycleSwapBuffer(
scoped_refptr<SwapBuffer> swap_buffer) { … }
scoped_refptr<WebGPUMailboxTexture> WebGPUSwapBufferProvider::GetNewTexture(
const wgpu::TextureDescriptor& desc,
SkAlphaType alpha_mode) { … }
scoped_refptr<WebGPUMailboxTexture>
WebGPUSwapBufferProvider::GetLastWebGPUMailboxTexture() const { … }
base::WeakPtr<WebGraphicsContext3DProviderWrapper>
WebGPUSwapBufferProvider::GetContextProviderWeakPtr() const { … }
bool WebGPUSwapBufferProvider::PrepareTransferableResource(
cc::SharedBitmapIdRegistrar* bitmap_registrar,
viz::TransferableResource* out_resource,
viz::ReleaseCallback* out_release_callback) { … }
bool WebGPUSwapBufferProvider::CopyToVideoFrame(
WebGraphicsContext3DVideoFramePool* frame_pool,
SourceDrawingBuffer src_buffer,
const gfx::ColorSpace& dst_color_space,
WebGraphicsContext3DVideoFramePool::FrameReadyCallback callback) { … }
void WebGPUSwapBufferProvider::MailboxReleased(
scoped_refptr<SwapBuffer> swap_buffer,
const gpu::SyncToken& sync_token,
bool lost_resource) { … }
WebGPUSwapBufferProvider::SwapBuffer::SwapBuffer(
base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider,
scoped_refptr<gpu::ClientSharedImage> shared_image,
gpu::SyncToken creation_token,
gfx::Size size)
: … { … }
WebGPUSwapBufferProvider::SwapBuffer::~SwapBuffer() { … }
gpu::SharedImageUsageSet
WebGPUSwapBufferProvider::GetSharedImageUsagesForDisplay() { … }
scoped_refptr<gpu::ClientSharedImage>
WebGPUSwapBufferProvider::GetCurrentSharedImage() { … }
gpu::Mailbox WebGPUSwapBufferProvider::GetCurrentMailboxForTesting() const { … }
}