mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-18 06:09:30 -07:00
Updating WebGPU project to satisfy Chrome Canary
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
let ONE_OVER_SQRT_2PI = 0.39894;
|
||||
const ONE_OVER_SQRT_2PI = 0.39894;
|
||||
|
||||
struct Config {
|
||||
bloomRadius : f32,
|
||||
@@ -20,7 +20,7 @@ fn gaussianPDF(x : f32) -> f32 {
|
||||
) / config.bloomRadius;
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(32, 1, 1) fn computeMain(input : ComputeInput) {
|
||||
@compute @workgroup_size(32, 1, 1) fn computeMain(input : ComputeInput) {
|
||||
|
||||
var coord = vec2<i32>(input.id.xy);
|
||||
var outputSize = textureDimensions(outputTex);
|
||||
|
||||
@@ -19,7 +19,7 @@ struct ComputeInput {
|
||||
@builtin(global_invocation_id) id : vec3<u32>,
|
||||
};
|
||||
|
||||
@stage(compute) @workgroup_size(32, 1, 1) fn computeMain(input : ComputeInput) {
|
||||
@compute @workgroup_size(32, 1, 1) fn computeMain(input : ComputeInput) {
|
||||
|
||||
var coord = vec2<i32>(input.id.xy);
|
||||
var outputSize = textureDimensions(outputTex);
|
||||
|
||||
@@ -6,13 +6,13 @@ struct VertOutput {
|
||||
@location(0) uv : vec2<f32>,
|
||||
};
|
||||
|
||||
@stage(vertex) fn vertMain(@builtin(vertex_index) index : u32) -> VertOutput {
|
||||
@vertex fn vertMain(@builtin(vertex_index) index : u32) -> VertOutput {
|
||||
var uv = vec2<f32>(f32(index % 2u), f32((index + 1u) % 6u / 3u));
|
||||
var position = vec4<f32>(uv * 2.0 - 1.0, 1.0, 1.0);
|
||||
return VertOutput(position, uv);
|
||||
}
|
||||
|
||||
@stage(fragment) fn fragMain(input : VertOutput) -> @location(0) vec4<f32> {
|
||||
@fragment fn fragMain(input : VertOutput) -> @location(0) vec4<f32> {
|
||||
var uv = input.uv;
|
||||
uv.y = 1.0 - uv.y;
|
||||
return textureSample( tex, nearestSampler, uv );
|
||||
|
||||
@@ -19,7 +19,7 @@ fn getBrightness(uv : vec2<f32>) -> vec4<f32> {
|
||||
return min((primary + bloom) * (2.0 - config.bloomStrength), vec4<f32>(1.0));
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(32, 1, 1) fn computeMain(input : ComputeInput) {
|
||||
@compute @workgroup_size(32, 1, 1) fn computeMain(input : ComputeInput) {
|
||||
|
||||
// Resolve the invocation ID to a texel coordinate
|
||||
var coord = vec2<i32>(input.id.xy);
|
||||
|
||||
@@ -25,7 +25,7 @@ struct ComputeInput {
|
||||
@builtin(global_invocation_id) id : vec3<u32>,
|
||||
};
|
||||
|
||||
let PI : f32 = 3.14159265359;
|
||||
const PI : f32 = 3.14159265359;
|
||||
|
||||
fn randomFloat( uv : vec2<f32> ) -> f32 {
|
||||
let a = 12.9898;
|
||||
@@ -42,7 +42,7 @@ fn getBrightness(uv : vec2<f32>) -> vec4<f32> {
|
||||
return min((primary + bloom) * (2.0 - config.bloomStrength), vec4<f32>(1.0));
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(32, 1, 1) fn computeMain(input : ComputeInput) {
|
||||
@compute @workgroup_size(32, 1, 1) fn computeMain(input : ComputeInput) {
|
||||
|
||||
// Resolve the invocation ID to a texel coordinate
|
||||
var coord = vec2<i32>(input.id.xy);
|
||||
|
||||
@@ -96,11 +96,11 @@ struct FragOutput {
|
||||
|
||||
// Constants
|
||||
|
||||
let NUM_VERTICES_PER_QUAD : i32 = 6; // 2 * 3
|
||||
let PI : f32 = 3.14159265359;
|
||||
let TWO_PI : f32 = 6.28318530718;
|
||||
let SQRT_2 : f32 = 1.4142135623730951;
|
||||
let SQRT_5 : f32 = 2.23606797749979;
|
||||
const NUM_VERTICES_PER_QUAD : i32 = 6; // 2 * 3
|
||||
const PI : f32 = 3.14159265359;
|
||||
const TWO_PI : f32 = 6.28318530718;
|
||||
const SQRT_2 : f32 = 1.4142135623730951;
|
||||
const SQRT_5 : f32 = 2.23606797749979;
|
||||
|
||||
// Helper functions for generating randomness, borrowed from elsewhere
|
||||
|
||||
@@ -277,7 +277,7 @@ fn computeResult (isFirstFrame : bool, previousResult : vec4<f32>, glyphPos : ve
|
||||
return result;
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(32, 1, 1) fn computeMain(input : ComputeInput) {
|
||||
@compute @workgroup_size(32, 1, 1) fn computeMain(input : ComputeInput) {
|
||||
|
||||
// Resolve the invocation ID to a cell coordinate
|
||||
var row = i32(input.id.y);
|
||||
@@ -305,7 +305,7 @@ fn computeResult (isFirstFrame : bool, previousResult : vec4<f32>, glyphPos : ve
|
||||
// vec2<f32>(1.0, 1.0), vec2<f32>(0.0, 1.0), vec2<f32>(1.0, 0.0)
|
||||
// );
|
||||
|
||||
@stage(vertex) fn vertMain(input : VertInput) -> VertOutput {
|
||||
@vertex fn vertMain(input : VertInput) -> VertOutput {
|
||||
|
||||
var volumetric = bool(config.volumetric);
|
||||
|
||||
@@ -383,7 +383,7 @@ fn getSymbolUV(glyphCycle : f32) -> vec2<f32> {
|
||||
|
||||
// Fragment shader
|
||||
|
||||
@stage(fragment) fn fragMain(input : VertOutput) -> FragOutput {
|
||||
@fragment fn fragMain(input : VertOutput) -> FragOutput {
|
||||
|
||||
var volumetric = bool(config.volumetric);
|
||||
var uv = input.uv;
|
||||
|
||||
@@ -20,7 +20,7 @@ struct ComputeInput {
|
||||
@builtin(global_invocation_id) id : vec3<u32>,
|
||||
};
|
||||
|
||||
let PI : f32 = 3.14159265359;
|
||||
const PI : f32 = 3.14159265359;
|
||||
|
||||
fn randomFloat( uv : vec2<f32> ) -> f32 {
|
||||
let a = 12.9898;
|
||||
@@ -56,7 +56,7 @@ fn hslToRgb(h : f32, s : f32, l : f32) -> vec3<f32> {
|
||||
);
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(32, 1, 1) fn computeMain(input : ComputeInput) {
|
||||
@compute @workgroup_size(32, 1, 1) fn computeMain(input : ComputeInput) {
|
||||
|
||||
// Resolve the invocation ID to a texel coordinate
|
||||
var coord = vec2<i32>(input.id.xy);
|
||||
|
||||
@@ -21,7 +21,7 @@ struct ComputeInput {
|
||||
@builtin(global_invocation_id) id : vec3<u32>,
|
||||
};
|
||||
|
||||
let PI : f32 = 3.14159265359;
|
||||
const PI : f32 = 3.14159265359;
|
||||
|
||||
fn randomFloat( uv : vec2<f32> ) -> f32 {
|
||||
let a = 12.9898;
|
||||
@@ -38,7 +38,7 @@ fn getBrightness(uv : vec2<f32>) -> vec4<f32> {
|
||||
return min((primary + bloom) * (2.0 - config.bloomStrength), vec4<f32>(1.0));
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(32, 1, 1) fn computeMain(input : ComputeInput) {
|
||||
@compute @workgroup_size(32, 1, 1) fn computeMain(input : ComputeInput) {
|
||||
|
||||
// Resolve the invocation ID to a texel coordinate
|
||||
var coord = vec2<i32>(input.id.xy);
|
||||
|
||||
Reference in New Issue
Block a user