update compute shaders to include workgroup_size in their attribute

Change-Id: Ia9027f8ec9c4a293ae1bef735c8b5eeea84e81e2
Bug: tint:884
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/55685
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Sarah
2021-06-23 19:19:06 +00:00
committed by Dawn LUCI CQ
parent 1317636fc8
commit 2a57db73cb
26 changed files with 72 additions and 70 deletions

View File

@@ -1981,7 +1981,7 @@ TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) {
})";
constexpr char kTexture2DShaderCS[] = R"(
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
[[stage(compute)]] fn main() {
[[stage(compute), workgroup_size(1)]] fn main() {
ignore(textureDimensions(myTexture));
})";
@@ -2020,7 +2020,7 @@ TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) {
})";
constexpr char kTexture2DArrayShaderCS[] = R"(
[[group(0), binding(0)]] var myTexture : texture_2d_array<f32>;
[[stage(compute)]] fn main() {
[[stage(compute), workgroup_size(1)]] fn main() {
ignore(textureDimensions(myTexture));
})";

View File

@@ -152,7 +152,7 @@ TEST_F(GetBindGroupLayoutTests, ComputePipeline) {
};
[[group(0), binding(0)]] var<uniform> uniforms : S;
[[stage(compute)]] fn main() {
[[stage(compute), workgroup_size(1)]] fn main() {
var pos : vec4<f32> = uniforms.pos;
})");
@@ -915,11 +915,11 @@ TEST_F(GetBindGroupLayoutTests, FromCorrectEntryPoint) {
[[group(0), binding(0)]] var<storage, read_write> data0 : Data;
[[group(0), binding(1)]] var<storage, read_write> data1 : Data;
[[stage(compute)]] fn compute0() {
[[stage(compute), workgroup_size(1)]] fn compute0() {
data0.data = 0.0;
}
[[stage(compute)]] fn compute1() {
[[stage(compute), workgroup_size(1)]] fn compute1() {
data1.data = 0.0;
}
)");

View File

@@ -33,7 +33,7 @@ TEST_F(MultipleDeviceTest, ValidatesSameDevice) {
TEST_F(MultipleDeviceTest, ValidatesSameDeviceCreatePipelineAsync) {
wgpu::ShaderModuleWGSLDescriptor wgslDesc = {};
wgslDesc.source = R"(
[[stage(compute)]] fn main() {
[[stage(compute), workgroup_size(1, 1, 1)]] fn main() {
}
)";

View File

@@ -211,7 +211,7 @@ namespace {
wgpu::ComputePipelineDescriptor descriptor;
descriptor.compute.module = utils::CreateShaderModule(device, R"(
[[stage(compute)]] fn main() {
[[stage(compute), workgroup_size(1)]] fn main() {
})");
descriptor.compute.entryPoint = "main";
device.CreateComputePipelineAsync(&descriptor, callback, &callbackData);
@@ -236,7 +236,7 @@ namespace {
cpDesc.layout = utils::MakePipelineLayout(device, {emptyBGL, testBGL});
cpDesc.compute.entryPoint = "main";
cpDesc.compute.module =
utils::CreateShaderModule(device, "[[stage(compute)]] fn main() {}");
utils::CreateShaderModule(device, "[[stage(compute), workgroup_size(1)]] fn main() {}");
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&cpDesc);
wgpu::BufferDescriptor bufDesc;
@@ -304,7 +304,7 @@ namespace {
cpDesc.layout = utils::MakePipelineLayout(device, {emptyBGL, emptyBGL, testBGL});
cpDesc.compute.entryPoint = "main";
cpDesc.compute.module =
utils::CreateShaderModule(device, "[[stage(compute)]] fn main() {}");
utils::CreateShaderModule(device, "[[stage(compute), workgroup_size(1)]] fn main() {}");
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&cpDesc);
wgpu::TextureDescriptor texDesc;

View File

@@ -63,7 +63,7 @@ namespace {
wgpu::ComputePipeline CreateNoOpComputePipeline(std::vector<wgpu::BindGroupLayout> bgls) {
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"(
[[stage(compute)]] fn main() {
[[stage(compute), workgroup_size(1)]] fn main() {
})");
wgpu::ComputePipelineDescriptor pipelineDescriptor;
pipelineDescriptor.layout = utils::MakePipelineLayout(device, std::move(bgls));

View File

@@ -85,7 +85,7 @@ class StorageTextureValidationTests : public ValidationTest {
ostream << "[[group(0), binding(0)]] var image0 : " << imageTypeDeclaration << "<"
<< imageFormatQualifier << ", " << access
<< ">;\n"
"[[stage(compute)]] fn main() {\n"
"[[stage(compute), workgroup_size(1)]] fn main() {\n"
" ignore(textureDimensions(image0));\n"
"}\n";
@@ -194,7 +194,7 @@ TEST_F(StorageTextureValidationTests, ComputePipeline) {
};
[[group(0), binding(1)]] var<storage, read_write> buf : Buf;
[[stage(compute)]] fn main([[builtin(local_invocation_id)]] LocalInvocationID : vec3<u32>) {
[[stage(compute), workgroup_size(1)]] fn main([[builtin(local_invocation_id)]] LocalInvocationID : vec3<u32>) {
buf.data = textureLoad(image0, vec2<i32>(LocalInvocationID.xy)).x;
})");
@@ -211,7 +211,7 @@ TEST_F(StorageTextureValidationTests, ComputePipeline) {
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var image0 : texture_storage_2d<rgba8unorm, write>;
[[stage(compute)]] fn main([[builtin(local_invocation_id)]] LocalInvocationID : vec3<u32>) {
[[stage(compute), workgroup_size(1)]] fn main([[builtin(local_invocation_id)]] LocalInvocationID : vec3<u32>) {
textureStore(image0, vec2<i32>(LocalInvocationID.xy), vec4<f32>(0.0, 0.0, 0.0, 0.0));
})");
@@ -248,7 +248,7 @@ TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) {
{
ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var image0 : texture_storage_2d<rgba8unorm, read_write>;
[[stage(compute)]] fn main() {
[[stage(compute), workgroup_size(1)]] fn main() {
ignore(textureDimensions(image0));
})"));
}

View File

@@ -136,7 +136,7 @@ TEST_F(UnsafeAPIValidationTest, DispatchIndirectDisallowed) {
wgpu::ComputePipelineDescriptor pipelineDesc;
pipelineDesc.compute.entryPoint = "main";
pipelineDesc.compute.module =
utils::CreateShaderModule(device, "[[stage(compute)]] fn main() {}");
utils::CreateShaderModule(device, "[[stage(compute), workgroup_size(1)]] fn main() {}");
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
// Control case: dispatch is allowed.