mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-14 16:41:13 +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,73 +1102,84 @@ 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
|
||||||
|
// has a better chance of optimizing this well.
|
||||||
|
const uint8_t *colormap = _colormap;
|
||||||
|
const uint8_t *source = _source;
|
||||||
|
|
||||||
|
// Inner loop that does the actual texture mapping,
|
||||||
|
// e.g. a DDA-lile scaling.
|
||||||
|
// This is as fast as it gets.
|
||||||
|
do
|
||||||
{
|
{
|
||||||
// [RH] Get local copies of these variables so that the compiler
|
// Re-map color indices from wall texture column
|
||||||
// has a better chance of optimizing this well.
|
// using a lighting/special effects LUT.
|
||||||
const BYTE *colormap = _colormap;
|
*dest = colormap[source[frac >> FRACBITS]];
|
||||||
const BYTE *source = _source;
|
|
||||||
int pitch = _pitch;
|
|
||||||
|
|
||||||
// Inner loop that does the actual texture mapping,
|
dest += pitch;
|
||||||
// e.g. a DDA-lile scaling.
|
frac += fracstep;
|
||||||
// This is as fast as it gets.
|
|
||||||
do
|
|
||||||
{
|
|
||||||
// Re-map color indices from wall texture column
|
|
||||||
// using a lighting/special effects LUT.
|
|
||||||
*dest = colormap[source[frac >> FRACBITS]];
|
|
||||||
|
|
||||||
dest += pitch;
|
} while (--count);
|
||||||
frac += fracstep;
|
|
||||||
|
|
||||||
} 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;
|
||||||
|
dest = thread->dest_for_thread(_dest_y, pitch, dest);
|
||||||
|
pitch *= thread->num_cores;
|
||||||
|
|
||||||
|
uint8_t color = _color;
|
||||||
|
do
|
||||||
{
|
{
|
||||||
int pitch = _pitch;
|
*dest = color;
|
||||||
BYTE color = _color;
|
dest += pitch;
|
||||||
|
} while (--count);
|
||||||
do
|
|
||||||
{
|
|
||||||
*dest = color;
|
|
||||||
dest += pitch;
|
|
||||||
} 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,385 +1301,425 @@ 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);
|
||||||
|
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;
|
||||||
|
|
||||||
|
uint32_t *fg2rgb = _srcblend;
|
||||||
|
uint32_t *bg2rgb = _destblend;
|
||||||
|
const uint8_t *colormap = _colormap;
|
||||||
|
const uint8_t *source = _source;
|
||||||
|
|
||||||
|
do
|
||||||
{
|
{
|
||||||
DWORD *fg2rgb = _srcblend;
|
uint32_t fg = colormap[source[frac >> FRACBITS]];
|
||||||
DWORD *bg2rgb = _destblend;
|
uint32_t bg = *dest;
|
||||||
const BYTE *colormap = _colormap;
|
|
||||||
const BYTE *source = _source;
|
|
||||||
int pitch = _pitch;
|
|
||||||
|
|
||||||
do
|
fg = fg2rgb[fg];
|
||||||
{
|
bg = bg2rgb[bg];
|
||||||
DWORD fg = colormap[source[frac >> FRACBITS]];
|
fg = (fg + bg) | 0x1f07c1f;
|
||||||
DWORD bg = *dest;
|
*dest = RGB32k.All[fg & (fg >> 15)];
|
||||||
|
dest += pitch;
|
||||||
fg = fg2rgb[fg];
|
frac += fracstep;
|
||||||
bg = bg2rgb[bg];
|
} while (--count);
|
||||||
fg = (fg + bg) | 0x1f07c1f;
|
|
||||||
*dest = RGB32k.All[fg & (fg >> 15)];
|
|
||||||
dest += pitch;
|
|
||||||
frac += fracstep;
|
|
||||||
} 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);
|
||||||
|
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] 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
|
||||||
{
|
{
|
||||||
// [RH] Local copies of global vars to improve compiler optimizations
|
*dest = colormap[translation[source[frac >> FRACBITS]]];
|
||||||
const BYTE *colormap = _colormap;
|
dest += pitch;
|
||||||
const BYTE *translation = _translation;
|
|
||||||
const BYTE *source = _source;
|
|
||||||
int pitch = _pitch;
|
|
||||||
|
|
||||||
do
|
frac += fracstep;
|
||||||
{
|
} while (--count);
|
||||||
*dest = colormap[translation[source[frac >> FRACBITS]]];
|
|
||||||
dest += pitch;
|
|
||||||
|
|
||||||
frac += fracstep;
|
|
||||||
} 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);
|
||||||
|
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;
|
||||||
|
|
||||||
|
uint32_t *fg2rgb = _srcblend;
|
||||||
|
uint32_t *bg2rgb = _destblend;
|
||||||
|
const uint8_t *translation = _translation;
|
||||||
|
const uint8_t *colormap = _colormap;
|
||||||
|
const uint8_t *source = _source;
|
||||||
|
|
||||||
|
do
|
||||||
{
|
{
|
||||||
DWORD *fg2rgb = _srcblend;
|
uint32_t fg = colormap[translation[source[frac >> FRACBITS]]];
|
||||||
DWORD *bg2rgb = _destblend;
|
uint32_t bg = *dest;
|
||||||
const BYTE *translation = _translation;
|
|
||||||
const BYTE *colormap = _colormap;
|
|
||||||
const BYTE *source = _source;
|
|
||||||
int pitch = _pitch;
|
|
||||||
|
|
||||||
do
|
fg = fg2rgb[fg];
|
||||||
{
|
bg = bg2rgb[bg];
|
||||||
DWORD fg = colormap[translation[source[frac >> FRACBITS]]];
|
fg = (fg + bg) | 0x1f07c1f;
|
||||||
DWORD bg = *dest;
|
*dest = RGB32k.All[fg & (fg >> 15)];
|
||||||
|
dest += pitch;
|
||||||
fg = fg2rgb[fg];
|
frac += fracstep;
|
||||||
bg = bg2rgb[bg];
|
} while (--count);
|
||||||
fg = (fg + bg) | 0x1f07c1f;
|
|
||||||
*dest = RGB32k.All[fg & (fg >> 15)];
|
|
||||||
dest += pitch;
|
|
||||||
frac += fracstep;
|
|
||||||
} 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);
|
||||||
|
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;
|
||||||
|
|
||||||
|
const uint8_t *source = _source;
|
||||||
|
const uint8_t *colormap = _colormap;
|
||||||
|
uint32_t *fgstart = &Col2RGB8[0][_color];
|
||||||
|
|
||||||
|
do
|
||||||
{
|
{
|
||||||
const BYTE *source = _source;
|
uint32_t val = colormap[source[frac >> FRACBITS]];
|
||||||
const BYTE *colormap = _colormap;
|
uint32_t fg = fgstart[val << 8];
|
||||||
int pitch = _pitch;
|
val = (Col2RGB8[64 - val][*dest] + fg) | 0x1f07c1f;
|
||||||
DWORD *fgstart = &Col2RGB8[0][_color];
|
*dest = RGB32k.All[val & (val >> 15)];
|
||||||
|
|
||||||
do
|
dest += pitch;
|
||||||
{
|
frac += fracstep;
|
||||||
DWORD val = colormap[source[frac >> FRACBITS]];
|
} while (--count);
|
||||||
DWORD fg = fgstart[val << 8];
|
|
||||||
val = (Col2RGB8[64 - val][*dest] + fg) | 0x1f07c1f;
|
|
||||||
*dest = RGB32k.All[val & (val >> 15)];
|
|
||||||
|
|
||||||
dest += pitch;
|
|
||||||
frac += fracstep;
|
|
||||||
} 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);
|
||||||
|
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;
|
||||||
|
|
||||||
|
const uint8_t *colormap = _colormap;
|
||||||
|
const uint8_t *source = _source;
|
||||||
|
uint32_t *fg2rgb = _srcblend;
|
||||||
|
uint32_t *bg2rgb = _destblend;
|
||||||
|
|
||||||
|
do
|
||||||
{
|
{
|
||||||
const BYTE *colormap = _colormap;
|
uint32_t a = fg2rgb[colormap[source[frac >> FRACBITS]]] + bg2rgb[*dest];
|
||||||
const BYTE *source = _source;
|
uint32_t b = a;
|
||||||
int pitch = _pitch;
|
|
||||||
DWORD *fg2rgb = _srcblend;
|
|
||||||
DWORD *bg2rgb = _destblend;
|
|
||||||
|
|
||||||
do
|
a |= 0x01f07c1f;
|
||||||
{
|
b &= 0x40100400;
|
||||||
DWORD a = fg2rgb[colormap[source[frac >> FRACBITS]]] + bg2rgb[*dest];
|
a &= 0x3fffffff;
|
||||||
DWORD b = a;
|
b = b - (b >> 5);
|
||||||
|
a |= b;
|
||||||
a |= 0x01f07c1f;
|
*dest = RGB32k.All[a & (a >> 15)];
|
||||||
b &= 0x40100400;
|
dest += pitch;
|
||||||
a &= 0x3fffffff;
|
frac += fracstep;
|
||||||
b = b - (b >> 5);
|
} while (--count);
|
||||||
a |= b;
|
|
||||||
*dest = RGB32k.All[a & (a >> 15)];
|
|
||||||
dest += pitch;
|
|
||||||
frac += fracstep;
|
|
||||||
} 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);
|
||||||
|
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;
|
||||||
|
|
||||||
|
const uint8_t *translation = _translation;
|
||||||
|
const uint8_t *colormap = _colormap;
|
||||||
|
const uint8_t *source = _source;
|
||||||
|
uint32_t *fg2rgb = _srcblend;
|
||||||
|
uint32_t *bg2rgb = _destblend;
|
||||||
|
|
||||||
|
do
|
||||||
{
|
{
|
||||||
const BYTE *translation = _translation;
|
uint32_t a = fg2rgb[colormap[translation[source[frac >> FRACBITS]]]] + bg2rgb[*dest];
|
||||||
const BYTE *colormap = _colormap;
|
uint32_t b = a;
|
||||||
const BYTE *source = _source;
|
|
||||||
int pitch = _pitch;
|
|
||||||
DWORD *fg2rgb = _srcblend;
|
|
||||||
DWORD *bg2rgb = _destblend;
|
|
||||||
|
|
||||||
do
|
a |= 0x01f07c1f;
|
||||||
{
|
b &= 0x40100400;
|
||||||
DWORD a = fg2rgb[colormap[translation[source[frac >> FRACBITS]]]] + bg2rgb[*dest];
|
a &= 0x3fffffff;
|
||||||
DWORD b = a;
|
b = b - (b >> 5);
|
||||||
|
a |= b;
|
||||||
a |= 0x01f07c1f;
|
*dest = RGB32k.All[(a >> 15) & a];
|
||||||
b &= 0x40100400;
|
dest += pitch;
|
||||||
a &= 0x3fffffff;
|
frac += fracstep;
|
||||||
b = b - (b >> 5);
|
} while (--count);
|
||||||
a |= b;
|
|
||||||
*dest = RGB32k.All[(a >> 15) & a];
|
|
||||||
dest += pitch;
|
|
||||||
frac += fracstep;
|
|
||||||
} 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);
|
||||||
|
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;
|
||||||
|
|
||||||
|
const uint8_t *colormap = _colormap;
|
||||||
|
const uint8_t *source = _source;
|
||||||
|
uint32_t *fg2rgb = _srcblend;
|
||||||
|
uint32_t *bg2rgb = _destblend;
|
||||||
|
|
||||||
|
do
|
||||||
{
|
{
|
||||||
const BYTE *colormap = _colormap;
|
uint32_t a = (fg2rgb[colormap[source[frac >> FRACBITS]]] | 0x40100400) - bg2rgb[*dest];
|
||||||
const BYTE *source = _source;
|
uint32_t b = a;
|
||||||
int pitch = _pitch;
|
|
||||||
DWORD *fg2rgb = _srcblend;
|
|
||||||
DWORD *bg2rgb = _destblend;
|
|
||||||
|
|
||||||
do
|
b &= 0x40100400;
|
||||||
{
|
b = b - (b >> 5);
|
||||||
DWORD a = (fg2rgb[colormap[source[frac >> FRACBITS]]] | 0x40100400) - bg2rgb[*dest];
|
a &= b;
|
||||||
DWORD b = a;
|
a |= 0x01f07c1f;
|
||||||
|
*dest = RGB32k.All[a & (a >> 15)];
|
||||||
b &= 0x40100400;
|
dest += pitch;
|
||||||
b = b - (b >> 5);
|
frac += fracstep;
|
||||||
a &= b;
|
} while (--count);
|
||||||
a |= 0x01f07c1f;
|
|
||||||
*dest = RGB32k.All[a & (a >> 15)];
|
|
||||||
dest += pitch;
|
|
||||||
frac += fracstep;
|
|
||||||
} 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);
|
||||||
|
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;
|
||||||
|
|
||||||
|
const uint8_t *translation = _translation;
|
||||||
|
const uint8_t *colormap = _colormap;
|
||||||
|
const uint8_t *source = _source;
|
||||||
|
uint32_t *fg2rgb = _srcblend;
|
||||||
|
uint32_t *bg2rgb = _destblend;
|
||||||
|
|
||||||
|
do
|
||||||
{
|
{
|
||||||
const BYTE *translation = _translation;
|
uint32_t a = (fg2rgb[colormap[translation[source[frac >> FRACBITS]]]] | 0x40100400) - bg2rgb[*dest];
|
||||||
const BYTE *colormap = _colormap;
|
uint32_t b = a;
|
||||||
const BYTE *source = _source;
|
|
||||||
int pitch = _pitch;
|
|
||||||
DWORD *fg2rgb = _srcblend;
|
|
||||||
DWORD *bg2rgb = _destblend;
|
|
||||||
|
|
||||||
do
|
b &= 0x40100400;
|
||||||
{
|
b = b - (b >> 5);
|
||||||
DWORD a = (fg2rgb[colormap[translation[source[frac >> FRACBITS]]]] | 0x40100400) - bg2rgb[*dest];
|
a &= b;
|
||||||
DWORD b = a;
|
a |= 0x01f07c1f;
|
||||||
|
*dest = RGB32k.All[(a >> 15) & a];
|
||||||
b &= 0x40100400;
|
dest += pitch;
|
||||||
b = b - (b >> 5);
|
frac += fracstep;
|
||||||
a &= b;
|
} while (--count);
|
||||||
a |= 0x01f07c1f;
|
|
||||||
*dest = RGB32k.All[(a >> 15) & a];
|
|
||||||
dest += pitch;
|
|
||||||
frac += fracstep;
|
|
||||||
} 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);
|
||||||
|
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;
|
||||||
|
|
||||||
|
const uint8_t *colormap = _colormap;
|
||||||
|
const uint8_t *source = _source;
|
||||||
|
uint32_t *fg2rgb = _srcblend;
|
||||||
|
uint32_t *bg2rgb = _destblend;
|
||||||
|
|
||||||
|
do
|
||||||
{
|
{
|
||||||
const BYTE *colormap = _colormap;
|
uint32_t a = (bg2rgb[*dest] | 0x40100400) - fg2rgb[colormap[source[frac >> FRACBITS]]];
|
||||||
const BYTE *source = _source;
|
uint32_t b = a;
|
||||||
int pitch = _pitch;
|
|
||||||
DWORD *fg2rgb = _srcblend;
|
|
||||||
DWORD *bg2rgb = _destblend;
|
|
||||||
|
|
||||||
do
|
b &= 0x40100400;
|
||||||
{
|
b = b - (b >> 5);
|
||||||
DWORD a = (bg2rgb[*dest] | 0x40100400) - fg2rgb[colormap[source[frac >> FRACBITS]]];
|
a &= b;
|
||||||
DWORD b = a;
|
a |= 0x01f07c1f;
|
||||||
|
*dest = RGB32k.All[a & (a >> 15)];
|
||||||
b &= 0x40100400;
|
dest += pitch;
|
||||||
b = b - (b >> 5);
|
frac += fracstep;
|
||||||
a &= b;
|
} while (--count);
|
||||||
a |= 0x01f07c1f;
|
|
||||||
*dest = RGB32k.All[a & (a >> 15)];
|
|
||||||
dest += pitch;
|
|
||||||
frac += fracstep;
|
|
||||||
} 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);
|
||||||
|
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;
|
||||||
|
|
||||||
|
const uint8_t *translation = _translation;
|
||||||
|
const uint8_t *colormap = _colormap;
|
||||||
|
const uint8_t *source = _source;
|
||||||
|
uint32_t *fg2rgb = _srcblend;
|
||||||
|
uint32_t *bg2rgb = _destblend;
|
||||||
|
|
||||||
|
do
|
||||||
{
|
{
|
||||||
const BYTE *translation = _translation;
|
uint32_t a = (bg2rgb[*dest] | 0x40100400) - fg2rgb[colormap[translation[source[frac >> FRACBITS]]]];
|
||||||
const BYTE *colormap = _colormap;
|
uint32_t b = a;
|
||||||
const BYTE *source = _source;
|
|
||||||
int pitch = _pitch;
|
|
||||||
DWORD *fg2rgb = _srcblend;
|
|
||||||
DWORD *bg2rgb = _destblend;
|
|
||||||
|
|
||||||
do
|
b &= 0x40100400;
|
||||||
{
|
b = b - (b >> 5);
|
||||||
DWORD a = (bg2rgb[*dest] | 0x40100400) - fg2rgb[colormap[translation[source[frac >> FRACBITS]]]];
|
a &= b;
|
||||||
DWORD b = a;
|
a |= 0x01f07c1f;
|
||||||
|
*dest = RGB32k.All[(a >> 15) & a];
|
||||||
b &= 0x40100400;
|
dest += pitch;
|
||||||
b = b - (b >> 5);
|
frac += fracstep;
|
||||||
a &= b;
|
} while (--count);
|
||||||
a |= 0x01f07c1f;
|
|
||||||
*dest = RGB32k.All[(a >> 15) & a];
|
|
||||||
dest += pitch;
|
|
||||||
frac += fracstep;
|
|
||||||
} 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