Add the entry point of CreateReadyComputePipeline

This patch adds the entry point of CreateReadyComputePipeline in both
dawn_native and dawn_wire.

TODOs:
1. Add more tests in dawn_unittests and dawn_end2end_tests.
2. Put the main logic of creating a pipeline into a separate thread.

BUG=dawn:529
TEST=dawn_end2end_tests

Change-Id: I7edd269a5422a8b85320a7f9173df925decba633
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30060
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Jiawei Shao
2020-10-19 01:56:08 +00:00
committed by Commit Bot service account
parent 47a6a94e15
commit ae5f950444
18 changed files with 638 additions and 1 deletions

View File

@@ -100,6 +100,18 @@ void ProcTableAsClass::FenceOnCompletion(WGPUFence self,
OnFenceOnCompletionCallback(self, value, callback, userdata);
}
void ProcTableAsClass::DeviceCreateReadyComputePipeline(
WGPUDevice self,
WGPUComputePipelineDescriptor const * descriptor,
WGPUCreateReadyComputePipelineCallback callback,
void* userdata) {
auto object = reinterpret_cast<ProcTableAsClass::Object*>(self);
object->createReadyComputePipelineCallback = callback;
object->userdata = userdata;
OnDeviceCreateReadyComputePipelineCallback(self, descriptor, callback, userdata);
}
void ProcTableAsClass::CallDeviceErrorCallback(WGPUDevice device,
WGPUErrorType type,
const char* message) {
@@ -123,6 +135,14 @@ void ProcTableAsClass::CallFenceOnCompletionCallback(WGPUFence fence,
object->fenceOnCompletionCallback(status, object->userdata);
}
void ProcTableAsClass::CallDeviceCreateReadyComputePipelineCallback(WGPUDevice device,
WGPUCreateReadyPipelineStatus status,
WGPUComputePipeline pipeline,
const char* message) {
auto object = reinterpret_cast<ProcTableAsClass::Object*>(device);
object->createReadyComputePipelineCallback(status, pipeline, message, object->userdata);
}
{% for type in by_category["object"] %}
{{as_cType(type.name)}} ProcTableAsClass::GetNew{{type.name.CamelCase()}}() {
mObjects.emplace_back(new Object);

View File

@@ -52,6 +52,10 @@ class ProcTableAsClass {
{% endfor %}
// Stores callback and userdata and calls the On* methods
void DeviceCreateReadyComputePipeline(WGPUDevice self,
WGPUComputePipelineDescriptor const * descriptor,
WGPUCreateReadyComputePipelineCallback callback,
void* userdata);
void DeviceSetUncapturedErrorCallback(WGPUDevice self,
WGPUErrorCallback callback,
void* userdata);
@@ -71,6 +75,11 @@ class ProcTableAsClass {
void* userdata);
// Special cased mockable methods
virtual void OnDeviceCreateReadyComputePipelineCallback(
WGPUDevice device,
WGPUComputePipelineDescriptor const * descriptor,
WGPUCreateReadyComputePipelineCallback callback,
void* userdata) = 0;
virtual void OnDeviceSetUncapturedErrorCallback(WGPUDevice device,
WGPUErrorCallback callback,
void* userdata) = 0;
@@ -89,6 +98,10 @@ class ProcTableAsClass {
void* userdata) = 0;
// Calls the stored callbacks
void CallDeviceCreateReadyComputePipelineCallback(WGPUDevice device,
WGPUCreateReadyPipelineStatus status,
WGPUComputePipeline pipeline,
const char* message);
void CallDeviceErrorCallback(WGPUDevice device, WGPUErrorType type, const char* message);
void CallDeviceLostCallback(WGPUDevice device, const char* message);
void CallMapAsyncCallback(WGPUBuffer buffer, WGPUBufferMapAsyncStatus status);
@@ -97,6 +110,7 @@ class ProcTableAsClass {
struct Object {
ProcTableAsClass* procs = nullptr;
WGPUErrorCallback deviceErrorCallback = nullptr;
WGPUCreateReadyComputePipelineCallback createReadyComputePipelineCallback = nullptr;
WGPUDeviceLostCallback deviceLostCallback = nullptr;
WGPUBufferMapCallback mapAsyncCallback = nullptr;
WGPUFenceOnCompletionCallback fenceOnCompletionCallback = nullptr;
@@ -130,6 +144,12 @@ class MockProcTable : public ProcTableAsClass {
MOCK_METHOD(void, {{as_MethodSuffix(type.name, Name("release"))}}, ({{as_cType(type.name)}} self), (override));
{% endfor %}
MOCK_METHOD(void,
OnDeviceCreateReadyComputePipelineCallback,
(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor,
WGPUCreateReadyComputePipelineCallback callback,
void* userdata),
(override));
MOCK_METHOD(void, OnDeviceSetUncapturedErrorCallback, (WGPUDevice device, WGPUErrorCallback callback, void* userdata), (override));
MOCK_METHOD(void, OnDeviceSetDeviceLostCallback, (WGPUDevice device, WGPUDeviceLostCallback callback, void* userdata), (override));
MOCK_METHOD(bool, OnDevicePopErrorScopeCallback, (WGPUDevice device, WGPUErrorCallback callback, void* userdata), (override));