Remove deprecated WGSL "-> void"

Bug: dawn:755
Change-Id: I10f2fb3afd26560df10b21d149a65b625bdb2b4b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/47600
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2021-04-13 09:48:24 +00:00 committed by Commit Bot service account
parent 71f3d58939
commit 21bd02becf
85 changed files with 381 additions and 386 deletions

View File

@ -70,7 +70,7 @@ void init() {
[[builtin(vertex_idx)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
var positions : array<vec4<f32>, 3> = array<vec4<f32>, 3>(
vec4<f32>( 0.0, 0.1, 0.0, 1.0),
vec4<f32>(-0.1, -0.1, 0.0, 1.0),
@ -111,7 +111,7 @@ void init() {
[[location(0)]] var<out> FragColor : vec4<f32>;
[[location(0)]] var<in> v_color : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
FragColor = v_color;
})");

View File

@ -44,7 +44,7 @@ void init() {
" vec2<f32>(-0.5, -0.5),\n"
" vec2<f32>( 0.5, -0.5)\n"
");\n"
"[[stage(vertex)]] fn main() -> void {\n"
"[[stage(vertex)]] fn main() {\n"
" Position = vec4<f32>(pos[VertexIndex], 0.0, 1.0);\n"
" return;\n"
"}\n";
@ -52,7 +52,7 @@ void init() {
const char* fs =
"[[location(0)]] var<out> fragColor : vec4<f32>;\n"
"[[stage(fragment)]] fn main() -> void {\n"
"[[stage(fragment)]] fn main() {\n"
" fragColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);\n"
" return;\n"
"}\n";

View File

@ -102,7 +102,7 @@ void initRender() {
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]]
fn main() -> void {
fn main() {
var angle : f32 = -atan2(a_particleVel.x, a_particleVel.y);
var pos : vec2<f32> = vec2<f32>(
(a_pos.x * cos(angle)) - (a_pos.y * sin(angle)),
@ -115,7 +115,7 @@ void initRender() {
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> FragColor : vec4<f32>;
[[stage(fragment)]]
fn main() -> void {
fn main() {
FragColor = vec4<f32>(1.0, 1.0, 1.0, 1.0);
return;
}
@ -174,7 +174,7 @@ void initSim() {
// https://github.com/austinEng/Project6-Vulkan-Flocking/blob/master/data/shaders/computeparticles/particle.comp
[[stage(compute)]]
fn main() -> void {
fn main() {
var index : u32 = GlobalInvocationID.x;
if (index >= params.particleCount) {
return;

View File

@ -98,7 +98,7 @@ void init() {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[location(0)]] var<in> pos : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = pos;
return;
})");
@ -109,7 +109,7 @@ void init() {
[[group(0), binding(1)]] var myTexture : texture_2d<f32>;
[[location(0)]] var<out> FragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
FragColor = textureSample(myTexture, mySampler, FragCoord.xy / vec2<f32>(640.0, 480.0));
return;
})");

View File

@ -119,7 +119,7 @@ void init() {
[[location(2)]] var<out> f_col : vec3<f32>;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
f_col = col;
Position = camera.proj * camera.view * model.matrix * vec4<f32>(pos, 1.0);
return;
@ -129,7 +129,7 @@ void init() {
[[location(0)]] var<out> FragColor : vec4<f32>;
[[location(2)]] var<in> f_col : vec3<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
FragColor = vec4<f32>(f_col, 1.0);
return;
})");
@ -138,7 +138,7 @@ void init() {
[[location(0)]] var<out> FragColor : vec4<f32>;
[[location(2)]] var<in> f_col : vec3<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
FragColor = vec4<f32>(mix(f_col, vec3<f32>(0.5, 0.5, 0.5), vec3<f32>(0.5, 0.5, 0.5)), 1.0);
return;
})");

View File

@ -320,13 +320,13 @@ int main(int argc, const char* argv[]) {
vec2<f32>(-0.5, -0.5),
vec2<f32>( 0.5, -0.5)
);
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(pos[VertexIndex], 0.0, 1.0);
return;
})");
pipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
return;
})");

View File

@ -46,7 +46,7 @@ namespace dawn_native {
[[builtin(position)]] var<out> Position : vec4<f32>;
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[binding(0), group(0)]] var<uniform> uniforms : Uniforms;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>((texcoord[VertexIndex] * 2.0 - vec2<f32>(1.0, 1.0)), 0.0, 1.0);
// Y component of scale is calculated by the copySizeHeight / textureHeight. Only
@ -76,7 +76,7 @@ namespace dawn_native {
[[binding(2), group(0)]] var myTexture: texture_2d<f32>;
[[location(0)]] var<in> v_texcoord : vec2<f32>;
[[location(0)]] var<out> outputColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
// Clamp the texcoord and discard the out-of-bound pixels.
var clampedTexcoord : vec2<f32> =
clamp(v_texcoord, vec2<f32>(0.0, 0.0), vec2<f32>(1.0, 1.0));

View File

@ -63,7 +63,7 @@ namespace dawn_native {
const sizeofTimestamp : u32 = 8u;
[[stage(compute), workgroup_size(8, 1, 1)]]
fn main() -> void {
fn main() {
if (GlobalInvocationID.x >= params.count) { return; }
var index : u32 = GlobalInvocationID.x + params.offset / sizeofTimestamp;

View File

@ -664,7 +664,7 @@ namespace dawn_native { namespace d3d12 {
// TODO(jiawei.shao@intel.com): move the resource lazy clearing inside the barrier tracking
// for compute passes.
auto PrepareResourcesForComputePass = [](CommandRecordingContext* commandContext,
const PassResourceUsage& usages) -> void {
const PassResourceUsage& usages) {
for (size_t i = 0; i < usages.buffers.size(); ++i) {
Buffer* buffer = ToBackend(usages.buffers[i]);

View File

@ -49,7 +49,7 @@ class BindGroupTests : public DawnTest {
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, 1.0),
@ -84,7 +84,7 @@ class BindGroupTests : public DawnTest {
}
}
fs << "\n[[stage(fragment)]] fn main() -> void {\n";
fs << "\n[[stage(fragment)]] fn main() {\n";
for (size_t i = 0; i < bindingTypes.size(); ++i) {
fs << "fragColor = fragColor + buffer" << i << ".color;\n";
}
@ -129,7 +129,7 @@ TEST_P(BindGroupTests, ReusedBindGroupSingleSubmit) {
};
[[group(0), binding(0)]] var <uniform> contents: Contents;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
var f : f32 = contents.f;
})");
@ -168,7 +168,7 @@ TEST_P(BindGroupTests, ReusedUBO) {
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, 1.0),
@ -186,7 +186,7 @@ TEST_P(BindGroupTests, ReusedUBO) {
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = fragmentUbo.color;
})");
@ -249,7 +249,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, 1.0),
@ -266,7 +266,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = textureSample(tex, samp, FragCoord.xy);
})");
@ -364,7 +364,7 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, 1.0),
@ -392,7 +392,7 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = fragmentUbo1.color + fragmentUbo2.color;
})");
@ -855,7 +855,7 @@ TEST_P(BindGroupTests, DynamicOffsetOrder) {
[[group(0), binding(0)]] var<storage> buffer0 : [[access(read)]] Buffer0;
[[group(0), binding(4)]] var<storage> outputBuffer : [[access(read_write)]] OutputBuffer;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
outputBuffer.value = vec3<u32>(buffer0.value, buffer2.value, buffer3.value);
})");
pipelineDescriptor.computeStage.entryPoint = "main";
@ -954,7 +954,7 @@ TEST_P(BindGroupTests, ArbitraryBindingNumbers) {
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, 1.0),
@ -984,7 +984,7 @@ TEST_P(BindGroupTests, ArbitraryBindingNumbers) {
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = ubo1.color + 2.0 * ubo2.color + 4.0 * ubo3.color;
})");
@ -1084,7 +1084,7 @@ TEST_P(BindGroupTests, EmptyLayout) {
pipelineDesc.layout = utils::MakeBasicPipelineLayout(device, &bgl);
pipelineDesc.computeStage.entryPoint = "main";
pipelineDesc.computeStage.module = utils::CreateShaderModule(device, R"(
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
})");
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
@ -1110,7 +1110,7 @@ TEST_P(BindGroupTests, ReadonlyStorage) {
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, 1.0),
@ -1126,7 +1126,7 @@ TEST_P(BindGroupTests, ReadonlyStorage) {
[[group(0), binding(0)]] var<storage> buffer0 : [[access(read)]] Buffer0;
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = buffer0.color;
})");
@ -1282,8 +1282,7 @@ TEST_P(BindGroupTests, ReallyLargeBindGroup) {
body << "result.value = 1u;\n";
std::string shader =
interface.str() + "[[stage(compute)]] fn main() -> void {\n" + body.str() + "}\n";
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";

View File

@ -210,7 +210,7 @@ class BufferZeroInitTest : public DawnTest {
[[location(0)]] var<in> i_color : vec4<f32>;
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = i_color;
})");
@ -253,7 +253,7 @@ class BufferZeroInitTest : public DawnTest {
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
if (all(pos == vec4<f32>(0.0, 0.0, 0.0, 0.0))) {
o_color = vec4<f32>(0.0, 1.0, 0.0, 1.0);
} else {
@ -295,7 +295,7 @@ class BufferZeroInitTest : public DawnTest {
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
if (VertexIndex == 0u) {
o_color = vec4<f32>(0.0, 1.0, 0.0, 1.0);
} else {
@ -341,7 +341,7 @@ class BufferZeroInitTest : public DawnTest {
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
o_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
})",
@ -379,7 +379,7 @@ class BufferZeroInitTest : public DawnTest {
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
o_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
})",
@ -418,7 +418,7 @@ class BufferZeroInitTest : public DawnTest {
const char* computeShader = R"(
[[group(0), binding(0)]] var outImage : [[access(write)]] texture_storage_2d<rgba8unorm>;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
textureStore(outImage, vec2<i32>(0, 0), vec4<f32>(1.0, 0.0, 0.0, 1.0));
})";
@ -990,7 +990,7 @@ TEST_P(BufferZeroInitTest, BoundAsUniformBuffer) {
[[group(0), binding(0)]] var<uniform> ubo : UBO;
[[group(0), binding(1)]] var outImage : [[access(write)]] texture_storage_2d<rgba8unorm>;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
if (all(ubo.value == vec4<u32>(0u, 0u, 0u, 0u))) {
textureStore(outImage, vec2<i32>(0, 0), vec4<f32>(0.0, 1.0, 0.0, 1.0));
} else {
@ -1029,7 +1029,7 @@ TEST_P(BufferZeroInitTest, BoundAsReadonlyStorageBuffer) {
[[group(0), binding(0)]] var<storage> ssbo : [[access(read_write)]] SSBO;
[[group(0), binding(1)]] var outImage : [[access(write)]] texture_storage_2d<rgba8unorm>;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
if (all(ssbo.value == vec4<u32>(0u, 0u, 0u, 0u))) {
textureStore(outImage, vec2<i32>(0, 0), vec4<f32>(0.0, 1.0, 0.0, 1.0));
} else {
@ -1068,7 +1068,7 @@ TEST_P(BufferZeroInitTest, BoundAsStorageBuffer) {
[[group(0), binding(0)]] var<storage> ssbo : [[access(read_write)]] SSBO;
[[group(0), binding(1)]] var outImage : [[access(write)]] texture_storage_2d<rgba8unorm>;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
if (all(ssbo.value[0] == vec4<u32>(0u, 0u, 0u, 0u)) &&
all(ssbo.value[1] == vec4<u32>(0u, 0u, 0u, 0u))) {
textureStore(outImage, vec2<i32>(0, 0), vec4<f32>(0.0, 1.0, 0.0, 1.0));

View File

@ -37,14 +37,14 @@ class ClipSpaceTest : public DawnTest {
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(pos[VertexIndex], 1.0);
return;
})");
pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
return;
})");

View File

@ -38,7 +38,7 @@ class ColorStateTest : public DawnTest {
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
vec2<f32>(-1.0, -1.0),
vec2<f32>(3.0, -1.0),
@ -68,7 +68,7 @@ class ColorStateTest : public DawnTest {
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = myUbo.color;
return;
}
@ -804,7 +804,7 @@ TEST_P(ColorStateTest, IndependentColorState) {
[[location(2)]] var<out> fragColor2 : vec4<f32>;
[[location(3)]] var<out> fragColor3 : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor0 = myUbo.color0;
fragColor1 = myUbo.color1;
fragColor2 = myUbo.color2;
@ -917,7 +917,7 @@ TEST_P(ColorStateTest, DefaultBlendColor) {
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = myUbo.color;
return;
}
@ -1044,7 +1044,7 @@ TEST_P(ColorStateTest, ColorWriteMaskDoesNotAffectRenderPassLoadOpClear) {
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = myUbo.color;
return;
}

View File

@ -145,7 +145,7 @@ class CompressedTextureBCFormatTest : public DawnTest {
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
vec2<f32>(-3.0, 1.0),
vec2<f32>( 3.0, 1.0),
@ -162,7 +162,7 @@ class CompressedTextureBCFormatTest : public DawnTest {
[[location(0)]] var<in> texCoord : vec2<f32>;
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = textureSample(texture0, sampler0, texCoord);
return;
})");

View File

@ -101,7 +101,7 @@ TEST_P(ComputeCopyStorageBufferTests, SizedArrayOfBasic) {
[[builtin(global_invocation_id)]] var<in> GlobalInvocationID : vec3<u32>;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
var index : u32 = GlobalInvocationID.x;
if (index >= 4u) { return; }
dst.s[index] = src.s[index];
@ -129,7 +129,7 @@ TEST_P(ComputeCopyStorageBufferTests, SizedArrayOfStruct) {
[[builtin(global_invocation_id)]] var<in> GlobalInvocationID : vec3<u32>;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
var index : u32 = GlobalInvocationID.x;
if (index >= 4u) { return; }
dst.s[index] = src.s[index];
@ -152,7 +152,7 @@ TEST_P(ComputeCopyStorageBufferTests, UnsizedArrayOfBasic) {
[[builtin(global_invocation_id)]] var<in> GlobalInvocationID : vec3<u32>;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
var index : u32 = GlobalInvocationID.x;
if (index >= 4u) { return; }
dst.s[index] = src.s[index];

View File

@ -42,7 +42,7 @@ class ComputeDispatchTests : public DawnTest {
[[builtin(global_invocation_id)]] var<in> GlobalInvocationID : vec3<u32>;
[[stage(compute), workgroup_size(1, 1, 1)]]
fn main() -> void {
fn main() {
const dispatch : vec3<u32> = input.expectedDispatch;
if (dispatch.x == 0u || dispatch.y == 0u || dispatch.z == 0u) {

View File

@ -84,7 +84,7 @@ TEST_P(ComputeSharedMemoryTests, Basic) {
var<workgroup> tmp : u32;
[[stage(compute), workgroup_size(4,4,1)]]
fn main() -> void {
fn main() {
var index : u32 = LocalInvocationID.y * kTileSize + LocalInvocationID.x;
if (index == 0u) {
tmp = 0u;

View File

@ -40,7 +40,7 @@ TEST_P(ComputeStorageBufferBarrierTests, AddIncrement) {
[[builtin(global_invocation_id)]] var<in> GlobalInvocationID : vec3<u32>;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
buf.data[GlobalInvocationID.x] = buf.data[GlobalInvocationID.x] + 0x1234u;
}
)");
@ -96,7 +96,7 @@ TEST_P(ComputeStorageBufferBarrierTests, AddPingPong) {
[[group(0), binding(1)]] var<storage> dst : [[access(read_write)]] Dst;
[[builtin(global_invocation_id)]] var<in> GlobalInvocationID : vec3<u32>;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
dst.data[GlobalInvocationID.x] = src.data[GlobalInvocationID.x] + 0x1234u;
}
)");
@ -168,7 +168,7 @@ TEST_P(ComputeStorageBufferBarrierTests, StorageAndReadonlyStoragePingPongInOneP
[[builtin(global_invocation_id)]] var<in> GlobalInvocationID : vec3<u32>;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
dst.data[GlobalInvocationID.x] = src.data[GlobalInvocationID.x] + 0x1234u;
}
)");
@ -236,7 +236,7 @@ TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPong) {
[[group(0), binding(1)]] var<storage> dst : [[access(read_write)]] Buf;
[[builtin(global_invocation_id)]] var<in> GlobalInvocationID : vec3<u32>;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
dst.data[GlobalInvocationID.x] = src.data[GlobalInvocationID.x] +
vec4<u32>(0x1234u, 0x1234u, 0x1234u, 0x1234u);
}
@ -304,7 +304,7 @@ TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPongInOnePass) {
[[group(0), binding(1)]] var<storage> dst : [[access(read_write)]] Buf;
[[builtin(global_invocation_id)]] var<in> GlobalInvocationID : vec3<u32>;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
dst.data[GlobalInvocationID.x] = src.data[GlobalInvocationID.x] +
vec4<u32>(0x1234u, 0x1234u, 0x1234u, 0x1234u);
}

View File

@ -153,7 +153,7 @@ class CopyTextureForBrowserTests : public DawnTest {
// The value diff should be smaller than the hard coded tolerance.
return abs(value - expect) < 0.001;
}
[[stage(compute), workgroup_size(1, 1, 1)]] fn main() -> void {
[[stage(compute), workgroup_size(1, 1, 1)]] fn main() {
var srcSize : vec2<i32> = textureDimensions(src);
var dstSize : vec2<i32> = textureDimensions(dst);
var dstTexCoord : vec2<u32> = vec2<u32>(GlobalInvocationID.xy);

View File

@ -80,7 +80,7 @@ TEST_P(CreatePipelineAsyncTest, BasicUseOfCreateComputePipelineAsync) {
};
[[group(0), binding(0)]] var<storage> ssbo : [[access(read_write)]] SSBO;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
ssbo.value = 1u;
})");
csDesc.computeStage.entryPoint = "main";
@ -115,7 +115,7 @@ TEST_P(CreatePipelineAsyncTest, CreateComputePipelineFailed) {
};
[[group(0), binding(0)]] var<storage> ssbo : [[access(read_write)]] SSBO;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
ssbo.value = 1u;
})");
csDesc.computeStage.entryPoint = "main0";
@ -148,12 +148,12 @@ TEST_P(CreatePipelineAsyncTest, BasicUseOfCreateRenderPipelineAsync) {
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> o_color : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
o_color = vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");
renderPipelineDescriptor.vertex.module = vsModule;
@ -218,12 +218,12 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineFailed) {
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> o_color : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
o_color = vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");
renderPipelineDescriptor.vertex.module = vsModule;
@ -257,7 +257,7 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineFailed) {
TEST_P(CreatePipelineAsyncTest, ReleaseDeviceBeforeCallbackOfCreateComputePipelineAsync) {
wgpu::ComputePipelineDescriptor csDesc;
csDesc.computeStage.module = utils::CreateShaderModule(device, R"(
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
})");
csDesc.computeStage.entryPoint = "main";
@ -282,12 +282,12 @@ TEST_P(CreatePipelineAsyncTest, ReleaseDeviceBeforeCallbackOfCreateRenderPipelin
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> o_color : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
o_color = vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");
renderPipelineDescriptor.vertex.module = vsModule;
@ -320,7 +320,7 @@ TEST_P(CreatePipelineAsyncTest, CreateSameComputePipelineTwice) {
};
[[group(0), binding(0)]] var<storage> ssbo : [[access(read_write)]] SSBO;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
ssbo.value = 1u;
})");
csDesc.computeStage.entryPoint = "main";
@ -361,7 +361,7 @@ TEST_P(CreatePipelineAsyncTest, CreateSamePipelineTwiceAtSameTime) {
};
[[group(0), binding(0)]] var<storage> ssbo : [[access(read_write)]] SSBO;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
ssbo.value = 1u;
})");
csDesc.computeStage.entryPoint = "main";

View File

@ -37,7 +37,7 @@ class CullingTest : public DawnTest {
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(pos[VertexIndex], 0.0, 1.0);
return;
})");
@ -49,7 +49,7 @@ class CullingTest : public DawnTest {
[[location(0)]] var<out> fragColor : vec4<f32>;;
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(
(FragCoord.xy - vec2<f32>(0.5, 0.5)) / vec2<f32>(255.0, 255.0),
0.0, 1.0);

View File

@ -103,14 +103,14 @@ TEST_P(D3D12CachingTests, SameShaderNoCache) {
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn vertex_main() -> void {
[[stage(vertex)]] fn vertex_main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
return;
}
[[location(0)]] var<out> outColor : vec4<f32>;
[[stage(fragment)]] fn fragment_main() -> void {
[[stage(fragment)]] fn fragment_main() {
outColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
return;
}
@ -150,14 +150,14 @@ TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPointsPerStage) {
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn vertex_main() -> void {
[[stage(vertex)]] fn vertex_main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
return;
}
[[location(0)]] var<out> outColor : vec4<f32>;
[[stage(fragment)]] fn fragment_main() -> void {
[[stage(fragment)]] fn fragment_main() {
outColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
return;
}
@ -195,14 +195,14 @@ TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPointsPerStage) {
wgpu::ShaderModule newModule = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn vertex_main() -> void {
[[stage(vertex)]] fn vertex_main() {
Position = vec4<f32>(1.0, 1.0, 1.0, 1.0);
return;
}
[[location(0)]] var<out> outColor : vec4<f32>;
[[stage(fragment)]] fn fragment_main() -> void {
[[stage(fragment)]] fn fragment_main() {
outColor = vec4<f32>(1.0, 1.0, 1.0, 1.0);
return;
}
@ -231,12 +231,12 @@ TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPoints) {
};
[[binding(0), group(0)]] var<storage> data : [[access(read_write)]] Data;
[[stage(compute)]] fn write1() -> void {
[[stage(compute)]] fn write1() {
data.data = 1u;
return;
}
[[stage(compute)]] fn write42() -> void {
[[stage(compute)]] fn write42() {
data.data = 42u;
return;
}

View File

@ -236,7 +236,7 @@ namespace {
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
vec2<f32>(-1.0, 1.0),
vec2<f32>(-1.0, -1.0),
@ -300,7 +300,7 @@ TEST_P(D3D12VideoViewsTests, NV12SampleYtoR) {
[[location(0)]] var<in> texCoord : vec2<f32>;
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
var y : f32 = textureSample(texture, sampler0, texCoord).r;
fragColor = vec4<f32>(y, 0.0, 0.0, 1.0);
})");
@ -353,7 +353,7 @@ TEST_P(D3D12VideoViewsTests, NV12SampleUVtoRG) {
[[location(0)]] var<in> texCoord : vec2<f32>;
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
var u : f32 = textureSample(texture, sampler0, texCoord).r;
var v : f32 = textureSample(texture, sampler0, texCoord).g;
fragColor = vec4<f32>(u, v, 0.0, 1.0);
@ -416,7 +416,7 @@ TEST_P(D3D12VideoViewsTests, NV12SampleYUVtoRGB) {
[[location(0)]] var<in> texCoord : vec2<f32>;
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
var y : f32 = textureSample(lumaTexture, sampler0, texCoord).r;
var u : f32 = textureSample(chromaTexture, sampler0, texCoord).r;
var v : f32 = textureSample(chromaTexture, sampler0, texCoord).g;

View File

@ -499,7 +499,7 @@ class VertexFormatDeprecationTests : public DeprecationTests {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, (attribute + R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = )" + attribAccess + R"(;
return;
}
@ -508,7 +508,7 @@ class VertexFormatDeprecationTests : public DeprecationTests {
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> outColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
outColor = vec4<f32>(1.0, 1.0, 1.0, 1.0);
return;
}

View File

@ -38,7 +38,7 @@ class DepthBiasTests : public DawnTest {
vertexSource = R"(
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
vec2<f32>(-1.0, -1.0),
vec2<f32>( 1.0, -1.0),
@ -56,7 +56,7 @@ class DepthBiasTests : public DawnTest {
vertexSource = R"(
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec3<f32>, 6> = array<vec3<f32>, 6>(
vec3<f32>(-1.0, -1.0, 0.0),
vec3<f32>( 1.0, -1.0, 0.0),
@ -74,7 +74,7 @@ class DepthBiasTests : public DawnTest {
wgpu::ShaderModule fragmentModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
return;
})");

View File

@ -32,7 +32,7 @@ class DepthStencilCopyTests : public DawnTest {
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
vec2<f32>(-1.0, -1.0),
vec2<f32>( 0.0, -1.0),
@ -75,7 +75,7 @@ class DepthStencilCopyTests : public DawnTest {
std::string fsSource = R"(
[[builtin(frag_depth)]] var<out> FragDepth : f32;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
FragDepth = )" + std::to_string(regionDepth) +
";\n}";
@ -242,7 +242,7 @@ class DepthStencilCopyTests : public DawnTest {
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
vec2<f32>(-1.0, -1.0),
vec2<f32>( 3.0, -1.0),
@ -259,7 +259,7 @@ class DepthStencilCopyTests : public DawnTest {
[[location(0)]] var<out> result : u32;
[[builtin(frag_depth)]] var<out> FragDepth : f32;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
result = 1u;
FragDepth = textureLoad(texture0, vec2<i32>(FragCoord.xy), 0)[0];
})");
@ -646,7 +646,7 @@ TEST_P(DepthStencilCopyTests, ToStencilAspect) {
utils::ComboRenderPipelineDescriptor2 renderPipelineDesc;
renderPipelineDesc.vertex.module = mVertexModule;
renderPipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"(
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
wgpu::DepthStencilState* depthStencil =
renderPipelineDesc.EnableDepthStencil(wgpu::TextureFormat::Depth24PlusStencil8);

View File

@ -67,7 +67,7 @@ class DepthStencilSamplingTest : public DawnTest {
uint32_t componentIndex) {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
})");
@ -106,7 +106,7 @@ class DepthStencilSamplingTest : public DawnTest {
index++;
}
shaderSource << "[[stage(fragment)]] fn main() -> void { " << shaderBody.str() << "\n}";
shaderSource << "[[stage(fragment)]] fn main() { " << shaderBody.str() << "\n}";
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, shaderSource.str().c_str());
pipelineDescriptor.vertex.module = vsModule;
@ -160,7 +160,7 @@ class DepthStencilSamplingTest : public DawnTest {
index++;
}
shaderSource << "[[stage(compute)]] fn main() -> void { " << shaderBody.str() << "\n}";
shaderSource << "[[stage(compute)]] fn main() { " << shaderBody.str() << "\n}";
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, shaderSource.str().c_str());
@ -174,7 +174,7 @@ class DepthStencilSamplingTest : public DawnTest {
wgpu::RenderPipeline CreateComparisonRenderPipeline() {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
})");
@ -188,7 +188,7 @@ class DepthStencilSamplingTest : public DawnTest {
[[location(0)]] var<out> samplerResult : f32;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
samplerResult = textureSampleCompare(tex, samp, vec2<f32>(0.5, 0.5), uniforms.compareRef);
})");
@ -223,7 +223,7 @@ class DepthStencilSamplingTest : public DawnTest {
};
[[group(0), binding(3)]] var<storage> samplerResult : [[access(read_write)]] SamplerResult;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
samplerResult.value = textureSampleCompare(tex, samp, vec2<f32>(0.5, 0.5), uniforms.compareRef);
})");

View File

@ -64,7 +64,7 @@ class DepthStencilStateTest : public DawnTest {
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
vec2<f32>(-1.0, 1.0),
vec2<f32>(-1.0, -1.0),
@ -84,7 +84,7 @@ class DepthStencilStateTest : public DawnTest {
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(ubo.color, 1.0);
})");
}

View File

@ -30,13 +30,13 @@ class DestroyTest : public DawnTest {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<in> pos : vec4<f32>;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = pos;
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");

View File

@ -129,7 +129,7 @@ TEST_P(DeviceLostTest, GetBindGroupLayoutFails) {
pos : vec4<f32>;
};
[[group(0), binding(0)]] var<uniform> ubo : UniformBuffer;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
})");
wgpu::ComputePipelineDescriptor descriptor;
@ -214,7 +214,7 @@ TEST_P(DeviceLostTest, CreateShaderModuleFails) {
ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"(
[[location(0)]] var<in> color : vec4<f32>;
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = color;
})"));
}

View File

@ -29,13 +29,13 @@ class DrawIndexedIndirectTest : public DawnTest {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<in> pos : vec4<f32>;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = pos;
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");

View File

@ -29,13 +29,13 @@ class DrawIndexedTest : public DawnTest {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<in> pos : vec4<f32>;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = pos;
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");

View File

@ -29,13 +29,13 @@ class DrawIndirectTest : public DawnTest {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<in> pos : vec4<f32>;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = pos;
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");

View File

@ -29,13 +29,13 @@ class DrawTest : public DawnTest {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<in> pos : vec4<f32>;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = pos;
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");

View File

@ -96,7 +96,7 @@ class DynamicBufferOffsetTests : public DawnTest {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 0.0),
vec2<f32>(-1.0, 1.0),
@ -145,7 +145,7 @@ class DynamicBufferOffsetTests : public DawnTest {
fs << "const multipleNumber : u32 = " << multipleNumber << "u;\n";
fs << R"(
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
sBufferNotDynamic.value = uBufferNotDynamic.value.xy;
sBuffer.value = vec2<u32>(multipleNumber, multipleNumber) * (uBuffer.value.xy + sBufferNotDynamic.value.xy);
fragColor = vec4<f32>(f32(uBuffer.value.x) / 255.0, f32(uBuffer.value.y) / 255.0,
@ -212,7 +212,7 @@ class DynamicBufferOffsetTests : public DawnTest {
cs << "const multipleNumber : u32 = " << multipleNumber << "u;\n";
cs << R"(
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
sBufferNotDynamic.value = uBufferNotDynamic.value.xy;
sBuffer.value = vec2<u32>(multipleNumber, multipleNumber) * (uBuffer.value.xy + sBufferNotDynamic.value.xy);
}

View File

@ -26,14 +26,14 @@ TEST_P(EntryPointTests, FragAndVertexSameModule) {
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn vertex_main() -> void {
[[stage(vertex)]] fn vertex_main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
return;
}
[[location(0)]] var<out> outColor : vec4<f32>;
[[stage(fragment)]] fn fragment_main() -> void {
[[stage(fragment)]] fn fragment_main() {
outColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
return;
}
@ -72,12 +72,12 @@ TEST_P(EntryPointTests, TwoComputeInModule) {
};
[[binding(0), group(0)]] var<storage> data : [[access(read_write)]] Data;
[[stage(compute)]] fn write1() -> void {
[[stage(compute)]] fn write1() {
data.data = 1u;
return;
}
[[stage(compute)]] fn write42() -> void {
[[stage(compute)]] fn write42() {
data.data = 42u;
return;
}

View File

@ -112,7 +112,7 @@ void FirstIndexOffsetTests::TestImpl(DrawMode mode,
[[builtin(position)]] var<out> position : vec4<f32>;
[[location(0)]] var<in> pos : vec4<f32>;
[[stage(vertex)]] fn main() -> void {)";
[[stage(vertex)]] fn main() {)";
fragmentShader << R"(
[[block]] struct IndexVals {
vertex_index : u32;
@ -121,7 +121,7 @@ void FirstIndexOffsetTests::TestImpl(DrawMode mode,
[[group(0), binding(0)]] var<storage> idx_vals : [[access(read_write)]] IndexVals;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
)";
if ((checkIndex & CheckIndex::Vertex) != 0) {

View File

@ -40,7 +40,7 @@ class GpuMemorySyncTests : public DawnTest {
a : i32;
};
[[group(0), binding(0)]] var<storage> data : [[access(read_write)]] Data;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
data.a = data.a + 1;
})");
@ -59,7 +59,7 @@ class GpuMemorySyncTests : public DawnTest {
wgpu::TextureFormat colorFormat) {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
})");
@ -69,7 +69,7 @@ class GpuMemorySyncTests : public DawnTest {
};
[[group(0), binding(0)]] var<storage> data : [[access(read_write)]] Data;
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
data.i = data.i + 1;
fragColor = vec4<f32>(f32(data.i) / 255.0, 0.0, 0.0, 1.0);
})");
@ -261,7 +261,7 @@ TEST_P(GpuMemorySyncTests, SampledAndROStorageTextureInComputePass) {
[[group(0), binding(1)]] var sampledTex : texture_2d<u32>;
[[group(0), binding(2)]] var storageTex : [[access(read)]] texture_storage_2d<r32uint>;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
output.sampledOut = textureLoad(sampledTex, vec2<i32>(0, 0), 0).x;
output.storageOut = textureLoad(storageTex, vec2<i32>(0, 0)).x;
}
@ -318,7 +318,7 @@ class StorageToUniformSyncTests : public DawnTest {
a : f32;
};
[[group(0), binding(0)]] var<storage> data : [[access(read_write)]] Data;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
data.a = 1.0;
})");
@ -336,7 +336,7 @@ class StorageToUniformSyncTests : public DawnTest {
wgpu::TextureFormat colorFormat) {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
})");
@ -347,7 +347,7 @@ class StorageToUniformSyncTests : public DawnTest {
[[group(0), binding(0)]] var<uniform> contents : Contents;
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(contents.color, 0.0, 0.0, 1.0);
})");
@ -533,7 +533,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) {
[[group(0), binding(2)]] var<storage> uniformContents : [[access(read_write)]] ColorContents1;
[[group(0), binding(3)]] var<storage> storageContents : [[access(read_write)]] ColorContents2;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
vbContents.pos[0] = vec4<f32>(-1.0, 1.0, 0.0, 1.0);
vbContents.pos[1] = vec4<f32>(1.0, 1.0, 0.0, 1.0);
vbContents.pos[2] = vec4<f32>(1.0, -1.0, 0.0, 1.0);
@ -576,7 +576,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<in> pos : vec4<f32>;
[[builtin(position)]] var<out> Position: vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = pos;
})");
@ -589,7 +589,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) {
[[group(0), binding(1)]] var<storage> storageBuffer : [[access(read)]] Buf;
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(uniformBuffer.color, storageBuffer.color, 0.0, 1.0);
})");
@ -650,7 +650,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) {
[[group(0), binding(0)]] var<storage> contents : [[access(read_write)]] Contents;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
contents.pos[0] = vec4<f32>(-1.0, 1.0, 0.0, 1.0);
contents.pos[1] = vec4<f32>(1.0, 1.0, 0.0, 1.0);
contents.pos[2] = vec4<f32>(1.0, -1.0, 0.0, 1.0);
@ -694,7 +694,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<in> pos : vec4<f32>;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = pos;
})");
@ -706,7 +706,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) {
[[group(0), binding(1)]] var<storage> storageBuffer : [[access(read)]] Buf;
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(uniformBuffer.color, storageBuffer.color, 0.0, 1.0);
})");

View File

@ -252,7 +252,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
[[location(0)]] var<out> o_texCoord : vec2<f32>;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
vec2<f32>(-2.0, -2.0),
vec2<f32>(-2.0, 2.0),
@ -280,7 +280,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
[[location(0)]] var<in> texCoord : vec2<f32>;
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = textureSample(texture0, sampler0, texCoord);
}
)");

View File

@ -36,7 +36,7 @@ class IndexFormatTest : public DawnTest {
[[location(0)]] var<in> pos : vec4<f32>;
[[builtin(vertex_index)]] var<in> idx : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
// 0xFFFFFFFE is a designated invalid index used by some tests.
if (idx == 0xFFFFFFFEu) {
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
@ -47,7 +47,7 @@ class IndexFormatTest : public DawnTest {
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");

View File

@ -53,7 +53,7 @@ class MultisampledRenderingTest : public DawnTest {
[[location(0)]] var<out> FragColor : vec4<f32>;
[[builtin(frag_depth)]] var<out> FragDepth : f32;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
FragColor = uBuffer.color;
FragDepth = uBuffer.depth;
})";
@ -65,7 +65,7 @@ class MultisampledRenderingTest : public DawnTest {
[[group(0), binding(0)]] var<uniform> uBuffer : U;
[[location(0)]] var<out> FragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
FragColor = uBuffer.color;
})";
@ -87,7 +87,7 @@ class MultisampledRenderingTest : public DawnTest {
[[location(0)]] var<out> FragColor0 : vec4<f32>;
[[location(1)]] var<out> FragColor1 : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
FragColor0 = uBuffer.color0;
FragColor1 = uBuffer.color1;
})";
@ -217,7 +217,7 @@ class MultisampledRenderingTest : public DawnTest {
[[builtin(position)]] var<out> Position : vec4<f32>;
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, 1.0),
@ -231,7 +231,7 @@ class MultisampledRenderingTest : public DawnTest {
[[builtin(position)]] var<out> Position : vec4<f32>;
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, 1.0),
@ -779,7 +779,7 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DTextureWithSampleMaskAndShaderOut
[[location(0)]] var<out> FragColor : vec4<f32>;
[[builtin(sample_mask_out)]] var<out> SampleMask : u32;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
FragColor = uBuffer.color;
SampleMask = 6u;
})";
@ -837,7 +837,7 @@ TEST_P(MultisampledRenderingTest, ResolveIntoMultipleResolveTargetsWithShaderOut
[[location(1)]] var<out> FragColor1 : vec4<f32>;
[[builtin(sample_mask_out)]] var<out> SampleMask : u32;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
FragColor0 = uBuffer.color0;
FragColor1 = uBuffer.color1;
SampleMask = 6u;

View File

@ -56,14 +56,14 @@ class MultisampledSamplingTest : public DawnTest {
desc.vertex.module = utils::CreateShaderModule(device, R"(
[[location(0)]] var<in> pos : vec2<f32>;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(pos, 0.0, 1.0);
})");
desc.cFragment.module = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : f32;
[[builtin(frag_depth)]] var<out> FragDepth : f32;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = 1.0;
FragDepth = 0.7;
})");
@ -98,7 +98,7 @@ class MultisampledSamplingTest : public DawnTest {
};
[[group(0), binding(2)]] var<storage> results : [[access(read_write)]] Results;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
for (var i : i32 = 0; i < 4; i = i + 1) {
results.colorSamples[i] = textureLoad(texture0, vec2<i32>(0, 0), i).x;
results.depthSamples[i] = textureLoad(texture1, vec2<i32>(0, 0), i).x;

View File

@ -105,17 +105,17 @@ TEST_P(ObjectCachingTest, PipelineLayoutDeduplication) {
TEST_P(ObjectCachingTest, ShaderModuleDeduplication) {
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");
wgpu::ShaderModule sameModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");
wgpu::ShaderModule otherModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(0.0, 0.0, 0.0, 0.0);
})");
@ -127,16 +127,16 @@ TEST_P(ObjectCachingTest, ShaderModuleDeduplication) {
TEST_P(ObjectCachingTest, ComputePipelineDeduplicationOnShaderModule) {
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
var<workgroup> i : u32;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
i = 0u;
})");
wgpu::ShaderModule sameModule = utils::CreateShaderModule(device, R"(
var<workgroup> i : u32;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
i = 0u;
})");
wgpu::ShaderModule otherModule = utils::CreateShaderModule(device, R"(
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
})");
EXPECT_NE(module.Get(), otherModule.Get());
@ -179,7 +179,7 @@ TEST_P(ObjectCachingTest, ComputePipelineDeduplicationOnLayout) {
desc.computeStage.entryPoint = "main";
desc.computeStage.module = utils::CreateShaderModule(device, R"(
var<workgroup> i : u32;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
i = 0u;
})");
@ -213,11 +213,11 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnLayout) {
utils::ComboRenderPipelineDescriptor2 desc;
desc.vertex.module = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 0.0);
})");
desc.cFragment.module = utils::CreateShaderModule(device, R"(
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
desc.layout = pl;
@ -237,17 +237,17 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnLayout) {
TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnVertexModule) {
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 0.0);
})");
wgpu::ShaderModule sameModule = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 0.0);
})");
wgpu::ShaderModule otherModule = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(1.0, 1.0, 1.0, 1.0);
})");
@ -256,7 +256,7 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnVertexModule) {
utils::ComboRenderPipelineDescriptor2 desc;
desc.cFragment.module = utils::CreateShaderModule(device, R"(
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
desc.vertex.module = module;
@ -275,14 +275,14 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnVertexModule) {
// Test that RenderPipelines are correctly deduplicated wrt. their fragment module
TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnFragmentModule) {
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
wgpu::ShaderModule sameModule = utils::CreateShaderModule(device, R"(
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
wgpu::ShaderModule otherModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(0.0, 0.0, 0.0, 0.0);
})");
@ -292,7 +292,7 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnFragmentModule) {
utils::ComboRenderPipelineDescriptor2 desc;
desc.vertex.module = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 0.0);
})");

