mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-19 01:46:35 +00:00
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:
committed by
Commit Bot service account
parent
47a6a94e15
commit
ae5f950444
@@ -26,6 +26,16 @@ namespace dawn_wire { namespace server {
|
||||
server->OnDeviceLost(message);
|
||||
}
|
||||
|
||||
void Server::ForwardCreateReadyComputePipeline(WGPUCreateReadyPipelineStatus status,
|
||||
WGPUComputePipeline pipeline,
|
||||
const char* message,
|
||||
void* userdata) {
|
||||
CreateReadyPipelineUserData* createReadyPipelineUserData =
|
||||
static_cast<CreateReadyPipelineUserData*>(userdata);
|
||||
createReadyPipelineUserData->server->OnCreateReadyComputePipelineCallback(
|
||||
status, pipeline, message, createReadyPipelineUserData);
|
||||
}
|
||||
|
||||
void Server::OnUncapturedError(WGPUErrorType type, const char* message) {
|
||||
ReturnDeviceUncapturedErrorCallbackCmd cmd;
|
||||
cmd.type = type;
|
||||
@@ -53,6 +63,48 @@ namespace dawn_wire { namespace server {
|
||||
return success;
|
||||
}
|
||||
|
||||
bool Server::DoDeviceCreateReadyComputePipeline(
|
||||
WGPUDevice cDevice,
|
||||
uint64_t requestSerial,
|
||||
ObjectHandle pipelineObjectHandle,
|
||||
const WGPUComputePipelineDescriptor* descriptor) {
|
||||
auto* resultData = ComputePipelineObjects().Allocate(pipelineObjectHandle.id);
|
||||
if (resultData == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
resultData->generation = pipelineObjectHandle.generation;
|
||||
|
||||
std::unique_ptr<CreateReadyPipelineUserData> userdata =
|
||||
std::make_unique<CreateReadyPipelineUserData>();
|
||||
userdata->server = this;
|
||||
userdata->requestSerial = requestSerial;
|
||||
userdata->pipelineObjectID = pipelineObjectHandle.id;
|
||||
|
||||
mProcs.deviceCreateReadyComputePipeline(
|
||||
cDevice, descriptor, ForwardCreateReadyComputePipeline, userdata.release());
|
||||
return true;
|
||||
}
|
||||
|
||||
void Server::OnCreateReadyComputePipelineCallback(WGPUCreateReadyPipelineStatus status,
|
||||
WGPUComputePipeline pipeline,
|
||||
const char* message,
|
||||
CreateReadyPipelineUserData* userdata) {
|
||||
std::unique_ptr<CreateReadyPipelineUserData> data(userdata);
|
||||
if (status != WGPUCreateReadyPipelineStatus_Success) {
|
||||
ComputePipelineObjects().Free(data->pipelineObjectID);
|
||||
} else {
|
||||
ComputePipelineObjects().Get(data->pipelineObjectID)->handle = pipeline;
|
||||
}
|
||||
|
||||
ReturnDeviceCreateReadyComputePipelineCallbackCmd cmd;
|
||||
cmd.status = status;
|
||||
cmd.requestSerial = data->requestSerial;
|
||||
cmd.message = message;
|
||||
|
||||
SerializeCommand(cmd);
|
||||
}
|
||||
|
||||
// static
|
||||
void Server::ForwardPopErrorScope(WGPUErrorType type, const char* message, void* userdata) {
|
||||
auto* data = reinterpret_cast<ErrorScopeUserdata*>(userdata);
|
||||
|
||||
Reference in New Issue
Block a user