mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-21 16:59:12 +00:00
Splash screen rendering
This commit is contained in:
@@ -3,21 +3,21 @@ struct Uniforms {
|
||||
};
|
||||
|
||||
struct VertexInput {
|
||||
[[location(0)]] a_Pos: vec2<f32>;
|
||||
[[location(1)]] a_UV: vec2<f32>;
|
||||
[[location(2)]] a_Color: vec4<f32>;
|
||||
@location(0) a_Pos: vec2<f32>;
|
||||
@location(1) a_UV: vec2<f32>;
|
||||
@location(2) a_Color: vec4<f32>;
|
||||
};
|
||||
|
||||
struct VertexOutput {
|
||||
[[location(0)]] v_UV: vec2<f32>;
|
||||
[[location(1)]] v_Color: vec4<f32>;
|
||||
[[builtin(position)]] v_Position: vec4<f32>;
|
||||
@location(0) v_UV: vec2<f32>;
|
||||
@location(1) v_Color: vec4<f32>;
|
||||
@builtin(position) v_Position: vec4<f32>;
|
||||
};
|
||||
|
||||
[[group(0), binding(0)]]
|
||||
@group(0) @binding(0)
|
||||
var<uniform> uniforms: Uniforms;
|
||||
|
||||
[[stage(vertex)]]
|
||||
@stage(vertex)
|
||||
fn vs_main(in: VertexInput) -> VertexOutput {
|
||||
var out: VertexOutput;
|
||||
out.v_UV = in.a_UV;
|
||||
@@ -26,9 +26,9 @@ fn vs_main(in: VertexInput) -> VertexOutput {
|
||||
return out;
|
||||
}
|
||||
|
||||
[[group(1), binding(0)]]
|
||||
@group(1) @binding(0)
|
||||
var u_Texture: texture_2d<f32>;
|
||||
[[group(1), binding(1)]]
|
||||
@group(1) @binding(1)
|
||||
var u_Sampler: sampler;
|
||||
|
||||
fn srgb_to_linear(srgb: vec4<f32>) -> vec4<f32> {
|
||||
@@ -40,14 +40,14 @@ fn srgb_to_linear(srgb: vec4<f32>) -> vec4<f32> {
|
||||
return vec4<f32>(result, srgb.a);
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fs_main_linear(in: VertexOutput) -> [[location(0)]] vec4<f32> {
|
||||
@stage(fragment)
|
||||
fn fs_main_linear(in: VertexOutput) -> @location(0) vec4<f32> {
|
||||
let color = srgb_to_linear(in.v_Color);
|
||||
return color * textureSample(u_Texture, u_Sampler, in.v_UV);
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fs_main_srgb(in: VertexOutput) -> [[location(0)]] vec4<f32> {
|
||||
@stage(fragment)
|
||||
fn fs_main_srgb(in: VertexOutput) -> @location(0) vec4<f32> {
|
||||
let color = in.v_Color;
|
||||
return color * textureSample(u_Texture, u_Sampler, in.v_UV);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user