View File

@ -130,7 +130,7 @@ TEST_P(OpArrayLengthTest, Compute) {
};
[[group(1), binding(0)]] var<storage> result : [[access(read_write)]] ResultBuffer;
)" + mShaderInterface + R"(
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
result.data[0] = arrayLength(buffer1.data);
result.data[1] = arrayLength(buffer2.data);
result.data[2] = arrayLength(buffer3.data);
@ -166,13 +166,13 @@ TEST_P(OpArrayLengthTest, Fragment) {
// pass pixel.
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, (mShaderInterface + R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor.r = f32(arrayLength(buffer1.data)) / 255.0;
fragColor.g = f32(arrayLength(buffer2.data)) / 255.0;
fragColor.b = f32(arrayLength(buffer3.data)) / 255.0;
@ -220,7 +220,7 @@ TEST_P(OpArrayLengthTest, Vertex) {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, (mShaderInterface + R"(
[[location(0)]] var<out> pointColor : vec4<f32>;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
pointColor.r = f32(arrayLength(buffer1.data)) / 255.0;
pointColor.g = f32(arrayLength(buffer2.data)) / 255.0;
pointColor.b = f32(arrayLength(buffer3.data)) / 255.0;
@ -233,7 +233,7 @@ TEST_P(OpArrayLengthTest, Vertex) {
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[location(0)]] var<in> pointColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = pointColor;
})");

View File

@ -52,7 +52,7 @@ class DepthClampingTest : public DawnTest {
[[group(0), binding(0)]] var<uniform> ubo : UBO;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(0.0, 0.0, ubo.depth, 1.0);
})");
@ -65,7 +65,7 @@ class DepthClampingTest : public DawnTest {
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(ubo.color, 1.0);
})");
}

