ComputePipelineDescriptor.computeStage->compute

Deprecates the computeStage member of the descriptor in favor of compute
as described by the spec. In order to support both variants without
breaking backwards compatibility some code had to be manually added to
the wire client to copy from the deprecated member to the new one and
visa versa.

Change-Id: I9d5c2fc9c446c927c5792c9af9ed56c90060b65b
Bug: dawn:800
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/53884
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Brandon Jones 2021-06-09 18:07:32 +00:00 committed by Dawn LUCI CQ
parent e5b9903cc1
commit 0d50a2c770
47 changed files with 251 additions and 178 deletions

View File

@ -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"}
]
},

View File

@ -163,6 +163,7 @@
"client_handwritten_commands": [
"BufferDestroy",
"BufferUnmap",
"DeviceCreateComputePipeline",
"DeviceCreateErrorBuffer",
"DeviceGetDefaultQueue",
"DeviceGetQueue",

View File

@ -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) {

View File

@ -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)

View File

@ -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()) {

View File

@ -1115,11 +1115,18 @@ namespace dawn_native {
ComputePipelineDescriptor* outDescriptor) {
Ref<PipelineLayoutBase> 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();
}

View File

@ -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));

View File

@ -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(

View File

@ -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));

View File

@ -21,7 +21,7 @@ namespace dawn_native { namespace opengl {
ComputePipeline::ComputePipeline(Device* device, const ComputePipelineDescriptor* descriptor)
: ComputePipelineBase(device, descriptor) {
PerStage<const ShaderModule*> modules(nullptr);
modules[SingleShaderStage::Compute] = ToBackend(descriptor->computeStage.module);
modules[SingleShaderStage::Compute] = ToBackend(descriptor->compute.module);
PipelineGL::Initialize(device->gl, ToBackend(descriptor->layout), GetAllStages());
}

View File

@ -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());

View File

@ -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());

View File

@ -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);

View File

@ -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);

View File

@ -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<u32>(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 = {};

View File

@ -168,8 +168,8 @@ class BufferZeroInitTest : public DawnTest {
const std::vector<uint32_t>& 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.

View File

@ -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);

View File

@ -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);
}

View File

@ -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

View File

@ -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<u32, 3>;
};
@ -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<u32, 3>;
};

View File

@ -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);
}

View File

@ -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) {

View File

@ -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));

View File

@ -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(),

View File

@ -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);
}

View File

@ -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) {

View File

@ -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) {

View File

@ -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.

View File

@ -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];

View File

@ -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<f32>;
[[group(0), binding(1)]] var texture1 : texture_multisampled_2d<f32>;

View File

@ -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<workgroup> i : u32;
[[stage(compute)]] fn main() {
i = 0u;

View File

@ -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<u32, 3>;
};
@ -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

View File

@ -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),

View File

@ -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 =

View File

@ -464,8 +464,8 @@ fn IsEqualTo(pixel : vec4<f32>, expected : vec4<f32>) -> 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

View File

@ -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<f32>;
[[block]] struct Result {
@ -984,8 +984,8 @@ TEST_P(TextureZeroInitTest, ComputePassSampledTextureClear) {
result.value = textureLoad(tex, vec2<i32>(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);

View File

@ -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),

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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<MockCallback<WGPUCreateComputePipelineAsyncCallback>> 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<MockCallback<WGPUCreateComputePipelineAsyncCallback>> creationCallback;
EXPECT_CALL(creationCallback,

View File

@ -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);

View File

@ -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);
}

View File

@ -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 = {

View File

@ -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);

View File

@ -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();