From 0d50a2c77013b2996ad34dc4044ef3b0255509cf Mon Sep 17 00:00:00 2001 From: Brandon Jones Date: Wed, 9 Jun 2021 18:07:32 +0000 Subject: [PATCH] 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 Reviewed-by: Corentin Wallez --- dawn.json | 1 + dawn_wire.json | 1 + examples/ComputeBoids.cpp | 4 +- src/dawn_native/ComputePipeline.cpp | 20 ++++++--- src/dawn_native/CreatePipelineAsyncTask.cpp | 8 ++-- src/dawn_native/Device.cpp | 15 +++++-- src/dawn_native/QueryHelper.cpp | 4 +- .../d3d12/ComputePipelineD3D12.cpp | 8 ++-- src/dawn_native/metal/ComputePipelineMTL.mm | 4 +- src/dawn_native/opengl/ComputePipelineGL.cpp | 2 +- src/dawn_native/vulkan/ComputePipelineVk.cpp | 8 ++-- src/dawn_wire/client/Device.cpp | 43 ++++++++++++++++++- src/dawn_wire/client/Device.h | 1 + src/tests/DawnTest.cpp | 4 +- src/tests/end2end/BindGroupTests.cpp | 16 +++---- src/tests/end2end/BufferZeroInitTests.cpp | 8 ++-- .../end2end/ComputeCopyStorageBufferTests.cpp | 4 +- src/tests/end2end/ComputeDispatchTests.cpp | 4 +- .../end2end/ComputeSharedMemoryTests.cpp | 4 +- .../ComputeStorageBufferBarrierTests.cpp | 28 ++++++------ .../end2end/CopyTextureForBrowserTests.cpp | 4 +- .../end2end/CreatePipelineAsyncTests.cpp | 20 ++++----- src/tests/end2end/D3D12CachingTests.cpp | 16 +++---- src/tests/end2end/DeprecatedAPITests.cpp | 12 ++++++ .../end2end/DepthStencilSamplingTests.cpp | 8 ++-- src/tests/end2end/DeviceLostTests.cpp | 10 ++--- .../end2end/DynamicBufferOffsetTests.cpp | 4 +- src/tests/end2end/EntryPointTests.cpp | 6 +-- .../end2end/GpuMemorySynchronizationTests.cpp | 20 ++++----- .../end2end/MultisampledSamplingTests.cpp | 4 +- src/tests/end2end/ObjectCachingTests.cpp | 12 +++--- src/tests/end2end/OpArrayLengthTests.cpp | 6 +-- src/tests/end2end/ShaderFloat16Tests.cpp | 4 +- src/tests/end2end/ShaderTests.cpp | 4 +- src/tests/end2end/StorageTextureTests.cpp | 12 +++--- src/tests/end2end/TextureZeroInitTests.cpp | 6 +-- src/tests/perf_tests/ShaderRobustnessPerf.cpp | 4 +- .../validation/BindGroupValidationTests.cpp | 8 ++-- .../ComputeIndirectValidationTests.cpp | 4 +- .../GetBindGroupLayoutValidationTests.cpp | 10 ++--- .../MinimumBufferSizeValidationTests.cpp | 4 +- .../validation/MultipleDeviceTests.cpp | 8 ++-- .../validation/QueueSubmitValidationTests.cpp | 12 +++--- .../validation/ResourceUsageTrackingTests.cpp | 4 +- .../StorageTextureValidationTests.cpp | 20 ++++----- .../validation/UnsafeAPIValidationTests.cpp | 4 +- .../wire/WireCreatePipelineAsyncTests.cpp | 16 +++---- 47 files changed, 251 insertions(+), 178 deletions(-) diff --git a/dawn.json b/dawn.json index aed6596439..0619d6bca6 100644 --- a/dawn.json +++ b/dawn.json @@ -620,6 +620,7 @@ "members": [ {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true}, {"name": "layout", "type": "pipeline layout", "optional": true}, + {"name": "compute", "type": "programmable stage descriptor"}, {"name": "compute stage", "type": "programmable stage descriptor"} ] }, diff --git a/dawn_wire.json b/dawn_wire.json index ec270ab41d..5a71c22411 100644 --- a/dawn_wire.json +++ b/dawn_wire.json @@ -163,6 +163,7 @@ "client_handwritten_commands": [ "BufferDestroy", "BufferUnmap", + "DeviceCreateComputePipeline", "DeviceCreateErrorBuffer", "DeviceGetDefaultQueue", "DeviceGetQueue", diff --git a/examples/ComputeBoids.cpp b/examples/ComputeBoids.cpp index ed130db5c7..0061368212 100644 --- a/examples/ComputeBoids.cpp +++ b/examples/ComputeBoids.cpp @@ -253,8 +253,8 @@ void initSim() { wgpu::ComputePipelineDescriptor csDesc; csDesc.layout = pl; - csDesc.computeStage.module = module; - csDesc.computeStage.entryPoint = "main"; + csDesc.compute.module = module; + csDesc.compute.entryPoint = "main"; updatePipeline = device.CreateComputePipeline(&csDesc); for (uint32_t i = 0; i < 2; ++i) { diff --git a/src/dawn_native/ComputePipeline.cpp b/src/dawn_native/ComputePipeline.cpp index 9515d3a9ad..8ae593b613 100644 --- a/src/dawn_native/ComputePipeline.cpp +++ b/src/dawn_native/ComputePipeline.cpp @@ -29,9 +29,19 @@ namespace dawn_native { DAWN_TRY(device->ValidateObject(descriptor->layout)); } - DAWN_TRY(ValidateProgrammableStage(device, descriptor->computeStage.module, - descriptor->computeStage.entryPoint, descriptor->layout, - SingleShaderStage::Compute)); + if (descriptor->compute.module != nullptr) { + DAWN_TRY(ValidateProgrammableStage(device, descriptor->compute.module, + descriptor->compute.entryPoint, descriptor->layout, + SingleShaderStage::Compute)); + } else { + // TODO(dawn:800): Remove after deprecation period. + device->EmitDeprecationWarning( + "computeStage has been deprecated. Please begin using compute instead."); + DAWN_TRY(ValidateProgrammableStage(device, descriptor->computeStage.module, + descriptor->computeStage.entryPoint, + descriptor->layout, SingleShaderStage::Compute)); + } + return {}; } @@ -41,8 +51,8 @@ namespace dawn_native { const ComputePipelineDescriptor* descriptor) : PipelineBase(device, descriptor->layout, - {{SingleShaderStage::Compute, descriptor->computeStage.module, - descriptor->computeStage.entryPoint}}) { + {{SingleShaderStage::Compute, descriptor->compute.module, + descriptor->compute.entryPoint}}) { } ComputePipelineBase::ComputePipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag) diff --git a/src/dawn_native/CreatePipelineAsyncTask.cpp b/src/dawn_native/CreatePipelineAsyncTask.cpp index c3e7f6f091..42a4b9c53c 100644 --- a/src/dawn_native/CreatePipelineAsyncTask.cpp +++ b/src/dawn_native/CreatePipelineAsyncTask.cpp @@ -113,8 +113,8 @@ namespace dawn_native { mUserdata(userdata), mLabel(descriptor->label != nullptr ? descriptor->label : ""), mLayout(descriptor->layout), - mEntryPoint(descriptor->computeStage.entryPoint), - mComputeShaderModule(descriptor->computeStage.module) { + mEntryPoint(descriptor->compute.entryPoint), + mComputeShaderModule(descriptor->compute.module) { ASSERT(mComputePipeline != nullptr); // TODO(jiawei.shao@intel.com): save nextInChain when it is supported in Dawn. @@ -126,9 +126,9 @@ namespace dawn_native { if (!mLabel.empty()) { descriptor.label = mLabel.c_str(); } - descriptor.computeStage.entryPoint = mEntryPoint.c_str(); + descriptor.compute.entryPoint = mEntryPoint.c_str(); descriptor.layout = mLayout.Get(); - descriptor.computeStage.module = mComputeShaderModule.Get(); + descriptor.compute.module = mComputeShaderModule.Get(); MaybeError maybeError = mComputePipeline->Initialize(&descriptor); std::string errorMessage; if (maybeError.IsError()) { diff --git a/src/dawn_native/Device.cpp b/src/dawn_native/Device.cpp index b70e844bf1..84e79932cc 100644 --- a/src/dawn_native/Device.cpp +++ b/src/dawn_native/Device.cpp @@ -1115,11 +1115,18 @@ namespace dawn_native { ComputePipelineDescriptor* outDescriptor) { Ref layoutRef; *outDescriptor = descriptor; + // TODO(dawn:800): Remove after deprecation period. + if (outDescriptor->compute.module == nullptr && + outDescriptor->computeStage.module != nullptr) { + outDescriptor->compute.module = outDescriptor->computeStage.module; + outDescriptor->compute.entryPoint = outDescriptor->computeStage.entryPoint; + } + if (outDescriptor->layout == nullptr) { - DAWN_TRY_ASSIGN(layoutRef, PipelineLayoutBase::CreateDefault( - this, {{SingleShaderStage::Compute, - outDescriptor->computeStage.module, - outDescriptor->computeStage.entryPoint}})); + DAWN_TRY_ASSIGN(layoutRef, + PipelineLayoutBase::CreateDefault( + this, {{SingleShaderStage::Compute, outDescriptor->compute.module, + outDescriptor->compute.entryPoint}})); outDescriptor->layout = layoutRef.Get(); } diff --git a/src/dawn_native/QueryHelper.cpp b/src/dawn_native/QueryHelper.cpp index eb3d0bf44b..179db7b4df 100644 --- a/src/dawn_native/QueryHelper.cpp +++ b/src/dawn_native/QueryHelper.cpp @@ -125,8 +125,8 @@ namespace dawn_native { ComputePipelineDescriptor computePipelineDesc = {}; // Generate the layout based on shader module. computePipelineDesc.layout = nullptr; - computePipelineDesc.computeStage.module = store->timestampCS.Get(); - computePipelineDesc.computeStage.entryPoint = "main"; + computePipelineDesc.compute.module = store->timestampCS.Get(); + computePipelineDesc.compute.entryPoint = "main"; DAWN_TRY_ASSIGN(store->timestampComputePipeline, device->CreateComputePipeline(&computePipelineDesc)); diff --git a/src/dawn_native/d3d12/ComputePipelineD3D12.cpp b/src/dawn_native/d3d12/ComputePipelineD3D12.cpp index efd942a0e4..1c90338879 100644 --- a/src/dawn_native/d3d12/ComputePipelineD3D12.cpp +++ b/src/dawn_native/d3d12/ComputePipelineD3D12.cpp @@ -43,15 +43,15 @@ namespace dawn_native { namespace d3d12 { // SPRIV-cross does matrix multiplication expecting row major matrices compileFlags |= D3DCOMPILE_PACK_MATRIX_ROW_MAJOR; - ShaderModule* module = ToBackend(descriptor->computeStage.module); + ShaderModule* module = ToBackend(descriptor->compute.module); D3D12_COMPUTE_PIPELINE_STATE_DESC d3dDesc = {}; d3dDesc.pRootSignature = ToBackend(GetLayout())->GetRootSignature(); CompiledShader compiledShader; - DAWN_TRY_ASSIGN(compiledShader, module->Compile(descriptor->computeStage.entryPoint, - SingleShaderStage::Compute, - ToBackend(GetLayout()), compileFlags)); + DAWN_TRY_ASSIGN(compiledShader, + module->Compile(descriptor->compute.entryPoint, SingleShaderStage::Compute, + ToBackend(GetLayout()), compileFlags)); d3dDesc.CS = compiledShader.GetD3D12ShaderBytecode(); auto* d3d12Device = device->GetD3D12Device(); DAWN_TRY(CheckHRESULT( diff --git a/src/dawn_native/metal/ComputePipelineMTL.mm b/src/dawn_native/metal/ComputePipelineMTL.mm index b0cdfd9e90..860aa400db 100644 --- a/src/dawn_native/metal/ComputePipelineMTL.mm +++ b/src/dawn_native/metal/ComputePipelineMTL.mm @@ -32,8 +32,8 @@ namespace dawn_native { namespace metal { MaybeError ComputePipeline::Initialize(const ComputePipelineDescriptor* descriptor) { auto mtlDevice = ToBackend(GetDevice())->GetMTLDevice(); - ShaderModule* computeModule = ToBackend(descriptor->computeStage.module); - const char* computeEntryPoint = descriptor->computeStage.entryPoint; + ShaderModule* computeModule = ToBackend(descriptor->compute.module); + const char* computeEntryPoint = descriptor->compute.entryPoint; ShaderModule::MetalFunctionData computeData; DAWN_TRY(computeModule->CreateFunction(computeEntryPoint, SingleShaderStage::Compute, ToBackend(GetLayout()), &computeData)); diff --git a/src/dawn_native/opengl/ComputePipelineGL.cpp b/src/dawn_native/opengl/ComputePipelineGL.cpp index dcb88bec7c..837b928464 100644 --- a/src/dawn_native/opengl/ComputePipelineGL.cpp +++ b/src/dawn_native/opengl/ComputePipelineGL.cpp @@ -21,7 +21,7 @@ namespace dawn_native { namespace opengl { ComputePipeline::ComputePipeline(Device* device, const ComputePipelineDescriptor* descriptor) : ComputePipelineBase(device, descriptor) { PerStage modules(nullptr); - modules[SingleShaderStage::Compute] = ToBackend(descriptor->computeStage.module); + modules[SingleShaderStage::Compute] = ToBackend(descriptor->compute.module); PipelineGL::Initialize(device->gl, ToBackend(descriptor->layout), GetAllStages()); } diff --git a/src/dawn_native/vulkan/ComputePipelineVk.cpp b/src/dawn_native/vulkan/ComputePipelineVk.cpp index 5bc1d4d7e7..941e48f945 100644 --- a/src/dawn_native/vulkan/ComputePipelineVk.cpp +++ b/src/dawn_native/vulkan/ComputePipelineVk.cpp @@ -49,13 +49,13 @@ namespace dawn_native { namespace vulkan { if (GetDevice()->IsToggleEnabled(Toggle::UseTintGenerator)) { // Generate a new VkShaderModule with BindingRemapper tint transform for each pipeline DAWN_TRY_ASSIGN(createInfo.stage.module, - ToBackend(descriptor->computeStage.module) - ->GetTransformedModuleHandle(descriptor->computeStage.entryPoint, + ToBackend(descriptor->compute.module) + ->GetTransformedModuleHandle(descriptor->compute.entryPoint, ToBackend(GetLayout()))); } else { - createInfo.stage.module = ToBackend(descriptor->computeStage.module)->GetHandle(); + createInfo.stage.module = ToBackend(descriptor->compute.module)->GetHandle(); } - createInfo.stage.pName = descriptor->computeStage.entryPoint; + createInfo.stage.pName = descriptor->compute.entryPoint; createInfo.stage.pSpecializationInfo = nullptr; Device* device = ToBackend(GetDevice()); diff --git a/src/dawn_wire/client/Device.cpp b/src/dawn_wire/client/Device.cpp index adfccdff1b..2c87b7c1fb 100644 --- a/src/dawn_wire/client/Device.cpp +++ b/src/dawn_wire/client/Device.cpp @@ -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()); diff --git a/src/dawn_wire/client/Device.h b/src/dawn_wire/client/Device.h index 122c509e0e..2c0d35cbb0 100644 --- a/src/dawn_wire/client/Device.h +++ b/src/dawn_wire/client/Device.h @@ -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); diff --git a/src/tests/DawnTest.cpp b/src/tests/DawnTest.cpp index 3de7da0294..e01d1672c4 100644 --- a/src/tests/DawnTest.cpp +++ b/src/tests/DawnTest.cpp @@ -1111,8 +1111,8 @@ std::ostringstream& DawnTestBase::ExpectSampledDepthData(wgpu::Texture texture, wgpu::ShaderModule csModule = utils::CreateShaderModule(device, shaderSource.str().c_str()); wgpu::ComputePipelineDescriptor pipelineDescriptor; - pipelineDescriptor.computeStage.module = csModule; - pipelineDescriptor.computeStage.entryPoint = "main"; + pipelineDescriptor.compute.module = csModule; + pipelineDescriptor.compute.entryPoint = "main"; wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDescriptor); diff --git a/src/tests/end2end/BindGroupTests.cpp b/src/tests/end2end/BindGroupTests.cpp index 4ab61c471c..72fa49476e 100644 --- a/src/tests/end2end/BindGroupTests.cpp +++ b/src/tests/end2end/BindGroupTests.cpp @@ -132,8 +132,8 @@ TEST_P(BindGroupTests, ReusedBindGroupSingleSubmit) { })"); wgpu::ComputePipelineDescriptor cpDesc; - cpDesc.computeStage.module = module; - cpDesc.computeStage.entryPoint = "main"; + cpDesc.compute.module = module; + cpDesc.compute.entryPoint = "main"; wgpu::ComputePipeline cp = device.CreateComputePipeline(&cpDesc); wgpu::BufferDescriptor bufferDesc; @@ -818,7 +818,7 @@ TEST_P(BindGroupTests, DynamicOffsetOrder) { }); wgpu::ComputePipelineDescriptor pipelineDescriptor; - pipelineDescriptor.computeStage.module = utils::CreateShaderModule(device, R"( + pipelineDescriptor.compute.module = utils::CreateShaderModule(device, R"( // TODO(crbug.com/tint/386): Use the same struct [[block]] struct Buffer0 { value : u32; @@ -844,7 +844,7 @@ TEST_P(BindGroupTests, DynamicOffsetOrder) { [[stage(compute)]] fn main() { outputBuffer.value = vec3(buffer0.value, buffer2.value, buffer3.value); })"); - pipelineDescriptor.computeStage.entryPoint = "main"; + pipelineDescriptor.compute.entryPoint = "main"; pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl); wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDescriptor); @@ -1064,8 +1064,8 @@ TEST_P(BindGroupTests, EmptyLayout) { wgpu::ComputePipelineDescriptor pipelineDesc; pipelineDesc.layout = utils::MakeBasicPipelineLayout(device, &bgl); - pipelineDesc.computeStage.entryPoint = "main"; - pipelineDesc.computeStage.module = utils::CreateShaderModule(device, R"( + pipelineDesc.compute.entryPoint = "main"; + pipelineDesc.compute.module = utils::CreateShaderModule(device, R"( [[stage(compute)]] fn main() { })"); @@ -1262,8 +1262,8 @@ TEST_P(BindGroupTests, ReallyLargeBindGroup) { std::string shader = interface.str() + "[[stage(compute)]] fn main() {\n" + body.str() + "}\n"; wgpu::ComputePipelineDescriptor cpDesc; - cpDesc.computeStage.module = utils::CreateShaderModule(device, shader.c_str()); - cpDesc.computeStage.entryPoint = "main"; + cpDesc.compute.module = utils::CreateShaderModule(device, shader.c_str()); + cpDesc.compute.entryPoint = "main"; wgpu::ComputePipeline cp = device.CreateComputePipeline(&cpDesc); wgpu::BindGroupDescriptor bgDesc = {}; diff --git a/src/tests/end2end/BufferZeroInitTests.cpp b/src/tests/end2end/BufferZeroInitTests.cpp index 78e14787aa..29e4933271 100644 --- a/src/tests/end2end/BufferZeroInitTests.cpp +++ b/src/tests/end2end/BufferZeroInitTests.cpp @@ -168,8 +168,8 @@ class BufferZeroInitTest : public DawnTest { const std::vector& expectedBufferData) { wgpu::ComputePipelineDescriptor pipelineDescriptor; pipelineDescriptor.layout = nullptr; - pipelineDescriptor.computeStage.module = module; - pipelineDescriptor.computeStage.entryPoint = "main"; + pipelineDescriptor.compute.module = module; + pipelineDescriptor.compute.entryPoint = "main"; wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDescriptor); const uint64_t bufferSize = expectedBufferData.size() * sizeof(uint32_t); @@ -433,8 +433,8 @@ class BufferZeroInitTest : public DawnTest { wgpu::ComputePipelineDescriptor pipelineDescriptor; pipelineDescriptor.layout = nullptr; - pipelineDescriptor.computeStage.module = utils::CreateShaderModule(device, computeShader); - pipelineDescriptor.computeStage.entryPoint = "main"; + pipelineDescriptor.compute.module = utils::CreateShaderModule(device, computeShader); + pipelineDescriptor.compute.entryPoint = "main"; wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDescriptor); // Clear the color of outputTexture to green. diff --git a/src/tests/end2end/ComputeCopyStorageBufferTests.cpp b/src/tests/end2end/ComputeCopyStorageBufferTests.cpp index 721ff210d8..86e6aac4aa 100644 --- a/src/tests/end2end/ComputeCopyStorageBufferTests.cpp +++ b/src/tests/end2end/ComputeCopyStorageBufferTests.cpp @@ -32,8 +32,8 @@ void ComputeCopyStorageBufferTests::BasicTest(const char* shader) { auto module = utils::CreateShaderModule(device, shader); wgpu::ComputePipelineDescriptor csDesc; - csDesc.computeStage.module = module; - csDesc.computeStage.entryPoint = "main"; + csDesc.compute.module = module; + csDesc.compute.entryPoint = "main"; wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&csDesc); diff --git a/src/tests/end2end/ComputeDispatchTests.cpp b/src/tests/end2end/ComputeDispatchTests.cpp index 860aaee9fd..7ec40762cb 100644 --- a/src/tests/end2end/ComputeDispatchTests.cpp +++ b/src/tests/end2end/ComputeDispatchTests.cpp @@ -54,8 +54,8 @@ class ComputeDispatchTests : public DawnTest { })"); wgpu::ComputePipelineDescriptor csDesc; - csDesc.computeStage.module = module; - csDesc.computeStage.entryPoint = "main"; + csDesc.compute.module = module; + csDesc.compute.entryPoint = "main"; pipeline = device.CreateComputePipeline(&csDesc); } diff --git a/src/tests/end2end/ComputeSharedMemoryTests.cpp b/src/tests/end2end/ComputeSharedMemoryTests.cpp index 3e7e6de929..4a822a8ee0 100644 --- a/src/tests/end2end/ComputeSharedMemoryTests.cpp +++ b/src/tests/end2end/ComputeSharedMemoryTests.cpp @@ -30,8 +30,8 @@ void ComputeSharedMemoryTests::BasicTest(const char* shader) { auto module = utils::CreateShaderModule(device, shader); wgpu::ComputePipelineDescriptor csDesc; - csDesc.computeStage.module = module; - csDesc.computeStage.entryPoint = "main"; + csDesc.compute.module = module; + csDesc.compute.entryPoint = "main"; wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&csDesc); // Set up dst storage buffer diff --git a/src/tests/end2end/ComputeStorageBufferBarrierTests.cpp b/src/tests/end2end/ComputeStorageBufferBarrierTests.cpp index 777597485d..970fdec3eb 100644 --- a/src/tests/end2end/ComputeStorageBufferBarrierTests.cpp +++ b/src/tests/end2end/ComputeStorageBufferBarrierTests.cpp @@ -45,8 +45,8 @@ TEST_P(ComputeStorageBufferBarrierTests, AddIncrement) { )"); wgpu::ComputePipelineDescriptor pipelineDesc = {}; - pipelineDesc.computeStage.module = module; - pipelineDesc.computeStage.entryPoint = "main"; + pipelineDesc.compute.module = module; + pipelineDesc.compute.entryPoint = "main"; wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc); wgpu::BindGroup bindGroup = @@ -101,8 +101,8 @@ TEST_P(ComputeStorageBufferBarrierTests, AddPingPong) { )"); wgpu::ComputePipelineDescriptor pipelineDesc = {}; - pipelineDesc.computeStage.module = module; - pipelineDesc.computeStage.entryPoint = "main"; + pipelineDesc.compute.module = module; + pipelineDesc.compute.entryPoint = "main"; wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc); wgpu::BindGroup bindGroupA = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0), @@ -172,8 +172,8 @@ TEST_P(ComputeStorageBufferBarrierTests, StorageAndReadonlyStoragePingPongInOneP )"); wgpu::ComputePipelineDescriptor pipelineDesc = {}; - pipelineDesc.computeStage.module = module; - pipelineDesc.computeStage.entryPoint = "main"; + pipelineDesc.compute.module = module; + pipelineDesc.compute.entryPoint = "main"; wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc); wgpu::BindGroup bindGroupA = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0), @@ -241,8 +241,8 @@ TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPong) { )"); wgpu::ComputePipelineDescriptor pipelineDesc = {}; - pipelineDesc.computeStage.module = module; - pipelineDesc.computeStage.entryPoint = "main"; + pipelineDesc.compute.module = module; + pipelineDesc.compute.entryPoint = "main"; wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc); wgpu::BindGroup bindGroupA = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0), @@ -309,8 +309,8 @@ TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPongInOnePass) { )"); wgpu::ComputePipelineDescriptor pipelineDesc = {}; - pipelineDesc.computeStage.module = module; - pipelineDesc.computeStage.entryPoint = "main"; + pipelineDesc.compute.module = module; + pipelineDesc.compute.entryPoint = "main"; wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc); wgpu::BindGroup bindGroupA = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0), @@ -354,8 +354,8 @@ TEST_P(ComputeStorageBufferBarrierTests, IndirectBufferCorrectBarrier) { DAWN_SUPPRESS_TEST_IF(IsD3D12() && !HasToggleEnabled("use_tint_generator")); wgpu::ComputePipelineDescriptor step2PipelineDesc; - step2PipelineDesc.computeStage.entryPoint = "main"; - step2PipelineDesc.computeStage.module = utils::CreateShaderModule(device, R"( + step2PipelineDesc.compute.entryPoint = "main"; + step2PipelineDesc.compute.module = utils::CreateShaderModule(device, R"( [[block]] struct Buf { data : array; }; @@ -368,8 +368,8 @@ TEST_P(ComputeStorageBufferBarrierTests, IndirectBufferCorrectBarrier) { wgpu::ComputePipeline step2Pipeline = device.CreateComputePipeline(&step2PipelineDesc); wgpu::ComputePipelineDescriptor step3PipelineDesc; - step3PipelineDesc.computeStage.entryPoint = "main"; - step3PipelineDesc.computeStage.module = utils::CreateShaderModule(device, R"( + step3PipelineDesc.compute.entryPoint = "main"; + step3PipelineDesc.compute.module = utils::CreateShaderModule(device, R"( [[block]] struct Buf { data : array; }; diff --git a/src/tests/end2end/CopyTextureForBrowserTests.cpp b/src/tests/end2end/CopyTextureForBrowserTests.cpp index 5bd197c51f..05fe914f72 100644 --- a/src/tests/end2end/CopyTextureForBrowserTests.cpp +++ b/src/tests/end2end/CopyTextureForBrowserTests.cpp @@ -207,8 +207,8 @@ class CopyTextureForBrowserTests : public DawnTest { )"); wgpu::ComputePipelineDescriptor csDesc; - csDesc.computeStage.module = csModule; - csDesc.computeStage.entryPoint = "main"; + csDesc.compute.module = csModule; + csDesc.compute.entryPoint = "main"; return device.CreateComputePipeline(&csDesc); } diff --git a/src/tests/end2end/CreatePipelineAsyncTests.cpp b/src/tests/end2end/CreatePipelineAsyncTests.cpp index c5e76f85d0..ea4b3e1017 100644 --- a/src/tests/end2end/CreatePipelineAsyncTests.cpp +++ b/src/tests/end2end/CreatePipelineAsyncTests.cpp @@ -74,7 +74,7 @@ class CreatePipelineAsyncTest : public DawnTest { // Verify the basic use of CreateComputePipelineAsync works on all backends. TEST_P(CreatePipelineAsyncTest, BasicUseOfCreateComputePipelineAsync) { wgpu::ComputePipelineDescriptor csDesc; - csDesc.computeStage.module = utils::CreateShaderModule(device, R"( + csDesc.compute.module = utils::CreateShaderModule(device, R"( [[block]] struct SSBO { value : u32; }; @@ -83,7 +83,7 @@ TEST_P(CreatePipelineAsyncTest, BasicUseOfCreateComputePipelineAsync) { [[stage(compute)]] fn main() { ssbo.value = 1u; })"); - csDesc.computeStage.entryPoint = "main"; + csDesc.compute.entryPoint = "main"; device.CreateComputePipelineAsync( &csDesc, @@ -109,7 +109,7 @@ TEST_P(CreatePipelineAsyncTest, CreateComputePipelineFailed) { DAWN_TEST_UNSUPPORTED_IF(HasToggleEnabled("skip_validation")); wgpu::ComputePipelineDescriptor csDesc; - csDesc.computeStage.module = utils::CreateShaderModule(device, R"( + csDesc.compute.module = utils::CreateShaderModule(device, R"( [[block]] struct SSBO { value : u32; }; @@ -118,7 +118,7 @@ TEST_P(CreatePipelineAsyncTest, CreateComputePipelineFailed) { [[stage(compute)]] fn main() { ssbo.value = 1u; })"); - csDesc.computeStage.entryPoint = "main0"; + csDesc.compute.entryPoint = "main0"; device.CreateComputePipelineAsync( &csDesc, @@ -252,10 +252,10 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineFailed) { // CreateComputePipelineAsync() is called. TEST_P(CreatePipelineAsyncTest, ReleaseDeviceBeforeCallbackOfCreateComputePipelineAsync) { wgpu::ComputePipelineDescriptor csDesc; - csDesc.computeStage.module = utils::CreateShaderModule(device, R"( + csDesc.compute.module = utils::CreateShaderModule(device, R"( [[stage(compute)]] fn main() { })"); - csDesc.computeStage.entryPoint = "main"; + csDesc.compute.entryPoint = "main"; device.CreateComputePipelineAsync( &csDesc, @@ -308,7 +308,7 @@ TEST_P(CreatePipelineAsyncTest, ReleaseDeviceBeforeCallbackOfCreateRenderPipelin // object from cache works correctly. TEST_P(CreatePipelineAsyncTest, CreateSameComputePipelineTwice) { wgpu::ComputePipelineDescriptor csDesc; - csDesc.computeStage.module = utils::CreateShaderModule(device, R"( + csDesc.compute.module = utils::CreateShaderModule(device, R"( [[block]] struct SSBO { value : u32; }; @@ -317,7 +317,7 @@ TEST_P(CreatePipelineAsyncTest, CreateSameComputePipelineTwice) { [[stage(compute)]] fn main() { ssbo.value = 1u; })"); - csDesc.computeStage.entryPoint = "main"; + csDesc.compute.entryPoint = "main"; auto callback = [](WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline returnPipeline, const char* message, void* userdata) { @@ -349,7 +349,7 @@ TEST_P(CreatePipelineAsyncTest, CreateSameComputePipelineTwice) { // same time works correctly. TEST_P(CreatePipelineAsyncTest, CreateSamePipelineTwiceAtSameTime) { wgpu::ComputePipelineDescriptor csDesc; - csDesc.computeStage.module = utils::CreateShaderModule(device, R"( + csDesc.compute.module = utils::CreateShaderModule(device, R"( [[block]] struct SSBO { value : u32; }; @@ -358,7 +358,7 @@ TEST_P(CreatePipelineAsyncTest, CreateSamePipelineTwiceAtSameTime) { [[stage(compute)]] fn main() { ssbo.value = 1u; })"); - csDesc.computeStage.entryPoint = "main"; + csDesc.compute.entryPoint = "main"; auto callback = [](WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline returnPipeline, const char* message, void* userdata) { diff --git a/src/tests/end2end/D3D12CachingTests.cpp b/src/tests/end2end/D3D12CachingTests.cpp index ecf7c8b96a..d3c72ebb92 100644 --- a/src/tests/end2end/D3D12CachingTests.cpp +++ b/src/tests/end2end/D3D12CachingTests.cpp @@ -225,12 +225,12 @@ TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPoints) { // Store the WGSL shader into the cache. { wgpu::ComputePipelineDescriptor desc; - desc.computeStage.module = module; - desc.computeStage.entryPoint = "write1"; + desc.compute.module = module; + desc.compute.entryPoint = "write1"; EXPECT_CACHE_HIT(0u, device.CreateComputePipeline(&desc)); - desc.computeStage.module = module; - desc.computeStage.entryPoint = "write42"; + desc.compute.module = module; + desc.compute.entryPoint = "write42"; EXPECT_CACHE_HIT(0u, device.CreateComputePipeline(&desc)); } @@ -239,15 +239,15 @@ TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPoints) { // Load the same WGSL shader from the cache. { wgpu::ComputePipelineDescriptor desc; - desc.computeStage.module = module; - desc.computeStage.entryPoint = "write1"; + desc.compute.module = module; + desc.compute.entryPoint = "write1"; // Cached HLSL shader calls LoadData twice (once to peek, again to get), so check 2 x // kNumOfShaders hits. EXPECT_CACHE_HIT(2u, device.CreateComputePipeline(&desc)); - desc.computeStage.module = module; - desc.computeStage.entryPoint = "write42"; + desc.compute.module = module; + desc.compute.entryPoint = "write42"; // Cached HLSL shader calls LoadData twice, so check 2 x kNumOfShaders hits. EXPECT_CACHE_HIT(2u, device.CreateComputePipeline(&desc)); diff --git a/src/tests/end2end/DeprecatedAPITests.cpp b/src/tests/end2end/DeprecatedAPITests.cpp index 8205e3bacd..83346a7494 100644 --- a/src/tests/end2end/DeprecatedAPITests.cpp +++ b/src/tests/end2end/DeprecatedAPITests.cpp @@ -85,6 +85,18 @@ TEST_P(DeprecationTests, SetAttachmentDescriptorAttachment) { pass.EndPass(); } +// Test that setting computeStage in a ComputePipelineDescriptor is deprecated. +TEST_P(DeprecationTests, ComputeStage) { + wgpu::ComputePipelineDescriptor csDesc; + csDesc.computeStage.module = utils::CreateShaderModule(device, R"( + [[stage(compute)]] fn main() { + })"); + csDesc.computeStage.entryPoint = "main"; + + wgpu::ComputePipeline pipeline; + EXPECT_DEPRECATION_WARNING(pipeline = device.CreateComputePipeline(&csDesc)); +} + DAWN_INSTANTIATE_TEST(DeprecationTests, D3D12Backend(), MetalBackend(), diff --git a/src/tests/end2end/DepthStencilSamplingTests.cpp b/src/tests/end2end/DepthStencilSamplingTests.cpp index d0681a09be..c6feabee89 100644 --- a/src/tests/end2end/DepthStencilSamplingTests.cpp +++ b/src/tests/end2end/DepthStencilSamplingTests.cpp @@ -168,8 +168,8 @@ class DepthStencilSamplingTest : public DawnTest { wgpu::ShaderModule csModule = utils::CreateShaderModule(device, shaderSource.str().c_str()); wgpu::ComputePipelineDescriptor pipelineDescriptor; - pipelineDescriptor.computeStage.module = csModule; - pipelineDescriptor.computeStage.entryPoint = "main"; + pipelineDescriptor.compute.module = csModule; + pipelineDescriptor.compute.entryPoint = "main"; return device.CreateComputePipeline(&pipelineDescriptor); } @@ -236,8 +236,8 @@ class DepthStencilSamplingTest : public DawnTest { wgpu::ComputePipelineDescriptor pipelineDescriptor; pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl); - pipelineDescriptor.computeStage.module = csModule; - pipelineDescriptor.computeStage.entryPoint = "main"; + pipelineDescriptor.compute.module = csModule; + pipelineDescriptor.compute.entryPoint = "main"; return device.CreateComputePipeline(&pipelineDescriptor); } diff --git a/src/tests/end2end/DeviceLostTests.cpp b/src/tests/end2end/DeviceLostTests.cpp index b27c499a78..8513c16578 100644 --- a/src/tests/end2end/DeviceLostTests.cpp +++ b/src/tests/end2end/DeviceLostTests.cpp @@ -115,8 +115,8 @@ TEST_P(DeviceLostTest, GetBindGroupLayoutFails) { wgpu::ComputePipelineDescriptor descriptor; descriptor.layout = nullptr; - descriptor.computeStage.module = csModule; - descriptor.computeStage.entryPoint = "main"; + descriptor.compute.module = csModule; + descriptor.compute.entryPoint = "main"; wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&descriptor); @@ -169,7 +169,7 @@ TEST_P(DeviceLostTest, CreateComputePipelineFails) { wgpu::ComputePipelineDescriptor descriptor = {}; descriptor.layout = nullptr; - descriptor.computeStage.module = nullptr; + descriptor.compute.module = nullptr; ASSERT_DEVICE_ERROR(device.CreateComputePipeline(&descriptor)); } @@ -452,8 +452,8 @@ TEST_P(DeviceLostTest, DeviceLostBeforeCreatePipelineAsyncCallback) { })"); wgpu::ComputePipelineDescriptor descriptor; - descriptor.computeStage.module = csModule; - descriptor.computeStage.entryPoint = "main"; + descriptor.compute.module = csModule; + descriptor.compute.entryPoint = "main"; auto callback = [](WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline returnPipeline, const char* message, void* userdata) { diff --git a/src/tests/end2end/DynamicBufferOffsetTests.cpp b/src/tests/end2end/DynamicBufferOffsetTests.cpp index 32821fd3eb..f6bfa3b787 100644 --- a/src/tests/end2end/DynamicBufferOffsetTests.cpp +++ b/src/tests/end2end/DynamicBufferOffsetTests.cpp @@ -218,8 +218,8 @@ class DynamicBufferOffsetTests : public DawnTest { wgpu::ShaderModule csModule = utils::CreateShaderModule(device, cs.str().c_str()); wgpu::ComputePipelineDescriptor csDesc; - csDesc.computeStage.module = csModule; - csDesc.computeStage.entryPoint = "main"; + csDesc.compute.module = csModule; + csDesc.compute.entryPoint = "main"; wgpu::PipelineLayoutDescriptor pipelineLayoutDescriptor; if (isInheritedPipeline) { diff --git a/src/tests/end2end/EntryPointTests.cpp b/src/tests/end2end/EntryPointTests.cpp index da5d5db638..c97244db6d 100644 --- a/src/tests/end2end/EntryPointTests.cpp +++ b/src/tests/end2end/EntryPointTests.cpp @@ -79,12 +79,12 @@ TEST_P(EntryPointTests, TwoComputeInModule) { // Create both pipelines from the module. wgpu::ComputePipelineDescriptor pipelineDesc; - pipelineDesc.computeStage.module = module; + pipelineDesc.compute.module = module; - pipelineDesc.computeStage.entryPoint = "write1"; + pipelineDesc.compute.entryPoint = "write1"; wgpu::ComputePipeline write1 = device.CreateComputePipeline(&pipelineDesc); - pipelineDesc.computeStage.entryPoint = "write42"; + pipelineDesc.compute.entryPoint = "write42"; wgpu::ComputePipeline write42 = device.CreateComputePipeline(&pipelineDesc); // Create the bindGroup. diff --git a/src/tests/end2end/GpuMemorySynchronizationTests.cpp b/src/tests/end2end/GpuMemorySynchronizationTests.cpp index 7113a139ac..035b647ec1 100644 --- a/src/tests/end2end/GpuMemorySynchronizationTests.cpp +++ b/src/tests/end2end/GpuMemorySynchronizationTests.cpp @@ -45,8 +45,8 @@ class GpuMemorySyncTests : public DawnTest { })"); wgpu::ComputePipelineDescriptor cpDesc; - cpDesc.computeStage.module = csModule; - cpDesc.computeStage.entryPoint = "main"; + cpDesc.compute.module = csModule; + cpDesc.compute.entryPoint = "main"; wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&cpDesc); wgpu::BindGroup bindGroup = @@ -249,8 +249,8 @@ TEST_P(GpuMemorySyncTests, SampledAndROStorageTextureInComputePass) { // Create a pipeline that loads the texture from both the sampled and storage paths. wgpu::ComputePipelineDescriptor pipelineDesc; - pipelineDesc.computeStage.entryPoint = "main"; - pipelineDesc.computeStage.module = utils::CreateShaderModule(device, R"( + pipelineDesc.compute.entryPoint = "main"; + pipelineDesc.compute.module = utils::CreateShaderModule(device, R"( [[block]] struct Output { sampledOut: u32; storageOut: u32; @@ -321,8 +321,8 @@ class StorageToUniformSyncTests : public DawnTest { })"); wgpu::ComputePipelineDescriptor cpDesc; - cpDesc.computeStage.module = csModule; - cpDesc.computeStage.entryPoint = "main"; + cpDesc.compute.module = csModule; + cpDesc.compute.entryPoint = "main"; wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&cpDesc); wgpu::BindGroup bindGroup = @@ -542,8 +542,8 @@ TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) { })"); wgpu::ComputePipelineDescriptor cpDesc; - cpDesc.computeStage.module = csModule; - cpDesc.computeStage.entryPoint = "main"; + cpDesc.compute.module = csModule; + cpDesc.compute.entryPoint = "main"; wgpu::ComputePipeline cp = device.CreateComputePipeline(&cpDesc); wgpu::Buffer vertexBuffer = CreateZeroedBuffer( kVertexBufferStride * 4, @@ -657,8 +657,8 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) { })"); wgpu::ComputePipelineDescriptor cpDesc; - cpDesc.computeStage.module = csModule; - cpDesc.computeStage.entryPoint = "main"; + cpDesc.compute.module = csModule; + cpDesc.compute.entryPoint = "main"; wgpu::ComputePipeline cp = device.CreateComputePipeline(&cpDesc); struct Data { float pos[4][4]; diff --git a/src/tests/end2end/MultisampledSamplingTests.cpp b/src/tests/end2end/MultisampledSamplingTests.cpp index 39e6103f26..4d913c18c3 100644 --- a/src/tests/end2end/MultisampledSamplingTests.cpp +++ b/src/tests/end2end/MultisampledSamplingTests.cpp @@ -91,8 +91,8 @@ class MultisampledSamplingTest : public DawnTest { } { wgpu::ComputePipelineDescriptor desc = {}; - desc.computeStage.entryPoint = "main"; - desc.computeStage.module = utils::CreateShaderModule(device, R"( + desc.compute.entryPoint = "main"; + desc.compute.module = utils::CreateShaderModule(device, R"( [[group(0), binding(0)]] var texture0 : texture_multisampled_2d; [[group(0), binding(1)]] var texture1 : texture_multisampled_2d; diff --git a/src/tests/end2end/ObjectCachingTests.cpp b/src/tests/end2end/ObjectCachingTests.cpp index ecc3afb6f7..fb6c2ddc2b 100644 --- a/src/tests/end2end/ObjectCachingTests.cpp +++ b/src/tests/end2end/ObjectCachingTests.cpp @@ -142,16 +142,16 @@ TEST_P(ObjectCachingTest, ComputePipelineDeduplicationOnShaderModule) { wgpu::PipelineLayout layout = utils::MakeBasicPipelineLayout(device, nullptr); wgpu::ComputePipelineDescriptor desc; - desc.computeStage.entryPoint = "main"; + desc.compute.entryPoint = "main"; desc.layout = layout; - desc.computeStage.module = module; + desc.compute.module = module; wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&desc); - desc.computeStage.module = sameModule; + desc.compute.module = sameModule; wgpu::ComputePipeline samePipeline = device.CreateComputePipeline(&desc); - desc.computeStage.module = otherModule; + desc.compute.module = otherModule; wgpu::ComputePipeline otherPipeline = device.CreateComputePipeline(&desc); EXPECT_NE(pipeline.Get(), otherPipeline.Get()); @@ -173,8 +173,8 @@ TEST_P(ObjectCachingTest, ComputePipelineDeduplicationOnLayout) { EXPECT_EQ(pl.Get() == samePl.Get(), !UsesWire()); wgpu::ComputePipelineDescriptor desc; - desc.computeStage.entryPoint = "main"; - desc.computeStage.module = utils::CreateShaderModule(device, R"( + desc.compute.entryPoint = "main"; + desc.compute.module = utils::CreateShaderModule(device, R"( var i : u32; [[stage(compute)]] fn main() { i = 0u; diff --git a/src/tests/end2end/OpArrayLengthTests.cpp b/src/tests/end2end/OpArrayLengthTests.cpp index b7b55bf124..581143cdc7 100644 --- a/src/tests/end2end/OpArrayLengthTests.cpp +++ b/src/tests/end2end/OpArrayLengthTests.cpp @@ -123,8 +123,8 @@ TEST_P(OpArrayLengthTest, Compute) { wgpu::ComputePipelineDescriptor pipelineDesc; pipelineDesc.layout = pl; - pipelineDesc.computeStage.entryPoint = "main"; - pipelineDesc.computeStage.module = utils::CreateShaderModule(device, (R"( + pipelineDesc.compute.entryPoint = "main"; + pipelineDesc.compute.module = utils::CreateShaderModule(device, (R"( [[block]] struct ResultBuffer { data : [[stride(4)]] array; }; @@ -135,7 +135,7 @@ TEST_P(OpArrayLengthTest, Compute) { result.data[1] = arrayLength(buffer2.data); result.data[2] = arrayLength(buffer3.data); })") - .c_str()); + .c_str()); wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc); // Run a single instance of the compute shader diff --git a/src/tests/end2end/ShaderFloat16Tests.cpp b/src/tests/end2end/ShaderFloat16Tests.cpp index 73427bd244..6a8c6647f5 100644 --- a/src/tests/end2end/ShaderFloat16Tests.cpp +++ b/src/tests/end2end/ShaderFloat16Tests.cpp @@ -147,8 +147,8 @@ TEST_P(ShaderFloat16Tests, Basic16BitFloatFeaturesTest) { )"); wgpu::ComputePipelineDescriptor csDesc; - csDesc.computeStage.module = module; - csDesc.computeStage.entryPoint = "main"; + csDesc.compute.module = module; + csDesc.compute.entryPoint = "main"; wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&csDesc); wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0), diff --git a/src/tests/end2end/ShaderTests.cpp b/src/tests/end2end/ShaderTests.cpp index ace5c8f722..6184a5e9d4 100644 --- a/src/tests/end2end/ShaderTests.cpp +++ b/src/tests/end2end/ShaderTests.cpp @@ -62,8 +62,8 @@ TEST_P(ShaderTests, ComputeLog2) { })"; wgpu::ComputePipelineDescriptor csDesc; - csDesc.computeStage.module = utils::CreateShaderModule(device, shader.c_str()); - csDesc.computeStage.entryPoint = "main"; + csDesc.compute.module = utils::CreateShaderModule(device, shader.c_str()); + csDesc.compute.entryPoint = "main"; wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&csDesc); wgpu::BindGroup bindGroup = diff --git a/src/tests/end2end/StorageTextureTests.cpp b/src/tests/end2end/StorageTextureTests.cpp index a25aa53bb3..4eed7e33d3 100644 --- a/src/tests/end2end/StorageTextureTests.cpp +++ b/src/tests/end2end/StorageTextureTests.cpp @@ -464,8 +464,8 @@ fn IsEqualTo(pixel : vec4, expected : vec4) -> bool { wgpu::ShaderModule csModule = utils::CreateShaderModule(device, computeShader); wgpu::ComputePipelineDescriptor computeDescriptor; computeDescriptor.layout = nullptr; - computeDescriptor.computeStage.module = csModule; - computeDescriptor.computeStage.entryPoint = "main"; + computeDescriptor.compute.module = csModule; + computeDescriptor.compute.entryPoint = "main"; return device.CreateComputePipeline(&computeDescriptor); } @@ -990,8 +990,8 @@ TEST_P(StorageTextureTests, ReadonlyAndWriteonlyStorageTexturePingPong) { )"); wgpu::ComputePipelineDescriptor pipelineDesc = {}; - pipelineDesc.computeStage.module = module; - pipelineDesc.computeStage.entryPoint = "main"; + pipelineDesc.compute.module = module; + pipelineDesc.compute.entryPoint = "main"; wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc); // In bindGroupA storageTexture1 is bound as read-only storage texture and storageTexture2 is @@ -1064,8 +1064,8 @@ TEST_P(StorageTextureTests, SampledAndWriteonlyStorageTexturePingPong) { )"); wgpu::ComputePipelineDescriptor pipelineDesc = {}; - pipelineDesc.computeStage.module = module; - pipelineDesc.computeStage.entryPoint = "main"; + pipelineDesc.compute.module = module; + pipelineDesc.compute.entryPoint = "main"; wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc); // In bindGroupA storageTexture1 is bound as read-only storage texture and storageTexture2 is diff --git a/src/tests/end2end/TextureZeroInitTests.cpp b/src/tests/end2end/TextureZeroInitTests.cpp index f8a03d5163..843829895b 100644 --- a/src/tests/end2end/TextureZeroInitTests.cpp +++ b/src/tests/end2end/TextureZeroInitTests.cpp @@ -973,7 +973,7 @@ TEST_P(TextureZeroInitTest, ComputePassSampledTextureClear) { // Create compute pipeline wgpu::ComputePipelineDescriptor computePipelineDescriptor; - wgpu::ProgrammableStageDescriptor computeStage; + wgpu::ProgrammableStageDescriptor compute; const char* cs = R"( [[group(0), binding(0)]] var tex : texture_2d; [[block]] struct Result { @@ -984,8 +984,8 @@ TEST_P(TextureZeroInitTest, ComputePassSampledTextureClear) { result.value = textureLoad(tex, vec2(0,0), 0); } )"; - computePipelineDescriptor.computeStage.module = utils::CreateShaderModule(device, cs); - computePipelineDescriptor.computeStage.entryPoint = "main"; + computePipelineDescriptor.compute.module = utils::CreateShaderModule(device, cs); + computePipelineDescriptor.compute.entryPoint = "main"; wgpu::ComputePipeline computePipeline = device.CreateComputePipeline(&computePipelineDescriptor); diff --git a/src/tests/perf_tests/ShaderRobustnessPerf.cpp b/src/tests/perf_tests/ShaderRobustnessPerf.cpp index f63af7b702..ffcce8af0e 100644 --- a/src/tests/perf_tests/ShaderRobustnessPerf.cpp +++ b/src/tests/perf_tests/ShaderRobustnessPerf.cpp @@ -460,8 +460,8 @@ void ShaderRobustnessPerf::SetUp() { } wgpu::ComputePipelineDescriptor csDesc; - csDesc.computeStage.module = module; - csDesc.computeStage.entryPoint = "main"; + csDesc.compute.module = module; + csDesc.compute.entryPoint = "main"; mPipeline = device.CreateComputePipeline(&csDesc); mBindGroup = utils::MakeBindGroup(device, mPipeline.GetBindGroupLayout(0), diff --git a/src/tests/unittests/validation/BindGroupValidationTests.cpp b/src/tests/unittests/validation/BindGroupValidationTests.cpp index b41b8c4929..0a0f2201c4 100644 --- a/src/tests/unittests/validation/BindGroupValidationTests.cpp +++ b/src/tests/unittests/validation/BindGroupValidationTests.cpp @@ -1312,8 +1312,8 @@ class SetBindGroupValidationTest : public ValidationTest { wgpu::ComputePipelineDescriptor csDesc; csDesc.layout = pipelineLayout; - csDesc.computeStage.module = csModule; - csDesc.computeStage.entryPoint = "main"; + csDesc.compute.module = csModule; + csDesc.compute.entryPoint = "main"; return device.CreateComputePipeline(&csDesc); } @@ -1918,8 +1918,8 @@ class BindGroupLayoutCompatibilityTest : public ValidationTest { wgpu::ComputePipelineDescriptor csDesc; csDesc.layout = pipelineLayout; - csDesc.computeStage.module = csModule; - csDesc.computeStage.entryPoint = "main"; + csDesc.compute.module = csModule; + csDesc.compute.entryPoint = "main"; return device.CreateComputePipeline(&csDesc); } diff --git a/src/tests/unittests/validation/ComputeIndirectValidationTests.cpp b/src/tests/unittests/validation/ComputeIndirectValidationTests.cpp index f0d5466bf6..9187deadcb 100644 --- a/src/tests/unittests/validation/ComputeIndirectValidationTests.cpp +++ b/src/tests/unittests/validation/ComputeIndirectValidationTests.cpp @@ -31,8 +31,8 @@ class ComputeIndirectValidationTest : public ValidationTest { wgpu::ComputePipelineDescriptor csDesc; csDesc.layout = pl; - csDesc.computeStage.module = computeModule; - csDesc.computeStage.entryPoint = "main"; + csDesc.compute.module = computeModule; + csDesc.compute.entryPoint = "main"; pipeline = device.CreateComputePipeline(&csDesc); } diff --git a/src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp b/src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp index a0a531a7f6..a4a2bb131e 100644 --- a/src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp +++ b/src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp @@ -158,8 +158,8 @@ TEST_F(GetBindGroupLayoutTests, ComputePipeline) { wgpu::ComputePipelineDescriptor descriptor; descriptor.layout = nullptr; - descriptor.computeStage.module = csModule; - descriptor.computeStage.entryPoint = "main"; + descriptor.compute.module = csModule; + descriptor.compute.entryPoint = "main"; wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&descriptor); @@ -925,14 +925,14 @@ TEST_F(GetBindGroupLayoutTests, FromCorrectEntryPoint) { )"); wgpu::ComputePipelineDescriptor pipelineDesc; - pipelineDesc.computeStage.module = module; + pipelineDesc.compute.module = module; // Get each entryPoint's BGL. - pipelineDesc.computeStage.entryPoint = "compute0"; + pipelineDesc.compute.entryPoint = "compute0"; wgpu::ComputePipeline pipeline0 = device.CreateComputePipeline(&pipelineDesc); wgpu::BindGroupLayout bgl0 = pipeline0.GetBindGroupLayout(0); - pipelineDesc.computeStage.entryPoint = "compute1"; + pipelineDesc.compute.entryPoint = "compute1"; wgpu::ComputePipeline pipeline1 = device.CreateComputePipeline(&pipelineDesc); wgpu::BindGroupLayout bgl1 = pipeline1.GetBindGroupLayout(0); diff --git a/src/tests/unittests/validation/MinimumBufferSizeValidationTests.cpp b/src/tests/unittests/validation/MinimumBufferSizeValidationTests.cpp index df880252a6..b841501927 100644 --- a/src/tests/unittests/validation/MinimumBufferSizeValidationTests.cpp +++ b/src/tests/unittests/validation/MinimumBufferSizeValidationTests.cpp @@ -171,8 +171,8 @@ class MinBufferSizeTestsBase : public ValidationTest { descriptor.bindGroupLayouts = layouts.data(); csDesc.layout = device.CreatePipelineLayout(&descriptor); } - csDesc.computeStage.module = csModule; - csDesc.computeStage.entryPoint = "main"; + csDesc.compute.module = csModule; + csDesc.compute.entryPoint = "main"; return device.CreateComputePipeline(&csDesc); } diff --git a/src/tests/unittests/validation/MultipleDeviceTests.cpp b/src/tests/unittests/validation/MultipleDeviceTests.cpp index 144d99504b..8e9637dd8c 100644 --- a/src/tests/unittests/validation/MultipleDeviceTests.cpp +++ b/src/tests/unittests/validation/MultipleDeviceTests.cpp @@ -45,8 +45,8 @@ TEST_F(MultipleDeviceTest, ValidatesSameDeviceCreatePipelineAsync) { wgpu::ShaderModule shaderModule = device.CreateShaderModule(&shaderModuleDesc); wgpu::ComputePipelineDescriptor pipelineDesc = {}; - pipelineDesc.computeStage.module = shaderModule; - pipelineDesc.computeStage.entryPoint = "main"; + pipelineDesc.compute.module = shaderModule; + pipelineDesc.compute.entryPoint = "main"; StrictMock> creationCallback; EXPECT_CALL(creationCallback, @@ -65,8 +65,8 @@ TEST_F(MultipleDeviceTest, ValidatesSameDeviceCreatePipelineAsync) { wgpu::ShaderModule shaderModule = device2.CreateShaderModule(&shaderModuleDesc); wgpu::ComputePipelineDescriptor pipelineDesc = {}; - pipelineDesc.computeStage.module = shaderModule; - pipelineDesc.computeStage.entryPoint = "main"; + pipelineDesc.compute.module = shaderModule; + pipelineDesc.compute.entryPoint = "main"; StrictMock> creationCallback; EXPECT_CALL(creationCallback, diff --git a/src/tests/unittests/validation/QueueSubmitValidationTests.cpp b/src/tests/unittests/validation/QueueSubmitValidationTests.cpp index 39692524f9..0b6d591694 100644 --- a/src/tests/unittests/validation/QueueSubmitValidationTests.cpp +++ b/src/tests/unittests/validation/QueueSubmitValidationTests.cpp @@ -210,10 +210,10 @@ namespace { }; wgpu::ComputePipelineDescriptor descriptor; - descriptor.computeStage.module = utils::CreateShaderModule(device, R"( + descriptor.compute.module = utils::CreateShaderModule(device, R"( [[stage(compute)]] fn main() { })"); - descriptor.computeStage.entryPoint = "main"; + descriptor.compute.entryPoint = "main"; device.CreateComputePipelineAsync(&descriptor, callback, &callbackData); WaitForAllOperations(device); @@ -234,8 +234,8 @@ namespace { // BindGroup 2. This is to provide coverage of for loops in validation code. wgpu::ComputePipelineDescriptor cpDesc; cpDesc.layout = utils::MakePipelineLayout(device, {emptyBGL, testBGL}); - cpDesc.computeStage.entryPoint = "main"; - cpDesc.computeStage.module = + cpDesc.compute.entryPoint = "main"; + cpDesc.compute.module = utils::CreateShaderModule(device, "[[stage(compute)]] fn main() {}"); wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&cpDesc); @@ -302,8 +302,8 @@ namespace { wgpu::ComputePipelineDescriptor cpDesc; cpDesc.layout = utils::MakePipelineLayout(device, {emptyBGL, emptyBGL, testBGL}); - cpDesc.computeStage.entryPoint = "main"; - cpDesc.computeStage.module = + cpDesc.compute.entryPoint = "main"; + cpDesc.compute.module = utils::CreateShaderModule(device, "[[stage(compute)]] fn main() {}"); wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&cpDesc); diff --git a/src/tests/unittests/validation/ResourceUsageTrackingTests.cpp b/src/tests/unittests/validation/ResourceUsageTrackingTests.cpp index d70ef9ad5e..eed4393e80 100644 --- a/src/tests/unittests/validation/ResourceUsageTrackingTests.cpp +++ b/src/tests/unittests/validation/ResourceUsageTrackingTests.cpp @@ -67,8 +67,8 @@ namespace { })"); wgpu::ComputePipelineDescriptor pipelineDescriptor; pipelineDescriptor.layout = utils::MakePipelineLayout(device, std::move(bgls)); - pipelineDescriptor.computeStage.module = csModule; - pipelineDescriptor.computeStage.entryPoint = "main"; + pipelineDescriptor.compute.module = csModule; + pipelineDescriptor.compute.entryPoint = "main"; return device.CreateComputePipeline(&pipelineDescriptor); } diff --git a/src/tests/unittests/validation/StorageTextureValidationTests.cpp b/src/tests/unittests/validation/StorageTextureValidationTests.cpp index a212e10a60..8222f9d00b 100644 --- a/src/tests/unittests/validation/StorageTextureValidationTests.cpp +++ b/src/tests/unittests/validation/StorageTextureValidationTests.cpp @@ -200,8 +200,8 @@ TEST_F(StorageTextureValidationTests, ComputePipeline) { wgpu::ComputePipelineDescriptor descriptor; descriptor.layout = nullptr; - descriptor.computeStage.module = csModule; - descriptor.computeStage.entryPoint = "main"; + descriptor.compute.module = csModule; + descriptor.compute.entryPoint = "main"; device.CreateComputePipeline(&descriptor); } @@ -217,8 +217,8 @@ TEST_F(StorageTextureValidationTests, ComputePipeline) { wgpu::ComputePipelineDescriptor descriptor; descriptor.layout = nullptr; - descriptor.computeStage.module = csModule; - descriptor.computeStage.entryPoint = "main"; + descriptor.compute.module = csModule; + descriptor.compute.entryPoint = "main"; device.CreateComputePipeline(&descriptor); } @@ -402,8 +402,8 @@ TEST_F(StorageTextureValidationTests, BindGroupLayoutEntryTypeMatchesShaderDecla // Set common fields of compute pipeline descriptor. wgpu::ComputePipelineDescriptor defaultComputePipelineDescriptor; - defaultComputePipelineDescriptor.computeStage.module = csModule; - defaultComputePipelineDescriptor.computeStage.entryPoint = "main"; + defaultComputePipelineDescriptor.compute.module = csModule; + defaultComputePipelineDescriptor.compute.entryPoint = "main"; for (utils::BindingLayoutEntryInitializationHelper bindingLayoutEntry : kSupportedBindingTypes) { @@ -478,8 +478,8 @@ TEST_F(StorageTextureValidationTests, BindGroupLayoutStorageTextureFormatMatches // Set common fields of compute pipeline descriptor. wgpu::ComputePipelineDescriptor defaultComputePipelineDescriptor; - defaultComputePipelineDescriptor.computeStage.module = csModule; - defaultComputePipelineDescriptor.computeStage.entryPoint = "main"; + defaultComputePipelineDescriptor.compute.module = csModule; + defaultComputePipelineDescriptor.compute.entryPoint = "main"; // Set common fileds of bind group layout binding. utils::BindingLayoutEntryInitializationHelper defaultBindGroupLayoutEntry = { @@ -534,8 +534,8 @@ TEST_F(StorageTextureValidationTests, BindGroupLayoutViewDimensionMatchesShaderD // Set common fields of compute pipeline descriptor. wgpu::ComputePipelineDescriptor defaultComputePipelineDescriptor; - defaultComputePipelineDescriptor.computeStage.module = csModule; - defaultComputePipelineDescriptor.computeStage.entryPoint = "main"; + defaultComputePipelineDescriptor.compute.module = csModule; + defaultComputePipelineDescriptor.compute.entryPoint = "main"; // Set common fields of bind group layout binding. utils::BindingLayoutEntryInitializationHelper defaultBindGroupLayoutEntry = { diff --git a/src/tests/unittests/validation/UnsafeAPIValidationTests.cpp b/src/tests/unittests/validation/UnsafeAPIValidationTests.cpp index 02e55fd761..12bd37d979 100644 --- a/src/tests/unittests/validation/UnsafeAPIValidationTests.cpp +++ b/src/tests/unittests/validation/UnsafeAPIValidationTests.cpp @@ -134,8 +134,8 @@ TEST_F(UnsafeAPIValidationTest, DispatchIndirectDisallowed) { // Create the dummy compute pipeline. wgpu::ComputePipelineDescriptor pipelineDesc; - pipelineDesc.computeStage.entryPoint = "main"; - pipelineDesc.computeStage.module = + pipelineDesc.compute.entryPoint = "main"; + pipelineDesc.compute.module = utils::CreateShaderModule(device, "[[stage(compute)]] fn main() {}"); wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc); diff --git a/src/tests/unittests/wire/WireCreatePipelineAsyncTests.cpp b/src/tests/unittests/wire/WireCreatePipelineAsyncTests.cpp index d61a1d40aa..78f7f8fd16 100644 --- a/src/tests/unittests/wire/WireCreatePipelineAsyncTests.cpp +++ b/src/tests/unittests/wire/WireCreatePipelineAsyncTests.cpp @@ -100,8 +100,8 @@ TEST_F(WireCreatePipelineAsyncTest, CreateComputePipelineAsyncSuccess) { EXPECT_CALL(api, DeviceCreateShaderModule(apiDevice, _)).WillOnce(Return(apiCsModule)); WGPUComputePipelineDescriptor descriptor{}; - descriptor.computeStage.module = csModule; - descriptor.computeStage.entryPoint = "main"; + descriptor.compute.module = csModule; + descriptor.compute.entryPoint = "main"; wgpuDeviceCreateComputePipelineAsync(device, &descriptor, ToMockCreateComputePipelineAsyncCallback, this); @@ -129,8 +129,8 @@ TEST_F(WireCreatePipelineAsyncTest, CreateComputePipelineAsyncError) { EXPECT_CALL(api, DeviceCreateShaderModule(apiDevice, _)).WillOnce(Return(apiCsModule)); WGPUComputePipelineDescriptor descriptor{}; - descriptor.computeStage.module = csModule; - descriptor.computeStage.entryPoint = "main"; + descriptor.compute.module = csModule; + descriptor.compute.entryPoint = "main"; wgpuDeviceCreateComputePipelineAsync(device, &descriptor, ToMockCreateComputePipelineAsyncCallback, this); @@ -258,8 +258,8 @@ TEST_F(WireCreatePipelineAsyncTest, CreateComputePipelineAsyncThenDisconnect) { EXPECT_CALL(api, DeviceCreateShaderModule(apiDevice, _)).WillOnce(Return(apiCsModule)); WGPUComputePipelineDescriptor descriptor{}; - descriptor.computeStage.module = csModule; - descriptor.computeStage.entryPoint = "main"; + descriptor.compute.module = csModule; + descriptor.compute.entryPoint = "main"; wgpuDeviceCreateComputePipelineAsync(device, &descriptor, ToMockCreateComputePipelineAsyncCallback, this); @@ -314,8 +314,8 @@ TEST_F(WireCreatePipelineAsyncTest, CreateComputePipelineAsyncAfterDisconnect) { EXPECT_CALL(api, DeviceCreateShaderModule(apiDevice, _)).WillOnce(Return(apiCsModule)); WGPUComputePipelineDescriptor descriptor{}; - descriptor.computeStage.module = csModule; - descriptor.computeStage.entryPoint = "main"; + descriptor.compute.module = csModule; + descriptor.compute.entryPoint = "main"; FlushClient();