View File

@ -156,13 +156,13 @@ class PrimitiveTopologyTest : public DawnTest {
vsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<in> pos : vec4<f32>;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = pos;
})");
fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");

View File

@ -83,7 +83,7 @@ class OcclusionQueryTests : public QueryTests {
vsModule = utils::CreateShaderModule(device, R"(
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
vec2<f32>( 1.0, 1.0),
vec2<f32>(-1.0, -1.0),
@ -93,7 +93,7 @@ class OcclusionQueryTests : public QueryTests {
fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");

View File

@ -34,7 +34,7 @@ class RenderBundleTest : public DawnTest {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<in> pos : vec4<f32>;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = pos;
})");
@ -45,7 +45,7 @@ class RenderBundleTest : public DawnTest {
};
[[group(0), binding(0)]] var<uniform> fragmentUniformBuffer : Ubo;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = fragmentUniformBuffer.color;
})");

View File

@ -80,7 +80,7 @@ class RenderPassLoadOpTests : public DawnTest {
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
vec2<f32>( 0.0, -1.0),
vec2<f32>( 1.0, -1.0),
@ -94,7 +94,7 @@ class RenderPassLoadOpTests : public DawnTest {
const char* fsSource = R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(0.0, 0.0, 1.0, 1.0);
})";
blueQuad = DrawQuad(device, vsSource, fsSource);

