mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-06-09 16:13:34 +00:00
ComputePipelineDescriptor.computeStage->compute
Deprecates the computeStage member of the descriptor in favor of compute as described by the spec. In order to support both variants without breaking backwards compatibility some code had to be manually added to the wire client to copy from the deprecated member to the new one and visa versa. Change-Id: I9d5c2fc9c446c927c5792c9af9ed56c90060b65b Bug: dawn:800 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/53884 Commit-Queue: Brandon Jones <bajones@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
e5b9903cc1
commit
0d50a2c770
@ -620,6 +620,7 @@
|
|||||||
"members": [
|
"members": [
|
||||||
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true},
|
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true},
|
||||||
{"name": "layout", "type": "pipeline layout", "optional": true},
|
{"name": "layout", "type": "pipeline layout", "optional": true},
|
||||||
|
{"name": "compute", "type": "programmable stage descriptor"},
|
||||||
{"name": "compute stage", "type": "programmable stage descriptor"}
|
{"name": "compute stage", "type": "programmable stage descriptor"}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -163,6 +163,7 @@
|
|||||||
"client_handwritten_commands": [
|
"client_handwritten_commands": [
|
||||||
"BufferDestroy",
|
"BufferDestroy",
|
||||||
"BufferUnmap",
|
"BufferUnmap",
|
||||||
|
"DeviceCreateComputePipeline",
|
||||||
"DeviceCreateErrorBuffer",
|
"DeviceCreateErrorBuffer",
|
||||||
"DeviceGetDefaultQueue",
|
"DeviceGetDefaultQueue",
|
||||||
"DeviceGetQueue",
|
"DeviceGetQueue",
|
||||||
|
@ -253,8 +253,8 @@ void initSim() {
|
|||||||
|
|
||||||
wgpu::ComputePipelineDescriptor csDesc;
|
wgpu::ComputePipelineDescriptor csDesc;
|
||||||
csDesc.layout = pl;
|
csDesc.layout = pl;
|
||||||
csDesc.computeStage.module = module;
|
csDesc.compute.module = module;
|
||||||
csDesc.computeStage.entryPoint = "main";
|
csDesc.compute.entryPoint = "main";
|
||||||
updatePipeline = device.CreateComputePipeline(&csDesc);
|
updatePipeline = device.CreateComputePipeline(&csDesc);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < 2; ++i) {
|
for (uint32_t i = 0; i < 2; ++i) {
|
||||||
|
@ -29,9 +29,19 @@ namespace dawn_native {
|
|||||||
DAWN_TRY(device->ValidateObject(descriptor->layout));
|
DAWN_TRY(device->ValidateObject(descriptor->layout));
|
||||||
}
|
}
|
||||||
|
|
||||||
DAWN_TRY(ValidateProgrammableStage(device, descriptor->computeStage.module,
|
if (descriptor->compute.module != nullptr) {
|
||||||
descriptor->computeStage.entryPoint, descriptor->layout,
|
DAWN_TRY(ValidateProgrammableStage(device, descriptor->compute.module,
|
||||||
SingleShaderStage::Compute));
|
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 {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,8 +51,8 @@ namespace dawn_native {
|
|||||||
const ComputePipelineDescriptor* descriptor)
|
const ComputePipelineDescriptor* descriptor)
|
||||||
: PipelineBase(device,
|
: PipelineBase(device,
|
||||||
descriptor->layout,
|
descriptor->layout,
|
||||||
{{SingleShaderStage::Compute, descriptor->computeStage.module,
|
{{SingleShaderStage::Compute, descriptor->compute.module,
|
||||||
descriptor->computeStage.entryPoint}}) {
|
descriptor->compute.entryPoint}}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ComputePipelineBase::ComputePipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag)
|
ComputePipelineBase::ComputePipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag)
|
||||||
|
@ -113,8 +113,8 @@ namespace dawn_native {
|
|||||||
mUserdata(userdata),
|
mUserdata(userdata),
|
||||||
mLabel(descriptor->label != nullptr ? descriptor->label : ""),
|
mLabel(descriptor->label != nullptr ? descriptor->label : ""),
|
||||||
mLayout(descriptor->layout),
|
mLayout(descriptor->layout),
|
||||||
mEntryPoint(descriptor->computeStage.entryPoint),
|
mEntryPoint(descriptor->compute.entryPoint),
|
||||||
mComputeShaderModule(descriptor->computeStage.module) {
|
mComputeShaderModule(descriptor->compute.module) {
|
||||||
ASSERT(mComputePipeline != nullptr);
|
ASSERT(mComputePipeline != nullptr);
|
||||||
|
|
||||||
// TODO(jiawei.shao@intel.com): save nextInChain when it is supported in Dawn.
|
// TODO(jiawei.shao@intel.com): save nextInChain when it is supported in Dawn.
|
||||||
@ -126,9 +126,9 @@ namespace dawn_native {
|
|||||||
if (!mLabel.empty()) {
|
if (!mLabel.empty()) {
|
||||||
descriptor.label = mLabel.c_str();
|
descriptor.label = mLabel.c_str();
|
||||||
}
|
}
|
||||||
descriptor.computeStage.entryPoint = mEntryPoint.c_str();
|
descriptor.compute.entryPoint = mEntryPoint.c_str();
|
||||||
descriptor.layout = mLayout.Get();
|
descriptor.layout = mLayout.Get();
|
||||||
descriptor.computeStage.module = mComputeShaderModule.Get();
|
descriptor.compute.module = mComputeShaderModule.Get();
|
||||||
MaybeError maybeError = mComputePipeline->Initialize(&descriptor);
|
MaybeError maybeError = mComputePipeline->Initialize(&descriptor);
|
||||||
std::string errorMessage;
|
std::string errorMessage;
|
||||||
if (maybeError.IsError()) {
|
if (maybeError.IsError()) {
|
||||||
|
@ -1115,11 +1115,18 @@ namespace dawn_native {
|
|||||||
ComputePipelineDescriptor* outDescriptor) {
|
ComputePipelineDescriptor* outDescriptor) {
|
||||||
Ref<PipelineLayoutBase> layoutRef;
|
Ref<PipelineLayoutBase> layoutRef;
|
||||||
*outDescriptor = descriptor;
|
*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) {
|
if (outDescriptor->layout == nullptr) {
|
||||||
DAWN_TRY_ASSIGN(layoutRef, PipelineLayoutBase::CreateDefault(
|
DAWN_TRY_ASSIGN(layoutRef,
|
||||||
this, {{SingleShaderStage::Compute,
|
PipelineLayoutBase::CreateDefault(
|
||||||
outDescriptor->computeStage.module,
|
this, {{SingleShaderStage::Compute, outDescriptor->compute.module,
|
||||||
outDescriptor->computeStage.entryPoint}}));
|
outDescriptor->compute.entryPoint}}));
|
||||||
outDescriptor->layout = layoutRef.Get();
|
outDescriptor->layout = layoutRef.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,8 +125,8 @@ namespace dawn_native {
|
|||||||
ComputePipelineDescriptor computePipelineDesc = {};
|
ComputePipelineDescriptor computePipelineDesc = {};
|
||||||
// Generate the layout based on shader module.
|
// Generate the layout based on shader module.
|
||||||
computePipelineDesc.layout = nullptr;
|
computePipelineDesc.layout = nullptr;
|
||||||
computePipelineDesc.computeStage.module = store->timestampCS.Get();
|
computePipelineDesc.compute.module = store->timestampCS.Get();
|
||||||
computePipelineDesc.computeStage.entryPoint = "main";
|
computePipelineDesc.compute.entryPoint = "main";
|
||||||
|
|
||||||
DAWN_TRY_ASSIGN(store->timestampComputePipeline,
|
DAWN_TRY_ASSIGN(store->timestampComputePipeline,
|
||||||
device->CreateComputePipeline(&computePipelineDesc));
|
device->CreateComputePipeline(&computePipelineDesc));
|
||||||
|
@ -43,15 +43,15 @@ namespace dawn_native { namespace d3d12 {
|
|||||||
// SPRIV-cross does matrix multiplication expecting row major matrices
|
// SPRIV-cross does matrix multiplication expecting row major matrices
|
||||||
compileFlags |= D3DCOMPILE_PACK_MATRIX_ROW_MAJOR;
|
compileFlags |= D3DCOMPILE_PACK_MATRIX_ROW_MAJOR;
|
||||||
|
|
||||||
ShaderModule* module = ToBackend(descriptor->computeStage.module);
|
ShaderModule* module = ToBackend(descriptor->compute.module);
|
||||||
|
|
||||||
D3D12_COMPUTE_PIPELINE_STATE_DESC d3dDesc = {};
|
D3D12_COMPUTE_PIPELINE_STATE_DESC d3dDesc = {};
|
||||||
d3dDesc.pRootSignature = ToBackend(GetLayout())->GetRootSignature();
|
d3dDesc.pRootSignature = ToBackend(GetLayout())->GetRootSignature();
|
||||||
|
|
||||||
CompiledShader compiledShader;
|
CompiledShader compiledShader;
|
||||||
DAWN_TRY_ASSIGN(compiledShader, module->Compile(descriptor->computeStage.entryPoint,
|
DAWN_TRY_ASSIGN(compiledShader,
|
||||||
SingleShaderStage::Compute,
|
module->Compile(descriptor->compute.entryPoint, SingleShaderStage::Compute,
|
||||||
ToBackend(GetLayout()), compileFlags));
|
ToBackend(GetLayout()), compileFlags));
|
||||||
d3dDesc.CS = compiledShader.GetD3D12ShaderBytecode();
|
d3dDesc.CS = compiledShader.GetD3D12ShaderBytecode();
|
||||||
auto* d3d12Device = device->GetD3D12Device();
|
auto* d3d12Device = device->GetD3D12Device();
|
||||||
DAWN_TRY(CheckHRESULT(
|
DAWN_TRY(CheckHRESULT(
|
||||||
|
@ -32,8 +32,8 @@ namespace dawn_native { namespace metal {
|
|||||||
MaybeError ComputePipeline::Initialize(const ComputePipelineDescriptor* descriptor) {
|
MaybeError ComputePipeline::Initialize(const ComputePipelineDescriptor* descriptor) {
|
||||||
auto mtlDevice = ToBackend(GetDevice())->GetMTLDevice();
|
auto mtlDevice = ToBackend(GetDevice())->GetMTLDevice();
|
||||||
|
|
||||||
ShaderModule* computeModule = ToBackend(descriptor->computeStage.module);
|
ShaderModule* computeModule = ToBackend(descriptor->compute.module);
|
||||||
const char* computeEntryPoint = descriptor->computeStage.entryPoint;
|
const char* computeEntryPoint = descriptor->compute.entryPoint;
|
||||||
ShaderModule::MetalFunctionData computeData;
|
ShaderModule::MetalFunctionData computeData;
|
||||||
DAWN_TRY(computeModule->CreateFunction(computeEntryPoint, SingleShaderStage::Compute,
|
DAWN_TRY(computeModule->CreateFunction(computeEntryPoint, SingleShaderStage::Compute,
|
||||||
ToBackend(GetLayout()), &computeData));
|
ToBackend(GetLayout()), &computeData));
|
||||||
|
@ -21,7 +21,7 @@ namespace dawn_native { namespace opengl {
|
|||||||
ComputePipeline::ComputePipeline(Device* device, const ComputePipelineDescriptor* descriptor)
|
ComputePipeline::ComputePipeline(Device* device, const ComputePipelineDescriptor* descriptor)
|
||||||
: ComputePipelineBase(device, descriptor) {
|
: ComputePipelineBase(device, descriptor) {
|
||||||
PerStage<const ShaderModule*> modules(nullptr);
|
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());
|
PipelineGL::Initialize(device->gl, ToBackend(descriptor->layout), GetAllStages());
|
||||||
}
|
}
|
||||||
|
@ -49,13 +49,13 @@ namespace dawn_native { namespace vulkan {
|
|||||||
if (GetDevice()->IsToggleEnabled(Toggle::UseTintGenerator)) {
|
if (GetDevice()->IsToggleEnabled(Toggle::UseTintGenerator)) {
|
||||||
// Generate a new VkShaderModule with BindingRemapper tint transform for each pipeline
|
// Generate a new VkShaderModule with BindingRemapper tint transform for each pipeline
|
||||||
DAWN_TRY_ASSIGN(createInfo.stage.module,
|
DAWN_TRY_ASSIGN(createInfo.stage.module,
|
||||||
ToBackend(descriptor->computeStage.module)
|
ToBackend(descriptor->compute.module)
|
||||||
->GetTransformedModuleHandle(descriptor->computeStage.entryPoint,
|
->GetTransformedModuleHandle(descriptor->compute.entryPoint,
|
||||||
ToBackend(GetLayout())));
|
ToBackend(GetLayout())));
|
||||||
} else {
|
} 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;
|
createInfo.stage.pSpecializationInfo = nullptr;
|
||||||
|
|
||||||
Device* device = ToBackend(GetDevice());
|
Device* device = ToBackend(GetDevice());
|
||||||
|
@ -233,6 +233,34 @@ namespace dawn_wire { namespace client {
|
|||||||
return GetQueue();
|
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,
|
void Device::CreateComputePipelineAsync(WGPUComputePipelineDescriptor const* descriptor,
|
||||||
WGPUCreateComputePipelineAsyncCallback callback,
|
WGPUCreateComputePipelineAsyncCallback callback,
|
||||||
void* userdata) {
|
void* userdata) {
|
||||||
@ -243,7 +271,20 @@ namespace dawn_wire { namespace client {
|
|||||||
|
|
||||||
DeviceCreateComputePipelineAsyncCmd cmd;
|
DeviceCreateComputePipelineAsyncCmd cmd;
|
||||||
cmd.deviceId = this->id;
|
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++;
|
uint64_t serial = mCreatePipelineAsyncRequestSerial++;
|
||||||
ASSERT(mCreatePipelineAsyncRequests.find(serial) == mCreatePipelineAsyncRequests.end());
|
ASSERT(mCreatePipelineAsyncRequests.find(serial) == mCreatePipelineAsyncRequests.end());
|
||||||
|
@ -43,6 +43,7 @@ namespace dawn_wire { namespace client {
|
|||||||
bool PopErrorScope(WGPUErrorCallback callback, void* userdata);
|
bool PopErrorScope(WGPUErrorCallback callback, void* userdata);
|
||||||
WGPUBuffer CreateBuffer(const WGPUBufferDescriptor* descriptor);
|
WGPUBuffer CreateBuffer(const WGPUBufferDescriptor* descriptor);
|
||||||
WGPUBuffer CreateErrorBuffer();
|
WGPUBuffer CreateErrorBuffer();
|
||||||
|
WGPUComputePipeline CreateComputePipeline(WGPUComputePipelineDescriptor const* descriptor);
|
||||||
void CreateComputePipelineAsync(WGPUComputePipelineDescriptor const* descriptor,
|
void CreateComputePipelineAsync(WGPUComputePipelineDescriptor const* descriptor,
|
||||||
WGPUCreateComputePipelineAsyncCallback callback,
|
WGPUCreateComputePipelineAsyncCallback callback,
|
||||||
void* userdata);
|
void* userdata);
|
||||||
|
@ -1111,8 +1111,8 @@ std::ostringstream& DawnTestBase::ExpectSampledDepthData(wgpu::Texture texture,
|
|||||||
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, shaderSource.str().c_str());
|
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, shaderSource.str().c_str());
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor pipelineDescriptor;
|
wgpu::ComputePipelineDescriptor pipelineDescriptor;
|
||||||
pipelineDescriptor.computeStage.module = csModule;
|
pipelineDescriptor.compute.module = csModule;
|
||||||
pipelineDescriptor.computeStage.entryPoint = "main";
|
pipelineDescriptor.compute.entryPoint = "main";
|
||||||
|
|
||||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDescriptor);
|
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDescriptor);
|
||||||
|
|
||||||
|
@ -132,8 +132,8 @@ TEST_P(BindGroupTests, ReusedBindGroupSingleSubmit) {
|
|||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor cpDesc;
|
wgpu::ComputePipelineDescriptor cpDesc;
|
||||||
cpDesc.computeStage.module = module;
|
cpDesc.compute.module = module;
|
||||||
cpDesc.computeStage.entryPoint = "main";
|
cpDesc.compute.entryPoint = "main";
|
||||||
wgpu::ComputePipeline cp = device.CreateComputePipeline(&cpDesc);
|
wgpu::ComputePipeline cp = device.CreateComputePipeline(&cpDesc);
|
||||||
|
|
||||||
wgpu::BufferDescriptor bufferDesc;
|
wgpu::BufferDescriptor bufferDesc;
|
||||||
@ -818,7 +818,7 @@ TEST_P(BindGroupTests, DynamicOffsetOrder) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor pipelineDescriptor;
|
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
|
// TODO(crbug.com/tint/386): Use the same struct
|
||||||
[[block]] struct Buffer0 {
|
[[block]] struct Buffer0 {
|
||||||
value : u32;
|
value : u32;
|
||||||
@ -844,7 +844,7 @@ TEST_P(BindGroupTests, DynamicOffsetOrder) {
|
|||||||
[[stage(compute)]] fn main() {
|
[[stage(compute)]] fn main() {
|
||||||
outputBuffer.value = vec3<u32>(buffer0.value, buffer2.value, buffer3.value);
|
outputBuffer.value = vec3<u32>(buffer0.value, buffer2.value, buffer3.value);
|
||||||
})");
|
})");
|
||||||
pipelineDescriptor.computeStage.entryPoint = "main";
|
pipelineDescriptor.compute.entryPoint = "main";
|
||||||
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDescriptor);
|
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDescriptor);
|
||||||
|
|
||||||
@ -1064,8 +1064,8 @@ TEST_P(BindGroupTests, EmptyLayout) {
|
|||||||
|
|
||||||
wgpu::ComputePipelineDescriptor pipelineDesc;
|
wgpu::ComputePipelineDescriptor pipelineDesc;
|
||||||
pipelineDesc.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
pipelineDesc.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||||
pipelineDesc.computeStage.entryPoint = "main";
|
pipelineDesc.compute.entryPoint = "main";
|
||||||
pipelineDesc.computeStage.module = utils::CreateShaderModule(device, R"(
|
pipelineDesc.compute.module = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(compute)]] fn main() {
|
[[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";
|
std::string shader = interface.str() + "[[stage(compute)]] fn main() {\n" + body.str() + "}\n";
|
||||||
wgpu::ComputePipelineDescriptor cpDesc;
|
wgpu::ComputePipelineDescriptor cpDesc;
|
||||||
cpDesc.computeStage.module = utils::CreateShaderModule(device, shader.c_str());
|
cpDesc.compute.module = utils::CreateShaderModule(device, shader.c_str());
|
||||||
cpDesc.computeStage.entryPoint = "main";
|
cpDesc.compute.entryPoint = "main";
|
||||||
wgpu::ComputePipeline cp = device.CreateComputePipeline(&cpDesc);
|
wgpu::ComputePipeline cp = device.CreateComputePipeline(&cpDesc);
|
||||||
|
|
||||||
wgpu::BindGroupDescriptor bgDesc = {};
|
wgpu::BindGroupDescriptor bgDesc = {};
|
||||||
|
@ -168,8 +168,8 @@ class BufferZeroInitTest : public DawnTest {
|
|||||||
const std::vector<uint32_t>& expectedBufferData) {
|
const std::vector<uint32_t>& expectedBufferData) {
|
||||||
wgpu::ComputePipelineDescriptor pipelineDescriptor;
|
wgpu::ComputePipelineDescriptor pipelineDescriptor;
|
||||||
pipelineDescriptor.layout = nullptr;
|
pipelineDescriptor.layout = nullptr;
|
||||||
pipelineDescriptor.computeStage.module = module;
|
pipelineDescriptor.compute.module = module;
|
||||||
pipelineDescriptor.computeStage.entryPoint = "main";
|
pipelineDescriptor.compute.entryPoint = "main";
|
||||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDescriptor);
|
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDescriptor);
|
||||||
|
|
||||||
const uint64_t bufferSize = expectedBufferData.size() * sizeof(uint32_t);
|
const uint64_t bufferSize = expectedBufferData.size() * sizeof(uint32_t);
|
||||||
@ -433,8 +433,8 @@ class BufferZeroInitTest : public DawnTest {
|
|||||||
|
|
||||||
wgpu::ComputePipelineDescriptor pipelineDescriptor;
|
wgpu::ComputePipelineDescriptor pipelineDescriptor;
|
||||||
pipelineDescriptor.layout = nullptr;
|
pipelineDescriptor.layout = nullptr;
|
||||||
pipelineDescriptor.computeStage.module = utils::CreateShaderModule(device, computeShader);
|
pipelineDescriptor.compute.module = utils::CreateShaderModule(device, computeShader);
|
||||||
pipelineDescriptor.computeStage.entryPoint = "main";
|
pipelineDescriptor.compute.entryPoint = "main";
|
||||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDescriptor);
|
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDescriptor);
|
||||||
|
|
||||||
// Clear the color of outputTexture to green.
|
// Clear the color of outputTexture to green.
|
||||||
|
@ -32,8 +32,8 @@ void ComputeCopyStorageBufferTests::BasicTest(const char* shader) {
|
|||||||
auto module = utils::CreateShaderModule(device, shader);
|
auto module = utils::CreateShaderModule(device, shader);
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor csDesc;
|
wgpu::ComputePipelineDescriptor csDesc;
|
||||||
csDesc.computeStage.module = module;
|
csDesc.compute.module = module;
|
||||||
csDesc.computeStage.entryPoint = "main";
|
csDesc.compute.entryPoint = "main";
|
||||||
|
|
||||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&csDesc);
|
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&csDesc);
|
||||||
|
|
||||||
|
@ -54,8 +54,8 @@ class ComputeDispatchTests : public DawnTest {
|
|||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor csDesc;
|
wgpu::ComputePipelineDescriptor csDesc;
|
||||||
csDesc.computeStage.module = module;
|
csDesc.compute.module = module;
|
||||||
csDesc.computeStage.entryPoint = "main";
|
csDesc.compute.entryPoint = "main";
|
||||||
pipeline = device.CreateComputePipeline(&csDesc);
|
pipeline = device.CreateComputePipeline(&csDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,8 +30,8 @@ void ComputeSharedMemoryTests::BasicTest(const char* shader) {
|
|||||||
auto module = utils::CreateShaderModule(device, shader);
|
auto module = utils::CreateShaderModule(device, shader);
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor csDesc;
|
wgpu::ComputePipelineDescriptor csDesc;
|
||||||
csDesc.computeStage.module = module;
|
csDesc.compute.module = module;
|
||||||
csDesc.computeStage.entryPoint = "main";
|
csDesc.compute.entryPoint = "main";
|
||||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&csDesc);
|
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&csDesc);
|
||||||
|
|
||||||
// Set up dst storage buffer
|
// Set up dst storage buffer
|
||||||
|
@ -45,8 +45,8 @@ TEST_P(ComputeStorageBufferBarrierTests, AddIncrement) {
|
|||||||
)");
|
)");
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor pipelineDesc = {};
|
wgpu::ComputePipelineDescriptor pipelineDesc = {};
|
||||||
pipelineDesc.computeStage.module = module;
|
pipelineDesc.compute.module = module;
|
||||||
pipelineDesc.computeStage.entryPoint = "main";
|
pipelineDesc.compute.entryPoint = "main";
|
||||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
|
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
|
||||||
|
|
||||||
wgpu::BindGroup bindGroup =
|
wgpu::BindGroup bindGroup =
|
||||||
@ -101,8 +101,8 @@ TEST_P(ComputeStorageBufferBarrierTests, AddPingPong) {
|
|||||||
)");
|
)");
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor pipelineDesc = {};
|
wgpu::ComputePipelineDescriptor pipelineDesc = {};
|
||||||
pipelineDesc.computeStage.module = module;
|
pipelineDesc.compute.module = module;
|
||||||
pipelineDesc.computeStage.entryPoint = "main";
|
pipelineDesc.compute.entryPoint = "main";
|
||||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
|
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
|
||||||
|
|
||||||
wgpu::BindGroup bindGroupA = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
|
wgpu::BindGroup bindGroupA = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
|
||||||
@ -172,8 +172,8 @@ TEST_P(ComputeStorageBufferBarrierTests, StorageAndReadonlyStoragePingPongInOneP
|
|||||||
)");
|
)");
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor pipelineDesc = {};
|
wgpu::ComputePipelineDescriptor pipelineDesc = {};
|
||||||
pipelineDesc.computeStage.module = module;
|
pipelineDesc.compute.module = module;
|
||||||
pipelineDesc.computeStage.entryPoint = "main";
|
pipelineDesc.compute.entryPoint = "main";
|
||||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
|
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
|
||||||
|
|
||||||
wgpu::BindGroup bindGroupA = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
|
wgpu::BindGroup bindGroupA = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
|
||||||
@ -241,8 +241,8 @@ TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPong) {
|
|||||||
)");
|
)");
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor pipelineDesc = {};
|
wgpu::ComputePipelineDescriptor pipelineDesc = {};
|
||||||
pipelineDesc.computeStage.module = module;
|
pipelineDesc.compute.module = module;
|
||||||
pipelineDesc.computeStage.entryPoint = "main";
|
pipelineDesc.compute.entryPoint = "main";
|
||||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
|
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
|
||||||
|
|
||||||
wgpu::BindGroup bindGroupA = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
|
wgpu::BindGroup bindGroupA = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
|
||||||
@ -309,8 +309,8 @@ TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPongInOnePass) {
|
|||||||
)");
|
)");
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor pipelineDesc = {};
|
wgpu::ComputePipelineDescriptor pipelineDesc = {};
|
||||||
pipelineDesc.computeStage.module = module;
|
pipelineDesc.compute.module = module;
|
||||||
pipelineDesc.computeStage.entryPoint = "main";
|
pipelineDesc.compute.entryPoint = "main";
|
||||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
|
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
|
||||||
|
|
||||||
wgpu::BindGroup bindGroupA = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
|
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"));
|
DAWN_SUPPRESS_TEST_IF(IsD3D12() && !HasToggleEnabled("use_tint_generator"));
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor step2PipelineDesc;
|
wgpu::ComputePipelineDescriptor step2PipelineDesc;
|
||||||
step2PipelineDesc.computeStage.entryPoint = "main";
|
step2PipelineDesc.compute.entryPoint = "main";
|
||||||
step2PipelineDesc.computeStage.module = utils::CreateShaderModule(device, R"(
|
step2PipelineDesc.compute.module = utils::CreateShaderModule(device, R"(
|
||||||
[[block]] struct Buf {
|
[[block]] struct Buf {
|
||||||
data : array<u32, 3>;
|
data : array<u32, 3>;
|
||||||
};
|
};
|
||||||
@ -368,8 +368,8 @@ TEST_P(ComputeStorageBufferBarrierTests, IndirectBufferCorrectBarrier) {
|
|||||||
wgpu::ComputePipeline step2Pipeline = device.CreateComputePipeline(&step2PipelineDesc);
|
wgpu::ComputePipeline step2Pipeline = device.CreateComputePipeline(&step2PipelineDesc);
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor step3PipelineDesc;
|
wgpu::ComputePipelineDescriptor step3PipelineDesc;
|
||||||
step3PipelineDesc.computeStage.entryPoint = "main";
|
step3PipelineDesc.compute.entryPoint = "main";
|
||||||
step3PipelineDesc.computeStage.module = utils::CreateShaderModule(device, R"(
|
step3PipelineDesc.compute.module = utils::CreateShaderModule(device, R"(
|
||||||
[[block]] struct Buf {
|
[[block]] struct Buf {
|
||||||
data : array<u32, 3>;
|
data : array<u32, 3>;
|
||||||
};
|
};
|
||||||
|
@ -207,8 +207,8 @@ class CopyTextureForBrowserTests : public DawnTest {
|
|||||||
)");
|
)");
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor csDesc;
|
wgpu::ComputePipelineDescriptor csDesc;
|
||||||
csDesc.computeStage.module = csModule;
|
csDesc.compute.module = csModule;
|
||||||
csDesc.computeStage.entryPoint = "main";
|
csDesc.compute.entryPoint = "main";
|
||||||
|
|
||||||
return device.CreateComputePipeline(&csDesc);
|
return device.CreateComputePipeline(&csDesc);
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ class CreatePipelineAsyncTest : public DawnTest {
|
|||||||
// Verify the basic use of CreateComputePipelineAsync works on all backends.
|
// Verify the basic use of CreateComputePipelineAsync works on all backends.
|
||||||
TEST_P(CreatePipelineAsyncTest, BasicUseOfCreateComputePipelineAsync) {
|
TEST_P(CreatePipelineAsyncTest, BasicUseOfCreateComputePipelineAsync) {
|
||||||
wgpu::ComputePipelineDescriptor csDesc;
|
wgpu::ComputePipelineDescriptor csDesc;
|
||||||
csDesc.computeStage.module = utils::CreateShaderModule(device, R"(
|
csDesc.compute.module = utils::CreateShaderModule(device, R"(
|
||||||
[[block]] struct SSBO {
|
[[block]] struct SSBO {
|
||||||
value : u32;
|
value : u32;
|
||||||
};
|
};
|
||||||
@ -83,7 +83,7 @@ TEST_P(CreatePipelineAsyncTest, BasicUseOfCreateComputePipelineAsync) {
|
|||||||
[[stage(compute)]] fn main() {
|
[[stage(compute)]] fn main() {
|
||||||
ssbo.value = 1u;
|
ssbo.value = 1u;
|
||||||
})");
|
})");
|
||||||
csDesc.computeStage.entryPoint = "main";
|
csDesc.compute.entryPoint = "main";
|
||||||
|
|
||||||
device.CreateComputePipelineAsync(
|
device.CreateComputePipelineAsync(
|
||||||
&csDesc,
|
&csDesc,
|
||||||
@ -109,7 +109,7 @@ TEST_P(CreatePipelineAsyncTest, CreateComputePipelineFailed) {
|
|||||||
DAWN_TEST_UNSUPPORTED_IF(HasToggleEnabled("skip_validation"));
|
DAWN_TEST_UNSUPPORTED_IF(HasToggleEnabled("skip_validation"));
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor csDesc;
|
wgpu::ComputePipelineDescriptor csDesc;
|
||||||
csDesc.computeStage.module = utils::CreateShaderModule(device, R"(
|
csDesc.compute.module = utils::CreateShaderModule(device, R"(
|
||||||
[[block]] struct SSBO {
|
[[block]] struct SSBO {
|
||||||
value : u32;
|
value : u32;
|
||||||
};
|
};
|
||||||
@ -118,7 +118,7 @@ TEST_P(CreatePipelineAsyncTest, CreateComputePipelineFailed) {
|
|||||||
[[stage(compute)]] fn main() {
|
[[stage(compute)]] fn main() {
|
||||||
ssbo.value = 1u;
|
ssbo.value = 1u;
|
||||||
})");
|
})");
|
||||||
csDesc.computeStage.entryPoint = "main0";
|
csDesc.compute.entryPoint = "main0";
|
||||||
|
|
||||||
device.CreateComputePipelineAsync(
|
device.CreateComputePipelineAsync(
|
||||||
&csDesc,
|
&csDesc,
|
||||||
@ -252,10 +252,10 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineFailed) {
|
|||||||
// CreateComputePipelineAsync() is called.
|
// CreateComputePipelineAsync() is called.
|
||||||
TEST_P(CreatePipelineAsyncTest, ReleaseDeviceBeforeCallbackOfCreateComputePipelineAsync) {
|
TEST_P(CreatePipelineAsyncTest, ReleaseDeviceBeforeCallbackOfCreateComputePipelineAsync) {
|
||||||
wgpu::ComputePipelineDescriptor csDesc;
|
wgpu::ComputePipelineDescriptor csDesc;
|
||||||
csDesc.computeStage.module = utils::CreateShaderModule(device, R"(
|
csDesc.compute.module = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(compute)]] fn main() {
|
[[stage(compute)]] fn main() {
|
||||||
})");
|
})");
|
||||||
csDesc.computeStage.entryPoint = "main";
|
csDesc.compute.entryPoint = "main";
|
||||||
|
|
||||||
device.CreateComputePipelineAsync(
|
device.CreateComputePipelineAsync(
|
||||||
&csDesc,
|
&csDesc,
|
||||||
@ -308,7 +308,7 @@ TEST_P(CreatePipelineAsyncTest, ReleaseDeviceBeforeCallbackOfCreateRenderPipelin
|
|||||||
// object from cache works correctly.
|
// object from cache works correctly.
|
||||||
TEST_P(CreatePipelineAsyncTest, CreateSameComputePipelineTwice) {
|
TEST_P(CreatePipelineAsyncTest, CreateSameComputePipelineTwice) {
|
||||||
wgpu::ComputePipelineDescriptor csDesc;
|
wgpu::ComputePipelineDescriptor csDesc;
|
||||||
csDesc.computeStage.module = utils::CreateShaderModule(device, R"(
|
csDesc.compute.module = utils::CreateShaderModule(device, R"(
|
||||||
[[block]] struct SSBO {
|
[[block]] struct SSBO {
|
||||||
value : u32;
|
value : u32;
|
||||||
};
|
};
|
||||||
@ -317,7 +317,7 @@ TEST_P(CreatePipelineAsyncTest, CreateSameComputePipelineTwice) {
|
|||||||
[[stage(compute)]] fn main() {
|
[[stage(compute)]] fn main() {
|
||||||
ssbo.value = 1u;
|
ssbo.value = 1u;
|
||||||
})");
|
})");
|
||||||
csDesc.computeStage.entryPoint = "main";
|
csDesc.compute.entryPoint = "main";
|
||||||
|
|
||||||
auto callback = [](WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline returnPipeline,
|
auto callback = [](WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline returnPipeline,
|
||||||
const char* message, void* userdata) {
|
const char* message, void* userdata) {
|
||||||
@ -349,7 +349,7 @@ TEST_P(CreatePipelineAsyncTest, CreateSameComputePipelineTwice) {
|
|||||||
// same time works correctly.
|
// same time works correctly.
|
||||||
TEST_P(CreatePipelineAsyncTest, CreateSamePipelineTwiceAtSameTime) {
|
TEST_P(CreatePipelineAsyncTest, CreateSamePipelineTwiceAtSameTime) {
|
||||||
wgpu::ComputePipelineDescriptor csDesc;
|
wgpu::ComputePipelineDescriptor csDesc;
|
||||||
csDesc.computeStage.module = utils::CreateShaderModule(device, R"(
|
csDesc.compute.module = utils::CreateShaderModule(device, R"(
|
||||||
[[block]] struct SSBO {
|
[[block]] struct SSBO {
|
||||||
value : u32;
|
value : u32;
|
||||||
};
|
};
|
||||||
@ -358,7 +358,7 @@ TEST_P(CreatePipelineAsyncTest, CreateSamePipelineTwiceAtSameTime) {
|
|||||||
[[stage(compute)]] fn main() {
|
[[stage(compute)]] fn main() {
|
||||||
ssbo.value = 1u;
|
ssbo.value = 1u;
|
||||||
})");
|
})");
|
||||||
csDesc.computeStage.entryPoint = "main";
|
csDesc.compute.entryPoint = "main";
|
||||||
|
|
||||||
auto callback = [](WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline returnPipeline,
|
auto callback = [](WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline returnPipeline,
|
||||||
const char* message, void* userdata) {
|
const char* message, void* userdata) {
|
||||||
|
@ -225,12 +225,12 @@ TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPoints) {
|
|||||||
// Store the WGSL shader into the cache.
|
// Store the WGSL shader into the cache.
|
||||||
{
|
{
|
||||||
wgpu::ComputePipelineDescriptor desc;
|
wgpu::ComputePipelineDescriptor desc;
|
||||||
desc.computeStage.module = module;
|
desc.compute.module = module;
|
||||||
desc.computeStage.entryPoint = "write1";
|
desc.compute.entryPoint = "write1";
|
||||||
EXPECT_CACHE_HIT(0u, device.CreateComputePipeline(&desc));
|
EXPECT_CACHE_HIT(0u, device.CreateComputePipeline(&desc));
|
||||||
|
|
||||||
desc.computeStage.module = module;
|
desc.compute.module = module;
|
||||||
desc.computeStage.entryPoint = "write42";
|
desc.compute.entryPoint = "write42";
|
||||||
EXPECT_CACHE_HIT(0u, device.CreateComputePipeline(&desc));
|
EXPECT_CACHE_HIT(0u, device.CreateComputePipeline(&desc));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,15 +239,15 @@ TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPoints) {
|
|||||||
// Load the same WGSL shader from the cache.
|
// Load the same WGSL shader from the cache.
|
||||||
{
|
{
|
||||||
wgpu::ComputePipelineDescriptor desc;
|
wgpu::ComputePipelineDescriptor desc;
|
||||||
desc.computeStage.module = module;
|
desc.compute.module = module;
|
||||||
desc.computeStage.entryPoint = "write1";
|
desc.compute.entryPoint = "write1";
|
||||||
|
|
||||||
// Cached HLSL shader calls LoadData twice (once to peek, again to get), so check 2 x
|
// Cached HLSL shader calls LoadData twice (once to peek, again to get), so check 2 x
|
||||||
// kNumOfShaders hits.
|
// kNumOfShaders hits.
|
||||||
EXPECT_CACHE_HIT(2u, device.CreateComputePipeline(&desc));
|
EXPECT_CACHE_HIT(2u, device.CreateComputePipeline(&desc));
|
||||||
|
|
||||||
desc.computeStage.module = module;
|
desc.compute.module = module;
|
||||||
desc.computeStage.entryPoint = "write42";
|
desc.compute.entryPoint = "write42";
|
||||||
|
|
||||||
// Cached HLSL shader calls LoadData twice, so check 2 x kNumOfShaders hits.
|
// Cached HLSL shader calls LoadData twice, so check 2 x kNumOfShaders hits.
|
||||||
EXPECT_CACHE_HIT(2u, device.CreateComputePipeline(&desc));
|
EXPECT_CACHE_HIT(2u, device.CreateComputePipeline(&desc));
|
||||||
|
@ -85,6 +85,18 @@ TEST_P(DeprecationTests, SetAttachmentDescriptorAttachment) {
|
|||||||
pass.EndPass();
|
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,
|
DAWN_INSTANTIATE_TEST(DeprecationTests,
|
||||||
D3D12Backend(),
|
D3D12Backend(),
|
||||||
MetalBackend(),
|
MetalBackend(),
|
||||||
|
@ -168,8 +168,8 @@ class DepthStencilSamplingTest : public DawnTest {
|
|||||||
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, shaderSource.str().c_str());
|
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, shaderSource.str().c_str());
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor pipelineDescriptor;
|
wgpu::ComputePipelineDescriptor pipelineDescriptor;
|
||||||
pipelineDescriptor.computeStage.module = csModule;
|
pipelineDescriptor.compute.module = csModule;
|
||||||
pipelineDescriptor.computeStage.entryPoint = "main";
|
pipelineDescriptor.compute.entryPoint = "main";
|
||||||
|
|
||||||
return device.CreateComputePipeline(&pipelineDescriptor);
|
return device.CreateComputePipeline(&pipelineDescriptor);
|
||||||
}
|
}
|
||||||
@ -236,8 +236,8 @@ class DepthStencilSamplingTest : public DawnTest {
|
|||||||
|
|
||||||
wgpu::ComputePipelineDescriptor pipelineDescriptor;
|
wgpu::ComputePipelineDescriptor pipelineDescriptor;
|
||||||
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||||
pipelineDescriptor.computeStage.module = csModule;
|
pipelineDescriptor.compute.module = csModule;
|
||||||
pipelineDescriptor.computeStage.entryPoint = "main";
|
pipelineDescriptor.compute.entryPoint = "main";
|
||||||
|
|
||||||
return device.CreateComputePipeline(&pipelineDescriptor);
|
return device.CreateComputePipeline(&pipelineDescriptor);
|
||||||
}
|
}
|
||||||
|
@ -115,8 +115,8 @@ TEST_P(DeviceLostTest, GetBindGroupLayoutFails) {
|
|||||||
|
|
||||||
wgpu::ComputePipelineDescriptor descriptor;
|
wgpu::ComputePipelineDescriptor descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
descriptor.computeStage.module = csModule;
|
descriptor.compute.module = csModule;
|
||||||
descriptor.computeStage.entryPoint = "main";
|
descriptor.compute.entryPoint = "main";
|
||||||
|
|
||||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&descriptor);
|
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&descriptor);
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ TEST_P(DeviceLostTest, CreateComputePipelineFails) {
|
|||||||
|
|
||||||
wgpu::ComputePipelineDescriptor descriptor = {};
|
wgpu::ComputePipelineDescriptor descriptor = {};
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
descriptor.computeStage.module = nullptr;
|
descriptor.compute.module = nullptr;
|
||||||
ASSERT_DEVICE_ERROR(device.CreateComputePipeline(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateComputePipeline(&descriptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -452,8 +452,8 @@ TEST_P(DeviceLostTest, DeviceLostBeforeCreatePipelineAsyncCallback) {
|
|||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor descriptor;
|
wgpu::ComputePipelineDescriptor descriptor;
|
||||||
descriptor.computeStage.module = csModule;
|
descriptor.compute.module = csModule;
|
||||||
descriptor.computeStage.entryPoint = "main";
|
descriptor.compute.entryPoint = "main";
|
||||||
|
|
||||||
auto callback = [](WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline returnPipeline,
|
auto callback = [](WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline returnPipeline,
|
||||||
const char* message, void* userdata) {
|
const char* message, void* userdata) {
|
||||||
|
@ -218,8 +218,8 @@ class DynamicBufferOffsetTests : public DawnTest {
|
|||||||
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, cs.str().c_str());
|
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, cs.str().c_str());
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor csDesc;
|
wgpu::ComputePipelineDescriptor csDesc;
|
||||||
csDesc.computeStage.module = csModule;
|
csDesc.compute.module = csModule;
|
||||||
csDesc.computeStage.entryPoint = "main";
|
csDesc.compute.entryPoint = "main";
|
||||||
|
|
||||||
wgpu::PipelineLayoutDescriptor pipelineLayoutDescriptor;
|
wgpu::PipelineLayoutDescriptor pipelineLayoutDescriptor;
|
||||||
if (isInheritedPipeline) {
|
if (isInheritedPipeline) {
|
||||||
|
@ -79,12 +79,12 @@ TEST_P(EntryPointTests, TwoComputeInModule) {
|
|||||||
|
|
||||||
// Create both pipelines from the module.
|
// Create both pipelines from the module.
|
||||||
wgpu::ComputePipelineDescriptor pipelineDesc;
|
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);
|
wgpu::ComputePipeline write1 = device.CreateComputePipeline(&pipelineDesc);
|
||||||
|
|
||||||
pipelineDesc.computeStage.entryPoint = "write42";
|
pipelineDesc.compute.entryPoint = "write42";
|
||||||
wgpu::ComputePipeline write42 = device.CreateComputePipeline(&pipelineDesc);
|
wgpu::ComputePipeline write42 = device.CreateComputePipeline(&pipelineDesc);
|
||||||
|
|
||||||
// Create the bindGroup.
|
// Create the bindGroup.
|
||||||
|
@ -45,8 +45,8 @@ class GpuMemorySyncTests : public DawnTest {
|
|||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor cpDesc;
|
wgpu::ComputePipelineDescriptor cpDesc;
|
||||||
cpDesc.computeStage.module = csModule;
|
cpDesc.compute.module = csModule;
|
||||||
cpDesc.computeStage.entryPoint = "main";
|
cpDesc.compute.entryPoint = "main";
|
||||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&cpDesc);
|
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&cpDesc);
|
||||||
|
|
||||||
wgpu::BindGroup bindGroup =
|
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.
|
// Create a pipeline that loads the texture from both the sampled and storage paths.
|
||||||
wgpu::ComputePipelineDescriptor pipelineDesc;
|
wgpu::ComputePipelineDescriptor pipelineDesc;
|
||||||
pipelineDesc.computeStage.entryPoint = "main";
|
pipelineDesc.compute.entryPoint = "main";
|
||||||
pipelineDesc.computeStage.module = utils::CreateShaderModule(device, R"(
|
pipelineDesc.compute.module = utils::CreateShaderModule(device, R"(
|
||||||
[[block]] struct Output {
|
[[block]] struct Output {
|
||||||
sampledOut: u32;
|
sampledOut: u32;
|
||||||
storageOut: u32;
|
storageOut: u32;
|
||||||
@ -321,8 +321,8 @@ class StorageToUniformSyncTests : public DawnTest {
|
|||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor cpDesc;
|
wgpu::ComputePipelineDescriptor cpDesc;
|
||||||
cpDesc.computeStage.module = csModule;
|
cpDesc.compute.module = csModule;
|
||||||
cpDesc.computeStage.entryPoint = "main";
|
cpDesc.compute.entryPoint = "main";
|
||||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&cpDesc);
|
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&cpDesc);
|
||||||
|
|
||||||
wgpu::BindGroup bindGroup =
|
wgpu::BindGroup bindGroup =
|
||||||
@ -542,8 +542,8 @@ TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) {
|
|||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor cpDesc;
|
wgpu::ComputePipelineDescriptor cpDesc;
|
||||||
cpDesc.computeStage.module = csModule;
|
cpDesc.compute.module = csModule;
|
||||||
cpDesc.computeStage.entryPoint = "main";
|
cpDesc.compute.entryPoint = "main";
|
||||||
wgpu::ComputePipeline cp = device.CreateComputePipeline(&cpDesc);
|
wgpu::ComputePipeline cp = device.CreateComputePipeline(&cpDesc);
|
||||||
wgpu::Buffer vertexBuffer = CreateZeroedBuffer(
|
wgpu::Buffer vertexBuffer = CreateZeroedBuffer(
|
||||||
kVertexBufferStride * 4,
|
kVertexBufferStride * 4,
|
||||||
@ -657,8 +657,8 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) {
|
|||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor cpDesc;
|
wgpu::ComputePipelineDescriptor cpDesc;
|
||||||
cpDesc.computeStage.module = csModule;
|
cpDesc.compute.module = csModule;
|
||||||
cpDesc.computeStage.entryPoint = "main";
|
cpDesc.compute.entryPoint = "main";
|
||||||
wgpu::ComputePipeline cp = device.CreateComputePipeline(&cpDesc);
|
wgpu::ComputePipeline cp = device.CreateComputePipeline(&cpDesc);
|
||||||
struct Data {
|
struct Data {
|
||||||
float pos[4][4];
|
float pos[4][4];
|
||||||
|
@ -91,8 +91,8 @@ class MultisampledSamplingTest : public DawnTest {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
wgpu::ComputePipelineDescriptor desc = {};
|
wgpu::ComputePipelineDescriptor desc = {};
|
||||||
desc.computeStage.entryPoint = "main";
|
desc.compute.entryPoint = "main";
|
||||||
desc.computeStage.module = utils::CreateShaderModule(device, R"(
|
desc.compute.module = utils::CreateShaderModule(device, R"(
|
||||||
[[group(0), binding(0)]] var texture0 : texture_multisampled_2d<f32>;
|
[[group(0), binding(0)]] var texture0 : texture_multisampled_2d<f32>;
|
||||||
[[group(0), binding(1)]] var texture1 : texture_multisampled_2d<f32>;
|
[[group(0), binding(1)]] var texture1 : texture_multisampled_2d<f32>;
|
||||||
|
|
||||||
|
@ -142,16 +142,16 @@ TEST_P(ObjectCachingTest, ComputePipelineDeduplicationOnShaderModule) {
|
|||||||
wgpu::PipelineLayout layout = utils::MakeBasicPipelineLayout(device, nullptr);
|
wgpu::PipelineLayout layout = utils::MakeBasicPipelineLayout(device, nullptr);
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor desc;
|
wgpu::ComputePipelineDescriptor desc;
|
||||||
desc.computeStage.entryPoint = "main";
|
desc.compute.entryPoint = "main";
|
||||||
desc.layout = layout;
|
desc.layout = layout;
|
||||||
|
|
||||||
desc.computeStage.module = module;
|
desc.compute.module = module;
|
||||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&desc);
|
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&desc);
|
||||||
|
|
||||||
desc.computeStage.module = sameModule;
|
desc.compute.module = sameModule;
|
||||||
wgpu::ComputePipeline samePipeline = device.CreateComputePipeline(&desc);
|
wgpu::ComputePipeline samePipeline = device.CreateComputePipeline(&desc);
|
||||||
|
|
||||||
desc.computeStage.module = otherModule;
|
desc.compute.module = otherModule;
|
||||||
wgpu::ComputePipeline otherPipeline = device.CreateComputePipeline(&desc);
|
wgpu::ComputePipeline otherPipeline = device.CreateComputePipeline(&desc);
|
||||||
|
|
||||||
EXPECT_NE(pipeline.Get(), otherPipeline.Get());
|
EXPECT_NE(pipeline.Get(), otherPipeline.Get());
|
||||||
@ -173,8 +173,8 @@ TEST_P(ObjectCachingTest, ComputePipelineDeduplicationOnLayout) {
|
|||||||
EXPECT_EQ(pl.Get() == samePl.Get(), !UsesWire());
|
EXPECT_EQ(pl.Get() == samePl.Get(), !UsesWire());
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor desc;
|
wgpu::ComputePipelineDescriptor desc;
|
||||||
desc.computeStage.entryPoint = "main";
|
desc.compute.entryPoint = "main";
|
||||||
desc.computeStage.module = utils::CreateShaderModule(device, R"(
|
desc.compute.module = utils::CreateShaderModule(device, R"(
|
||||||
var<workgroup> i : u32;
|
var<workgroup> i : u32;
|
||||||
[[stage(compute)]] fn main() {
|
[[stage(compute)]] fn main() {
|
||||||
i = 0u;
|
i = 0u;
|
||||||
|
@ -123,8 +123,8 @@ TEST_P(OpArrayLengthTest, Compute) {
|
|||||||
|
|
||||||
wgpu::ComputePipelineDescriptor pipelineDesc;
|
wgpu::ComputePipelineDescriptor pipelineDesc;
|
||||||
pipelineDesc.layout = pl;
|
pipelineDesc.layout = pl;
|
||||||
pipelineDesc.computeStage.entryPoint = "main";
|
pipelineDesc.compute.entryPoint = "main";
|
||||||
pipelineDesc.computeStage.module = utils::CreateShaderModule(device, (R"(
|
pipelineDesc.compute.module = utils::CreateShaderModule(device, (R"(
|
||||||
[[block]] struct ResultBuffer {
|
[[block]] struct ResultBuffer {
|
||||||
data : [[stride(4)]] array<u32, 3>;
|
data : [[stride(4)]] array<u32, 3>;
|
||||||
};
|
};
|
||||||
@ -135,7 +135,7 @@ TEST_P(OpArrayLengthTest, Compute) {
|
|||||||
result.data[1] = arrayLength(buffer2.data);
|
result.data[1] = arrayLength(buffer2.data);
|
||||||
result.data[2] = arrayLength(buffer3.data);
|
result.data[2] = arrayLength(buffer3.data);
|
||||||
})")
|
})")
|
||||||
.c_str());
|
.c_str());
|
||||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
|
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
|
||||||
|
|
||||||
// Run a single instance of the compute shader
|
// Run a single instance of the compute shader
|
||||||
|
@ -147,8 +147,8 @@ TEST_P(ShaderFloat16Tests, Basic16BitFloatFeaturesTest) {
|
|||||||
)");
|
)");
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor csDesc;
|
wgpu::ComputePipelineDescriptor csDesc;
|
||||||
csDesc.computeStage.module = module;
|
csDesc.compute.module = module;
|
||||||
csDesc.computeStage.entryPoint = "main";
|
csDesc.compute.entryPoint = "main";
|
||||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&csDesc);
|
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&csDesc);
|
||||||
|
|
||||||
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
|
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
|
||||||
|
@ -62,8 +62,8 @@ TEST_P(ShaderTests, ComputeLog2) {
|
|||||||
})";
|
})";
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor csDesc;
|
wgpu::ComputePipelineDescriptor csDesc;
|
||||||
csDesc.computeStage.module = utils::CreateShaderModule(device, shader.c_str());
|
csDesc.compute.module = utils::CreateShaderModule(device, shader.c_str());
|
||||||
csDesc.computeStage.entryPoint = "main";
|
csDesc.compute.entryPoint = "main";
|
||||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&csDesc);
|
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&csDesc);
|
||||||
|
|
||||||
wgpu::BindGroup bindGroup =
|
wgpu::BindGroup bindGroup =
|
||||||
|
@ -464,8 +464,8 @@ fn IsEqualTo(pixel : vec4<f32>, expected : vec4<f32>) -> bool {
|
|||||||
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, computeShader);
|
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, computeShader);
|
||||||
wgpu::ComputePipelineDescriptor computeDescriptor;
|
wgpu::ComputePipelineDescriptor computeDescriptor;
|
||||||
computeDescriptor.layout = nullptr;
|
computeDescriptor.layout = nullptr;
|
||||||
computeDescriptor.computeStage.module = csModule;
|
computeDescriptor.compute.module = csModule;
|
||||||
computeDescriptor.computeStage.entryPoint = "main";
|
computeDescriptor.compute.entryPoint = "main";
|
||||||
return device.CreateComputePipeline(&computeDescriptor);
|
return device.CreateComputePipeline(&computeDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -990,8 +990,8 @@ TEST_P(StorageTextureTests, ReadonlyAndWriteonlyStorageTexturePingPong) {
|
|||||||
)");
|
)");
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor pipelineDesc = {};
|
wgpu::ComputePipelineDescriptor pipelineDesc = {};
|
||||||
pipelineDesc.computeStage.module = module;
|
pipelineDesc.compute.module = module;
|
||||||
pipelineDesc.computeStage.entryPoint = "main";
|
pipelineDesc.compute.entryPoint = "main";
|
||||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
|
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
|
||||||
|
|
||||||
// In bindGroupA storageTexture1 is bound as read-only storage texture and storageTexture2 is
|
// In bindGroupA storageTexture1 is bound as read-only storage texture and storageTexture2 is
|
||||||
@ -1064,8 +1064,8 @@ TEST_P(StorageTextureTests, SampledAndWriteonlyStorageTexturePingPong) {
|
|||||||
)");
|
)");
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor pipelineDesc = {};
|
wgpu::ComputePipelineDescriptor pipelineDesc = {};
|
||||||
pipelineDesc.computeStage.module = module;
|
pipelineDesc.compute.module = module;
|
||||||
pipelineDesc.computeStage.entryPoint = "main";
|
pipelineDesc.compute.entryPoint = "main";
|
||||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
|
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
|
||||||
|
|
||||||
// In bindGroupA storageTexture1 is bound as read-only storage texture and storageTexture2 is
|
// In bindGroupA storageTexture1 is bound as read-only storage texture and storageTexture2 is
|
||||||
|
@ -973,7 +973,7 @@ TEST_P(TextureZeroInitTest, ComputePassSampledTextureClear) {
|
|||||||
|
|
||||||
// Create compute pipeline
|
// Create compute pipeline
|
||||||
wgpu::ComputePipelineDescriptor computePipelineDescriptor;
|
wgpu::ComputePipelineDescriptor computePipelineDescriptor;
|
||||||
wgpu::ProgrammableStageDescriptor computeStage;
|
wgpu::ProgrammableStageDescriptor compute;
|
||||||
const char* cs = R"(
|
const char* cs = R"(
|
||||||
[[group(0), binding(0)]] var tex : texture_2d<f32>;
|
[[group(0), binding(0)]] var tex : texture_2d<f32>;
|
||||||
[[block]] struct Result {
|
[[block]] struct Result {
|
||||||
@ -984,8 +984,8 @@ TEST_P(TextureZeroInitTest, ComputePassSampledTextureClear) {
|
|||||||
result.value = textureLoad(tex, vec2<i32>(0,0), 0);
|
result.value = textureLoad(tex, vec2<i32>(0,0), 0);
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
computePipelineDescriptor.computeStage.module = utils::CreateShaderModule(device, cs);
|
computePipelineDescriptor.compute.module = utils::CreateShaderModule(device, cs);
|
||||||
computePipelineDescriptor.computeStage.entryPoint = "main";
|
computePipelineDescriptor.compute.entryPoint = "main";
|
||||||
wgpu::ComputePipeline computePipeline =
|
wgpu::ComputePipeline computePipeline =
|
||||||
device.CreateComputePipeline(&computePipelineDescriptor);
|
device.CreateComputePipeline(&computePipelineDescriptor);
|
||||||
|
|
||||||
|
@ -460,8 +460,8 @@ void ShaderRobustnessPerf::SetUp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor csDesc;
|
wgpu::ComputePipelineDescriptor csDesc;
|
||||||
csDesc.computeStage.module = module;
|
csDesc.compute.module = module;
|
||||||
csDesc.computeStage.entryPoint = "main";
|
csDesc.compute.entryPoint = "main";
|
||||||
mPipeline = device.CreateComputePipeline(&csDesc);
|
mPipeline = device.CreateComputePipeline(&csDesc);
|
||||||
|
|
||||||
mBindGroup = utils::MakeBindGroup(device, mPipeline.GetBindGroupLayout(0),
|
mBindGroup = utils::MakeBindGroup(device, mPipeline.GetBindGroupLayout(0),
|
||||||
|
@ -1312,8 +1312,8 @@ class SetBindGroupValidationTest : public ValidationTest {
|
|||||||
|
|
||||||
wgpu::ComputePipelineDescriptor csDesc;
|
wgpu::ComputePipelineDescriptor csDesc;
|
||||||
csDesc.layout = pipelineLayout;
|
csDesc.layout = pipelineLayout;
|
||||||
csDesc.computeStage.module = csModule;
|
csDesc.compute.module = csModule;
|
||||||
csDesc.computeStage.entryPoint = "main";
|
csDesc.compute.entryPoint = "main";
|
||||||
|
|
||||||
return device.CreateComputePipeline(&csDesc);
|
return device.CreateComputePipeline(&csDesc);
|
||||||
}
|
}
|
||||||
@ -1918,8 +1918,8 @@ class BindGroupLayoutCompatibilityTest : public ValidationTest {
|
|||||||
|
|
||||||
wgpu::ComputePipelineDescriptor csDesc;
|
wgpu::ComputePipelineDescriptor csDesc;
|
||||||
csDesc.layout = pipelineLayout;
|
csDesc.layout = pipelineLayout;
|
||||||
csDesc.computeStage.module = csModule;
|
csDesc.compute.module = csModule;
|
||||||
csDesc.computeStage.entryPoint = "main";
|
csDesc.compute.entryPoint = "main";
|
||||||
|
|
||||||
return device.CreateComputePipeline(&csDesc);
|
return device.CreateComputePipeline(&csDesc);
|
||||||
}
|
}
|
||||||
|
@ -31,8 +31,8 @@ class ComputeIndirectValidationTest : public ValidationTest {
|
|||||||
|
|
||||||
wgpu::ComputePipelineDescriptor csDesc;
|
wgpu::ComputePipelineDescriptor csDesc;
|
||||||
csDesc.layout = pl;
|
csDesc.layout = pl;
|
||||||
csDesc.computeStage.module = computeModule;
|
csDesc.compute.module = computeModule;
|
||||||
csDesc.computeStage.entryPoint = "main";
|
csDesc.compute.entryPoint = "main";
|
||||||
pipeline = device.CreateComputePipeline(&csDesc);
|
pipeline = device.CreateComputePipeline(&csDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,8 +158,8 @@ TEST_F(GetBindGroupLayoutTests, ComputePipeline) {
|
|||||||
|
|
||||||
wgpu::ComputePipelineDescriptor descriptor;
|
wgpu::ComputePipelineDescriptor descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
descriptor.computeStage.module = csModule;
|
descriptor.compute.module = csModule;
|
||||||
descriptor.computeStage.entryPoint = "main";
|
descriptor.compute.entryPoint = "main";
|
||||||
|
|
||||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&descriptor);
|
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&descriptor);
|
||||||
|
|
||||||
@ -925,14 +925,14 @@ TEST_F(GetBindGroupLayoutTests, FromCorrectEntryPoint) {
|
|||||||
)");
|
)");
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor pipelineDesc;
|
wgpu::ComputePipelineDescriptor pipelineDesc;
|
||||||
pipelineDesc.computeStage.module = module;
|
pipelineDesc.compute.module = module;
|
||||||
|
|
||||||
// Get each entryPoint's BGL.
|
// Get each entryPoint's BGL.
|
||||||
pipelineDesc.computeStage.entryPoint = "compute0";
|
pipelineDesc.compute.entryPoint = "compute0";
|
||||||
wgpu::ComputePipeline pipeline0 = device.CreateComputePipeline(&pipelineDesc);
|
wgpu::ComputePipeline pipeline0 = device.CreateComputePipeline(&pipelineDesc);
|
||||||
wgpu::BindGroupLayout bgl0 = pipeline0.GetBindGroupLayout(0);
|
wgpu::BindGroupLayout bgl0 = pipeline0.GetBindGroupLayout(0);
|
||||||
|
|
||||||
pipelineDesc.computeStage.entryPoint = "compute1";
|
pipelineDesc.compute.entryPoint = "compute1";
|
||||||
wgpu::ComputePipeline pipeline1 = device.CreateComputePipeline(&pipelineDesc);
|
wgpu::ComputePipeline pipeline1 = device.CreateComputePipeline(&pipelineDesc);
|
||||||
wgpu::BindGroupLayout bgl1 = pipeline1.GetBindGroupLayout(0);
|
wgpu::BindGroupLayout bgl1 = pipeline1.GetBindGroupLayout(0);
|
||||||
|
|
||||||
|
@ -171,8 +171,8 @@ class MinBufferSizeTestsBase : public ValidationTest {
|
|||||||
descriptor.bindGroupLayouts = layouts.data();
|
descriptor.bindGroupLayouts = layouts.data();
|
||||||
csDesc.layout = device.CreatePipelineLayout(&descriptor);
|
csDesc.layout = device.CreatePipelineLayout(&descriptor);
|
||||||
}
|
}
|
||||||
csDesc.computeStage.module = csModule;
|
csDesc.compute.module = csModule;
|
||||||
csDesc.computeStage.entryPoint = "main";
|
csDesc.compute.entryPoint = "main";
|
||||||
|
|
||||||
return device.CreateComputePipeline(&csDesc);
|
return device.CreateComputePipeline(&csDesc);
|
||||||
}
|
}
|
||||||
|
@ -45,8 +45,8 @@ TEST_F(MultipleDeviceTest, ValidatesSameDeviceCreatePipelineAsync) {
|
|||||||
wgpu::ShaderModule shaderModule = device.CreateShaderModule(&shaderModuleDesc);
|
wgpu::ShaderModule shaderModule = device.CreateShaderModule(&shaderModuleDesc);
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor pipelineDesc = {};
|
wgpu::ComputePipelineDescriptor pipelineDesc = {};
|
||||||
pipelineDesc.computeStage.module = shaderModule;
|
pipelineDesc.compute.module = shaderModule;
|
||||||
pipelineDesc.computeStage.entryPoint = "main";
|
pipelineDesc.compute.entryPoint = "main";
|
||||||
|
|
||||||
StrictMock<MockCallback<WGPUCreateComputePipelineAsyncCallback>> creationCallback;
|
StrictMock<MockCallback<WGPUCreateComputePipelineAsyncCallback>> creationCallback;
|
||||||
EXPECT_CALL(creationCallback,
|
EXPECT_CALL(creationCallback,
|
||||||
@ -65,8 +65,8 @@ TEST_F(MultipleDeviceTest, ValidatesSameDeviceCreatePipelineAsync) {
|
|||||||
wgpu::ShaderModule shaderModule = device2.CreateShaderModule(&shaderModuleDesc);
|
wgpu::ShaderModule shaderModule = device2.CreateShaderModule(&shaderModuleDesc);
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor pipelineDesc = {};
|
wgpu::ComputePipelineDescriptor pipelineDesc = {};
|
||||||
pipelineDesc.computeStage.module = shaderModule;
|
pipelineDesc.compute.module = shaderModule;
|
||||||
pipelineDesc.computeStage.entryPoint = "main";
|
pipelineDesc.compute.entryPoint = "main";
|
||||||
|
|
||||||
StrictMock<MockCallback<WGPUCreateComputePipelineAsyncCallback>> creationCallback;
|
StrictMock<MockCallback<WGPUCreateComputePipelineAsyncCallback>> creationCallback;
|
||||||
EXPECT_CALL(creationCallback,
|
EXPECT_CALL(creationCallback,
|
||||||
|
@ -210,10 +210,10 @@ namespace {
|
|||||||
};
|
};
|
||||||
|
|
||||||
wgpu::ComputePipelineDescriptor descriptor;
|
wgpu::ComputePipelineDescriptor descriptor;
|
||||||
descriptor.computeStage.module = utils::CreateShaderModule(device, R"(
|
descriptor.compute.module = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(compute)]] fn main() {
|
[[stage(compute)]] fn main() {
|
||||||
})");
|
})");
|
||||||
descriptor.computeStage.entryPoint = "main";
|
descriptor.compute.entryPoint = "main";
|
||||||
device.CreateComputePipelineAsync(&descriptor, callback, &callbackData);
|
device.CreateComputePipelineAsync(&descriptor, callback, &callbackData);
|
||||||
|
|
||||||
WaitForAllOperations(device);
|
WaitForAllOperations(device);
|
||||||
@ -234,8 +234,8 @@ namespace {
|
|||||||
// BindGroup 2. This is to provide coverage of for loops in validation code.
|
// BindGroup 2. This is to provide coverage of for loops in validation code.
|
||||||
wgpu::ComputePipelineDescriptor cpDesc;
|
wgpu::ComputePipelineDescriptor cpDesc;
|
||||||
cpDesc.layout = utils::MakePipelineLayout(device, {emptyBGL, testBGL});
|
cpDesc.layout = utils::MakePipelineLayout(device, {emptyBGL, testBGL});
|
||||||
cpDesc.computeStage.entryPoint = "main";
|
cpDesc.compute.entryPoint = "main";
|
||||||
cpDesc.computeStage.module =
|
cpDesc.compute.module =
|
||||||
utils::CreateShaderModule(device, "[[stage(compute)]] fn main() {}");
|
utils::CreateShaderModule(device, "[[stage(compute)]] fn main() {}");
|
||||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&cpDesc);
|
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&cpDesc);
|
||||||
|
|
||||||
@ -302,8 +302,8 @@ namespace {
|
|||||||
|
|
||||||
wgpu::ComputePipelineDescriptor cpDesc;
|
wgpu::ComputePipelineDescriptor cpDesc;
|
||||||
cpDesc.layout = utils::MakePipelineLayout(device, {emptyBGL, emptyBGL, testBGL});
|
cpDesc.layout = utils::MakePipelineLayout(device, {emptyBGL, emptyBGL, testBGL});
|
||||||
cpDesc.computeStage.entryPoint = "main";
|
cpDesc.compute.entryPoint = "main";
|
||||||
cpDesc.computeStage.module =
|
cpDesc.compute.module =
|
||||||
utils::CreateShaderModule(device, "[[stage(compute)]] fn main() {}");
|
utils::CreateShaderModule(device, "[[stage(compute)]] fn main() {}");
|
||||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&cpDesc);
|
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&cpDesc);
|
||||||
|
|
||||||
|
@ -67,8 +67,8 @@ namespace {
|
|||||||
})");
|
})");
|
||||||
wgpu::ComputePipelineDescriptor pipelineDescriptor;
|
wgpu::ComputePipelineDescriptor pipelineDescriptor;
|
||||||
pipelineDescriptor.layout = utils::MakePipelineLayout(device, std::move(bgls));
|
pipelineDescriptor.layout = utils::MakePipelineLayout(device, std::move(bgls));
|
||||||
pipelineDescriptor.computeStage.module = csModule;
|
pipelineDescriptor.compute.module = csModule;
|
||||||
pipelineDescriptor.computeStage.entryPoint = "main";
|
pipelineDescriptor.compute.entryPoint = "main";
|
||||||
return device.CreateComputePipeline(&pipelineDescriptor);
|
return device.CreateComputePipeline(&pipelineDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,8 +200,8 @@ TEST_F(StorageTextureValidationTests, ComputePipeline) {
|
|||||||
|
|
||||||
wgpu::ComputePipelineDescriptor descriptor;
|
wgpu::ComputePipelineDescriptor descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
descriptor.computeStage.module = csModule;
|
descriptor.compute.module = csModule;
|
||||||
descriptor.computeStage.entryPoint = "main";
|
descriptor.compute.entryPoint = "main";
|
||||||
|
|
||||||
device.CreateComputePipeline(&descriptor);
|
device.CreateComputePipeline(&descriptor);
|
||||||
}
|
}
|
||||||
@ -217,8 +217,8 @@ TEST_F(StorageTextureValidationTests, ComputePipeline) {
|
|||||||
|
|
||||||
wgpu::ComputePipelineDescriptor descriptor;
|
wgpu::ComputePipelineDescriptor descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
descriptor.computeStage.module = csModule;
|
descriptor.compute.module = csModule;
|
||||||
descriptor.computeStage.entryPoint = "main";
|
descriptor.compute.entryPoint = "main";
|
||||||
|
|
||||||
device.CreateComputePipeline(&descriptor);
|
device.CreateComputePipeline(&descriptor);
|
||||||
}
|
}
|
||||||
@ -402,8 +402,8 @@ TEST_F(StorageTextureValidationTests, BindGroupLayoutEntryTypeMatchesShaderDecla
|
|||||||
|
|
||||||
// Set common fields of compute pipeline descriptor.
|
// Set common fields of compute pipeline descriptor.
|
||||||
wgpu::ComputePipelineDescriptor defaultComputePipelineDescriptor;
|
wgpu::ComputePipelineDescriptor defaultComputePipelineDescriptor;
|
||||||
defaultComputePipelineDescriptor.computeStage.module = csModule;
|
defaultComputePipelineDescriptor.compute.module = csModule;
|
||||||
defaultComputePipelineDescriptor.computeStage.entryPoint = "main";
|
defaultComputePipelineDescriptor.compute.entryPoint = "main";
|
||||||
|
|
||||||
for (utils::BindingLayoutEntryInitializationHelper bindingLayoutEntry :
|
for (utils::BindingLayoutEntryInitializationHelper bindingLayoutEntry :
|
||||||
kSupportedBindingTypes) {
|
kSupportedBindingTypes) {
|
||||||
@ -478,8 +478,8 @@ TEST_F(StorageTextureValidationTests, BindGroupLayoutStorageTextureFormatMatches
|
|||||||
|
|
||||||
// Set common fields of compute pipeline descriptor.
|
// Set common fields of compute pipeline descriptor.
|
||||||
wgpu::ComputePipelineDescriptor defaultComputePipelineDescriptor;
|
wgpu::ComputePipelineDescriptor defaultComputePipelineDescriptor;
|
||||||
defaultComputePipelineDescriptor.computeStage.module = csModule;
|
defaultComputePipelineDescriptor.compute.module = csModule;
|
||||||
defaultComputePipelineDescriptor.computeStage.entryPoint = "main";
|
defaultComputePipelineDescriptor.compute.entryPoint = "main";
|
||||||
|
|
||||||
// Set common fileds of bind group layout binding.
|
// Set common fileds of bind group layout binding.
|
||||||
utils::BindingLayoutEntryInitializationHelper defaultBindGroupLayoutEntry = {
|
utils::BindingLayoutEntryInitializationHelper defaultBindGroupLayoutEntry = {
|
||||||
@ -534,8 +534,8 @@ TEST_F(StorageTextureValidationTests, BindGroupLayoutViewDimensionMatchesShaderD
|
|||||||
|
|
||||||
// Set common fields of compute pipeline descriptor.
|
// Set common fields of compute pipeline descriptor.
|
||||||
wgpu::ComputePipelineDescriptor defaultComputePipelineDescriptor;
|
wgpu::ComputePipelineDescriptor defaultComputePipelineDescriptor;
|
||||||
defaultComputePipelineDescriptor.computeStage.module = csModule;
|
defaultComputePipelineDescriptor.compute.module = csModule;
|
||||||
defaultComputePipelineDescriptor.computeStage.entryPoint = "main";
|
defaultComputePipelineDescriptor.compute.entryPoint = "main";
|
||||||
|
|
||||||
// Set common fields of bind group layout binding.
|
// Set common fields of bind group layout binding.
|
||||||
utils::BindingLayoutEntryInitializationHelper defaultBindGroupLayoutEntry = {
|
utils::BindingLayoutEntryInitializationHelper defaultBindGroupLayoutEntry = {
|
||||||
|
@ -134,8 +134,8 @@ TEST_F(UnsafeAPIValidationTest, DispatchIndirectDisallowed) {
|
|||||||
|
|
||||||
// Create the dummy compute pipeline.
|
// Create the dummy compute pipeline.
|
||||||
wgpu::ComputePipelineDescriptor pipelineDesc;
|
wgpu::ComputePipelineDescriptor pipelineDesc;
|
||||||
pipelineDesc.computeStage.entryPoint = "main";
|
pipelineDesc.compute.entryPoint = "main";
|
||||||
pipelineDesc.computeStage.module =
|
pipelineDesc.compute.module =
|
||||||
utils::CreateShaderModule(device, "[[stage(compute)]] fn main() {}");
|
utils::CreateShaderModule(device, "[[stage(compute)]] fn main() {}");
|
||||||
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
|
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
|
||||||
|
|
||||||
|
@ -100,8 +100,8 @@ TEST_F(WireCreatePipelineAsyncTest, CreateComputePipelineAsyncSuccess) {
|
|||||||
EXPECT_CALL(api, DeviceCreateShaderModule(apiDevice, _)).WillOnce(Return(apiCsModule));
|
EXPECT_CALL(api, DeviceCreateShaderModule(apiDevice, _)).WillOnce(Return(apiCsModule));
|
||||||
|
|
||||||
WGPUComputePipelineDescriptor descriptor{};
|
WGPUComputePipelineDescriptor descriptor{};
|
||||||
descriptor.computeStage.module = csModule;
|
descriptor.compute.module = csModule;
|
||||||
descriptor.computeStage.entryPoint = "main";
|
descriptor.compute.entryPoint = "main";
|
||||||
|
|
||||||
wgpuDeviceCreateComputePipelineAsync(device, &descriptor,
|
wgpuDeviceCreateComputePipelineAsync(device, &descriptor,
|
||||||
ToMockCreateComputePipelineAsyncCallback, this);
|
ToMockCreateComputePipelineAsyncCallback, this);
|
||||||
@ -129,8 +129,8 @@ TEST_F(WireCreatePipelineAsyncTest, CreateComputePipelineAsyncError) {
|
|||||||
EXPECT_CALL(api, DeviceCreateShaderModule(apiDevice, _)).WillOnce(Return(apiCsModule));
|
EXPECT_CALL(api, DeviceCreateShaderModule(apiDevice, _)).WillOnce(Return(apiCsModule));
|
||||||
|
|
||||||
WGPUComputePipelineDescriptor descriptor{};
|
WGPUComputePipelineDescriptor descriptor{};
|
||||||
descriptor.computeStage.module = csModule;
|
descriptor.compute.module = csModule;
|
||||||
descriptor.computeStage.entryPoint = "main";
|
descriptor.compute.entryPoint = "main";
|
||||||
|
|
||||||
wgpuDeviceCreateComputePipelineAsync(device, &descriptor,
|
wgpuDeviceCreateComputePipelineAsync(device, &descriptor,
|
||||||
ToMockCreateComputePipelineAsyncCallback, this);
|
ToMockCreateComputePipelineAsyncCallback, this);
|
||||||
@ -258,8 +258,8 @@ TEST_F(WireCreatePipelineAsyncTest, CreateComputePipelineAsyncThenDisconnect) {
|
|||||||
EXPECT_CALL(api, DeviceCreateShaderModule(apiDevice, _)).WillOnce(Return(apiCsModule));
|
EXPECT_CALL(api, DeviceCreateShaderModule(apiDevice, _)).WillOnce(Return(apiCsModule));
|
||||||
|
|
||||||
WGPUComputePipelineDescriptor descriptor{};
|
WGPUComputePipelineDescriptor descriptor{};
|
||||||
descriptor.computeStage.module = csModule;
|
descriptor.compute.module = csModule;
|
||||||
descriptor.computeStage.entryPoint = "main";
|
descriptor.compute.entryPoint = "main";
|
||||||
|
|
||||||
wgpuDeviceCreateComputePipelineAsync(device, &descriptor,
|
wgpuDeviceCreateComputePipelineAsync(device, &descriptor,
|
||||||
ToMockCreateComputePipelineAsyncCallback, this);
|
ToMockCreateComputePipelineAsyncCallback, this);
|
||||||
@ -314,8 +314,8 @@ TEST_F(WireCreatePipelineAsyncTest, CreateComputePipelineAsyncAfterDisconnect) {
|
|||||||
EXPECT_CALL(api, DeviceCreateShaderModule(apiDevice, _)).WillOnce(Return(apiCsModule));
|
EXPECT_CALL(api, DeviceCreateShaderModule(apiDevice, _)).WillOnce(Return(apiCsModule));
|
||||||
|
|
||||||
WGPUComputePipelineDescriptor descriptor{};
|
WGPUComputePipelineDescriptor descriptor{};
|
||||||
descriptor.computeStage.module = csModule;
|
descriptor.compute.module = csModule;
|
||||||
descriptor.computeStage.entryPoint = "main";
|
descriptor.compute.entryPoint = "main";
|
||||||
|
|
||||||
FlushClient();
|
FlushClient();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user