#include "dawn/native/Queue.h"
#include <webgpu/webgpu.h>
#include <algorithm>
#include <cstring>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include "dawn/common/Constants.h"
#include "dawn/common/FutureUtils.h"
#include "dawn/common/ityp_span.h"
#include "dawn/native/BlitBufferToDepthStencil.h"
#include "dawn/native/Buffer.h"
#include "dawn/native/CommandBuffer.h"
#include "dawn/native/CommandEncoder.h"
#include "dawn/native/CommandValidation.h"
#include "dawn/native/Commands.h"
#include "dawn/native/CopyTextureForBrowserHelper.h"
#include "dawn/native/Device.h"
#include "dawn/native/DynamicUploader.h"
#include "dawn/native/EventManager.h"
#include "dawn/native/ExternalTexture.h"
#include "dawn/native/Instance.h"
#include "dawn/native/ObjectType_autogen.h"
#include "dawn/native/QuerySet.h"
#include "dawn/native/RenderPassEncoder.h"
#include "dawn/native/RenderPipeline.h"
#include "dawn/native/SystemEvent.h"
#include "dawn/native/Texture.h"
#include "dawn/platform/DawnPlatform.h"
#include "dawn/platform/tracing/TraceEvent.h"
#include "partition_alloc/pointers/raw_ptr.h"
namespace dawn::native {
namespace {
void CopyTextureData(uint8_t* dstPointer,
const uint8_t* srcPointer,
uint32_t depth,
uint32_t rowsPerImage,
uint64_t imageAdditionalStride,
uint32_t actualBytesPerRow,
uint32_t dstBytesPerRow,
uint32_t srcBytesPerRow) { … }
ResultOrError<UploadHandle> UploadTextureDataAligningBytesPerRowAndOffset(
DeviceBase* device,
const void* data,
uint32_t alignedBytesPerRow,
uint32_t optimallyAlignedBytesPerRow,
uint32_t alignedRowsPerImage,
const TextureDataLayout& dataLayout,
bool hasDepthOrStencil,
const TexelBlockInfo& blockInfo,
const Extent3D& writeSizePixel) { … }
struct SubmittedWorkDone : TrackTaskCallback { … };
class ErrorQueue : public QueueBase { … };
}
void TrackTaskCallback::SetFinishedSerial(ExecutionSerial serial) { … }
QueueBase::QueueBase(DeviceBase* device, const QueueDescriptor* descriptor)
: … { … }
QueueBase::QueueBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label)
: … { … }
QueueBase::~QueueBase() { … }
void QueueBase::DestroyImpl() { … }
Ref<QueueBase> QueueBase::MakeError(DeviceBase* device, const char* label) { … }
ObjectType QueueBase::GetType() const { … }
void QueueBase::FormatLabel(absl::FormatSink* s) const { … }
void QueueBase::APISubmit(uint32_t commandCount, CommandBufferBase* const* commands) { … }
void QueueBase::APIOnSubmittedWorkDone(WGPUQueueWorkDoneCallback callback, void* userdata) { … }
Future QueueBase::APIOnSubmittedWorkDoneF(const QueueWorkDoneCallbackInfo& callbackInfo) { … }
Future QueueBase::APIOnSubmittedWorkDone2(const WGPUQueueWorkDoneCallbackInfo2& callbackInfo) { … }
void QueueBase::TrackTask(std::unique_ptr<TrackTaskCallback> task, ExecutionSerial serial) { … }
void QueueBase::TrackTaskAfterEventualFlush(std::unique_ptr<TrackTaskCallback> task) { … }
void QueueBase::TrackPendingTask(std::unique_ptr<TrackTaskCallback> task) { … }
void QueueBase::Tick(ExecutionSerial finishedSerial) { … }
void QueueBase::HandleDeviceLoss() { … }
void QueueBase::APIWriteBuffer(BufferBase* buffer,
uint64_t bufferOffset,
const void* data,
size_t size) { … }
MaybeError QueueBase::WriteBuffer(BufferBase* buffer,
uint64_t bufferOffset,
const void* data,
size_t size) { … }
MaybeError QueueBase::WriteBufferImpl(BufferBase* buffer,
uint64_t bufferOffset,
const void* data,
size_t size) { … }
void QueueBase::APIWriteTexture(const ImageCopyTexture* destination,
const void* data,
size_t dataSize,
const TextureDataLayout* dataLayout,
const Extent3D* writeSize) { … }
MaybeError QueueBase::WriteTextureInternal(const ImageCopyTexture* destinationOrig,
const void* data,
size_t dataSize,
const TextureDataLayout& dataLayout,
const Extent3D* writeSize) { … }
MaybeError QueueBase::WriteTextureImpl(const ImageCopyTexture& destination,
const void* data,
size_t dataSize,
const TextureDataLayout& dataLayout,
const Extent3D& writeSizePixel) { … }
void QueueBase::APICopyTextureForBrowser(const ImageCopyTexture* source,
const ImageCopyTexture* destination,
const Extent3D* copySize,
const CopyTextureForBrowserOptions* options) { … }
void QueueBase::APICopyExternalTextureForBrowser(const ImageCopyExternalTexture* source,
const ImageCopyTexture* destination,
const Extent3D* copySize,
const CopyTextureForBrowserOptions* options) { … }
MaybeError QueueBase::CopyTextureForBrowserInternal(const ImageCopyTexture* sourceOrig,
const ImageCopyTexture* destinationOrig,
const Extent3D* copySize,
const CopyTextureForBrowserOptions* options) { … }
MaybeError QueueBase::CopyExternalTextureForBrowserInternal(
const ImageCopyExternalTexture* source,
const ImageCopyTexture* destinationOrig,
const Extent3D* copySize,
const CopyTextureForBrowserOptions* options) { … }
MaybeError QueueBase::ValidateSubmit(uint32_t commandCount,
CommandBufferBase* const* commands) const { … }
MaybeError QueueBase::ValidateOnSubmittedWorkDone(wgpu::QueueWorkDoneStatus* status) const { … }
MaybeError QueueBase::ValidateWriteTexture(const ImageCopyTexture* destination,
size_t dataSize,
const TextureDataLayout& dataLayout,
const Extent3D* writeSize) const { … }
MaybeError QueueBase::SubmitInternal(uint32_t commandCount, CommandBufferBase* const* commands) { … }
}