Deprecate dispatch* in favor of dispatchWorkgroups*

In https://github.com/gpuweb/gpuweb/pull/2689 both dispatch and
dispatchIndirect were renamed to dispatchWorkgroups and
dispatchWorkgroupsIndirect in order to clarify the meaning of the
arguments.

Change-Id: Iadb9d8b60c43445a69f9c569fba2340b5dca95a9
Bug: dawn:22
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88364
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Brandon Jones <bajones@chromium.org>
This commit is contained in:
Brandon Jones 2022-04-29 17:51:54 +00:00 committed by Dawn LUCI CQ
parent 4c6c974564
commit 3daebe896f
38 changed files with 185 additions and 117 deletions

View File

@ -796,6 +796,15 @@
},
{
"name": "dispatch",
"tags": ["deprecated"],
"args": [
{"name": "workgroupCountX", "type": "uint32_t"},
{"name": "workgroupCountY", "type": "uint32_t", "default": "1"},
{"name": "workgroupCountZ", "type": "uint32_t", "default": "1"}
]
},
{
"name": "dispatch workgroups",
"args": [
{"name": "workgroupCountX", "type": "uint32_t"},
{"name": "workgroupCountY", "type": "uint32_t", "default": "1"},
@ -804,6 +813,14 @@
},
{
"name": "dispatch indirect",
"tags": ["deprecated"],
"args": [
{"name": "indirect buffer", "type": "buffer"},
{"name": "indirect offset", "type": "uint64_t"}
]
},
{
"name": "dispatch workgroups indirect",
"args": [
{"name": "indirect buffer", "type": "buffer"},
{"name": "indirect offset", "type": "uint64_t"}

View File

@ -186,6 +186,14 @@ namespace dawn::native {
void ComputePassEncoder::APIDispatch(uint32_t workgroupCountX,
uint32_t workgroupCountY,
uint32_t workgroupCountZ) {
GetDevice()->EmitDeprecationWarning(
"dispatch() has been deprecated. Use dispatchWorkgroups() instead.");
APIDispatchWorkgroups(workgroupCountX, workgroupCountY, workgroupCountZ);
}
void ComputePassEncoder::APIDispatchWorkgroups(uint32_t workgroupCountX,
uint32_t workgroupCountY,
uint32_t workgroupCountZ) {
mEncodingContext->TryEncode(
this,
[&](CommandAllocator* allocator) -> MaybeError {
@ -222,7 +230,7 @@ namespace dawn::native {
return {};
},
"encoding %s.Dispatch(%u, %u, %u).", this, workgroupCountX, workgroupCountY,
"encoding %s.DispatchWorkgroups(%u, %u, %u).", this, workgroupCountX, workgroupCountY,
workgroupCountZ);
}
@ -308,7 +316,7 @@ namespace dawn::native {
// Issue commands to validate the indirect buffer.
APISetPipeline(validationPipeline.Get());
APISetBindGroup(0, validationBindGroup.Get());
APIDispatch(1);
APIDispatchWorkgroups(1);
// Restore the state.
RestoreCommandBufferState(std::move(previousState));
@ -319,6 +327,13 @@ namespace dawn::native {
void ComputePassEncoder::APIDispatchIndirect(BufferBase* indirectBuffer,
uint64_t indirectOffset) {
GetDevice()->EmitDeprecationWarning(
"dispatchIndirect() has been deprecated. Use dispatchWorkgroupsIndirect() instead.");
APIDispatchWorkgroupsIndirect(indirectBuffer, indirectOffset);
}
void ComputePassEncoder::APIDispatchWorkgroupsIndirect(BufferBase* indirectBuffer,
uint64_t indirectOffset) {
mEncodingContext->TryEncode(
this,
[&](CommandAllocator* allocator) -> MaybeError {
@ -381,7 +396,8 @@ namespace dawn::native {
dispatch->indirectOffset = indirectOffset;
return {};
},
"encoding %s.DispatchIndirect(%s, %u).", this, indirectBuffer, indirectOffset);
"encoding %s.DispatchWorkgroupsIndirect(%s, %u).", this, indirectBuffer,
indirectOffset);
}
void ComputePassEncoder::APISetPipeline(ComputePipelineBase* pipeline) {

View File

@ -44,10 +44,10 @@ namespace dawn::native {
void APIEnd();
void APIEndPass(); // TODO(dawn:1286): Remove after deprecation period.
void APIDispatch(uint32_t workgroupCountX,
uint32_t workgroupCountY = 1,
uint32_t workgroupCountZ = 1);
void APIDispatchIndirect(BufferBase* indirectBuffer, uint64_t indirectOffset);
void APIDispatchWorkgroups(uint32_t workgroupCountX,
uint32_t workgroupCountY = 1,
uint32_t workgroupCountZ = 1);
void APIDispatchWorkgroupsIndirect(BufferBase* indirectBuffer, uint64_t indirectOffset);
void APISetPipeline(ComputePipelineBase* pipeline);
void APISetBindGroup(uint32_t groupIndex,
@ -62,6 +62,12 @@ namespace dawn::native {
RestoreCommandBufferState(std::move(state));
}
// Deprecated
void APIDispatch(uint32_t workgroupCountX,
uint32_t workgroupCountY = 1,
uint32_t workgroupCountZ = 1);
void APIDispatchIndirect(BufferBase* indirectBuffer, uint64_t indirectOffset);
protected:
ComputePassEncoder(DeviceBase* device,
const ComputePassDescriptor* descriptor,

View File

@ -441,7 +441,7 @@ namespace dawn::native {
const uint32_t numDrawsRoundedUp =
(batch.batchInfo->numDraws + kWorkgroupSize - 1) / kWorkgroupSize;
passEncoder->APISetBindGroup(0, bindGroup.Get());
passEncoder->APIDispatch(numDrawsRoundedUp);
passEncoder->APIDispatchWorkgroups(numDrawsRoundedUp);
}
passEncoder->APIEnd();

View File

@ -208,7 +208,7 @@ namespace dawn::native {
Ref<ComputePassEncoder> pass = encoder->BeginComputePass();
pass->APISetPipeline(pipeline);
pass->APISetBindGroup(0, bindGroup.Get());
pass->APIDispatch(
pass->APIDispatchWorkgroups(
static_cast<uint32_t>((timestamps->GetSize() / sizeof(uint64_t) + 7) / 8));
pass->APIEnd();

View File

@ -276,7 +276,7 @@ wgpu::CommandBuffer createCommandBuffer(const wgpu::TextureView backbufferView,
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(updatePipeline);
pass.SetBindGroup(0, updateBGs[i]);
pass.Dispatch(kNumParticles);
pass.DispatchWorkgroups(kNumParticles);
pass.End();
}

View File

@ -1241,7 +1241,7 @@ std::ostringstream& DawnTestBase::ExpectSampledFloatDataImpl(wgpu::TextureView t
wgpu::ComputePassEncoder pass = commandEncoder.BeginComputePass();
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup);
pass.Dispatch(width, height);
pass.DispatchWorkgroups(width, height);
pass.End();
wgpu::CommandBuffer commands = commandEncoder.Finish();
queue.Submit(1, &commands);

View File

@ -37,7 +37,7 @@ class BindGroupTests : public DawnTest {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
return encoder.Finish();
}
@ -479,7 +479,7 @@ TEST_P(BindGroupTests, MultipleEntryPointsWithMultipleNonZeroGroups) {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(cp);
pass.SetBindGroup(0, bindGroup0);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
cb = encoder.Finish();
queue.Submit(1, &cb);
@ -510,7 +510,7 @@ TEST_P(BindGroupTests, MultipleEntryPointsWithMultipleNonZeroGroups) {
pass.SetBindGroup(0, bindGroup0);
pass.SetBindGroup(1, bindGroup1);
pass.SetBindGroup(2, bindGroup2);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
cb = encoder.Finish();
queue.Submit(1, &cb);
@ -543,7 +543,7 @@ TEST_P(BindGroupTests, MultipleEntryPointsWithMultipleNonZeroGroups) {
pass.SetBindGroup(0, bindGroup0);
pass.SetBindGroup(1, bindGroup1);
pass.SetBindGroup(2, bindGroup2);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
cb = encoder.Finish();
queue.Submit(1, &cb);
@ -1062,7 +1062,7 @@ TEST_P(BindGroupTests, DynamicOffsetOrder) {
wgpu::ComputePassEncoder computePassEncoder = commandEncoder.BeginComputePass();
computePassEncoder.SetPipeline(pipeline);
computePassEncoder.SetBindGroup(0, bindGroup, offsets.size(), offsets.data());
computePassEncoder.Dispatch(1);
computePassEncoder.DispatchWorkgroups(1);
computePassEncoder.End();
wgpu::CommandBuffer commands = commandEncoder.Finish();
@ -1144,7 +1144,7 @@ TEST_P(BindGroupTests, DynamicAndNonDynamicBindingsDoNotConflictAfterRemapping)
wgpu::ComputePassEncoder computePassEncoder = commandEncoder.BeginComputePass();
computePassEncoder.SetPipeline(pipeline);
computePassEncoder.SetBindGroup(0, bindGroup, offsets.size(), offsets.data());
computePassEncoder.Dispatch(1);
computePassEncoder.DispatchWorkgroups(1);
computePassEncoder.End();
wgpu::CommandBuffer commands = commandEncoder.Finish();
@ -1364,7 +1364,7 @@ TEST_P(BindGroupTests, EmptyLayout) {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bg);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
wgpu::CommandBuffer commands = encoder.Finish();
@ -1563,7 +1563,7 @@ TEST_P(BindGroupTests, ReallyLargeBindGroup) {
wgpu::ComputePassEncoder pass = commandEncoder.BeginComputePass();
pass.SetPipeline(cp);
pass.SetBindGroup(0, bg);
pass.Dispatch(1, 1, 1);
pass.DispatchWorkgroups(1, 1, 1);
pass.End();
wgpu::CommandBuffer commands = commandEncoder.Finish();

View File

@ -190,7 +190,7 @@ class BufferZeroInitTest : public DawnTest {
wgpu::ComputePassEncoder computePass = encoder.BeginComputePass();
computePass.SetBindGroup(0, bindGroup);
computePass.SetPipeline(pipeline);
computePass.Dispatch(1u);
computePass.DispatchWorkgroups(1u);
computePass.End();
wgpu::CommandBuffer commandBuffer = encoder.Finish();
@ -458,7 +458,7 @@ class BufferZeroInitTest : public DawnTest {
wgpu::ComputePassEncoder computePass = encoder.BeginComputePass();
computePass.SetBindGroup(0, bindGroup);
computePass.SetPipeline(pipeline);
computePass.DispatchIndirect(indirectBuffer, indirectBufferOffset);
computePass.DispatchWorkgroupsIndirect(indirectBuffer, indirectBufferOffset);
computePass.End();
ExpectLazyClearSubmitAndCheckOutputs(encoder, indirectBuffer, bufferSize, outputTexture);

View File

@ -74,7 +74,7 @@ void ComputeCopyStorageBufferTests::BasicTest(const char* shader) {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup);
pass.Dispatch(kInstances);
pass.DispatchWorkgroups(kInstances);
pass.End();
commands = encoder.Finish();

View File

@ -100,7 +100,7 @@ class ComputeDispatchTests : public DawnTest {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup);
pass.Dispatch(x, y, z);
pass.DispatchWorkgroups(x, y, z);
pass.End();
commands = encoder.Finish();
@ -159,7 +159,7 @@ class ComputeDispatchTests : public DawnTest {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(computePipelineForTest);
pass.SetBindGroup(0, bindGroup);
pass.DispatchIndirect(indirectBuffer, indirectOffset);
pass.DispatchWorkgroupsIndirect(indirectBuffer, indirectOffset);
pass.End();
commands = encoder.Finish();

View File

@ -324,7 +324,7 @@ fn main() {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
commands = encoder.Finish();

View File

@ -56,7 +56,7 @@ void ComputeSharedMemoryTests::BasicTest(const char* shader) {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
commands = encoder.Finish();
@ -178,7 +178,7 @@ TEST_P(ComputeSharedMemoryTests, AssortedTypes) {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
commands = encoder.Finish();

View File

@ -58,7 +58,7 @@ TEST_P(ComputeStorageBufferBarrierTests, AddIncrement) {
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup);
for (uint32_t i = 0; i < kIterations; ++i) {
pass.Dispatch(kNumValues);
pass.DispatchWorkgroups(kNumValues);
}
pass.End();
wgpu::CommandBuffer commands = encoder.Finish();
@ -121,9 +121,9 @@ TEST_P(ComputeStorageBufferBarrierTests, AddPingPong) {
for (uint32_t i = 0; i < kIterations / 2; ++i) {
pass.SetBindGroup(0, bindGroups[0]);
pass.Dispatch(kNumValues);
pass.DispatchWorkgroups(kNumValues);
pass.SetBindGroup(0, bindGroups[1]);
pass.Dispatch(kNumValues);
pass.DispatchWorkgroups(kNumValues);
}
pass.End();
wgpu::CommandBuffer commands = encoder.Finish();
@ -187,9 +187,9 @@ TEST_P(ComputeStorageBufferBarrierTests, StorageAndReadonlyStoragePingPongInOneP
for (uint32_t i = 0; i < kIterations / 2; ++i) {
pass.SetBindGroup(0, bindGroups[0]);
pass.Dispatch(kNumValues);
pass.DispatchWorkgroups(kNumValues);
pass.SetBindGroup(0, bindGroups[1]);
pass.Dispatch(kNumValues);
pass.DispatchWorkgroups(kNumValues);
}
pass.End();
wgpu::CommandBuffer commands = encoder.Finish();
@ -256,7 +256,7 @@ TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPong) {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroups[b]);
pass.Dispatch(kNumValues / 4);
pass.DispatchWorkgroups(kNumValues / 4);
pass.End();
}
@ -323,7 +323,7 @@ TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPongInOnePass) {
for (uint32_t i = 0, b = 0; i < kIterations; ++i, b = 1 - b) {
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroups[b]);
pass.Dispatch(kNumValues / 4);
pass.DispatchWorkgroups(kNumValues / 4);
}
pass.End();
@ -389,7 +389,7 @@ TEST_P(ComputeStorageBufferBarrierTests, IndirectBufferCorrectBarrier) {
pass.SetPipeline(step2Pipeline);
pass.SetBindGroup(0, step2Group);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
// 3 - Use the indirect buffer in a Dispatch while also reading its data.
wgpu::Buffer resultBuffer = utils::CreateBufferFromData<uint32_t>(
@ -399,7 +399,7 @@ TEST_P(ComputeStorageBufferBarrierTests, IndirectBufferCorrectBarrier) {
pass.SetPipeline(step3Pipeline);
pass.SetBindGroup(0, step3Group);
pass.DispatchIndirect(buf, 0);
pass.DispatchWorkgroupsIndirect(buf, 0);
pass.End();
wgpu::CommandBuffer commands = encoder.Finish();

View File

@ -475,8 +475,8 @@ class CopyTextureForBrowserTests : public Parent {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup);
pass.Dispatch(dstSpec.textureSize.width,
dstSpec.textureSize.height); // Verify dst texture content
pass.DispatchWorkgroups(dstSpec.textureSize.width,
dstSpec.textureSize.height); // Verify dst texture content
pass.End();
testCommands = encoder.Finish();

View File

@ -53,7 +53,7 @@ class CreatePipelineAsyncTest : public DawnTest {
pass.SetBindGroup(0, bindGroup);
pass.SetPipeline(currentTask->computePipeline);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
commands = encoder.Finish();

View File

@ -139,6 +139,35 @@ TEST_P(DeprecationTests, EndPass) {
}
}
// Test that dispatch() and dispatchIndirect() is deprecated.
TEST_P(DeprecationTests, Dispatch) {
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
@stage(compute) @workgroup_size(1, 1, 1)
fn main() {
})");
wgpu::ComputePipelineDescriptor csDesc;
csDesc.compute.module = module;
csDesc.compute.entryPoint = "main";
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&csDesc);
std::array<uint32_t, 3> indirectBufferData = {1, 0, 0};
wgpu::Buffer indirectBuffer = utils::CreateBufferFromData(
device, &indirectBufferData[0], indirectBufferData.size() * sizeof(uint32_t),
wgpu::BufferUsage::Indirect);
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(pipeline);
EXPECT_DEPRECATION_WARNING(pass.Dispatch(1));
EXPECT_DEPRECATION_WARNING(pass.DispatchIndirect(indirectBuffer, 0));
pass.End();
}
DAWN_INSTANTIATE_TEST(DeprecationTests,
D3D12Backend(),
MetalBackend(),

View File

@ -385,7 +385,7 @@ class DepthStencilSamplingTest : public DawnTestWithParams<DepthStencilSamplingT
wgpu::ComputePassEncoder pass = commandEncoder.BeginComputePass();
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
}
@ -583,7 +583,7 @@ class DepthStencilSamplingTest : public DawnTestWithParams<DepthStencilSamplingT
wgpu::ComputePassEncoder pass = commandEncoder.BeginComputePass();
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
}
@ -723,7 +723,7 @@ TEST_P(DepthStencilSamplingTest, SampleDepthAndStencilRender) {
wgpu::ComputePassEncoder pass = commandEncoder.BeginComputePass();
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
}

View File

@ -687,7 +687,7 @@ TEST_P(DrawIndexedIndirectTest, ValidateReusedBundleWithChangingParams) {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(computePipeline);
pass.SetBindGroup(0, bindGroup);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
};

View File

@ -264,7 +264,7 @@ TEST_P(DynamicBufferOffsetTests, BasicComputePipeline) {
wgpu::ComputePassEncoder computePassEncoder = commandEncoder.BeginComputePass();
computePassEncoder.SetPipeline(pipeline);
computePassEncoder.SetBindGroup(0, mBindGroups[0], offsets.size(), offsets.data());
computePassEncoder.Dispatch(1);
computePassEncoder.DispatchWorkgroups(1);
computePassEncoder.End();
wgpu::CommandBuffer commands = commandEncoder.Finish();
queue.Submit(1, &commands);
@ -284,7 +284,7 @@ TEST_P(DynamicBufferOffsetTests, SetDynamicOffsetsComputePipeline) {
wgpu::ComputePassEncoder computePassEncoder = commandEncoder.BeginComputePass();
computePassEncoder.SetPipeline(pipeline);
computePassEncoder.SetBindGroup(0, mBindGroups[0], offsets.size(), offsets.data());
computePassEncoder.Dispatch(1);
computePassEncoder.DispatchWorkgroups(1);
computePassEncoder.End();
wgpu::CommandBuffer commands = commandEncoder.Finish();
queue.Submit(1, &commands);
@ -339,10 +339,10 @@ TEST_P(DynamicBufferOffsetTests, InheritDynamicOffsetsComputePipeline) {
wgpu::ComputePassEncoder computePassEncoder = commandEncoder.BeginComputePass();
computePassEncoder.SetPipeline(pipeline);
computePassEncoder.SetBindGroup(0, mBindGroups[0], offsets.size(), offsets.data());
computePassEncoder.Dispatch(1);
computePassEncoder.DispatchWorkgroups(1);
computePassEncoder.SetPipeline(testPipeline);
computePassEncoder.SetBindGroup(1, mBindGroups[1]);
computePassEncoder.Dispatch(1);
computePassEncoder.DispatchWorkgroups(1);
computePassEncoder.End();
wgpu::CommandBuffer commands = commandEncoder.Finish();
queue.Submit(1, &commands);
@ -392,9 +392,9 @@ TEST_P(DynamicBufferOffsetTests, UpdateDynamicOffsetsMultipleTimesComputePipelin
wgpu::ComputePassEncoder computePassEncoder = commandEncoder.BeginComputePass();
computePassEncoder.SetPipeline(pipeline);
computePassEncoder.SetBindGroup(0, mBindGroups[0], offsets.size(), offsets.data());
computePassEncoder.Dispatch(1);
computePassEncoder.DispatchWorkgroups(1);
computePassEncoder.SetBindGroup(0, mBindGroups[0], testOffsets.size(), testOffsets.data());
computePassEncoder.Dispatch(1);
computePassEncoder.DispatchWorkgroups(1);
computePassEncoder.End();
wgpu::CommandBuffer commands = commandEncoder.Finish();
queue.Submit(1, &commands);
@ -564,7 +564,7 @@ TEST_P(ClampedOOBDynamicBufferOffsetTests, CheckOOBAccess) {
wgpu::ComputePassEncoder computePassEncoder = commandEncoder.BeginComputePass();
computePassEncoder.SetPipeline(pipeline);
computePassEncoder.SetBindGroup(0, bindGroup, dynamicOffsets.size(), dynamicOffsets.data());
computePassEncoder.Dispatch(1);
computePassEncoder.DispatchWorkgroups(1);
computePassEncoder.End();
wgpu::CommandBuffer commands = commandEncoder.Finish();
queue.Submit(1, &commands);

View File

@ -119,7 +119,7 @@ TEST_P(EntryPointTests, TwoComputeInModule) {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(write1);
pass.SetBindGroup(0, group);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands);
@ -133,7 +133,7 @@ TEST_P(EntryPointTests, TwoComputeInModule) {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(write42);
pass.SetBindGroup(0, group);
pass.Dispatch(42);
pass.DispatchWorkgroups(42);
pass.End();
wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands);

View File

@ -106,7 +106,7 @@ TEST_P(GpuMemorySyncTests, ComputePass) {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(compute);
pass.SetBindGroup(0, bindGroup);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
}
@ -170,7 +170,7 @@ TEST_P(GpuMemorySyncTests, RenderPassToComputePass) {
wgpu::ComputePassEncoder pass1 = encoder.BeginComputePass();
pass1.SetPipeline(compute);
pass1.SetBindGroup(0, bindGroup1);
pass1.Dispatch(1);
pass1.DispatchWorkgroups(1);
pass1.End();
wgpu::CommandBuffer commands = encoder.Finish();
@ -196,7 +196,7 @@ TEST_P(GpuMemorySyncTests, ComputePassToRenderPass) {
wgpu::ComputePassEncoder pass0 = encoder.BeginComputePass();
pass0.SetPipeline(compute);
pass0.SetBindGroup(0, bindGroup1);
pass0.Dispatch(1);
pass0.DispatchWorkgroups(1);
pass0.End();
// Read that data in render pass.
@ -296,7 +296,7 @@ TEST_P(StorageToUniformSyncTests, ReadAfterWriteWithSameCommandBuffer) {
wgpu::ComputePassEncoder pass0 = encoder0.BeginComputePass();
pass0.SetPipeline(compute);
pass0.SetBindGroup(0, computeBindGroup);
pass0.Dispatch(1);
pass0.DispatchWorkgroups(1);
pass0.End();
// Read that data in render pass.
@ -329,7 +329,7 @@ TEST_P(StorageToUniformSyncTests, ReadAfterWriteWithDifferentCommandBuffers) {
wgpu::ComputePassEncoder pass0 = encoder0.BeginComputePass();
pass0.SetPipeline(compute);
pass0.SetBindGroup(0, computeBindGroup);
pass0.Dispatch(1);
pass0.DispatchWorkgroups(1);
pass0.End();
cb[0] = encoder0.Finish();
@ -364,7 +364,7 @@ TEST_P(StorageToUniformSyncTests, ReadAfterWriteWithDifferentQueueSubmits) {
wgpu::ComputePassEncoder pass0 = encoder0.BeginComputePass();
pass0.SetPipeline(compute);
pass0.SetBindGroup(0, computeBindGroup);
pass0.Dispatch(1);
pass0.DispatchWorkgroups(1);
pass0.End();
cb[0] = encoder0.Finish();
queue.Submit(1, &cb[0]);
@ -468,7 +468,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) {
wgpu::ComputePassEncoder pass0 = encoder.BeginComputePass();
pass0.SetPipeline(cp);
pass0.SetBindGroup(0, bindGroup0);
pass0.Dispatch(1);
pass0.DispatchWorkgroups(1);
pass0.End();
// Create pipeline, bind group, and reuse buffers in render pass.
@ -585,7 +585,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) {
wgpu::ComputePassEncoder pass0 = encoder.BeginComputePass();
pass0.SetPipeline(cp);
pass0.SetBindGroup(0, bindGroup0);
pass0.Dispatch(1);
pass0.DispatchWorkgroups(1);
pass0.End();
// Create pipeline, bind group, and reuse the buffer in render pass.

View File

@ -91,7 +91,7 @@ TEST_P(MaxLimitTests, MaxComputeWorkgroupStorageSize) {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands);
@ -225,7 +225,7 @@ TEST_P(MaxLimitTests, MaxBufferBindingSize) {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands);

View File

@ -215,7 +215,7 @@ TEST_P(MultisampledSamplingTest, SamplePositions) {
{{0, colorView},
{1, depthView},
{2, outputBuffer, alignedResultSize * sampleOffset, kResultSize}}));
computePassEncoder.Dispatch(1);
computePassEncoder.DispatchWorkgroups(1);
computePassEncoder.End();
}
}

View File

@ -144,7 +144,7 @@ TEST_P(OpArrayLengthTest, Compute) {
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, mBindGroup);
pass.SetBindGroup(1, resultBindGroup);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
wgpu::CommandBuffer commands = encoder.Finish();

View File

@ -162,7 +162,7 @@ TEST_P(ShaderFloat16Tests, DISABLED_Basic16BitFloatFeaturesTest) {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands);

View File

@ -91,7 +91,7 @@ struct Buf {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
commands = encoder.Finish();
@ -456,7 +456,7 @@ struct Buf {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
commands = encoder.Finish();
@ -512,7 +512,7 @@ struct Buf {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
commands = encoder.Finish();
@ -564,7 +564,7 @@ struct Buf {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
commands = encoder.Finish();
@ -651,15 +651,15 @@ struct Buf {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(pipeline1);
pass.SetBindGroup(0, bindGroup1);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.SetPipeline(pipeline2);
pass.SetBindGroup(0, bindGroup2);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.SetPipeline(pipeline3);
pass.SetBindGroup(0, bindGroup3);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();

View File

@ -515,7 +515,7 @@ fn IsEqualTo(pixel : vec4<f32>, expected : vec4<f32>) -> bool {
wgpu::ComputePassEncoder computeEncoder = encoder.BeginComputePass();
computeEncoder.SetBindGroup(0, bindGroup);
computeEncoder.SetPipeline(pipeline);
computeEncoder.Dispatch(1);
computeEncoder.DispatchWorkgroups(1);
computeEncoder.End();
wgpu::CommandBuffer commandBuffer = encoder.Finish();
@ -567,7 +567,7 @@ fn IsEqualTo(pixel : vec4<f32>, expected : vec4<f32>) -> bool {
wgpu::ComputePassEncoder computePassEncoder = encoder.BeginComputePass();
computePassEncoder.SetBindGroup(0, bindGroup);
computePassEncoder.SetPipeline(pipeline);
computePassEncoder.Dispatch(1);
computePassEncoder.DispatchWorkgroups(1);
computePassEncoder.End();
wgpu::CommandBuffer commandBuffer = encoder.Finish();
queue.Submit(1, &commandBuffer);
@ -591,7 +591,7 @@ fn IsEqualTo(pixel : vec4<f32>, expected : vec4<f32>) -> bool {
wgpu::ComputePassEncoder computePassEncoder = encoder.BeginComputePass();
computePassEncoder.SetBindGroup(0, bindGroup);
computePassEncoder.SetPipeline(pipeline);
computePassEncoder.Dispatch(1);
computePassEncoder.DispatchWorkgroups(1);
computePassEncoder.End();
wgpu::CommandBuffer commandBuffer = encoder.Finish();
queue.Submit(1, &commandBuffer);
@ -833,11 +833,11 @@ TEST_P(StorageTextureTests, SampledAndWriteonlyStorageTexturePingPong) {
// After the first dispatch the value in storageTexture2 should be 1u.
pass.SetBindGroup(0, bindGroupA);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
// After the second dispatch the value in storageTexture1 should be 2u;
pass.SetBindGroup(0, bindGroupB);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();

View File

@ -1002,7 +1002,7 @@ TEST_P(TextureZeroInitTest, ComputePassSampledTextureClear) {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(computePipeline);
pass.SetBindGroup(0, bindGroup);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
wgpu::CommandBuffer commands = encoder.Finish();
EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commands));

View File

@ -482,8 +482,8 @@ void ShaderRobustnessPerf::Step() {
pass.SetPipeline(mPipeline);
pass.SetBindGroup(0, mBindGroup);
for (unsigned int i = 0; i < kNumIterations; ++i) {
pass.Dispatch(ceil(static_cast<float>(mDimBOuter) / float{kTileSize}),
ceil(static_cast<float>(mDimAOuter) / float{kTileSize}), 1);
pass.DispatchWorkgroups(ceil(static_cast<float>(mDimBOuter) / float{kTileSize}),
ceil(static_cast<float>(mDimAOuter) / float{kTileSize}), 1);
}
pass.End();

View File

@ -105,7 +105,7 @@ namespace dawn::native {
pass.SetBindGroup(1, dynamicBG, 1, &dynamicOffset);
EXPECT_EQ(ToAPI(stateTracker->GetComputePipeline()), pipeline0.Get());
pass.DispatchIndirect(indirectBuffer, 0);
pass.DispatchWorkgroupsIndirect(indirectBuffer, 0);
// Expect restored state.
EXPECT_EQ(ToAPI(stateTracker->GetComputePipeline()), pipeline0.Get());
@ -118,7 +118,7 @@ namespace dawn::native {
// Dispatch again to check that the restored state can be used.
// Also pass an indirect offset which should get replaced with the offset
// into the scratch indirect buffer (0).
pass.DispatchIndirect(indirectBuffer, 4);
pass.DispatchWorkgroupsIndirect(indirectBuffer, 4);
// Expect restored state.
EXPECT_EQ(ToAPI(stateTracker->GetComputePipeline()), pipeline0.Get());
@ -135,7 +135,7 @@ namespace dawn::native {
EXPECT_EQ(ToAPI(stateTracker->GetComputePipeline()), pipeline1.Get());
EXPECT_EQ(ToAPI(stateTracker->GetPipelineLayout()), pl1.Get());
pass.DispatchIndirect(indirectBuffer, 0);
pass.DispatchWorkgroupsIndirect(indirectBuffer, 0);
// Expect restored state.
EXPECT_EQ(ToAPI(stateTracker->GetComputePipeline()), pipeline1.Get());

View File

@ -1531,7 +1531,7 @@ class SetBindGroupValidationTest : public ValidationTest {
if (bindGroup != nullptr) {
computePassEncoder.SetBindGroup(0, bindGroup, count, offsets);
}
computePassEncoder.Dispatch(1);
computePassEncoder.DispatchWorkgroups(1);
computePassEncoder.End();
if (!expectation) {
ASSERT_DEVICE_ERROR(commandEncoder.Finish());
@ -1597,9 +1597,9 @@ TEST_F(SetBindGroupValidationTest, VerifyGroupIfChangedAfterAction) {
wgpu::ComputePassEncoder computePassEncoder = commandEncoder.BeginComputePass();
computePassEncoder.SetPipeline(computePipeline);
computePassEncoder.SetBindGroup(0, bindGroup, 3, offsets.data());
computePassEncoder.Dispatch(1);
computePassEncoder.DispatchWorkgroups(1);
computePassEncoder.SetBindGroup(0, invalidGroup, 0, nullptr);
computePassEncoder.Dispatch(1);
computePassEncoder.DispatchWorkgroups(1);
computePassEncoder.End();
ASSERT_DEVICE_ERROR(commandEncoder.Finish());
}
@ -2298,7 +2298,7 @@ class BindingsValidationTest : public BindGroupLayoutCompatibilityTest {
cp.SetBindGroup(i, bg[i]);
}
cp.SetPipeline(pipeline);
cp.Dispatch(1);
cp.DispatchWorkgroups(1);
cp.End();
if (!expectation) {
ASSERT_DEVICE_ERROR(encoder.Finish());

View File

@ -54,7 +54,7 @@ class ComputeIndirectValidationTest : public ValidationTest {
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(pipeline);
pass.DispatchIndirect(indirectBuffer, indirectOffset);
pass.DispatchWorkgroupsIndirect(indirectBuffer, indirectOffset);
pass.End();
ValidateExpectation(encoder, expectation);

View File

@ -42,7 +42,7 @@ class ComputeValidationTest : public ValidationTest {
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(pipeline);
pass.Dispatch(x, y, z);
pass.DispatchWorkgroups(x, y, z);
pass.End();
encoder.Finish();
}

View File

@ -289,7 +289,7 @@ class MinBufferSizeTestsBase : public ValidationTest {
for (size_t i = 0; i < bindGroups.size(); ++i) {
computePassEncoder.SetBindGroup(i, bindGroups[i]);
}
computePassEncoder.Dispatch(1);
computePassEncoder.DispatchWorkgroups(1);
computePassEncoder.End();
if (!expectation) {
ASSERT_DEVICE_ERROR(commandEncoder.Finish());

View File

@ -276,7 +276,7 @@ namespace {
pass.SetBindGroup(1, unusedBG);
pass.SetBindGroup(1, usedBG);
pass.SetPipeline(pipeline);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
wgpu::CommandBuffer commands = encoder.Finish();
@ -349,7 +349,7 @@ namespace {
pass.SetBindGroup(2, unusedBG);
pass.SetBindGroup(2, usedBG);
pass.SetPipeline(pipeline);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
wgpu::CommandBuffer commands = encoder.Finish();

View File

@ -172,7 +172,7 @@ namespace {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(cp);
pass.SetBindGroup(0, bg);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
ASSERT_DEVICE_ERROR(encoder.Finish());
}
@ -213,7 +213,7 @@ namespace {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(cp);
pass.SetBindGroup(0, bg);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
encoder.Finish();
}
@ -365,11 +365,11 @@ namespace {
pass.SetPipeline(cp0);
pass.SetBindGroup(0, bg0);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.SetPipeline(cp1);
pass.SetBindGroup(0, bg1);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
encoder.Finish();
@ -430,7 +430,7 @@ namespace {
pass.SetBindGroup(0, readBG);
pass.SetBindGroup(1, writeBG);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
ASSERT_DEVICE_ERROR(encoder.Finish());
@ -474,7 +474,7 @@ namespace {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetBindGroup(0, bg1);
pass.SetPipeline(cp);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
encoder.Finish();
@ -621,7 +621,7 @@ namespace {
pass.SetBindGroup(1, readBG0);
pass.SetBindGroup(1, readBG1);
pass.SetPipeline(cp);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
encoder.Finish();
}
@ -635,7 +635,7 @@ namespace {
pass.SetBindGroup(1, readBG1);
pass.SetBindGroup(1, readBG0);
pass.SetPipeline(cp);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
ASSERT_DEVICE_ERROR(encoder.Finish());
}
@ -682,7 +682,7 @@ namespace {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(cp);
pass.SetBindGroup(0, bg);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
ASSERT_DEVICE_ERROR(encoder.Finish());
}
@ -732,7 +732,7 @@ namespace {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(cp);
pass.SetBindGroup(0, bg);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
ASSERT_DEVICE_ERROR(encoder.Finish());
}
@ -811,7 +811,7 @@ namespace {
pass.SetBindGroup(0, bg0);
pass.SetBindGroup(1, bg1);
pass.SetPipeline(cp);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
encoder.Finish();
}
@ -877,7 +877,7 @@ namespace {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(cp);
pass.SetBindGroup(0, bg);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
ASSERT_DEVICE_ERROR(encoder.Finish());
}
@ -996,7 +996,7 @@ namespace {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(cp);
pass.SetBindGroup(0, bg);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
encoder.Finish();
}
@ -1228,11 +1228,11 @@ namespace {
pass.SetPipeline(readCp);
pass.SetBindGroup(0, readBG);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.SetPipeline(writeCp);
pass.SetBindGroup(0, writeBG);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
encoder.Finish();
@ -1298,7 +1298,7 @@ namespace {
pass.SetBindGroup(0, readBG);
pass.SetBindGroup(1, writeBG);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
ASSERT_DEVICE_ERROR(encoder.Finish());
@ -1344,7 +1344,7 @@ namespace {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetBindGroup(0, bg);
pass.SetPipeline(cp);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
encoder.Finish();
}
@ -1430,7 +1430,7 @@ namespace {
pass.SetBindGroup(1, readBG0);
pass.SetBindGroup(1, readBG1);
pass.SetPipeline(cp);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
encoder.Finish();
}
@ -1445,7 +1445,7 @@ namespace {
pass.SetBindGroup(1, readBG1);
pass.SetBindGroup(1, readBG0);
pass.SetPipeline(cp);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
ASSERT_DEVICE_ERROR(encoder.Finish());
}
@ -1497,7 +1497,7 @@ namespace {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(cp);
pass.SetBindGroup(0, bg);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
ASSERT_DEVICE_ERROR(encoder.Finish());
}
@ -1551,7 +1551,7 @@ namespace {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(cp);
pass.SetBindGroup(0, bg);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
ASSERT_DEVICE_ERROR(encoder.Finish());
}
@ -1618,7 +1618,7 @@ namespace {
pass.SetBindGroup(0, readBG);
pass.SetBindGroup(1, writeBG);
pass.SetPipeline(cp);
pass.Dispatch(1);
pass.DispatchWorkgroups(1);
pass.End();
encoder.Finish();
}
@ -1673,7 +1673,7 @@ namespace {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(readCp);
pass.SetBindGroup(0, readBG);
pass.DispatchIndirect(buffer, 0);
pass.DispatchWorkgroupsIndirect(buffer, 0);
pass.End();
encoder.Finish();
}
@ -1684,7 +1684,7 @@ namespace {
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(writeCp);
pass.SetBindGroup(0, writeBG);
pass.DispatchIndirect(buffer, 0);
pass.DispatchWorkgroupsIndirect(buffer, 0);
pass.End();
ASSERT_DEVICE_ERROR(encoder.Finish());
}

View File

@ -98,7 +98,7 @@ TEST_P(InternalStorageBufferBindingTests, QueryResolveBufferBoundAsInternalStora
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup);
for (uint32_t i = 0; i < kIterations; ++i) {
pass.Dispatch(kNumValues);
pass.DispatchWorkgroups(kNumValues);
}
pass.End();
wgpu::CommandBuffer commands = encoder.Finish();