Nugget
Loading...
Searching...
No Matches
raster-expected-phase13.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-13 expected values. Most tests use expectedClut8Color() or
30// expectedTex15Color() inline; constants below are for the
31// semi-trans/mask cases where the value depends on hardware-specific
32// blend math.
33
34#include "raster-helpers.h"
35#include "texture-fixtures.h"
36
37// 15-bit semi-trans masked rect over red background (R5=31), F texel
38// = vram555(0, 0, 0)|0x8000 = 0x8000 (mask bit set, R/G/B = 0).
39// F8 channels: R=0, G=0, B=0. B8 channels: R=248, G=0, B=0.
40// All output pixels carry bit-15 due to texel-mask propagation.
41//
42// ABR=0: (248+0)/2=124 -> R5=15. Output = 0x000f | 0x8000 = 0x800f
43// ABR=1: 248+0=248 -> R5=31. Output = 0x001f | 0x8000 = 0x801f
44// ABR=2: 248-0=248 -> R5=31. Output = 0x001f | 0x8000 = 0x801f
45// ABR=3: 248+0=248 -> R5=31. Output = 0x001f | 0x8000 = 0x801f
46#define TR15_SEMI_ABR0_BLEND 0x800fu
47#define TR15_SEMI_ABR1_BLEND 0x801fu
48#define TR15_SEMI_ABR2_BLEND 0x801fu
49#define TR15_SEMI_ABR3_BLEND 0x801fu
50
51// 8-bit set-mask textured rect: CLUT8[0] = vram555(0, 31, 0) = 0x03e0.
52// E6 set-mask forces bit 15 on output -> 0x03e0 | 0x8000 = 0x83e0.
53#define TR8_SETMASK_OUTPUT 0x83e0u
54
55// 15-bit check-mask: pre-fill (R5=8) | 0x8000 survives = 0x0008 | 0x8000 = 0x8008.
56#define TR15_CHECKMASK_PREFILL 0x8008u