Metal: Support creating compute pipeline asynchronously
BUG=dawn:529 TEST=dawn_end2end_tests Change-Id: I9427afbb11196c14843c6fb7bf6224afca6d63fc Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/53761 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
parent
cabd60d991
commit
c9a6df3297
|
@ -30,6 +30,11 @@ namespace dawn_native { namespace metal {
|
|||
static ResultOrError<Ref<ComputePipeline>> Create(
|
||||
Device* device,
|
||||
const ComputePipelineDescriptor* descriptor);
|
||||
static void CreateAsync(Device* device,
|
||||
const ComputePipelineDescriptor* descriptor,
|
||||
size_t blueprintHash,
|
||||
WGPUCreateComputePipelineAsyncCallback callback,
|
||||
void* userdata);
|
||||
|
||||
void Encode(id<MTLComputeCommandEncoder> encoder);
|
||||
MTLSize GetLocalWorkGroupSize() const;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include "dawn_native/metal/ComputePipelineMTL.h"
|
||||
|
||||
#include "dawn_native/CreatePipelineAsyncTask.h"
|
||||
#include "dawn_native/metal/DeviceMTL.h"
|
||||
#include "dawn_native/metal/ShaderModuleMTL.h"
|
||||
|
||||
|
@ -66,4 +67,16 @@ namespace dawn_native { namespace metal {
|
|||
return mRequiresStorageBufferLength;
|
||||
}
|
||||
|
||||
void ComputePipeline::CreateAsync(Device* device,
|
||||
const ComputePipelineDescriptor* descriptor,
|
||||
size_t blueprintHash,
|
||||
WGPUCreateComputePipelineAsyncCallback callback,
|
||||
void* userdata) {
|
||||
Ref<ComputePipeline> pipeline = AcquireRef(new ComputePipeline(device, descriptor));
|
||||
std::unique_ptr<CreateComputePipelineAsyncTask> asyncTask =
|
||||
std::make_unique<CreateComputePipelineAsyncTask>(pipeline, descriptor, blueprintHash,
|
||||
callback, userdata);
|
||||
CreateComputePipelineAsyncTask::RunAsync(std::move(asyncTask));
|
||||
}
|
||||
|
||||
}} // namespace dawn_native::metal
|
||||
|
|
|
@ -112,6 +112,10 @@ namespace dawn_native { namespace metal {
|
|||
ResultOrError<Ref<TextureViewBase>> CreateTextureViewImpl(
|
||||
TextureBase* texture,
|
||||
const TextureViewDescriptor* descriptor) override;
|
||||
void CreateComputePipelineAsyncImpl(const ComputePipelineDescriptor* descriptor,
|
||||
size_t blueprintHash,
|
||||
WGPUCreateComputePipelineAsyncCallback callback,
|
||||
void* userdata) override;
|
||||
|
||||
void InitTogglesFromDriver();
|
||||
void ShutDownImpl() override;
|
||||
|
|
|
@ -259,6 +259,12 @@ namespace dawn_native { namespace metal {
|
|||
const TextureViewDescriptor* descriptor) {
|
||||
return TextureView::Create(texture, descriptor);
|
||||
}
|
||||
void Device::CreateComputePipelineAsyncImpl(const ComputePipelineDescriptor* descriptor,
|
||||
size_t blueprintHash,
|
||||
WGPUCreateComputePipelineAsyncCallback callback,
|
||||
void* userdata) {
|
||||
ComputePipeline::CreateAsync(this, descriptor, blueprintHash, callback, userdata);
|
||||
}
|
||||
|
||||
ResultOrError<ExecutionSerial> Device::CheckAndUpdateCompletedSerials() {
|
||||
uint64_t frontendCompletedSerial{GetCompletedCommandSerial()};
|
||||
|
|
Loading…
Reference in New Issue