libcamera: shaders: Extend bayer shaders to support swapping R and B on output

We can easily facilitate swapping R and B on output. Pivot on an
environment define for this purpose.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
This commit is contained in:
Bryan O'Donoghue 2025-06-04 16:51:16 +01:00
parent 4a9a1dff88
commit 6637b468b7
2 changed files with 9 additions and 1 deletions

View file

@ -268,5 +268,9 @@ void main(void)
rgb.b = texture2D(blue_param, vec2(rgb.b, 0.5)).b;
#endif
#if defined (SWAP_BLUE)
gl_FragColor = vec4(rgb.bgr, 1.0);
#else
gl_FragColor = vec4(rgb, 1.0);
#endif
}

View file

@ -163,5 +163,9 @@ void main(void) {
rgb.b = texture2D(red_param, vec2(rgb.b, 0.5)).b;
#endif
gl_FragColor.rgb = rgb;
#if defined (SWAP_BLUE)
gl_FragColor = vec4(rgb.bgr, 1.0);
#else
gl_FragColor = vec4(rgb, 1.0);
#endif
}