View File

@ -30,7 +30,7 @@ class RenderPassTest : public DawnTest {
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, -1.0),
@ -41,7 +41,7 @@ class RenderPassTest : public DawnTest {
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(0.0, 0.0, 1.0, 1.0);
})");
@ -141,7 +141,7 @@ TEST_P(RenderPassTest, NoCorrespondingFragmentShaderOutputs) {
{
// Next we use a pipeline whose fragment shader has no outputs.
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
descriptor.vertex.module = mVSModule;

View File

@ -50,7 +50,7 @@ class SamplerFilterAnisotropicTest : public DawnTest {
[[builtin(position)]] var<out> Position : vec4<f32>;
[[location(0)]] var<out> fragUV : vec2<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
fragUV = uv;
Position = uniforms.matrix * position;
}
@ -65,7 +65,7 @@ class SamplerFilterAnisotropicTest : public DawnTest {
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = textureSample(texture0, sampler0, fragUV);
})");

View File

@ -58,7 +58,7 @@ class SamplerTest : public DawnTest {
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
vec2<f32>(-2.0, -2.0),
vec2<f32>(-2.0, 2.0),
@ -77,7 +77,7 @@ class SamplerTest : public DawnTest {
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = textureSample(texture0, sampler0, FragCoord.xy / vec2<f32>(2.0, 2.0));
})");

View File

@ -32,13 +32,13 @@ class ScissorTest : public DawnTest {
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, -1.0));
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(pos[VertexIndex], 0.5, 1.0);
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");

