Add r_multithreaded and fix color issue

This commit is contained in:
Magnus Norddahl 2016-06-17 08:02:41 +02:00
parent 77c4786b9d
commit fee8650357
3 changed files with 1439 additions and 1264 deletions

File diff suppressed because it is too large Load Diff

View File

@ -184,6 +184,8 @@ public:
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
{ {
@ -227,7 +229,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

@ -59,8 +59,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)
@ -70,8 +70,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
@ -85,9 +85,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) {
@ -121,11 +121,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)
@ -135,11 +135,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
@ -154,15 +154,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);
@ -186,11 +186,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)
@ -199,11 +199,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
@ -219,15 +219,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);
@ -266,16 +266,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)
{ {
@ -507,13 +507,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)
@ -523,13 +523,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
@ -544,17 +544,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);
@ -583,13 +583,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)
@ -598,13 +598,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
@ -620,17 +620,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++)
@ -668,19 +668,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)
{ {
@ -764,11 +764,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)
@ -778,11 +778,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
@ -798,13 +798,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;
@ -833,11 +833,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)
@ -846,11 +846,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
@ -867,13 +867,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;
@ -912,13 +912,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 {
@ -957,12 +957,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)
@ -972,12 +972,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
@ -992,16 +992,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);
@ -1029,12 +1029,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)
@ -1043,12 +1043,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
@ -1064,16 +1064,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++)
@ -1110,18 +1110,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)
{ {
@ -1205,12 +1205,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)
@ -1220,12 +1220,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
@ -1240,16 +1240,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);
@ -1277,12 +1277,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)
@ -1291,12 +1291,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
@ -1311,16 +1311,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++)
@ -1353,12 +1353,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)
@ -1368,12 +1368,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
@ -1388,16 +1388,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);
@ -1425,12 +1425,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)
@ -1439,12 +1439,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
@ -1459,16 +1459,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++)
@ -1513,29 +1513,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;
@ -1544,13 +1544,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;
@ -1587,34 +1587,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) {