mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-20 23:09:30 -07:00
The delimiter between WGSL struct fields is now a comma, which is also the delimiter between parameters in angle brackets, so gpu-buffer needs to be a little cleverer with the lines it separates.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
let ONE_OVER_SQRT_2PI = 0.39894;
|
||||
|
||||
struct Config {
|
||||
bloomRadius : f32;
|
||||
direction : vec2<f32>;
|
||||
bloomRadius : f32,
|
||||
direction : vec2<f32>,
|
||||
};
|
||||
|
||||
@group(0) @binding(0) var<uniform> config : Config;
|
||||
@@ -11,7 +11,7 @@ struct Config {
|
||||
@group(0) @binding(3) var outputTex : texture_storage_2d<rgba8unorm, write>;
|
||||
|
||||
struct ComputeInput {
|
||||
@builtin(global_invocation_id) id : vec3<u32>;
|
||||
@builtin(global_invocation_id) id : vec3<u32>,
|
||||
};
|
||||
|
||||
fn gaussianPDF(x : f32) -> f32 {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
struct Config {
|
||||
pyramidHeight : f32;
|
||||
pyramidHeight : f32,
|
||||
};
|
||||
|
||||
@group(0) @binding(0) var<uniform> config : Config;
|
||||
@@ -16,7 +16,7 @@ struct Config {
|
||||
@group(0) @binding(6) var outputTex : texture_storage_2d<rgba8unorm, write>;
|
||||
|
||||
struct ComputeInput {
|
||||
@builtin(global_invocation_id) id : vec3<u32>;
|
||||
@builtin(global_invocation_id) id : vec3<u32>,
|
||||
};
|
||||
|
||||
@stage(compute) @workgroup_size(32, 1, 1) fn computeMain(input : ComputeInput) {
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
@group(0) @binding(1) var tex : texture_2d<f32>;
|
||||
|
||||
struct VertOutput {
|
||||
@builtin(position) Position : vec4<f32>;
|
||||
@location(0) uv : vec2<f32>;
|
||||
@builtin(position) Position : vec4<f32>,
|
||||
@location(0) uv : vec2<f32>,
|
||||
};
|
||||
|
||||
@stage(vertex) fn vertMain(@builtin(vertex_index) index : u32) -> VertOutput {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
struct Config {
|
||||
bloomStrength : f32;
|
||||
bloomStrength : f32,
|
||||
};
|
||||
|
||||
@group(0) @binding(0) var<uniform> config : Config;
|
||||
@@ -10,7 +10,7 @@ struct Config {
|
||||
@group(0) @binding(5) var outputTex : texture_storage_2d<rgba8unorm, write>;
|
||||
|
||||
struct ComputeInput {
|
||||
@builtin(global_invocation_id) id : vec3<u32>;
|
||||
@builtin(global_invocation_id) id : vec3<u32>,
|
||||
};
|
||||
|
||||
fn getBrightness(uv : vec2<f32>) -> vec4<f32> {
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
struct Config {
|
||||
bloomStrength : f32;
|
||||
ditherMagnitude : f32;
|
||||
backgroundColor : vec3<f32>;
|
||||
bloomStrength : f32,
|
||||
ditherMagnitude : f32,
|
||||
backgroundColor : vec3<f32>,
|
||||
};
|
||||
|
||||
struct Palette {
|
||||
colors : array<vec3<f32>, 512>;
|
||||
colors : array<vec3<f32>, 512>,
|
||||
};
|
||||
|
||||
struct Time {
|
||||
seconds : f32;
|
||||
frames : i32;
|
||||
seconds : f32,
|
||||
frames : i32,
|
||||
};
|
||||
|
||||
@group(0) @binding(0) var<uniform> config : Config;
|
||||
@@ -22,7 +22,7 @@ struct Time {
|
||||
@group(0) @binding(6) var outputTex : texture_storage_2d<rgba8unorm, write>;
|
||||
|
||||
struct ComputeInput {
|
||||
@builtin(global_invocation_id) id : vec3<u32>;
|
||||
@builtin(global_invocation_id) id : vec3<u32>,
|
||||
};
|
||||
|
||||
let PI : f32 = 3.14159265359;
|
||||
|
||||
@@ -3,60 +3,60 @@
|
||||
|
||||
struct Config {
|
||||
// common properties used for compute and rendering
|
||||
animationSpeed : f32;
|
||||
glyphSequenceLength : i32;
|
||||
glyphTextureGridSize : vec2<i32>;
|
||||
glyphHeightToWidth : f32;
|
||||
resurrectingCodeRatio : f32;
|
||||
gridSize : vec2<f32>;
|
||||
showComputationTexture : i32;
|
||||
animationSpeed : f32,
|
||||
glyphSequenceLength : i32,
|
||||
glyphTextureGridSize : vec2<i32>,
|
||||
glyphHeightToWidth : f32,
|
||||
resurrectingCodeRatio : f32,
|
||||
gridSize : vec2<f32>,
|
||||
showComputationTexture : i32,
|
||||
|
||||
// compute-specific properties
|
||||
brightnessThreshold : f32;
|
||||
brightnessOverride : f32;
|
||||
brightnessDecay : f32;
|
||||
cursorEffectThreshold : f32;
|
||||
cycleSpeed : f32;
|
||||
cycleFrameSkip : i32;
|
||||
fallSpeed : f32;
|
||||
hasSun : i32;
|
||||
hasThunder : i32;
|
||||
raindropLength : f32;
|
||||
rippleScale : f32;
|
||||
rippleSpeed : f32;
|
||||
rippleThickness : f32;
|
||||
cycleStyle : i32;
|
||||
rippleType : i32;
|
||||
brightnessThreshold : f32,
|
||||
brightnessOverride : f32,
|
||||
brightnessDecay : f32,
|
||||
cursorEffectThreshold : f32,
|
||||
cycleSpeed : f32,
|
||||
cycleFrameSkip : i32,
|
||||
fallSpeed : f32,
|
||||
hasSun : i32,
|
||||
hasThunder : i32,
|
||||
raindropLength : f32,
|
||||
rippleScale : f32,
|
||||
rippleSpeed : f32,
|
||||
rippleThickness : f32,
|
||||
cycleStyle : i32,
|
||||
rippleType : i32,
|
||||
|
||||
// render-specific properties
|
||||
forwardSpeed : f32;
|
||||
glyphVerticalSpacing : f32;
|
||||
glyphEdgeCrop : f32;
|
||||
isPolar : i32;
|
||||
density : f32;
|
||||
slantScale : f32;
|
||||
slantVec : vec2<f32>;
|
||||
volumetric : i32;
|
||||
loops : i32;
|
||||
highPassThreshold : f32;
|
||||
forwardSpeed : f32,
|
||||
glyphVerticalSpacing : f32,
|
||||
glyphEdgeCrop : f32,
|
||||
isPolar : i32,
|
||||
density : f32,
|
||||
slantScale : f32,
|
||||
slantVec : vec2<f32>,
|
||||
volumetric : i32,
|
||||
loops : i32,
|
||||
highPassThreshold : f32,
|
||||
};
|
||||
|
||||
// The properties that change over time get their own buffer.
|
||||
struct Time {
|
||||
seconds : f32;
|
||||
frames : i32;
|
||||
seconds : f32,
|
||||
frames : i32,
|
||||
};
|
||||
|
||||
// The properties related to the size of the canvas get their own buffer.
|
||||
struct Scene {
|
||||
screenSize : vec2<f32>;
|
||||
camera : mat4x4<f32>;
|
||||
transform : mat4x4<f32>;
|
||||
screenSize : vec2<f32>,
|
||||
camera : mat4x4<f32>,
|
||||
transform : mat4x4<f32>,
|
||||
};
|
||||
|
||||
// The array of cells that the compute shader updates, and the fragment shader draws.
|
||||
struct CellData {
|
||||
cells: array<vec4<f32>>;
|
||||
cells: array<vec4<f32>>,
|
||||
};
|
||||
|
||||
// Shared bindings
|
||||
@@ -75,23 +75,23 @@ struct CellData {
|
||||
// Shader params
|
||||
|
||||
struct ComputeInput {
|
||||
@builtin(global_invocation_id) id : vec3<u32>;
|
||||
@builtin(global_invocation_id) id : vec3<u32>,
|
||||
};
|
||||
|
||||
struct VertInput {
|
||||
@builtin(vertex_index) index : u32;
|
||||
@builtin(vertex_index) index : u32,
|
||||
};
|
||||
|
||||
struct VertOutput {
|
||||
@builtin(position) Position : vec4<f32>;
|
||||
@location(0) uv : vec2<f32>;
|
||||
@location(1) channel : vec3<f32>;
|
||||
@location(2) glyph : vec4<f32>;
|
||||
@builtin(position) Position : vec4<f32>,
|
||||
@location(0) uv : vec2<f32>,
|
||||
@location(1) channel : vec3<f32>,
|
||||
@location(2) glyph : vec4<f32>,
|
||||
};
|
||||
|
||||
struct FragOutput {
|
||||
@location(0) color : vec4<f32>;
|
||||
@location(1) highPassColor : vec4<f32>;
|
||||
@location(0) color : vec4<f32>,
|
||||
@location(1) highPassColor : vec4<f32>,
|
||||
};
|
||||
|
||||
// Constants
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
struct Config {
|
||||
bloomStrength : f32;
|
||||
ditherMagnitude : f32;
|
||||
backgroundColor : vec3<f32>;
|
||||
bloomStrength : f32,
|
||||
ditherMagnitude : f32,
|
||||
backgroundColor : vec3<f32>,
|
||||
};
|
||||
|
||||
struct Time {
|
||||
seconds : f32;
|
||||
frames : i32;
|
||||
seconds : f32,
|
||||
frames : i32,
|
||||
};
|
||||
|
||||
@group(0) @binding(0) var<uniform> config : Config;
|
||||
@@ -17,7 +17,7 @@ struct Time {
|
||||
@group(0) @binding(5) var outputTex : texture_storage_2d<rgba8unorm, write>;
|
||||
|
||||
struct ComputeInput {
|
||||
@builtin(global_invocation_id) id : vec3<u32>;
|
||||
@builtin(global_invocation_id) id : vec3<u32>,
|
||||
};
|
||||
|
||||
let PI : f32 = 3.14159265359;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
struct Config {
|
||||
bloomStrength : f32;
|
||||
ditherMagnitude : f32;
|
||||
backgroundColor : vec3<f32>;
|
||||
bloomStrength : f32,
|
||||
ditherMagnitude : f32,
|
||||
backgroundColor : vec3<f32>,
|
||||
};
|
||||
|
||||
struct Time {
|
||||
seconds : f32;
|
||||
frames : i32;
|
||||
seconds : f32,
|
||||
frames : i32,
|
||||
};
|
||||
|
||||
@group(0) @binding(0) var<uniform> config : Config;
|
||||
@@ -18,7 +18,7 @@ struct Time {
|
||||
@group(0) @binding(6) var outputTex : texture_storage_2d<rgba8unorm, write>;
|
||||
|
||||
struct ComputeInput {
|
||||
@builtin(global_invocation_id) id : vec3<u32>;
|
||||
@builtin(global_invocation_id) id : vec3<u32>,
|
||||
};
|
||||
|
||||
let PI : f32 = 3.14159265359;
|
||||
|
||||
Reference in New Issue
Block a user