View File

@ -37,7 +37,7 @@ TEST_P(ShaderTests, ComputeLog2) {
[[group(0), binding(0)]] var<storage> buf : [[access(read_write)]] Buf;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
const factor : f32 = 1.0001;
buf.data[0] = u32(log2(1.0 * factor));

View File

@ -330,7 +330,7 @@ fn IsEqualTo(pixel : vec4<f32>, expected : vec4<f32>) -> bool {
std::ostringstream ostream;
ostream << GetImageDeclaration(format, "write", is2DArray, 0) << "\n";
ostream << "[[stage(" << stage << ")]]\n";
ostream << "fn main() -> void {\n";
ostream << "fn main() {\n";
ostream << " var size : vec2<i32> = textureDimensions(storageImage0);\n";
ostream << " const layerCount : i32 = " << layerCount << ";\n";
ostream << " for (var layer : i32 = 0; layer < layerCount; layer = layer + 1) {\n";
@ -358,7 +358,7 @@ fn IsEqualTo(pixel : vec4<f32>, expected : vec4<f32>) -> bool {
std::ostringstream ostream;
ostream << GetImageDeclaration(format, "write", is2DArray, 0) << "\n";
ostream << GetImageDeclaration(format, "read", is2DArray, 1) << "\n";
ostream << "[[stage(compute)]] fn main() -> void {\n";
ostream << "[[stage(compute)]] fn main() {\n";
ostream << " var size : vec2<i32> = textureDimensions(storageImage0);\n";
ostream << " const layerCount : i32 = " << layerCount << ";\n";
ostream << " for (var layer : i32 = 0; layer < layerCount; layer = layer + 1) {\n";
@ -649,7 +649,7 @@ fn IsEqualTo(pixel : vec4<f32>, expected : vec4<f32>) -> bool {
const char* kSimpleVertexShader = R"(
[[builtin(position)]] var<out> position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
})";
@ -715,7 +715,7 @@ TEST_P(StorageTextureTests, ReadonlyStorageTextureInComputeShader) {
[[group(0), binding(1)]] var<storage> dstBuffer : [[access(read_write)]] DstBuffer;
)" << CommonReadOnlyTestCode(format)
<< R"(
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
if (doTest()) {
dstBuffer.result = 1u;
} else {
@ -750,7 +750,7 @@ TEST_P(StorageTextureTests, ReadonlyStorageTextureInVertexShader) {
[[location(0)]] var<out> o_color : vec4<f32>;
)" << CommonReadOnlyTestCode(format)
<< R"(
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
if (doTest()) {
o_color = vec4<f32>(0.0, 1.0, 0.0, 1.0);
@ -761,7 +761,7 @@ TEST_P(StorageTextureTests, ReadonlyStorageTextureInVertexShader) {
const char* kFragmentShader = R"(
[[location(0)]] var<in> o_color : vec4<f32>;
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = o_color;
})";
CheckDrawsGreen(vsStream.str().c_str(), kFragmentShader, readonlyStorageTexture);
@ -795,7 +795,7 @@ TEST_P(StorageTextureTests, ReadonlyStorageTextureInFragmentShader) {
[[location(0)]] var<out> o_color : vec4<f32>;
)" << CommonReadOnlyTestCode(format)
<< R"(
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
if (doTest()) {
o_color = vec4<f32>(0.0, 1.0, 0.0, 1.0);
} else {
@ -940,7 +940,7 @@ TEST_P(StorageTextureTests, Readonly2DArrayStorageTexture) {
[[group(0), binding(1)]] var<storage> dstBuffer : [[access(read_write)]] DstBuffer;
)" << CommonReadOnlyTestCode(kTextureFormat, true)
<< R"(
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
if (doTest()) {
dstBuffer.result = 1u;
} else {
@ -985,7 +985,7 @@ TEST_P(StorageTextureTests, ReadonlyAndWriteonlyStorageTexturePingPong) {
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var Src : [[access(read)]] texture_storage_2d<r32uint>;
[[group(0), binding(1)]] var Dst : [[access(write)]] texture_storage_2d<r32uint>;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
var srcValue : vec4<u32> = textureLoad(Src, vec2<i32>(0, 0));
srcValue.x = srcValue.x + 1u;
textureStore(Dst, vec2<i32>(0, 0), srcValue);
@ -1059,7 +1059,7 @@ TEST_P(StorageTextureTests, SampledAndWriteonlyStorageTexturePingPong) {
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var Src : texture_2d<u32>;
[[group(0), binding(1)]] var Dst : [[access(write)]] texture_storage_2d<r32uint>;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
var srcValue : vec4<u32> = textureLoad(Src, vec2<i32>(0, 0), 0);
srcValue.x = srcValue.x + 1u;
textureStore(Dst, vec2<i32>(0, 0), srcValue);
@ -1158,13 +1158,13 @@ fn doTest() -> bool {
const char* kCommonWriteOnlyZeroInitTestCodeFragment = R"(
[[group(0), binding(0)]] var dstImage : [[access(write)]] texture_storage_2d<r32uint>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
textureStore(dstImage, vec2<i32>(0, 0), vec4<u32>(1u, 0u, 0u, 1u));
})";
const char* kCommonWriteOnlyZeroInitTestCodeCompute = R"(
[[group(0), binding(0)]] var dstImage : [[access(write)]] texture_storage_2d<r32uint>;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
textureStore(dstImage, vec2<i32>(0, 0), vec4<u32>(1u, 0u, 0u, 1u));
})";
};
@ -1183,7 +1183,7 @@ TEST_P(StorageTextureZeroInitTests, ReadonlyStorageTextureClearsToZeroInRenderPa
[[location(0)]] var<out> o_color : vec4<f32>;
)") + kCommonReadOnlyZeroInitTestCode +
R"(
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
if (doTest()) {
o_color = vec4<f32>(0.0, 1.0, 0.0, 1.0);
} else {
@ -1209,7 +1209,7 @@ TEST_P(StorageTextureZeroInitTests, ReadonlyStorageTextureClearsToZeroInComputeP
[[group(0), binding(0)]] var srcImage : [[access(read)]] texture_storage_2d<r32uint>;
[[group(0), binding(1)]] var<storage> dstBuffer : [[access(read_write)]] DstBuffer;
)") + kCommonReadOnlyZeroInitTestCode + R"(
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
if (doTest()) {
dstBuffer.result = 1u;
} else {

View File

@ -223,12 +223,12 @@ TEST_P(SwapChainValidationTests, ReturnedViewCharacteristics) {
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
})");
pipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");
// Validation will check that the sample count of the view matches this format.

View File

@ -146,7 +146,7 @@ class TextureFormatTest : public DawnTest {
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
vec2<f32>(-3.0, -1.0),
vec2<f32>( 3.0, -1.0),
@ -162,7 +162,7 @@ class TextureFormatTest : public DawnTest {
fsSource << "[[group(0), binding(0)]] var myTexture : texture_2d<" << type << ">;\n";
fsSource << "[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;\n";
fsSource << "[[location(0)]] var<out> fragColor : vec4<" << type << ">;\n";
fsSource << "[[stage(fragment)]] fn main() -> void {\n";
fsSource << "[[stage(fragment)]] fn main() {\n";
fsSource << " fragColor = textureLoad(myTexture, vec2<i32>(FragCoord.xy), 0);\n";
fsSource << "}";

View File

@ -53,7 +53,7 @@ class TextureSubresourceTest : public DawnTest {
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>(-1.0, -1.0),
@ -64,7 +64,7 @@ class TextureSubresourceTest : public DawnTest {
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
})");
@ -93,7 +93,7 @@ class TextureSubresourceTest : public DawnTest {
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
vec2<f32>(-1.0, -1.0),
vec2<f32>( 1.0, 1.0),
@ -113,7 +113,7 @@ class TextureSubresourceTest : public DawnTest {
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = textureSample(tex, samp, FragCoord.xy / vec2<f32>(4.0, 4.0));
})");

View File

@ -64,7 +64,7 @@ namespace {
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[location(0)]] var<out> TexCoord : vec2<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
vec2<f32>(-2., -2.),
vec2<f32>(-2., 2.),
@ -219,7 +219,7 @@ class TextureViewSamplingTest : public DawnTest {
[[location(0)]] var<in> texCoord : vec2<f32>;
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = textureSample(texture0, sampler0, texCoord);
}
)";
@ -258,7 +258,7 @@ class TextureViewSamplingTest : public DawnTest {
[[location(0)]] var<in> texCoord : vec2<f32>;
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = textureSample(texture0, sampler0, texCoord, 0) +
textureSample(texture0, sampler0, texCoord, 1) +
textureSample(texture0, sampler0, texCoord, 2);
@ -295,7 +295,7 @@ class TextureViewSamplingTest : public DawnTest {
[[location(0)]] var<in> texCoord : vec2<f32>;
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
var sc : f32 = 2.0 * texCoord.x - 1.0;
var tc : f32 = 2.0 * texCoord.y - 1.0;
fragColor = textureSample(texture0, sampler0, vec3<f32>()"
@ -368,7 +368,7 @@ TEST_P(TextureViewSamplingTest, Default2DArrayTexture) {
[[location(0)]] var<in> texCoord : vec2<f32>;
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = textureSample(texture0, sampler0, texCoord, 0) +
textureSample(texture0, sampler0, texCoord, 1) +
textureSample(texture0, sampler0, texCoord, 2);
@ -498,7 +498,7 @@ class TextureViewRenderingTest : public DawnTest {
const char* oneColorFragmentShader = R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
}
)";

View File

@ -70,7 +70,7 @@ class TextureZeroInitTest : public DawnTest {
pipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest(depth);
const char* fs = R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
}
)";
@ -95,7 +95,7 @@ class TextureZeroInitTest : public DawnTest {
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(pos[VertexIndex], )" +
std::to_string(depth) + R"(, 1.0);
})";
@ -106,7 +106,7 @@ class TextureZeroInitTest : public DawnTest {
[[group(0), binding(0)]] var texture0 : texture_2d<f32>;
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = textureLoad(texture0, vec2<i32>(FragCoord.xy), 0);
}
)");
@ -977,7 +977,7 @@ TEST_P(TextureZeroInitTest, ComputePassSampledTextureClear) {
value : vec4<f32>;
};
[[group(0), binding(1)]] var<storage> result : [[access(read_write)]] Result;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
result.value = textureLoad(tex, vec2<i32>(0,0), 0);
}
)";

View File

@ -35,7 +35,7 @@ class VertexBufferRobustnessTest : public DawnTest {
return utils::CreateShaderModule(device, (attributes + R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
if ()" + successExpression + R"() {
// Success case, move the vertex out of the viewport
Position = vec4<f32>(-10.0, 0.0, 0.0, 1.0);
@ -60,7 +60,7 @@ class VertexBufferRobustnessTest : public DawnTest {
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> outColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
outColor = vec4<f32>(1.0, 1.0, 1.0, 1.0);
return;
}

View File

@ -255,7 +255,7 @@ class VertexFormatTest : public DawnTest {
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
vec2<f32>(-1.0, -1.0),
vec2<f32>( 2.0, 0.0),
@ -343,7 +343,7 @@ class VertexFormatTest : public DawnTest {
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<in> color : vec4<f32>;
[[location(0)]] var<out> FragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
FragColor = color;
})");

View File

@ -83,7 +83,7 @@ class VertexStateTest : public DawnTest {
vs << "[[builtin(instance_index)]] var<in> InstanceIndex : u32;\n";
vs << "[[location(0)]] var<out> color : vec4<f32>;\n";
vs << "[[builtin(position)]] var<out> Position : vec4<f32>;\n";
vs << "[[stage(vertex)]] fn main() -> void {\n";
vs << "[[stage(vertex)]] fn main() {\n";
// Hard code the triangle in the shader so that we don't have to add a vertex input for it.
// Also this places the triangle in the grid based on its VertexID and InstanceID
@ -127,7 +127,7 @@ class VertexStateTest : public DawnTest {
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<in> color : vec4<f32>;
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = color;
}
)");
@ -578,7 +578,7 @@ TEST_P(VertexStateTest, OverlappingVertexAttributes) {
[[location(0)]] var<out> color : vec4<f32>;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
var success : bool = (
@ -598,7 +598,7 @@ TEST_P(VertexStateTest, OverlappingVertexAttributes) {
pipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"(
[[location(0)]] var<in> color : vec4<f32>;
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = color;
})");
pipelineDesc.vertex.bufferCount = vertexState.vertexBufferCount;
@ -643,13 +643,13 @@ TEST_P(OptionalVertexStateTest, Basic) {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");

View File

@ -26,13 +26,13 @@ TEST_P(ViewportOrientationTests, OriginAt0x0) {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(-0.5, 0.5, 0.0, 1.0);
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");

View File

@ -34,13 +34,13 @@ class ViewportTest : public DawnTest {
vec2<f32>(-1.0, -1.0),
vec2<f32>( 1.0, -1.0));
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(pos[VertexIndex], 0.0, 1.0);
})");
mQuadFS = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(1.0, 1.0, 1.0, 1.0);
})");
}
@ -104,7 +104,7 @@ class ViewportTest : public DawnTest {
vec3<f32>( 0.0, 0.0, 0.5),
vec3<f32>( 0.9, 0.0, 0.0));
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(points[VertexIndex], 1.0);
})");
pipelineDesc.cFragment.module = mQuadFS;

View File

@ -35,7 +35,7 @@ namespace {
constexpr char kVertexShader[] = R"(
[[location(0)]] var<in> pos : vec4<f32>;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = pos;
})";
@ -45,7 +45,7 @@ namespace {
};
[[group(0), binding(0)]] var<uniform> uniforms : Uniforms;
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(uniforms.color * (1.0 / 5000.0), 1.0);
})";
@ -61,7 +61,7 @@ namespace {
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>((constants.color + uniforms.color) * (1.0 / 5000.0), 1.0);
})";

