mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-13 16:07:55 +00:00
- Reimplemented rgb555 into all drawers in r_draw_pal.cpp including span drawers. All that remains now are the 4col drawers in r_drawt_pal.cpp.
This commit is contained in:
parent
80482e98a3
commit
101108877a
4 changed files with 847 additions and 291 deletions
|
@ -236,16 +236,22 @@ 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;
|
||||
}
|
||||
|
|
|
@ -658,6 +658,9 @@ namespace swrenderer
|
|||
int bits = _fracbits;
|
||||
int pitch = _pitch;
|
||||
|
||||
uint32_t *fg2rgb = _srcblend;
|
||||
uint32_t *bg2rgb = _destblend;
|
||||
|
||||
count = thread->count_for_thread(_dest_y, count);
|
||||
if (count <= 0)
|
||||
return;
|
||||
|
@ -711,6 +714,9 @@ namespace swrenderer
|
|||
int count = _count;
|
||||
int bits = _fracbits;
|
||||
|
||||
uint32_t *fg2rgb = _srcblend;
|
||||
uint32_t *bg2rgb = _destblend;
|
||||
|
||||
uint32_t dc_wall_texturefrac[4] = { _texturefrac[0], _texturefrac[1], _texturefrac[2], _texturefrac[3] };
|
||||
uint32_t dc_wall_iscale[4] = { _iscale[0], _iscale[1], _iscale[2], _iscale[3] };
|
||||
|
||||
|
@ -728,6 +734,31 @@ namespace swrenderer
|
|||
}
|
||||
pitch *= thread->num_cores;
|
||||
|
||||
if (!r_blendmethod)
|
||||
{
|
||||
do
|
||||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
uint8_t pix = _source[i][dc_wall_texturefrac[i] >> bits];
|
||||
if (pix != 0)
|
||||
{
|
||||
uint32_t a = (bg2rgb[dest[i]] | 0x40100400) - fg2rgb[_colormap[i][pix]];
|
||||
uint32_t b = a;
|
||||
|
||||
b &= 0x40100400;
|
||||
b = b - (b >> 5);
|
||||
a &= b;
|
||||
a |= 0x01f07c1f;
|
||||
dest[i] = RGB32k.All[a & (a >> 15)];
|
||||
}
|
||||
dc_wall_texturefrac[i] += dc_wall_iscale[i];
|
||||
}
|
||||
dest += _pitch;
|
||||
} while (--count);
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
|
@ -745,6 +776,7 @@ namespace swrenderer
|
|||
dest += _pitch;
|
||||
} while (--count);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -1319,6 +1351,18 @@ namespace swrenderer
|
|||
|
||||
const PalEntry* pal = GPalette.BaseColors;
|
||||
|
||||
if (!r_blendmethod)
|
||||
{
|
||||
do
|
||||
{
|
||||
uint32_t bg;
|
||||
bg = (fg + bg2rgb[*dest]) | 0x1f07c1f;
|
||||
*dest = RGB32k.All[bg & (bg >> 15)];
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
int src_r = ((_srccolor >> 16) & 0xff) * _srcalpha;
|
||||
|
@ -1330,7 +1374,7 @@ namespace swrenderer
|
|||
*dest = RGB256k.RGB[r][g][b];
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void FillColumnAddClampPalCommand::Execute(DrawerThread *thread)
|
||||
|
@ -1357,6 +1401,24 @@ namespace swrenderer
|
|||
|
||||
const PalEntry* pal = GPalette.BaseColors;
|
||||
|
||||
if (!r_blendmethod)
|
||||
{
|
||||
do
|
||||
{
|
||||
uint32_t a = fg + bg2rgb[*dest];
|
||||
uint32_t b = a;
|
||||
|
||||
a |= 0x01f07c1f;
|
||||
b &= 0x40100400;
|
||||
a &= 0x3fffffff;
|
||||
b = b - (b >> 5);
|
||||
a |= b;
|
||||
*dest = RGB32k.All[a & (a >> 15)];
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
int src_r = ((_srccolor >> 16) & 0xff) * _srcalpha;
|
||||
|
@ -1369,6 +1431,7 @@ namespace swrenderer
|
|||
dest += pitch;
|
||||
} while (--count);
|
||||
}
|
||||
}
|
||||
|
||||
void FillColumnSubClampPalCommand::Execute(DrawerThread *thread)
|
||||
{
|
||||
|
@ -1378,6 +1441,8 @@ namespace swrenderer
|
|||
count = _count;
|
||||
|
||||
dest = _dest;
|
||||
uint32_t *bg2rgb = _destblend;
|
||||
uint32_t fg = _srccolor;
|
||||
|
||||
int pitch = _pitch;
|
||||
|
||||
|
@ -1390,6 +1455,23 @@ namespace swrenderer
|
|||
|
||||
const PalEntry* palette = GPalette.BaseColors;
|
||||
|
||||
if (!r_blendmethod)
|
||||
{
|
||||
do
|
||||
{
|
||||
uint32_t a = fg - bg2rgb[*dest];
|
||||
uint32_t b = a;
|
||||
|
||||
b &= 0x40100400;
|
||||
b = b - (b >> 5);
|
||||
a &= b;
|
||||
a |= 0x01f07c1f;
|
||||
*dest = RGB32k.All[a & (a >> 15)];
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
int src_r = ((_srccolor >> 16) & 0xff) * _srcalpha;
|
||||
|
@ -1404,6 +1486,7 @@ namespace swrenderer
|
|||
dest += pitch;
|
||||
} while (--count);
|
||||
}
|
||||
}
|
||||
|
||||
void FillColumnRevSubClampPalCommand::Execute(DrawerThread *thread)
|
||||
{
|
||||
|
@ -1415,6 +1498,8 @@ namespace swrenderer
|
|||
return;
|
||||
|
||||
dest = _dest;
|
||||
uint32_t *bg2rgb = _destblend;
|
||||
uint32_t fg = _srccolor;
|
||||
|
||||
int pitch = _pitch;
|
||||
|
||||
|
@ -1427,6 +1512,23 @@ namespace swrenderer
|
|||
|
||||
const PalEntry *palette = GPalette.BaseColors;
|
||||
|
||||
if (!r_blendmethod)
|
||||
{
|
||||
do
|
||||
{
|
||||
uint32_t a = (bg2rgb[*dest] | 0x40100400) - fg;
|
||||
uint32_t b = a;
|
||||
|
||||
b &= 0x40100400;
|
||||
b = b - (b >> 5);
|
||||
a &= b;
|
||||
a |= 0x01f07c1f;
|
||||
*dest = RGB32k.All[a & (a >> 15)];
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
int src_r = ((_srccolor >> 16) & 0xff) * _srcalpha;
|
||||
|
@ -1441,6 +1543,7 @@ namespace swrenderer
|
|||
dest += pitch;
|
||||
} while (--count);
|
||||
}
|
||||
}
|
||||
|
||||
void DrawColumnAddPalCommand::Execute(DrawerThread *thread)
|
||||
{
|
||||
|
@ -1465,10 +1568,29 @@ namespace swrenderer
|
|||
fracstep *= thread->num_cores;
|
||||
pitch *= thread->num_cores;
|
||||
|
||||
uint32_t *fg2rgb = _srcblend;
|
||||
uint32_t *bg2rgb = _destblend;
|
||||
const uint8_t *colormap = _colormap;
|
||||
const uint8_t *source = _source;
|
||||
const PalEntry *palette = GPalette.BaseColors;
|
||||
|
||||
if (!r_blendmethod)
|
||||
{
|
||||
do
|
||||
{
|
||||
uint32_t fg = colormap[source[frac >> FRACBITS]];
|
||||
uint32_t bg = *dest;
|
||||
|
||||
fg = fg2rgb[fg];
|
||||
bg = bg2rgb[bg];
|
||||
fg = (fg + bg) | 0x1f07c1f;
|
||||
*dest = RGB32k.All[fg & (fg >> 15)];
|
||||
dest += pitch;
|
||||
frac += fracstep;
|
||||
} while (--count);
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
uint32_t fg = colormap[source[frac >> FRACBITS]];
|
||||
|
@ -1481,6 +1603,7 @@ namespace swrenderer
|
|||
frac += fracstep;
|
||||
} while (--count);
|
||||
}
|
||||
}
|
||||
|
||||
void DrawColumnTranslatedPalCommand::Execute(DrawerThread *thread)
|
||||
{
|
||||
|
@ -1543,12 +1666,31 @@ namespace swrenderer
|
|||
fracstep *= thread->num_cores;
|
||||
pitch *= thread->num_cores;
|
||||
|
||||
uint32_t *fg2rgb = _srcblend;
|
||||
uint32_t *bg2rgb = _destblend;
|
||||
const uint8_t *translation = _translation;
|
||||
const uint8_t *colormap = _colormap;
|
||||
const uint8_t *source = _source;
|
||||
|
||||
const PalEntry *palette = GPalette.BaseColors;
|
||||
|
||||
if (!r_blendmethod)
|
||||
{
|
||||
do
|
||||
{
|
||||
uint32_t fg = colormap[translation[source[frac >> FRACBITS]]];
|
||||
uint32_t bg = *dest;
|
||||
|
||||
fg = fg2rgb[fg];
|
||||
bg = bg2rgb[bg];
|
||||
fg = (fg + bg) | 0x1f07c1f;
|
||||
*dest = RGB32k.All[fg & (fg >> 15)];
|
||||
dest += pitch;
|
||||
frac += fracstep;
|
||||
} while (--count);
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
uint32_t fg = colormap[translation[source[frac >> FRACBITS]]];
|
||||
|
@ -1561,6 +1703,7 @@ namespace swrenderer
|
|||
frac += fracstep;
|
||||
} while (--count);
|
||||
}
|
||||
}
|
||||
|
||||
void DrawColumnShadedPalCommand::Execute(DrawerThread *thread)
|
||||
{
|
||||
|
@ -1586,9 +1729,24 @@ namespace swrenderer
|
|||
|
||||
const uint8_t *source = _source;
|
||||
const uint8_t *colormap = _colormap;
|
||||
|
||||
uint32_t *fgstart = &Col2RGB8[0][_color];
|
||||
const PalEntry *palette = GPalette.BaseColors;
|
||||
|
||||
if (!r_blendmethod)
|
||||
{
|
||||
do
|
||||
{
|
||||
uint32_t val = colormap[source[frac >> FRACBITS]];
|
||||
uint32_t fg = fgstart[val << 8];
|
||||
val = (Col2RGB8[64 - val][*dest] + fg) | 0x1f07c1f;
|
||||
*dest = RGB32k.All[val & (val >> 15)];
|
||||
|
||||
dest += pitch;
|
||||
frac += fracstep;
|
||||
} while (--count);
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
uint32_t val = source[frac >> FRACBITS];
|
||||
|
@ -1602,6 +1760,7 @@ namespace swrenderer
|
|||
frac += fracstep;
|
||||
} while (--count);
|
||||
}
|
||||
}
|
||||
|
||||
void DrawColumnAddClampPalCommand::Execute(DrawerThread *thread)
|
||||
{
|
||||
|
@ -1628,8 +1787,29 @@ namespace swrenderer
|
|||
|
||||
const uint8_t *colormap = _colormap;
|
||||
const uint8_t *source = _source;
|
||||
uint32_t *fg2rgb = _srcblend;
|
||||
uint32_t *bg2rgb = _destblend;
|
||||
const PalEntry *palette = GPalette.BaseColors;
|
||||
|
||||
if (!r_blendmethod)
|
||||
{
|
||||
do
|
||||
{
|
||||
uint32_t a = fg2rgb[colormap[source[frac >> FRACBITS]]] + bg2rgb[*dest];
|
||||
uint32_t b = a;
|
||||
|
||||
a |= 0x01f07c1f;
|
||||
b &= 0x40100400;
|
||||
a &= 0x3fffffff;
|
||||
b = b - (b >> 5);
|
||||
a |= b;
|
||||
*dest = RGB32k.All[a & (a >> 15)];
|
||||
dest += pitch;
|
||||
frac += fracstep;
|
||||
} while (--count);
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
int fg = colormap[source[frac >> FRACBITS]];
|
||||
|
@ -1642,6 +1822,7 @@ namespace swrenderer
|
|||
frac += fracstep;
|
||||
} while (--count);
|
||||
}
|
||||
}
|
||||
|
||||
void DrawColumnAddClampTranslatedPalCommand::Execute(DrawerThread *thread)
|
||||
{
|
||||
|
@ -1669,8 +1850,29 @@ namespace swrenderer
|
|||
const uint8_t *translation = _translation;
|
||||
const uint8_t *colormap = _colormap;
|
||||
const uint8_t *source = _source;
|
||||
uint32_t *fg2rgb = _srcblend;
|
||||
uint32_t *bg2rgb = _destblend;
|
||||
const PalEntry *palette = GPalette.BaseColors;
|
||||
|
||||
if (!r_blendmethod)
|
||||
{
|
||||
do
|
||||
{
|
||||
uint32_t a = fg2rgb[colormap[translation[source[frac >> FRACBITS]]]] + bg2rgb[*dest];
|
||||
uint32_t b = a;
|
||||
|
||||
a |= 0x01f07c1f;
|
||||
b &= 0x40100400;
|
||||
a &= 0x3fffffff;
|
||||
b = b - (b >> 5);
|
||||
a |= b;
|
||||
*dest = RGB32k.All[(a >> 15) & a];
|
||||
dest += pitch;
|
||||
frac += fracstep;
|
||||
} while (--count);
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
int fg = colormap[translation[source[frac >> FRACBITS]]];
|
||||
|
@ -1683,6 +1885,7 @@ namespace swrenderer
|
|||
frac += fracstep;
|
||||
} while (--count);
|
||||
}
|
||||
}
|
||||
|
||||
void DrawColumnSubClampPalCommand::Execute(DrawerThread *thread)
|
||||
{
|
||||
|
@ -1709,8 +1912,28 @@ namespace swrenderer
|
|||
|
||||
const uint8_t *colormap = _colormap;
|
||||
const uint8_t *source = _source;
|
||||
uint32_t *fg2rgb = _srcblend;
|
||||
uint32_t *bg2rgb = _destblend;
|
||||
const PalEntry *palette = GPalette.BaseColors;
|
||||
|
||||
if (!r_blendmethod)
|
||||
{
|
||||
do
|
||||
{
|
||||
uint32_t a = (fg2rgb[colormap[source[frac >> FRACBITS]]] | 0x40100400) - bg2rgb[*dest];
|
||||
uint32_t b = a;
|
||||
|
||||
b &= 0x40100400;
|
||||
b = b - (b >> 5);
|
||||
a &= b;
|
||||
a |= 0x01f07c1f;
|
||||
*dest = RGB32k.All[a & (a >> 15)];
|
||||
dest += pitch;
|
||||
frac += fracstep;
|
||||
} while (--count);
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
int fg = colormap[source[frac >> FRACBITS]];
|
||||
|
@ -1723,6 +1946,7 @@ namespace swrenderer
|
|||
frac += fracstep;
|
||||
} while (--count);
|
||||
}
|
||||
}
|
||||
|
||||
void DrawColumnSubClampTranslatedPalCommand::Execute(DrawerThread *thread)
|
||||
{
|
||||
|
@ -1750,8 +1974,28 @@ namespace swrenderer
|
|||
const uint8_t *translation = _translation;
|
||||
const uint8_t *colormap = _colormap;
|
||||
const uint8_t *source = _source;
|
||||
uint32_t *fg2rgb = _srcblend;
|
||||
uint32_t *bg2rgb = _destblend;
|
||||
const PalEntry *palette = GPalette.BaseColors;
|
||||
|
||||
if (!r_blendmethod)
|
||||
{
|
||||
do
|
||||
{
|
||||
uint32_t a = (fg2rgb[colormap[translation[source[frac >> FRACBITS]]]] | 0x40100400) - bg2rgb[*dest];
|
||||
uint32_t b = a;
|
||||
|
||||
b &= 0x40100400;
|
||||
b = b - (b >> 5);
|
||||
a &= b;
|
||||
a |= 0x01f07c1f;
|
||||
*dest = RGB32k.All[(a >> 15) & a];
|
||||
dest += pitch;
|
||||
frac += fracstep;
|
||||
} while (--count);
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
int fg = colormap[translation[source[frac >> FRACBITS]]];
|
||||
|
@ -1764,6 +2008,7 @@ namespace swrenderer
|
|||
frac += fracstep;
|
||||
} while (--count);
|
||||
}
|
||||
}
|
||||
|
||||
void DrawColumnRevSubClampPalCommand::Execute(DrawerThread *thread)
|
||||
{
|
||||
|
@ -1790,8 +2035,28 @@ namespace swrenderer
|
|||
|
||||
const uint8_t *colormap = _colormap;
|
||||
const uint8_t *source = _source;
|
||||
uint32_t *fg2rgb = _srcblend;
|
||||
uint32_t *bg2rgb = _destblend;
|
||||
const PalEntry *palette = GPalette.BaseColors;
|
||||
|
||||
if (!r_blendmethod)
|
||||
{
|
||||
do
|
||||
{
|
||||
uint32_t a = (bg2rgb[*dest] | 0x40100400) - fg2rgb[colormap[source[frac >> FRACBITS]]];
|
||||
uint32_t b = a;
|
||||
|
||||
b &= 0x40100400;
|
||||
b = b - (b >> 5);
|
||||
a &= b;
|
||||
a |= 0x01f07c1f;
|
||||
*dest = RGB32k.All[a & (a >> 15)];
|
||||
dest += pitch;
|
||||
frac += fracstep;
|
||||
} while (--count);
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
int fg = colormap[source[frac >> FRACBITS]];
|
||||
|
@ -1804,6 +2069,7 @@ namespace swrenderer
|
|||
frac += fracstep;
|
||||
} while (--count);
|
||||
}
|
||||
}
|
||||
|
||||
void DrawColumnRevSubClampTranslatedPalCommand::Execute(DrawerThread *thread)
|
||||
{
|
||||
|
@ -1831,8 +2097,28 @@ namespace swrenderer
|
|||
const uint8_t *translation = _translation;
|
||||
const uint8_t *colormap = _colormap;
|
||||
const uint8_t *source = _source;
|
||||
uint32_t *fg2rgb = _srcblend;
|
||||
uint32_t *bg2rgb = _destblend;
|
||||
const PalEntry *palette = GPalette.BaseColors;
|
||||
|
||||
if (!r_blendmethod)
|
||||
{
|
||||
do
|
||||
{
|
||||
uint32_t a = (bg2rgb[*dest] | 0x40100400) - fg2rgb[colormap[translation[source[frac >> FRACBITS]]]];
|
||||
uint32_t b = a;
|
||||
|
||||
b &= 0x40100400;
|
||||
b = b - (b >> 5);
|
||||
a &= b;
|
||||
a |= 0x01f07c1f;
|
||||
*dest = RGB32k.All[(a >> 15) & a];
|
||||
dest += pitch;
|
||||
frac += fracstep;
|
||||
} while (--count);
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
int fg = colormap[translation[source[frac >> FRACBITS]]];
|
||||
|
@ -1845,6 +2131,7 @@ namespace swrenderer
|
|||
frac += fracstep;
|
||||
} while (--count);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -2103,6 +2390,8 @@ namespace swrenderer
|
|||
const uint8_t *colormap = _colormap;
|
||||
int count;
|
||||
int spot;
|
||||
uint32_t *fg2rgb = _srcblend;
|
||||
uint32_t *bg2rgb = _destblend;
|
||||
|
||||
xfrac = _xfrac;
|
||||
yfrac = _yfrac;
|
||||
|
@ -2116,6 +2405,45 @@ namespace swrenderer
|
|||
|
||||
const PalEntry *palette = GPalette.BaseColors;
|
||||
|
||||
if (!r_blendmethod)
|
||||
{
|
||||
if (_xbits == 6 && _ybits == 6)
|
||||
{
|
||||
// 64x64 is the most common case by far, so special case it.
|
||||
do
|
||||
{
|
||||
spot = ((xfrac >> (32 - 6 - 6))&(63 * 64)) + (yfrac >> (32 - 6));
|
||||
uint32_t fg = colormap[source[spot]];
|
||||
uint32_t bg = *dest;
|
||||
fg = fg2rgb[fg];
|
||||
bg = bg2rgb[bg];
|
||||
fg = (fg + bg) | 0x1f07c1f;
|
||||
*dest++ = RGB32k.All[fg & (fg >> 15)];
|
||||
xfrac += xstep;
|
||||
yfrac += ystep;
|
||||
} while (--count);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t yshift = 32 - _ybits;
|
||||
uint8_t xshift = yshift - _xbits;
|
||||
int xmask = ((1 << _xbits) - 1) << _ybits;
|
||||
do
|
||||
{
|
||||
spot = ((xfrac >> xshift) & xmask) + (yfrac >> yshift);
|
||||
uint32_t fg = colormap[source[spot]];
|
||||
uint32_t bg = *dest;
|
||||
fg = fg2rgb[fg];
|
||||
bg = bg2rgb[bg];
|
||||
fg = (fg + bg) | 0x1f07c1f;
|
||||
*dest++ = RGB32k.All[fg & (fg >> 15)];
|
||||
xfrac += xstep;
|
||||
yfrac += ystep;
|
||||
} while (--count);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_xbits == 6 && _ybits == 6)
|
||||
{
|
||||
// 64x64 is the most common case by far, so special case it.
|
||||
|
@ -2153,6 +2481,7 @@ namespace swrenderer
|
|||
} while (--count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DrawSpanMaskedTranslucentPalCommand::Execute(DrawerThread *thread)
|
||||
{
|
||||
|
@ -2168,6 +2497,8 @@ namespace swrenderer
|
|||
const uint8_t *colormap = _colormap;
|
||||
int count;
|
||||
int spot;
|
||||
uint32_t *fg2rgb = _srcblend;
|
||||
uint32_t *bg2rgb = _destblend;
|
||||
|
||||
const PalEntry *palette = GPalette.BaseColors;
|
||||
|
||||
|
@ -2181,6 +2512,59 @@ namespace swrenderer
|
|||
xstep = _xstep;
|
||||
ystep = _ystep;
|
||||
|
||||
if (!r_blendmethod)
|
||||
{
|
||||
if (_xbits == 6 && _ybits == 6)
|
||||
{
|
||||
// 64x64 is the most common case by far, so special case it.
|
||||
do
|
||||
{
|
||||
uint8_t texdata;
|
||||
|
||||
spot = ((xfrac >> (32 - 6 - 6))&(63 * 64)) + (yfrac >> (32 - 6));
|
||||
texdata = source[spot];
|
||||
if (texdata != 0)
|
||||
{
|
||||
uint32_t fg = colormap[texdata];
|
||||
uint32_t bg = *dest;
|
||||
fg = fg2rgb[fg];
|
||||
bg = bg2rgb[bg];
|
||||
fg = (fg + bg) | 0x1f07c1f;
|
||||
*dest = RGB32k.All[fg & (fg >> 15)];
|
||||
}
|
||||
dest++;
|
||||
xfrac += xstep;
|
||||
yfrac += ystep;
|
||||
} while (--count);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t yshift = 32 - _ybits;
|
||||
uint8_t xshift = yshift - _xbits;
|
||||
int xmask = ((1 << _xbits) - 1) << _ybits;
|
||||
do
|
||||
{
|
||||
uint8_t texdata;
|
||||
|
||||
spot = ((xfrac >> xshift) & xmask) + (yfrac >> yshift);
|
||||
texdata = source[spot];
|
||||
if (texdata != 0)
|
||||
{
|
||||
uint32_t fg = colormap[texdata];
|
||||
uint32_t bg = *dest;
|
||||
fg = fg2rgb[fg];
|
||||
bg = bg2rgb[bg];
|
||||
fg = (fg + bg) | 0x1f07c1f;
|
||||
*dest = RGB32k.All[fg & (fg >> 15)];
|
||||
}
|
||||
dest++;
|
||||
xfrac += xstep;
|
||||
yfrac += ystep;
|
||||
} while (--count);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_xbits == 6 && _ybits == 6)
|
||||
{
|
||||
// 64x64 is the most common case by far, so special case it.
|
||||
|
@ -2230,6 +2614,7 @@ namespace swrenderer
|
|||
} while (--count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DrawSpanAddClampPalCommand::Execute(DrawerThread *thread)
|
||||
{
|
||||
|
@ -2245,6 +2630,8 @@ namespace swrenderer
|
|||
const uint8_t *colormap = _colormap;
|
||||
int count;
|
||||
int spot;
|
||||
uint32_t *fg2rgb = _srcblend;
|
||||
uint32_t *bg2rgb = _destblend;
|
||||
const PalEntry *palette = GPalette.BaseColors;
|
||||
|
||||
xfrac = _xfrac;
|
||||
|
@ -2257,6 +2644,51 @@ namespace swrenderer
|
|||
xstep = _xstep;
|
||||
ystep = _ystep;
|
||||
|
||||
if (!r_blendmethod)
|
||||
{
|
||||
if (_xbits == 6 && _ybits == 6)
|
||||
{
|
||||
// 64x64 is the most common case by far, so special case it.
|
||||
do
|
||||
{
|
||||
spot = ((xfrac >> (32 - 6 - 6))&(63 * 64)) + (yfrac >> (32 - 6));
|
||||
uint32_t a = fg2rgb[colormap[source[spot]]] + bg2rgb[*dest];
|
||||
uint32_t b = a;
|
||||
|
||||
a |= 0x01f07c1f;
|
||||
b &= 0x40100400;
|
||||
a &= 0x3fffffff;
|
||||
b = b - (b >> 5);
|
||||
a |= b;
|
||||
*dest++ = RGB32k.All[a & (a >> 15)];
|
||||
xfrac += xstep;
|
||||
yfrac += ystep;
|
||||
} while (--count);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t yshift = 32 - _ybits;
|
||||
uint8_t xshift = yshift - _xbits;
|
||||
int xmask = ((1 << _xbits) - 1) << _ybits;
|
||||
do
|
||||
{
|
||||
spot = ((xfrac >> xshift) & xmask) + (yfrac >> yshift);
|
||||
uint32_t a = fg2rgb[colormap[source[spot]]] + bg2rgb[*dest];
|
||||
uint32_t b = a;
|
||||
|
||||
a |= 0x01f07c1f;
|
||||
b &= 0x40100400;
|
||||
a &= 0x3fffffff;
|
||||
b = b - (b >> 5);
|
||||
a |= b;
|
||||
*dest++ = RGB32k.All[a & (a >> 15)];
|
||||
xfrac += xstep;
|
||||
yfrac += ystep;
|
||||
} while (--count);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_xbits == 6 && _ybits == 6)
|
||||
{
|
||||
// 64x64 is the most common case by far, so special case it.
|
||||
|
@ -2294,6 +2726,7 @@ namespace swrenderer
|
|||
} while (--count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DrawSpanMaskedAddClampPalCommand::Execute(DrawerThread *thread)
|
||||
{
|
||||
|
@ -2309,6 +2742,8 @@ namespace swrenderer
|
|||
const uint8_t *colormap = _colormap;
|
||||
int count;
|
||||
int spot;
|
||||
uint32_t *fg2rgb = _srcblend;
|
||||
uint32_t *bg2rgb = _destblend;
|
||||
const PalEntry *palette = GPalette.BaseColors;
|
||||
|
||||
xfrac = _xfrac;
|
||||
|
@ -2321,6 +2756,65 @@ namespace swrenderer
|
|||
xstep = _xstep;
|
||||
ystep = _ystep;
|
||||
|
||||
if (!r_columnmethod)
|
||||
{
|
||||
if (_xbits == 6 && _ybits == 6)
|
||||
{
|
||||
// 64x64 is the most common case by far, so special case it.
|
||||
do
|
||||
{
|
||||
uint8_t texdata;
|
||||
|
||||
spot = ((xfrac >> (32 - 6 - 6))&(63 * 64)) + (yfrac >> (32 - 6));
|
||||
texdata = source[spot];
|
||||
if (texdata != 0)
|
||||
{
|
||||
uint32_t a = fg2rgb[colormap[texdata]] + bg2rgb[*dest];
|
||||
uint32_t b = a;
|
||||
|
||||
a |= 0x01f07c1f;
|
||||
b &= 0x40100400;
|
||||
a &= 0x3fffffff;
|
||||
b = b - (b >> 5);
|
||||
a |= b;
|
||||
*dest = RGB32k.All[a & (a >> 15)];
|
||||
}
|
||||
dest++;
|
||||
xfrac += xstep;
|
||||
yfrac += ystep;
|
||||
} while (--count);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t yshift = 32 - _ybits;
|
||||
uint8_t xshift = yshift - _xbits;
|
||||
int xmask = ((1 << _xbits) - 1) << _ybits;
|
||||
do
|
||||
{
|
||||
uint8_t texdata;
|
||||
|
||||
spot = ((xfrac >> xshift) & xmask) + (yfrac >> yshift);
|
||||
texdata = source[spot];
|
||||
if (texdata != 0)
|
||||
{
|
||||
uint32_t a = fg2rgb[colormap[texdata]] + bg2rgb[*dest];
|
||||
uint32_t b = a;
|
||||
|
||||
a |= 0x01f07c1f;
|
||||
b &= 0x40100400;
|
||||
a &= 0x3fffffff;
|
||||
b = b - (b >> 5);
|
||||
a |= b;
|
||||
*dest = RGB32k.All[a & (a >> 15)];
|
||||
}
|
||||
dest++;
|
||||
xfrac += xstep;
|
||||
yfrac += ystep;
|
||||
} while (--count);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_xbits == 6 && _ybits == 6)
|
||||
{
|
||||
// 64x64 is the most common case by far, so special case it.
|
||||
|
@ -2370,6 +2864,7 @@ namespace swrenderer
|
|||
} while (--count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FillSpanPalCommand::Execute(DrawerThread *thread)
|
||||
{
|
||||
|
|
|
@ -1509,12 +1509,16 @@ 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;
|
||||
}
|
||||
|
@ -1531,12 +1535,16 @@ 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 = FRACUNIT;
|
||||
}
|
||||
|
|
|
@ -72,6 +72,7 @@ EXTERN_CVAR(Int, r_drawfuzz)
|
|||
EXTERN_CVAR(Bool, r_deathcamera);
|
||||
EXTERN_CVAR(Bool, r_drawplayersprites)
|
||||
EXTERN_CVAR(Bool, r_drawvoxels)
|
||||
EXTERN_CVAR(Bool, r_blendmethod)
|
||||
|
||||
CVAR(Bool, r_fullbrightignoresectorcolor, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
||||
//CVAR(Bool, r_splitsprites, true, CVAR_ARCHIVE)
|
||||
|
@ -2640,8 +2641,10 @@ static void R_DrawMaskedSegsBehindParticle (const vissprite_t *vis)
|
|||
|
||||
void R_DrawParticle (vissprite_t *vis)
|
||||
{
|
||||
DWORD *bg2rgb;
|
||||
int spacing;
|
||||
BYTE *dest;
|
||||
DWORD fg;
|
||||
BYTE color = vis->Style.colormap[vis->startfrac];
|
||||
int yl = vis->y1;
|
||||
int ycount = vis->y2 - yl + 1;
|
||||
|
@ -2655,8 +2658,32 @@ void R_DrawParticle (vissprite_t *vis)
|
|||
// vis->renderflags holds translucency level (0-255)
|
||||
fixed_t fglevel, bglevel;
|
||||
|
||||
{
|
||||
DWORD *fg2rgb;
|
||||
|
||||
fglevel = ((vis->renderflags + 1) << 8) & ~0x3ff;
|
||||
bglevel = FRACUNIT-fglevel;
|
||||
fg2rgb = Col2RGB8[fglevel>>10];
|
||||
bg2rgb = Col2RGB8[bglevel>>10];
|
||||
fg = fg2rgb[color];
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
spacing = RenderTarget->GetPitch() - countbase;
|
||||
dest = ylookup[yl] + x1 + dc_destorg;
|
||||
|
||||
do
|
||||
{
|
||||
int count = countbase;
|
||||
do
|
||||
{
|
||||
DWORD bg = bg2rgb[*dest];
|
||||
bg = (fg+bg) | 0x1f07c1f;
|
||||
*dest++ = RGB32k.All[bg & (bg>>15)];
|
||||
} while (--count);
|
||||
dest += spacing;
|
||||
} while (--ycount);*/
|
||||
|
||||
// original was row-wise
|
||||
// width = countbase
|
||||
|
@ -2664,6 +2691,25 @@ void R_DrawParticle (vissprite_t *vis)
|
|||
|
||||
spacing = RenderTarget->GetPitch();
|
||||
|
||||
if (!r_blendmethod)
|
||||
{
|
||||
for (int x = x1; x < (x1+countbase); x++)
|
||||
{
|
||||
dc_x = x;
|
||||
if (R_ClipSpriteColumnWithPortals(vis))
|
||||
continue;
|
||||
dest = ylookup[yl] + x + dc_destorg;
|
||||
for (int y = 0; y < ycount; y++)
|
||||
{
|
||||
DWORD bg = bg2rgb[*dest];
|
||||
bg = (fg+bg) | 0x1f07c1f;
|
||||
*dest = RGB32k.All[bg & (bg>>15)];
|
||||
dest += spacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int x = x1; x < (x1+countbase); x++)
|
||||
{
|
||||
dc_x = x;
|
||||
|
@ -2680,6 +2726,7 @@ void R_DrawParticle (vissprite_t *vis)
|
|||
dest += spacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern double BaseYaspectMul;;
|
||||
|
|
Loading…
Reference in a new issue