Skip to content

Commit

Permalink
render: Fix vertex shader positions
Browse files Browse the repository at this point in the history
  • Loading branch information
cookie-s committed Feb 8, 2025
1 parent 1744962 commit c272872
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions render/wgpu/shaders/blend/alpha.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ struct VertexOutput {

@vertex
fn main_vertex(in: common__VertexInput) -> VertexOutput {
let pos = common__globals.view_matrix * transforms.world_matrix * vec4<f32>(in.position.x, in.position.y, 1.0, 1.0);
let uv = vec2<f32>((pos.x + 1.0) / 2.0, -((pos.y - 1.0) / 2.0));
let pos = common__globals.view_matrix * transforms.world_matrix * vec4<f32>(in.position.x, in.position.y, 0.0, 1.0);
let uv = vec2<f32>(in.position.xy);
return VertexOutput(pos, uv);
}

Expand Down
4 changes: 2 additions & 2 deletions render/wgpu/shaders/blend/darken.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ struct VertexOutput {

@vertex
fn main_vertex(in: common__VertexInput) -> VertexOutput {
let pos = common__globals.view_matrix * transforms.world_matrix * vec4<f32>(in.position.x, in.position.y, 1.0, 1.0);
let uv = vec2<f32>((pos.x + 1.0) / 2.0, -((pos.y - 1.0) / 2.0));
let pos = common__globals.view_matrix * transforms.world_matrix * vec4<f32>(in.position.x, in.position.y, 0.0, 1.0);
let uv = vec2<f32>(in.position.xy);
return VertexOutput(pos, uv);
}

Expand Down
4 changes: 2 additions & 2 deletions render/wgpu/shaders/blend/difference.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ struct VertexOutput {

@vertex
fn main_vertex(in: common__VertexInput) -> VertexOutput {
let pos = common__globals.view_matrix * transforms.world_matrix * vec4<f32>(in.position.x, in.position.y, 1.0, 1.0);
let uv = vec2<f32>((pos.x + 1.0) / 2.0, -((pos.y - 1.0) / 2.0));
let pos = common__globals.view_matrix * transforms.world_matrix * vec4<f32>(in.position.x, in.position.y, 0.0, 1.0);
let uv = vec2<f32>(in.position.xy);
return VertexOutput(pos, uv);
}

Expand Down
4 changes: 2 additions & 2 deletions render/wgpu/shaders/blend/erase.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ struct VertexOutput {

@vertex
fn main_vertex(in: common__VertexInput) -> VertexOutput {
let pos = common__globals.view_matrix * transforms.world_matrix * vec4<f32>(in.position.x, in.position.y, 1.0, 1.0);
let uv = vec2<f32>((pos.x + 1.0) / 2.0, -((pos.y - 1.0) / 2.0));
let pos = common__globals.view_matrix * transforms.world_matrix * vec4<f32>(in.position.x, in.position.y, 0.0, 1.0);
let uv = vec2<f32>(in.position.xy);
return VertexOutput(pos, uv);
}

Expand Down
4 changes: 2 additions & 2 deletions render/wgpu/shaders/blend/hardlight.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ struct VertexOutput {

@vertex
fn main_vertex(in: common__VertexInput) -> VertexOutput {
let pos = common__globals.view_matrix * transforms.world_matrix * vec4<f32>(in.position.x, in.position.y, 1.0, 1.0);
let uv = vec2<f32>((pos.x + 1.0) / 2.0, -((pos.y - 1.0) / 2.0));
let pos = common__globals.view_matrix * transforms.world_matrix * vec4<f32>(in.position.x, in.position.y, 0.0, 1.0);
let uv = vec2<f32>(in.position.xy);
return VertexOutput(pos, uv);
}

Expand Down
4 changes: 2 additions & 2 deletions render/wgpu/shaders/blend/invert.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ struct VertexOutput {

@vertex
fn main_vertex(in: common__VertexInput) -> VertexOutput {
let pos = common__globals.view_matrix * transforms.world_matrix * vec4<f32>(in.position.x, in.position.y, 1.0, 1.0);
let uv = vec2<f32>((pos.x + 1.0) / 2.0, -((pos.y - 1.0) / 2.0));
let pos = common__globals.view_matrix * transforms.world_matrix * vec4<f32>(in.position.x, in.position.y, 0.0, 1.0);
let uv = vec2<f32>(in.position.xy);
return VertexOutput(pos, uv);
}

Expand Down
4 changes: 2 additions & 2 deletions render/wgpu/shaders/blend/lighten.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ struct VertexOutput {

@vertex
fn main_vertex(in: common__VertexInput) -> VertexOutput {
let pos = common__globals.view_matrix * transforms.world_matrix * vec4<f32>(in.position.x, in.position.y, 1.0, 1.0);
let uv = vec2<f32>((pos.x + 1.0) / 2.0, -((pos.y - 1.0) / 2.0));
let pos = common__globals.view_matrix * transforms.world_matrix * vec4<f32>(in.position.x, in.position.y, 0.0, 1.0);
let uv = vec2<f32>(in.position.xy);
return VertexOutput(pos, uv);
}

Expand Down
4 changes: 2 additions & 2 deletions render/wgpu/shaders/blend/multiply.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ struct VertexOutput {

@vertex
fn main_vertex(in: common__VertexInput) -> VertexOutput {
let pos = common__globals.view_matrix * transforms.world_matrix * vec4<f32>(in.position.x, in.position.y, 1.0, 1.0);
let uv = vec2<f32>((pos.x + 1.0) / 2.0, -((pos.y - 1.0) / 2.0));
let pos = common__globals.view_matrix * transforms.world_matrix * vec4<f32>(in.position.x, in.position.y, 0.0, 1.0);
let uv = vec2<f32>(in.position.xy);
return VertexOutput(pos, uv);
}

Expand Down
4 changes: 2 additions & 2 deletions render/wgpu/shaders/blend/overlay.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ struct VertexOutput {

@vertex
fn main_vertex(in: common__VertexInput) -> VertexOutput {
let pos = common__globals.view_matrix * transforms.world_matrix * vec4<f32>(in.position.x, in.position.y, 1.0, 1.0);
let uv = vec2<f32>((pos.x + 1.0) / 2.0, -((pos.y - 1.0) / 2.0));
let pos = common__globals.view_matrix * transforms.world_matrix * vec4<f32>(in.position.x, in.position.y, 0.0, 1.0);
let uv = vec2<f32>(in.position.xy);
return VertexOutput(pos, uv);
}

Expand Down

0 comments on commit c272872

Please sign in to comment.