View File

@ -72,14 +72,14 @@ class SubresourceTrackingPerf : public DawnPerfTestWithParams<SubresourceTrackin
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(1.0, 0.0, 0.0, 1.0);
}
)");
pipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> FragColor : vec4<f32>;
[[group(0), binding(0)]] var materials : texture_2d<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
const foo : vec2<i32> = textureDimensions(materials);
FragColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
}

View File

@ -1084,7 +1084,7 @@ class SetBindGroupValidationTest : public ValidationTest {
wgpu::RenderPipeline CreateRenderPipeline() {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
@ -1097,7 +1097,7 @@ class SetBindGroupValidationTest : public ValidationTest {
[[group(0), binding(2)]] var<storage> sBufferDynamic : [[access(read_write)]] S;
[[group(0), binding(3)]] var<storage> sReadonlyBufferDynamic : [[access(read)]] S;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
@ -1120,7 +1120,7 @@ class SetBindGroupValidationTest : public ValidationTest {
[[group(0), binding(2)]] var<storage> sBufferDynamic : [[access(read_write)]] S;
[[group(0), binding(3)]] var<storage> sReadonlyBufferDynamic : [[access(read)]] S;
[[stage(compute), workgroup_size(4, 4, 1)]] fn main() -> void {
[[stage(compute), workgroup_size(4, 4, 1)]] fn main() {
})");
wgpu::PipelineLayout pipelineLayout =
@ -1487,7 +1487,7 @@ class SetBindGroupPersistenceValidationTest : public ValidationTest {
ValidationTest::SetUp();
mVsModule = utils::CreateShaderModule(device, R"(
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
})");
}
@ -1555,7 +1555,7 @@ class SetBindGroupPersistenceValidationTest : public ValidationTest {
}
}
ss << "[[stage(fragment)]] fn main() -> void {}";
ss << "[[stage(fragment)]] fn main() {}";
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, ss.str().c_str());
@ -1689,7 +1689,7 @@ class BindGroupLayoutCompatibilityTest : public ValidationTest {
const char* fsShader,
std::vector<wgpu::BindGroupLayout> bindGroupLayout) {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fsShader);
@ -1714,7 +1714,7 @@ class BindGroupLayoutCompatibilityTest : public ValidationTest {
[[group(0), binding(0)]] var<storage> sBufferDynamic : [[access(read_write)]] S;
[[group(1), binding(0)]] var<storage> sReadonlyBufferDynamic : [[access(read)]] S;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})",
std::move(bindGroupLayouts));
}
@ -1747,7 +1747,7 @@ class BindGroupLayoutCompatibilityTest : public ValidationTest {
[[group(0), binding(0)]] var<storage> sBufferDynamic : [[access(read_write)]] S;
[[group(1), binding(0)]] var<storage> sReadonlyBufferDynamic : [[access(read)]] S;
[[stage(compute), workgroup_size(4, 4, 1)]] fn main() -> void {
[[stage(compute), workgroup_size(4, 4, 1)]] fn main() {
})",
std::move(bindGroupLayouts));
}
@ -1788,11 +1788,11 @@ TEST_F(BindGroupLayoutCompatibilityTest, ROStorageInBGLWithRWStorageInShader) {
TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) {
constexpr char kTexture2DShaderFS[] = R"(
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})";
constexpr char kTexture2DShaderCS[] = R"(
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
})";
// Render: Test that 2D texture with 2D view dimension works
@ -1825,11 +1825,11 @@ TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) {
constexpr char kTexture2DArrayShaderFS[] = R"(
[[group(0), binding(0)]] var myTexture : texture_2d_array<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})";
constexpr char kTexture2DArrayShaderCS[] = R"(
[[group(0), binding(0)]] var myTexture : texture_2d_array<f32>;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
})";
// Render: Test that 2D texture array with 2D array view dimension works
@ -2053,7 +2053,7 @@ class ComparisonSamplerBindingTest : public ValidationTest {
wgpu::RenderPipeline CreateFragmentPipeline(wgpu::BindGroupLayout* bindGroupLayout,
const char* fragmentSource) {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fragmentSource);
@ -2078,7 +2078,7 @@ TEST_F(ComparisonSamplerBindingTest, DISABLED_ShaderAndBGLMatches) {
CreateFragmentPipeline(&bindGroupLayout, R"(
[[group(0), binding(0)]] var mySampler: sampler;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
}
@ -2089,7 +2089,7 @@ TEST_F(ComparisonSamplerBindingTest, DISABLED_ShaderAndBGLMatches) {
CreateFragmentPipeline(&bindGroupLayout, R"(
[[group(0), binding(0)]] var mySampler: sampler_comparison;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
}
@ -2100,7 +2100,7 @@ TEST_F(ComparisonSamplerBindingTest, DISABLED_ShaderAndBGLMatches) {
ASSERT_DEVICE_ERROR(CreateFragmentPipeline(&bindGroupLayout, R"(
[[group(0), binding(0)]] var mySampler: sampler_comparison;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})"));
}
@ -2111,7 +2111,7 @@ TEST_F(ComparisonSamplerBindingTest, DISABLED_ShaderAndBGLMatches) {
ASSERT_DEVICE_ERROR(CreateFragmentPipeline(&bindGroupLayout, R"(
[[group(0), binding(0)]] var mySampler: sampler;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})"));
}
}

View File

@ -23,7 +23,7 @@ class ComputeIndirectValidationTest : public ValidationTest {
ValidationTest::SetUp();
wgpu::ShaderModule computeModule = utils::CreateShaderModule(device, R"(
[[stage(compute), workgroup_size(1)]] fn main() -> void {
[[stage(compute), workgroup_size(1)]] fn main() {
})");
// Set up compute pipeline

View File

@ -25,13 +25,13 @@ class DrawIndirectValidationTest : public ValidationTest {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 0.0);
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(0.0, 0.0, 0.0, 0.0);
})");

View File

@ -21,7 +21,7 @@ class GetBindGroupLayoutTests : public ValidationTest {
protected:
wgpu::RenderPipeline RenderPipelineFromFragmentShader(const char* shader) {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, shader);
@ -50,7 +50,7 @@ TEST_F(GetBindGroupLayoutTests, SameObject) {
[[group(0), binding(0)]] var<uniform> uniform0 : S;
[[group(1), binding(0)]] var<uniform> uniform1 : S;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
@ -64,7 +64,7 @@ TEST_F(GetBindGroupLayoutTests, SameObject) {
};
[[group(3), binding(0)]] var<storage> storage3 : [[access(read_write)]] S3;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
@ -102,7 +102,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultShaderStageAndDynamicOffsets) {
};
[[group(0), binding(0)]] var<uniform> uniforms : S;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
wgpu::BindGroupLayoutEntry binding = {};
@ -145,7 +145,7 @@ TEST_F(GetBindGroupLayoutTests, ComputePipeline) {
};
[[group(0), binding(0)]] var<uniform> uniforms : S;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
})");
wgpu::ComputePipelineDescriptor descriptor;
@ -196,7 +196,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
};
[[group(0), binding(0)]] var<storage> ssbo : [[access(read_write)]] S;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@ -208,7 +208,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
};
[[group(0), binding(0)]] var<uniform> uniforms : S;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@ -221,7 +221,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
};
[[group(0), binding(0)]] var<storage> ssbo : [[access(read)]] S;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@ -233,7 +233,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@ -243,7 +243,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
[[group(0), binding(0)]] var myTexture : texture_multisampled_2d<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@ -254,7 +254,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
[[group(0), binding(0)]] var mySampler: sampler;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@ -281,7 +281,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) {
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
[[group(0), binding(0)]] var myTexture : texture_1d<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@ -291,7 +291,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) {
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@ -301,7 +301,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) {
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
[[group(0), binding(0)]] var myTexture : texture_2d_array<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@ -311,7 +311,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) {
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
[[group(0), binding(0)]] var myTexture : texture_3d<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@ -321,7 +321,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) {
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
[[group(0), binding(0)]] var myTexture : texture_cube<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@ -331,7 +331,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) {
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
[[group(0), binding(0)]] var myTexture : texture_cube_array<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@ -357,7 +357,7 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) {
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@ -367,7 +367,7 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) {
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
[[group(0), binding(0)]] var myTexture : texture_2d<i32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@ -377,7 +377,7 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) {
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
[[group(0), binding(0)]] var myTexture : texture_2d<u32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@ -408,7 +408,7 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) {
};
[[group(0), binding(0)]] var<uniform> uniforms : S;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@ -421,7 +421,7 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) {
};
[[group(0), binding(1)]] var<uniform> uniforms : S;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@ -434,7 +434,7 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) {
};
[[group(0), binding(1)]] var<uniform> uniforms : S;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
EXPECT_NE(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
@ -449,7 +449,7 @@ TEST_F(GetBindGroupLayoutTests, DuplicateBinding) {
[[group(0), binding(0)]] var<uniform> uniform0 : S;
[[group(1), binding(0)]] var<uniform> uniform1 : S;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
@ -458,7 +458,7 @@ TEST_F(GetBindGroupLayoutTests, DuplicateBinding) {
};
[[group(1), binding(0)]] var<uniform> uniforms : S;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
@ -482,7 +482,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
};
[[group(0), binding(0)]] var<uniform> uniforms : S;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
})");
wgpu::ShaderModule vsModule64 = utils::CreateShaderModule(device, R"(
@ -491,7 +491,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
};
[[group(0), binding(0)]] var<uniform> uniforms : S;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
})");
wgpu::ShaderModule fsModule4 = utils::CreateShaderModule(device, R"(
@ -500,7 +500,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
};
[[group(0), binding(0)]] var<uniform> uniforms : S;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
wgpu::ShaderModule fsModule64 = utils::CreateShaderModule(device, R"(
@ -509,7 +509,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
};
[[group(0), binding(0)]] var<uniform> uniforms : S;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
// Create BGLs with minBufferBindingSize 4 and 64.
@ -563,21 +563,21 @@ TEST_F(GetBindGroupLayoutTests, StageAggregation) {
DAWN_SKIP_TEST_IF(UsesWire());
wgpu::ShaderModule vsModuleNoSampler = utils::CreateShaderModule(device, R"(
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
})");
wgpu::ShaderModule vsModuleSampler = utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var mySampler: sampler;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
})");
wgpu::ShaderModule fsModuleNoSampler = utils::CreateShaderModule(device, R"(
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
wgpu::ShaderModule fsModuleSampler = utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var mySampler: sampler;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
// Create BGLs with minBufferBindingSize 4 and 64.
@ -631,7 +631,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingType) {
};
[[group(0), binding(0)]] var<uniform> ubo : S;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
@ -640,7 +640,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingType) {
};
[[group(0), binding(0)]] var<storage> ssbo : [[access(read_write)]] S;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
@ -656,13 +656,13 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureMultisampling) {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var myTexture : texture_multisampled_2d<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
@ -678,13 +678,13 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingViewDimension) {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var myTexture : texture_3d<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
@ -700,13 +700,13 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureComponentType) {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var myTexture : texture_2d<i32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
@ -720,12 +720,12 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureComponentType) {
// Test it is an error to query an out of range bind group layout.
TEST_F(GetBindGroupLayoutTests, OutOfRangeIndex) {
ASSERT_DEVICE_ERROR(RenderPipelineFromFragmentShader(R"(
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})")
.GetBindGroupLayout(kMaxBindGroups));
ASSERT_DEVICE_ERROR(RenderPipelineFromFragmentShader(R"(
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})")
.GetBindGroupLayout(kMaxBindGroups + 1));
}
@ -744,7 +744,7 @@ TEST_F(GetBindGroupLayoutTests, UnusedIndex) {
[[group(0), binding(0)]] var<uniform> uniforms0 : S;
[[group(2), binding(0)]] var<uniform> uniforms2 : S;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
wgpu::BindGroupLayoutDescriptor desc = {};
@ -790,11 +790,11 @@ TEST_F(GetBindGroupLayoutTests, Reflection) {
};
[[group(0), binding(0)]] var<uniform> uniforms : S;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
@ -830,11 +830,11 @@ TEST_F(GetBindGroupLayoutTests, DISABLED_FromCorrectEntryPoint) {
[[binding 0, set 0]] var<storage> data0 : [[access(read_write)]] Data;
[[binding 1, set 0]] var<storage> data1 : [[access(read_write)]] Data;
fn compute0() -> void {
fn compute0() {
data0.data = 0.0;
return;
}
fn compute1() -> void {
fn compute1() {
data1.data = 0.0;
return;
}

View File

@ -24,13 +24,13 @@ class IndexBufferValidationTest : public ValidationTest {
wgpu::PrimitiveTopology primitiveTopology) {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");

View File

@ -99,19 +99,17 @@ namespace {
// Creates a compute shader with given bindings
std::string CreateComputeShaderWithBindings(const std::vector<BindingDescriptor>& bindings) {
return kStructs + GenerateBindingString(bindings) +
"[[stage(compute), workgroup_size(1,1,1)]] fn main() -> void {}";
"[[stage(compute), workgroup_size(1,1,1)]] fn main() {}";
}
// Creates a vertex shader with given bindings
std::string CreateVertexShaderWithBindings(const std::vector<BindingDescriptor>& bindings) {
return kStructs + GenerateBindingString(bindings) +
"[[stage(vertex)]] fn main() -> void {}";
return kStructs + GenerateBindingString(bindings) + "[[stage(vertex)]] fn main() {}";
}
// Creates a fragment shader with given bindings
std::string CreateFragmentShaderWithBindings(const std::vector<BindingDescriptor>& bindings) {
return kStructs + GenerateBindingString(bindings) +
"[[stage(fragment)]] fn main() -> void {}";
return kStructs + GenerateBindingString(bindings) + "[[stage(fragment)]] fn main() {}";
}
// Concatenates vectors containing BindingDescriptor

View File

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

View File

@ -176,13 +176,13 @@ namespace {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");
@ -213,7 +213,7 @@ namespace {
wgpu::ComputePipelineDescriptor descriptor;
descriptor.computeStage.module = utils::CreateShaderModule(device, R"(
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
})");
descriptor.computeStage.entryPoint = "main";
device.CreateComputePipelineAsync(&descriptor, callback, &callbackData);

View File

@ -35,7 +35,7 @@ namespace {
};
[[group(0), binding(0)]] var<uniform> uniforms : S;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
})");
fsModule = utils::CreateShaderModule(device, R"(
@ -49,7 +49,7 @@ namespace {
};
[[group(1), binding(1)]] var<storage> ssbo : [[access(read_write)]] Storage;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
wgpu::BindGroupLayout bgls[] = {

View File

@ -28,13 +28,13 @@ class RenderPipelineValidationTest : public ValidationTest {
vsModule = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
})");
fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");
}
@ -193,7 +193,7 @@ TEST_F(RenderPipelineValidationTest, FragmentOutputFormatCompatibility) {
stream << R"(
[[location(0)]] var<out> fragColor : vec4<)"
<< kScalarTypes[i] << R"(>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})";
descriptor.cFragment.module = utils::CreateShaderModule(device, stream.str().c_str());
@ -411,7 +411,7 @@ TEST_F(RenderPipelineValidationTest, TextureComponentTypeCompatibility) {
[[group(0), binding(0)]] var myTexture : texture_2d<)"
<< kScalarTypes[i] << R"(>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})";
descriptor.cFragment.module = utils::CreateShaderModule(device, stream.str().c_str());
@ -458,7 +458,7 @@ TEST_F(RenderPipelineValidationTest, TextureViewDimensionCompatibility) {
stream << R"(
[[group(0), binding(0)]] var myTexture : )"
<< kTextureKeywords[i] << R"(<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})";
descriptor.cFragment.module = utils::CreateShaderModule(device, stream.str().c_str());
@ -485,7 +485,7 @@ TEST_F(RenderPipelineValidationTest, StorageBufferInVertexShaderNoLayout) {
};
[[group(0), binding(0)]] var<storage> dst : [[access(read_write)]] Dst;
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
dst.data[VertexIndex] = 0x1234u;
})");
@ -592,13 +592,13 @@ TEST_F(RenderPipelineValidationTest, DepthCompareUndefinedIsError) {
TEST_F(RenderPipelineValidationTest, EntryPointNameValidation) {
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> position : vec4<f32>;
[[stage(vertex)]] fn vertex_main() -> void {
[[stage(vertex)]] fn vertex_main() {
position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
return;
}
[[location(0)]] var<out> color : vec4<f32>;
[[stage(fragment)]] fn fragment_main() -> void {
[[stage(fragment)]] fn fragment_main() {
color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
return;
}
@ -645,11 +645,11 @@ TEST_F(RenderPipelineValidationTest, VertexAttribCorrectEntryPoint) {
[[location(0)]] var<in> attrib0 : vec4<f32>;
[[location(1)]] var<in> attrib1 : vec4<f32>;
[[stage(vertex)]] fn vertex0() -> void {
[[stage(vertex)]] fn vertex0() {
position = attrib0;
return;
}
[[stage(vertex)]] fn vertex1() -> void {
[[stage(vertex)]] fn vertex1() {
position = attrib1;
return;
}
@ -690,11 +690,11 @@ TEST_F(RenderPipelineValidationTest, FragmentOutputCorrectEntryPoint) {
[[location(0)]] var<out> colorFloat : vec4<f32>;
[[location(0)]] var<out> colorUint : vec4<u32>;
[[stage(fragment)]] fn fragmentFloat() -> void {
[[stage(fragment)]] fn fragmentFloat() {
colorFloat = vec4<f32>(0.0, 0.0, 0.0, 0.0);
return;
}
[[stage(fragment)]] fn fragmentUint() -> void {
[[stage(fragment)]] fn fragmentUint() {
colorUint = vec4<u32>(0u, 0u, 0u, 0u);
return;
}
@ -734,11 +734,11 @@ TEST_F(RenderPipelineValidationTest, DISABLED_BindingsFromCorrectEntryPoint) {
[[binding 1, set 0]] var<uniform> var1 : Uniforms;
[[builtin(position)]] var<out> position : vec4<f32>;
fn vertex0() -> void {
fn vertex0() {
position = var0.data;
return;
}
fn vertex1() -> void {
fn vertex1() {
position = var1.data;
return;
}

View File

@ -47,11 +47,11 @@ namespace {
// pipeline. But those bind groups in caller can be used for validation for other purposes.
wgpu::RenderPipeline CreateNoOpRenderPipeline() {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
pipelineDescriptor.vertex.module = vsModule;
@ -62,7 +62,7 @@ namespace {
wgpu::ComputePipeline CreateNoOpComputePipeline() {
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"(
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
})");
wgpu::ComputePipelineDescriptor pipelineDescriptor;
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, nullptr);
@ -772,7 +772,7 @@ namespace {
// Create a passthrough render pipeline with a readonly buffer
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
@ -780,7 +780,7 @@ namespace {
value : f32;
};
[[group(0), binding(0)]] var<storage> rBuffer : [[access(read)]] RBuffer;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
pipelineDescriptor.vertex.module = vsModule;
@ -820,7 +820,7 @@ namespace {
value : f32;
};
[[group(0), binding(0)]] var<storage> rBuffer : [[access(read)]] RBuffer;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
})");
wgpu::ComputePipelineDescriptor pipelineDescriptor;
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl0);
@ -1550,12 +1550,12 @@ namespace {
{
// Create a passthrough render pipeline with a readonly storage texture
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var tex : [[access(read)]] texture_storage_2d<rgba8unorm>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})");
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
pipelineDescriptor.vertex.module = vsModule;
@ -1581,7 +1581,7 @@ namespace {
// Create a passthrough compute pipeline with a readonly storage texture
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var tex : [[access(read)]] texture_storage_2d<rgba8unorm>;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
})");
wgpu::ComputePipelineDescriptor pipelineDescriptor;
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &readBGL);

View File

@ -61,7 +61,7 @@ TEST_F(ShaderModuleValidationTest, CreationSuccess) {
TEST_F(ShaderModuleValidationTest, FragmentOutputLocationExceedsMaxColorAttachments) {
std::ostringstream stream;
stream << "[[location(" << kMaxColorAttachments << R"()]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
})";
ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, stream.str().c_str()));
@ -164,7 +164,7 @@ TEST_F(ShaderModuleValidationTest, CompilationMessages) {
std::ostringstream stream;
stream << R"([[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
})";
wgpu::ShaderModule shaderModule = utils::CreateShaderModule(device, stream.str().c_str());

View File

@ -25,12 +25,12 @@ class StorageTextureValidationTests : public ValidationTest {
mDefaultVSModule = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
})");
mDefaultFSModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
})");
}
@ -88,7 +88,7 @@ class StorageTextureValidationTests : public ValidationTest {
<< "[[access(" << access << ")]] " << imageTypeDeclaration << "<"
<< imageFormatQualifier
<< ">;\n"
"[[stage(compute)]] fn main() -> void {\n"
"[[stage(compute)]] fn main() {\n"
"}\n";
return ostream.str();
@ -124,7 +124,7 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
[[group(0), binding(0)]] var image0 : [[access(read)]] texture_storage_2d<rgba8unorm>;
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = textureLoad(image0, vec2<i32>(i32(VertexIndex), 0));
})");
@ -141,7 +141,7 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
[[group(0), binding(0)]] var image0 : [[access(read)]] texture_storage_2d<rgba8unorm>;
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = textureLoad(image0, vec2<i32>(FragCoord.xy));
})");
@ -157,7 +157,7 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[builtin(vertex_index)]] var<in> vertex_index : u32;
[[group(0), binding(0)]] var image0 : [[access(write)]] texture_storage_2d<rgba8unorm>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
textureStore(image0, vec2<i32>(i32(vertex_index), 0), vec4<f32>(1.0, 0.0, 0.0, 1.0));
})");
@ -173,7 +173,7 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[builtin(frag_coord)]] var<in> frag_coord : vec4<f32>;
[[group(0), binding(0)]] var image0 : [[access(write)]] texture_storage_2d<rgba8unorm>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
textureStore(image0, vec2<i32>(frag_coord.xy), vec4<f32>(1.0, 0.0, 0.0, 1.0));
})");
@ -199,7 +199,7 @@ TEST_F(StorageTextureValidationTests, ComputePipeline) {
};
[[group(0), binding(1)]] var<storage> buf : [[access(read_write)]] Buf;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
buf.data = textureLoad(image0, vec2<i32>(LocalInvocationID.xy)).x;
})");
@ -217,7 +217,7 @@ TEST_F(StorageTextureValidationTests, ComputePipeline) {
[[group(0), binding(0)]] var image0 : [[access(write)]] texture_storage_2d<rgba8unorm>;
[[builtin(local_invocation_id)]] var<in> LocalInvocationID : vec3<u32>;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
textureStore(image0, vec2<i32>(LocalInvocationID.xy), vec4<f32>(0.0, 0.0, 0.0, 0.0));
})");
@ -236,7 +236,7 @@ TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) {
{
ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var image0 : [[access(read_write)]] texture_storage_2d<rgba8unorm>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
})"));
}
@ -244,7 +244,7 @@ TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) {
{
ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var image0 : [[access(read_write)]] texture_storage_2d<rgba8unorm>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
})"));
}
@ -252,7 +252,7 @@ TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) {
{
ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var image0 : [[access(read_write)]] texture_storage_2d<rgba8unorm>;
[[stage(compute)]] fn main() -> void {
[[stage(compute)]] fn main() {
})"));
}
}

