mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-25 18:05:12 -04:00
1b778616b7
* feat(widescreen): continue framebuffer-feedback sprites into native-wide bands
Titles tag a 15-bit sprite that copies a framebuffer 1:1 (gpu_ws_tag_feedback_rect / psx_mod_tag_feedback_rect). Where it touches the draw area's edge, gpu.c emits band spans and the new optional backend op wide_feedback_rect (GL incl. render thread, software) samples the source buffer's wide surface. Band texels count as bit 15 set, as the centre does once the trail blends.
The software rasterizer now writes the texel's bit 15 into the framebuffer, and wide_full can dump the surface alpha ("alpha":1).
* fix(widescreen): quantise band feedback like packed VRAM
The centre samples 5-bit packed VRAM each frame; the band copy read the 8-bit wide surface and modulated with /128, so the bands drifted ~3 grey levels brighter and left a step at the 4:3 edge. Truncate like PACK_FS and modulate like TEX_FS.
* Reject fully clipped sprites before extending feedback margins
* Complete isolated resident and PGXP fixture collaborators
* Preserve existing line endings in the review fixes
---------
Co-authored-by: Matthew Stanley <1379tech@gmail.com>
39 lines
1.3 KiB
C
39 lines
1.3 KiB
C
#ifndef PSX_WS_FEEDBACK_RECT_H
|
|
#define PSX_WS_FEEDBACK_RECT_H
|
|
|
|
#include <stdint.h>
|
|
|
|
/* A title-tagged sprite that copies a framebuffer 1:1 (motion blur, trails)
|
|
* only covers the canonical columns. Each span below continues it into one
|
|
* native-wide band, sampling the source buffer's own band the same way. */
|
|
typedef struct {
|
|
int32_t dst_x;
|
|
int32_t src_x;
|
|
int32_t w;
|
|
} WsFeedbackSpan;
|
|
|
|
/* x/w: the sprite in VRAM X; src_x0: the source VRAM X drawn at x;
|
|
* left/width: the canonical draw area; margin: the band width. Writes the
|
|
* left band first; returns 0..2. */
|
|
static inline int ws_feedback_rect_spans(int32_t x, int32_t w, int32_t src_x0,
|
|
int32_t left, int32_t width,
|
|
int32_t margin, WsFeedbackSpan out[2]) {
|
|
if (w <= 0 || width <= 0 || margin <= 0) return 0;
|
|
int count = 0;
|
|
if (x <= left && x + w > left) {
|
|
out[count].dst_x = left - margin;
|
|
out[count].src_x = src_x0 + (left - margin - x);
|
|
out[count].w = margin;
|
|
count++;
|
|
}
|
|
if (x < left + width && x + w >= left + width) {
|
|
out[count].dst_x = left + width;
|
|
out[count].src_x = src_x0 + (left + width - x);
|
|
out[count].w = margin;
|
|
count++;
|
|
}
|
|
return count;
|
|
}
|
|
|
|
#endif
|