mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
Simplify drawer code by creating loop iterators
Fixed blending bug
This commit is contained in:
parent
7a0c801a18
commit
698b5f3db1
11 changed files with 1235 additions and 2769 deletions
|
@ -1644,6 +1644,8 @@ extern "C" void R_DrawSlabC(int dx, fixed_t v, int dy, fixed_t vi, const BYTE *v
|
|||
|
||||
int vlinebits;
|
||||
int mvlinebits;
|
||||
uint32_t vlinemax;
|
||||
uint32_t mvlinemax;
|
||||
|
||||
#ifndef X86_ASM
|
||||
static DWORD vlinec1 ();
|
||||
|
@ -1693,11 +1695,12 @@ DWORD (*domvline1)() = mvlineasm1;
|
|||
void (*domvline4)() = mvlineasm4;
|
||||
#endif
|
||||
|
||||
void setupvline (int fracbits)
|
||||
void setupvline (int fracbits, int fracmax)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
vlinebits = fracbits;
|
||||
vlinemax = fracmax;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1777,7 +1780,7 @@ void vlinec4 ()
|
|||
}
|
||||
#endif
|
||||
|
||||
void setupmvline (int fracbits)
|
||||
void setupmvline (int fracbits, int fracmax)
|
||||
{
|
||||
if (!r_swtruecolor)
|
||||
{
|
||||
|
@ -1792,6 +1795,7 @@ void setupmvline (int fracbits)
|
|||
else
|
||||
{
|
||||
mvlinebits = fracbits;
|
||||
mvlinemax = fracmax;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1964,10 +1968,12 @@ void R_DrawFogBoundary_C (int x1, int x2, short *uclip, short *dclip)
|
|||
}
|
||||
|
||||
int tmvlinebits;
|
||||
uint32_t tmvlinemax;
|
||||
|
||||
void setuptmvline (int bits)
|
||||
void setuptmvline (int bits, int fracmax)
|
||||
{
|
||||
tmvlinebits = bits;
|
||||
tmvlinemax = fracmax;
|
||||
}
|
||||
|
||||
fixed_t tmvline1_add_C ()
|
||||
|
|
|
@ -100,13 +100,13 @@ extern void (*R_DrawColumn)(void);
|
|||
extern DWORD (*dovline1) ();
|
||||
extern DWORD (*doprevline1) ();
|
||||
extern void (*dovline4) ();
|
||||
extern void setupvline (int);
|
||||
extern void setupvline (int,int);
|
||||
|
||||
extern DWORD (*domvline1) ();
|
||||
extern void (*domvline4) ();
|
||||
extern void setupmvline (int);
|
||||
extern void setupmvline (int,int);
|
||||
|
||||
extern void setuptmvline (int);
|
||||
extern void setuptmvline (int,int);
|
||||
|
||||
// The Spectre/Invisibility effect.
|
||||
extern void (*R_DrawFuzzColumn)(void);
|
||||
|
|
3338
src/r_draw_rgba.cpp
3338
src/r_draw_rgba.cpp
File diff suppressed because it is too large
Load diff
|
@ -286,7 +286,7 @@ public:
|
|||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Pixel shading macros and inline functions:
|
||||
// Pixel shading inline functions:
|
||||
|
||||
// Give the compiler a strong hint we want these functions inlined:
|
||||
#ifndef FORCEINLINE
|
||||
|
@ -310,220 +310,256 @@ public:
|
|||
#endif
|
||||
#endif
|
||||
|
||||
// calculates the light constant passed to the shade_pal_index function
|
||||
FORCEINLINE uint32_t calc_light_multiplier(dsfixed_t light)
|
||||
class LightBgra
|
||||
{
|
||||
return 256 - (light >> (FRACBITS - 8));
|
||||
}
|
||||
|
||||
// Calculates a ARGB8 color for the given palette index and light multiplier
|
||||
FORCEINLINE uint32_t shade_pal_index_simple(uint32_t index, uint32_t light)
|
||||
{
|
||||
const PalEntry &color = GPalette.BaseColors[index];
|
||||
uint32_t red = color.r;
|
||||
uint32_t green = color.g;
|
||||
uint32_t blue = color.b;
|
||||
|
||||
red = red * light / 256;
|
||||
green = green * light / 256;
|
||||
blue = blue * light / 256;
|
||||
|
||||
return 0xff000000 | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
|
||||
FORCEINLINE uint32_t shade_bgra_simple(uint32_t color, uint32_t light)
|
||||
{
|
||||
uint32_t red = (color >> 16) & 0xff;
|
||||
uint32_t green = (color >> 8) & 0xff;
|
||||
uint32_t blue = color & 0xff;
|
||||
|
||||
red = red * light / 256;
|
||||
green = green * light / 256;
|
||||
blue = blue * light / 256;
|
||||
|
||||
return 0xff000000 | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
|
||||
// Calculates a ARGB8 color for the given palette index, light multiplier and dynamic colormap
|
||||
FORCEINLINE uint32_t shade_pal_index(uint32_t index, uint32_t light, const ShadeConstants &constants)
|
||||
{
|
||||
const PalEntry &color = GPalette.BaseColors[index];
|
||||
uint32_t alpha = color.d & 0xff000000;
|
||||
uint32_t red = color.r;
|
||||
uint32_t green = color.g;
|
||||
uint32_t blue = color.b;
|
||||
if (constants.simple_shade)
|
||||
public:
|
||||
// calculates the light constant passed to the shade_pal_index function
|
||||
FORCEINLINE static uint32_t calc_light_multiplier(dsfixed_t light)
|
||||
{
|
||||
return 256 - (light >> (FRACBITS - 8));
|
||||
}
|
||||
|
||||
// Calculates a ARGB8 color for the given palette index and light multiplier
|
||||
FORCEINLINE static uint32_t shade_pal_index_simple(uint32_t index, uint32_t light)
|
||||
{
|
||||
const PalEntry &color = GPalette.BaseColors[index];
|
||||
uint32_t red = color.r;
|
||||
uint32_t green = color.g;
|
||||
uint32_t blue = color.b;
|
||||
|
||||
red = red * light / 256;
|
||||
green = green * light / 256;
|
||||
blue = blue * light / 256;
|
||||
|
||||
return 0xff000000 | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
else
|
||||
|
||||
// Calculates a ARGB8 color for the given palette index, light multiplier and dynamic colormap
|
||||
FORCEINLINE static uint32_t shade_pal_index(uint32_t index, uint32_t light, const ShadeConstants &constants)
|
||||
{
|
||||
uint32_t inv_light = 256 - light;
|
||||
uint32_t inv_desaturate = 256 - constants.desaturate;
|
||||
|
||||
uint32_t intensity = ((red * 77 + green * 143 + blue * 37) >> 8) * constants.desaturate;
|
||||
|
||||
red = (red * inv_desaturate + intensity) / 256;
|
||||
green = (green * inv_desaturate + intensity) / 256;
|
||||
blue = (blue * inv_desaturate + intensity) / 256;
|
||||
|
||||
red = (constants.fade_red * inv_light + red * light) / 256;
|
||||
green = (constants.fade_green * inv_light + green * light) / 256;
|
||||
blue = (constants.fade_blue * inv_light + blue * light) / 256;
|
||||
|
||||
red = (red * constants.light_red) / 256;
|
||||
green = (green * constants.light_green) / 256;
|
||||
blue = (blue * constants.light_blue) / 256;
|
||||
}
|
||||
return alpha | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
|
||||
FORCEINLINE uint32_t shade_bgra(uint32_t color, uint32_t light, const ShadeConstants &constants)
|
||||
{
|
||||
uint32_t alpha = color & 0xff000000;
|
||||
uint32_t red = (color >> 16) & 0xff;
|
||||
uint32_t green = (color >> 8) & 0xff;
|
||||
uint32_t blue = color & 0xff;
|
||||
if (constants.simple_shade)
|
||||
{
|
||||
red = red * light / 256;
|
||||
green = green * light / 256;
|
||||
blue = blue * light / 256;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t inv_light = 256 - light;
|
||||
uint32_t inv_desaturate = 256 - constants.desaturate;
|
||||
|
||||
uint32_t intensity = ((red * 77 + green * 143 + blue * 37) >> 8) * constants.desaturate;
|
||||
|
||||
red = (red * inv_desaturate + intensity) / 256;
|
||||
green = (green * inv_desaturate + intensity) / 256;
|
||||
blue = (blue * inv_desaturate + intensity) / 256;
|
||||
|
||||
red = (constants.fade_red * inv_light + red * light) / 256;
|
||||
green = (constants.fade_green * inv_light + green * light) / 256;
|
||||
blue = (constants.fade_blue * inv_light + blue * light) / 256;
|
||||
|
||||
red = (red * constants.light_red) / 256;
|
||||
green = (green * constants.light_green) / 256;
|
||||
blue = (blue * constants.light_blue) / 256;
|
||||
}
|
||||
return alpha | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
|
||||
FORCEINLINE uint32_t alpha_blend(uint32_t fg, uint32_t bg)
|
||||
{
|
||||
uint32_t fg_alpha = fg >> 24;
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
||||
uint32_t alpha = fg_alpha + (fg_alpha >> 7); // 255 -> 256
|
||||
uint32_t inv_alpha = 256 - alpha;
|
||||
|
||||
uint32_t bg_red = (bg >> 16) & 0xff;
|
||||
uint32_t bg_green = (bg >> 8) & 0xff;
|
||||
uint32_t bg_blue = bg & 0xff;
|
||||
|
||||
uint32_t red = clamp<uint32_t>(fg_red + (bg_red * inv_alpha) / 256, 0, 255);
|
||||
uint32_t green = clamp<uint32_t>(fg_green + (bg_green * inv_alpha) / 256, 0, 255);
|
||||
uint32_t blue = clamp<uint32_t>(fg_blue + (bg_blue * inv_alpha) / 256, 0, 255);
|
||||
|
||||
return 0xff000000 | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
|
||||
inline bool span_sampler_setup(const uint32_t * RESTRICT &source, int &xbits, int &ybits, fixed_t xstep, fixed_t ystep)
|
||||
{
|
||||
if (!r_bilinear)
|
||||
return false;
|
||||
|
||||
// Is this a magfilter or minfilter?
|
||||
fixed_t xmagnitude = abs(xstep) >> (32 - xbits - FRACBITS);
|
||||
fixed_t ymagnitude = abs(ystep) >> (32 - ybits - FRACBITS);
|
||||
fixed_t magnitude = (xmagnitude + ymagnitude) * 2 + (1 << (FRACBITS -1));
|
||||
if (magnitude >> FRACBITS == 0)
|
||||
return false;
|
||||
|
||||
if (r_mipmap)
|
||||
{
|
||||
int level = magnitude >> (FRACBITS + 1);
|
||||
while (level != 0)
|
||||
const PalEntry &color = GPalette.BaseColors[index];
|
||||
uint32_t alpha = color.d & 0xff000000;
|
||||
uint32_t red = color.r;
|
||||
uint32_t green = color.g;
|
||||
uint32_t blue = color.b;
|
||||
if (constants.simple_shade)
|
||||
{
|
||||
if (xbits <= 2 || ybits <= 2)
|
||||
break;
|
||||
|
||||
source += (1 << (xbits)) * (1 << (ybits));
|
||||
xbits -= 1;
|
||||
ybits -= 1;
|
||||
level >>= 1;
|
||||
red = red * light / 256;
|
||||
green = green * light / 256;
|
||||
blue = blue * light / 256;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t inv_light = 256 - light;
|
||||
uint32_t inv_desaturate = 256 - constants.desaturate;
|
||||
|
||||
uint32_t intensity = ((red * 77 + green * 143 + blue * 37) >> 8) * constants.desaturate;
|
||||
|
||||
red = (red * inv_desaturate + intensity) / 256;
|
||||
green = (green * inv_desaturate + intensity) / 256;
|
||||
blue = (blue * inv_desaturate + intensity) / 256;
|
||||
|
||||
red = (constants.fade_red * inv_light + red * light) / 256;
|
||||
green = (constants.fade_green * inv_light + green * light) / 256;
|
||||
blue = (constants.fade_blue * inv_light + blue * light) / 256;
|
||||
|
||||
red = (red * constants.light_red) / 256;
|
||||
green = (green * constants.light_green) / 256;
|
||||
blue = (blue * constants.light_blue) / 256;
|
||||
}
|
||||
return alpha | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
FORCEINLINE uint32_t sample_bilinear(const uint32_t *col0, const uint32_t *col1, uint32_t texturefracx, uint32_t texturefracy, int ybits)
|
||||
FORCEINLINE static uint32_t shade_bgra_simple(uint32_t color, uint32_t light)
|
||||
{
|
||||
uint32_t red = RPART(color) * light / 256;
|
||||
uint32_t green = GPART(color) * light / 256;
|
||||
uint32_t blue = BPART(color) * light / 256;
|
||||
return 0xff000000 | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
|
||||
FORCEINLINE static uint32_t shade_bgra(uint32_t color, uint32_t light, const ShadeConstants &constants)
|
||||
{
|
||||
uint32_t alpha = color & 0xff000000;
|
||||
uint32_t red = (color >> 16) & 0xff;
|
||||
uint32_t green = (color >> 8) & 0xff;
|
||||
uint32_t blue = color & 0xff;
|
||||
if (constants.simple_shade)
|
||||
{
|
||||
red = red * light / 256;
|
||||
green = green * light / 256;
|
||||
blue = blue * light / 256;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t inv_light = 256 - light;
|
||||
uint32_t inv_desaturate = 256 - constants.desaturate;
|
||||
|
||||
uint32_t intensity = ((red * 77 + green * 143 + blue * 37) >> 8) * constants.desaturate;
|
||||
|
||||
red = (red * inv_desaturate + intensity) / 256;
|
||||
green = (green * inv_desaturate + intensity) / 256;
|
||||
blue = (blue * inv_desaturate + intensity) / 256;
|
||||
|
||||
red = (constants.fade_red * inv_light + red * light) / 256;
|
||||
green = (constants.fade_green * inv_light + green * light) / 256;
|
||||
blue = (constants.fade_blue * inv_light + blue * light) / 256;
|
||||
|
||||
red = (red * constants.light_red) / 256;
|
||||
green = (green * constants.light_green) / 256;
|
||||
blue = (blue * constants.light_blue) / 256;
|
||||
}
|
||||
return alpha | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
};
|
||||
|
||||
class BlendBgra
|
||||
{
|
||||
uint32_t half = 1 << (ybits - 1);
|
||||
uint32_t y = (texturefracy - half) >> ybits;
|
||||
public:
|
||||
FORCEINLINE static uint32_t copy(uint32_t fg)
|
||||
{
|
||||
return fg;
|
||||
}
|
||||
|
||||
uint32_t p00 = col0[y];
|
||||
uint32_t p01 = col0[y + 1];
|
||||
uint32_t p10 = col1[y];
|
||||
uint32_t p11 = col1[y + 1];
|
||||
FORCEINLINE static uint32_t add(uint32_t fg, uint32_t bg, uint32_t srcalpha, uint32_t destalpha)
|
||||
{
|
||||
uint32_t red = MIN<uint32_t>((RPART(fg) * srcalpha + RPART(bg) * destalpha) >> 8, 255);
|
||||
uint32_t green = MIN<uint32_t>((GPART(fg) * srcalpha + GPART(bg) * destalpha) >> 8, 255);
|
||||
uint32_t blue = MIN<uint32_t>((BPART(fg) * srcalpha + BPART(bg) * destalpha) >> 8, 255);
|
||||
return 0xff000000 | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
|
||||
uint32_t inv_b = texturefracx;
|
||||
uint32_t inv_a = ((texturefracy + half) >> (ybits - 4)) & 15;
|
||||
uint32_t a = 16 - inv_a;
|
||||
uint32_t b = 16 - inv_b;
|
||||
FORCEINLINE static uint32_t sub(uint32_t fg, uint32_t bg, uint32_t srcalpha, uint32_t destalpha)
|
||||
{
|
||||
uint32_t red = clamp<uint32_t>((0x10000 - RPART(fg) * srcalpha + RPART(bg) * destalpha) >> 8, 256, 256 + 255) - 256;
|
||||
uint32_t green = clamp<uint32_t>((0x10000 - GPART(fg) * srcalpha + GPART(bg) * destalpha) >> 8, 256, 256 + 255) - 256;
|
||||
uint32_t blue = clamp<uint32_t>((0x10000 - BPART(fg) * srcalpha + BPART(bg) * destalpha) >> 8, 256, 256 + 255) - 256;
|
||||
return 0xff000000 | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
|
||||
uint32_t red = (RPART(p00) * a * b + RPART(p01) * inv_a * b + RPART(p10) * a * inv_b + RPART(p11) * inv_a * inv_b + 127) >> 8;
|
||||
uint32_t green = (GPART(p00) * a * b + GPART(p01) * inv_a * b + GPART(p10) * a * inv_b + GPART(p11) * inv_a * inv_b + 127) >> 8;
|
||||
uint32_t blue = (BPART(p00) * a * b + BPART(p01) * inv_a * b + BPART(p10) * a * inv_b + BPART(p11) * inv_a * inv_b + 127) >> 8;
|
||||
uint32_t alpha = (APART(p00) * a * b + APART(p01) * inv_a * b + APART(p10) * a * inv_b + APART(p11) * inv_a * inv_b + 127) >> 8;
|
||||
FORCEINLINE static uint32_t revsub(uint32_t fg, uint32_t bg, uint32_t srcalpha, uint32_t destalpha)
|
||||
{
|
||||
uint32_t red = clamp<uint32_t>((0x10000 + RPART(fg) * srcalpha - RPART(bg) * destalpha) >> 8, 256, 256 + 255) - 256;
|
||||
uint32_t green = clamp<uint32_t>((0x10000 + GPART(fg) * srcalpha - GPART(bg) * destalpha) >> 8, 256, 256 + 255) - 256;
|
||||
uint32_t blue = clamp<uint32_t>((0x10000 + BPART(fg) * srcalpha - BPART(bg) * destalpha) >> 8, 256, 256 + 255) - 256;
|
||||
return 0xff000000 | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
|
||||
return (alpha << 24) | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
FORCEINLINE static uint32_t alpha_blend(uint32_t fg, uint32_t bg)
|
||||
{
|
||||
uint32_t alpha = APART(fg) + (APART(fg) >> 7); // 255 -> 256
|
||||
uint32_t inv_alpha = 256 - alpha;
|
||||
uint32_t red = MIN<uint32_t>(RPART(fg) + (RPART(bg) * inv_alpha) / 256, 255);
|
||||
uint32_t green = MIN<uint32_t>(GPART(fg) + (GPART(bg) * inv_alpha) / 256, 255);
|
||||
uint32_t blue = MIN<uint32_t>(BPART(fg) + (BPART(bg) * inv_alpha) / 256, 255);
|
||||
return 0xff000000 | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
};
|
||||
|
||||
FORCEINLINE uint32_t sample_bilinear(const uint32_t *texture, dsfixed_t xfrac, dsfixed_t yfrac, int xbits, int ybits)
|
||||
class SampleBgra
|
||||
{
|
||||
int xshift = (32 - xbits);
|
||||
int yshift = (32 - ybits);
|
||||
int xmask = (1 << xshift) - 1;
|
||||
int ymask = (1 << yshift) - 1;
|
||||
uint32_t xhalf = 1 << (xbits - 1);
|
||||
uint32_t yhalf = 1 << (ybits - 1);
|
||||
uint32_t x = (xfrac - xhalf) >> xbits;
|
||||
uint32_t y = (yfrac - yhalf) >> ybits;
|
||||
public:
|
||||
inline static bool span_sampler_setup(const uint32_t * RESTRICT &source, int &xbits, int &ybits, fixed_t xstep, fixed_t ystep)
|
||||
{
|
||||
if (!r_bilinear)
|
||||
return false;
|
||||
|
||||
uint32_t p00 = texture[(y & ymask) + ((x & xmask) << yshift)];
|
||||
uint32_t p01 = texture[((y + 1) & ymask) + ((x & xmask) << yshift)];
|
||||
uint32_t p10 = texture[(y & ymask) + (((x + 1) & xmask) << yshift)];
|
||||
uint32_t p11 = texture[((y + 1) & ymask) + (((x + 1) & xmask) << yshift)];
|
||||
// Is this a magfilter or minfilter?
|
||||
fixed_t xmagnitude = abs(xstep) >> (32 - xbits - FRACBITS);
|
||||
fixed_t ymagnitude = abs(ystep) >> (32 - ybits - FRACBITS);
|
||||
fixed_t magnitude = (xmagnitude + ymagnitude) * 2 + (1 << (FRACBITS - 1));
|
||||
if (magnitude >> FRACBITS == 0)
|
||||
return false;
|
||||
|
||||
uint32_t inv_b = ((xfrac + xhalf) >> (xbits - 4)) & 15;
|
||||
uint32_t inv_a = ((yfrac + yhalf) >> (ybits - 4)) & 15;
|
||||
uint32_t a = 16 - inv_a;
|
||||
uint32_t b = 16 - inv_b;
|
||||
if (r_mipmap)
|
||||
{
|
||||
int level = magnitude >> (FRACBITS + 1);
|
||||
while (level != 0)
|
||||
{
|
||||
if (xbits <= 2 || ybits <= 2)
|
||||
break;
|
||||
|
||||
uint32_t red = (RPART(p00) * a * b + RPART(p01) * inv_a * b + RPART(p10) * a * inv_b + RPART(p11) * inv_a * inv_b + 127) >> 8;
|
||||
uint32_t green = (GPART(p00) * a * b + GPART(p01) * inv_a * b + GPART(p10) * a * inv_b + GPART(p11) * inv_a * inv_b + 127) >> 8;
|
||||
uint32_t blue = (BPART(p00) * a * b + BPART(p01) * inv_a * b + BPART(p10) * a * inv_b + BPART(p11) * inv_a * inv_b + 127) >> 8;
|
||||
uint32_t alpha = (APART(p00) * a * b + APART(p01) * inv_a * b + APART(p10) * a * inv_b + APART(p11) * inv_a * inv_b + 127) >> 8;
|
||||
source += (1 << (xbits)) * (1 << (ybits));
|
||||
xbits -= 1;
|
||||
ybits -= 1;
|
||||
level >>= 1;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return (alpha << 24) | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
FORCEINLINE static uint32_t sample_bilinear(const uint32_t *col0, const uint32_t *col1, uint32_t texturefracx, uint32_t texturefracy, int ybits, uint32_t ymax)
|
||||
{
|
||||
uint32_t half = 1 << (ybits - 1);
|
||||
uint32_t y0 = (texturefracy - half) >> ybits;
|
||||
if (y0 > ymax)
|
||||
y0 = 0;
|
||||
uint32_t y1 = y0 + 1;
|
||||
if (y1 > ymax)
|
||||
y1 = 0;
|
||||
|
||||
#define VEC_SAMPLE_BILINEAR4_COLUMN(fg, col0, col1, texturefracx, texturefracy, ybits) { \
|
||||
uint32_t p00 = col0[y0];
|
||||
uint32_t p01 = col0[y1];
|
||||
uint32_t p10 = col1[y0];
|
||||
uint32_t p11 = col1[y1];
|
||||
|
||||
uint32_t inv_b = texturefracx;
|
||||
uint32_t inv_a = ((texturefracy + half) >> (ybits - 4)) & 15;
|
||||
uint32_t a = 16 - inv_a;
|
||||
uint32_t b = 16 - inv_b;
|
||||
|
||||
uint32_t red = (RPART(p00) * a * b + RPART(p01) * inv_a * b + RPART(p10) * a * inv_b + RPART(p11) * inv_a * inv_b + 127) >> 8;
|
||||
uint32_t green = (GPART(p00) * a * b + GPART(p01) * inv_a * b + GPART(p10) * a * inv_b + GPART(p11) * inv_a * inv_b + 127) >> 8;
|
||||
uint32_t blue = (BPART(p00) * a * b + BPART(p01) * inv_a * b + BPART(p10) * a * inv_b + BPART(p11) * inv_a * inv_b + 127) >> 8;
|
||||
uint32_t alpha = (APART(p00) * a * b + APART(p01) * inv_a * b + APART(p10) * a * inv_b + APART(p11) * inv_a * inv_b + 127) >> 8;
|
||||
|
||||
return (alpha << 24) | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
|
||||
FORCEINLINE static uint32_t sample_bilinear(const uint32_t *texture, dsfixed_t xfrac, dsfixed_t yfrac, int xbits, int ybits)
|
||||
{
|
||||
int xshift = (32 - xbits);
|
||||
int yshift = (32 - ybits);
|
||||
int xmask = (1 << xshift) - 1;
|
||||
int ymask = (1 << yshift) - 1;
|
||||
uint32_t xhalf = 1 << (xbits - 1);
|
||||
uint32_t yhalf = 1 << (ybits - 1);
|
||||
uint32_t x = (xfrac - xhalf) >> xbits;
|
||||
uint32_t y = (yfrac - yhalf) >> ybits;
|
||||
|
||||
uint32_t p00 = texture[(y & ymask) + ((x & xmask) << yshift)];
|
||||
uint32_t p01 = texture[((y + 1) & ymask) + ((x & xmask) << yshift)];
|
||||
uint32_t p10 = texture[(y & ymask) + (((x + 1) & xmask) << yshift)];
|
||||
uint32_t p11 = texture[((y + 1) & ymask) + (((x + 1) & xmask) << yshift)];
|
||||
|
||||
uint32_t inv_b = ((xfrac + xhalf) >> (xbits - 4)) & 15;
|
||||
uint32_t inv_a = ((yfrac + yhalf) >> (ybits - 4)) & 15;
|
||||
uint32_t a = 16 - inv_a;
|
||||
uint32_t b = 16 - inv_b;
|
||||
|
||||
uint32_t red = (RPART(p00) * a * b + RPART(p01) * inv_a * b + RPART(p10) * a * inv_b + RPART(p11) * inv_a * inv_b + 127) >> 8;
|
||||
uint32_t green = (GPART(p00) * a * b + GPART(p01) * inv_a * b + GPART(p10) * a * inv_b + GPART(p11) * inv_a * inv_b + 127) >> 8;
|
||||
uint32_t blue = (BPART(p00) * a * b + BPART(p01) * inv_a * b + BPART(p10) * a * inv_b + BPART(p11) * inv_a * inv_b + 127) >> 8;
|
||||
uint32_t alpha = (APART(p00) * a * b + APART(p01) * inv_a * b + APART(p10) * a * inv_b + APART(p11) * inv_a * inv_b + 127) >> 8;
|
||||
|
||||
return (alpha << 24) | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// SSE/AVX shading macros:
|
||||
|
||||
#define VEC_SAMPLE_BILINEAR4_COLUMN(fg, col0, col1, texturefracx, texturefracy, ybits, ymax) { \
|
||||
uint32_t half = 1 << (ybits - 1); \
|
||||
\
|
||||
__m128i m127 = _mm_set1_epi16(127); \
|
||||
fg = _mm_setzero_si128(); \
|
||||
for (int i = 0; i < 4; i++) \
|
||||
{ \
|
||||
uint32_t y = (texturefracy[i] - half) >> ybits; \
|
||||
uint32_t y0 = (texturefracy[i] - half) >> ybits; \
|
||||
if (y0 > ymax) y0 = 0; \
|
||||
uint32_t y1 = y0 + 1; \
|
||||
if (y1 > ymax) y1 = 0; \
|
||||
\
|
||||
uint32_t inv_b = texturefracx[i]; \
|
||||
uint32_t inv_a = ((texturefracy[i] + half) >> (ybits - 4)) & 15; \
|
||||
|
@ -537,8 +573,8 @@ FORCEINLINE uint32_t sample_bilinear(const uint32_t *texture, dsfixed_t xfrac, d
|
|||
__m128i ab_invab = _mm_set_epi16(invab, invab, invab, invab, ab, ab, ab, ab); \
|
||||
__m128i ainvb_invainvb = _mm_set_epi16(invainvb, invainvb, invainvb, invainvb, ainvb, ainvb, ainvb, ainvb); \
|
||||
\
|
||||
__m128i p0 = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i*)(col0[i] + y)), _mm_setzero_si128()); \
|
||||
__m128i p1 = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i*)(col1[i] + y)), _mm_setzero_si128()); \
|
||||
__m128i p0 = _mm_unpacklo_epi8(_mm_set_epi32(0, 0, col0[i][y1], col0[i][y0]), _mm_setzero_si128()); \
|
||||
__m128i p1 = _mm_unpacklo_epi8(_mm_set_epi32(0, 0, col1[i][y1], col1[i][y0]), _mm_setzero_si128()); \
|
||||
\
|
||||
__m128i tmp = _mm_adds_epu16(_mm_mullo_epi16(p0, ab_invab), _mm_mullo_epi16(p1, ainvb_invainvb)); \
|
||||
__m128i color = _mm_srli_epi16(_mm_adds_epu16(_mm_adds_epu16(_mm_srli_si128(tmp, 8), tmp), m127), 8); \
|
||||
|
@ -758,12 +794,16 @@ FORCEINLINE uint32_t calc_blend_bgalpha(uint32_t fg, uint32_t dest_alpha)
|
|||
{
|
||||
uint32_t alpha = fg >> 24;
|
||||
alpha += alpha >> 7;
|
||||
return 256 - alpha; // (dest_alpha * (256 - alpha)) >> 8;
|
||||
uint32_t inv_alpha = 256 - alpha;
|
||||
return (dest_alpha * alpha + 256 * inv_alpha + 128) >> 8;
|
||||
}
|
||||
|
||||
#define VEC_CALC_BLEND_ALPHA_INIT(src_alpha, dest_alpha) \
|
||||
__m128i msrc_alpha = _mm_set1_epi16(src_alpha); \
|
||||
__m128i mdest_alpha = _mm_set1_epi16(dest_alpha);
|
||||
__m128i mdest_alpha = _mm_set1_epi16(dest_alpha * 255 / 256); \
|
||||
__m128i m256 = _mm_set1_epi16(256); \
|
||||
__m128i m255 = _mm_set1_epi16(255); \
|
||||
__m128i m128 = _mm_set1_epi16(128);
|
||||
|
||||
// Calculates the final alpha values to be used when combined with the source texture alpha channel
|
||||
#define VEC_CALC_BLEND_ALPHA(fg) \
|
||||
|
@ -772,8 +812,10 @@ FORCEINLINE uint32_t calc_blend_bgalpha(uint32_t fg, uint32_t dest_alpha)
|
|||
__m128i alpha_lo = _mm_shufflehi_epi16(_mm_shufflelo_epi16(_mm_unpacklo_epi8(fg, _mm_setzero_si128()), _MM_SHUFFLE(3, 3, 3, 3)), _MM_SHUFFLE(3, 3, 3, 3)); \
|
||||
alpha_hi = _mm_add_epi16(alpha_hi, _mm_srli_epi16(alpha_hi, 7)); \
|
||||
alpha_lo = _mm_add_epi16(alpha_lo, _mm_srli_epi16(alpha_lo, 7)); \
|
||||
bg_alpha_hi = _mm_sub_epi16(_mm_set1_epi16(256), alpha_hi); /* _mm_srli_epi16(_mm_mullo_epi16(_mm_sub_epi16(_mm_set1_epi16(256), alpha_hi), mdest_alpha), 8);*/ \
|
||||
bg_alpha_lo = _mm_sub_epi16(_mm_set1_epi16(256), alpha_lo); /* _mm_srli_epi16(_mm_mullo_epi16(_mm_sub_epi16(_mm_set1_epi16(256), alpha_lo), mdest_alpha), 8);*/ \
|
||||
bg_alpha_hi = _mm_srli_epi16(_mm_adds_epu16(_mm_adds_epu16(_mm_mullo_epi16(mdest_alpha, alpha_hi), _mm_mullo_epi16(m255, _mm_sub_epi16(m256, alpha_hi))), m128), 8); \
|
||||
bg_alpha_hi = _mm_add_epi16(bg_alpha_hi, _mm_srli_epi16(bg_alpha_hi, 7)); \
|
||||
bg_alpha_lo = _mm_srli_epi16(_mm_adds_epu16(_mm_adds_epu16(_mm_mullo_epi16(mdest_alpha, alpha_lo), _mm_mullo_epi16(m255, _mm_sub_epi16(m256, alpha_lo))), m128), 8); \
|
||||
bg_alpha_lo = _mm_add_epi16(bg_alpha_lo, _mm_srli_epi16(bg_alpha_lo, 7)); \
|
||||
fg_alpha_hi = msrc_alpha; \
|
||||
fg_alpha_lo = msrc_alpha; \
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
_destorg = dc_destorg;
|
||||
_light = ds_light;
|
||||
_shade_constants = ds_shade_constants;
|
||||
_magnifying = !span_sampler_setup(_source, _xbits, _ybits, _xstep, _ystep);
|
||||
_magnifying = !SampleBgra::span_sampler_setup(_source, _xbits, _ybits, _xstep, _ystep);
|
||||
}
|
||||
|
||||
void Execute(DrawerThread *thread) override
|
||||
|
@ -70,7 +70,7 @@ public:
|
|||
xstep = _xstep;
|
||||
ystep = _ystep;
|
||||
|
||||
uint32_t light = calc_light_multiplier(_light);
|
||||
uint32_t light = LightBgra::calc_light_multiplier(_light);
|
||||
ShadeConstants shade_constants = _shade_constants;
|
||||
|
||||
if (_magnifying)
|
||||
|
@ -166,7 +166,7 @@ public:
|
|||
spot = ((xfrac >> (32 - 6 - 6))&(63 * 64)) + (yfrac >> (32 - 6));
|
||||
|
||||
// Lookup pixel from flat texture tile
|
||||
*dest++ = shade_bgra(source[spot], light, shade_constants);
|
||||
*dest++ = LightBgra::shade_bgra(source[spot], light, shade_constants);
|
||||
|
||||
// Next step in u,v.
|
||||
xfrac += xstep;
|
||||
|
@ -258,7 +258,7 @@ public:
|
|||
spot = ((xfrac >> xshift) & xmask) + (yfrac >> yshift);
|
||||
|
||||
// Lookup pixel from flat texture tile
|
||||
*dest++ = shade_bgra(source[spot], light, shade_constants);
|
||||
*dest++ = LightBgra::shade_bgra(source[spot], light, shade_constants);
|
||||
|
||||
// Next step in u,v.
|
||||
xfrac += xstep;
|
||||
|
@ -305,7 +305,7 @@ public:
|
|||
|
||||
do
|
||||
{
|
||||
*dest++ = shade_bgra(sample_bilinear(source, xfrac, yfrac, 26, 26), light, shade_constants);
|
||||
*dest++ = LightBgra::shade_bgra(SampleBgra::sample_bilinear(source, xfrac, yfrac, 26, 26), light, shade_constants);
|
||||
xfrac += xstep;
|
||||
yfrac += ystep;
|
||||
} while (--count);
|
||||
|
@ -349,7 +349,7 @@ public:
|
|||
|
||||
do
|
||||
{
|
||||
*dest++ = shade_bgra(sample_bilinear(source, xfrac, yfrac, 32 - _xbits, 32 - _ybits), light, shade_constants);
|
||||
*dest++ = LightBgra::shade_bgra(SampleBgra::sample_bilinear(source, xfrac, yfrac, 32 - _xbits, 32 - _ybits), light, shade_constants);
|
||||
xfrac += xstep;
|
||||
yfrac += ystep;
|
||||
} while (--count);
|
||||
|
@ -364,7 +364,8 @@ class VecCommand(Vlinec4RGBA) : public DrawerCommand
|
|||
int _count;
|
||||
int _pitch;
|
||||
ShadeConstants _shade_constants;
|
||||
int vlinebits;
|
||||
int _vlinebits;
|
||||
uint32_t _vlinemax;
|
||||
fixed_t palookuplight[4];
|
||||
DWORD vplce[4];
|
||||
DWORD vince[4];
|
||||
|
@ -379,7 +380,8 @@ public:
|
|||
_count = dc_count;
|
||||
_pitch = dc_pitch;
|
||||
_shade_constants = dc_shade_constants;
|
||||
vlinebits = ::vlinebits;
|
||||
_vlinebits = vlinebits;
|
||||
_vlinemax = vlinemax;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
palookuplight[i] = ::palookuplight[i];
|
||||
|
@ -398,13 +400,13 @@ public:
|
|||
return;
|
||||
|
||||
uint32_t *dest = thread->dest_for_thread(_dest_y, _pitch, (uint32_t*)_dest);
|
||||
int bits = vlinebits;
|
||||
int bits = _vlinebits;
|
||||
int pitch = _pitch * thread->num_cores;
|
||||
|
||||
uint32_t light0 = calc_light_multiplier(palookuplight[0]);
|
||||
uint32_t light1 = calc_light_multiplier(palookuplight[1]);
|
||||
uint32_t light2 = calc_light_multiplier(palookuplight[2]);
|
||||
uint32_t light3 = calc_light_multiplier(palookuplight[3]);
|
||||
uint32_t light0 = LightBgra::calc_light_multiplier(palookuplight[0]);
|
||||
uint32_t light1 = LightBgra::calc_light_multiplier(palookuplight[1]);
|
||||
uint32_t light2 = LightBgra::calc_light_multiplier(palookuplight[2]);
|
||||
uint32_t light3 = LightBgra::calc_light_multiplier(palookuplight[3]);
|
||||
|
||||
ShadeConstants shade_constants = _shade_constants;
|
||||
|
||||
|
@ -480,7 +482,7 @@ public:
|
|||
do
|
||||
{
|
||||
__m128i fg;
|
||||
VEC_SAMPLE_BILINEAR4_COLUMN(fg, bufplce, bufplce2, buftexturefracx, local_vplce, bits);
|
||||
VEC_SAMPLE_BILINEAR4_COLUMN(fg, bufplce, bufplce2, buftexturefracx, local_vplce, bits, _vlinemax);
|
||||
|
||||
local_vplce[0] = local_vplce[0] + local_vince[0];
|
||||
local_vplce[1] = local_vplce[1] + local_vince[1];
|
||||
|
@ -498,7 +500,7 @@ public:
|
|||
do
|
||||
{
|
||||
__m128i fg;
|
||||
VEC_SAMPLE_BILINEAR4_COLUMN(fg, bufplce, bufplce2, buftexturefracx, local_vplce, bits);
|
||||
VEC_SAMPLE_BILINEAR4_COLUMN(fg, bufplce, bufplce2, buftexturefracx, local_vplce, bits, _vlinemax);
|
||||
|
||||
local_vplce[0] = local_vplce[0] + local_vince[0];
|
||||
local_vplce[1] = local_vplce[1] + local_vince[1];
|
||||
|
@ -520,7 +522,8 @@ class VecCommand(Mvlinec4RGBA) : public DrawerCommand
|
|||
int _count;
|
||||
int _pitch;
|
||||
ShadeConstants _shade_constants;
|
||||
int mvlinebits;
|
||||
int _mvlinebits;
|
||||
uint32_t _mvlinemax;
|
||||
fixed_t palookuplight[4];
|
||||
DWORD vplce[4];
|
||||
DWORD vince[4];
|
||||
|
@ -535,7 +538,8 @@ public:
|
|||
_count = dc_count;
|
||||
_pitch = dc_pitch;
|
||||
_shade_constants = dc_shade_constants;
|
||||
mvlinebits = ::mvlinebits;
|
||||
_mvlinebits = mvlinebits;
|
||||
_mvlinemax = mvlinemax;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
palookuplight[i] = ::palookuplight[i];
|
||||
|
@ -555,12 +559,12 @@ public:
|
|||
|
||||
uint32_t *dest = thread->dest_for_thread(_dest_y, _pitch, (uint32_t*)_dest);
|
||||
int pitch = _pitch * thread->num_cores;
|
||||
int bits = mvlinebits;
|
||||
int bits = _mvlinebits;
|
||||
|
||||
uint32_t light0 = calc_light_multiplier(palookuplight[0]);
|
||||
uint32_t light1 = calc_light_multiplier(palookuplight[1]);
|
||||
uint32_t light2 = calc_light_multiplier(palookuplight[2]);
|
||||
uint32_t light3 = calc_light_multiplier(palookuplight[3]);
|
||||
uint32_t light0 = LightBgra::calc_light_multiplier(palookuplight[0]);
|
||||
uint32_t light1 = LightBgra::calc_light_multiplier(palookuplight[1]);
|
||||
uint32_t light2 = LightBgra::calc_light_multiplier(palookuplight[2]);
|
||||
uint32_t light3 = LightBgra::calc_light_multiplier(palookuplight[3]);
|
||||
|
||||
ShadeConstants shade_constants = _shade_constants;
|
||||
|
||||
|
@ -640,7 +644,7 @@ public:
|
|||
do
|
||||
{
|
||||
__m128i fg;
|
||||
VEC_SAMPLE_BILINEAR4_COLUMN(fg, bufplce, bufplce2, buftexturefracx, local_vplce, bits);
|
||||
VEC_SAMPLE_BILINEAR4_COLUMN(fg, bufplce, bufplce2, buftexturefracx, local_vplce, bits, _mvlinemax);
|
||||
|
||||
local_vplce[0] = local_vplce[0] + local_vince[0];
|
||||
local_vplce[1] = local_vplce[1] + local_vince[1];
|
||||
|
@ -660,7 +664,7 @@ public:
|
|||
do
|
||||
{
|
||||
__m128i fg;
|
||||
VEC_SAMPLE_BILINEAR4_COLUMN(fg, bufplce, bufplce2, buftexturefracx, local_vplce, bits);
|
||||
VEC_SAMPLE_BILINEAR4_COLUMN(fg, bufplce, bufplce2, buftexturefracx, local_vplce, bits, _mvlinemax);
|
||||
|
||||
local_vplce[0] = local_vplce[0] + local_vince[0];
|
||||
local_vplce[1] = local_vplce[1] + local_vince[1];
|
||||
|
@ -686,7 +690,8 @@ class VecCommand(Tmvline4AddRGBA) : public DrawerCommand
|
|||
ShadeConstants _shade_constants;
|
||||
fixed_t _srcalpha;
|
||||
fixed_t _destalpha;
|
||||
int tmvlinebits;
|
||||
int _tmvlinebits;
|
||||
uint32_t _tmvlinemax;
|
||||
fixed_t palookuplight[4];
|
||||
DWORD vplce[4];
|
||||
DWORD vince[4];
|
||||
|
@ -701,7 +706,8 @@ public:
|
|||
_shade_constants = dc_shade_constants;
|
||||
_srcalpha = dc_srcalpha;
|
||||
_destalpha = dc_destalpha;
|
||||
tmvlinebits = ::tmvlinebits;
|
||||
_tmvlinebits = tmvlinebits;
|
||||
_tmvlinemax = tmvlinemax;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
palookuplight[i] = ::palookuplight[i];
|
||||
|
@ -719,13 +725,13 @@ public:
|
|||
|
||||
uint32_t *dest = thread->dest_for_thread(_dest_y, _pitch, (uint32_t*)_dest);
|
||||
int pitch = _pitch * thread->num_cores;
|
||||
int bits = tmvlinebits;
|
||||
int bits = _tmvlinebits;
|
||||
|
||||
uint32_t light[4];
|
||||
light[0] = calc_light_multiplier(palookuplight[0]);
|
||||
light[1] = calc_light_multiplier(palookuplight[1]);
|
||||
light[2] = calc_light_multiplier(palookuplight[2]);
|
||||
light[3] = calc_light_multiplier(palookuplight[3]);
|
||||
light[0] = LightBgra::calc_light_multiplier(palookuplight[0]);
|
||||
light[1] = LightBgra::calc_light_multiplier(palookuplight[1]);
|
||||
light[2] = LightBgra::calc_light_multiplier(palookuplight[2]);
|
||||
light[3] = LightBgra::calc_light_multiplier(palookuplight[3]);
|
||||
|
||||
ShadeConstants shade_constants = _shade_constants;
|
||||
|
||||
|
@ -825,7 +831,8 @@ class VecCommand(Tmvline4AddClampRGBA) : public DrawerCommand
|
|||
ShadeConstants _shade_constants;
|
||||
fixed_t _srcalpha;
|
||||
fixed_t _destalpha;
|
||||
int tmvlinebits;
|
||||
int _tmvlinebits;
|
||||
uint32_t _tmvlinemax;
|
||||
fixed_t palookuplight[4];
|
||||
DWORD vplce[4];
|
||||
DWORD vince[4];
|
||||
|
@ -840,7 +847,8 @@ public:
|
|||
_shade_constants = dc_shade_constants;
|
||||
_srcalpha = dc_srcalpha;
|
||||
_destalpha = dc_destalpha;
|
||||
tmvlinebits = ::tmvlinebits;
|
||||
_tmvlinebits = tmvlinebits;
|
||||
_tmvlinemax = tmvlinemax;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
palookuplight[i] = ::palookuplight[i];
|
||||
|
@ -858,13 +866,13 @@ public:
|
|||
|
||||
uint32_t *dest = thread->dest_for_thread(_dest_y, _pitch, (uint32_t*)_dest);
|
||||
int pitch = _pitch * thread->num_cores;
|
||||
int bits = tmvlinebits;
|
||||
int bits = _tmvlinebits;
|
||||
|
||||
uint32_t light[4];
|
||||
light[0] = calc_light_multiplier(palookuplight[0]);
|
||||
light[1] = calc_light_multiplier(palookuplight[1]);
|
||||
light[2] = calc_light_multiplier(palookuplight[2]);
|
||||
light[3] = calc_light_multiplier(palookuplight[3]);
|
||||
light[0] = LightBgra::calc_light_multiplier(palookuplight[0]);
|
||||
light[1] = LightBgra::calc_light_multiplier(palookuplight[1]);
|
||||
light[2] = LightBgra::calc_light_multiplier(palookuplight[2]);
|
||||
light[3] = LightBgra::calc_light_multiplier(palookuplight[3]);
|
||||
|
||||
ShadeConstants shade_constants = _shade_constants;
|
||||
|
||||
|
@ -963,7 +971,8 @@ class VecCommand(Tmvline4SubClampRGBA) : public DrawerCommand
|
|||
ShadeConstants _shade_constants;
|
||||
fixed_t _srcalpha;
|
||||
fixed_t _destalpha;
|
||||
int tmvlinebits;
|
||||
int _tmvlinebits;
|
||||
uint32_t _tmvlinemax;
|
||||
fixed_t palookuplight[4];
|
||||
DWORD vplce[4];
|
||||
DWORD vince[4];
|
||||
|
@ -978,7 +987,8 @@ public:
|
|||
_shade_constants = dc_shade_constants;
|
||||
_srcalpha = dc_srcalpha;
|
||||
_destalpha = dc_destalpha;
|
||||
tmvlinebits = ::tmvlinebits;
|
||||
_tmvlinebits = tmvlinebits;
|
||||
_tmvlinemax = tmvlinemax;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
palookuplight[i] = ::palookuplight[i];
|
||||
|
@ -996,13 +1006,13 @@ public:
|
|||
|
||||
uint32_t *dest = thread->dest_for_thread(_dest_y, _pitch, (uint32_t*)_dest);
|
||||
int pitch = _pitch * thread->num_cores;
|
||||
int bits = tmvlinebits;
|
||||
int bits = _tmvlinebits;
|
||||
|
||||
uint32_t light[4];
|
||||
light[0] = calc_light_multiplier(palookuplight[0]);
|
||||
light[1] = calc_light_multiplier(palookuplight[1]);
|
||||
light[2] = calc_light_multiplier(palookuplight[2]);
|
||||
light[3] = calc_light_multiplier(palookuplight[3]);
|
||||
light[0] = LightBgra::calc_light_multiplier(palookuplight[0]);
|
||||
light[1] = LightBgra::calc_light_multiplier(palookuplight[1]);
|
||||
light[2] = LightBgra::calc_light_multiplier(palookuplight[2]);
|
||||
light[3] = LightBgra::calc_light_multiplier(palookuplight[3]);
|
||||
|
||||
ShadeConstants shade_constants = _shade_constants;
|
||||
|
||||
|
@ -1101,7 +1111,8 @@ class VecCommand(Tmvline4RevSubClampRGBA) : public DrawerCommand
|
|||
ShadeConstants _shade_constants;
|
||||
fixed_t _srcalpha;
|
||||
fixed_t _destalpha;
|
||||
int tmvlinebits;
|
||||
int _tmvlinebits;
|
||||
uint32_t _tmvlinemax;
|
||||
fixed_t palookuplight[4];
|
||||
DWORD vplce[4];
|
||||
DWORD vince[4];
|
||||
|
@ -1116,7 +1127,8 @@ public:
|
|||
_shade_constants = dc_shade_constants;
|
||||
_srcalpha = dc_srcalpha;
|
||||
_destalpha = dc_destalpha;
|
||||
tmvlinebits = ::tmvlinebits;
|
||||
_tmvlinebits = tmvlinebits;
|
||||
_tmvlinemax = tmvlinemax;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
palookuplight[i] = ::palookuplight[i];
|
||||
|
@ -1134,13 +1146,13 @@ public:
|
|||
|
||||
uint32_t *dest = thread->dest_for_thread(_dest_y, _pitch, (uint32_t*)_dest);
|
||||
int pitch = _pitch * thread->num_cores;
|
||||
int bits = tmvlinebits;
|
||||
int bits = _tmvlinebits;
|
||||
|
||||
uint32_t light[4];
|
||||
light[0] = calc_light_multiplier(palookuplight[0]);
|
||||
light[1] = calc_light_multiplier(palookuplight[1]);
|
||||
light[2] = calc_light_multiplier(palookuplight[2]);
|
||||
light[3] = calc_light_multiplier(palookuplight[3]);
|
||||
light[0] = LightBgra::calc_light_multiplier(palookuplight[0]);
|
||||
light[1] = LightBgra::calc_light_multiplier(palookuplight[1]);
|
||||
light[2] = LightBgra::calc_light_multiplier(palookuplight[2]);
|
||||
light[3] = LightBgra::calc_light_multiplier(palookuplight[3]);
|
||||
|
||||
ShadeConstants shade_constants = _shade_constants;
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ public:
|
|||
if (count <= 0)
|
||||
return;
|
||||
|
||||
uint32_t light = calc_light_multiplier(_light);
|
||||
uint32_t light = LightBgra::calc_light_multiplier(_light);
|
||||
ShadeConstants shade_constants = _shade_constants;
|
||||
|
||||
dest = thread->dest_for_thread(yl, _pitch, ylookup[yl] + sx + (uint32_t*)_destorg);
|
||||
|
@ -196,7 +196,7 @@ public:
|
|||
BYTE *colormap = _colormap;
|
||||
|
||||
if (count & 1) {
|
||||
*dest = shade_pal_index(colormap[*source], light, shade_constants);
|
||||
*dest = LightBgra::shade_pal_index(colormap[*source], light, shade_constants);
|
||||
source += sincr;
|
||||
dest += pitch;
|
||||
}
|
||||
|
@ -204,8 +204,8 @@ public:
|
|||
return;
|
||||
|
||||
do {
|
||||
dest[0] = shade_pal_index(colormap[source[0]], light, shade_constants);
|
||||
dest[pitch] = shade_pal_index(colormap[source[sincr]], light, shade_constants);
|
||||
dest[0] = LightBgra::shade_pal_index(colormap[source[0]], light, shade_constants);
|
||||
dest[pitch] = LightBgra::shade_pal_index(colormap[source[sincr]], light, shade_constants);
|
||||
source += sincr * 2;
|
||||
dest += pitch * 2;
|
||||
} while (--count);
|
||||
|
@ -249,7 +249,7 @@ public:
|
|||
if (count <= 0)
|
||||
return;
|
||||
|
||||
uint32_t light = calc_light_multiplier(_light);
|
||||
uint32_t light = LightBgra::calc_light_multiplier(_light);
|
||||
ShadeConstants shade_constants = _shade_constants;
|
||||
|
||||
dest = thread->dest_for_thread(yl, _pitch, ylookup[yl] + sx + (uint32_t*)_destorg);
|
||||
|
@ -260,10 +260,10 @@ public:
|
|||
BYTE *colormap = _colormap;
|
||||
|
||||
if (count & 1) {
|
||||
dest[0] = shade_pal_index(colormap[source[0]], light, shade_constants);
|
||||
dest[1] = shade_pal_index(colormap[source[1]], light, shade_constants);
|
||||
dest[2] = shade_pal_index(colormap[source[2]], light, shade_constants);
|
||||
dest[3] = shade_pal_index(colormap[source[3]], light, shade_constants);
|
||||
dest[0] = LightBgra::shade_pal_index(colormap[source[0]], light, shade_constants);
|
||||
dest[1] = LightBgra::shade_pal_index(colormap[source[1]], light, shade_constants);
|
||||
dest[2] = LightBgra::shade_pal_index(colormap[source[2]], light, shade_constants);
|
||||
dest[3] = LightBgra::shade_pal_index(colormap[source[3]], light, shade_constants);
|
||||
source += sincr;
|
||||
dest += pitch;
|
||||
}
|
||||
|
@ -271,14 +271,14 @@ public:
|
|||
return;
|
||||
|
||||
do {
|
||||
dest[0] = shade_pal_index(colormap[source[0]], light, shade_constants);
|
||||
dest[1] = shade_pal_index(colormap[source[1]], light, shade_constants);
|
||||
dest[2] = shade_pal_index(colormap[source[2]], light, shade_constants);
|
||||
dest[3] = shade_pal_index(colormap[source[3]], light, shade_constants);
|
||||
dest[pitch] = shade_pal_index(colormap[source[sincr]], light, shade_constants);
|
||||
dest[pitch + 1] = shade_pal_index(colormap[source[sincr + 1]], light, shade_constants);
|
||||
dest[pitch + 2] = shade_pal_index(colormap[source[sincr + 2]], light, shade_constants);
|
||||
dest[pitch + 3] = shade_pal_index(colormap[source[sincr + 3]], light, shade_constants);
|
||||
dest[0] = LightBgra::shade_pal_index(colormap[source[0]], light, shade_constants);
|
||||
dest[1] = LightBgra::shade_pal_index(colormap[source[1]], light, shade_constants);
|
||||
dest[2] = LightBgra::shade_pal_index(colormap[source[2]], light, shade_constants);
|
||||
dest[3] = LightBgra::shade_pal_index(colormap[source[3]], light, shade_constants);
|
||||
dest[pitch] = LightBgra::shade_pal_index(colormap[source[sincr]], light, shade_constants);
|
||||
dest[pitch + 1] = LightBgra::shade_pal_index(colormap[source[sincr + 1]], light, shade_constants);
|
||||
dest[pitch + 2] = LightBgra::shade_pal_index(colormap[source[sincr + 2]], light, shade_constants);
|
||||
dest[pitch + 3] = LightBgra::shade_pal_index(colormap[source[sincr + 3]], light, shade_constants);
|
||||
source += sincr * 2;
|
||||
dest += pitch * 2;
|
||||
} while (--count);
|
||||
|
@ -453,7 +453,7 @@ public:
|
|||
pitch = _pitch * thread->num_cores;
|
||||
sincr = 4 * thread->num_cores;
|
||||
|
||||
uint32_t light = calc_light_multiplier(_light);
|
||||
uint32_t light = LightBgra::calc_light_multiplier(_light);
|
||||
ShadeConstants shade_constants = _shade_constants;
|
||||
BYTE *colormap = _colormap;
|
||||
|
||||
|
@ -461,7 +461,7 @@ public:
|
|||
uint32_t bg_alpha = _destalpha >> (FRACBITS - 8);
|
||||
|
||||
do {
|
||||
uint32_t fg = shade_pal_index(colormap[*source], light, shade_constants);
|
||||
uint32_t fg = LightBgra::shade_pal_index(colormap[*source], light, shade_constants);
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
@ -528,7 +528,7 @@ public:
|
|||
pitch = _pitch * thread->num_cores;
|
||||
sincr = 4 * thread->num_cores;
|
||||
|
||||
uint32_t light = calc_light_multiplier(_light);
|
||||
uint32_t light = LightBgra::calc_light_multiplier(_light);
|
||||
ShadeConstants shade_constants = _shade_constants;
|
||||
BYTE *colormap = _colormap;
|
||||
|
||||
|
@ -538,7 +538,7 @@ public:
|
|||
do {
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
uint32_t fg = shade_pal_index(colormap[source[i]], light, shade_constants);
|
||||
uint32_t fg = LightBgra::shade_pal_index(colormap[source[i]], light, shade_constants);
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
@ -606,7 +606,7 @@ public:
|
|||
pitch = _pitch * thread->num_cores;
|
||||
sincr = 4 * thread->num_cores;
|
||||
|
||||
uint32_t fg = shade_pal_index_simple(_color, calc_light_multiplier(_light));
|
||||
uint32_t fg = LightBgra::shade_pal_index_simple(_color, LightBgra::calc_light_multiplier(_light));
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
@ -674,7 +674,7 @@ public:
|
|||
pitch = _pitch * thread->num_cores;
|
||||
sincr = 4 * thread->num_cores;
|
||||
|
||||
uint32_t fg = shade_pal_index_simple(_color, calc_light_multiplier(_light));
|
||||
uint32_t fg = LightBgra::shade_pal_index_simple(_color, LightBgra::calc_light_multiplier(_light));
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
@ -747,14 +747,14 @@ public:
|
|||
pitch = _pitch * thread->num_cores;
|
||||
sincr = 4 * thread->num_cores;
|
||||
|
||||
uint32_t light = calc_light_multiplier(_light);
|
||||
uint32_t light = LightBgra::calc_light_multiplier(_light);
|
||||
ShadeConstants shade_constants = _shade_constants;
|
||||
|
||||
uint32_t fg_alpha = _srcalpha >> (FRACBITS - 8);
|
||||
uint32_t bg_alpha = _destalpha >> (FRACBITS - 8);
|
||||
|
||||
do {
|
||||
uint32_t fg = shade_pal_index(*source, light, shade_constants);
|
||||
uint32_t fg = LightBgra::shade_pal_index(*source, light, shade_constants);
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
@ -818,7 +818,7 @@ public:
|
|||
pitch = _pitch * thread->num_cores;
|
||||
sincr = 4 * thread->num_cores;
|
||||
|
||||
uint32_t light = calc_light_multiplier(_light);
|
||||
uint32_t light = LightBgra::calc_light_multiplier(_light);
|
||||
ShadeConstants shade_constants = _shade_constants;
|
||||
|
||||
uint32_t fg_alpha = _srcalpha >> (FRACBITS - 8);
|
||||
|
@ -827,7 +827,7 @@ public:
|
|||
do {
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
uint32_t fg = shade_pal_index(source[i], light, shade_constants);
|
||||
uint32_t fg = LightBgra::shade_pal_index(source[i], light, shade_constants);
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
@ -894,14 +894,14 @@ public:
|
|||
pitch = _pitch * thread->num_cores;
|
||||
sincr = 4 * thread->num_cores;
|
||||
|
||||
uint32_t light = calc_light_multiplier(_light);
|
||||
uint32_t light = LightBgra::calc_light_multiplier(_light);
|
||||
ShadeConstants shade_constants = _shade_constants;
|
||||
|
||||
uint32_t fg_alpha = _srcalpha >> (FRACBITS - 8);
|
||||
uint32_t bg_alpha = _destalpha >> (FRACBITS - 8);
|
||||
|
||||
do {
|
||||
uint32_t fg = shade_pal_index(*source, light, shade_constants);
|
||||
uint32_t fg = LightBgra::shade_pal_index(*source, light, shade_constants);
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
@ -965,7 +965,7 @@ public:
|
|||
pitch = _pitch * thread->num_cores;
|
||||
sincr = 4 * thread->num_cores;
|
||||
|
||||
uint32_t light = calc_light_multiplier(_light);
|
||||
uint32_t light = LightBgra::calc_light_multiplier(_light);
|
||||
ShadeConstants shade_constants = _shade_constants;
|
||||
|
||||
uint32_t fg_alpha = _srcalpha >> (FRACBITS - 8);
|
||||
|
@ -974,7 +974,7 @@ public:
|
|||
do {
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
uint32_t fg = shade_pal_index(source[i], light, shade_constants);
|
||||
uint32_t fg = LightBgra::shade_pal_index(source[i], light, shade_constants);
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
@ -1042,14 +1042,14 @@ public:
|
|||
pitch = _pitch * thread->num_cores;
|
||||
sincr = 4 * thread->num_cores;
|
||||
|
||||
uint32_t light = calc_light_multiplier(_light);
|
||||
uint32_t light = LightBgra::calc_light_multiplier(_light);
|
||||
ShadeConstants shade_constants = _shade_constants;
|
||||
|
||||
uint32_t fg_alpha = _srcalpha >> (FRACBITS - 8);
|
||||
uint32_t bg_alpha = _destalpha >> (FRACBITS - 8);
|
||||
|
||||
do {
|
||||
uint32_t fg = shade_pal_index(*source, light, shade_constants);
|
||||
uint32_t fg = LightBgra::shade_pal_index(*source, light, shade_constants);
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
@ -1113,7 +1113,7 @@ public:
|
|||
pitch = _pitch * thread->num_cores;
|
||||
sincr = 4 * thread->num_cores;
|
||||
|
||||
uint32_t light = calc_light_multiplier(_light);
|
||||
uint32_t light = LightBgra::calc_light_multiplier(_light);
|
||||
ShadeConstants shade_constants = _shade_constants;
|
||||
|
||||
uint32_t fg_alpha = _srcalpha >> (FRACBITS - 8);
|
||||
|
@ -1122,7 +1122,7 @@ public:
|
|||
do {
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
uint32_t fg = shade_pal_index(source[i], light, shade_constants);
|
||||
uint32_t fg = LightBgra::shade_pal_index(source[i], light, shade_constants);
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
return;
|
||||
|
||||
ShadeConstants shade_constants = _shade_constants;
|
||||
uint32_t light = calc_light_multiplier(_light);
|
||||
uint32_t light = LightBgra::calc_light_multiplier(_light);
|
||||
uint32_t *palette = (uint32_t*)GPalette.BaseColors;
|
||||
|
||||
dest = thread->dest_for_thread(yl, _pitch, ylookup[yl] + sx + (uint32_t*)_destorg);
|
||||
|
@ -207,7 +207,7 @@ public:
|
|||
pitch = _pitch * thread->num_cores;
|
||||
sincr = 4 * thread->num_cores;
|
||||
|
||||
uint32_t light = calc_light_multiplier(_light);
|
||||
uint32_t light = LightBgra::calc_light_multiplier(_light);
|
||||
uint32_t *palette = (uint32_t*)GPalette.BaseColors;
|
||||
BYTE *colormap = _colormap;
|
||||
|
||||
|
@ -335,7 +335,7 @@ public:
|
|||
pitch = _pitch * thread->num_cores;
|
||||
sincr = 4 * thread->num_cores;
|
||||
|
||||
__m128i fg = _mm_unpackhi_epi8(_mm_set1_epi32(shade_pal_index_simple(_color, calc_light_multiplier(_light))), _mm_setzero_si128());
|
||||
__m128i fg = _mm_unpackhi_epi8(_mm_set1_epi32(LightBgra::shade_pal_index_simple(_color, LightBgra::calc_light_multiplier(_light))), _mm_setzero_si128());
|
||||
__m128i alpha_one = _mm_set1_epi16(64);
|
||||
|
||||
do {
|
||||
|
@ -411,7 +411,7 @@ public:
|
|||
pitch = _pitch * thread->num_cores;
|
||||
sincr = 4 * thread->num_cores;
|
||||
|
||||
uint32_t light = calc_light_multiplier(_light);
|
||||
uint32_t light = LightBgra::calc_light_multiplier(_light);
|
||||
uint32_t *palette = (uint32_t*)GPalette.BaseColors;
|
||||
|
||||
uint32_t fg_alpha = _srcalpha >> (FRACBITS - 8);
|
||||
|
@ -538,7 +538,7 @@ public:
|
|||
pitch = _pitch * thread->num_cores;
|
||||
sincr = 4 * thread->num_cores;
|
||||
|
||||
uint32_t light = calc_light_multiplier(_light);
|
||||
uint32_t light = LightBgra::calc_light_multiplier(_light);
|
||||
uint32_t *palette = (uint32_t*)GPalette.BaseColors;
|
||||
ShadeConstants shade_constants = _shade_constants;
|
||||
|
||||
|
@ -664,7 +664,7 @@ public:
|
|||
pitch = _pitch * thread->num_cores;
|
||||
sincr = 4 * thread->num_cores;
|
||||
|
||||
uint32_t light = calc_light_multiplier(_light);
|
||||
uint32_t light = LightBgra::calc_light_multiplier(_light);
|
||||
uint32_t *palette = (uint32_t*)GPalette.BaseColors;
|
||||
ShadeConstants shade_constants = _shade_constants;
|
||||
|
||||
|
|
|
@ -514,8 +514,8 @@ void R_MapColoredPlane_rgba(int y, int x1)
|
|||
{
|
||||
uint32_t *dest = ylookup[y] + x1 + (uint32_t*)dc_destorg;
|
||||
int count = (spanend[y] - x1 + 1);
|
||||
uint32_t light = calc_light_multiplier(ds_light);
|
||||
uint32_t color = shade_pal_index_simple(ds_color, light);
|
||||
uint32_t light = LightBgra::calc_light_multiplier(ds_light);
|
||||
uint32_t color = LightBgra::shade_pal_index_simple(ds_color, light);
|
||||
for (int i = 0; i < count; i++)
|
||||
dest[i] = color;
|
||||
}
|
||||
|
|
|
@ -1276,7 +1276,7 @@ typedef void(*Draw4ColumnsFuncPtr)();
|
|||
void wallscan_any(
|
||||
int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat,
|
||||
const BYTE *(*getcol)(FTexture *tex, int x),
|
||||
void(setupwallscan(int bits,Draw1ColumnFuncPtr &draw1, Draw4ColumnsFuncPtr &draw2)))
|
||||
void(setupwallscan(int bits, int fracmax, Draw1ColumnFuncPtr &draw1, Draw4ColumnsFuncPtr &draw2)))
|
||||
{
|
||||
if (rw_pic->UseType == FTexture::TEX_Null)
|
||||
return;
|
||||
|
@ -1286,7 +1286,7 @@ void wallscan_any(
|
|||
|
||||
DWORD(*draw1column)();
|
||||
void(*draw4columns)();
|
||||
setupwallscan(32 - rw_pic->HeightBits, draw1column, draw4columns);
|
||||
setupwallscan(32 - rw_pic->HeightBits, (rw_pic->GetHeight() - 1) << (32 - rw_pic->HeightBits), draw1column, draw4columns);
|
||||
|
||||
bool fixed = (fixedcolormap != NULL || fixedlightlev >= 0);
|
||||
if (fixed)
|
||||
|
@ -1439,9 +1439,9 @@ void wallscan_any(
|
|||
|
||||
void wallscan(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const BYTE *(*getcol)(FTexture *tex, int x))
|
||||
{
|
||||
wallscan_any(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, [](int bits, Draw1ColumnFuncPtr &line1, Draw4ColumnsFuncPtr &line4)
|
||||
wallscan_any(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, [](int bits, int fracmax, Draw1ColumnFuncPtr &line1, Draw4ColumnsFuncPtr &line4)
|
||||
{
|
||||
setupvline(bits);
|
||||
setupvline(bits, fracmax);
|
||||
line1 = dovline1;
|
||||
line4 = dovline4;
|
||||
});
|
||||
|
@ -1455,9 +1455,9 @@ void maskwallscan(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t
|
|||
}
|
||||
else
|
||||
{
|
||||
wallscan_any(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, [](int bits, Draw1ColumnFuncPtr &line1, Draw4ColumnsFuncPtr &line4)
|
||||
wallscan_any(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, [](int bits, int fracmax, Draw1ColumnFuncPtr &line1, Draw4ColumnsFuncPtr &line4)
|
||||
{
|
||||
setupmvline(bits);
|
||||
setupmvline(bits, fracmax);
|
||||
line1 = domvline1;
|
||||
line4 = domvline4;
|
||||
});
|
||||
|
@ -1475,9 +1475,9 @@ void transmaskwallscan(int x1, int x2, short *uwal, short *dwal, float *swal, fi
|
|||
}
|
||||
else
|
||||
{
|
||||
wallscan_any(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, [](int bits, Draw1ColumnFuncPtr &line1, Draw4ColumnsFuncPtr &line4)
|
||||
wallscan_any(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, [](int bits, int fracmax, Draw1ColumnFuncPtr &line1, Draw4ColumnsFuncPtr &line4)
|
||||
{
|
||||
setuptmvline(bits);
|
||||
setuptmvline(bits, fracmax);
|
||||
line1 = reinterpret_cast<DWORD(*)()>(tmvline1);
|
||||
line4 = tmvline4;
|
||||
});
|
||||
|
|
|
@ -2732,7 +2732,7 @@ void R_DrawParticle_rgba(vissprite_t *vis)
|
|||
|
||||
DrawerCommandQueue::WaitForWorkers();
|
||||
|
||||
uint32_t fg = shade_pal_index_simple(color, calc_light_multiplier(LIGHTSCALE(0, vis->Style.ColormapNum << FRACBITS)));
|
||||
uint32_t fg = LightBgra::shade_pal_index_simple(color, LightBgra::calc_light_multiplier(LIGHTSCALE(0, vis->Style.ColormapNum << FRACBITS)));
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
|
|
@ -1026,7 +1026,7 @@ void DCanvas::PUTTRANSDOT (int xx, int yy, int basecolor, int level)
|
|||
{
|
||||
uint32_t *spot = (uint32_t*)GetBuffer() + oldyyshifted + xx;
|
||||
|
||||
uint32_t fg = shade_pal_index_simple(basecolor, calc_light_multiplier(0));
|
||||
uint32_t fg = LightBgra::shade_pal_index_simple(basecolor, LightBgra::calc_light_multiplier(0));
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
|
Loading…
Reference in a new issue