mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-16 20:31:20 +00:00
Remove the "Base" from pure-frontend dawn_native types
This was unnecessary verbosity. Fix this by having the ProcTable generator using type aliases so all types appear like they have "Base". BUG= Change-Id: I8c472fb924f6ce739e4e41038452381b4f727a2b Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13442 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
parent
9e7107eb96
commit
321c12255e
@ -26,6 +26,14 @@
|
||||
|
||||
namespace dawn_native {
|
||||
|
||||
// Type aliases to make all frontend types appear as if they have "Base" at the end when some
|
||||
// of them are actually pure-frontend and don't have the Base.
|
||||
using CommandEncoderBase = CommandEncoder;
|
||||
using ComputePassEncoderBase = ComputePassEncoder;
|
||||
using FenceBase = Fence;
|
||||
using RenderPassEncoderBase = RenderPassEncoder;
|
||||
using RenderBundleEncoderBase = RenderBundleEncoder;
|
||||
|
||||
namespace {
|
||||
|
||||
{% for type in by_category["object"] %}
|
||||
|
@ -19,8 +19,7 @@
|
||||
|
||||
namespace dawn_native {
|
||||
|
||||
CommandBufferBase::CommandBufferBase(CommandEncoderBase* encoder,
|
||||
const CommandBufferDescriptor*)
|
||||
CommandBufferBase::CommandBufferBase(CommandEncoder* encoder, const CommandBufferDescriptor*)
|
||||
: ObjectBase(encoder->GetDevice()), mResourceUsages(encoder->AcquireResourceUsages()) {
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace dawn_native {
|
||||
|
||||
class CommandBufferBase : public ObjectBase {
|
||||
public:
|
||||
CommandBufferBase(CommandEncoderBase* encoder, const CommandBufferDescriptor* descriptor);
|
||||
CommandBufferBase(CommandEncoder* encoder, const CommandBufferDescriptor* descriptor);
|
||||
static CommandBufferBase* MakeError(DeviceBase* device);
|
||||
|
||||
const CommandBufferResourceUsage& GetResourceUsages() const;
|
||||
|
@ -462,24 +462,23 @@ namespace dawn_native {
|
||||
|
||||
} // namespace
|
||||
|
||||
CommandEncoderBase::CommandEncoderBase(DeviceBase* device, const CommandEncoderDescriptor*)
|
||||
CommandEncoder::CommandEncoder(DeviceBase* device, const CommandEncoderDescriptor*)
|
||||
: ObjectBase(device), mEncodingContext(device, this) {
|
||||
}
|
||||
|
||||
CommandBufferResourceUsage CommandEncoderBase::AcquireResourceUsages() {
|
||||
CommandBufferResourceUsage CommandEncoder::AcquireResourceUsages() {
|
||||
ASSERT(!mWereResourceUsagesAcquired);
|
||||
mWereResourceUsagesAcquired = true;
|
||||
return std::move(mResourceUsages);
|
||||
}
|
||||
|
||||
CommandIterator CommandEncoderBase::AcquireCommands() {
|
||||
CommandIterator CommandEncoder::AcquireCommands() {
|
||||
return mEncodingContext.AcquireCommands();
|
||||
}
|
||||
|
||||
// Implementation of the API's command recording methods
|
||||
|
||||
ComputePassEncoderBase* CommandEncoderBase::BeginComputePass(
|
||||
const ComputePassDescriptor* descriptor) {
|
||||
ComputePassEncoder* CommandEncoder::BeginComputePass(const ComputePassDescriptor* descriptor) {
|
||||
DeviceBase* device = GetDevice();
|
||||
|
||||
bool success =
|
||||
@ -492,17 +491,16 @@ namespace dawn_native {
|
||||
});
|
||||
|
||||
if (success) {
|
||||
ComputePassEncoderBase* passEncoder =
|
||||
new ComputePassEncoderBase(device, this, &mEncodingContext);
|
||||
ComputePassEncoder* passEncoder =
|
||||
new ComputePassEncoder(device, this, &mEncodingContext);
|
||||
mEncodingContext.EnterPass(passEncoder);
|
||||
return passEncoder;
|
||||
}
|
||||
|
||||
return ComputePassEncoderBase::MakeError(device, this, &mEncodingContext);
|
||||
return ComputePassEncoder::MakeError(device, this, &mEncodingContext);
|
||||
}
|
||||
|
||||
RenderPassEncoderBase* CommandEncoderBase::BeginRenderPass(
|
||||
const RenderPassDescriptor* descriptor) {
|
||||
RenderPassEncoder* CommandEncoder::BeginRenderPass(const RenderPassDescriptor* descriptor) {
|
||||
DeviceBase* device = GetDevice();
|
||||
|
||||
bool success =
|
||||
@ -555,20 +553,19 @@ namespace dawn_native {
|
||||
});
|
||||
|
||||
if (success) {
|
||||
RenderPassEncoderBase* passEncoder =
|
||||
new RenderPassEncoderBase(device, this, &mEncodingContext);
|
||||
RenderPassEncoder* passEncoder = new RenderPassEncoder(device, this, &mEncodingContext);
|
||||
mEncodingContext.EnterPass(passEncoder);
|
||||
return passEncoder;
|
||||
}
|
||||
|
||||
return RenderPassEncoderBase::MakeError(device, this, &mEncodingContext);
|
||||
return RenderPassEncoder::MakeError(device, this, &mEncodingContext);
|
||||
}
|
||||
|
||||
void CommandEncoderBase::CopyBufferToBuffer(BufferBase* source,
|
||||
uint64_t sourceOffset,
|
||||
BufferBase* destination,
|
||||
uint64_t destinationOffset,
|
||||
uint64_t size) {
|
||||
void CommandEncoder::CopyBufferToBuffer(BufferBase* source,
|
||||
uint64_t sourceOffset,
|
||||
BufferBase* destination,
|
||||
uint64_t destinationOffset,
|
||||
uint64_t size) {
|
||||
mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||
DAWN_TRY(GetDevice()->ValidateObject(source));
|
||||
DAWN_TRY(GetDevice()->ValidateObject(destination));
|
||||
@ -585,9 +582,9 @@ namespace dawn_native {
|
||||
});
|
||||
}
|
||||
|
||||
void CommandEncoderBase::CopyBufferToTexture(const BufferCopyView* source,
|
||||
const TextureCopyView* destination,
|
||||
const Extent3D* copySize) {
|
||||
void CommandEncoder::CopyBufferToTexture(const BufferCopyView* source,
|
||||
const TextureCopyView* destination,
|
||||
const Extent3D* copySize) {
|
||||
mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||
DAWN_TRY(GetDevice()->ValidateObject(source->buffer));
|
||||
DAWN_TRY(GetDevice()->ValidateObject(destination->texture));
|
||||
@ -617,9 +614,9 @@ namespace dawn_native {
|
||||
});
|
||||
}
|
||||
|
||||
void CommandEncoderBase::CopyTextureToBuffer(const TextureCopyView* source,
|
||||
const BufferCopyView* destination,
|
||||
const Extent3D* copySize) {
|
||||
void CommandEncoder::CopyTextureToBuffer(const TextureCopyView* source,
|
||||
const BufferCopyView* destination,
|
||||
const Extent3D* copySize) {
|
||||
mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||
DAWN_TRY(GetDevice()->ValidateObject(source->texture));
|
||||
DAWN_TRY(GetDevice()->ValidateObject(destination->buffer));
|
||||
@ -649,9 +646,9 @@ namespace dawn_native {
|
||||
});
|
||||
}
|
||||
|
||||
void CommandEncoderBase::CopyTextureToTexture(const TextureCopyView* source,
|
||||
const TextureCopyView* destination,
|
||||
const Extent3D* copySize) {
|
||||
void CommandEncoder::CopyTextureToTexture(const TextureCopyView* source,
|
||||
const TextureCopyView* destination,
|
||||
const Extent3D* copySize) {
|
||||
mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||
DAWN_TRY(GetDevice()->ValidateObject(source->texture));
|
||||
DAWN_TRY(GetDevice()->ValidateObject(destination->texture));
|
||||
@ -672,7 +669,7 @@ namespace dawn_native {
|
||||
});
|
||||
}
|
||||
|
||||
void CommandEncoderBase::InsertDebugMarker(const char* groupLabel) {
|
||||
void CommandEncoder::InsertDebugMarker(const char* groupLabel) {
|
||||
mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||
InsertDebugMarkerCmd* cmd =
|
||||
allocator->Allocate<InsertDebugMarkerCmd>(Command::InsertDebugMarker);
|
||||
@ -685,7 +682,7 @@ namespace dawn_native {
|
||||
});
|
||||
}
|
||||
|
||||
void CommandEncoderBase::PopDebugGroup() {
|
||||
void CommandEncoder::PopDebugGroup() {
|
||||
mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||
allocator->Allocate<PopDebugGroupCmd>(Command::PopDebugGroup);
|
||||
|
||||
@ -693,7 +690,7 @@ namespace dawn_native {
|
||||
});
|
||||
}
|
||||
|
||||
void CommandEncoderBase::PushDebugGroup(const char* groupLabel) {
|
||||
void CommandEncoder::PushDebugGroup(const char* groupLabel) {
|
||||
mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||
PushDebugGroupCmd* cmd =
|
||||
allocator->Allocate<PushDebugGroupCmd>(Command::PushDebugGroup);
|
||||
@ -706,7 +703,7 @@ namespace dawn_native {
|
||||
});
|
||||
}
|
||||
|
||||
CommandBufferBase* CommandEncoderBase::Finish(const CommandBufferDescriptor* descriptor) {
|
||||
CommandBufferBase* CommandEncoder::Finish(const CommandBufferDescriptor* descriptor) {
|
||||
if (GetDevice()->ConsumedError(ValidateFinish(descriptor))) {
|
||||
// Even if finish validation fails, it is now invalid to call any encoding commands on
|
||||
// this object, so we set its state to finished.
|
||||
@ -719,8 +716,8 @@ namespace dawn_native {
|
||||
|
||||
// Implementation of the command buffer validation that can be precomputed before submit
|
||||
|
||||
MaybeError CommandEncoderBase::ValidateFinish(const CommandBufferDescriptor*) {
|
||||
TRACE_EVENT0(GetDevice()->GetPlatform(), Validation, "CommandEncoderBase::ValidateFinish");
|
||||
MaybeError CommandEncoder::ValidateFinish(const CommandBufferDescriptor*) {
|
||||
TRACE_EVENT0(GetDevice()->GetPlatform(), Validation, "CommandEncoder::ValidateFinish");
|
||||
DAWN_TRY(GetDevice()->ValidateObject(this));
|
||||
|
||||
// Even if Finish() validation fails, calling it will mutate the internal state of the
|
||||
|
@ -28,16 +28,16 @@ namespace dawn_native {
|
||||
|
||||
struct BeginRenderPassCmd;
|
||||
|
||||
class CommandEncoderBase : public ObjectBase {
|
||||
class CommandEncoder final : public ObjectBase {
|
||||
public:
|
||||
CommandEncoderBase(DeviceBase* device, const CommandEncoderDescriptor* descriptor);
|
||||
CommandEncoder(DeviceBase* device, const CommandEncoderDescriptor* descriptor);
|
||||
|
||||
CommandIterator AcquireCommands();
|
||||
CommandBufferResourceUsage AcquireResourceUsages();
|
||||
|
||||
// Dawn API
|
||||
ComputePassEncoderBase* BeginComputePass(const ComputePassDescriptor* descriptor);
|
||||
RenderPassEncoderBase* BeginRenderPass(const RenderPassDescriptor* descriptor);
|
||||
ComputePassEncoder* BeginComputePass(const ComputePassDescriptor* descriptor);
|
||||
RenderPassEncoder* BeginRenderPass(const RenderPassDescriptor* descriptor);
|
||||
|
||||
void CopyBufferToBuffer(BufferBase* source,
|
||||
uint64_t sourceOffset,
|
||||
|
@ -22,28 +22,27 @@
|
||||
|
||||
namespace dawn_native {
|
||||
|
||||
ComputePassEncoderBase::ComputePassEncoderBase(DeviceBase* device,
|
||||
CommandEncoderBase* commandEncoder,
|
||||
EncodingContext* encodingContext)
|
||||
ComputePassEncoder::ComputePassEncoder(DeviceBase* device,
|
||||
CommandEncoder* commandEncoder,
|
||||
EncodingContext* encodingContext)
|
||||
: ProgrammablePassEncoder(device, encodingContext), mCommandEncoder(commandEncoder) {
|
||||
}
|
||||
|
||||
ComputePassEncoderBase::ComputePassEncoderBase(DeviceBase* device,
|
||||
CommandEncoderBase* commandEncoder,
|
||||
EncodingContext* encodingContext,
|
||||
ErrorTag errorTag)
|
||||
ComputePassEncoder::ComputePassEncoder(DeviceBase* device,
|
||||
CommandEncoder* commandEncoder,
|
||||
EncodingContext* encodingContext,
|
||||
ErrorTag errorTag)
|
||||
: ProgrammablePassEncoder(device, encodingContext, errorTag),
|
||||
mCommandEncoder(commandEncoder) {
|
||||
}
|
||||
|
||||
ComputePassEncoderBase* ComputePassEncoderBase::MakeError(DeviceBase* device,
|
||||
CommandEncoderBase* commandEncoder,
|
||||
EncodingContext* encodingContext) {
|
||||
return new ComputePassEncoderBase(device, commandEncoder, encodingContext,
|
||||
ObjectBase::kError);
|
||||
ComputePassEncoder* ComputePassEncoder::MakeError(DeviceBase* device,
|
||||
CommandEncoder* commandEncoder,
|
||||
EncodingContext* encodingContext) {
|
||||
return new ComputePassEncoder(device, commandEncoder, encodingContext, ObjectBase::kError);
|
||||
}
|
||||
|
||||
void ComputePassEncoderBase::EndPass() {
|
||||
void ComputePassEncoder::EndPass() {
|
||||
if (mEncodingContext->TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||
allocator->Allocate<EndComputePassCmd>(Command::EndComputePass);
|
||||
|
||||
@ -53,7 +52,7 @@ namespace dawn_native {
|
||||
}
|
||||
}
|
||||
|
||||
void ComputePassEncoderBase::Dispatch(uint32_t x, uint32_t y, uint32_t z) {
|
||||
void ComputePassEncoder::Dispatch(uint32_t x, uint32_t y, uint32_t z) {
|
||||
mEncodingContext->TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||
DispatchCmd* dispatch = allocator->Allocate<DispatchCmd>(Command::Dispatch);
|
||||
dispatch->x = x;
|
||||
@ -64,8 +63,7 @@ namespace dawn_native {
|
||||
});
|
||||
}
|
||||
|
||||
void ComputePassEncoderBase::DispatchIndirect(BufferBase* indirectBuffer,
|
||||
uint64_t indirectOffset) {
|
||||
void ComputePassEncoder::DispatchIndirect(BufferBase* indirectBuffer, uint64_t indirectOffset) {
|
||||
mEncodingContext->TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||
DAWN_TRY(GetDevice()->ValidateObject(indirectBuffer));
|
||||
|
||||
@ -83,7 +81,7 @@ namespace dawn_native {
|
||||
});
|
||||
}
|
||||
|
||||
void ComputePassEncoderBase::SetPipeline(ComputePipelineBase* pipeline) {
|
||||
void ComputePassEncoder::SetPipeline(ComputePipelineBase* pipeline) {
|
||||
mEncodingContext->TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||
DAWN_TRY(GetDevice()->ValidateObject(pipeline));
|
||||
|
||||
|
@ -20,19 +20,15 @@
|
||||
|
||||
namespace dawn_native {
|
||||
|
||||
// This is called ComputePassEncoderBase to match the code generator expectations. Note that it
|
||||
// is a pure frontend type to record in its parent CommandEncoder and never has a backend
|
||||
// implementation.
|
||||
// TODO(cwallez@chromium.org): Remove that generator limitation and rename to ComputePassEncoder
|
||||
class ComputePassEncoderBase : public ProgrammablePassEncoder {
|
||||
class ComputePassEncoder final : public ProgrammablePassEncoder {
|
||||
public:
|
||||
ComputePassEncoderBase(DeviceBase* device,
|
||||
CommandEncoderBase* commandEncoder,
|
||||
EncodingContext* encodingContext);
|
||||
ComputePassEncoder(DeviceBase* device,
|
||||
CommandEncoder* commandEncoder,
|
||||
EncodingContext* encodingContext);
|
||||
|
||||
static ComputePassEncoderBase* MakeError(DeviceBase* device,
|
||||
CommandEncoderBase* commandEncoder,
|
||||
EncodingContext* encodingContext);
|
||||
static ComputePassEncoder* MakeError(DeviceBase* device,
|
||||
CommandEncoder* commandEncoder,
|
||||
EncodingContext* encodingContext);
|
||||
|
||||
void EndPass();
|
||||
|
||||
@ -41,15 +37,15 @@ namespace dawn_native {
|
||||
void SetPipeline(ComputePipelineBase* pipeline);
|
||||
|
||||
protected:
|
||||
ComputePassEncoderBase(DeviceBase* device,
|
||||
CommandEncoderBase* commandEncoder,
|
||||
EncodingContext* encodingContext,
|
||||
ErrorTag errorTag);
|
||||
ComputePassEncoder(DeviceBase* device,
|
||||
CommandEncoder* commandEncoder,
|
||||
EncodingContext* encodingContext,
|
||||
ErrorTag errorTag);
|
||||
|
||||
private:
|
||||
// For render and compute passes, the encoding context is borrowed from the command encoder.
|
||||
// Keep a reference to the encoder to make sure the context isn't freed.
|
||||
Ref<CommandEncoderBase> mCommandEncoder;
|
||||
Ref<CommandEncoder> mCommandEncoder;
|
||||
};
|
||||
|
||||
} // namespace dawn_native
|
||||
|
@ -445,9 +445,8 @@ namespace dawn_native {
|
||||
// The callback is deferred so it matches the async behavior of WebGPU.
|
||||
mDeferredCreateBufferMappedAsyncResults.push_back(deferred_info);
|
||||
}
|
||||
CommandEncoderBase* DeviceBase::CreateCommandEncoder(
|
||||
const CommandEncoderDescriptor* descriptor) {
|
||||
return new CommandEncoderBase(this, descriptor);
|
||||
CommandEncoder* DeviceBase::CreateCommandEncoder(const CommandEncoderDescriptor* descriptor) {
|
||||
return new CommandEncoder(this, descriptor);
|
||||
}
|
||||
ComputePipelineBase* DeviceBase::CreateComputePipeline(
|
||||
const ComputePipelineDescriptor* descriptor) {
|
||||
@ -490,12 +489,12 @@ namespace dawn_native {
|
||||
|
||||
return result;
|
||||
}
|
||||
RenderBundleEncoderBase* DeviceBase::CreateRenderBundleEncoder(
|
||||
RenderBundleEncoder* DeviceBase::CreateRenderBundleEncoder(
|
||||
const RenderBundleEncoderDescriptor* descriptor) {
|
||||
RenderBundleEncoderBase* result = nullptr;
|
||||
RenderBundleEncoder* result = nullptr;
|
||||
|
||||
if (ConsumedError(CreateRenderBundleEncoderInternal(&result, descriptor))) {
|
||||
return RenderBundleEncoderBase::MakeError(this);
|
||||
return RenderBundleEncoder::MakeError(this);
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -677,10 +676,10 @@ namespace dawn_native {
|
||||
}
|
||||
|
||||
MaybeError DeviceBase::CreateRenderBundleEncoderInternal(
|
||||
RenderBundleEncoderBase** result,
|
||||
RenderBundleEncoder** result,
|
||||
const RenderBundleEncoderDescriptor* descriptor) {
|
||||
DAWN_TRY(ValidateRenderBundleEncoderDescriptor(this, descriptor));
|
||||
*result = new RenderBundleEncoderBase(this, descriptor);
|
||||
*result = new RenderBundleEncoder(this, descriptor);
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ namespace dawn_native {
|
||||
const Format& GetValidInternalFormat(wgpu::TextureFormat format) const;
|
||||
|
||||
virtual CommandBufferBase* CreateCommandBuffer(
|
||||
CommandEncoderBase* encoder,
|
||||
CommandEncoder* encoder,
|
||||
const CommandBufferDescriptor* descriptor) = 0;
|
||||
|
||||
virtual Serial GetCompletedCommandSerial() const = 0;
|
||||
@ -145,11 +145,11 @@ namespace dawn_native {
|
||||
void CreateBufferMappedAsync(const BufferDescriptor* descriptor,
|
||||
wgpu::BufferCreateMappedCallback callback,
|
||||
void* userdata);
|
||||
CommandEncoderBase* CreateCommandEncoder(const CommandEncoderDescriptor* descriptor);
|
||||
CommandEncoder* CreateCommandEncoder(const CommandEncoderDescriptor* descriptor);
|
||||
ComputePipelineBase* CreateComputePipeline(const ComputePipelineDescriptor* descriptor);
|
||||
PipelineLayoutBase* CreatePipelineLayout(const PipelineLayoutDescriptor* descriptor);
|
||||
QueueBase* CreateQueue();
|
||||
RenderBundleEncoderBase* CreateRenderBundleEncoder(
|
||||
RenderBundleEncoder* CreateRenderBundleEncoder(
|
||||
const RenderBundleEncoderDescriptor* descriptor);
|
||||
RenderPipelineBase* CreateRenderPipeline(const RenderPipelineDescriptor* descriptor);
|
||||
SamplerBase* CreateSampler(const SamplerDescriptor* descriptor);
|
||||
@ -230,7 +230,7 @@ namespace dawn_native {
|
||||
const PipelineLayoutDescriptor* descriptor);
|
||||
MaybeError CreateQueueInternal(QueueBase** result);
|
||||
MaybeError CreateRenderBundleEncoderInternal(
|
||||
RenderBundleEncoderBase** result,
|
||||
RenderBundleEncoder** result,
|
||||
const RenderBundleEncoderDescriptor* descriptor);
|
||||
MaybeError CreateRenderPipelineInternal(RenderPipelineBase** result,
|
||||
const RenderPipelineDescriptor* descriptor);
|
||||
|
@ -33,17 +33,17 @@ namespace dawn_native {
|
||||
|
||||
// Fence
|
||||
|
||||
FenceBase::FenceBase(QueueBase* queue, const FenceDescriptor* descriptor)
|
||||
Fence::Fence(QueueBase* queue, const FenceDescriptor* descriptor)
|
||||
: ObjectBase(queue->GetDevice()),
|
||||
mSignalValue(descriptor->initialValue),
|
||||
mCompletedValue(descriptor->initialValue),
|
||||
mQueue(queue) {
|
||||
}
|
||||
|
||||
FenceBase::FenceBase(DeviceBase* device, ObjectBase::ErrorTag tag) : ObjectBase(device, tag) {
|
||||
Fence::Fence(DeviceBase* device, ObjectBase::ErrorTag tag) : ObjectBase(device, tag) {
|
||||
}
|
||||
|
||||
FenceBase::~FenceBase() {
|
||||
Fence::~Fence() {
|
||||
for (auto& request : mRequests.IterateAll()) {
|
||||
ASSERT(!IsError());
|
||||
request.completionCallback(WGPUFenceCompletionStatus_Unknown, request.userdata);
|
||||
@ -52,20 +52,20 @@ namespace dawn_native {
|
||||
}
|
||||
|
||||
// static
|
||||
FenceBase* FenceBase::MakeError(DeviceBase* device) {
|
||||
return new FenceBase(device, ObjectBase::kError);
|
||||
Fence* Fence::MakeError(DeviceBase* device) {
|
||||
return new Fence(device, ObjectBase::kError);
|
||||
}
|
||||
|
||||
uint64_t FenceBase::GetCompletedValue() const {
|
||||
uint64_t Fence::GetCompletedValue() const {
|
||||
if (IsError()) {
|
||||
return 0;
|
||||
}
|
||||
return mCompletedValue;
|
||||
}
|
||||
|
||||
void FenceBase::OnCompletion(uint64_t value,
|
||||
wgpu::FenceOnCompletionCallback callback,
|
||||
void* userdata) {
|
||||
void Fence::OnCompletion(uint64_t value,
|
||||
wgpu::FenceOnCompletionCallback callback,
|
||||
void* userdata) {
|
||||
if (GetDevice()->ConsumedError(ValidateOnCompletion(value))) {
|
||||
callback(WGPUFenceCompletionStatus_Error, userdata);
|
||||
return;
|
||||
@ -83,23 +83,23 @@ namespace dawn_native {
|
||||
mRequests.Enqueue(std::move(request), value);
|
||||
}
|
||||
|
||||
uint64_t FenceBase::GetSignaledValue() const {
|
||||
uint64_t Fence::GetSignaledValue() const {
|
||||
ASSERT(!IsError());
|
||||
return mSignalValue;
|
||||
}
|
||||
|
||||
const QueueBase* FenceBase::GetQueue() const {
|
||||
const QueueBase* Fence::GetQueue() const {
|
||||
ASSERT(!IsError());
|
||||
return mQueue.Get();
|
||||
}
|
||||
|
||||
void FenceBase::SetSignaledValue(uint64_t signalValue) {
|
||||
void Fence::SetSignaledValue(uint64_t signalValue) {
|
||||
ASSERT(!IsError());
|
||||
ASSERT(signalValue > mSignalValue);
|
||||
mSignalValue = signalValue;
|
||||
}
|
||||
|
||||
void FenceBase::SetCompletedValue(uint64_t completedValue) {
|
||||
void Fence::SetCompletedValue(uint64_t completedValue) {
|
||||
ASSERT(!IsError());
|
||||
ASSERT(completedValue <= mSignalValue);
|
||||
ASSERT(completedValue > mCompletedValue);
|
||||
@ -111,7 +111,7 @@ namespace dawn_native {
|
||||
mRequests.ClearUpTo(mCompletedValue);
|
||||
}
|
||||
|
||||
MaybeError FenceBase::ValidateOnCompletion(uint64_t value) const {
|
||||
MaybeError Fence::ValidateOnCompletion(uint64_t value) const {
|
||||
DAWN_TRY(GetDevice()->ValidateObject(this));
|
||||
if (value > mSignalValue) {
|
||||
return DAWN_VALIDATION_ERROR("Value greater than fence signaled value");
|
||||
|
@ -28,12 +28,12 @@ namespace dawn_native {
|
||||
|
||||
MaybeError ValidateFenceDescriptor(const FenceDescriptor* descriptor);
|
||||
|
||||
class FenceBase : public ObjectBase {
|
||||
class Fence final : public ObjectBase {
|
||||
public:
|
||||
FenceBase(QueueBase* queue, const FenceDescriptor* descriptor);
|
||||
~FenceBase();
|
||||
Fence(QueueBase* queue, const FenceDescriptor* descriptor);
|
||||
~Fence();
|
||||
|
||||
static FenceBase* MakeError(DeviceBase* device);
|
||||
static Fence* MakeError(DeviceBase* device);
|
||||
|
||||
uint64_t GetSignaledValue() const;
|
||||
const QueueBase* GetQueue() const;
|
||||
@ -49,7 +49,7 @@ namespace dawn_native {
|
||||
void SetCompletedValue(uint64_t completedValue);
|
||||
|
||||
private:
|
||||
FenceBase(DeviceBase* device, ObjectBase::ErrorTag tag);
|
||||
Fence(DeviceBase* device, ObjectBase::ErrorTag tag);
|
||||
|
||||
MaybeError ValidateOnCompletion(uint64_t value) const;
|
||||
|
||||
|
@ -26,7 +26,7 @@ namespace dawn_native {
|
||||
ASSERT(mFencesInFlight.Empty());
|
||||
}
|
||||
|
||||
void FenceSignalTracker::UpdateFenceOnComplete(FenceBase* fence, uint64_t value) {
|
||||
void FenceSignalTracker::UpdateFenceOnComplete(Fence* fence, uint64_t value) {
|
||||
// Because we currently only have a single queue, we can simply update
|
||||
// the fence completed value once the last submitted serial has passed.
|
||||
mFencesInFlight.Enqueue(FenceInFlight{fence, value},
|
||||
|
@ -21,11 +21,11 @@
|
||||
namespace dawn_native {
|
||||
|
||||
class DeviceBase;
|
||||
class FenceBase;
|
||||
class Fence;
|
||||
|
||||
class FenceSignalTracker {
|
||||
struct FenceInFlight {
|
||||
Ref<FenceBase> fence;
|
||||
Ref<Fence> fence;
|
||||
uint64_t value;
|
||||
};
|
||||
|
||||
@ -33,7 +33,7 @@ namespace dawn_native {
|
||||
FenceSignalTracker(DeviceBase* device);
|
||||
~FenceSignalTracker();
|
||||
|
||||
void UpdateFenceOnComplete(FenceBase* fence, uint64_t value);
|
||||
void UpdateFenceOnComplete(Fence* fence, uint64_t value);
|
||||
|
||||
void Tick(Serial finishedSerial);
|
||||
|
||||
|
@ -25,16 +25,16 @@ namespace dawn_native {
|
||||
class BufferBase;
|
||||
class ComputePipelineBase;
|
||||
class CommandBufferBase;
|
||||
class CommandEncoderBase;
|
||||
class ComputePassEncoderBase;
|
||||
class FenceBase;
|
||||
class CommandEncoder;
|
||||
class ComputePassEncoder;
|
||||
class Fence;
|
||||
class InstanceBase;
|
||||
class PipelineBase;
|
||||
class PipelineLayoutBase;
|
||||
class QueueBase;
|
||||
class RenderBundleBase;
|
||||
class RenderBundleEncoderBase;
|
||||
class RenderPassEncoderBase;
|
||||
class RenderBundleEncoder;
|
||||
class RenderPassEncoder;
|
||||
class RenderPipelineBase;
|
||||
class ResourceHeapBase;
|
||||
class SamplerBase;
|
||||
|
@ -47,7 +47,7 @@ namespace dawn_native {
|
||||
device->GetCurrentErrorScope());
|
||||
}
|
||||
|
||||
void QueueBase::Signal(FenceBase* fence, uint64_t signalValue) {
|
||||
void QueueBase::Signal(Fence* fence, uint64_t signalValue) {
|
||||
DeviceBase* device = GetDevice();
|
||||
if (device->ConsumedError(ValidateSignal(fence, signalValue))) {
|
||||
return;
|
||||
@ -60,12 +60,12 @@ namespace dawn_native {
|
||||
device->GetCurrentErrorScope());
|
||||
}
|
||||
|
||||
FenceBase* QueueBase::CreateFence(const FenceDescriptor* descriptor) {
|
||||
Fence* QueueBase::CreateFence(const FenceDescriptor* descriptor) {
|
||||
if (GetDevice()->ConsumedError(ValidateCreateFence(descriptor))) {
|
||||
return FenceBase::MakeError(GetDevice());
|
||||
return Fence::MakeError(GetDevice());
|
||||
}
|
||||
|
||||
return new FenceBase(this, descriptor);
|
||||
return new Fence(this, descriptor);
|
||||
}
|
||||
|
||||
MaybeError QueueBase::ValidateSubmit(uint32_t commandCount,
|
||||
@ -98,7 +98,7 @@ namespace dawn_native {
|
||||
return {};
|
||||
}
|
||||
|
||||
MaybeError QueueBase::ValidateSignal(const FenceBase* fence, uint64_t signalValue) {
|
||||
MaybeError QueueBase::ValidateSignal(const Fence* fence, uint64_t signalValue) {
|
||||
DAWN_TRY(GetDevice()->ValidateObject(this));
|
||||
DAWN_TRY(GetDevice()->ValidateObject(fence));
|
||||
|
||||
|
@ -29,15 +29,15 @@ namespace dawn_native {
|
||||
|
||||
// Dawn API
|
||||
void Submit(uint32_t commandCount, CommandBufferBase* const* commands);
|
||||
void Signal(FenceBase* fence, uint64_t signalValue);
|
||||
FenceBase* CreateFence(const FenceDescriptor* descriptor);
|
||||
void Signal(Fence* fence, uint64_t signalValue);
|
||||
Fence* CreateFence(const FenceDescriptor* descriptor);
|
||||
|
||||
private:
|
||||
virtual MaybeError SubmitImpl(uint32_t commandCount,
|
||||
CommandBufferBase* const* commands) = 0;
|
||||
|
||||
MaybeError ValidateSubmit(uint32_t commandCount, CommandBufferBase* const* commands);
|
||||
MaybeError ValidateSignal(const FenceBase* fence, uint64_t signalValue);
|
||||
MaybeError ValidateSignal(const Fence* fence, uint64_t signalValue);
|
||||
MaybeError ValidateCreateFence(const FenceDescriptor* descriptor);
|
||||
};
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
namespace dawn_native {
|
||||
|
||||
RenderBundleBase::RenderBundleBase(RenderBundleEncoderBase* encoder,
|
||||
RenderBundleBase::RenderBundleBase(RenderBundleEncoder* encoder,
|
||||
const RenderBundleDescriptor* descriptor,
|
||||
AttachmentState* attachmentState,
|
||||
PassResourceUsage resourceUsage)
|
||||
|
@ -30,11 +30,11 @@ namespace dawn_native {
|
||||
|
||||
struct BeginRenderPassCmd;
|
||||
struct RenderBundleDescriptor;
|
||||
class RenderBundleEncoderBase;
|
||||
class RenderBundleEncoder;
|
||||
|
||||
class RenderBundleBase : public ObjectBase {
|
||||
public:
|
||||
RenderBundleBase(RenderBundleEncoderBase* encoder,
|
||||
RenderBundleBase(RenderBundleEncoder* encoder,
|
||||
const RenderBundleDescriptor* descriptor,
|
||||
AttachmentState* attachmentState,
|
||||
PassResourceUsage resourceUsage);
|
||||
|
@ -77,32 +77,31 @@ namespace dawn_native {
|
||||
return {};
|
||||
}
|
||||
|
||||
RenderBundleEncoderBase::RenderBundleEncoderBase(
|
||||
DeviceBase* device,
|
||||
const RenderBundleEncoderDescriptor* descriptor)
|
||||
RenderBundleEncoder::RenderBundleEncoder(DeviceBase* device,
|
||||
const RenderBundleEncoderDescriptor* descriptor)
|
||||
: RenderEncoderBase(device, &mEncodingContext),
|
||||
mEncodingContext(device, this),
|
||||
mAttachmentState(device->GetOrCreateAttachmentState(descriptor)) {
|
||||
}
|
||||
|
||||
RenderBundleEncoderBase::RenderBundleEncoderBase(DeviceBase* device, ErrorTag errorTag)
|
||||
RenderBundleEncoder::RenderBundleEncoder(DeviceBase* device, ErrorTag errorTag)
|
||||
: RenderEncoderBase(device, &mEncodingContext, errorTag), mEncodingContext(device, this) {
|
||||
}
|
||||
|
||||
// static
|
||||
RenderBundleEncoderBase* RenderBundleEncoderBase::MakeError(DeviceBase* device) {
|
||||
return new RenderBundleEncoderBase(device, ObjectBase::kError);
|
||||
RenderBundleEncoder* RenderBundleEncoder::MakeError(DeviceBase* device) {
|
||||
return new RenderBundleEncoder(device, ObjectBase::kError);
|
||||
}
|
||||
|
||||
const AttachmentState* RenderBundleEncoderBase::GetAttachmentState() const {
|
||||
const AttachmentState* RenderBundleEncoder::GetAttachmentState() const {
|
||||
return mAttachmentState.Get();
|
||||
}
|
||||
|
||||
CommandIterator RenderBundleEncoderBase::AcquireCommands() {
|
||||
CommandIterator RenderBundleEncoder::AcquireCommands() {
|
||||
return mEncodingContext.AcquireCommands();
|
||||
}
|
||||
|
||||
RenderBundleBase* RenderBundleEncoderBase::Finish(const RenderBundleDescriptor* descriptor) {
|
||||
RenderBundleBase* RenderBundleEncoder::Finish(const RenderBundleDescriptor* descriptor) {
|
||||
if (GetDevice()->ConsumedError(ValidateFinish(descriptor))) {
|
||||
return RenderBundleBase::MakeError(GetDevice());
|
||||
}
|
||||
@ -112,9 +111,8 @@ namespace dawn_native {
|
||||
std::move(mResourceUsage));
|
||||
}
|
||||
|
||||
MaybeError RenderBundleEncoderBase::ValidateFinish(const RenderBundleDescriptor* descriptor) {
|
||||
TRACE_EVENT0(GetDevice()->GetPlatform(), Validation,
|
||||
"RenderBundleEncoderBase::ValidateFinish");
|
||||
MaybeError RenderBundleEncoder::ValidateFinish(const RenderBundleDescriptor* descriptor) {
|
||||
TRACE_EVENT0(GetDevice()->GetPlatform(), Validation, "RenderBundleEncoder::ValidateFinish");
|
||||
DAWN_TRY(GetDevice()->ValidateObject(this));
|
||||
|
||||
// Even if Finish() validation fails, calling it will mutate the internal state of the
|
||||
|
@ -26,12 +26,12 @@ namespace dawn_native {
|
||||
MaybeError ValidateRenderBundleEncoderDescriptor(
|
||||
const DeviceBase* device,
|
||||
const RenderBundleEncoderDescriptor* descriptor);
|
||||
class RenderBundleEncoderBase : public RenderEncoderBase {
|
||||
public:
|
||||
RenderBundleEncoderBase(DeviceBase* device,
|
||||
const RenderBundleEncoderDescriptor* descriptor);
|
||||
|
||||
static RenderBundleEncoderBase* MakeError(DeviceBase* device);
|
||||
class RenderBundleEncoder final : public RenderEncoderBase {
|
||||
public:
|
||||
RenderBundleEncoder(DeviceBase* device, const RenderBundleEncoderDescriptor* descriptor);
|
||||
|
||||
static RenderBundleEncoder* MakeError(DeviceBase* device);
|
||||
|
||||
const AttachmentState* GetAttachmentState() const;
|
||||
|
||||
@ -40,7 +40,7 @@ namespace dawn_native {
|
||||
CommandIterator AcquireCommands();
|
||||
|
||||
private:
|
||||
RenderBundleEncoderBase(DeviceBase* device, ErrorTag errorTag);
|
||||
RenderBundleEncoder(DeviceBase* device, ErrorTag errorTag);
|
||||
|
||||
MaybeError ValidateFinish(const RenderBundleDescriptor* descriptor);
|
||||
|
||||
|
@ -27,27 +27,26 @@
|
||||
|
||||
namespace dawn_native {
|
||||
|
||||
RenderPassEncoderBase::RenderPassEncoderBase(DeviceBase* device,
|
||||
CommandEncoderBase* commandEncoder,
|
||||
EncodingContext* encodingContext)
|
||||
RenderPassEncoder::RenderPassEncoder(DeviceBase* device,
|
||||
CommandEncoder* commandEncoder,
|
||||
EncodingContext* encodingContext)
|
||||
: RenderEncoderBase(device, encodingContext), mCommandEncoder(commandEncoder) {
|
||||
}
|
||||
|
||||
RenderPassEncoderBase::RenderPassEncoderBase(DeviceBase* device,
|
||||
CommandEncoderBase* commandEncoder,
|
||||
EncodingContext* encodingContext,
|
||||
ErrorTag errorTag)
|
||||
RenderPassEncoder::RenderPassEncoder(DeviceBase* device,
|
||||
CommandEncoder* commandEncoder,
|
||||
EncodingContext* encodingContext,
|
||||
ErrorTag errorTag)
|
||||
: RenderEncoderBase(device, encodingContext, errorTag), mCommandEncoder(commandEncoder) {
|
||||
}
|
||||
|
||||
RenderPassEncoderBase* RenderPassEncoderBase::MakeError(DeviceBase* device,
|
||||
CommandEncoderBase* commandEncoder,
|
||||
EncodingContext* encodingContext) {
|
||||
return new RenderPassEncoderBase(device, commandEncoder, encodingContext,
|
||||
ObjectBase::kError);
|
||||
RenderPassEncoder* RenderPassEncoder::MakeError(DeviceBase* device,
|
||||
CommandEncoder* commandEncoder,
|
||||
EncodingContext* encodingContext) {
|
||||
return new RenderPassEncoder(device, commandEncoder, encodingContext, ObjectBase::kError);
|
||||
}
|
||||
|
||||
void RenderPassEncoderBase::EndPass() {
|
||||
void RenderPassEncoder::EndPass() {
|
||||
if (mEncodingContext->TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||
allocator->Allocate<EndRenderPassCmd>(Command::EndRenderPass);
|
||||
|
||||
@ -57,7 +56,7 @@ namespace dawn_native {
|
||||
}
|
||||
}
|
||||
|
||||
void RenderPassEncoderBase::SetStencilReference(uint32_t reference) {
|
||||
void RenderPassEncoder::SetStencilReference(uint32_t reference) {
|
||||
mEncodingContext->TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||
SetStencilReferenceCmd* cmd =
|
||||
allocator->Allocate<SetStencilReferenceCmd>(Command::SetStencilReference);
|
||||
@ -67,7 +66,7 @@ namespace dawn_native {
|
||||
});
|
||||
}
|
||||
|
||||
void RenderPassEncoderBase::SetBlendColor(const Color* color) {
|
||||
void RenderPassEncoder::SetBlendColor(const Color* color) {
|
||||
mEncodingContext->TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||
SetBlendColorCmd* cmd = allocator->Allocate<SetBlendColorCmd>(Command::SetBlendColor);
|
||||
cmd->color = *color;
|
||||
@ -76,12 +75,12 @@ namespace dawn_native {
|
||||
});
|
||||
}
|
||||
|
||||
void RenderPassEncoderBase::SetViewport(float x,
|
||||
float y,
|
||||
float width,
|
||||
float height,
|
||||
float minDepth,
|
||||
float maxDepth) {
|
||||
void RenderPassEncoder::SetViewport(float x,
|
||||
float y,
|
||||
float width,
|
||||
float height,
|
||||
float minDepth,
|
||||
float maxDepth) {
|
||||
mEncodingContext->TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||
if ((isnan(x) || isnan(y) || isnan(width) || isnan(height) || isnan(minDepth) ||
|
||||
isnan(maxDepth))) {
|
||||
@ -111,10 +110,10 @@ namespace dawn_native {
|
||||
});
|
||||
}
|
||||
|
||||
void RenderPassEncoderBase::SetScissorRect(uint32_t x,
|
||||
uint32_t y,
|
||||
uint32_t width,
|
||||
uint32_t height) {
|
||||
void RenderPassEncoder::SetScissorRect(uint32_t x,
|
||||
uint32_t y,
|
||||
uint32_t width,
|
||||
uint32_t height) {
|
||||
mEncodingContext->TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||
if (width == 0 || height == 0) {
|
||||
return DAWN_VALIDATION_ERROR("Width and height must be greater than 0.");
|
||||
@ -131,8 +130,7 @@ namespace dawn_native {
|
||||
});
|
||||
}
|
||||
|
||||
void RenderPassEncoderBase::ExecuteBundles(uint32_t count,
|
||||
RenderBundleBase* const* renderBundles) {
|
||||
void RenderPassEncoder::ExecuteBundles(uint32_t count, RenderBundleBase* const* renderBundles) {
|
||||
mEncodingContext->TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
DAWN_TRY(GetDevice()->ValidateObject(renderBundles[i]));
|
||||
|
@ -22,19 +22,15 @@ namespace dawn_native {
|
||||
|
||||
class RenderBundleBase;
|
||||
|
||||
// This is called RenderPassEncoderBase to match the code generator expectations. Note that it
|
||||
// is a pure frontend type to record in its parent CommandEncoder and never has a backend
|
||||
// implementation.
|
||||
// TODO(cwallez@chromium.org): Remove that generator limitation and rename to RenderPassEncoder
|
||||
class RenderPassEncoderBase : public RenderEncoderBase {
|
||||
class RenderPassEncoder final : public RenderEncoderBase {
|
||||
public:
|
||||
RenderPassEncoderBase(DeviceBase* device,
|
||||
CommandEncoderBase* commandEncoder,
|
||||
EncodingContext* encodingContext);
|
||||
RenderPassEncoder(DeviceBase* device,
|
||||
CommandEncoder* commandEncoder,
|
||||
EncodingContext* encodingContext);
|
||||
|
||||
static RenderPassEncoderBase* MakeError(DeviceBase* device,
|
||||
CommandEncoderBase* commandEncoder,
|
||||
EncodingContext* encodingContext);
|
||||
static RenderPassEncoder* MakeError(DeviceBase* device,
|
||||
CommandEncoder* commandEncoder,
|
||||
EncodingContext* encodingContext);
|
||||
|
||||
void EndPass();
|
||||
|
||||
@ -50,15 +46,15 @@ namespace dawn_native {
|
||||
void ExecuteBundles(uint32_t count, RenderBundleBase* const* renderBundles);
|
||||
|
||||
protected:
|
||||
RenderPassEncoderBase(DeviceBase* device,
|
||||
CommandEncoderBase* commandEncoder,
|
||||
EncodingContext* encodingContext,
|
||||
ErrorTag errorTag);
|
||||
RenderPassEncoder(DeviceBase* device,
|
||||
CommandEncoder* commandEncoder,
|
||||
EncodingContext* encodingContext,
|
||||
ErrorTag errorTag);
|
||||
|
||||
private:
|
||||
// For render and compute passes, the encoding context is borrowed from the command encoder.
|
||||
// Keep a reference to the encoder to make sure the context isn't freed.
|
||||
Ref<CommandEncoderBase> mCommandEncoder;
|
||||
Ref<CommandEncoder> mCommandEncoder;
|
||||
};
|
||||
|
||||
} // namespace dawn_native
|
||||
|
@ -28,7 +28,7 @@ namespace dawn_native {
|
||||
struct BeginRenderPassCmd;
|
||||
|
||||
class DeviceBase;
|
||||
class RenderBundleEncoderBase;
|
||||
class RenderBundleEncoder;
|
||||
|
||||
MaybeError ValidateRenderPipelineDescriptor(const DeviceBase* device,
|
||||
const RenderPipelineDescriptor* descriptor);
|
||||
|
@ -566,8 +566,7 @@ namespace dawn_native { namespace d3d12 {
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
CommandBuffer::CommandBuffer(CommandEncoderBase* encoder,
|
||||
const CommandBufferDescriptor* descriptor)
|
||||
CommandBuffer::CommandBuffer(CommandEncoder* encoder, const CommandBufferDescriptor* descriptor)
|
||||
: CommandBufferBase(encoder, descriptor), mCommands(encoder->AcquireCommands()) {
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ namespace dawn_native { namespace d3d12 {
|
||||
|
||||
class CommandBuffer : public CommandBufferBase {
|
||||
public:
|
||||
CommandBuffer(CommandEncoderBase* encoder, const CommandBufferDescriptor* descriptor);
|
||||
CommandBuffer(CommandEncoder* encoder, const CommandBufferDescriptor* descriptor);
|
||||
~CommandBuffer();
|
||||
|
||||
MaybeError RecordCommands(CommandRecordingContext* commandContext, uint32_t indexInSubmit);
|
||||
|
@ -250,7 +250,7 @@ namespace dawn_native { namespace d3d12 {
|
||||
DAWN_TRY(buffer->Initialize());
|
||||
return buffer.release();
|
||||
}
|
||||
CommandBufferBase* Device::CreateCommandBuffer(CommandEncoderBase* encoder,
|
||||
CommandBufferBase* Device::CreateCommandBuffer(CommandEncoder* encoder,
|
||||
const CommandBufferDescriptor* descriptor) {
|
||||
return new CommandBuffer(encoder, descriptor);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ namespace dawn_native { namespace d3d12 {
|
||||
|
||||
MaybeError Initialize();
|
||||
|
||||
CommandBufferBase* CreateCommandBuffer(CommandEncoderBase* encoder,
|
||||
CommandBufferBase* CreateCommandBuffer(CommandEncoder* encoder,
|
||||
const CommandBufferDescriptor* descriptor) override;
|
||||
|
||||
Serial GetCompletedCommandSerial() const final override;
|
||||
|
@ -21,7 +21,7 @@
|
||||
#import <Metal/Metal.h>
|
||||
|
||||
namespace dawn_native {
|
||||
class CommandEncoderBase;
|
||||
class CommandEncoder;
|
||||
}
|
||||
|
||||
namespace dawn_native { namespace metal {
|
||||
@ -31,7 +31,7 @@ namespace dawn_native { namespace metal {
|
||||
|
||||
class CommandBuffer : public CommandBufferBase {
|
||||
public:
|
||||
CommandBuffer(CommandEncoderBase* encoder, const CommandBufferDescriptor* descriptor);
|
||||
CommandBuffer(CommandEncoder* encoder, const CommandBufferDescriptor* descriptor);
|
||||
~CommandBuffer();
|
||||
|
||||
void FillCommands(id<MTLCommandBuffer> commandBuffer);
|
||||
|
@ -591,8 +591,7 @@ namespace dawn_native { namespace metal {
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
CommandBuffer::CommandBuffer(CommandEncoderBase* encoder,
|
||||
const CommandBufferDescriptor* descriptor)
|
||||
CommandBuffer::CommandBuffer(CommandEncoder* encoder, const CommandBufferDescriptor* descriptor)
|
||||
: CommandBufferBase(encoder, descriptor), mCommands(encoder->AcquireCommands()) {
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ namespace dawn_native { namespace metal {
|
||||
Device(AdapterBase* adapter, id<MTLDevice> mtlDevice, const DeviceDescriptor* descriptor);
|
||||
~Device();
|
||||
|
||||
CommandBufferBase* CreateCommandBuffer(CommandEncoderBase* encoder,
|
||||
CommandBufferBase* CreateCommandBuffer(CommandEncoder* encoder,
|
||||
const CommandBufferDescriptor* descriptor) override;
|
||||
|
||||
Serial GetCompletedCommandSerial() const final override;
|
||||
|
@ -105,7 +105,7 @@ namespace dawn_native { namespace metal {
|
||||
ResultOrError<BufferBase*> Device::CreateBufferImpl(const BufferDescriptor* descriptor) {
|
||||
return new Buffer(this, descriptor);
|
||||
}
|
||||
CommandBufferBase* Device::CreateCommandBuffer(CommandEncoderBase* encoder,
|
||||
CommandBufferBase* Device::CreateCommandBuffer(CommandEncoder* encoder,
|
||||
const CommandBufferDescriptor* descriptor) {
|
||||
return new CommandBuffer(encoder, descriptor);
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ namespace dawn_native { namespace null {
|
||||
DAWN_TRY(IncrementMemoryUsage(descriptor->size));
|
||||
return new Buffer(this, descriptor);
|
||||
}
|
||||
CommandBufferBase* Device::CreateCommandBuffer(CommandEncoderBase* encoder,
|
||||
CommandBufferBase* Device::CreateCommandBuffer(CommandEncoder* encoder,
|
||||
const CommandBufferDescriptor* descriptor) {
|
||||
return new CommandBuffer(encoder, descriptor);
|
||||
}
|
||||
@ -302,8 +302,7 @@ namespace dawn_native { namespace null {
|
||||
|
||||
// CommandBuffer
|
||||
|
||||
CommandBuffer::CommandBuffer(CommandEncoderBase* encoder,
|
||||
const CommandBufferDescriptor* descriptor)
|
||||
CommandBuffer::CommandBuffer(CommandEncoder* encoder, const CommandBufferDescriptor* descriptor)
|
||||
: CommandBufferBase(encoder, descriptor), mCommands(encoder->AcquireCommands()) {
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ namespace dawn_native { namespace null {
|
||||
Device(Adapter* adapter, const DeviceDescriptor* descriptor);
|
||||
~Device();
|
||||
|
||||
CommandBufferBase* CreateCommandBuffer(CommandEncoderBase* encoder,
|
||||
CommandBufferBase* CreateCommandBuffer(CommandEncoder* encoder,
|
||||
const CommandBufferDescriptor* descriptor) override;
|
||||
|
||||
Serial GetCompletedCommandSerial() const final override;
|
||||
@ -178,7 +178,7 @@ namespace dawn_native { namespace null {
|
||||
|
||||
class CommandBuffer : public CommandBufferBase {
|
||||
public:
|
||||
CommandBuffer(CommandEncoderBase* encoder, const CommandBufferDescriptor* descriptor);
|
||||
CommandBuffer(CommandEncoder* encoder, const CommandBufferDescriptor* descriptor);
|
||||
~CommandBuffer();
|
||||
|
||||
private:
|
||||
|
@ -394,8 +394,7 @@ namespace dawn_native { namespace opengl {
|
||||
|
||||
} // namespace
|
||||
|
||||
CommandBuffer::CommandBuffer(CommandEncoderBase* encoder,
|
||||
const CommandBufferDescriptor* descriptor)
|
||||
CommandBuffer::CommandBuffer(CommandEncoder* encoder, const CommandBufferDescriptor* descriptor)
|
||||
: CommandBufferBase(encoder, descriptor), mCommands(encoder->AcquireCommands()) {
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ namespace dawn_native { namespace opengl {
|
||||
|
||||
class CommandBuffer : public CommandBufferBase {
|
||||
public:
|
||||
CommandBuffer(CommandEncoderBase* encoder, const CommandBufferDescriptor* descriptor);
|
||||
CommandBuffer(CommandEncoder* encoder, const CommandBufferDescriptor* descriptor);
|
||||
~CommandBuffer();
|
||||
|
||||
void Execute();
|
||||
|
@ -75,7 +75,7 @@ namespace dawn_native { namespace opengl {
|
||||
ResultOrError<BufferBase*> Device::CreateBufferImpl(const BufferDescriptor* descriptor) {
|
||||
return new Buffer(this, descriptor);
|
||||
}
|
||||
CommandBufferBase* Device::CreateCommandBuffer(CommandEncoderBase* encoder,
|
||||
CommandBufferBase* Device::CreateCommandBuffer(CommandEncoder* encoder,
|
||||
const CommandBufferDescriptor* descriptor) {
|
||||
return new CommandBuffer(encoder, descriptor);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ namespace dawn_native { namespace opengl {
|
||||
void SubmitFenceSync();
|
||||
|
||||
// Dawn API
|
||||
CommandBufferBase* CreateCommandBuffer(CommandEncoderBase* encoder,
|
||||
CommandBufferBase* CreateCommandBuffer(CommandEncoder* encoder,
|
||||
const CommandBufferDescriptor* descriptor) override;
|
||||
|
||||
Serial GetCompletedCommandSerial() const final override;
|
||||
|
@ -351,13 +351,12 @@ namespace dawn_native { namespace vulkan {
|
||||
} // anonymous namespace
|
||||
|
||||
// static
|
||||
CommandBuffer* CommandBuffer::Create(CommandEncoderBase* encoder,
|
||||
CommandBuffer* CommandBuffer::Create(CommandEncoder* encoder,
|
||||
const CommandBufferDescriptor* descriptor) {
|
||||
return new CommandBuffer(encoder, descriptor);
|
||||
}
|
||||
|
||||
CommandBuffer::CommandBuffer(CommandEncoderBase* encoder,
|
||||
const CommandBufferDescriptor* descriptor)
|
||||
CommandBuffer::CommandBuffer(CommandEncoder* encoder, const CommandBufferDescriptor* descriptor)
|
||||
: CommandBufferBase(encoder, descriptor), mCommands(encoder->AcquireCommands()) {
|
||||
}
|
||||
|
||||
|
@ -33,14 +33,14 @@ namespace dawn_native { namespace vulkan {
|
||||
|
||||
class CommandBuffer : public CommandBufferBase {
|
||||
public:
|
||||
static CommandBuffer* Create(CommandEncoderBase* encoder,
|
||||
static CommandBuffer* Create(CommandEncoder* encoder,
|
||||
const CommandBufferDescriptor* descriptor);
|
||||
~CommandBuffer();
|
||||
|
||||
MaybeError RecordCommands(CommandRecordingContext* recordingContext);
|
||||
|
||||
private:
|
||||
CommandBuffer(CommandEncoderBase* encoder, const CommandBufferDescriptor* descriptor);
|
||||
CommandBuffer(CommandEncoder* encoder, const CommandBufferDescriptor* descriptor);
|
||||
|
||||
void RecordComputePass(CommandRecordingContext* recordingContext);
|
||||
MaybeError RecordRenderPass(CommandRecordingContext* recordingContext,
|
||||
|
@ -164,7 +164,7 @@ namespace dawn_native { namespace vulkan {
|
||||
ResultOrError<BufferBase*> Device::CreateBufferImpl(const BufferDescriptor* descriptor) {
|
||||
return Buffer::Create(this, descriptor);
|
||||
}
|
||||
CommandBufferBase* Device::CreateCommandBuffer(CommandEncoderBase* encoder,
|
||||
CommandBufferBase* Device::CreateCommandBuffer(CommandEncoder* encoder,
|
||||
const CommandBufferDescriptor* descriptor) {
|
||||
return CommandBuffer::Create(encoder, descriptor);
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ namespace dawn_native { namespace vulkan {
|
||||
ExternalSemaphoreHandle* outHandle);
|
||||
|
||||
// Dawn API
|
||||
CommandBufferBase* CreateCommandBuffer(CommandEncoderBase* encoder,
|
||||
CommandBufferBase* CreateCommandBuffer(CommandEncoder* encoder,
|
||||
const CommandBufferDescriptor* descriptor) override;
|
||||
|
||||
Serial GetCompletedCommandSerial() const final override;
|
||||
|
Loading…
x
Reference in New Issue
Block a user