Cleaned up namespaces re: PR comments.

This commit is contained in:
bungoboingo 2022-10-18 15:18:37 -07:00
parent bb8d46a3fd
commit c4565759e4
13 changed files with 158 additions and 161 deletions

View file

@ -1,4 +1,4 @@
struct GradientUniforms {
struct Uniforms {
transform: mat4x4<f32>,
//xy = start, wz = end
position: vec4<f32>,
@ -12,7 +12,7 @@ struct Stop {
};
@group(0) @binding(0)
var<uniform> uniforms: GradientUniforms;
var<uniform> uniforms: Uniforms;
@group(0) @binding(1)
var<storage, read> color_stops: array<Stop>;
@ -33,7 +33,7 @@ fn vs_main(@location(0) input: vec2<f32>) -> VertexOutput {
//TODO: rewrite without branching
@fragment
fn fs_gradient(input: VertexOutput) -> @location(0) vec4<f32> {
fn fs_main(input: VertexOutput) -> @location(0) vec4<f32> {
let start = uniforms.position.xy;
let end = uniforms.position.zw;
let start_stop = uniforms.stop_range.x;

View file

@ -0,0 +1,17 @@
struct Uniforms {
transform: mat4x4<f32>,
color: vec4<f32>
}
@group(0) @binding(0)
var<uniform> uniforms: Uniforms;
@vertex
fn vs_main(@location(0) input: vec2<f32>) -> @builtin(position) vec4<f32> {
return uniforms.transform * vec4<f32>(input.xy, 0.0, 1.0);
}
@fragment
fn fs_main() -> @location(0) vec4<f32> {
return uniforms.color;
}

View file

@ -1,17 +0,0 @@
struct SolidUniforms {
transform: mat4x4<f32>,
color: vec4<f32>
}
@group(0) @binding(0)
var<uniform> solid_uniforms: SolidUniforms;
@vertex
fn vs_main(@location(0) input: vec2<f32>) -> @builtin(position) vec4<f32> {
return solid_uniforms.transform * vec4<f32>(input.xy, 0.0, 1.0);
}
@fragment
fn fs_solid() -> @location(0) vec4<f32> {
return solid_uniforms.color;
}