Nugget
Loading...
Searching...
No Matches
raster-expected-phase15.h
Go to the documentation of this file.
1/*
2
3MIT License
4
5Copyright (c) 2026 PCSX-Redux authors
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software and associated documentation files (the "Software"), to deal
9in the Software without restriction, including without limitation the rights
10to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11copies of the Software, and to permit persons to whom the Software is
12furnished to do so, subject to the following conditions:
13
14The above copyright notice and this permission notice shall be included in all
15copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23SOFTWARE.
24
25*/
26
27#pragma once
28
29// Phase-15 expected values. Most mask×offset tests use inline
30// expectedClut8Color() predictions; the macros below cover the
31// semi-trans and bit-15-transparency interaction cases where hardware
32// truth gets locked in on first run.
33
34#include "raster-helpers.h"
35#include "texture-fixtures.h"
36
37// Window × semi-trans with bit-15=0 CLUT entries. Phase-8 polygon
38// finding said bit-15=0 -> no blend; phase-13 confirmed same for rect.
39// Texel sampled = CLUT8[0] = vram555(0, 31, 0) = 0x03e0 (windowed
40// from u=8 via mask_u=0x01).
41#define WS_WINDOW_SEMI_NO_BLEND 0x03e0u
42
43// HARDWARE FINDING (verified 2026-05-16): the bit-15 transparency
44// gate fires on the WINDOWED texel value, NOT the unfiltered raw u
45// value. Window collapses x=8 (and x=0) to filtered_u=0; CLUT8[0]
46// has bit-15 set in this test fixture, so the gate fires and ABR
47// blend applies. Output = blend of bg (red) and CLUT8[0] (now
48// transparent green) at ABR=0:
49// B = vram555(31, 0, 0), F = vram555(0, 31, 0) | 0x8000
50// B8 = (248, 0, 0), F8 = (0, 248, 0)
51// ABR=0: ((248+0)/2, (0+248)/2, 0) = (124, 124, 0) -> (R5=15, G5=15)
52// bit-15 propagated from texel -> output = 0x81ef
53// Same result at x=0 (the window collapses both to filtered_u=0).
54//
55// Implication: the soft renderer's textured rect path must apply
56// E2 windowing BEFORE the bit-15 transparency check. A renderer
57// that checks bit-15 on the raw u value would miss the gate firing
58// here (CLUT8[8] has bit-15=0, would skip blend) and produce wrong
59// output.
60#define WX_WINDOW_TRANS_ABR0 0x81efu /* gate fires on windowed CLUT8[0] */
61#define WX_WINDOW_TRANS_X0 0x81efu /* same value: x=0 windows to filtered=0 */
62
63// Out-of-fixture-range window tests. Filtered_u lands beyond the
64// 64-byte uploaded TEX8 region; hardware samples whatever VRAM
65// contains there. Locking in for regression - not a window-formula
66// finding, an artefact of the fixture upload size.
67#define WT_MASK0F_OFF0F_X0_HW 0x03e0u /* HW captured: reads 0 at u=120 */
68#define WT_MASK1F_OFF1F_X0_HW 0x007cu /* HW captured: reads 124 at u=248 */