22 lines
936 B
GLSL
22 lines
936 B
GLSL
#version 450 core
|
|
|
|
// Fullscreen-triangle vertex shader for the backdrop downsample and H-blur sub-passes.
|
|
// Emits a single triangle covering NDC [-1,1]^2; the rasterizer clips edges outside.
|
|
// No vertex buffer; uses gl_VertexIndex to pick corners.
|
|
//
|
|
// The CPU sets the viewport (and matching scissor) per layer-bracket to limit work to
|
|
// the union AABB of the layer's backdrop primitives, expanded by 3*max_sigma and
|
|
// clamped to swapchain bounds. The fragment shader uses gl_FragCoord (absolute pixel
|
|
// space in the bound target) plus an inv-size uniform to compute its own UVs — see
|
|
// each fragment shader for the per-pass sampling math.
|
|
|
|
void main() {
|
|
// gl_VertexIndex 0 -> ( -1, -1)
|
|
// gl_VertexIndex 1 -> ( 3, -1)
|
|
// gl_VertexIndex 2 -> ( -1, 3)
|
|
vec2 ndc = vec2(
|
|
(gl_VertexIndex == 1) ? 3.0 : -1.0,
|
|
(gl_VertexIndex == 2) ? 3.0 : -1.0);
|
|
gl_Position = vec4(ndc, 0.0, 1.0);
|
|
}
|