#version 450
// One shader pack composite pass over the HDR image. The engine compiles
// it at run time with the pass's `#rusting composite 1` file as its hook.
layout(location = 0) out vec4 out_color;
// The chain color: the scene, or the last full-size pass's output.
layout(set = 0, binding = 0) uniform sampler2D chain;
layout(set = 0, binding = 1) uniform sampler2D scene_depth;
layout(set = 0, binding = 2) uniform sampler2DShadow shadow_map;
// The start of the scene shader's shadow buffer.
layout(set = 0, binding = 3) readonly buffer Shadow {
vec4 environment;
vec4 scene_color;
vec4 viewport;
vec4 probes[8];
mat4 inverse_view_projection;
vec4 fog;
vec4 fog_shape;
vec4 ambient_occlusion;
mat4 cascades[6];
vec4 cascade_far;
vec4 cascade_forward;
vec4 cascade_info;
} shadow;
layout(set = 0, binding = 4) uniform sampler2D history;
layout(set = 0, binding = 5) uniform sampler2D composite_targets[8];
// This pass's target: size in pixels, then one over it.
layout(push_constant) uniform Target {
vec4 size;
} target;
#include "frame.glsl"
#include "composite.glsl"
void main() {
vec2 uv = gl_FragCoord.xy * target.size.zw;
vec4 color = color_at(uv);
composite(
CompositeInput(uv, ivec2(gl_FragCoord.xy), target.size.zw, frame.time.x),
color
);
out_color = color;
}