mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-26 02:11:36 -04:00
74dadc6004
Post effects now run as chains of full-screen fragment passes on one executor (gl_postfx.inc), as asked in review. A chain is a small .pfx preset (postfx_chain.c, GL-free): passes with a shader (a file next to the preset or builtin:<name>), inputs (source, the optional primitive-derived mask, previous or a named earlier pass), a scale, format, filter and uniforms. The executor owns target allocation and lifetime, program build/cache, uniform binding (u_rcp, u_size, u_org) and GL state save/restore. Stages, in order, each from a fresh copy of the image: the built-in "bloom" chain ([video] bloom), a user chain ([video] post_shader / PSX_POST_SHADER, elective, off by default), and the built-in "fxaa"/"fxaa_hq" chain ([video] antialiasing_mode). FXAA folds in as a one-pass chain and its output is byte-identical to the former fixed pass; it still runs on real frames only. Generated (Smooth motion) frames run bloom and the user chain. The "may glow" mask is an optional pipeline input: draws keep stencil bit 1 only while an active chain reads `mask`, and the window-sized mask texture is built once per present for the chains that use it. Tests: postfx_chain_test (format, built-ins, errors, file import, no GL); gl_bloom_test gains an imported two-pass chain (byte-exact invert), the mask input (HUD unlit, 3D lit), a bad preset, a pass that does not compile, and GL state restored with bloom + a mask chain + FXAA on, all on the caller thread and the render thread. docs/POST_EFFECTS.md documents the format. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>