mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 15:22:15 +00:00
- removed all references to COL2RGB8 and RGB32k. Everything has now been transformed to RGB256k.
This commit is contained in:
parent
e2be28f925
commit
1e9d48216c
7 changed files with 8 additions and 95 deletions
|
@ -346,8 +346,6 @@ bool wipe_doFade (int ticks)
|
|||
{
|
||||
int x, y;
|
||||
int bglevel = 64 - fade;
|
||||
DWORD *fg2rgb = Col2RGB8[fade];
|
||||
DWORD *bg2rgb = Col2RGB8[bglevel];
|
||||
BYTE *fromnew = (BYTE *)wipe_scr_end;
|
||||
BYTE *fromold = (BYTE *)wipe_scr_start;
|
||||
BYTE *to = screen->GetBuffer();
|
||||
|
|
|
@ -238,22 +238,16 @@ namespace swrenderer
|
|||
}
|
||||
if (flags & STYLEF_InvertSource)
|
||||
{
|
||||
dc_srcblend = Col2RGB8_Inverse[fglevel >> 10];
|
||||
dc_destblend = Col2RGB8_LessPrecision[bglevel >> 10];
|
||||
dc_srcalpha = fglevel;
|
||||
dc_destalpha = bglevel;
|
||||
}
|
||||
else if (op == STYLEOP_Add && fglevel + bglevel <= FRACUNIT)
|
||||
{
|
||||
dc_srcblend = Col2RGB8[fglevel >> 10];
|
||||
dc_destblend = Col2RGB8[bglevel >> 10];
|
||||
dc_srcalpha = fglevel;
|
||||
dc_destalpha = bglevel;
|
||||
}
|
||||
else
|
||||
{
|
||||
dc_srcblend = Col2RGB8_LessPrecision[fglevel >> 10];
|
||||
dc_destblend = Col2RGB8_LessPrecision[bglevel >> 10];
|
||||
dc_srcalpha = fglevel;
|
||||
dc_destalpha = bglevel;
|
||||
}
|
||||
|
|
|
@ -1455,7 +1455,6 @@ namespace swrenderer
|
|||
|
||||
const uint8_t *source = _source;
|
||||
const uint8_t *colormap = _colormap;
|
||||
uint32_t *fgstart = &Col2RGB8[0][_color];
|
||||
|
||||
const PalEntry *palette = GPalette.BaseColors;
|
||||
|
||||
|
|
|
@ -508,7 +508,6 @@ namespace swrenderer
|
|||
if (count <= 0)
|
||||
return;
|
||||
|
||||
fgstart = &Col2RGB8[0][_color];
|
||||
colormap = _colormap;
|
||||
dest = ylookup[yl + thread->skipped_by_thread(yl)] + sx + _destorg;
|
||||
source = &thread->dc_temp[thread->temp_line_for_thread(yl)*4 + hx];
|
||||
|
@ -539,7 +538,6 @@ namespace swrenderer
|
|||
if (count <= 0)
|
||||
return;
|
||||
|
||||
fgstart = &Col2RGB8[0][_color];
|
||||
colormap = _colormap;
|
||||
dest = ylookup[yl + thread->skipped_by_thread(yl)] + sx + _destorg;
|
||||
source = &thread->dc_temp[thread->temp_line_for_thread(yl)*4];
|
||||
|
|
|
@ -1500,14 +1500,14 @@ void R_DrawNormalPlane (visplane_t *pl, double _xscale, double _yscale, fixed_t
|
|||
if (!additive)
|
||||
{
|
||||
spanfunc = R_DrawSpanMaskedTranslucent;
|
||||
dc_srcblend = Col2RGB8[alpha>>10];
|
||||
dc_destblend = Col2RGB8[(OPAQUE-alpha)>>10];
|
||||
dc_srcalpha = alpha;
|
||||
dc_destalpha = OPAQUE-alpha;
|
||||
}
|
||||
else
|
||||
{
|
||||
spanfunc = R_DrawSpanMaskedAddClamp;
|
||||
dc_srcblend = Col2RGB8_LessPrecision[alpha>>10];
|
||||
dc_destblend = Col2RGB8_LessPrecision[FRACUNIT>>10];
|
||||
dc_srcalpha = alpha;
|
||||
dc_destalpha = FRACUNIT;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1522,14 +1522,14 @@ void R_DrawNormalPlane (visplane_t *pl, double _xscale, double _yscale, fixed_t
|
|||
if (!additive)
|
||||
{
|
||||
spanfunc = R_DrawSpanTranslucent;
|
||||
dc_srcblend = Col2RGB8[alpha>>10];
|
||||
dc_destblend = Col2RGB8[(OPAQUE-alpha)>>10];
|
||||
dc_srcalpha = alpha;
|
||||
dc_destalpha = OPAQUE-alpha;
|
||||
}
|
||||
else
|
||||
{
|
||||
spanfunc = R_DrawSpanAddClamp;
|
||||
dc_srcblend = Col2RGB8_LessPrecision[alpha>>10];
|
||||
dc_destblend = Col2RGB8_LessPrecision[FRACUNIT>>10];
|
||||
dc_srcalpha = alpha;
|
||||
dc_destalpha = OPAQUE-alpha;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -143,7 +143,6 @@ extern "C" {
|
|||
DWORD Col2RGB8[65][256];
|
||||
DWORD *Col2RGB8_LessPrecision[65];
|
||||
DWORD Col2RGB8_Inverse[65][256];
|
||||
ColorTable32k RGB32k;
|
||||
ColorTable256k RGB256k;
|
||||
}
|
||||
|
||||
|
@ -659,48 +658,12 @@ static void BuildTransTable (const PalEntry *palette)
|
|||
{
|
||||
int r, g, b;
|
||||
|
||||
// create the RGB555 lookup table
|
||||
for (r = 0; r < 32; r++)
|
||||
for (g = 0; g < 32; g++)
|
||||
for (b = 0; b < 32; b++)
|
||||
//RGB32k.RGB[r][g][b] = ColorMatcher.Pick ((r<<3)|(r>>2), (g<<3)|(g>>2), (b<<3)|(b>>2));
|
||||
RGB32k.RGB[r][g][b] = 4;
|
||||
// create the RGB666 lookup table
|
||||
for (r = 0; r < 64; r++)
|
||||
for (g = 0; g < 64; g++)
|
||||
for (b = 0; b < 64; b++)
|
||||
RGB256k.RGB[r][g][b] = ColorMatcher.Pick ((r<<2)|(r>>4), (g<<2)|(g>>4), (b<<2)|(b>>4));
|
||||
|
||||
int x, y;
|
||||
|
||||
// create the swizzled palette
|
||||
for (x = 0; x < 65; x++)
|
||||
for (y = 0; y < 256; y++)
|
||||
Col2RGB8[x][y] = (((palette[y].r*x)>>4)<<20) |
|
||||
((palette[y].g*x)>>4) |
|
||||
(((palette[y].b*x)>>4)<<10);
|
||||
|
||||
// create the swizzled palette with the lsb of red and blue forced to 0
|
||||
// (for green, a 1 is okay since it never gets added into)
|
||||
for (x = 1; x < 64; x++)
|
||||
{
|
||||
Col2RGB8_LessPrecision[x] = Col2RGB8_2[x-1];
|
||||
for (y = 0; y < 256; y++)
|
||||
{
|
||||
Col2RGB8_2[x-1][y] = Col2RGB8[x][y] & 0x3feffbff;
|
||||
}
|
||||
}
|
||||
Col2RGB8_LessPrecision[0] = Col2RGB8[0];
|
||||
Col2RGB8_LessPrecision[64] = Col2RGB8[64];
|
||||
|
||||
// create the inverse swizzled palette
|
||||
for (x = 0; x < 65; x++)
|
||||
for (y = 0; y < 256; y++)
|
||||
{
|
||||
Col2RGB8_Inverse[x][y] = (((((255-palette[y].r)*x)>>4)<<20) |
|
||||
(((255-palette[y].g)*x)>>4) |
|
||||
((((255-palette[y].b)*x)>>4)<<10)) & 0x3feffbff;
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -448,20 +448,6 @@ EXTERN_CVAR (Float, Gamma)
|
|||
|
||||
// Translucency tables
|
||||
|
||||
// RGB32k is a normal R5G5B5 -> palette lookup table.
|
||||
|
||||
// Use a union so we can "overflow" without warnings.
|
||||
// Otherwise, we get stuff like this from Clang (when compiled
|
||||
// with -fsanitize=bounds) while running:
|
||||
// src/v_video.cpp:390:12: runtime error: index 1068 out of bounds for type 'BYTE [32]'
|
||||
// src/r_draw.cpp:273:11: runtime error: index 1057 out of bounds for type 'BYTE [32]'
|
||||
union ColorTable32k
|
||||
{
|
||||
BYTE RGB[32][32][32];
|
||||
BYTE All[32 *32 *32];
|
||||
};
|
||||
extern "C" ColorTable32k RGB32k;
|
||||
|
||||
// [SP] RGB666 support
|
||||
union ColorTable256k
|
||||
{
|
||||
|
@ -470,31 +456,6 @@ union ColorTable256k
|
|||
};
|
||||
extern "C" ColorTable256k RGB256k;
|
||||
|
||||
// Col2RGB8 is a pre-multiplied palette for color lookup. It is stored in a
|
||||
// special R10B10G10 format for efficient blending computation.
|
||||
// --RRRRRrrr--BBBBBbbb--GGGGGggg-- at level 64
|
||||
// --------rrrr------bbbb------gggg at level 1
|
||||
extern "C" DWORD Col2RGB8[65][256];
|
||||
|
||||
// Col2RGB8_LessPrecision is the same as Col2RGB8, but the LSB for red
|
||||
// and blue are forced to zero, so if the blend overflows, it won't spill
|
||||
// over into the next component's value.
|
||||
// --RRRRRrrr-#BBBBBbbb-#GGGGGggg-- at level 64
|
||||
// --------rrr#------bbb#------gggg at level 1
|
||||
extern "C" DWORD *Col2RGB8_LessPrecision[65];
|
||||
|
||||
// Col2RGB8_Inverse is the same as Col2RGB8_LessPrecision, except the source
|
||||
// palette has been inverted.
|
||||
extern "C" DWORD Col2RGB8_Inverse[65][256];
|
||||
|
||||
// "Magic" numbers used during the blending:
|
||||
// --000001111100000111110000011111 = 0x01f07c1f
|
||||
// -0111111111011111111101111111111 = 0x3FEFFBFF
|
||||
// -1000000000100000000010000000000 = 0x40100400
|
||||
// ------10000000001000000000100000 = 0x40100400 >> 5
|
||||
// --11111-----11111-----11111----- = 0x40100400 - (0x40100400 >> 5) aka "white"
|
||||
// --111111111111111111111111111111 = 0x3FFFFFFF
|
||||
|
||||
// Allocates buffer screens, call before R_Init.
|
||||
void V_Init (bool restart);
|
||||
|
||||
|
|
Loading…
Reference in a new issue