View File

@ -65,10 +65,8 @@ TEST_F(UnsafeAPIValidationTest, DrawIndexedIndirectDisallowed) {
bundleDesc.cColorFormats[0] = renderPass.attachmentFormat;
utils::ComboRenderPipelineDescriptor2 desc;
desc.vertex.module =
utils::CreateShaderModule(device, "[[stage(vertex)]] fn main() -> void {}");
desc.cFragment.module =
utils::CreateShaderModule(device, "[[stage(fragment)]] fn main() -> void {}");
desc.vertex.module = utils::CreateShaderModule(device, "[[stage(vertex)]] fn main() {}");
desc.cFragment.module = utils::CreateShaderModule(device, "[[stage(fragment)]] fn main() {}");
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
// Control cases: DrawIndirect and DrawIndexed are allowed inside a render pass.
@ -134,7 +132,7 @@ TEST_F(UnsafeAPIValidationTest, DispatchIndirectDisallowed) {
wgpu::ComputePipelineDescriptor pipelineDesc;
pipelineDesc.computeStage.entryPoint = "main";
pipelineDesc.computeStage.module =
utils::CreateShaderModule(device, "[[stage(compute)]] fn main() -> void {}");
utils::CreateShaderModule(device, "[[stage(compute)]] fn main() {}");
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
// Control case: dispatch is allowed.

View File

@ -27,7 +27,7 @@ class VertexBufferValidationTest : public ValidationTest {
fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");
}
@ -46,7 +46,7 @@ class VertexBufferValidationTest : public ValidationTest {
vs << "[[location(" << i << ")]] var<in> a_position" << i << " : vec3<f32>;\n";
}
vs << "[[builtin(position)]] var<out> Position : vec4<f32>;";
vs << "[[stage(vertex)]] fn main() -> void {\n";
vs << "[[stage(vertex)]] fn main() {\n";
vs << "Position = vec4<f32>(";
for (unsigned int i = 0; i < bufferCount; ++i) {

View File

@ -25,7 +25,7 @@ class VertexStateTest : public ValidationTest {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, vertexSource);
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
fragColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
}
)");
@ -46,7 +46,7 @@ class VertexStateTest : public ValidationTest {
const char* kDummyVertexShader = R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 0.0);
}
)";
@ -102,7 +102,7 @@ TEST_F(VertexStateTest, PipelineCompatibility) {
[[location(0)]] var<in> a : vec4<f32>;
[[location(1)]] var<in> b : vec4<f32>;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 0.0);
}
)");
@ -111,7 +111,7 @@ TEST_F(VertexStateTest, PipelineCompatibility) {
CreatePipeline(true, state, R"(
[[location(0)]] var<in> a : vec4<f32>;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 0.0);
}
)");
@ -120,7 +120,7 @@ TEST_F(VertexStateTest, PipelineCompatibility) {
CreatePipeline(false, state, R"(
[[location(2)]] var<in> a : vec4<f32>;
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 0.0);
}
)");

