D3D12: Support creating compute pipeline asynchronously

This patch implements the asynchronous path of CreateComputePipelineAsync
on D3D12 backend with the basic framework of the dawn_unittest
AsyncTaskTest.Basic.

1. Call the constructor of dawn_native::d3d12::ComputePipeline in the main
   thread.
2. Execute dawn_native::ComputePipelineBase::Initialize() (a virtual function)
   asynchronously.
3. Ensure every operation in dawn_native::d3d12::ComputePipeline::Initialize()
   is thread-safe (PersistentCache).
4. Save all the return values (pipeline object or error message, userdata, etc)
   in a CreateComputePipelineAsyncWaitableCallbackTask object and insert this
   callback task into CallbackTaskManager.
5. In Callback.Finish():
- Insert the pipeline object into the pipeline cache if necessary
- Call WGPUCreateComputePipelineAsyncCallback

Note that as we always handle the front-end pipeline cache in the main thread,
we don't need to make it thread-safe right now.

BUG=dawn:529
TEST=dawn_end2end_tests

Change-Id: I7eba2ce550b32439a94b2a4d1aa7f1b3383aa514
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/47900
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Jiawei Shao
2021-06-04 05:12:06 +00:00
committed by Dawn LUCI CQ
parent 2adb3c83e4
commit 5e1ca53269
19 changed files with 270 additions and 26 deletions

View File

@@ -67,7 +67,7 @@ TEST_F(AsyncTaskTest, Basic) {
dawn_platform::Platform platform;
std::unique_ptr<dawn_platform::WorkerTaskPool> pool = platform.CreateWorkerTaskPool();
dawn_native::AsnycTaskManager taskManager(pool.get());
dawn_native::AsyncTaskManager taskManager(pool.get());
ConcurrentTaskResultQueue taskResultQueue;
constexpr size_t kTaskCount = 4u;