Use type inference in custom_shader WGSL (#334)

This commit is contained in:
Jay Oster 2023-01-28 11:00:51 -08:00 committed by GitHub
parent b54f707a59
commit c3f63a540d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,13 +24,13 @@ struct Locals {
} }
@group(0) @binding(2) var<uniform> r_locals: Locals; @group(0) @binding(2) var<uniform> r_locals: Locals;
const tau: f32 = 6.283185307179586476925286766559; const tau = 6.283185307179586476925286766559;
const bias: f32 = 0.2376; // Offset the circular time input so it is never 0 const bias = 0.2376; // Offset the circular time input so it is never 0
// Random functions based on https://thebookofshaders.com/10/ // Random functions based on https://thebookofshaders.com/10/
const random_scale: f32 = 43758.5453123; const random_scale = 43758.5453123;
const random_x: f32 = 12.9898; const random_x = 12.9898;
const random_y: f32 = 78.233; const random_y = 78.233;
fn random(x: f32) -> f32 { fn random(x: f32) -> f32 {
return fract(sin(x) * random_scale); return fract(sin(x) * random_scale);