mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 10:49:14 +00:00
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:
committed by
Dawn LUCI CQ
parent
2adb3c83e4
commit
5e1ca53269
@@ -18,6 +18,7 @@
|
||||
#include "common/Log.h"
|
||||
#include "dawn_native/ErrorData.h"
|
||||
#include "dawn_native/Surface.h"
|
||||
#include "dawn_platform/DawnPlatform.h"
|
||||
|
||||
#if defined(DAWN_USE_X11)
|
||||
# include "dawn_native/XlibXcbFunctions.h"
|
||||
@@ -64,6 +65,7 @@ namespace dawn_native {
|
||||
return instance.Detach();
|
||||
}
|
||||
|
||||
// TODO(crbug.com/dawn/832): make the platform an initialization parameter of the instance.
|
||||
bool InstanceBase::Initialize(const InstanceDescriptor*) {
|
||||
return true;
|
||||
}
|
||||
@@ -225,8 +227,15 @@ namespace dawn_native {
|
||||
mPlatform = platform;
|
||||
}
|
||||
|
||||
dawn_platform::Platform* InstanceBase::GetPlatform() const {
|
||||
return mPlatform;
|
||||
dawn_platform::Platform* InstanceBase::GetPlatform() {
|
||||
if (mPlatform != nullptr) {
|
||||
return mPlatform;
|
||||
}
|
||||
|
||||
if (mDefaultPlatform == nullptr) {
|
||||
mDefaultPlatform = std::make_unique<dawn_platform::Platform>();
|
||||
}
|
||||
return mDefaultPlatform.get();
|
||||
}
|
||||
|
||||
const XlibXcbFunctions* InstanceBase::GetOrCreateXlibXcbFunctions() {
|
||||
|
||||
Reference in New Issue
Block a user