mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-15 16:16:08 +00:00
ComputePipelineDescriptor.computeStage->compute
Deprecates the computeStage member of the descriptor in favor of compute as described by the spec. In order to support both variants without breaking backwards compatibility some code had to be manually added to the wire client to copy from the deprecated member to the new one and visa versa. Change-Id: I9d5c2fc9c446c927c5792c9af9ed56c90060b65b Bug: dawn:800 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/53884 Commit-Queue: Brandon Jones <bajones@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
e5b9903cc1
commit
0d50a2c770
@@ -233,6 +233,34 @@ namespace dawn_wire { namespace client {
|
||||
return GetQueue();
|
||||
}
|
||||
|
||||
// TODO(dawn:800): Once the deprecated computeStage field is removed this method will no longer
|
||||
// be needed and DeviceCreateComputePipeline can be removed from client_handwritten_commands in
|
||||
// dawn_wire.json
|
||||
WGPUComputePipeline Device::CreateComputePipeline(
|
||||
WGPUComputePipelineDescriptor const* descriptor) {
|
||||
DeviceCreateComputePipelineCmd cmd;
|
||||
cmd.self = ToAPI(this);
|
||||
|
||||
auto* allocation = client->ComputePipelineAllocator().New(client);
|
||||
cmd.result = ObjectHandle{allocation->object->id, allocation->generation};
|
||||
|
||||
// Copy compute to the deprecated computeStage or visa-versa, depending on which one is
|
||||
// populated, so that serialization doesn't fail.
|
||||
WGPUComputePipelineDescriptor localDescriptor = *descriptor;
|
||||
if (localDescriptor.computeStage.module == nullptr) {
|
||||
localDescriptor.computeStage.module = localDescriptor.compute.module;
|
||||
localDescriptor.computeStage.entryPoint = localDescriptor.compute.entryPoint;
|
||||
} else if (localDescriptor.compute.module == nullptr) {
|
||||
localDescriptor.compute.module = localDescriptor.computeStage.module;
|
||||
localDescriptor.compute.entryPoint = localDescriptor.computeStage.entryPoint;
|
||||
}
|
||||
|
||||
cmd.descriptor = &localDescriptor;
|
||||
client->SerializeCommand(cmd);
|
||||
|
||||
return ToAPI(allocation->object.get());
|
||||
}
|
||||
|
||||
void Device::CreateComputePipelineAsync(WGPUComputePipelineDescriptor const* descriptor,
|
||||
WGPUCreateComputePipelineAsyncCallback callback,
|
||||
void* userdata) {
|
||||
@@ -243,7 +271,20 @@ namespace dawn_wire { namespace client {
|
||||
|
||||
DeviceCreateComputePipelineAsyncCmd cmd;
|
||||
cmd.deviceId = this->id;
|
||||
cmd.descriptor = descriptor;
|
||||
|
||||
// Copy compute to the deprecated computeStage or visa-versa, depending on which one is
|
||||
// populated, so that serialization doesn't fail.
|
||||
// TODO(dawn:800): Remove once computeStage is removed.
|
||||
WGPUComputePipelineDescriptor localDescriptor = *descriptor;
|
||||
if (localDescriptor.computeStage.module == nullptr) {
|
||||
localDescriptor.computeStage.module = localDescriptor.compute.module;
|
||||
localDescriptor.computeStage.entryPoint = localDescriptor.compute.entryPoint;
|
||||
} else if (localDescriptor.compute.module == nullptr) {
|
||||
localDescriptor.compute.module = localDescriptor.computeStage.module;
|
||||
localDescriptor.compute.entryPoint = localDescriptor.computeStage.entryPoint;
|
||||
}
|
||||
|
||||
cmd.descriptor = &localDescriptor;
|
||||
|
||||
uint64_t serial = mCreatePipelineAsyncRequestSerial++;
|
||||
ASSERT(mCreatePipelineAsyncRequests.find(serial) == mCreatePipelineAsyncRequests.end());
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace dawn_wire { namespace client {
|
||||
bool PopErrorScope(WGPUErrorCallback callback, void* userdata);
|
||||
WGPUBuffer CreateBuffer(const WGPUBufferDescriptor* descriptor);
|
||||
WGPUBuffer CreateErrorBuffer();
|
||||
WGPUComputePipeline CreateComputePipeline(WGPUComputePipelineDescriptor const* descriptor);
|
||||
void CreateComputePipelineAsync(WGPUComputePipelineDescriptor const* descriptor,
|
||||
WGPUCreateComputePipelineAsyncCallback callback,
|
||||
void* userdata);
|
||||
|
||||
Reference in New Issue
Block a user