MichelandMichel f277bd87e4 xBRZ freescale multipass: Resolve pass, corner fixes on by default (#583)
* xBRZ freescale multipass: xbrz-crisp line tests weigh hue a little more

With XBRZ_DIAG on, the shallow and steep line tests weigh hue a little
more than lightness (1.2x), so lines in hue-shifted shading follow the
artist's pixels. Plain xbrz-freescale-multipass doesn't change.

* xBRZ freescale multipass: xbrz-crisp keeps dark pixels and stripe tips

With XBRZ_DIAG on, a shallow or steep line is only blocked when it would
cut a pixel with a lighter color, so dark outlines, eyes and eyebrows keep
their pixels, and a blocked corner is still cut at the tip of a 1-pixel
diagonal stripe, so the stripe runs on to the edge. Plain
xbrz-freescale-multipass doesn't change.

* xBRZ freescale multipass: xbrz-crisp outlines, junctions and eyes

With XBRZ_DIAG on:
- a cut between two close inner tones runs up to a darker outline, which
  stays whole, except next to a corner the artist already rounded with an
  antialiasing pixel;
- a blocked corner whose blend color runs straight on, like a frame or a
  horizontal line, stays square, so lines do not bend where they meet;
- where two dark strokes of different colors meet in an L around a
  1-pixel light gap, like a pupil under an eyebrow, the corner stays
  square.

Plain xbrz-freescale-multipass doesn't change.

* xBRZ freescale multipass: xbrz-crisp diagonals up to a wall, light strokes

With XBRZ_DIAG on, a corner the diagonal rules left square comes back as
in xBRZ where the pixel's color runs on as a 45-degree diagonal up to a
straight line (hair, a fence post), and where a 1-pixel stroke lighter
than both colors runs on along the cut (the white strokes of letters).
Plain xbrz-freescale-multipass doesn't change.

* xBRZ freescale multipass: xbrz-crisp antialiasing steps and diagonal tips

With the xbrz-crisp rules on:
- a single antialiasing pixel stepping along a diagonal edge is rounded
  as in xBRZ (the shaded edge of a cape);
- the tip of a diagonal closes where the neighbour across its edge draws
  a line in the pixel's color, and a thin arm runs on to the next color;
- a line found only by the hue weighting is not drawn into the line of
  the neighbour across the same edge;
- a corner just below XBRZ_MINC (up to 4) is still rounded when both
  neighbours along its cut are, so diagonal edges have no teeth;
- a stripe only 3 pixels long is not a stripe end when the color past it
  runs straight on;
- when a line cuts one corner of an antialiasing pixel on a strong edge
  and XBRZ_MINC left the opposite corner square, that corner is cut too.

The first pass also does less work. Plain xbrz-freescale-multipass
doesn't change.

* xBRZ freescale multipass: number the rules, one section each

Code reorganization only, the output is the same with every setting.
The header lists the xbrz-crisp rules by number and each one has a
section of the same number and name in both passes; the blend decision
word is read and written through BLEND and FLAG macros.

* xBRZ freescale multipass: xbrz-crisp line shapes, stripe ends, outlines

With the xbrz-crisp rules on:
- the line shapes rule reads the right neighbour at the top-right and
  bottom-left corners, so mirrored art is drawn the same;
- a line xBRZ finds is kept, unless it would bring back a blocked corner
  or the line's color runs on along a 45-degree diagonal;
- the ends of 2-pixel stripes stay square like those of 1-pixel stripes
  (limit 36), and a line that turns diagonal at its end is not a stripe
  end;
- a pixel closed in a straight row between two near-black outline pixels
  is not pulled out of it (a brow between the black lines of an eye).

Plain xbrz-freescale-multipass doesn't change.

* xBRZ freescale multipass: xbrz-crisp fixes for faces under outlines

With the xbrz-crisp rules on, a pixel whose side neighbour is a close
tone of it is not a stripe end under an outline turning diagonal (a
forehead), and a line found only by the hue weighting is not drawn where
its far pixel is closer to the pixel's own color, or where its two colors
clearly differ and its color runs on along a 45-degree diagonal (a brow
and the tip of a nose). Plain xbrz-freescale-multipass doesn't change.

* xBRZ freescale multipass: lighter first pass, same image

The costly rule tests only run where they can change a corner, so the
first pass does less work. The output is the same with every setting.

* xBRZ freescale multipass: xbrz-crisp uses a minimum contrast of 20

The xbrz-crisp preset sets XBRZ_MINC to 20 instead of 24, so outlines
and faces are rounded a little more, while textures keep their pixels.

* xBRZ freescale multipass: resolve pass between the two passes

A new pass, once per input pixel, settles the decisions that depend on
the neighbours' decisions (chained diagonals, weak corners, lines that
meet), so the output pass only draws the corners. The first pass also
skips its rule tests where the center pixel equals a side neighbour at
every corner, since no corner can be cut there.

The image is the same with both presets. xbrz-crisp gets about 20% fewer
GPU instructions per frame. Both presets have one more pass.

* xBRZ freescale multipass: lines, closed shadows and tiles in xbrz-crisp

