Convert WGSL comments to //
This CL updates the tests with WGSL sources to use // for comments instead of #. This matches the current WGSL spec. Change-Id: I04e1a18630a16b794955cace7e55a89221c964fe Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37520 Auto-Submit: dan sinclair <dsinclair@chromium.org> Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
22eff1eb8c
commit
e6ca254c72
|
@ -151,8 +151,7 @@ void initRender() {
|
|||
}
|
||||
|
||||
void initSim() {
|
||||
wgpu::ShaderModule module =
|
||||
utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[block]] struct Particle {
|
||||
[[offset(0)]] pos : vec2<f32>;
|
||||
[[offset(8)]] vel : vec2<f32>;
|
||||
|
@ -175,7 +174,7 @@ void initSim() {
|
|||
[[binding(2), set(0)]] var<storage_buffer> particlesB : [[access(read_write)]] Particles;
|
||||
[[builtin(global_invocation_id)]] var<in> GlobalInvocationID : vec3<u32>;
|
||||
|
||||
# https://github.com/austinEng/Project6-Vulkan-Flocking/blob/master/data/shaders/computeparticles/particle.comp
|
||||
// https://github.com/austinEng/Project6-Vulkan-Flocking/blob/master/data/shaders/computeparticles/particle.comp
|
||||
[[stage(compute)]]
|
||||
fn main() -> void {
|
||||
var index : u32 = GlobalInvocationID.x;
|
||||
|
@ -222,12 +221,12 @@ void initSim() {
|
|||
vVel = vVel + (cMass * params.rule1Scale) + (colVel * params.rule2Scale) +
|
||||
(cVel * params.rule3Scale);
|
||||
|
||||
# clamp velocity for a more pleasing simulation
|
||||
// clamp velocity for a more pleasing simulation
|
||||
vVel = normalize(vVel) * clamp(length(vVel), 0.0, 0.1);
|
||||
# kinematic update
|
||||
// kinematic update
|
||||
vPos = vPos + (vVel * params.deltaT);
|
||||
|
||||
# Wrap around boundary
|
||||
// Wrap around boundary
|
||||
if (vPos.x < -1.0) {
|
||||
vPos.x = 1.0;
|
||||
}
|
||||
|
@ -241,7 +240,7 @@ void initSim() {
|
|||
vPos.y = -1.0;
|
||||
}
|
||||
|
||||
# Write back
|
||||
// Write back
|
||||
particlesB.particles[index].pos = vPos;
|
||||
particlesB.particles[index].vel = vVel;
|
||||
return;
|
||||
|
|
|
@ -49,8 +49,8 @@ namespace dawn_native {
|
|||
[[stage(vertex)]] fn main() -> void {
|
||||
Position = vec4<f32>((texcoord[VertexIndex] * 2.0 - vec2<f32>(1.0, 1.0)), 0.0, 1.0);
|
||||
|
||||
# Texture coordinate takes top-left as origin point. We need to map the
|
||||
# texture to triangle carefully.
|
||||
// Texture coordinate takes top-left as origin point. We need to map the
|
||||
// texture to triangle carefully.
|
||||
v_texcoord = (texcoord[VertexIndex] * vec2<f32>(1.0, -1.0) + vec2<f32>(0.0, 1.0)) *
|
||||
uniforms.u_scale + uniforms.u_offset;
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ namespace dawn_native {
|
|||
[[location(0)]] var<in> v_texcoord : vec2<f32>;
|
||||
[[location(0)]] var<out> rgbaColor : vec4<f32>;
|
||||
[[stage(fragment)]] fn main() -> void {
|
||||
# Clamp the texcoord and discard the out-of-bound pixels.
|
||||
// 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));
|
||||
if (all(clampedTexcoord == v_texcoord)) {
|
||||
|
|
|
@ -157,7 +157,7 @@ TEST_P(BindGroupTests, ReusedUBO) {
|
|||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
# TODO(crbug.com/tint/369): Use a mat2x2 when Tint translates it correctly.
|
||||
// TODO(crbug.com/tint/369): Use a mat2x2 when Tint translates it correctly.
|
||||
[[block]] struct VertexUniformBuffer {
|
||||
[[offset(0)]] transform : vec4<f32>;
|
||||
};
|
||||
|
@ -245,7 +245,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
|
|||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
# TODO(crbug.com/tint/369): Use a mat2x2 when Tint translates it correctly.
|
||||
// TODO(crbug.com/tint/369): Use a mat2x2 when Tint translates it correctly.
|
||||
[[block]] struct VertexUniformBuffer {
|
||||
[[offset(0)]] transform : vec4<f32>;
|
||||
};
|
||||
|
@ -360,8 +360,8 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
|
|||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
# TODO(crbug.com/tint/369): Use a mat2x2 when Tint translates it correctly.
|
||||
# TODO(crbug.com/tint/386): Use the same struct.
|
||||
// TODO(crbug.com/tint/369): Use a mat2x2 when Tint translates it correctly.
|
||||
// TODO(crbug.com/tint/386): Use the same struct.
|
||||
[[block]] struct VertexUniformBuffer1 {
|
||||
[[offset(0)]] transform : vec4<f32>;
|
||||
};
|
||||
|
@ -370,7 +370,7 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
|
|||
[[offset(0)]] transform : vec4<f32>;
|
||||
};
|
||||
|
||||
# TODO(crbug.com/tint/386): Use the same struct definition.
|
||||
// TODO(crbug.com/tint/386): Use the same struct definition.
|
||||
[[set(0), binding(0)]] var <uniform> vertexUbo1 : VertexUniformBuffer1;
|
||||
[[set(1), binding(0)]] var <uniform> vertexUbo2 : VertexUniformBuffer2;
|
||||
|
||||
|
@ -390,7 +390,7 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
|
|||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
# TODO(crbug.com/tint/386): Use the same struct
|
||||
// TODO(crbug.com/tint/386): Use the same struct
|
||||
[[block]] struct FragmentUniformBuffer1 {
|
||||
[[offset(0)]] color : vec4<f32>;
|
||||
};
|
||||
|
@ -399,7 +399,7 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
|
|||
[[offset(0)]] color : vec4<f32>;
|
||||
};
|
||||
|
||||
# TODO(crbug.com/tint/386): Use the same struct definition.
|
||||
// TODO(crbug.com/tint/386): Use the same struct definition.
|
||||
[[set(0), binding(1)]] var <uniform> fragmentUbo1 : FragmentUniformBuffer1;
|
||||
[[set(1), binding(1)]] var <uniform> fragmentUbo2 : FragmentUniformBuffer2;
|
||||
|
||||
|
@ -846,7 +846,7 @@ TEST_P(BindGroupTests, DynamicOffsetOrder) {
|
|||
|
||||
wgpu::ComputePipelineDescriptor pipelineDescriptor;
|
||||
pipelineDescriptor.computeStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
# TODO(crbug.com/tint/386): Use the same struct
|
||||
// TODO(crbug.com/tint/386): Use the same struct
|
||||
[[block]] struct Buffer0 {
|
||||
[[offset(0)]] value : u32;
|
||||
};
|
||||
|
@ -974,7 +974,7 @@ TEST_P(BindGroupTests, ArbitraryBindingNumbers) {
|
|||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
# TODO(crbug.com/tint/386): Use the same struct
|
||||
// TODO(crbug.com/tint/386): Use the same struct
|
||||
[[block]] struct Ubo1 {
|
||||
[[offset(0)]] color : vec4<f32>;
|
||||
};
|
||||
|
@ -987,7 +987,7 @@ TEST_P(BindGroupTests, ArbitraryBindingNumbers) {
|
|||
[[offset(0)]] color : vec4<f32>;
|
||||
};
|
||||
|
||||
# TODO(crbug.com/tint/386): Use the same struct definition.
|
||||
// TODO(crbug.com/tint/386): Use the same struct definition.
|
||||
[[set(0), binding(953)]] var <uniform> ubo1 : Ubo1;
|
||||
[[set(0), binding(47)]] var <uniform> ubo2 : Ubo2;
|
||||
[[set(0), binding(111)]] var <uniform> ubo3 : Ubo3;
|
||||
|
|
|
@ -83,7 +83,7 @@ TEST_P(ComputeStorageBufferBarrierTests, AddPingPong) {
|
|||
device, data.data(), bufferSize, wgpu::BufferUsage::Storage | wgpu::BufferUsage::CopySrc);
|
||||
|
||||
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
# TODO(crbug.com/tint/386): Use the same struct.
|
||||
// TODO(crbug.com/tint/386): Use the same struct.
|
||||
[[block]] struct Src {
|
||||
[[offset(0)]] data : [[stride(4)]] array<u32, 100>;
|
||||
};
|
||||
|
@ -154,7 +154,7 @@ TEST_P(ComputeStorageBufferBarrierTests, StorageAndReadonlyStoragePingPongInOneP
|
|||
device, data.data(), bufferSize, wgpu::BufferUsage::Storage | wgpu::BufferUsage::CopySrc);
|
||||
|
||||
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
# TODO(crbug.com/tint/386): Use the same struct.
|
||||
// TODO(crbug.com/tint/386): Use the same struct.
|
||||
[[block]] struct Src {
|
||||
[[offset(0)]] data : [[stride(4)]] array<u32, 100>;
|
||||
};
|
||||
|
|
|
@ -108,7 +108,7 @@ class DynamicBufferOffsetTests : public DawnTest {
|
|||
std::ostringstream fs;
|
||||
std::string multipleNumber = isInheritedPipeline ? "2" : "1";
|
||||
fs << R"(
|
||||
# TODO(crbug.com/tint/386): Use the same struct.
|
||||
// TODO(crbug.com/tint/386): Use the same struct.
|
||||
[[block]] struct Buffer1 {
|
||||
[[offset(0)]] value : vec2<u32>;
|
||||
};
|
||||
|
@ -177,7 +177,7 @@ class DynamicBufferOffsetTests : public DawnTest {
|
|||
std::ostringstream cs;
|
||||
std::string multipleNumber = isInheritedPipeline ? "2" : "1";
|
||||
cs << R"(
|
||||
# TODO(crbug.com/tint/386): Use the same struct.
|
||||
// TODO(crbug.com/tint/386): Use the same struct.
|
||||
[[block]] struct Buffer1 {
|
||||
[[offset(0)]] value : vec2<u32>;
|
||||
};
|
||||
|
|
|
@ -468,7 +468,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) {
|
|||
};
|
||||
[[set(0), binding(1)]] var<storage_buffer> ibContents : [[access(read_write)]] IBContents;
|
||||
|
||||
# TODO(crbug.com/tint/386): Use the same struct.
|
||||
// TODO(crbug.com/tint/386): Use the same struct.
|
||||
[[block]] struct ColorContents1 {
|
||||
[[offset(0)]] color : f32;
|
||||
};
|
||||
|
|
|
@ -37,7 +37,7 @@ class IndexFormatTest : public DawnTest {
|
|||
[[builtin(vertex_idx)]] var<in> idx : u32;
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
[[stage(vertex)]] fn main() -> void {
|
||||
# 0xFFFFFFFE is a designated invalid index used by some tests.
|
||||
// 0xFFFFFFFE is a designated invalid index used by some tests.
|
||||
if (idx == 0xFFFFFFFEu) {
|
||||
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||
} else {
|
||||
|
|
|
@ -56,7 +56,7 @@ class OpArrayLengthTest : public DawnTest {
|
|||
// Common shader code to use these buffers in shaders, assuming they are in bindgroup index
|
||||
// 0.
|
||||
mShaderInterface = R"(
|
||||
# TODO(crbug.com/tint/386): Use the same struct.
|
||||
// TODO(crbug.com/tint/386): Use the same struct.
|
||||
[[block]] struct DataBuffer1 {
|
||||
[[offset(0)]] data : [[stride(4)]] array<f32>;
|
||||
};
|
||||
|
@ -65,14 +65,14 @@ class OpArrayLengthTest : public DawnTest {
|
|||
[[offset(0)]] data : [[stride(4)]] array<f32>;
|
||||
};
|
||||
|
||||
# The length should be 1 because the buffer is 4-byte long.
|
||||
// The length should be 1 because the buffer is 4-byte long.
|
||||
[[set(0), binding(0)]] var<storage_buffer> buffer1 : [[access(read)]] DataBuffer1;
|
||||
|
||||
# The length should be 64 because the buffer is 256 bytes long.
|
||||
// The length should be 64 because the buffer is 256 bytes long.
|
||||
[[set(0), binding(1)]] var<storage_buffer> buffer2 : [[access(read)]] DataBuffer2;
|
||||
|
||||
# The length should be (512 - 16*4) / 8 = 56 because the buffer is 512 bytes long
|
||||
# and the structure is 8 bytes big.
|
||||
// The length should be (512 - 16*4) / 8 = 56 because the buffer is 512 bytes long
|
||||
// and the structure is 8 bytes big.
|
||||
struct Buffer3Data {
|
||||
[[offset(0)]] a : f32;
|
||||
[[offset(4)]] b : i32;
|
||||
|
|
|
@ -37,10 +37,10 @@ class VertexBufferRobustnessTest : public DawnTest {
|
|||
|
||||
[[stage(vertex)]] fn main() -> void {
|
||||
if ()" + successExpression + R"() {
|
||||
# Success case, move the vertex out of the viewport
|
||||
// Success case, move the vertex out of the viewport
|
||||
Position = vec4<f32>(-10.0, 0.0, 0.0, 1.0);
|
||||
} else {
|
||||
# Failure case, move the vertex inside the viewport
|
||||
// Failure case, move the vertex inside the viewport
|
||||
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||
}
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue