#include "third_party/blink/renderer/modules/webgpu/gpu_texture.h"
#include "base/containers/heap_array.h"
#include "gpu/command_buffer/client/webgpu_interface.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture_descriptor.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture_view_descriptor.h"
#include "third_party/blink/renderer/core/html/canvas/canvas_rendering_context.h"
#include "third_party/blink/renderer/core/html/canvas/html_canvas_element.h"
#include "third_party/blink/renderer/modules/webgpu/dawn_conversions.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_device.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_texture_usage.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_texture_view.h"
#include "third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image.h"
#include "third_party/blink/renderer/platform/graphics/canvas_resource_provider.h"
#include "third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context.h"
#include "third_party/blink/renderer/platform/graphics/gpu/webgpu_mailbox_texture.h"
#include "third_party/blink/renderer/platform/graphics/gpu/webgpu_resource_provider_cache.h"
namespace blink {
namespace {
bool ConvertToDawn(const GPUTextureDescriptor* in,
wgpu::TextureDescriptor* out,
wgpu::TextureBindingViewDimensionDescriptor*
out_texture_binding_view_dimension,
std::string* label,
base::HeapArray<wgpu::TextureFormat>* view_formats,
GPUDevice* device,
ExceptionState& exception_state) { … }
wgpu::TextureViewDescriptor AsDawnType(
const GPUTextureViewDescriptor* webgpu_desc,
std::string* label) { … }
std::string ValidateTextureMipLevelAndArrayLayerCounts(
const GPUTextureViewDescriptor* webgpu_desc) { … }
}
GPUTexture* GPUTexture::Create(GPUDevice* device,
const GPUTextureDescriptor* webgpu_desc,
ExceptionState& exception_state) { … }
GPUTexture* GPUTexture::Create(GPUDevice* device,
const wgpu::TextureDescriptor* desc) { … }
GPUTexture* GPUTexture::CreateError(GPUDevice* device,
const wgpu::TextureDescriptor* desc) { … }
GPUTexture::GPUTexture(GPUDevice* device,
wgpu::Texture texture,
const String& label)
: … { … }
GPUTexture::GPUTexture(GPUDevice* device,
wgpu::TextureFormat format,
wgpu::TextureUsage usage,
scoped_refptr<WebGPUMailboxTexture> mailbox_texture,
const String& label)
: … { … }
GPUTextureView* GPUTexture::createView(
const GPUTextureViewDescriptor* webgpu_desc,
ExceptionState& exception_state) { … }
GPUTexture::~GPUTexture() { … }
void GPUTexture::destroy() { … }
uint32_t GPUTexture::width() const { … }
uint32_t GPUTexture::height() const { … }
uint32_t GPUTexture::depthOrArrayLayers() const { … }
uint32_t GPUTexture::mipLevelCount() const { … }
uint32_t GPUTexture::sampleCount() const { … }
String GPUTexture::dimension() const { … }
String GPUTexture::format() const { … }
uint32_t GPUTexture::usage() const { … }
void GPUTexture::DissociateMailbox() { … }
scoped_refptr<WebGPUMailboxTexture> GPUTexture::GetMailboxTexture() { … }
void GPUTexture::SetBeforeDestroyCallback(base::OnceClosure callback) { … }
void GPUTexture::ClearBeforeDestroyCallback() { … }
}