Migrate all tests over to using Default Struct Layout

The WGSL spec has been updated with 'Default Struct Layouts':
https://github.com/gpuweb/gpuweb/pull/1447

This removes the `[[offset(n)]]` decoration, and replaces it with two optional decorations: `[[size(n)]]` and `[[align(n)]]`, and a sensible set of sizes and alignments for each type.

Most `[[stride(n)]]` decorations have also been removed from arrays.

Bug: tint:626
Bug: tint:629
Change-Id: Ib0d2741f61ea943e6fb99d00cbb5cab2f97ae7be
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44280
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Ben Clayton 2021-03-17 09:48:19 +00:00 committed by Commit Bot service account
parent 0008432827
commit c56868420d
34 changed files with 168 additions and 169 deletions

View File

@ -151,21 +151,21 @@ void initRender() {
void initSim() {
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
struct Particle {
[[offset(0)]] pos : vec2<f32>;
[[offset(8)]] vel : vec2<f32>;
pos : vec2<f32>;
vel : vec2<f32>;
};
[[block]] struct SimParams {
[[offset(0)]] deltaT : f32;
[[offset(4)]] rule1Distance : f32;
[[offset(8)]] rule2Distance : f32;
[[offset(12)]] rule3Distance : f32;
[[offset(16)]] rule1Scale : f32;
[[offset(20)]] rule2Scale : f32;
[[offset(24)]] rule3Scale : f32;
[[offset(28)]] particleCount : u32;
deltaT : f32;
rule1Distance : f32;
rule2Distance : f32;
rule3Distance : f32;
rule1Scale : f32;
rule2Scale : f32;
rule3Scale : f32;
particleCount : u32;
};
[[block]] struct Particles {
[[offset(0)]] particles : [[stride(16)]] array<Particle>;
particles : array<Particle>;
};
[[binding(0), group(0)]] var<uniform> params : SimParams;
[[binding(1), group(0)]] var<storage_buffer> particlesA : [[access(read)]] Particles;

View File

@ -103,13 +103,13 @@ void init() {
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct Camera {
[[offset(0)]] view : mat4x4<f32>;
[[offset(64)]] proj : mat4x4<f32>;
view : mat4x4<f32>;
proj : mat4x4<f32>;
};
[[group(0), binding(0)]] var<uniform> camera : Camera;
[[block]] struct Model {
[[offset(0)]] matrix : mat4x4<f32>;
matrix : mat4x4<f32>;
};
[[group(0), binding(1)]] var<uniform> model : Model;

View File

@ -35,8 +35,8 @@ namespace dawn_native {
// TODO(shaobo.yan@intel.com) : Support premultiplay-alpha, flipY.
static const char sCopyTextureForBrowserVertex[] = R"(
[[block]] struct Uniforms {
[[offset(0)]] u_scale : vec2<f32>;
[[offset(8)]] u_offset : vec2<f32>;
u_scale : vec2<f32>;
u_offset : vec2<f32>;
};
const texcoord : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
vec2<f32>(-0.5, 0.0),

View File

@ -34,22 +34,22 @@ namespace dawn_native {
static const char sConvertTimestampsToNanoseconds[] = R"(
struct Timestamp {
[[offset(0)]] low : u32;
[[offset(4)]] high : u32;
low : u32;
high : u32;
};
[[block]] struct TimestampArr {
[[offset(0)]] t : [[stride(8)]] array<Timestamp>;
t : array<Timestamp>;
};
[[block]] struct AvailabilityArr {
[[offset(0)]] v : [[stride(4)]] array<u32>;
v : array<u32>;
};
[[block]] struct TimestampParams {
[[offset(0)]] count : u32;
[[offset(4)]] offset : u32;
[[offset(8)]] period : f32;
count : u32;
offset : u32;
period : f32;
};
[[group(0), binding(0)]]

View File

@ -67,7 +67,7 @@ class BindGroupTests : public DawnTest {
for (size_t i = 0; i < bindingTypes.size(); ++i) {
fs << "[[block]] struct Buffer" << i << R"( {
[[offset(0)]] color : vec4<f32>;
color : vec4<f32>;
};)";
switch (bindingTypes[i]) {
@ -121,7 +121,7 @@ class BindGroupTests : public DawnTest {
TEST_P(BindGroupTests, ReusedBindGroupSingleSubmit) {
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct Contents {
[[offset(0)]] f : f32;
f : f32;
};
[[group(0), binding(0)]] var <uniform> contents: Contents;
@ -155,7 +155,7 @@ TEST_P(BindGroupTests, ReusedUBO) {
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
// TODO(crbug.com/tint/369): Use a mat2x2 when Tint translates it correctly.
[[block]] struct VertexUniformBuffer {
[[offset(0)]] transform : vec4<f32>;
transform : vec4<f32>;
};
[[group(0), binding(0)]] var <uniform> vertexUbo : VertexUniformBuffer;
@ -177,7 +177,7 @@ TEST_P(BindGroupTests, ReusedUBO) {
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct FragmentUniformBuffer {
[[offset(0)]] color : vec4<f32>;
color : vec4<f32>;
};
[[group(0), binding(1)]] var <uniform> fragmentUbo : FragmentUniformBuffer;
@ -239,7 +239,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
// TODO(crbug.com/tint/369): Use a mat2x2 when Tint translates it correctly.
[[block]] struct VertexUniformBuffer {
[[offset(0)]] transform : vec4<f32>;
transform : vec4<f32>;
};
[[group(0), binding(0)]] var <uniform> vertexUbo : VertexUniformBuffer;
@ -349,11 +349,11 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
// 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>;
transform : vec4<f32>;
};
[[block]] struct VertexUniformBuffer2 {
[[offset(0)]] transform : vec4<f32>;
transform : vec4<f32>;
};
// TODO(crbug.com/tint/386): Use the same struct definition.
@ -378,11 +378,11 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
// TODO(crbug.com/tint/386): Use the same struct
[[block]] struct FragmentUniformBuffer1 {
[[offset(0)]] color : vec4<f32>;
color : vec4<f32>;
};
[[block]] struct FragmentUniformBuffer2 {
[[offset(0)]] color : vec4<f32>;
color : vec4<f32>;
};
// TODO(crbug.com/tint/386): Use the same struct definition.
@ -834,19 +834,19 @@ TEST_P(BindGroupTests, DynamicOffsetOrder) {
pipelineDescriptor.computeStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
// TODO(crbug.com/tint/386): Use the same struct
[[block]] struct Buffer0 {
[[offset(0)]] value : u32;
value : u32;
};
[[block]] struct Buffer2 {
[[offset(0)]] value : u32;
value : u32;
};
[[block]] struct Buffer3 {
[[offset(0)]] value : u32;
value : u32;
};
[[block]] struct OutputBuffer {
[[offset(0)]] value : vec3<u32>;
value : vec3<u32>;
};
[[group(0), binding(2)]] var<uniform> buffer2 : Buffer2;
@ -962,15 +962,15 @@ TEST_P(BindGroupTests, ArbitraryBindingNumbers) {
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
// TODO(crbug.com/tint/386): Use the same struct
[[block]] struct Ubo1 {
[[offset(0)]] color : vec4<f32>;
color : vec4<f32>;
};
[[block]] struct Ubo2 {
[[offset(0)]] color : vec4<f32>;
color : vec4<f32>;
};
[[block]] struct Ubo3 {
[[offset(0)]] color : vec4<f32>;
color : vec4<f32>;
};
// TODO(crbug.com/tint/386): Use the same struct definition.
@ -1117,7 +1117,7 @@ TEST_P(BindGroupTests, ReadonlyStorage) {
pipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct Buffer0 {
[[offset(0)]] color : vec4<f32>;
color : vec4<f32>;
};
[[group(0), binding(0)]] var<storage_buffer> buffer0 : [[access(read)]] Buffer0;
@ -1236,7 +1236,7 @@ TEST_P(BindGroupTests, ReallyLargeBindGroup) {
bgEntries.push_back({binding, buffer, 0, 4 * sizeof(uint32_t), nullptr, nullptr});
interface << "[[block]] struct UniformBuffer" << i << R"({
[[offset(0)]] value : u32;
value : u32;
};
)";
interface << "[[group(0), binding(" << binding++ << ")]] "
@ -1253,7 +1253,7 @@ TEST_P(BindGroupTests, ReallyLargeBindGroup) {
bgEntries.push_back({binding, buffer, 0, sizeof(uint32_t), nullptr, nullptr});
interface << "[[block]] struct ReadOnlyStorageBuffer" << i << R"({
[[offset(0)]] value : u32;
value : u32;
};
)";
interface << "[[group(0), binding(" << binding++ << ")]] "
@ -1270,7 +1270,7 @@ TEST_P(BindGroupTests, ReallyLargeBindGroup) {
bgEntries.push_back({binding, result, 0, sizeof(uint32_t), nullptr, nullptr});
interface << R"([[block]] struct ReadWriteStorageBuffer{
[[offset(0)]] value : u32;
value : u32;
};
)";
interface << "[[group(0), binding(" << binding++ << ")]] "

View File

@ -993,7 +993,7 @@ TEST_P(BufferZeroInitTest, BoundAsUniformBuffer) {
const char* computeShader = R"(
[[block]] struct UBO {
[[offset(0)]] value : vec4<u32>;
value : vec4<u32>;
};
[[group(0), binding(0)]] var<uniform> ubo : UBO;
[[group(0), binding(1)]] var outImage : [[access(write)]] texture_storage_2d<rgba8unorm>;
@ -1035,7 +1035,7 @@ TEST_P(BufferZeroInitTest, BoundAsReadonlyStorageBuffer) {
const char* computeShader = R"(
[[block]] struct SSBO {
[[offset(0)]] value : vec4<u32>;
value : vec4<u32>;
};
[[group(0), binding(0)]] var<storage> ssbo : SSBO;
[[group(0), binding(1)]] var outImage : [[access(write)]] texture_storage_2d<rgba8unorm>;

View File

@ -57,7 +57,7 @@ class ColorStateTest : public DawnTest {
void SetupSingleSourcePipelines(wgpu::ColorStateDescriptor colorStateDescriptor) {
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct MyBlock {
[[offset(0)]] color : vec4<f32>;
color : vec4<f32>;
};
[[group(0), binding(0)]] var<uniform> myUbo : MyBlock;
@ -771,10 +771,10 @@ TEST_P(ColorStateTest, IndependentColorState) {
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct MyBlock {
[[offset(0)]] color0 : vec4<f32>;
[[offset(16)]] color1 : vec4<f32>;
[[offset(32)]] color2 : vec4<f32>;
[[offset(48)]] color3 : vec4<f32>;
color0 : vec4<f32>;
color1 : vec4<f32>;
color2 : vec4<f32>;
color3 : vec4<f32>;
};
[[group(0), binding(0)]] var<uniform> myUbo : MyBlock;
@ -881,7 +881,7 @@ TEST_P(ColorStateTest, IndependentColorState) {
TEST_P(ColorStateTest, DefaultBlendColor) {
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct MyBlock {
[[offset(0)]] color : vec4<f32>;
color : vec4<f32>;
};
[[group(0), binding(0)]] var<uniform> myUbo : MyBlock;
@ -1004,7 +1004,7 @@ TEST_P(ColorStateTest, DefaultBlendColor) {
TEST_P(ColorStateTest, ColorWriteMaskDoesNotAffectRenderPassLoadOpClear) {
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct MyBlock {
[[offset(0)]] color : vec4<f32>;
color : vec4<f32>;
};
[[group(0), binding(0)]] var<uniform> myUbo : MyBlock;

View File

@ -89,10 +89,10 @@ void ComputeCopyStorageBufferTests::BasicTest(const char* shader) {
TEST_P(ComputeCopyStorageBufferTests, SizedArrayOfBasic) {
BasicTest(R"(
[[block]] struct Buf1 {
[[offset(0)]] s : [[stride(16)]] array<vec4<u32>, 4>;
s : array<vec4<u32>, 4>;
};
[[block]] struct Buf2 {
[[offset(0)]] s : [[stride(16)]] array<vec4<u32>, 4>;
s : array<vec4<u32>, 4>;
};
// TODO(crbug.com/tint/386): Use the same struct type
@ -112,15 +112,15 @@ TEST_P(ComputeCopyStorageBufferTests, SizedArrayOfBasic) {
TEST_P(ComputeCopyStorageBufferTests, SizedArrayOfStruct) {
BasicTest(R"(
struct S {
[[offset(0)]] a : vec2<u32>;
[[offset(8)]] b : vec2<u32>;
a : vec2<u32>;
b : vec2<u32>;
};
[[block]] struct Buf1 {
[[offset(0)]] s : [[stride(16)]] array<S, 4>;
s : array<S, 4>;
};
[[block]] struct Buf2 {
[[offset(0)]] s : [[stride(16)]] array<S, 4>;
s : array<S, 4>;
};
// TODO(crbug.com/tint/386): Use the same struct type
@ -140,10 +140,10 @@ TEST_P(ComputeCopyStorageBufferTests, SizedArrayOfStruct) {
TEST_P(ComputeCopyStorageBufferTests, UnsizedArrayOfBasic) {
BasicTest(R"(
[[block]] struct Buf1 {
[[offset(0)]] s : [[stride(16)]] array<vec4<u32>>;
s : array<vec4<u32>>;
};
[[block]] struct Buf2 {
[[offset(0)]] s : [[stride(16)]] array<vec4<u32>>;
s : array<vec4<u32>>;
};
// TODO(crbug.com/tint/386): Use the same struct type

View File

@ -30,10 +30,10 @@ class ComputeDispatchTests : public DawnTest {
// To make sure the dispatch was not called, write maximum u32 value for 0 dispatches
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct InputBuf {
[[offset(0)]] expectedDispatch : vec3<u32>;
expectedDispatch : vec3<u32>;
};
[[block]] struct OutputBuf {
[[offset(0)]] workGroups : vec3<u32>;
workGroups : vec3<u32>;
};
[[group(0), binding(0)]] var<uniform> input : InputBuf;

View File

@ -33,7 +33,7 @@ TEST_P(ComputeStorageBufferBarrierTests, AddIncrement) {
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct Buf {
[[offset(0)]] data : [[stride(4)]] array<u32, 100>;
data : array<u32, 100>;
};
[[group(0), binding(0)]] var<storage_buffer> buf : [[access(read_write)]] Buf;
@ -85,11 +85,11 @@ TEST_P(ComputeStorageBufferBarrierTests, AddPingPong) {
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
// TODO(crbug.com/tint/386): Use the same struct.
[[block]] struct Src {
[[offset(0)]] data : [[stride(4)]] array<u32, 100>;
data : array<u32, 100>;
};
[[block]] struct Dst {
[[offset(0)]] data : [[stride(4)]] array<u32, 100>;
data : array<u32, 100>;
};
[[group(0), binding(0)]] var<storage_buffer> src : [[access(read_write)]] Src;
@ -156,11 +156,11 @@ TEST_P(ComputeStorageBufferBarrierTests, StorageAndReadonlyStoragePingPongInOneP
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
// TODO(crbug.com/tint/386): Use the same struct.
[[block]] struct Src {
[[offset(0)]] data : [[stride(4)]] array<u32, 100>;
data : array<u32, 100>;
};
[[block]] struct Dst {
[[offset(0)]] data : [[stride(4)]] array<u32, 100>;
data : array<u32, 100>;
};
[[group(0), binding(0)]] var<storage_buffer> src : [[access(read)]] Src;
@ -229,7 +229,7 @@ TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPong) {
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct Buf {
[[offset(0)]] data : [[stride(16)]] array<vec4<u32>, 25>;
data : array<vec4<u32>, 25>;
};
[[group(0), binding(0)]] var<uniform> src : Buf;
@ -297,7 +297,7 @@ TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPongInOnePass) {
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct Buf {
[[offset(0)]] data : [[stride(16)]] array<vec4<u32>, 25>;
data : array<vec4<u32>, 25>;
};
[[group(0), binding(0)]] var<uniform> src : Buf;

View File

@ -73,10 +73,10 @@ class CopyTextureForBrowserTests : public DawnTest {
wgpu::ComputePipeline MakeTestPipeline() {
wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct Uniforms {
[[offset(0)]] dstTextureFlipY : u32;
dstTextureFlipY : u32;
};
[[block]] struct OutputBuf {
[[offset(0)]] result : [[stride(4)]] array<u32>;
result : array<u32>;
};
[[group(0), binding(0)]] var src : texture_2d<f32>;
[[group(0), binding(1)]] var dst : texture_2d<f32>;

View File

@ -36,7 +36,7 @@ TEST_P(CreatePipelineAsyncTest, BasicUseOfCreateComputePipelineAsync) {
wgpu::ComputePipelineDescriptor csDesc;
csDesc.computeStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct SSBO {
[[offset(0)]] value : u32;
value : u32;
};
[[group(0), binding(0)]] var<storage_buffer> ssbo : SSBO;
@ -103,7 +103,7 @@ TEST_P(CreatePipelineAsyncTest, CreateComputePipelineFailed) {
wgpu::ComputePipelineDescriptor csDesc;
csDesc.computeStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct SSBO {
[[offset(0)]] value : u32;
value : u32;
};
[[group(0), binding(0)]] var<storage_buffer> ssbo : SSBO;

View File

@ -227,7 +227,7 @@ TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPointsPerStage) {
TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPoints) {
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct Data {
[[offset(0)]] data : u32;
data : u32;
};
[[binding(0), group(0)]] var<storage_buffer> data : Data;

View File

@ -124,10 +124,10 @@ class DepthStencilSamplingTest : public DawnTest {
std::ostringstream shaderBody;
shaderSource << R"(
[[block]] struct DepthResult {
[[offset(0)]] value : f32;
value : f32;
};
[[block]] struct StencilResult {
[[offset(0)]] value : u32;
value : u32;
};)";
shaderSource << "\n";
@ -184,7 +184,7 @@ class DepthStencilSamplingTest : public DawnTest {
[[group(0), binding(0)]] var samp : sampler_comparison;
[[group(0), binding(1)]] var tex : texture_depth_2d;
[[block]] struct Uniforms {
[[offset(0)]] compareRef : f32;
compareRef : f32;
};
[[group(0), binding(2)]] var<uniform> uniforms : Uniforms;
@ -216,12 +216,12 @@ class DepthStencilSamplingTest : public DawnTest {
[[group(0), binding(0)]] var samp : sampler_comparison;
[[group(0), binding(1)]] var tex : texture_depth_2d;
[[block]] struct Uniforms {
[[offset(0)]] compareRef : f32;
compareRef : f32;
};
[[group(0), binding(2)]] var<uniform> uniforms : Uniforms;
[[block]] struct SamplerResult {
[[offset(0)]] value : f32;
value : f32;
};
[[group(0), binding(3)]] var<storage_buffer> samplerResult : SamplerResult;

View File

@ -54,8 +54,8 @@ class DepthStencilStateTest : public DawnTest {
vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct UBO {
[[offset(0)]] color : vec3<f32>;
[[offset(12)]] depth : f32;
color : vec3<f32>;
depth : f32;
};
[[group(0), binding(0)]] var<uniform> ubo : UBO;
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
@ -74,8 +74,8 @@ class DepthStencilStateTest : public DawnTest {
fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct UBO {
[[offset(0)]] color : vec3<f32>;
[[offset(12)]] depth : f32;
color : vec3<f32>;
depth : f32;
};
[[group(0), binding(0)]] var<uniform> ubo : UBO;

View File

@ -87,8 +87,7 @@ class DeviceLostTest : public DawnTest {
device.LoseForTesting();
}
static void MapFailCallback(WGPUBufferMapAsyncStatus status,
void* userdata) {
static void MapFailCallback(WGPUBufferMapAsyncStatus status, void* userdata) {
EXPECT_EQ(WGPUBufferMapAsyncStatus_DeviceLost, status);
EXPECT_EQ(&fakeUserData, userdata);
}
@ -127,7 +126,7 @@ TEST_P(DeviceLostTest, CreateBindGroupLayoutFails) {
TEST_P(DeviceLostTest, GetBindGroupLayoutFails) {
wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct UniformBuffer {
[[offset(0)]] pos : vec4<f32>;
pos : vec4<f32>;
};
[[group(0), binding(0)]] var<uniform> ubo : UniformBuffer;
[[stage(compute)]] fn main() -> void {

View File

@ -110,19 +110,19 @@ class DynamicBufferOffsetTests : public DawnTest {
fs << R"(
// TODO(crbug.com/tint/386): Use the same struct.
[[block]] struct Buffer1 {
[[offset(0)]] value : vec2<u32>;
value : vec2<u32>;
};
[[block]] struct Buffer2 {
[[offset(0)]] value : vec2<u32>;
value : vec2<u32>;
};
[[block]] struct Buffer3 {
[[offset(0)]] value : vec2<u32>;
value : vec2<u32>;
};
[[block]] struct Buffer4 {
[[offset(0)]] value : vec2<u32>;
value : vec2<u32>;
};
[[group(0), binding(0)]] var<uniform> uBufferNotDynamic : Buffer1;
@ -134,7 +134,7 @@ class DynamicBufferOffsetTests : public DawnTest {
if (isInheritedPipeline) {
fs << R"(
[[block]] struct Buffer5 {
[[offset(0)]] value : vec2<u32>;
value : vec2<u32>;
};
[[group(1), binding(0)]] var<uniform> paddingBlock : Buffer5;
@ -179,19 +179,19 @@ class DynamicBufferOffsetTests : public DawnTest {
cs << R"(
// TODO(crbug.com/tint/386): Use the same struct.
[[block]] struct Buffer1 {
[[offset(0)]] value : vec2<u32>;
value : vec2<u32>;
};
[[block]] struct Buffer2 {
[[offset(0)]] value : vec2<u32>;
value : vec2<u32>;
};
[[block]] struct Buffer3 {
[[offset(0)]] value : vec2<u32>;
value : vec2<u32>;
};
[[block]] struct Buffer4 {
[[offset(0)]] value : vec2<u32>;
value : vec2<u32>;
};
[[group(0), binding(0)]] var<uniform> uBufferNotDynamic : Buffer1;
@ -203,7 +203,7 @@ class DynamicBufferOffsetTests : public DawnTest {
if (isInheritedPipeline) {
cs << R"(
[[block]] struct Buffer5 {
[[offset(0)]] value : vec2<u32>;
value : vec2<u32>;
};
[[group(1), binding(0)]] var<uniform> paddingBlock : Buffer5;

View File

@ -72,7 +72,7 @@ TEST_P(EntryPointTests, TwoComputeInModule) {
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct Data {
[[offset(0)]] data : u32;
data : u32;
};
[[binding(0), group(0)]] var<storage_buffer> data : Data;

View File

@ -115,8 +115,8 @@ void FirstIndexOffsetTests::TestImpl(DrawMode mode,
[[stage(vertex)]] fn main() -> void {)";
fragmentShader << R"(
[[block]] struct IndexVals {
[[offset(0)]] vertex_index : u32;
[[offset(4)]] instance_index : u32;
vertex_index : u32;
instance_index : u32;
};
[[group(0), binding(0)]] var<storage_buffer> idx_vals : [[access(read_write)]] IndexVals;

View File

@ -37,7 +37,7 @@ class GpuMemorySyncTests : public DawnTest {
const wgpu::Buffer& buffer) {
wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct Data {
[[offset(0)]] a : i32;
a : i32;
};
[[group(0), binding(0)]] var<storage_buffer> data : [[access(read_write)]] Data;
[[stage(compute)]] fn main() -> void {
@ -65,7 +65,7 @@ class GpuMemorySyncTests : public DawnTest {
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct Data {
[[offset(0)]] i : i32;
i : i32;
};
[[group(0), binding(0)]] var<storage_buffer> data : [[access(read_write)]] Data;
[[location(0)]] var<out> fragColor : vec4<f32>;
@ -254,8 +254,8 @@ TEST_P(GpuMemorySyncTests, SampledAndROStorageTextureInComputePass) {
pipelineDesc.computeStage.entryPoint = "main";
pipelineDesc.computeStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct Output {
[[offset(0)]] sampledOut: u32;
[[offset(4)]] storageOut: u32;
sampledOut: u32;
storageOut: u32;
};
[[group(0), binding(0)]] var<storage_buffer> output : [[access(write)]] Output;
[[group(0), binding(1)]] var sampledTex : texture_2d<u32>;
@ -315,7 +315,7 @@ class StorageToUniformSyncTests : public DawnTest {
std::tuple<wgpu::ComputePipeline, wgpu::BindGroup> CreatePipelineAndBindGroupForCompute() {
wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct Data {
[[offset(0)]] a : f32;
a : f32;
};
[[group(0), binding(0)]] var<storage_buffer> data : [[access(read_write)]] Data;
[[stage(compute)]] fn main() -> void {
@ -342,7 +342,7 @@ class StorageToUniformSyncTests : public DawnTest {
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct Contents {
[[offset(0)]] color : f32;
color : f32;
};
[[group(0), binding(0)]] var<uniform> contents : Contents;
@ -514,21 +514,21 @@ TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) {
// Create pipeline, bind group, and different buffers for compute pass.
wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct VBContents {
[[offset(0)]] pos : [[stride(16)]] array<vec4<f32>, 4>;
pos : array<vec4<f32>, 4>;
};
[[group(0), binding(0)]] var<storage_buffer> vbContents : [[access(read_write)]] VBContents;
[[block]] struct IBContents {
[[offset(0)]] indices : [[stride(16)]] array<vec4<i32>, 2>;
indices : array<vec4<i32>, 2>;
};
[[group(0), binding(1)]] var<storage_buffer> ibContents : [[access(read_write)]] IBContents;
// TODO(crbug.com/tint/386): Use the same struct.
[[block]] struct ColorContents1 {
[[offset(0)]] color : f32;
color : f32;
};
[[block]] struct ColorContents2 {
[[offset(0)]] color : f32;
color : f32;
};
[[group(0), binding(2)]] var<storage_buffer> uniformContents : [[access(read_write)]] ColorContents1;
[[group(0), binding(3)]] var<storage_buffer> storageContents : [[access(read_write)]] ColorContents2;
@ -582,7 +582,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) {
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct Buf {
[[offset(0)]] color : f32;
color : f32;
};
[[group(0), binding(0)]] var<uniform> uniformBuffer : Buf;
@ -642,10 +642,10 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) {
// Create pipeline, bind group, and a complex buffer for compute pass.
wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct Contents {
[[offset(0)]] pos : [[stride(16)]] array<vec4<f32>, 4>;
[[offset(256)]] indices : [[stride(16)]] array<vec4<i32>, 2>;
[[offset(512)]] color0 : f32;
[[offset(768)]] color1 : f32;
[[align(256)]] pos : array<vec4<f32>, 4>;
[[align(256)]] indices : array<vec4<i32>, 2>;
[[align(256)]] color0 : f32;
[[align(256)]] color1 : f32;
};
[[group(0), binding(0)]] var<storage_buffer> contents : [[access(read_write)]] Contents;
@ -700,7 +700,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) {
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct Buf {
[[offset(0)]] color : f32;
color : f32;
};
[[group(0), binding(0)]] var<uniform> uniformBuffer : Buf;
[[group(0), binding(1)]] var<storage_buffer> storageBuffer : [[access(read)]] Buf;

View File

@ -94,8 +94,8 @@ class MultisampledSamplingTest : public DawnTest {
[[group(0), binding(1)]] var texture1 : texture_multisampled_2d<f32>;
[[block]] struct Results {
[[offset(0)]] colorSamples : [[stride(4)]] array<f32, 4>;
[[offset(16)]] depthSamples : [[stride(4)]] array<f32, 4>;
colorSamples : array<f32, 4>;
depthSamples : array<f32, 4>;
};
[[group(0), binding(2)]] var<storage_buffer> results : [[access(read_write)]] Results;

View File

@ -55,11 +55,11 @@ class OpArrayLengthTest : public DawnTest {
mShaderInterface = R"(
// TODO(crbug.com/tint/386): Use the same struct.
[[block]] struct DataBuffer1 {
[[offset(0)]] data : [[stride(4)]] array<f32>;
data : [[stride(4)]] array<f32>;
};
[[block]] struct DataBuffer2 {
[[offset(0)]] data : [[stride(4)]] array<f32>;
data : [[stride(4)]] array<f32>;
};
// The length should be 1 because the buffer is 4-byte long.
@ -71,13 +71,13 @@ class OpArrayLengthTest : public DawnTest {
// 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;
a : f32;
b : i32;
};
[[block]] struct Buffer3 {
[[offset(0)]] garbage : mat4x4<f32>;
[[offset(64)]] data : [[stride(8)]] array<Buffer3Data>;
[[size(64)]] garbage : mat4x4<f32>;
data : [[stride(8)]] array<Buffer3Data>;
};
[[group(0), binding(2)]] var<storage_buffer> buffer3 : [[access(read)]] Buffer3;
)";
@ -126,7 +126,7 @@ TEST_P(OpArrayLengthTest, Compute) {
pipelineDesc.computeStage.entryPoint = "main";
pipelineDesc.computeStage.module = utils::CreateShaderModuleFromWGSL(device, (R"(
[[block]] struct ResultBuffer {
[[offset(0)]] data : [[stride(4)]] array<u32, 3>;
data : [[stride(4)]] array<u32, 3>;
};
[[group(1), binding(0)]] var<storage_buffer> result : [[access(read_write)]] ResultBuffer;
)" + mShaderInterface + R"(

View File

@ -41,7 +41,7 @@ class RenderBundleTest : public DawnTest {
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[block]] struct Ubo {
[[offset(0)]] color : vec4<f32>;
color : vec4<f32>;
};
[[group(0), binding(0)]] var<uniform> fragmentUniformBuffer : Ubo;

View File

@ -39,7 +39,7 @@ class SamplerFilterAnisotropicTest : public DawnTest {
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct Uniforms {
[[offset(0)]] matrix : mat4x4<f32>;
matrix : mat4x4<f32>;
};
[[location(0)]] var<in> position : vec4<f32>;

View File

@ -32,7 +32,7 @@ TEST_P(ShaderTests, ComputeLog2) {
std::string shader = R"(
[[block]] struct Buf {
[[offset(0)]] data : [[stride(4)]] array<u32, 19>;
data : array<u32, 19>;
};
[[group(0), binding(0)]] var<storage_buffer> buf : [[access(read_write)]] Buf;

View File

@ -709,7 +709,7 @@ TEST_P(StorageTextureTests, ReadonlyStorageTextureInComputeShader) {
std::ostringstream csStream;
csStream << R"(
[[block]] struct DstBuffer {
[[offset(0)]] result : u32;
result : u32;
};
[[group(0), binding(1)]] var<storage_buffer> dstBuffer : DstBuffer;
@ -934,7 +934,7 @@ TEST_P(StorageTextureTests, Readonly2DArrayStorageTexture) {
std::ostringstream csStream;
csStream << R"(
[[block]] struct DstBuffer {
[[offset(0)]] result : u32;
result : u32;
};
[[group(0), binding(1)]] var<storage_buffer> dstBuffer : DstBuffer;
@ -1203,7 +1203,7 @@ TEST_P(StorageTextureZeroInitTests, ReadonlyStorageTextureClearsToZeroInComputeP
// to DstBuffer if they all have to expected value.
const std::string kComputeShader = std::string(R"(
[[block]] struct DstBuffer {
[[offset(0)]] result : u32;
result : u32;
};
[[group(0), binding(0)]] var srcImage : [[access(read)]] texture_storage_2d<r32uint>;

View File

@ -976,7 +976,7 @@ TEST_P(TextureZeroInitTest, ComputePassSampledTextureClear) {
const char* cs = R"(
[[group(0), binding(0)]] var tex : texture_2d<f32>;
[[block]] struct Result {
[[offset(0)]] value : vec4<f32>;
value : vec4<f32>;
};
[[group(0), binding(1)]] var<storage> result : Result;
[[stage(compute)]] fn main() -> void {

View File

@ -41,7 +41,7 @@ namespace {
constexpr char kFragmentShaderA[] = R"(
[[block]] struct Uniforms {
[[offset(0)]] color : vec3<f32>;
color : vec3<f32>;
};
[[group(0), binding(0)]] var<uniform> uniforms : Uniforms;
[[location(0)]] var<out> fragColor : vec4<f32>;
@ -51,10 +51,10 @@ namespace {
constexpr char kFragmentShaderB[] = R"(
[[block]] struct Constants {
[[offset(0)]] color : vec3<f32>;
color : vec3<f32>;
};
[[block]] struct Uniforms {
[[offset(0)]] color : vec3<f32>;
color : vec3<f32>;
};
[[group(0), binding(0)]] var<uniform> constants : Constants;
[[group(1), binding(0)]] var<uniform> uniforms : Uniforms;

View File

@ -1089,7 +1089,7 @@ class SetBindGroupValidationTest : public ValidationTest {
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct S {
[[offset(0)]] value : vec2<f32>;
value : vec2<f32>;
};
[[group(0), binding(0)]] var<uniform> uBufferDynamic : S;
@ -1112,7 +1112,7 @@ class SetBindGroupValidationTest : public ValidationTest {
wgpu::ComputePipeline CreateComputePipeline() {
wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct S {
[[offset(0)]] value : vec2<f32>;
value : vec2<f32>;
};
[[group(0), binding(0)]] var<uniform> uBufferDynamic : S;
@ -1532,7 +1532,7 @@ class SetBindGroupPersistenceValidationTest : public ValidationTest {
device.CreatePipelineLayout(&pipelineLayoutDescriptor);
std::stringstream ss;
ss << "[[block]] struct S { [[offset(0)]] value : vec2<f32>; };";
ss << "[[block]] struct S { value : vec2<f32>; };";
// Build a shader which has bindings that match the pipeline layout.
for (uint32_t l = 0; l < layouts.size(); ++l) {
@ -1708,7 +1708,7 @@ class BindGroupLayoutCompatibilityTest : public ValidationTest {
wgpu::RenderPipeline CreateRenderPipeline(std::vector<wgpu::BindGroupLayout> bindGroupLayouts) {
return CreateFSRenderPipeline(R"(
[[block]] struct S {
[[offset(0)]] value : vec2<f32>;
value : vec2<f32>;
};
[[group(0), binding(0)]] var<storage_buffer> sBufferDynamic : [[access(read_write)]] S;
@ -1741,7 +1741,7 @@ class BindGroupLayoutCompatibilityTest : public ValidationTest {
std::vector<wgpu::BindGroupLayout> bindGroupLayouts) {
return CreateComputePipeline(R"(
[[block]] struct S {
[[offset(0)]] value : vec2<f32>;
value : vec2<f32>;
};
[[group(0), binding(0)]] var<storage_buffer> sBufferDynamic : [[access(read_write)]] S;

View File

@ -45,7 +45,7 @@ TEST_F(GetBindGroupLayoutTests, SameObject) {
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct S {
[[offset(0)]] pos : vec4<f32>;
pos : vec4<f32>;
};
[[group(0), binding(0)]] var<uniform> uniform0 : S;
[[group(1), binding(0)]] var<uniform> uniform1 : S;
@ -55,12 +55,12 @@ TEST_F(GetBindGroupLayoutTests, SameObject) {
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct S2 {
[[offset(0)]] pos : vec4<f32>;
pos : vec4<f32>;
};
[[group(2), binding(0)]] var<uniform> uniform2 : S2;
[[block]] struct S3 {
[[offset(0)]] pos : mat4x4<f32>;
pos : mat4x4<f32>;
};
[[group(3), binding(0)]] var<storage_buffer> storage3 : S3;
@ -98,7 +98,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultShaderStageAndDynamicOffsets) {
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
[[block]] struct S {
[[offset(0)]] pos : vec4<f32>;
pos : vec4<f32>;
};
[[group(0), binding(0)]] var<uniform> uniforms : S;
@ -141,7 +141,7 @@ TEST_F(GetBindGroupLayoutTests, ComputePipeline) {
wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct S {
[[offset(0)]] pos : vec4<f32>;
pos : vec4<f32>;
};
[[group(0), binding(0)]] var<uniform> uniforms : S;
@ -192,7 +192,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
binding.buffer.type = wgpu::BufferBindingType::Storage;
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
[[block]] struct S {
[[offset(0)]] pos : vec4<f32>;
pos : vec4<f32>;
};
[[group(0), binding(0)]] var<storage_buffer> ssbo : S;
@ -204,7 +204,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
binding.buffer.type = wgpu::BufferBindingType::Uniform;
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
[[block]] struct S {
[[offset(0)]] pos : vec4<f32>;
pos : vec4<f32>;
};
[[group(0), binding(0)]] var<uniform> uniforms : S;
@ -217,7 +217,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
binding.buffer.type = wgpu::BufferBindingType::ReadOnlyStorage;
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
[[block]] struct S {
[[offset(0)]] pos : vec4<f32>;
pos : vec4<f32>;
};
[[group(0), binding(0)]] var<storage_buffer> ssbo : [[access(read)]] S;
@ -404,7 +404,7 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) {
binding.binding = 0;
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
[[block]] struct S {
[[offset(0)]] pos : vec4<f32>;
pos : vec4<f32>;
};
[[group(0), binding(0)]] var<uniform> uniforms : S;
@ -417,7 +417,7 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) {
binding.binding = 1;
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
[[block]] struct S {
[[offset(0)]] pos : vec4<f32>;
pos : vec4<f32>;
};
[[group(0), binding(1)]] var<uniform> uniforms : S;
@ -430,7 +430,7 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) {
binding.binding = 2;
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
[[block]] struct S {
[[offset(0)]] pos : vec4<f32>;
pos : vec4<f32>;
};
[[group(0), binding(1)]] var<uniform> uniforms : S;
@ -444,7 +444,7 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) {
TEST_F(GetBindGroupLayoutTests, DuplicateBinding) {
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct S {
[[offset(0)]] pos : vec4<f32>;
pos : vec4<f32>;
};
[[group(0), binding(0)]] var<uniform> uniform0 : S;
[[group(1), binding(0)]] var<uniform> uniform1 : S;
@ -454,7 +454,7 @@ TEST_F(GetBindGroupLayoutTests, DuplicateBinding) {
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct S {
[[offset(0)]] pos : vec4<f32>;
pos : vec4<f32>;
};
[[group(1), binding(0)]] var<uniform> uniforms : S;
@ -478,7 +478,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
wgpu::ShaderModule vsModule4 = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct S {
[[offset(0)]] pos : f32;
pos : f32;
};
[[group(0), binding(0)]] var<uniform> uniforms : S;
@ -487,7 +487,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
wgpu::ShaderModule vsModule64 = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct S {
[[offset(0)]] pos : mat4x4<f32>;
pos : mat4x4<f32>;
};
[[group(0), binding(0)]] var<uniform> uniforms : S;
@ -496,7 +496,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
wgpu::ShaderModule fsModule4 = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct S {
[[offset(0)]] pos : f32;
pos : f32;
};
[[group(0), binding(0)]] var<uniform> uniforms : S;
@ -505,7 +505,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
wgpu::ShaderModule fsModule64 = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct S {
[[offset(0)]] pos : mat4x4<f32>;
pos : mat4x4<f32>;
};
[[group(0), binding(0)]] var<uniform> uniforms : S;
@ -627,7 +627,7 @@ TEST_F(GetBindGroupLayoutTests, StageAggregation) {
TEST_F(GetBindGroupLayoutTests, ConflictingBindingType) {
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct S {
[[offset(0)]] pos : vec4<f32>;
pos : vec4<f32>;
};
[[group(0), binding(0)]] var<uniform> ubo : S;
@ -636,7 +636,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingType) {
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct S {
[[offset(0)]] pos : vec4<f32>;
pos : vec4<f32>;
};
[[group(0), binding(0)]] var<storage_buffer> ssbo : S;
@ -739,7 +739,7 @@ TEST_F(GetBindGroupLayoutTests, UnusedIndex) {
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
[[block]] struct S {
[[offset(0)]] pos : vec4<f32>;
pos : vec4<f32>;
};
[[group(0), binding(0)]] var<uniform> uniforms0 : S;
[[group(2), binding(0)]] var<uniform> uniforms2 : S;
@ -786,7 +786,7 @@ TEST_F(GetBindGroupLayoutTests, Reflection) {
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct S {
[[offset(0)]] pos : vec4<f32>;
pos : vec4<f32>;
};
[[group(0), binding(0)]] var<uniform> uniforms : S;
@ -825,7 +825,7 @@ TEST_F(GetBindGroupLayoutTests, Reflection) {
TEST_F(GetBindGroupLayoutTests, DISABLED_FromCorrectEntryPoint) {
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct Data {
[[offset 0]] data : f32;
data : f32;
};
[[binding 0, set 0]] var<storage_buffer> data0 : Data;
[[binding 1, set 0]] var<storage_buffer> data1 : Data;

View File

@ -31,7 +31,7 @@ namespace {
[[location(0)]] var<in> pos : vec2<f32>;
[[block]] struct S {
[[offset(0)]] transform : mat2x2<f32>;
transform : mat2x2<f32>;
};
[[group(0), binding(0)]] var<uniform> uniforms : S;
@ -40,12 +40,12 @@ namespace {
fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct Uniforms {
[[offset(0)]] color : vec4<f32>;
color : vec4<f32>;
};
[[group(1), binding(0)]] var<uniform> uniforms : Uniforms;
[[block]] struct Storage {
[[offset(0)]] dummy : [[stride(4)]] array<f32>;
dummy : array<f32>;
};
[[group(1), binding(1)]] var<storage_buffer> ssbo : [[access(read_write)]] Storage;

View File

@ -486,7 +486,7 @@ TEST_F(RenderPipelineValidationTest, TextureViewDimensionCompatibility) {
TEST_F(RenderPipelineValidationTest, StorageBufferInVertexShaderNoLayout) {
wgpu::ShaderModule vsModuleWithStorageBuffer = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct Dst {
[[offset(0)]] data : [[stride(4)]] array<u32, 100>;
data : array<u32, 100>;
};
[[group(0), binding(0)]] var<storage_buffer> dst : [[access(read_write)]] Dst;
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
@ -703,7 +703,7 @@ TEST_F(RenderPipelineValidationTest, DISABLED_BindingsFromCorrectEntryPoint) {
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct Uniforms {
[[offset 0]] data : vec4<f32>;
data : vec4<f32>;
};
[[binding 0, set 0]] var<uniform> var0 : Uniforms;
[[binding 1, set 0]] var<uniform> var1 : Uniforms;

View File

@ -777,7 +777,7 @@ namespace {
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct RBuffer {
[[offset(0)]] value : f32;
value : f32;
};
[[group(0), binding(0)]] var<storage_buffer> rBuffer : [[access(read)]] RBuffer;
[[stage(fragment)]] fn main() -> void {
@ -817,7 +817,7 @@ namespace {
// Create a passthrough compute pipeline with a readonly buffer
wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct RBuffer {
[[offset(0)]] value : f32;
value : f32;
};
[[group(0), binding(0)]] var<storage_buffer> rBuffer : [[access(read)]] RBuffer;
[[stage(compute)]] fn main() -> void {

View File

@ -195,7 +195,7 @@ TEST_F(StorageTextureValidationTests, ComputePipeline) {
[[builtin(local_invocation_id)]] var<in> LocalInvocationID : vec3<u32>;
[[block]] struct Buf {
[[offset(0)]] data : f32;
data : f32;
};
[[group(0), binding(1)]] var<storage_buffer> buf : [[access(read_write)]] Buf;