BPMemory: Make TevKSel more clear

It stores both the konst selection value for alpha and color channels (for two tev stages per ksel), and half of a swap table row (there are 4 total swap tables, which can be used for swizzling the rasterized color and the texture color, and indices selecting which tables to use are stored per tev stage in the alpha combiner).  Since these are indexed very differently, the old code was hard to follow.
This commit is contained in:
Pokechu22
2021-12-26 19:21:15 -08:00
parent f21798b9b6
commit 5ef8a7973e
6 changed files with 111 additions and 84 deletions

View File

@ -125,7 +125,7 @@ struct pixel_shader_uid_data
{
// TODO: Can save a lot space by removing the padding bits
u32 cc : 24;
u32 ac : 24; // tswap and rswap are left blank (encoded into the tevksel fields below)
u32 ac : 24; // tswap and rswap are left blank (decoded into the swap fields below)
u32 tevorders_texmap : 3;
u32 tevorders_texcoord : 3;
@ -133,18 +133,19 @@ struct pixel_shader_uid_data
RasColorChan tevorders_colorchan : 3;
u32 pad1 : 7;
// TODO: Clean up the swapXY mess
// TODO: We could save space by storing the 4 swap tables elsewhere and only storing references
// to which table is used (the tswap and rswap fields), instead of duplicating them here
u32 tevind : 21;
u32 tevksel_swap1a : 2;
u32 tevksel_swap2a : 2;
u32 tevksel_swap1b : 2;
u32 tevksel_swap2b : 2;
ColorChannel ras_swap_r : 2;
ColorChannel ras_swap_g : 2;
ColorChannel ras_swap_b : 2;
ColorChannel ras_swap_a : 2;
u32 pad2 : 2;
u32 tevksel_swap1c : 2;
u32 tevksel_swap2c : 2;
u32 tevksel_swap1d : 2;
u32 tevksel_swap2d : 2;
ColorChannel tex_swap_r : 2;
ColorChannel tex_swap_g : 2;
ColorChannel tex_swap_b : 2;
ColorChannel tex_swap_a : 2;
KonstSel tevksel_kc : 5;
KonstSel tevksel_ka : 5;
u32 pad3 : 14;