mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-13 15:16:16 +00:00
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:
committed by
Commit Bot service account
parent
0008432827
commit
c56868420d
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user