mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 17:35:30 +00:00
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:
@@ -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));
|
||||
})";
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
)");
|
||||
|
||||
@@ -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() {
|
||||
}
|
||||
)";
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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));
|
||||
})"));
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user