mirror of
https://github.com/exoticorn/microw8.git
synced 2026-01-20 11:16:42 +01:00
finish fast_crt shader
This commit is contained in:
@@ -29,7 +29,7 @@ fn sample_pixel(coords: vec2<i32>, offset: vec4<f32>) -> vec3<f32> {
|
|||||||
if(is_outside) {
|
if(is_outside) {
|
||||||
return vec3<f32>(0.0);
|
return vec3<f32>(0.0);
|
||||||
} else {
|
} else {
|
||||||
let f = max(vec4<f32>(0.01) / offset - vec4<f32>(0.003), vec4<f32>(0.0));
|
let f = max(vec4<f32>(0.008) / offset - vec4<f32>(0.0024), vec4<f32>(0.0));
|
||||||
return textureLoad(screen_texture, coords, 0).rgb * (f.x + f.y + f.z + f.w);
|
return textureLoad(screen_texture, coords, 0).rgb * (f.x + f.y + f.z + f.w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,11 @@ fn row_factor(offset: f32) -> f32 {
|
|||||||
return 1.0 / (1.0 + offset * offset * 16.0);
|
return 1.0 / (1.0 + offset * offset * 16.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn col_factor(offset: f32) -> f32 {
|
||||||
|
let offset = max(0.0, abs(offset) - 0.4);
|
||||||
|
return 1.0 / (1.0 + offset * offset * 16.0);
|
||||||
|
}
|
||||||
|
|
||||||
@fragment
|
@fragment
|
||||||
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
|
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
|
||||||
let base = round(in.tex_coords) - vec2<f32>(0.5);
|
let base = round(in.tex_coords) - vec2<f32>(0.5);
|
||||||
@@ -39,8 +44,11 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
|
|||||||
|
|
||||||
let v = base.y + bottom_factor / (bottom_factor + top_factor);
|
let v = base.y + bottom_factor / (bottom_factor + top_factor);
|
||||||
|
|
||||||
let u = in.tex_coords.x;
|
let left_factor = col_factor(frac.x);
|
||||||
|
let right_factor = col_factor(frac.x - 1.0);
|
||||||
|
|
||||||
return textureSample(screen_texture, linear_sampler, vec2<f32>(u, v) / vec2<f32>(320.0, 240.0)) * (top_factor + bottom_factor) * 2.0;
|
let u = base.x + right_factor / (right_factor + left_factor);
|
||||||
|
|
||||||
|
return textureSample(screen_texture, linear_sampler, vec2<f32>(u, v) / vec2<f32>(320.0, 240.0)) * (top_factor + bottom_factor) * (left_factor + right_factor) * 1.1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user