Vulkan fixes

This commit is contained in:
luboslenco
2025-06-08 21:44:05 +02:00
parent 73fca805d2
commit f519a78359
15 changed files with 53 additions and 28 deletions
+1 -1
View File
@@ -60,7 +60,7 @@ fun bloom_downsample_pass_frag(input: vert_out): float4 {
contribution_factor /= max(epsilon, brightness);
color.rgb *= contribution_factor;
color.rgb = color.rgb * contribution_factor;
}
color.a = 1.0;
+9 -4
View File
@@ -59,7 +59,7 @@ fun deferred_light_vert(input: vert_in): vert_out {
// NDC (at the back of cube)
var v: float4 = float4(input.pos.xy, 1.0, 1.0);
v = constants.invVP * v;
v.xyz /= v.w;
v.xyz = v.xyz / v.w;
output.view_ray = v.xyz - constants.eye;
return output;
@@ -174,10 +174,15 @@ fun deferred_light_frag(input: vert_out): float4 {
var n: float3;
n.z = 1.0 - abs(g0.x) - abs(g0.y);
if (n.z >= 0.0) {
n.xy = g0.xy;
//n.xy = g0.xy;
n.x = g0.x;
n.y = g0.y;
}
else {
n.xy = octahedron_wrap(g0.xy);
//n.xy = octahedron_wrap(g0.xy);
var f2: float2 = octahedron_wrap(g0.xy);
n.x = f2.x;
n.y = f2.y;
}
n = normalize(n);
@@ -222,7 +227,7 @@ fun deferred_light_frag(input: vert_out): float4 {
//envl.rgb += prefiltered_color * (f0 * env_brdf.x + env_brdf.y) * 1.5;
envl.rgb = envl.rgb + (prefiltered_color * (f0 * env_brdf.x + env_brdf.y) * 1.5);
envl.rgb *= constants.envmap_data.w * occ;
envl.rgb = envl.rgb * constants.envmap_data.w * occ;
var color: float4;
color.rgb = envl.rgb;
+1 -1
View File
@@ -37,7 +37,7 @@ fun histogram_pass_frag(input: vert_out): float4 {
sample_lod(tex, sampler_linear, float2(0.8, 0.2), 0.0).rgb +
sample_lod(tex, sampler_linear, float2(0.2, 0.8), 0.0).rgb +
sample_lod(tex, sampler_linear, float2(0.8, 0.8), 0.0).rgb;
color.rgb /= 5.0;
color.rgb = color.rgb / 5.0;
return color;
}
+8 -3
View File
@@ -46,7 +46,7 @@ fun ssao_pass_vert(input: vert_in): vert_out {
fun get_projected_coord(hit_coord: float3): float2 {
var projected_coord: float4 = constants.P * float4(hit_coord, 1.0);
projected_coord.xy /= projected_coord.w;
projected_coord.xy = projected_coord.xy / projected_coord.w;
projected_coord.xy = projected_coord.xy * 0.5 + 0.5;
projected_coord.y = 1.0 - projected_coord.y;
return projected_coord.xy;
@@ -130,10 +130,15 @@ fun ssao_pass_frag(input: vert_out): float {
var n: float3;
n.z = 1.0 - abs(enc.x) - abs(enc.y);
if (n.z >= 0.0) {
n.xy = enc.xy;
//n.xy = enc.xy;
n.x = enc.x;
n.y = enc.y;
}
else {
n.xy = octahedron_wrap(enc.xy);
//n.xy = octahedron_wrap(enc.xy);
var f2: float2 = octahedron_wrap(enc.xy);
n.x = f2.x;
n.y = f2.y;
}
n = normalize(constants.V3 * n);