mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-14 08:30:50 +00:00
Thread awareness to column drawers
This commit is contained in:
parent
836c7a5351
commit
6122d982b7
1 changed files with 356 additions and 292 deletions
|
@ -1088,16 +1088,12 @@ namespace swrenderer
|
||||||
void DrawColumnPalCommand::Execute(DrawerThread *thread)
|
void DrawColumnPalCommand::Execute(DrawerThread *thread)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
BYTE *dest;
|
uint8_t *dest;
|
||||||
fixed_t frac;
|
fixed_t frac;
|
||||||
fixed_t fracstep;
|
fixed_t fracstep;
|
||||||
|
|
||||||
count = _count;
|
count = _count;
|
||||||
|
|
||||||
// Zero length, column does not exceed a pixel.
|
|
||||||
if (count <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Framebuffer destination address.
|
// Framebuffer destination address.
|
||||||
dest = _dest;
|
dest = _dest;
|
||||||
|
|
||||||
|
@ -1106,12 +1102,20 @@ namespace swrenderer
|
||||||
fracstep = _iscale;
|
fracstep = _iscale;
|
||||||
frac = _texturefrac;
|
frac = _texturefrac;
|
||||||
|
|
||||||
{
|
count = thread->count_for_thread(_dest_y, count);
|
||||||
|
if (count <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int pitch = _pitch;
|
||||||
|
dest = thread->dest_for_thread(_dest_y, pitch, dest);
|
||||||
|
frac += fracstep * thread->skipped_by_thread(_dest_y);
|
||||||
|
fracstep *= thread->num_cores;
|
||||||
|
pitch *= thread->num_cores;
|
||||||
|
|
||||||
// [RH] Get local copies of these variables so that the compiler
|
// [RH] Get local copies of these variables so that the compiler
|
||||||
// has a better chance of optimizing this well.
|
// has a better chance of optimizing this well.
|
||||||
const BYTE *colormap = _colormap;
|
const uint8_t *colormap = _colormap;
|
||||||
const BYTE *source = _source;
|
const uint8_t *source = _source;
|
||||||
int pitch = _pitch;
|
|
||||||
|
|
||||||
// Inner loop that does the actual texture mapping,
|
// Inner loop that does the actual texture mapping,
|
||||||
// e.g. a DDA-lile scaling.
|
// e.g. a DDA-lile scaling.
|
||||||
|
@ -1127,52 +1131,55 @@ namespace swrenderer
|
||||||
|
|
||||||
} while (--count);
|
} while (--count);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void FillColumnPalCommand::Execute(DrawerThread *thread)
|
void FillColumnPalCommand::Execute(DrawerThread *thread)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
BYTE *dest;
|
uint8_t *dest;
|
||||||
|
|
||||||
count = _count;
|
count = _count;
|
||||||
|
dest = _dest;
|
||||||
|
|
||||||
|
count = thread->count_for_thread(_dest_y, count);
|
||||||
if (count <= 0)
|
if (count <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dest = _dest;
|
|
||||||
|
|
||||||
{
|
|
||||||
int pitch = _pitch;
|
int pitch = _pitch;
|
||||||
BYTE color = _color;
|
dest = thread->dest_for_thread(_dest_y, pitch, dest);
|
||||||
|
pitch *= thread->num_cores;
|
||||||
|
|
||||||
|
uint8_t color = _color;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
*dest = color;
|
*dest = color;
|
||||||
dest += pitch;
|
dest += pitch;
|
||||||
} while (--count);
|
} while (--count);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void FillColumnAddPalCommand::Execute(DrawerThread *thread)
|
void FillColumnAddPalCommand::Execute(DrawerThread *thread)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
BYTE *dest;
|
uint8_t *dest;
|
||||||
|
|
||||||
count = _count;
|
count = _count;
|
||||||
if (count <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
dest = _dest;
|
dest = _dest;
|
||||||
DWORD *bg2rgb;
|
uint32_t *bg2rgb;
|
||||||
DWORD fg;
|
uint32_t fg;
|
||||||
|
|
||||||
bg2rgb = _destblend;
|
bg2rgb = _destblend;
|
||||||
fg = _srccolor;
|
fg = _srccolor;
|
||||||
int pitch = _pitch;
|
int pitch = _pitch;
|
||||||
|
|
||||||
|
count = thread->count_for_thread(_dest_y, count);
|
||||||
|
if (count <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
dest = thread->dest_for_thread(_dest_y, pitch, dest);
|
||||||
|
pitch *= thread->num_cores;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
DWORD bg;
|
uint32_t bg;
|
||||||
bg = (fg + bg2rgb[*dest]) | 0x1f07c1f;
|
bg = (fg + bg2rgb[*dest]) | 0x1f07c1f;
|
||||||
*dest = RGB32k.All[bg & (bg >> 15)];
|
*dest = RGB32k.All[bg & (bg >> 15)];
|
||||||
dest += pitch;
|
dest += pitch;
|
||||||
|
@ -1183,24 +1190,29 @@ namespace swrenderer
|
||||||
void FillColumnAddClampPalCommand::Execute(DrawerThread *thread)
|
void FillColumnAddClampPalCommand::Execute(DrawerThread *thread)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
BYTE *dest;
|
uint8_t *dest;
|
||||||
|
|
||||||
count = _count;
|
count = _count;
|
||||||
if (count <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
dest = _dest;
|
dest = _dest;
|
||||||
DWORD *bg2rgb;
|
uint32_t *bg2rgb;
|
||||||
DWORD fg;
|
uint32_t fg;
|
||||||
|
|
||||||
bg2rgb = _destblend;
|
bg2rgb = _destblend;
|
||||||
fg = _srccolor;
|
fg = _srccolor;
|
||||||
int pitch = _pitch;
|
int pitch = _pitch;
|
||||||
|
|
||||||
|
count = thread->count_for_thread(_dest_y, count);
|
||||||
|
if (count <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
dest = thread->dest_for_thread(_dest_y, pitch, dest);
|
||||||
|
pitch *= thread->num_cores;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
DWORD a = fg + bg2rgb[*dest];
|
uint32_t a = fg + bg2rgb[*dest];
|
||||||
DWORD b = a;
|
uint32_t b = a;
|
||||||
|
|
||||||
a |= 0x01f07c1f;
|
a |= 0x01f07c1f;
|
||||||
b &= 0x40100400;
|
b &= 0x40100400;
|
||||||
|
@ -1215,24 +1227,29 @@ namespace swrenderer
|
||||||
void FillColumnSubClampPalCommand::Execute(DrawerThread *thread)
|
void FillColumnSubClampPalCommand::Execute(DrawerThread *thread)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
BYTE *dest;
|
uint8_t *dest;
|
||||||
|
|
||||||
count = _count;
|
count = _count;
|
||||||
if (count <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
dest = _dest;
|
dest = _dest;
|
||||||
DWORD *bg2rgb;
|
uint32_t *bg2rgb;
|
||||||
DWORD fg;
|
uint32_t fg;
|
||||||
|
|
||||||
bg2rgb = _destblend;
|
bg2rgb = _destblend;
|
||||||
fg = _srccolor | 0x40100400;
|
fg = _srccolor | 0x40100400;
|
||||||
int pitch = _pitch;
|
int pitch = _pitch;
|
||||||
|
|
||||||
|
count = thread->count_for_thread(_dest_y, count);
|
||||||
|
if (count <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
dest = thread->dest_for_thread(_dest_y, pitch, dest);
|
||||||
|
pitch *= thread->num_cores;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
DWORD a = fg - bg2rgb[*dest];
|
uint32_t a = fg - bg2rgb[*dest];
|
||||||
DWORD b = a;
|
uint32_t b = a;
|
||||||
|
|
||||||
b &= 0x40100400;
|
b &= 0x40100400;
|
||||||
b = b - (b >> 5);
|
b = b - (b >> 5);
|
||||||
|
@ -1246,24 +1263,31 @@ namespace swrenderer
|
||||||
void FillColumnRevSubClampPalCommand::Execute(DrawerThread *thread)
|
void FillColumnRevSubClampPalCommand::Execute(DrawerThread *thread)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
BYTE *dest;
|
uint8_t *dest;
|
||||||
|
|
||||||
count = _count;
|
count = _count;
|
||||||
if (count <= 0)
|
if (count <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dest = _dest;
|
dest = _dest;
|
||||||
DWORD *bg2rgb;
|
uint32_t *bg2rgb;
|
||||||
DWORD fg;
|
uint32_t fg;
|
||||||
|
|
||||||
bg2rgb = _destblend;
|
bg2rgb = _destblend;
|
||||||
fg = _srccolor;
|
fg = _srccolor;
|
||||||
int pitch = _pitch;
|
int pitch = _pitch;
|
||||||
|
|
||||||
|
count = thread->count_for_thread(_dest_y, count);
|
||||||
|
if (count <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
dest = thread->dest_for_thread(_dest_y, pitch, dest);
|
||||||
|
pitch *= thread->num_cores;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
DWORD a = (bg2rgb[*dest] | 0x40100400) - fg;
|
uint32_t a = (bg2rgb[*dest] | 0x40100400) - fg;
|
||||||
DWORD b = a;
|
uint32_t b = a;
|
||||||
|
|
||||||
b &= 0x40100400;
|
b &= 0x40100400;
|
||||||
b = b - (b >> 5);
|
b = b - (b >> 5);
|
||||||
|
@ -1277,30 +1301,35 @@ namespace swrenderer
|
||||||
void DrawColumnAddPalCommand::Execute(DrawerThread *thread)
|
void DrawColumnAddPalCommand::Execute(DrawerThread *thread)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
BYTE *dest;
|
uint8_t *dest;
|
||||||
fixed_t frac;
|
fixed_t frac;
|
||||||
fixed_t fracstep;
|
fixed_t fracstep;
|
||||||
|
|
||||||
count = _count;
|
count = _count;
|
||||||
if (count <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
dest = _dest;
|
dest = _dest;
|
||||||
|
|
||||||
fracstep = _iscale;
|
fracstep = _iscale;
|
||||||
frac = _texturefrac;
|
frac = _texturefrac;
|
||||||
|
|
||||||
{
|
count = thread->count_for_thread(_dest_y, count);
|
||||||
DWORD *fg2rgb = _srcblend;
|
if (count <= 0)
|
||||||
DWORD *bg2rgb = _destblend;
|
return;
|
||||||
const BYTE *colormap = _colormap;
|
|
||||||
const BYTE *source = _source;
|
|
||||||
int pitch = _pitch;
|
int pitch = _pitch;
|
||||||
|
dest = thread->dest_for_thread(_dest_y, pitch, dest);
|
||||||
|
frac += fracstep * thread->skipped_by_thread(_dest_y);
|
||||||
|
fracstep *= thread->num_cores;
|
||||||
|
pitch *= thread->num_cores;
|
||||||
|
|
||||||
|
uint32_t *fg2rgb = _srcblend;
|
||||||
|
uint32_t *bg2rgb = _destblend;
|
||||||
|
const uint8_t *colormap = _colormap;
|
||||||
|
const uint8_t *source = _source;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
DWORD fg = colormap[source[frac >> FRACBITS]];
|
uint32_t fg = colormap[source[frac >> FRACBITS]];
|
||||||
DWORD bg = *dest;
|
uint32_t bg = *dest;
|
||||||
|
|
||||||
fg = fg2rgb[fg];
|
fg = fg2rgb[fg];
|
||||||
bg = bg2rgb[bg];
|
bg = bg2rgb[bg];
|
||||||
|
@ -1310,30 +1339,35 @@ namespace swrenderer
|
||||||
frac += fracstep;
|
frac += fracstep;
|
||||||
} while (--count);
|
} while (--count);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void DrawColumnTranslatedPalCommand::Execute(DrawerThread *thread)
|
void DrawColumnTranslatedPalCommand::Execute(DrawerThread *thread)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
BYTE* dest;
|
uint8_t* dest;
|
||||||
fixed_t frac;
|
fixed_t frac;
|
||||||
fixed_t fracstep;
|
fixed_t fracstep;
|
||||||
|
|
||||||
count = _count;
|
count = _count;
|
||||||
if (count <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
dest = _dest;
|
dest = _dest;
|
||||||
|
|
||||||
fracstep = _iscale;
|
fracstep = _iscale;
|
||||||
frac = _texturefrac;
|
frac = _texturefrac;
|
||||||
|
|
||||||
{
|
count = thread->count_for_thread(_dest_y, count);
|
||||||
// [RH] Local copies of global vars to improve compiler optimizations
|
if (count <= 0)
|
||||||
const BYTE *colormap = _colormap;
|
return;
|
||||||
const BYTE *translation = _translation;
|
|
||||||
const BYTE *source = _source;
|
|
||||||
int pitch = _pitch;
|
int pitch = _pitch;
|
||||||
|
dest = thread->dest_for_thread(_dest_y, pitch, dest);
|
||||||
|
frac += fracstep * thread->skipped_by_thread(_dest_y);
|
||||||
|
fracstep *= thread->num_cores;
|
||||||
|
pitch *= thread->num_cores;
|
||||||
|
|
||||||
|
// [RH] Local copies of global vars to improve compiler optimizations
|
||||||
|
const uint8_t *colormap = _colormap;
|
||||||
|
const uint8_t *translation = _translation;
|
||||||
|
const uint8_t *source = _source;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -1343,36 +1377,40 @@ namespace swrenderer
|
||||||
frac += fracstep;
|
frac += fracstep;
|
||||||
} while (--count);
|
} while (--count);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void DrawColumnTlatedAddPalCommand::Execute(DrawerThread *thread)
|
void DrawColumnTlatedAddPalCommand::Execute(DrawerThread *thread)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
BYTE *dest;
|
uint8_t *dest;
|
||||||
fixed_t frac;
|
fixed_t frac;
|
||||||
fixed_t fracstep;
|
fixed_t fracstep;
|
||||||
|
|
||||||
count = _count;
|
count = _count;
|
||||||
if (count <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
dest = _dest;
|
dest = _dest;
|
||||||
|
|
||||||
fracstep = _iscale;
|
fracstep = _iscale;
|
||||||
frac = _texturefrac;
|
frac = _texturefrac;
|
||||||
|
|
||||||
{
|
count = thread->count_for_thread(_dest_y, count);
|
||||||
DWORD *fg2rgb = _srcblend;
|
if (count <= 0)
|
||||||
DWORD *bg2rgb = _destblend;
|
return;
|
||||||
const BYTE *translation = _translation;
|
|
||||||
const BYTE *colormap = _colormap;
|
|
||||||
const BYTE *source = _source;
|
|
||||||
int pitch = _pitch;
|
int pitch = _pitch;
|
||||||
|
dest = thread->dest_for_thread(_dest_y, pitch, dest);
|
||||||
|
frac += fracstep * thread->skipped_by_thread(_dest_y);
|
||||||
|
fracstep *= thread->num_cores;
|
||||||
|
pitch *= thread->num_cores;
|
||||||
|
|
||||||
|
uint32_t *fg2rgb = _srcblend;
|
||||||
|
uint32_t *bg2rgb = _destblend;
|
||||||
|
const uint8_t *translation = _translation;
|
||||||
|
const uint8_t *colormap = _colormap;
|
||||||
|
const uint8_t *source = _source;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
DWORD fg = colormap[translation[source[frac >> FRACBITS]]];
|
uint32_t fg = colormap[translation[source[frac >> FRACBITS]]];
|
||||||
DWORD bg = *dest;
|
uint32_t bg = *dest;
|
||||||
|
|
||||||
fg = fg2rgb[fg];
|
fg = fg2rgb[fg];
|
||||||
bg = bg2rgb[bg];
|
bg = bg2rgb[bg];
|
||||||
|
@ -1382,34 +1420,37 @@ namespace swrenderer
|
||||||
frac += fracstep;
|
frac += fracstep;
|
||||||
} while (--count);
|
} while (--count);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void DrawColumnShadedPalCommand::Execute(DrawerThread *thread)
|
void DrawColumnShadedPalCommand::Execute(DrawerThread *thread)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
BYTE *dest;
|
uint8_t *dest;
|
||||||
fixed_t frac, fracstep;
|
fixed_t frac, fracstep;
|
||||||
|
|
||||||
count = _count;
|
count = _count;
|
||||||
|
|
||||||
if (count <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
dest = _dest;
|
dest = _dest;
|
||||||
|
|
||||||
fracstep = _iscale;
|
fracstep = _iscale;
|
||||||
frac = _texturefrac;
|
frac = _texturefrac;
|
||||||
|
|
||||||
{
|
count = thread->count_for_thread(_dest_y, count);
|
||||||
const BYTE *source = _source;
|
if (count <= 0)
|
||||||
const BYTE *colormap = _colormap;
|
return;
|
||||||
|
|
||||||
int pitch = _pitch;
|
int pitch = _pitch;
|
||||||
DWORD *fgstart = &Col2RGB8[0][_color];
|
dest = thread->dest_for_thread(_dest_y, pitch, dest);
|
||||||
|
frac += fracstep * thread->skipped_by_thread(_dest_y);
|
||||||
|
fracstep *= thread->num_cores;
|
||||||
|
pitch *= thread->num_cores;
|
||||||
|
|
||||||
|
const uint8_t *source = _source;
|
||||||
|
const uint8_t *colormap = _colormap;
|
||||||
|
uint32_t *fgstart = &Col2RGB8[0][_color];
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
DWORD val = colormap[source[frac >> FRACBITS]];
|
uint32_t val = colormap[source[frac >> FRACBITS]];
|
||||||
DWORD fg = fgstart[val << 8];
|
uint32_t fg = fgstart[val << 8];
|
||||||
val = (Col2RGB8[64 - val][*dest] + fg) | 0x1f07c1f;
|
val = (Col2RGB8[64 - val][*dest] + fg) | 0x1f07c1f;
|
||||||
*dest = RGB32k.All[val & (val >> 15)];
|
*dest = RGB32k.All[val & (val >> 15)];
|
||||||
|
|
||||||
|
@ -1417,35 +1458,39 @@ namespace swrenderer
|
||||||
frac += fracstep;
|
frac += fracstep;
|
||||||
} while (--count);
|
} while (--count);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void DrawColumnAddClampPalCommand::Execute(DrawerThread *thread)
|
void DrawColumnAddClampPalCommand::Execute(DrawerThread *thread)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
BYTE *dest;
|
uint8_t *dest;
|
||||||
fixed_t frac;
|
fixed_t frac;
|
||||||
fixed_t fracstep;
|
fixed_t fracstep;
|
||||||
|
|
||||||
count = _count;
|
count = _count;
|
||||||
if (count <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
dest = _dest;
|
dest = _dest;
|
||||||
|
|
||||||
fracstep = _iscale;
|
fracstep = _iscale;
|
||||||
frac = _texturefrac;
|
frac = _texturefrac;
|
||||||
|
|
||||||
{
|
count = thread->count_for_thread(_dest_y, count);
|
||||||
const BYTE *colormap = _colormap;
|
if (count <= 0)
|
||||||
const BYTE *source = _source;
|
return;
|
||||||
|
|
||||||
int pitch = _pitch;
|
int pitch = _pitch;
|
||||||
DWORD *fg2rgb = _srcblend;
|
dest = thread->dest_for_thread(_dest_y, pitch, dest);
|
||||||
DWORD *bg2rgb = _destblend;
|
frac += fracstep * thread->skipped_by_thread(_dest_y);
|
||||||
|
fracstep *= thread->num_cores;
|
||||||
|
pitch *= thread->num_cores;
|
||||||
|
|
||||||
|
const uint8_t *colormap = _colormap;
|
||||||
|
const uint8_t *source = _source;
|
||||||
|
uint32_t *fg2rgb = _srcblend;
|
||||||
|
uint32_t *bg2rgb = _destblend;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
DWORD a = fg2rgb[colormap[source[frac >> FRACBITS]]] + bg2rgb[*dest];
|
uint32_t a = fg2rgb[colormap[source[frac >> FRACBITS]]] + bg2rgb[*dest];
|
||||||
DWORD b = a;
|
uint32_t b = a;
|
||||||
|
|
||||||
a |= 0x01f07c1f;
|
a |= 0x01f07c1f;
|
||||||
b &= 0x40100400;
|
b &= 0x40100400;
|
||||||
|
@ -1457,36 +1502,40 @@ namespace swrenderer
|
||||||
frac += fracstep;
|
frac += fracstep;
|
||||||
} while (--count);
|
} while (--count);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void DrawColumnAddClampTranslatedPalCommand::Execute(DrawerThread *thread)
|
void DrawColumnAddClampTranslatedPalCommand::Execute(DrawerThread *thread)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
BYTE *dest;
|
uint8_t *dest;
|
||||||
fixed_t frac;
|
fixed_t frac;
|
||||||
fixed_t fracstep;
|
fixed_t fracstep;
|
||||||
|
|
||||||
count = _count;
|
count = _count;
|
||||||
if (count <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
dest = _dest;
|
dest = _dest;
|
||||||
|
|
||||||
fracstep = _iscale;
|
fracstep = _iscale;
|
||||||
frac = _texturefrac;
|
frac = _texturefrac;
|
||||||
|
|
||||||
{
|
count = thread->count_for_thread(_dest_y, count);
|
||||||
const BYTE *translation = _translation;
|
if (count <= 0)
|
||||||
const BYTE *colormap = _colormap;
|
return;
|
||||||
const BYTE *source = _source;
|
|
||||||
int pitch = _pitch;
|
int pitch = _pitch;
|
||||||
DWORD *fg2rgb = _srcblend;
|
dest = thread->dest_for_thread(_dest_y, pitch, dest);
|
||||||
DWORD *bg2rgb = _destblend;
|
frac += fracstep * thread->skipped_by_thread(_dest_y);
|
||||||
|
fracstep *= thread->num_cores;
|
||||||
|
pitch *= thread->num_cores;
|
||||||
|
|
||||||
|
const uint8_t *translation = _translation;
|
||||||
|
const uint8_t *colormap = _colormap;
|
||||||
|
const uint8_t *source = _source;
|
||||||
|
uint32_t *fg2rgb = _srcblend;
|
||||||
|
uint32_t *bg2rgb = _destblend;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
DWORD a = fg2rgb[colormap[translation[source[frac >> FRACBITS]]]] + bg2rgb[*dest];
|
uint32_t a = fg2rgb[colormap[translation[source[frac >> FRACBITS]]]] + bg2rgb[*dest];
|
||||||
DWORD b = a;
|
uint32_t b = a;
|
||||||
|
|
||||||
a |= 0x01f07c1f;
|
a |= 0x01f07c1f;
|
||||||
b &= 0x40100400;
|
b &= 0x40100400;
|
||||||
|
@ -1498,35 +1547,39 @@ namespace swrenderer
|
||||||
frac += fracstep;
|
frac += fracstep;
|
||||||
} while (--count);
|
} while (--count);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void DrawColumnSubClampPalCommand::Execute(DrawerThread *thread)
|
void DrawColumnSubClampPalCommand::Execute(DrawerThread *thread)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
BYTE *dest;
|
uint8_t *dest;
|
||||||
fixed_t frac;
|
fixed_t frac;
|
||||||
fixed_t fracstep;
|
fixed_t fracstep;
|
||||||
|
|
||||||
count = _count;
|
count = _count;
|
||||||
if (count <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
dest = _dest;
|
dest = _dest;
|
||||||
|
|
||||||
fracstep = _iscale;
|
fracstep = _iscale;
|
||||||
frac = _texturefrac;
|
frac = _texturefrac;
|
||||||
|
|
||||||
{
|
count = thread->count_for_thread(_dest_y, count);
|
||||||
const BYTE *colormap = _colormap;
|
if (count <= 0)
|
||||||
const BYTE *source = _source;
|
return;
|
||||||
|
|
||||||
int pitch = _pitch;
|
int pitch = _pitch;
|
||||||
DWORD *fg2rgb = _srcblend;
|
dest = thread->dest_for_thread(_dest_y, pitch, dest);
|
||||||
DWORD *bg2rgb = _destblend;
|
frac += fracstep * thread->skipped_by_thread(_dest_y);
|
||||||
|
fracstep *= thread->num_cores;
|
||||||
|
pitch *= thread->num_cores;
|
||||||
|
|
||||||
|
const uint8_t *colormap = _colormap;
|
||||||
|
const uint8_t *source = _source;
|
||||||
|
uint32_t *fg2rgb = _srcblend;
|
||||||
|
uint32_t *bg2rgb = _destblend;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
DWORD a = (fg2rgb[colormap[source[frac >> FRACBITS]]] | 0x40100400) - bg2rgb[*dest];
|
uint32_t a = (fg2rgb[colormap[source[frac >> FRACBITS]]] | 0x40100400) - bg2rgb[*dest];
|
||||||
DWORD b = a;
|
uint32_t b = a;
|
||||||
|
|
||||||
b &= 0x40100400;
|
b &= 0x40100400;
|
||||||
b = b - (b >> 5);
|
b = b - (b >> 5);
|
||||||
|
@ -1537,36 +1590,40 @@ namespace swrenderer
|
||||||
frac += fracstep;
|
frac += fracstep;
|
||||||
} while (--count);
|
} while (--count);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void DrawColumnSubClampTranslatedPalCommand::Execute(DrawerThread *thread)
|
void DrawColumnSubClampTranslatedPalCommand::Execute(DrawerThread *thread)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
BYTE *dest;
|
uint8_t *dest;
|
||||||
fixed_t frac;
|
fixed_t frac;
|
||||||
fixed_t fracstep;
|
fixed_t fracstep;
|
||||||
|
|
||||||
count = _count;
|
count = _count;
|
||||||
if (count <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
dest = _dest;
|
dest = _dest;
|
||||||
|
|
||||||
fracstep = _iscale;
|
fracstep = _iscale;
|
||||||
frac = _texturefrac;
|
frac = _texturefrac;
|
||||||
|
|
||||||
{
|
count = thread->count_for_thread(_dest_y, count);
|
||||||
const BYTE *translation = _translation;
|
if (count <= 0)
|
||||||
const BYTE *colormap = _colormap;
|
return;
|
||||||
const BYTE *source = _source;
|
|
||||||
int pitch = _pitch;
|
int pitch = _pitch;
|
||||||
DWORD *fg2rgb = _srcblend;
|
dest = thread->dest_for_thread(_dest_y, pitch, dest);
|
||||||
DWORD *bg2rgb = _destblend;
|
frac += fracstep * thread->skipped_by_thread(_dest_y);
|
||||||
|
fracstep *= thread->num_cores;
|
||||||
|
pitch *= thread->num_cores;
|
||||||
|
|
||||||
|
const uint8_t *translation = _translation;
|
||||||
|
const uint8_t *colormap = _colormap;
|
||||||
|
const uint8_t *source = _source;
|
||||||
|
uint32_t *fg2rgb = _srcblend;
|
||||||
|
uint32_t *bg2rgb = _destblend;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
DWORD a = (fg2rgb[colormap[translation[source[frac >> FRACBITS]]]] | 0x40100400) - bg2rgb[*dest];
|
uint32_t a = (fg2rgb[colormap[translation[source[frac >> FRACBITS]]]] | 0x40100400) - bg2rgb[*dest];
|
||||||
DWORD b = a;
|
uint32_t b = a;
|
||||||
|
|
||||||
b &= 0x40100400;
|
b &= 0x40100400;
|
||||||
b = b - (b >> 5);
|
b = b - (b >> 5);
|
||||||
|
@ -1577,35 +1634,39 @@ namespace swrenderer
|
||||||
frac += fracstep;
|
frac += fracstep;
|
||||||
} while (--count);
|
} while (--count);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void DrawColumnRevSubClampPalCommand::Execute(DrawerThread *thread)
|
void DrawColumnRevSubClampPalCommand::Execute(DrawerThread *thread)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
BYTE *dest;
|
uint8_t *dest;
|
||||||
fixed_t frac;
|
fixed_t frac;
|
||||||
fixed_t fracstep;
|
fixed_t fracstep;
|
||||||
|
|
||||||
count = _count;
|
count = _count;
|
||||||
if (count <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
dest = _dest;
|
dest = _dest;
|
||||||
|
|
||||||
fracstep = _iscale;
|
fracstep = _iscale;
|
||||||
frac = _texturefrac;
|
frac = _texturefrac;
|
||||||
|
|
||||||
{
|
count = thread->count_for_thread(_dest_y, count);
|
||||||
const BYTE *colormap = _colormap;
|
if (count <= 0)
|
||||||
const BYTE *source = _source;
|
return;
|
||||||
|
|
||||||
int pitch = _pitch;
|
int pitch = _pitch;
|
||||||
DWORD *fg2rgb = _srcblend;
|
dest = thread->dest_for_thread(_dest_y, pitch, dest);
|
||||||
DWORD *bg2rgb = _destblend;
|
frac += fracstep * thread->skipped_by_thread(_dest_y);
|
||||||
|
fracstep *= thread->num_cores;
|
||||||
|
pitch *= thread->num_cores;
|
||||||
|
|
||||||
|
const uint8_t *colormap = _colormap;
|
||||||
|
const uint8_t *source = _source;
|
||||||
|
uint32_t *fg2rgb = _srcblend;
|
||||||
|
uint32_t *bg2rgb = _destblend;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
DWORD a = (bg2rgb[*dest] | 0x40100400) - fg2rgb[colormap[source[frac >> FRACBITS]]];
|
uint32_t a = (bg2rgb[*dest] | 0x40100400) - fg2rgb[colormap[source[frac >> FRACBITS]]];
|
||||||
DWORD b = a;
|
uint32_t b = a;
|
||||||
|
|
||||||
b &= 0x40100400;
|
b &= 0x40100400;
|
||||||
b = b - (b >> 5);
|
b = b - (b >> 5);
|
||||||
|
@ -1616,36 +1677,40 @@ namespace swrenderer
|
||||||
frac += fracstep;
|
frac += fracstep;
|
||||||
} while (--count);
|
} while (--count);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void DrawColumnRevSubClampTranslatedPalCommand::Execute(DrawerThread *thread)
|
void DrawColumnRevSubClampTranslatedPalCommand::Execute(DrawerThread *thread)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
BYTE *dest;
|
uint8_t *dest;
|
||||||
fixed_t frac;
|
fixed_t frac;
|
||||||
fixed_t fracstep;
|
fixed_t fracstep;
|
||||||
|
|
||||||
count = _count;
|
count = _count;
|
||||||
if (count <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
dest = _dest;
|
dest = _dest;
|
||||||
|
|
||||||
fracstep = _iscale;
|
fracstep = _iscale;
|
||||||
frac = _texturefrac;
|
frac = _texturefrac;
|
||||||
|
|
||||||
{
|
count = thread->count_for_thread(_dest_y, count);
|
||||||
const BYTE *translation = _translation;
|
if (count <= 0)
|
||||||
const BYTE *colormap = _colormap;
|
return;
|
||||||
const BYTE *source = _source;
|
|
||||||
int pitch = _pitch;
|
int pitch = _pitch;
|
||||||
DWORD *fg2rgb = _srcblend;
|
dest = thread->dest_for_thread(_dest_y, pitch, dest);
|
||||||
DWORD *bg2rgb = _destblend;
|
frac += fracstep * thread->skipped_by_thread(_dest_y);
|
||||||
|
fracstep *= thread->num_cores;
|
||||||
|
pitch *= thread->num_cores;
|
||||||
|
|
||||||
|
const uint8_t *translation = _translation;
|
||||||
|
const uint8_t *colormap = _colormap;
|
||||||
|
const uint8_t *source = _source;
|
||||||
|
uint32_t *fg2rgb = _srcblend;
|
||||||
|
uint32_t *bg2rgb = _destblend;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
DWORD a = (bg2rgb[*dest] | 0x40100400) - fg2rgb[colormap[translation[source[frac >> FRACBITS]]]];
|
uint32_t a = (bg2rgb[*dest] | 0x40100400) - fg2rgb[colormap[translation[source[frac >> FRACBITS]]]];
|
||||||
DWORD b = a;
|
uint32_t b = a;
|
||||||
|
|
||||||
b &= 0x40100400;
|
b &= 0x40100400;
|
||||||
b = b - (b >> 5);
|
b = b - (b >> 5);
|
||||||
|
@ -1656,7 +1721,6 @@ namespace swrenderer
|
||||||
frac += fracstep;
|
frac += fracstep;
|
||||||
} while (--count);
|
} while (--count);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -1674,7 +1738,7 @@ namespace swrenderer
|
||||||
void DrawFuzzColumnPalCommand::Execute(DrawerThread *thread)
|
void DrawFuzzColumnPalCommand::Execute(DrawerThread *thread)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
BYTE *dest;
|
uint8_t *dest;
|
||||||
|
|
||||||
// Adjust borders. Low...
|
// Adjust borders. Low...
|
||||||
if (_yl == 0)
|
if (_yl == 0)
|
||||||
|
@ -1701,7 +1765,7 @@ namespace swrenderer
|
||||||
int pitch = _pitch;
|
int pitch = _pitch;
|
||||||
int fuzz = fuzzpos;
|
int fuzz = fuzzpos;
|
||||||
int cnt;
|
int cnt;
|
||||||
BYTE *map = &NormalLight.Maps[6 * 256];
|
uint8_t *map = &NormalLight.Maps[6 * 256];
|
||||||
|
|
||||||
// [RH] Split this into three separate loops to minimize
|
// [RH] Split this into three separate loops to minimize
|
||||||
// the number of times fuzzpos needs to be clamped.
|
// the number of times fuzzpos needs to be clamped.
|
||||||
|
@ -1767,7 +1831,7 @@ namespace swrenderer
|
||||||
|
|
||||||
void DrawSpanPalCommand::Execute(DrawerThread *thread)
|
void DrawSpanPalCommand::Execute(DrawerThread *thread)
|
||||||
{
|
{
|
||||||
if (thread->skipped_by_thread(_dest_y))
|
if (thread->skipped_by_thread(_y))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dsfixed_t xfrac;
|
dsfixed_t xfrac;
|
||||||
|
@ -1831,7 +1895,7 @@ namespace swrenderer
|
||||||
|
|
||||||
void DrawSpanMaskedPalCommand::Execute(DrawerThread *thread)
|
void DrawSpanMaskedPalCommand::Execute(DrawerThread *thread)
|
||||||
{
|
{
|
||||||
if (thread->skipped_by_thread(_dest_y))
|
if (thread->skipped_by_thread(_y))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dsfixed_t xfrac;
|
dsfixed_t xfrac;
|
||||||
|
@ -1896,7 +1960,7 @@ namespace swrenderer
|
||||||
|
|
||||||
void DrawSpanTranslucentPalCommand::Execute(DrawerThread *thread)
|
void DrawSpanTranslucentPalCommand::Execute(DrawerThread *thread)
|
||||||
{
|
{
|
||||||
if (thread->skipped_by_thread(_dest_y))
|
if (thread->skipped_by_thread(_y))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dsfixed_t xfrac;
|
dsfixed_t xfrac;
|
||||||
|
@ -1959,7 +2023,7 @@ namespace swrenderer
|
||||||
|
|
||||||
void DrawSpanMaskedTranslucentPalCommand::Execute(DrawerThread *thread)
|
void DrawSpanMaskedTranslucentPalCommand::Execute(DrawerThread *thread)
|
||||||
{
|
{
|
||||||
if (thread->skipped_by_thread(_dest_y))
|
if (thread->skipped_by_thread(_y))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dsfixed_t xfrac;
|
dsfixed_t xfrac;
|
||||||
|
@ -2036,7 +2100,7 @@ namespace swrenderer
|
||||||
|
|
||||||
void DrawSpanAddClampPalCommand::Execute(DrawerThread *thread)
|
void DrawSpanAddClampPalCommand::Execute(DrawerThread *thread)
|
||||||
{
|
{
|
||||||
if (thread->skipped_by_thread(_dest_y))
|
if (thread->skipped_by_thread(_y))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dsfixed_t xfrac;
|
dsfixed_t xfrac;
|
||||||
|
@ -2105,7 +2169,7 @@ namespace swrenderer
|
||||||
|
|
||||||
void DrawSpanMaskedAddClampPalCommand::Execute(DrawerThread *thread)
|
void DrawSpanMaskedAddClampPalCommand::Execute(DrawerThread *thread)
|
||||||
{
|
{
|
||||||
if (thread->skipped_by_thread(_dest_y))
|
if (thread->skipped_by_thread(_y))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dsfixed_t xfrac;
|
dsfixed_t xfrac;
|
||||||
|
|
Loading…
Reference in a new issue