Added r_multithreaded CVAR and fixed some broken colors

This commit is contained in:
Magnus Norddahl 2016-06-17 07:38:05 +02:00
parent 312776621e
commit 70dbde4f78
3 changed files with 1314 additions and 1291 deletions

File diff suppressed because it is too large Load diff

View file

@ -178,17 +178,19 @@ public:
class DrawerCommand class DrawerCommand
{ {
protected: protected:
int dc_dest_y; int _dest_y;
public: public:
DrawerCommand() DrawerCommand()
{ {
dc_dest_y = static_cast<int>((dc_dest - dc_destorg) / (dc_pitch * 4)); _dest_y = static_cast<int>((dc_dest - dc_destorg) / (dc_pitch * 4));
} }
virtual void Execute(DrawerThread *thread) = 0; virtual void Execute(DrawerThread *thread) = 0;
}; };
EXTERN_CVAR(Bool, r_multithreaded)
// Manages queueing up commands and executing them on worker threads // Manages queueing up commands and executing them on worker threads
class DrawerCommandQueue class DrawerCommandQueue
{ {
@ -232,7 +234,7 @@ public:
static void QueueCommand(Types &&... args) static void QueueCommand(Types &&... args)
{ {
auto queue = Instance(); auto queue = Instance();
if (queue->threaded_render == 0) if (queue->threaded_render == 0 || !r_multithreaded)
{ {
T command(std::forward<Types>(args)...); T command(std::forward<Types>(args)...);
command.Execute(&queue->single_core_thread); command.Execute(&queue->single_core_thread);

View file

@ -61,8 +61,8 @@ class RtCopy1colRGBACommand : public DrawerCommand
int sx; int sx;
int yl; int yl;
int yh; int yh;
BYTE *dc_destorg; BYTE *_destorg;
int dc_pitch; int _pitch;
public: public:
RtCopy1colRGBACommand(int hx, int sx, int yl, int yh) RtCopy1colRGBACommand(int hx, int sx, int yl, int yh)
@ -72,8 +72,8 @@ public:
this->yl = yl; this->yl = yl;
this->yh = yh; this->yh = yh;
dc_destorg = ::dc_destorg; _destorg = dc_destorg;
dc_pitch = ::dc_pitch; _pitch = dc_pitch;
} }
void Execute(DrawerThread *thread) override void Execute(DrawerThread *thread) override
@ -87,9 +87,9 @@ public:
if (count <= 0) if (count <= 0)
return; return;
dest = thread->dest_for_thread(yl, dc_pitch, ylookup[yl] + sx + (uint32_t*)dc_destorg); dest = thread->dest_for_thread(yl, _pitch, ylookup[yl] + sx + (uint32_t*)_destorg);
source = &thread->dc_temp_rgba[yl * 4 + hx] + thread->skipped_by_thread(yl) * 4; source = &thread->dc_temp_rgba[yl * 4 + hx] + thread->skipped_by_thread(yl) * 4;
pitch = dc_pitch * thread->num_cores; pitch = _pitch * thread->num_cores;
sincr = thread->num_cores * 4; sincr = thread->num_cores * 4;
if (count & 1) { if (count & 1) {
@ -123,11 +123,11 @@ class RtMap1colRGBACommand : public DrawerCommand
int sx; int sx;
int yl; int yl;
int yh; int yh;
fixed_t dc_light; fixed_t _light;
ShadeConstants dc_shade_constants; ShadeConstants _shade_constants;
BYTE *dc_destorg; BYTE *_destorg;
int dc_pitch; int _pitch;
BYTE *dc_colormap; BYTE *_colormap;
public: public:
RtMap1colRGBACommand(int hx, int sx, int yl, int yh) RtMap1colRGBACommand(int hx, int sx, int yl, int yh)
@ -137,11 +137,11 @@ public:
this->yl = yl; this->yl = yl;
this->yh = yh; this->yh = yh;
dc_light = ::dc_light; _light = dc_light;
dc_shade_constants = ::dc_shade_constants; _shade_constants = dc_shade_constants;
dc_destorg = ::dc_destorg; _destorg = dc_destorg;
dc_pitch = ::dc_pitch; _pitch = dc_pitch;
dc_colormap = ::dc_colormap; _colormap = dc_colormap;
} }
void Execute(DrawerThread *thread) override void Execute(DrawerThread *thread) override
@ -156,15 +156,15 @@ public:
if (count <= 0) if (count <= 0)
return; return;
uint32_t light = calc_light_multiplier(dc_light); uint32_t light = calc_light_multiplier(_light);
ShadeConstants shade_constants = dc_shade_constants; ShadeConstants shade_constants = _shade_constants;
dest = thread->dest_for_thread(yl, dc_pitch, ylookup[yl] + sx + (uint32_t*)dc_destorg); dest = thread->dest_for_thread(yl, _pitch, ylookup[yl] + sx + (uint32_t*)_destorg);
source = &thread->dc_temp_rgba[yl * 4 + hx] + thread->skipped_by_thread(yl) * 4; source = &thread->dc_temp_rgba[yl * 4 + hx] + thread->skipped_by_thread(yl) * 4;
pitch = dc_pitch * thread->num_cores; pitch = _pitch * thread->num_cores;
sincr = thread->num_cores * 4; sincr = thread->num_cores * 4;
BYTE *colormap = dc_colormap; BYTE *colormap = _colormap;
if (count & 1) { if (count & 1) {
*dest = shade_pal_index(colormap[*source], light, shade_constants); *dest = shade_pal_index(colormap[*source], light, shade_constants);
@ -188,11 +188,11 @@ class RtMap4colsRGBACommand : public DrawerCommand
int sx; int sx;
int yl; int yl;
int yh; int yh;
fixed_t dc_light; fixed_t _light;
ShadeConstants dc_shade_constants; ShadeConstants _shade_constants;
BYTE *dc_destorg; BYTE *_destorg;
int dc_pitch; int _pitch;
BYTE *colormap; BYTE *_colormap;
public: public:
RtMap4colsRGBACommand(int sx, int yl, int yh) RtMap4colsRGBACommand(int sx, int yl, int yh)
@ -201,11 +201,11 @@ public:
this->yl = yl; this->yl = yl;
this->yh = yh; this->yh = yh;
dc_light = ::dc_light; _light = dc_light;
dc_shade_constants = ::dc_shade_constants; _shade_constants = dc_shade_constants;
dc_destorg = ::dc_destorg; _destorg = dc_destorg;
dc_pitch = ::dc_pitch; _pitch = dc_pitch;
dc_colormap = ::dc_colormap; _colormap = dc_colormap;
} }
#ifdef NO_SSE #ifdef NO_SSE
@ -221,15 +221,15 @@ public:
if (count <= 0) if (count <= 0)
return; return;
uint32_t light = calc_light_multiplier(dc_light); uint32_t light = calc_light_multiplier(_light);
ShadeConstants shade_constants = dc_shade_constants; ShadeConstants shade_constants = _shade_constants;
dest = thread->dest_for_thread(yl, dc_pitch, ylookup[yl] + sx + (uint32_t*)dc_destorg); dest = thread->dest_for_thread(yl, _pitch, ylookup[yl] + sx + (uint32_t*)_destorg);
source = &thread->dc_temp_rgba[yl * 4] + thread->skipped_by_thread(yl) * 4; source = &thread->dc_temp_rgba[yl * 4] + thread->skipped_by_thread(yl) * 4;
pitch = dc_pitch * thread->num_cores; pitch = _pitch * thread->num_cores;
sincr = thread->num_cores * 4; sincr = thread->num_cores * 4;
BYTE *colormap = dc_colormap; BYTE *colormap = _colormap;
if (count & 1) { if (count & 1) {
dest[0] = shade_pal_index(colormap[source[0]], light, shade_constants); dest[0] = shade_pal_index(colormap[source[0]], light, shade_constants);
@ -268,16 +268,16 @@ public:
if (count <= 0) if (count <= 0)
return; return;
ShadeConstants shade_constants = dc_shade_constants; ShadeConstants shade_constants = _shade_constants;
uint32_t light = calc_light_multiplier(dc_light); uint32_t light = calc_light_multiplier(_light);
uint32_t *palette = (uint32_t*)GPalette.BaseColors; uint32_t *palette = (uint32_t*)GPalette.BaseColors;
dest = thread->dest_for_thread(yl, dc_pitch, ylookup[yl] + sx + (uint32_t*)dc_destorg); dest = thread->dest_for_thread(yl, _pitch, ylookup[yl] + sx + (uint32_t*)_destorg);
source = &thread->dc_temp_rgba[yl * 4] + thread->skipped_by_thread(yl) * 4; source = &thread->dc_temp_rgba[yl * 4] + thread->skipped_by_thread(yl) * 4;
pitch = dc_pitch * thread->num_cores; pitch = _pitch * thread->num_cores;
sincr = thread->num_cores * 4; sincr = thread->num_cores * 4;
BYTE *colormap = dc_colormap; BYTE *colormap = _colormap;
if (shade_constants.simple_shade) if (shade_constants.simple_shade)
{ {
@ -509,13 +509,13 @@ class RtAdd1colRGBACommand : public DrawerCommand
int sx; int sx;
int yl; int yl;
int yh; int yh;
BYTE *dc_destorg; BYTE *_destorg;
int dc_pitch; int _pitch;
fixed_t dc_light; fixed_t _light;
ShadeConstants dc_shade_constants; ShadeConstants _shade_constants;
fixed_t dc_srcalpha; fixed_t _srcalpha;
fixed_t dc_destalpha; fixed_t _destalpha;
BYTE *dc_colormap; BYTE *_colormap;
public: public:
RtAdd1colRGBACommand(int hx, int sx, int yl, int yh) RtAdd1colRGBACommand(int hx, int sx, int yl, int yh)
@ -525,13 +525,13 @@ public:
this->yl = yl; this->yl = yl;
this->yh = yh; this->yh = yh;
dc_destorg = ::dc_destorg; _destorg = dc_destorg;
dc_pitch = ::dc_pitch; _pitch = dc_pitch;
dc_light = ::dc_light; _light = dc_light;
dc_shade_constants = ::dc_shade_constants; _shade_constants = dc_shade_constants;
dc_srcalpha = ::dc_srcalpha; _srcalpha = dc_srcalpha;
dc_destalpha = ::dc_destalpha; _destalpha = dc_destalpha;
dc_colormap = ::dc_colormap; _colormap = dc_colormap;
} }
void Execute(DrawerThread *thread) override void Execute(DrawerThread *thread) override
@ -546,17 +546,17 @@ public:
if (count <= 0) if (count <= 0)
return; return;
dest = thread->dest_for_thread(yl, dc_pitch, ylookup[yl] + sx + (uint32_t*)dc_destorg); dest = thread->dest_for_thread(yl, _pitch, ylookup[yl] + sx + (uint32_t*)_destorg);
source = &thread->dc_temp_rgba[yl * 4 + hx] + thread->skipped_by_thread(yl) * 4; source = &thread->dc_temp_rgba[yl * 4 + hx] + thread->skipped_by_thread(yl) * 4;
pitch = dc_pitch * thread->num_cores; pitch = _pitch * thread->num_cores;
sincr = 4 * thread->num_cores; sincr = 4 * thread->num_cores;
uint32_t light = calc_light_multiplier(dc_light); uint32_t light = calc_light_multiplier(_light);
ShadeConstants shade_constants = dc_shade_constants; ShadeConstants shade_constants = _shade_constants;
BYTE *colormap = dc_colormap; BYTE *colormap = _colormap;
uint32_t fg_alpha = dc_srcalpha >> (FRACBITS - 8); uint32_t fg_alpha = _srcalpha >> (FRACBITS - 8);
uint32_t bg_alpha = dc_destalpha >> (FRACBITS - 8); uint32_t bg_alpha = _destalpha >> (FRACBITS - 8);
do { do {
uint32_t fg = shade_pal_index(colormap[*source], light, shade_constants); uint32_t fg = shade_pal_index(colormap[*source], light, shade_constants);
@ -585,13 +585,13 @@ class RtAdd4colsRGBACommand : public DrawerCommand
int sx; int sx;
int yl; int yl;
int yh; int yh;
BYTE *dc_destorg; BYTE *_destorg;
int dc_pitch; int _pitch;
fixed_t dc_light; fixed_t _light;
ShadeConstants dc_shade_constants; ShadeConstants _shade_constants;
BYTE *dc_colormap; BYTE *_colormap;
fixed_t dc_srcalpha; fixed_t _srcalpha;
fixed_t dc_destalpha; fixed_t _destalpha;
public: public:
RtAdd4colsRGBACommand(int sx, int yl, int yh) RtAdd4colsRGBACommand(int sx, int yl, int yh)
@ -600,13 +600,13 @@ public:
this->yl = yl; this->yl = yl;
this->yh = yh; this->yh = yh;
dc_destorg = ::dc_destorg; _destorg = dc_destorg;
dc_pitch = ::dc_pitch; _pitch = dc_pitch;
dc_light = ::dc_light; _light = dc_light;
dc_shade_constants = ::dc_shade_constants; _shade_constants = dc_shade_constants;
dc_colormap = ::dc_colormap; _colormap = dc_colormap;
dc_srcalpha = ::dc_srcalpha; _srcalpha = dc_srcalpha;
dc_destalpha = ::dc_destalpha; _destalpha = dc_destalpha;
} }
#ifdef NO_SSE #ifdef NO_SSE
@ -622,17 +622,17 @@ public:
if (count <= 0) if (count <= 0)
return; return;
dest = thread->dest_for_thread(yl, dc_pitch, ylookup[yl] + sx + (uint32_t*)dc_destorg); dest = thread->dest_for_thread(yl, _pitch, ylookup[yl] + sx + (uint32_t*)_destorg);
source = &thread->dc_temp_rgba[yl * 4] + thread->skipped_by_thread(yl) * 4; source = &thread->dc_temp_rgba[yl * 4] + thread->skipped_by_thread(yl) * 4;
pitch = dc_pitch * thread->num_cores; pitch = _pitch * thread->num_cores;
sincr = 4 * thread->num_cores; sincr = 4 * thread->num_cores;
uint32_t light = calc_light_multiplier(dc_light); uint32_t light = calc_light_multiplier(_light);
ShadeConstants shade_constants = dc_shade_constants; ShadeConstants shade_constants = _shade_constants;
BYTE *colormap = dc_colormap; BYTE *colormap = _colormap;
uint32_t fg_alpha = dc_srcalpha >> (FRACBITS - 8); uint32_t fg_alpha = _srcalpha >> (FRACBITS - 8);
uint32_t bg_alpha = dc_destalpha >> (FRACBITS - 8); uint32_t bg_alpha = _destalpha >> (FRACBITS - 8);
do { do {
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
@ -670,19 +670,19 @@ public:
if (count <= 0) if (count <= 0)
return; return;
dest = thread->dest_for_thread(yl, dc_pitch, ylookup[yl] + sx + (uint32_t*)dc_destorg); dest = thread->dest_for_thread(yl, _pitch, ylookup[yl] + sx + (uint32_t*)_destorg);
source = &thread->dc_temp_rgba[yl * 4] + thread->skipped_by_thread(yl) * 4; source = &thread->dc_temp_rgba[yl * 4] + thread->skipped_by_thread(yl) * 4;
pitch = dc_pitch * thread->num_cores; pitch = _pitch * thread->num_cores;
sincr = 4 * thread->num_cores; sincr = 4 * thread->num_cores;
uint32_t light = calc_light_multiplier(dc_light); uint32_t light = calc_light_multiplier(_light);
uint32_t *palette = (uint32_t*)GPalette.BaseColors; uint32_t *palette = (uint32_t*)GPalette.BaseColors;
BYTE *colormap = dc_colormap; BYTE *colormap = _colormap;
uint32_t fg_alpha = dc_srcalpha >> (FRACBITS - 8); uint32_t fg_alpha = _srcalpha >> (FRACBITS - 8);
uint32_t bg_alpha = dc_destalpha >> (FRACBITS - 8); uint32_t bg_alpha = _destalpha >> (FRACBITS - 8);
ShadeConstants shade_constants = dc_shade_constants; ShadeConstants shade_constants = _shade_constants;
if (shade_constants.simple_shade) if (shade_constants.simple_shade)
{ {
@ -766,11 +766,11 @@ class RtShaded1colRGBACommand : public DrawerCommand
int sx; int sx;
int yl; int yl;
int yh; int yh;
lighttable_t *dc_colormap; lighttable_t *_colormap;
BYTE *dc_destorg; BYTE *_destorg;
int dc_pitch; int _pitch;
int dc_color; int _color;
fixed_t dc_light; fixed_t _light;
public: public:
RtShaded1colRGBACommand(int hx, int sx, int yl, int yh) RtShaded1colRGBACommand(int hx, int sx, int yl, int yh)
@ -780,11 +780,11 @@ public:
this->yl = yl; this->yl = yl;
this->yh = yh; this->yh = yh;
dc_colormap = ::dc_colormap; _colormap = dc_colormap;
dc_destorg = ::dc_destorg; _destorg = dc_destorg;
dc_pitch = ::dc_pitch; _pitch = dc_pitch;
dc_color = ::dc_color; _color = dc_color;
dc_light = ::dc_light; _light = dc_light;
} }
void Execute(DrawerThread *thread) override void Execute(DrawerThread *thread) override
@ -800,13 +800,13 @@ public:
if (count <= 0) if (count <= 0)
return; return;
colormap = dc_colormap; colormap = _colormap;
dest = thread->dest_for_thread(yl, dc_pitch, ylookup[yl] + sx + (uint32_t*)dc_destorg); dest = thread->dest_for_thread(yl, _pitch, ylookup[yl] + sx + (uint32_t*)_destorg);
source = &thread->dc_temp_rgba[yl * 4 + hx] + thread->skipped_by_thread(yl) * 4; source = &thread->dc_temp_rgba[yl * 4 + hx] + thread->skipped_by_thread(yl) * 4;
pitch = dc_pitch * thread->num_cores; pitch = _pitch * thread->num_cores;
sincr = 4 * thread->num_cores; sincr = 4 * thread->num_cores;
uint32_t fg = shade_pal_index_simple(dc_color, calc_light_multiplier(dc_light)); uint32_t fg = shade_pal_index_simple(_color, calc_light_multiplier(_light));
uint32_t fg_red = (fg >> 16) & 0xff; uint32_t fg_red = (fg >> 16) & 0xff;
uint32_t fg_green = (fg >> 8) & 0xff; uint32_t fg_green = (fg >> 8) & 0xff;
uint32_t fg_blue = fg & 0xff; uint32_t fg_blue = fg & 0xff;
@ -835,11 +835,11 @@ class RtShaded4colsRGBACommand : public DrawerCommand
int sx; int sx;
int yl; int yl;
int yh; int yh;
lighttable_t *dc_colormap; lighttable_t *_colormap;
int dc_color; int _color;
BYTE *dc_destorg; BYTE *_destorg;
int dc_pitch; int _pitch;
fixed_t dc_light; fixed_t _light;
public: public:
RtShaded4colsRGBACommand(int sx, int yl, int yh) RtShaded4colsRGBACommand(int sx, int yl, int yh)
@ -848,11 +848,11 @@ public:
this->yl = yl; this->yl = yl;
this->yh = yh; this->yh = yh;
dc_colormap = ::dc_colormap; _colormap = dc_colormap;
dc_color = ::dc_color; _color = dc_color;
dc_destorg = ::dc_destorg; _destorg = dc_destorg;
dc_pitch = ::dc_pitch; _pitch = dc_pitch;
dc_light = ::dc_light; _light = dc_light;
} }
#ifdef NO_SSE #ifdef NO_SSE
@ -869,13 +869,13 @@ public:
if (count <= 0) if (count <= 0)
return; return;
colormap = dc_colormap; colormap = _colormap;
dest = thread->dest_for_thread(yl, dc_pitch, ylookup[yl] + sx + (uint32_t*)dc_destorg); dest = thread->dest_for_thread(yl, _pitch, ylookup[yl] + sx + (uint32_t*)_destorg);
source = &thread->dc_temp_rgba[yl * 4] + thread->skipped_by_thread(yl) * 4; source = &thread->dc_temp_rgba[yl * 4] + thread->skipped_by_thread(yl) * 4;
pitch = dc_pitch * thread->num_cores; pitch = _pitch * thread->num_cores;
sincr = 4 * thread->num_cores; sincr = 4 * thread->num_cores;
uint32_t fg = shade_pal_index_simple(dc_color, calc_light_multiplier(dc_light)); uint32_t fg = shade_pal_index_simple(_color, calc_light_multiplier(_light));
uint32_t fg_red = (fg >> 16) & 0xff; uint32_t fg_red = (fg >> 16) & 0xff;
uint32_t fg_green = (fg >> 8) & 0xff; uint32_t fg_green = (fg >> 8) & 0xff;
uint32_t fg_blue = fg & 0xff; uint32_t fg_blue = fg & 0xff;
@ -914,13 +914,13 @@ public:
if (count <= 0) if (count <= 0)
return; return;
colormap = dc_colormap; colormap = _colormap;
dest = thread->dest_for_thread(yl, dc_pitch, ylookup[yl] + sx + (uint32_t*)dc_destorg); dest = thread->dest_for_thread(yl, _pitch, ylookup[yl] + sx + (uint32_t*)_destorg);
source = &thread->dc_temp_rgba[yl * 4] + thread->skipped_by_thread(yl) * 4; source = &thread->dc_temp_rgba[yl * 4] + thread->skipped_by_thread(yl) * 4;
pitch = dc_pitch * thread->num_cores; pitch = _pitch * thread->num_cores;
sincr = 4 * thread->num_cores; sincr = 4 * thread->num_cores;
__m128i fg = _mm_unpackhi_epi8(_mm_set1_epi32(shade_pal_index_simple(dc_color, calc_light_multiplier(dc_light))), _mm_setzero_si128()); __m128i fg = _mm_unpackhi_epi8(_mm_set1_epi32(shade_pal_index_simple(_color, calc_light_multiplier(_light))), _mm_setzero_si128());
__m128i alpha_one = _mm_set1_epi16(64); __m128i alpha_one = _mm_set1_epi16(64);
do { do {
@ -959,12 +959,12 @@ class RtAddClamp1colRGBACommand : public DrawerCommand
int sx; int sx;
int yl; int yl;
int yh; int yh;
BYTE *dc_destorg; BYTE *_destorg;
int dc_pitch; int _pitch;
fixed_t dc_light; fixed_t _light;
ShadeConstants dc_shade_constants; ShadeConstants _shade_constants;
fixed_t dc_srcalpha; fixed_t _srcalpha;
fixed_t dc_destalpha; fixed_t _destalpha;
public: public:
RtAddClamp1colRGBACommand(int hx, int sx, int yl, int yh) RtAddClamp1colRGBACommand(int hx, int sx, int yl, int yh)
@ -974,12 +974,12 @@ public:
this->yl = yl; this->yl = yl;
this->yh = yh; this->yh = yh;
dc_destorg = ::dc_destorg; _destorg = dc_destorg;
dc_pitch = ::dc_pitch; _pitch = dc_pitch;
dc_light = ::dc_light; _light = dc_light;
dc_shade_constants = ::dc_shade_constants; _shade_constants = dc_shade_constants;
dc_srcalpha = ::dc_srcalpha; _srcalpha = dc_srcalpha;
dc_destalpha = ::dc_destalpha; _destalpha = dc_destalpha;
} }
void Execute(DrawerThread *thread) override void Execute(DrawerThread *thread) override
@ -994,16 +994,16 @@ public:
if (count <= 0) if (count <= 0)
return; return;
dest = thread->dest_for_thread(yl, dc_pitch, ylookup[yl] + sx + (uint32_t*)dc_destorg); dest = thread->dest_for_thread(yl, _pitch, ylookup[yl] + sx + (uint32_t*)_destorg);
source = &thread->dc_temp_rgba[yl * 4 + hx] + thread->skipped_by_thread(yl) * 4; source = &thread->dc_temp_rgba[yl * 4 + hx] + thread->skipped_by_thread(yl) * 4;
pitch = dc_pitch * thread->num_cores; pitch = _pitch * thread->num_cores;
sincr = 4 * thread->num_cores; sincr = 4 * thread->num_cores;
uint32_t light = calc_light_multiplier(dc_light); uint32_t light = calc_light_multiplier(_light);
ShadeConstants shade_constants = dc_shade_constants; ShadeConstants shade_constants = _shade_constants;
uint32_t fg_alpha = dc_srcalpha >> (FRACBITS - 8); uint32_t fg_alpha = _srcalpha >> (FRACBITS - 8);
uint32_t bg_alpha = dc_destalpha >> (FRACBITS - 8); uint32_t bg_alpha = _destalpha >> (FRACBITS - 8);
do { do {
uint32_t fg = shade_pal_index(*source, light, shade_constants); uint32_t fg = shade_pal_index(*source, light, shade_constants);
@ -1031,12 +1031,12 @@ class RtAddClamp4colsRGBACommand : public DrawerCommand
int sx; int sx;
int yl; int yl;
int yh; int yh;
BYTE *dc_destorg; BYTE *_destorg;
int dc_pitch; int _pitch;
fixed_t dc_light; fixed_t _light;
fixed_t dc_srcalpha; fixed_t _srcalpha;
fixed_t dc_destalpha; fixed_t _destalpha;
ShadeConstants dc_shade_constants; ShadeConstants _shade_constants;
public: public:
RtAddClamp4colsRGBACommand(int sx, int yl, int yh) RtAddClamp4colsRGBACommand(int sx, int yl, int yh)
@ -1045,12 +1045,12 @@ public:
this->yl = yl; this->yl = yl;
this->yh = yh; this->yh = yh;
dc_destorg = ::dc_destorg; _destorg = dc_destorg;
dc_pitch = ::dc_pitch; _pitch = dc_pitch;
dc_light = ::dc_light; _light = dc_light;
dc_srcalpha = ::dc_srcalpha; _srcalpha = dc_srcalpha;
dc_destalpha = ::dc_destalpha; _destalpha = dc_destalpha;
dc_shade_constants = ::dc_shade_constants; _shade_constants = dc_shade_constants;
} }
#ifdef NO_SSE #ifdef NO_SSE
@ -1066,16 +1066,16 @@ public:
if (count <= 0) if (count <= 0)
return; return;
dest = thread->dest_for_thread(yl, dc_pitch, ylookup[yl] + sx + (uint32_t*)dc_destorg); dest = thread->dest_for_thread(yl, _pitch, ylookup[yl] + sx + (uint32_t*)_destorg);
source = &thread->dc_temp_rgba[yl * 4] + thread->skipped_by_thread(yl) * 4; source = &thread->dc_temp_rgba[yl * 4] + thread->skipped_by_thread(yl) * 4;
pitch = dc_pitch * thread->num_cores; pitch = _pitch * thread->num_cores;
sincr = 4 * thread->num_cores; sincr = 4 * thread->num_cores;
uint32_t light = calc_light_multiplier(dc_light); uint32_t light = calc_light_multiplier(_light);
ShadeConstants shade_constants = dc_shade_constants; ShadeConstants shade_constants = _shade_constants;
uint32_t fg_alpha = dc_srcalpha >> (FRACBITS - 8); uint32_t fg_alpha = _srcalpha >> (FRACBITS - 8);
uint32_t bg_alpha = dc_destalpha >> (FRACBITS - 8); uint32_t bg_alpha = _destalpha >> (FRACBITS - 8);
do { do {
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
@ -1112,18 +1112,18 @@ public:
if (count <= 0) if (count <= 0)
return; return;
dest = thread->dest_for_thread(yl, dc_pitch, ylookup[yl] + sx + (uint32_t*)dc_destorg); dest = thread->dest_for_thread(yl, _pitch, ylookup[yl] + sx + (uint32_t*)_destorg);
source = &thread->dc_temp_rgba[yl * 4] + thread->skipped_by_thread(yl) * 4; source = &thread->dc_temp_rgba[yl * 4] + thread->skipped_by_thread(yl) * 4;
pitch = dc_pitch * thread->num_cores; pitch = _pitch * thread->num_cores;
sincr = 4 * thread->num_cores; sincr = 4 * thread->num_cores;
uint32_t light = calc_light_multiplier(dc_light); uint32_t light = calc_light_multiplier(_light);
uint32_t *palette = (uint32_t*)GPalette.BaseColors; uint32_t *palette = (uint32_t*)GPalette.BaseColors;
uint32_t fg_alpha = dc_srcalpha >> (FRACBITS - 8); uint32_t fg_alpha = _srcalpha >> (FRACBITS - 8);
uint32_t bg_alpha = dc_destalpha >> (FRACBITS - 8); uint32_t bg_alpha = _destalpha >> (FRACBITS - 8);
ShadeConstants shade_constants = dc_shade_constants; ShadeConstants shade_constants = _shade_constants;
if (shade_constants.simple_shade) if (shade_constants.simple_shade)
{ {
@ -1207,12 +1207,12 @@ class RtSubClamp1colRGBACommand : public DrawerCommand
int sx; int sx;
int yl; int yl;
int yh; int yh;
BYTE *dc_destorg; BYTE *_destorg;
int dc_pitch; int _pitch;
fixed_t dc_light; fixed_t _light;
fixed_t dc_srcalpha; fixed_t _srcalpha;
fixed_t dc_destalpha; fixed_t _destalpha;
ShadeConstants dc_shade_constants; ShadeConstants _shade_constants;
public: public:
RtSubClamp1colRGBACommand(int hx, int sx, int yl, int yh) RtSubClamp1colRGBACommand(int hx, int sx, int yl, int yh)
@ -1222,12 +1222,12 @@ public:
this->yl = yl; this->yl = yl;
this->yh = yh; this->yh = yh;
dc_destorg = ::dc_destorg; _destorg = dc_destorg;
dc_pitch = ::dc_pitch; _pitch = dc_pitch;
dc_light = ::dc_light; _light = dc_light;
dc_srcalpha = ::dc_srcalpha; _srcalpha = dc_srcalpha;
dc_destalpha = ::dc_destalpha; _destalpha = dc_destalpha;
dc_shade_constants = ::dc_shade_constants; _shade_constants = dc_shade_constants;
} }
void Execute(DrawerThread *thread) override void Execute(DrawerThread *thread) override
@ -1242,16 +1242,16 @@ public:
if (count <= 0) if (count <= 0)
return; return;
dest = thread->dest_for_thread(yl, dc_pitch, ylookup[yl] + sx + (uint32_t*)dc_destorg); dest = thread->dest_for_thread(yl, _pitch, ylookup[yl] + sx + (uint32_t*)_destorg);
source = &thread->dc_temp_rgba[yl * 4 + hx] + thread->skipped_by_thread(yl) * 4; source = &thread->dc_temp_rgba[yl * 4 + hx] + thread->skipped_by_thread(yl) * 4;
pitch = dc_pitch * thread->num_cores; pitch = _pitch * thread->num_cores;
sincr = 4 * thread->num_cores; sincr = 4 * thread->num_cores;
uint32_t light = calc_light_multiplier(dc_light); uint32_t light = calc_light_multiplier(_light);
ShadeConstants shade_constants = dc_shade_constants; ShadeConstants shade_constants = _shade_constants;
uint32_t fg_alpha = dc_srcalpha >> (FRACBITS - 8); uint32_t fg_alpha = _srcalpha >> (FRACBITS - 8);
uint32_t bg_alpha = dc_destalpha >> (FRACBITS - 8); uint32_t bg_alpha = _destalpha >> (FRACBITS - 8);
do { do {
uint32_t fg = shade_pal_index(*source, light, shade_constants); uint32_t fg = shade_pal_index(*source, light, shade_constants);
@ -1279,12 +1279,12 @@ class RtSubClamp4colsRGBACommand : public DrawerCommand
int sx; int sx;
int yl; int yl;
int yh; int yh;
BYTE *dc_destorg; BYTE *_destorg;
int dc_pitch; int _pitch;
fixed_t dc_light; fixed_t _light;
fixed_t dc_srcalpha; fixed_t _srcalpha;
fixed_t dc_destalpha; fixed_t _destalpha;
ShadeConstants dc_shade_constants; ShadeConstants _shade_constants;
public: public:
RtSubClamp4colsRGBACommand(int sx, int yl, int yh) RtSubClamp4colsRGBACommand(int sx, int yl, int yh)
@ -1293,12 +1293,12 @@ public:
this->yl = yl; this->yl = yl;
this->yh = yh; this->yh = yh;
dc_destorg = ::dc_destorg; _destorg = dc_destorg;
dc_pitch = ::dc_pitch; _pitch = dc_pitch;
dc_light = ::dc_light; _light = dc_light;
dc_srcalpha = ::dc_srcalpha; _srcalpha = dc_srcalpha;
dc_destalpha = ::dc_destalpha; _destalpha = dc_destalpha;
dc_shade_constants = ::dc_shade_constants; _shade_constants = dc_shade_constants;
} }
void Execute(DrawerThread *thread) override void Execute(DrawerThread *thread) override
@ -1313,16 +1313,16 @@ public:
if (count <= 0) if (count <= 0)
return; return;
dest = thread->dest_for_thread(yl, dc_pitch, ylookup[yl] + sx + (uint32_t*)dc_destorg); dest = thread->dest_for_thread(yl, _pitch, ylookup[yl] + sx + (uint32_t*)_destorg);
source = &thread->dc_temp_rgba[yl * 4] + thread->skipped_by_thread(yl) * 4; source = &thread->dc_temp_rgba[yl * 4] + thread->skipped_by_thread(yl) * 4;
pitch = dc_pitch * thread->num_cores; pitch = _pitch * thread->num_cores;
sincr = 4 * thread->num_cores; sincr = 4 * thread->num_cores;
uint32_t light = calc_light_multiplier(dc_light); uint32_t light = calc_light_multiplier(_light);
ShadeConstants shade_constants = dc_shade_constants; ShadeConstants shade_constants = _shade_constants;
uint32_t fg_alpha = dc_srcalpha >> (FRACBITS - 8); uint32_t fg_alpha = _srcalpha >> (FRACBITS - 8);
uint32_t bg_alpha = dc_destalpha >> (FRACBITS - 8); uint32_t bg_alpha = _destalpha >> (FRACBITS - 8);
do { do {
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
@ -1355,12 +1355,12 @@ class RtRevSubClamp1colRGBACommand : public DrawerCommand
int sx; int sx;
int yl; int yl;
int yh; int yh;
BYTE *dc_destorg; BYTE *_destorg;
int dc_pitch; int _pitch;
fixed_t dc_light; fixed_t _light;
fixed_t dc_srcalpha; fixed_t _srcalpha;
fixed_t dc_destalpha; fixed_t _destalpha;
ShadeConstants dc_shade_constants; ShadeConstants _shade_constants;
public: public:
RtRevSubClamp1colRGBACommand(int hx, int sx, int yl, int yh) RtRevSubClamp1colRGBACommand(int hx, int sx, int yl, int yh)
@ -1370,12 +1370,12 @@ public:
this->yl = yl; this->yl = yl;
this->yh = yh; this->yh = yh;
dc_destorg = ::dc_destorg; _destorg = dc_destorg;
dc_pitch = ::dc_pitch; _pitch = dc_pitch;
dc_light = ::dc_light; _light = dc_light;
dc_srcalpha = ::dc_srcalpha; _srcalpha = dc_srcalpha;
dc_destalpha = ::dc_destalpha; _destalpha = dc_destalpha;
dc_shade_constants = ::dc_shade_constants; _shade_constants = dc_shade_constants;
} }
void Execute(DrawerThread *thread) override void Execute(DrawerThread *thread) override
@ -1390,16 +1390,16 @@ public:
if (count <= 0) if (count <= 0)
return; return;
dest = thread->dest_for_thread(yl, dc_pitch, ylookup[yl] + sx + (uint32_t*)dc_destorg); dest = thread->dest_for_thread(yl, _pitch, ylookup[yl] + sx + (uint32_t*)_destorg);
source = &thread->dc_temp_rgba[yl * 4 + hx] + thread->skipped_by_thread(yl) * 4; source = &thread->dc_temp_rgba[yl * 4 + hx] + thread->skipped_by_thread(yl) * 4;
pitch = dc_pitch * thread->num_cores; pitch = _pitch * thread->num_cores;
sincr = 4 * thread->num_cores; sincr = 4 * thread->num_cores;
uint32_t light = calc_light_multiplier(dc_light); uint32_t light = calc_light_multiplier(_light);
ShadeConstants shade_constants = dc_shade_constants; ShadeConstants shade_constants = _shade_constants;
uint32_t fg_alpha = dc_srcalpha >> (FRACBITS - 8); uint32_t fg_alpha = _srcalpha >> (FRACBITS - 8);
uint32_t bg_alpha = dc_destalpha >> (FRACBITS - 8); uint32_t bg_alpha = _destalpha >> (FRACBITS - 8);
do { do {
uint32_t fg = shade_pal_index(*source, light, shade_constants); uint32_t fg = shade_pal_index(*source, light, shade_constants);
@ -1427,12 +1427,12 @@ class RtRevSubClamp4colsRGBACommand : public DrawerCommand
int sx; int sx;
int yl; int yl;
int yh; int yh;
BYTE *dc_destorg; BYTE *_destorg;
int dc_pitch; int _pitch;
fixed_t dc_light; fixed_t _light;
fixed_t dc_srcalpha; fixed_t _srcalpha;
fixed_t dc_destalpha; fixed_t _destalpha;
ShadeConstants dc_shade_constants; ShadeConstants _shade_constants;
public: public:
RtRevSubClamp4colsRGBACommand(int sx, int yl, int yh) RtRevSubClamp4colsRGBACommand(int sx, int yl, int yh)
@ -1441,12 +1441,12 @@ public:
this->yl = yl; this->yl = yl;
this->yh = yh; this->yh = yh;
dc_destorg = ::dc_destorg; _destorg = dc_destorg;
dc_pitch = ::dc_pitch; _pitch = dc_pitch;
dc_light = ::dc_light; _light = dc_light;
dc_srcalpha = ::dc_srcalpha; _srcalpha = dc_srcalpha;
dc_destalpha = ::dc_destalpha; _destalpha = dc_destalpha;
dc_shade_constants = ::dc_shade_constants; _shade_constants = dc_shade_constants;
} }
void Execute(DrawerThread *thread) override void Execute(DrawerThread *thread) override
@ -1461,16 +1461,16 @@ public:
if (count <= 0) if (count <= 0)
return; return;
dest = thread->dest_for_thread(yl, dc_pitch, ylookup[yl] + sx + (uint32_t*)dc_destorg); dest = thread->dest_for_thread(yl, _pitch, ylookup[yl] + sx + (uint32_t*)_destorg);
source = &thread->dc_temp_rgba[yl * 4] + thread->skipped_by_thread(yl) * 4; source = &thread->dc_temp_rgba[yl * 4] + thread->skipped_by_thread(yl) * 4;
pitch = dc_pitch * thread->num_cores; pitch = _pitch * thread->num_cores;
sincr = 4 * thread->num_cores; sincr = 4 * thread->num_cores;
uint32_t light = calc_light_multiplier(dc_light); uint32_t light = calc_light_multiplier(_light);
ShadeConstants shade_constants = dc_shade_constants; ShadeConstants shade_constants = _shade_constants;
uint32_t fg_alpha = dc_srcalpha >> (FRACBITS - 8); uint32_t fg_alpha = _srcalpha >> (FRACBITS - 8);
uint32_t bg_alpha = dc_destalpha >> (FRACBITS - 8); uint32_t bg_alpha = _destalpha >> (FRACBITS - 8);
do { do {
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
@ -1515,29 +1515,29 @@ public:
class DrawColumnHorizRGBACommand : public DrawerCommand class DrawColumnHorizRGBACommand : public DrawerCommand
{ {
int dc_count; int _count;
fixed_t dc_iscale; fixed_t _iscale;
fixed_t dc_texturefrac; fixed_t _texturefrac;
const BYTE *dc_source; const BYTE *_source;
int dc_x; int _x;
int dc_yl; int _yl;
int dc_yh; int _yh;
public: public:
DrawColumnHorizRGBACommand() DrawColumnHorizRGBACommand()
{ {
dc_count = ::dc_count; _count = dc_count;
dc_iscale = ::dc_iscale; _iscale = dc_iscale;
dc_texturefrac = ::dc_texturefrac; _texturefrac = dc_texturefrac;
dc_source = ::dc_source; _source = dc_source;
dc_x = ::dc_x; _x = dc_x;
dc_yl = ::dc_yl; _yl = dc_yl;
dc_yh = ::dc_yh; _yh = dc_yh;
} }
void Execute(DrawerThread *thread) override void Execute(DrawerThread *thread) override
{ {
int count = dc_count; int count = _count;
uint32_t *dest; uint32_t *dest;
fixed_t fracstep; fixed_t fracstep;
fixed_t frac; fixed_t frac;
@ -1546,13 +1546,13 @@ public:
return; return;
{ {
int x = dc_x & 3; int x = _x & 3;
dest = &thread->dc_temp_rgba[x + 4 * dc_yl]; dest = &thread->dc_temp_rgba[x + 4 * _yl];
} }
fracstep = dc_iscale; fracstep = _iscale;
frac = dc_texturefrac; frac = _texturefrac;
const BYTE *source = dc_source; const BYTE *source = _source;
if (count & 1) { if (count & 1) {
*dest = source[frac >> FRACBITS]; dest += 4; frac += fracstep; *dest = source[frac >> FRACBITS]; dest += 4; frac += fracstep;
@ -1589,34 +1589,34 @@ public:
class FillColumnHorizRGBACommand : public DrawerCommand class FillColumnHorizRGBACommand : public DrawerCommand
{ {
int dc_x; int _x;
int dc_yl; int _yl;
int dc_yh; int _yh;
int dc_count; int _count;
int dc_color; int _color;
public: public:
FillColumnHorizRGBACommand() FillColumnHorizRGBACommand()
{ {
dc_x = ::dc_x; _x = dc_x;
dc_count = ::dc_count; _count = dc_count;
dc_color = ::dc_color; _color = dc_color;
dc_yl = ::dc_yl; _yl = dc_yl;
dc_yh = ::dc_yh; _yh = dc_yh;
} }
void Execute(DrawerThread *thread) override void Execute(DrawerThread *thread) override
{ {
int count = dc_count; int count = _count;
int color = dc_color; int color = _color;
uint32_t *dest; uint32_t *dest;
if (count <= 0) if (count <= 0)
return; return;
{ {
int x = dc_x & 3; int x = _x & 3;
dest = &thread->dc_temp_rgba[x + 4 * dc_yl]; dest = &thread->dc_temp_rgba[x + 4 * _yl];
} }
if (count & 1) { if (count & 1) {