View File

@ -43,7 +43,7 @@ class D3D12DescriptorHeapTests : public DawnTest {
[[builtin(position)]] var<out> Position : vec4<f32>;
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, 1.0),
@ -59,7 +59,7 @@ class D3D12DescriptorHeapTests : public DawnTest {
[[group(0), binding(0)]] var<uniform> colorBuffer : U;
[[location(0)]] var<out> FragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
FragColor = colorBuffer.color;
})");
}
@ -453,7 +453,7 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBO) {
[[group(0), binding(0)]] var<uniform> buffer0 : U;
[[location(0)]] var<out> FragColor : f32;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
FragColor = buffer0.heapSize;
})");
@ -790,7 +790,7 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) {
[[builtin(position)]] var<out> Position : vec4<f32>;
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, 1.0),
@ -809,7 +809,7 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) {
[[location(0)]] var<out> FragColor : vec4<f32>;
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
FragColor = textureSample(texture0, sampler0, FragCoord.xy) + buffer0.color;
})");

View File

@ -342,7 +342,7 @@ TEST_P(D3D12DescriptorResidencyTests, SwitchedViewHeapResidency) {
[[builtin(position)]] var<out> Position : vec4<f32>;
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
[[stage(vertex)]] fn main() -> void {
[[stage(vertex)]] fn main() {
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, 1.0),
@ -358,7 +358,7 @@ TEST_P(D3D12DescriptorResidencyTests, SwitchedViewHeapResidency) {
[[group(0), binding(0)]] var<uniform> colorBuffer : U;
[[location(0)]] var<out> FragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
[[stage(fragment)]] fn main() {
FragColor = colorBuffer.color;
})");