Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c272872

Browse files
committedFeb 8, 2025··
render: Fix vertex shader positions
1 parent 1744962 commit c272872

9 files changed

+18
-18
lines changed
 

‎render/wgpu/shaders/blend/alpha.wgsl

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ struct VertexOutput {
1212

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

‎render/wgpu/shaders/blend/darken.wgsl

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ struct VertexOutput {
1212

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

‎render/wgpu/shaders/blend/difference.wgsl

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ struct VertexOutput {
1212

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

‎render/wgpu/shaders/blend/erase.wgsl

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ struct VertexOutput {
1212

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

‎render/wgpu/shaders/blend/hardlight.wgsl

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ struct VertexOutput {
1212

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

‎render/wgpu/shaders/blend/invert.wgsl

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ struct VertexOutput {
1212

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

‎render/wgpu/shaders/blend/lighten.wgsl

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ struct VertexOutput {
1212

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

‎render/wgpu/shaders/blend/multiply.wgsl

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ struct VertexOutput {
1212

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

‎render/wgpu/shaders/blend/overlay.wgsl

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ struct VertexOutput {
1212

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

0 commit comments

Comments
 (0)
Please sign in to comment.