aboutsummaryrefslogtreecommitdiffstats
path: root/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'shaders')
-rw-r--r--shaders/compute.comp9
-rw-r--r--shaders/include/ray.h2
-rw-r--r--shaders/tonemapping.comp17
3 files changed, 5 insertions, 23 deletions
diff --git a/shaders/compute.comp b/shaders/compute.comp
index b5fcc17..e64448a 100644
--- a/shaders/compute.comp
+++ b/shaders/compute.comp
@@ -224,7 +224,7 @@ vec3 ray_color(ray r, uint seed) {
throughput *= sample_weight;
- r = ray(info.point, ray_dir, 0.001f, 1e15);
+ r = ray(info.point, 0.001f, ray_dir, 1e15);
// Russian Roulette
// As the throughput gets smaller, the ray is more likely to get terminated early.
@@ -240,8 +240,8 @@ vec3 ray_color(ray r, uint seed) {
}
ray generate_camera_ray(ivec2 coords, uint seed) {
- uint width = uint(regs.width_height & 0xff);
- uint height = uint(regs.width_height & 0xff00);
+ uint width = uint(regs.width_height & 0xffff);
+ uint height = uint(regs.width_height & 0xffff0000);
vec2 scene_size = vec2(width - 1, height - 1);
vec2 uv = vec2(coords.x / scene_size.x, 1.0 - coords.y / scene_size.y);
vec2 rand_disk = disk_vec(vec2(rand(seed), rand(seed)));
@@ -256,7 +256,7 @@ ray generate_camera_ray(ivec2 coords, uint seed) {
vec3 offset = lens_disk.x * regs.cam.right.xyz + lens_disk.y * regs.cam.up.xyz;
vec3 proj_plane_pos = regs.cam.first_pixel.xyz + jittered_uvs.x * regs.cam.horizontal.xyz + jittered_uvs.y * regs.cam.vertical.xyz;
- return ray(regs.cam.position.xyz + offset, proj_plane_pos.xyz - regs.cam.position.xyz - offset, 0.001f, 1e15);
+ return ray(regs.cam.position.xyz + offset, 0.001f, proj_plane_pos.xyz - regs.cam.position.xyz - offset, 1e15);
}
void main() {
@@ -265,7 +265,6 @@ void main() {
if (any(greaterThanEqual(gl_GlobalInvocationID.xy, uvec2(width, height))))
return;
- return;
int downscale_factor = int(regs.max_min_feat_downscale & 0xff000000);
ivec2 coords = ivec2(gl_GlobalInvocationID.xy) * downscale_factor;
diff --git a/shaders/include/ray.h b/shaders/include/ray.h
index 7a6cc21..6be711d 100644
--- a/shaders/include/ray.h
+++ b/shaders/include/ray.h
@@ -1,7 +1,7 @@
struct ray {
vec3 origin;
- vec3 direction;
float min_t;
+ vec3 direction;
float max_t;
};
diff --git a/shaders/tonemapping.comp b/shaders/tonemapping.comp
index ed30c92..bfe6e18 100644
--- a/shaders/tonemapping.comp
+++ b/shaders/tonemapping.comp
@@ -6,23 +6,6 @@ layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
layout(descriptor_heap, rgba32f) uniform image2D images[];
-struct camera {
- vec4 position;
-
- vec4 forward;
- vec4 up;
- vec4 right;
-
- vec4 horizontal;
- vec4 vertical;
- vec4 first_pixel;
-
- float lens_radius;
- float fov;
- float focus_distance;
- float aspect_ratio;
-};
-
layout(push_constant) uniform registers {
int downscale_factor;
uint output_image_index;