Three rules that read a 7x7 window, only on with the rules of xbrz-crisp
(plain xbrz-freescale-multipass doesn't change):

- A corner left square by XBRZ_MINC is still cut as in xBRZ where it lies
  on a straight line (45 degrees or 2:1, with regular steps) between two
  stripes that run on for 5 pixels or more, one of them 1 pixel wide
  against a strong contour, like an outline's antialiasing band or the
  stripes of a bar, so those lines have no teeth.
- Where a near-black shadow runs under an object, like the round shadow
  under a character's feet, the notch between them is closed, on any
  floor.
- In a row of 1-pixel tiles between two straight walls, like the squares
  of a gauge, a blocked corner between two tiles stays square.

* xBRZ freescale multipass: rules 2 and 4 to 7 on by default

XBRZ_DIAG now defaults to 100, so plain xbrz-freescale-multipass uses
rules 2 and 4 to 7: a junction of three colors is not pulled into a fake
diagonal, frame lines do not bend where they meet, and the ends of
1-pixel stripes (gauges, health bars) stay square. About 0.2% of the
output pixels change, and XBRZ_DIAG = 0 gives the old image.

Rules 3, 9, 10, 12 and 13 belong to the crisp look, so they now also
need XBRZ_MINC above 0, like rules 1, 8 and 11; xbrz-crisp doesn't
change. The header lists the rules by number, matching the sections in
the code.

* xBRZ freescale multipass: lighter passes, same image

The output pass picks the offset of each corner's blend color first and
reads one pixel instead of two. Rule 4 finds how far E's color runs along
the diagonal first, so the wall test past the run is compiled once instead
of three times. With XBRZ_MINC at 0 the line tests are plain xBRZ's and
rule 3 is skipped.

Both presets give the same image (0 pixels differ on 100 screens). GPU
instructions per frame (Mesa ir3, 8x8 blocks, 30 GBA screens at 6x):
plain xbrz-freescale-multipass 509 M -> 419 M (428 M before commit 1),
xbrz-crisp 471 M -> 432 M.

* xBRZ freescale multipass: shaded outlines in the xbrz-crisp eye rule

Rule 3 (eye) keeps a corner square where two dark strokes of different
colors meet in an L around a 1-pixel light gap, like a pupil under an
eyebrow. Where one stroke ends in the other's color, it is one outline
stepping through shades rather than two strokes, so that corner is now
cut as in xBRZ (the top of a tooth on the Dragon Ball Z: Buu's Fury title
screen, the planks of the Minish Cap fence). This is xBRZ Crisp 2.5.

xbrz-crisp: 0.0005% of the pixels change on 30 GBA screens, all of them
now as in xBRZ. Plain xbrz-freescale-multipass gives the same image, since
rule 3 is off with XBRZ_MINC at 0.

* xBRZ freescale multipass: plain pass 0 without the xbrz-crisp rules

RetroArch passes the parameters as uniforms, so with XBRZ_MINC at 0 the
first pass still compiled the crisp rules in: twice the code, and register
spills on Adreno. Plain xbrz-freescale-multipass now uses a pass 0 with
XBRZ_MINC fixed at 0, so those rules compile away; xbrz-crisp uses
xbrz-crisp-pass0, with every rule and XBRZ_MINC in the menu. The resolve
and output passes stay shared. Same image for both presets (0 pixels
differ); plain loses the XBRZ_MINC parameter.

* xBRZ freescale multipass: plain xBRZ keeps a pixel closed between outlines

Rule 10 now runs with XBRZ_DIAG instead of XBRZ_MINC: a pixel closed in a
straight row between two near-black outline pixels that also wrap the
corner, like the brow between the black lines of an eye, is not pulled out
of it by a line through the outline. 0.003% of the output pixels change
in plain xBRZ (XBRZ_DIAG = 0 still gives the old image); xbrz-crisp is
unchanged.

---------

Co-authored-by: Michel <[email protected]>
2026-11-07 22:45:55 -06:00
2025-08-17 08:59:39 -05:00
2025-02-26 16:12:14 -06:00
2025-06-06 14:31:28 -05:00
2023-05-17 19:54:31 -05:00
2023-10-13 13:37:07 -05:00
2025-01-23 22:19:22 +01:00
2019-06-03 10:07:29 -05:00
2024-12-23 15:49:25 -06:00
2019-06-03 10:07:29 -05:00
2022-04-17 05:21:54 +10:00
2020-01-22 15:21:27 -06:00
2023-09-30 08:39:31 -05:00
2022-04-17 05:21:54 +10:00
2022-04-17 05:21:54 +10:00
2023-05-17 19:54:31 -05:00
2019-06-03 10:07:29 -05:00
2018-10-25 22:30:12 -05:00
2019-06-03 10:07:29 -05:00
2023-05-17 19:54:31 -05:00
2023-05-17 19:54:31 -05:00
2026-08-30 11:19:07 -05:00
2019-06-03 10:07:29 -05:00
2020-12-22 10:17:43 +00:00
2017-07-24 22:00:20 -04:00
2019-06-25 16:22:11 -05:00
S
Description
This repo is for glsl shaders converted by hand from libretro's common-shaders repo, since some don't play nicely with the cg2glsl script.
66 MiB
0 Stars 1 Watchers 0 Forks
Languages
GLSL 91.7%
C 8.3%