chromium/gpu/command_buffer/client/webgpu_implementation.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "gpu/command_buffer/client/webgpu_implementation.h"

#include <dawn/wire/client/webgpu.h>

#include <algorithm>
#include <vector>

#include "base/numerics/checked_math.h"
#include "base/run_loop.h"
#include "base/trace_event/trace_event.h"
#include "gpu/command_buffer/client/dawn_client_memory_transfer_service.h"
#include "gpu/command_buffer/client/dawn_client_serializer.h"
#include "gpu/command_buffer/client/gpu_control.h"
#include "gpu/command_buffer/client/shared_memory_limits.h"

#define GPU_CLIENT_SINGLE_THREAD_CHECK()

namespace gpu {
namespace webgpu {

#if BUILDFLAG(USE_DAWN)
DawnWireServices::~DawnWireServices() {}

DawnWireServices::DawnWireServices(
    WebGPUImplementation* webgpu_implementation,
    WebGPUCmdHelper* helper,
    MappedMemoryManager* mapped_memory,
    std::unique_ptr<TransferBuffer> transfer_buffer)
    :{}

WGPUInstance DawnWireServices::GetWGPUInstance() const {}

dawn::wire::WireClient* DawnWireServices::wire_client() {}
DawnClientSerializer* DawnWireServices::serializer() {}
DawnClientMemoryTransferService* DawnWireServices::memory_transfer_service() {}

void DawnWireServices::Disconnect() {}

bool DawnWireServices::IsDisconnected() const {}

void DawnWireServices::FreeMappedResources(WebGPUCmdHelper* helper) {}
#endif

// Include the auto-generated part of this file. We split this because it means
// we can easily edit the non-auto generated parts right here in this file
// instead of having to edit some template or the code generator.
#include "gpu/command_buffer/client/webgpu_implementation_impl_autogen.h"

WebGPUImplementation::WebGPUImplementation(
    WebGPUCmdHelper* helper,
    TransferBufferInterface* transfer_buffer,
    GpuControl* gpu_control)
    :{}

WebGPUImplementation::~WebGPUImplementation() {}

void WebGPUImplementation::LoseContext() {}

gpu::ContextResult WebGPUImplementation::Initialize(
    const SharedMemoryLimits& limits) {}

// ContextSupport implementation.
void WebGPUImplementation::SetAggressivelyFreeResources(
    bool aggressively_free_resources) {}
uint64_t WebGPUImplementation::ShareGroupTracingGUID() const {}
void WebGPUImplementation::SetErrorMessageCallback(
    base::RepeatingCallback<void(const char*, int32_t)> callback) {}
bool WebGPUImplementation::ThreadSafeShallowLockDiscardableTexture(
    uint32_t texture_id) {}
void WebGPUImplementation::CompleteLockDiscardableTexureOnContextThread(
    uint32_t texture_id) {}
bool WebGPUImplementation::ThreadsafeDiscardableTextureIsDeletedForTracing(
    uint32_t texture_id) {}
void* WebGPUImplementation::MapTransferCacheEntry(uint32_t serialized_size) {}
void WebGPUImplementation::UnmapAndCreateTransferCacheEntry(uint32_t type,
                                                            uint32_t id) {}
bool WebGPUImplementation::ThreadsafeLockTransferCacheEntry(uint32_t type,
                                                            uint32_t id) {}
void WebGPUImplementation::UnlockTransferCacheEntries(
    const std::vector<std::pair<uint32_t, uint32_t>>& entries) {}
void WebGPUImplementation::DeleteTransferCacheEntry(uint32_t type,
                                                    uint32_t id) {}
unsigned int WebGPUImplementation::GetTransferBufferFreeSize() const {}
bool WebGPUImplementation::IsJpegDecodeAccelerationSupported() const {}
bool WebGPUImplementation::IsWebPDecodeAccelerationSupported() const {}
bool WebGPUImplementation::CanDecodeWithHardwareAcceleration(
    const cc::ImageHeaderMetadata* image_metadata) const {}

// InterfaceBase implementation.
void WebGPUImplementation::GenSyncTokenCHROMIUM(GLbyte* sync_token) {}
void WebGPUImplementation::GenUnverifiedSyncTokenCHROMIUM(GLbyte* sync_token) {}
void WebGPUImplementation::VerifySyncTokensCHROMIUM(GLbyte** sync_tokens,
                                                    GLsizei count) {}
void WebGPUImplementation::WaitSyncTokenCHROMIUM(const GLbyte* sync_token) {}
void WebGPUImplementation::ShallowFlushCHROMIUM() {}

bool WebGPUImplementation::HasGrContextSupport() const {}

// ImplementationBase implementation.
void WebGPUImplementation::IssueShallowFlush() {}

void WebGPUImplementation::SetGLError(GLenum error,
                                      const char* function_name,
                                      const char* msg) {}

// GpuControlClient implementation.
void WebGPUImplementation::OnGpuControlLostContext() {}
void WebGPUImplementation::OnGpuControlLostContextMaybeReentrant() {}
void WebGPUImplementation::OnGpuControlErrorMessage(const char* message,
                                                    int32_t id) {}
void WebGPUImplementation::OnGpuControlReturnData(
    base::span<const uint8_t> data) {}

void WebGPUImplementation::FlushCommands() {}

bool WebGPUImplementation::EnsureAwaitingFlush() {}

void WebGPUImplementation::FlushAwaitingCommands() {}

scoped_refptr<APIChannel> WebGPUImplementation::GetAPIChannel() const {}

ReservedTexture WebGPUImplementation::ReserveTexture(
    WGPUDevice device,
    const WGPUTextureDescriptor* optionalDesc) {}

WGPUDevice WebGPUImplementation::DeprecatedEnsureDefaultDeviceSync() {}

void WebGPUImplementation::AssociateMailbox(
    GLuint device_id,
    GLuint device_generation,
    GLuint texture_id,
    GLuint texture_generation,
    uint64_t usage,
    uint64_t internal_usage,
    const WGPUTextureFormat* view_formats,
    GLuint view_format_count,
    MailboxFlags flags,
    const Mailbox& mailbox) {}

void WebGPUImplementation::DissociateMailbox(GLuint texture_id,
                                             GLuint texture_generation) {}

void WebGPUImplementation::DissociateMailboxForPresent(
    GLuint device_id,
    GLuint device_generation,
    GLuint texture_id,
    GLuint texture_generation) {}

void WebGPUImplementation::SetWebGPUExecutionContextToken(uint32_t type,
                                                          uint32_t high_high,
                                                          uint32_t high_low,
                                                          uint32_t low_high,
                                                          uint32_t low_low) {}

}  // namespace webgpu
}  // namespace gpu