mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-26 02:11:36 -04:00
GL: opt-in bloom ([video] bloom), sourced from 3D and additive primitives only
[video] bloom = 0.0 (off, default) .. 2.0 adds a glow around lights on the
OpenGL backend. PSX_BLOOM overrides it for one run; {"cmd":"bloom"} reads or
changes strength, threshold and a debug view live. It is a plain [video] key,
so [quality.*] presets can switch it off on low-end machines.
The HUD never glows: with bloom on every textured and untextured draw is
followed by two stencil-only passes of the same vertices that keep a
"may glow" mark in stencil bit 1 (bit 0 stays the mask-bit mirror). Opaque
primitives clear it under their coverage, then PGXP-proven 3D primitives and
additive semi-transparent texels/primitives (modes 1 and 3) set it, painter
ordered like the colour; 3D and non-3D primitives never share a batch while
bloom is on. Semi-transparent primitives leave the mark alone and the PGXP
depth-clear pass (colour writes off) marks nothing. Without PGXP geometry only
additive primitives glow.
The pass runs on the composed game image before AA and the OSD: the presented
surface's marks are blitted into a quarter-resolution stencil, a soft-knee
bright pass runs under it, three separable Gaussian iterations spread it and a
screen blend adds it back. The marks follow the picture: native-wide centre
copies and Smooth motion surfaces (redraw and reprojection) copy stencil with
colour, and generated frames get the same pass. Off: nothing runs, no state
changes, and the composed frame is byte-identical to master.
test_gl_bloom (gl_bloom_test): off is byte-identical before/after bloom and
with --dump against master; on, a bright 2D panel and a panel over a lit 3D
polygon are byte-identical to off, an additive and a 3D polygon glow; guest
VRAM is unchanged; on this thread and on the render thread.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1229,6 +1229,7 @@ extern "C" EMSCRIPTEN_KEEPALIVE void psx_web_set_smooth_60fps(int enabled) {
|
||||
static int g_video_scale = 1; /* internal-resolution SSAA factor */
|
||||
static bool g_video_aa = true; /* linear present filtering */
|
||||
static int g_video_post_aa = 0; /* [video] antialiasing_mode / PSX_AA_MODE (GL_POST_AA_*) */
|
||||
static float g_video_bloom = 0.0f; /* [video] bloom (PSX_BLOOM overrides) */
|
||||
static int g_video_ss_milli = 1000; /* [video] supersample / PSX_SUPERSAMPLE */
|
||||
/* FMV present reconstruction (VIDEO_FMV_FILTER_*), pushed to the GL renderer
|
||||
* once the config is resolved. Only consulted while g_video_aa is on. */
|
||||
@@ -16332,6 +16333,7 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
g_video_aa = gc.runtime.video_antialiasing;
|
||||
g_video_post_aa = gc.runtime.video_antialiasing_mode;
|
||||
g_video_bloom = gc.runtime.video_bloom;
|
||||
g_video_ss_milli = gc.runtime.video_supersample_milli;
|
||||
g_video_texfilter = gc.runtime.video_texture_filter;
|
||||
g_video_fmv_filter = gc.runtime.video_fmv_filter;
|
||||
@@ -19114,6 +19116,7 @@ session_reboot:
|
||||
}
|
||||
gl_renderer_set_swap_interval(0);
|
||||
(void)gl_renderer_set_post_aa(g_video_post_aa);
|
||||
gl_renderer_set_bloom(g_video_bloom);
|
||||
g_gl_active = gl_renderer_init_context(s_headless_gl_window) != 0;
|
||||
if (!g_gl_active || gr_backend() != GR_BACKEND_OPENGL ||
|
||||
!(SDL_GetWindowFlags(s_headless_gl_window) & SDL_WINDOW_HIDDEN)) {
|
||||
@@ -19326,6 +19329,7 @@ session_reboot:
|
||||
gl_renderer_set_dynamic_resolution(
|
||||
((dynres_requested() || dbg_live_scale) && g_video_scale_applies) ? 1 : 0);
|
||||
(void)gl_renderer_set_post_aa(g_video_post_aa);
|
||||
gl_renderer_set_bloom(g_video_bloom);
|
||||
g_gl_active = (gl_renderer_init_context(sdl_window) != 0);
|
||||
dynres_setup();
|
||||
if (dbg_live_scale && g_gl_active) {
|
||||
|
||||
Reference in New Issue
Block a user