mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-28 06:42:09 +00:00
Merge remote-tracking branch 'zdoom/master' into qzdoom
# Conflicts: # src/r_draw.cpp # src/r_draw.h # src/r_plane.cpp
This commit is contained in:
commit
452e0dcfc9
7 changed files with 270 additions and 397 deletions
131
src/r_draw.cpp
131
src/r_draw.cpp
|
@ -100,17 +100,15 @@ namespace swrenderer
|
|||
uint8_t *dc_destorg;
|
||||
int dc_destheight;
|
||||
int dc_count;
|
||||
uint32_t vplce[4];
|
||||
uint32_t vince[4];
|
||||
uint8_t *palookupoffse[4];
|
||||
fixed_t palookuplight[4];
|
||||
const uint8_t *bufplce[4];
|
||||
const uint8_t *bufplce2[4];
|
||||
uint32_t buftexturefracx[4];
|
||||
uint32_t bufheight[4];
|
||||
int vlinebits;
|
||||
int mvlinebits;
|
||||
int tmvlinebits;
|
||||
uint32_t dc_wall_texturefrac[4];
|
||||
uint32_t dc_wall_iscale[4];
|
||||
uint8_t *dc_wall_colormap[4];
|
||||
fixed_t dc_wall_light[4];
|
||||
const uint8_t *dc_wall_source[4];
|
||||
const uint8_t *dc_wall_source2[4];
|
||||
uint32_t dc_wall_texturefracx[4];
|
||||
uint32_t dc_wall_sourceheight[4];
|
||||
int dc_wall_fracbits;
|
||||
int ds_y;
|
||||
int ds_x1;
|
||||
int ds_x2;
|
||||
|
@ -525,50 +523,35 @@ namespace swrenderer
|
|||
return tex->GetColumn(col, nullptr);
|
||||
}
|
||||
|
||||
bool R_GetTransMaskDrawers(fixed_t(**tmvline1)(), void(**tmvline4)())
|
||||
bool R_GetTransMaskDrawers(void(**drawCol1)(), void(**drawCol4)())
|
||||
{
|
||||
if (colfunc == R_DrawAddColumn)
|
||||
{
|
||||
*tmvline1 = tmvline1_add;
|
||||
*tmvline4 = tmvline4_add;
|
||||
*drawCol1 = R_DrawWallAddCol1;
|
||||
*drawCol4 = R_DrawWallAddCol4;
|
||||
return true;
|
||||
}
|
||||
if (colfunc == R_DrawAddClampColumn)
|
||||
{
|
||||
*tmvline1 = tmvline1_addclamp;
|
||||
*tmvline4 = tmvline4_addclamp;
|
||||
*drawCol1 = R_DrawWallAddClampCol1;
|
||||
*drawCol4 = R_DrawWallAddClampCol4;
|
||||
return true;
|
||||
}
|
||||
if (colfunc == R_DrawSubClampColumn)
|
||||
{
|
||||
*tmvline1 = tmvline1_subclamp;
|
||||
*tmvline4 = tmvline4_subclamp;
|
||||
*drawCol1 = R_DrawWallSubClampCol1;
|
||||
*drawCol4 = R_DrawWallSubClampCol4;
|
||||
return true;
|
||||
}
|
||||
if (colfunc == R_DrawRevSubClampColumn)
|
||||
{
|
||||
*tmvline1 = tmvline1_revsubclamp;
|
||||
*tmvline4 = tmvline4_revsubclamp;
|
||||
*drawCol1 = R_DrawWallRevSubClampCol1;
|
||||
*drawCol4 = R_DrawWallRevSubClampCol4;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void setupvline(int fracbits)
|
||||
{
|
||||
drawerargs::vlinebits = fracbits;
|
||||
}
|
||||
|
||||
void setupmvline(int fracbits)
|
||||
{
|
||||
drawerargs::mvlinebits = fracbits;
|
||||
}
|
||||
|
||||
void setuptmvline(int fracbits)
|
||||
{
|
||||
drawerargs::tmvlinebits = fracbits;
|
||||
}
|
||||
|
||||
void R_SetColorMapLight(FSWColormap *base_colormap, float light, int shade)
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
@ -1185,154 +1168,100 @@ namespace swrenderer
|
|||
}
|
||||
}
|
||||
|
||||
uint32_t vlinec1()
|
||||
void R_DrawWallCol1()
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawWall1LLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawWall1PalCommand>();
|
||||
|
||||
return dc_texturefrac + dc_count * dc_iscale;
|
||||
}
|
||||
|
||||
void vlinec4()
|
||||
void R_DrawWallCol4()
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawWall4LLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawWall4PalCommand>();
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
vplce[i] += vince[i] * dc_count;
|
||||
}
|
||||
|
||||
uint32_t mvlinec1()
|
||||
void R_DrawWallMaskedCol1()
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawWallMasked1LLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawWallMasked1PalCommand>();
|
||||
|
||||
return dc_texturefrac + dc_count * dc_iscale;
|
||||
}
|
||||
|
||||
void mvlinec4()
|
||||
void R_DrawWallMaskedCol4()
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawWallMasked4LLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawWallMasked4PalCommand>();
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
vplce[i] += vince[i] * dc_count;
|
||||
}
|
||||
|
||||
fixed_t tmvline1_add()
|
||||
void R_DrawWallAddCol1()
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawWallAdd1LLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawWallAdd1PalCommand>();
|
||||
|
||||
return dc_texturefrac + dc_count * dc_iscale;
|
||||
}
|
||||
|
||||
void tmvline4_add()
|
||||
void R_DrawWallAddCol4()
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawWallAdd4LLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawWallAdd4PalCommand>();
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
vplce[i] += vince[i] * dc_count;
|
||||
}
|
||||
|
||||
fixed_t tmvline1_addclamp()
|
||||
void R_DrawWallAddClampCol1()
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawWallAddClamp1LLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawWallAddClamp1PalCommand>();
|
||||
|
||||
return dc_texturefrac + dc_count * dc_iscale;
|
||||
}
|
||||
|
||||
void tmvline4_addclamp()
|
||||
void R_DrawWallAddClampCol4()
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawWallAddClamp4LLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawWallAddClamp4PalCommand>();
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
vplce[i] += vince[i] * dc_count;
|
||||
}
|
||||
|
||||
fixed_t tmvline1_subclamp()
|
||||
void R_DrawWallSubClampCol1()
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawWallSubClamp1LLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawWallSubClamp1PalCommand>();
|
||||
|
||||
return dc_texturefrac + dc_count * dc_iscale;
|
||||
}
|
||||
|
||||
void tmvline4_subclamp()
|
||||
void R_DrawWallSubClampCol4()
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawWallSubClamp4LLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawWallSubClamp4PalCommand>();
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
vplce[i] += vince[i] * dc_count;
|
||||
}
|
||||
|
||||
fixed_t tmvline1_revsubclamp()
|
||||
void R_DrawWallRevSubClampCol1()
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawWallRevSubClamp1LLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawWallRevSubClamp1PalCommand>();
|
||||
|
||||
return dc_texturefrac + dc_count * dc_iscale;
|
||||
}
|
||||
|
||||
void tmvline4_revsubclamp()
|
||||
void R_DrawWallRevSubClampCol4()
|
||||
{
|
||||
using namespace drawerargs;
|
||||
|
||||
if (r_swtruecolor)
|
||||
DrawerCommandQueue::QueueCommand<DrawWallRevSubClamp4LLVMCommand>();
|
||||
else
|
||||
DrawerCommandQueue::QueueCommand<DrawWallRevSubClamp4PalCommand>();
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
vplce[i] += vince[i] * dc_count;
|
||||
}
|
||||
|
||||
void R_DrawSingleSkyCol1(uint32_t solid_top, uint32_t solid_bottom)
|
||||
|
|
54
src/r_draw.h
54
src/r_draw.h
|
@ -66,17 +66,15 @@ namespace swrenderer
|
|||
|
||||
extern bool drawer_needs_pal_input;
|
||||
|
||||
extern uint32_t vplce[4];
|
||||
extern uint32_t vince[4];
|
||||
extern uint8_t *palookupoffse[4];
|
||||
extern fixed_t palookuplight[4];
|
||||
extern const uint8_t *bufplce[4];
|
||||
extern const uint8_t *bufplce2[4];
|
||||
extern uint32_t buftexturefracx[4];
|
||||
extern uint32_t bufheight[4];
|
||||
extern int vlinebits;
|
||||
extern int mvlinebits;
|
||||
extern int tmvlinebits;
|
||||
extern uint32_t dc_wall_texturefrac[4];
|
||||
extern uint32_t dc_wall_iscale[4];
|
||||
extern uint8_t *dc_wall_colormap[4];
|
||||
extern fixed_t dc_wall_light[4];
|
||||
extern const uint8_t *dc_wall_source[4];
|
||||
extern const uint8_t *dc_wall_source2[4];
|
||||
extern uint32_t dc_wall_texturefracx[4];
|
||||
extern uint32_t dc_wall_sourceheight[4];
|
||||
extern int dc_wall_fracbits;
|
||||
|
||||
extern int ds_y;
|
||||
extern int ds_x1;
|
||||
|
@ -130,7 +128,7 @@ namespace swrenderer
|
|||
ESPSResult R_SetPatchStyle(FRenderStyle style, fixed_t alpha, int translation, uint32_t color);
|
||||
ESPSResult R_SetPatchStyle(FRenderStyle style, float alpha, int translation, uint32_t color);
|
||||
void R_FinishSetPatchStyle(); // Call this after finished drawing the current thing, in case its style was STYLE_Shade
|
||||
bool R_GetTransMaskDrawers(fixed_t(**tmvline1)(), void(**tmvline4)());
|
||||
bool R_GetTransMaskDrawers(void(**drawCol1)(), void(**drawCol4)());
|
||||
|
||||
const uint8_t *R_GetColumn(FTexture *tex, int col);
|
||||
|
||||
|
@ -192,29 +190,21 @@ namespace swrenderer
|
|||
void R_SetupDrawSlab(FSWColormap *base_colormap, float light, int shade);
|
||||
void R_DrawSlab(int dx, fixed_t v, int dy, fixed_t vi, const uint8_t *vptr, uint8_t *p);
|
||||
void R_DrawFogBoundary(int x1, int x2, short *uclip, short *dclip);
|
||||
uint32_t vlinec1();
|
||||
void vlinec4();
|
||||
uint32_t mvlinec1();
|
||||
void mvlinec4();
|
||||
fixed_t tmvline1_add();
|
||||
void tmvline4_add();
|
||||
fixed_t tmvline1_addclamp();
|
||||
void tmvline4_addclamp();
|
||||
fixed_t tmvline1_subclamp();
|
||||
void tmvline4_subclamp();
|
||||
fixed_t tmvline1_revsubclamp();
|
||||
void tmvline4_revsubclamp();
|
||||
void R_FillColumnHoriz();
|
||||
void R_FillSpan();
|
||||
|
||||
inline uint32_t dovline1() { return vlinec1(); }
|
||||
inline void dovline4() { vlinec4(); }
|
||||
inline uint32_t domvline1() { return mvlinec1(); }
|
||||
inline void domvline4() { mvlinec4(); }
|
||||
|
||||
void setupvline(int fracbits);
|
||||
void setupmvline(int fracbits);
|
||||
void setuptmvline(int fracbits);
|
||||
void R_DrawWallCol1();
|
||||
void R_DrawWallCol4();
|
||||
void R_DrawWallMaskedCol1();
|
||||
void R_DrawWallMaskedCol4();
|
||||
void R_DrawWallAddCol1();
|
||||
void R_DrawWallAddCol4();
|
||||
void R_DrawWallAddClampCol1();
|
||||
void R_DrawWallAddClampCol4();
|
||||
void R_DrawWallSubClampCol1();
|
||||
void R_DrawWallSubClampCol4();
|
||||
void R_DrawWallRevSubClampCol1();
|
||||
void R_DrawWallRevSubClampCol4();
|
||||
|
||||
void R_DrawSingleSkyCol1(uint32_t solid_top, uint32_t solid_bottom);
|
||||
void R_DrawSingleSkyCol4(uint32_t solid_top, uint32_t solid_bottom);
|
||||
|
|
|
@ -95,9 +95,7 @@ namespace swrenderer
|
|||
_count = dc_count;
|
||||
_source = dc_source;
|
||||
_dest = dc_dest;
|
||||
_vlinebits = vlinebits;
|
||||
_mvlinebits = mvlinebits;
|
||||
_tmvlinebits = tmvlinebits;
|
||||
_fracbits = dc_wall_fracbits;
|
||||
_pitch = dc_pitch;
|
||||
_srcblend = dc_srcblend;
|
||||
_destblend = dc_destblend;
|
||||
|
@ -110,15 +108,13 @@ namespace swrenderer
|
|||
_dest = dc_dest;
|
||||
_count = dc_count;
|
||||
_pitch = dc_pitch;
|
||||
_vlinebits = vlinebits;
|
||||
_mvlinebits = mvlinebits;
|
||||
_tmvlinebits = tmvlinebits;
|
||||
_fracbits = dc_wall_fracbits;
|
||||
for (int col = 0; col < 4; col++)
|
||||
{
|
||||
_palookupoffse[col] = palookupoffse[col];
|
||||
_bufplce[col] = bufplce[col];
|
||||
_vince[col] = vince[col];
|
||||
_vplce[col] = vplce[col];
|
||||
_colormap[col] = dc_wall_colormap[col];
|
||||
_source[col] = dc_wall_source[col];
|
||||
_iscale[col] = dc_wall_iscale[col];
|
||||
_texturefrac[col] = dc_wall_texturefrac[col];
|
||||
}
|
||||
_srcblend = dc_srcblend;
|
||||
_destblend = dc_destblend;
|
||||
|
@ -132,7 +128,7 @@ namespace swrenderer
|
|||
int count = _count;
|
||||
const uint8_t *source = _source;
|
||||
uint8_t *dest = _dest;
|
||||
int bits = _vlinebits;
|
||||
int bits = _fracbits;
|
||||
int pitch = _pitch;
|
||||
|
||||
count = thread->count_for_thread(_dest_y, count);
|
||||
|
@ -156,24 +152,24 @@ namespace swrenderer
|
|||
{
|
||||
uint8_t *dest = _dest;
|
||||
int count = _count;
|
||||
int bits = _vlinebits;
|
||||
int bits = _fracbits;
|
||||
uint32_t place;
|
||||
auto pal0 = _palookupoffse[0];
|
||||
auto pal1 = _palookupoffse[1];
|
||||
auto pal2 = _palookupoffse[2];
|
||||
auto pal3 = _palookupoffse[3];
|
||||
auto buf0 = _bufplce[0];
|
||||
auto buf1 = _bufplce[1];
|
||||
auto buf2 = _bufplce[2];
|
||||
auto buf3 = _bufplce[3];
|
||||
auto vince0 = _vince[0];
|
||||
auto vince1 = _vince[1];
|
||||
auto vince2 = _vince[2];
|
||||
auto vince3 = _vince[3];
|
||||
auto vplce0 = _vplce[0];
|
||||
auto vplce1 = _vplce[1];
|
||||
auto vplce2 = _vplce[2];
|
||||
auto vplce3 = _vplce[3];
|
||||
auto pal0 = _colormap[0];
|
||||
auto pal1 = _colormap[1];
|
||||
auto pal2 = _colormap[2];
|
||||
auto pal3 = _colormap[3];
|
||||
auto buf0 = _source[0];
|
||||
auto buf1 = _source[1];
|
||||
auto buf2 = _source[2];
|
||||
auto buf3 = _source[3];
|
||||
auto dc_wall_iscale0 = _iscale[0];
|
||||
auto dc_wall_iscale1 = _iscale[1];
|
||||
auto dc_wall_iscale2 = _iscale[2];
|
||||
auto dc_wall_iscale3 = _iscale[3];
|
||||
auto dc_wall_texturefrac0 = _texturefrac[0];
|
||||
auto dc_wall_texturefrac1 = _texturefrac[1];
|
||||
auto dc_wall_texturefrac2 = _texturefrac[2];
|
||||
auto dc_wall_texturefrac3 = _texturefrac[3];
|
||||
auto pitch = _pitch;
|
||||
|
||||
count = thread->count_for_thread(_dest_y, count);
|
||||
|
@ -182,22 +178,22 @@ namespace swrenderer
|
|||
|
||||
int skipped = thread->skipped_by_thread(_dest_y);
|
||||
dest = thread->dest_for_thread(_dest_y, pitch, dest);
|
||||
vplce0 += vince0 * skipped;
|
||||
vplce1 += vince1 * skipped;
|
||||
vplce2 += vince2 * skipped;
|
||||
vplce3 += vince3 * skipped;
|
||||
vince0 *= thread->num_cores;
|
||||
vince1 *= thread->num_cores;
|
||||
vince2 *= thread->num_cores;
|
||||
vince3 *= thread->num_cores;
|
||||
dc_wall_texturefrac0 += dc_wall_iscale0 * skipped;
|
||||
dc_wall_texturefrac1 += dc_wall_iscale1 * skipped;
|
||||
dc_wall_texturefrac2 += dc_wall_iscale2 * skipped;
|
||||
dc_wall_texturefrac3 += dc_wall_iscale3 * skipped;
|
||||
dc_wall_iscale0 *= thread->num_cores;
|
||||
dc_wall_iscale1 *= thread->num_cores;
|
||||
dc_wall_iscale2 *= thread->num_cores;
|
||||
dc_wall_iscale3 *= thread->num_cores;
|
||||
pitch *= thread->num_cores;
|
||||
|
||||
do
|
||||
{
|
||||
dest[0] = pal0[buf0[(place = vplce0) >> bits]]; vplce0 = place + vince0;
|
||||
dest[1] = pal1[buf1[(place = vplce1) >> bits]]; vplce1 = place + vince1;
|
||||
dest[2] = pal2[buf2[(place = vplce2) >> bits]]; vplce2 = place + vince2;
|
||||
dest[3] = pal3[buf3[(place = vplce3) >> bits]]; vplce3 = place + vince3;
|
||||
dest[0] = pal0[buf0[(place = dc_wall_texturefrac0) >> bits]]; dc_wall_texturefrac0 = place + dc_wall_iscale0;
|
||||
dest[1] = pal1[buf1[(place = dc_wall_texturefrac1) >> bits]]; dc_wall_texturefrac1 = place + dc_wall_iscale1;
|
||||
dest[2] = pal2[buf2[(place = dc_wall_texturefrac2) >> bits]]; dc_wall_texturefrac2 = place + dc_wall_iscale2;
|
||||
dest[3] = pal3[buf3[(place = dc_wall_texturefrac3) >> bits]]; dc_wall_texturefrac3 = place + dc_wall_iscale3;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
}
|
||||
|
@ -210,7 +206,7 @@ namespace swrenderer
|
|||
int count = _count;
|
||||
const uint8_t *source = _source;
|
||||
uint8_t *dest = _dest;
|
||||
int bits = _mvlinebits;
|
||||
int bits = _fracbits;
|
||||
int pitch = _pitch;
|
||||
|
||||
count = thread->count_for_thread(_dest_y, count);
|
||||
|
@ -238,24 +234,24 @@ namespace swrenderer
|
|||
{
|
||||
uint8_t *dest = _dest;
|
||||
int count = _count;
|
||||
int bits = _mvlinebits;
|
||||
int bits = _fracbits;
|
||||
uint32_t place;
|
||||
auto pal0 = _palookupoffse[0];
|
||||
auto pal1 = _palookupoffse[1];
|
||||
auto pal2 = _palookupoffse[2];
|
||||
auto pal3 = _palookupoffse[3];
|
||||
auto buf0 = _bufplce[0];
|
||||
auto buf1 = _bufplce[1];
|
||||
auto buf2 = _bufplce[2];
|
||||
auto buf3 = _bufplce[3];
|
||||
auto vince0 = _vince[0];
|
||||
auto vince1 = _vince[1];
|
||||
auto vince2 = _vince[2];
|
||||
auto vince3 = _vince[3];
|
||||
auto vplce0 = _vplce[0];
|
||||
auto vplce1 = _vplce[1];
|
||||
auto vplce2 = _vplce[2];
|
||||
auto vplce3 = _vplce[3];
|
||||
auto pal0 = _colormap[0];
|
||||
auto pal1 = _colormap[1];
|
||||
auto pal2 = _colormap[2];
|
||||
auto pal3 = _colormap[3];
|
||||
auto buf0 = _source[0];
|
||||
auto buf1 = _source[1];
|
||||
auto buf2 = _source[2];
|
||||
auto buf3 = _source[3];
|
||||
auto dc_wall_iscale0 = _iscale[0];
|
||||
auto dc_wall_iscale1 = _iscale[1];
|
||||
auto dc_wall_iscale2 = _iscale[2];
|
||||
auto dc_wall_iscale3 = _iscale[3];
|
||||
auto dc_wall_texturefrac0 = _texturefrac[0];
|
||||
auto dc_wall_texturefrac1 = _texturefrac[1];
|
||||
auto dc_wall_texturefrac2 = _texturefrac[2];
|
||||
auto dc_wall_texturefrac3 = _texturefrac[3];
|
||||
auto pitch = _pitch;
|
||||
|
||||
count = thread->count_for_thread(_dest_y, count);
|
||||
|
@ -264,24 +260,24 @@ namespace swrenderer
|
|||
|
||||
int skipped = thread->skipped_by_thread(_dest_y);
|
||||
dest = thread->dest_for_thread(_dest_y, pitch, dest);
|
||||
vplce0 += vince0 * skipped;
|
||||
vplce1 += vince1 * skipped;
|
||||
vplce2 += vince2 * skipped;
|
||||
vplce3 += vince3 * skipped;
|
||||
vince0 *= thread->num_cores;
|
||||
vince1 *= thread->num_cores;
|
||||
vince2 *= thread->num_cores;
|
||||
vince3 *= thread->num_cores;
|
||||
dc_wall_texturefrac0 += dc_wall_iscale0 * skipped;
|
||||
dc_wall_texturefrac1 += dc_wall_iscale1 * skipped;
|
||||
dc_wall_texturefrac2 += dc_wall_iscale2 * skipped;
|
||||
dc_wall_texturefrac3 += dc_wall_iscale3 * skipped;
|
||||
dc_wall_iscale0 *= thread->num_cores;
|
||||
dc_wall_iscale1 *= thread->num_cores;
|
||||
dc_wall_iscale2 *= thread->num_cores;
|
||||
dc_wall_iscale3 *= thread->num_cores;
|
||||
pitch *= thread->num_cores;
|
||||
|
||||
do
|
||||
{
|
||||
uint8_t pix;
|
||||
|
||||
pix = buf0[(place = vplce0) >> bits]; if (pix) dest[0] = pal0[pix]; vplce0 = place + vince0;
|
||||
pix = buf1[(place = vplce1) >> bits]; if (pix) dest[1] = pal1[pix]; vplce1 = place + vince1;
|
||||
pix = buf2[(place = vplce2) >> bits]; if (pix) dest[2] = pal2[pix]; vplce2 = place + vince2;
|
||||
pix = buf3[(place = vplce3) >> bits]; if (pix) dest[3] = pal3[pix]; vplce3 = place + vince3;
|
||||
pix = buf0[(place = dc_wall_texturefrac0) >> bits]; if (pix) dest[0] = pal0[pix]; dc_wall_texturefrac0 = place + dc_wall_iscale0;
|
||||
pix = buf1[(place = dc_wall_texturefrac1) >> bits]; if (pix) dest[1] = pal1[pix]; dc_wall_texturefrac1 = place + dc_wall_iscale1;
|
||||
pix = buf2[(place = dc_wall_texturefrac2) >> bits]; if (pix) dest[2] = pal2[pix]; dc_wall_texturefrac2 = place + dc_wall_iscale2;
|
||||
pix = buf3[(place = dc_wall_texturefrac3) >> bits]; if (pix) dest[3] = pal3[pix]; dc_wall_texturefrac3 = place + dc_wall_iscale3;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
}
|
||||
|
@ -294,7 +290,7 @@ namespace swrenderer
|
|||
int count = _count;
|
||||
const uint8_t *source = _source;
|
||||
uint8_t *dest = _dest;
|
||||
int bits = _tmvlinebits;
|
||||
int bits = _fracbits;
|
||||
int pitch = _pitch;
|
||||
|
||||
uint32_t *fg2rgb = _srcblend;
|
||||
|
@ -328,13 +324,13 @@ namespace swrenderer
|
|||
{
|
||||
uint8_t *dest = _dest;
|
||||
int count = _count;
|
||||
int bits = _tmvlinebits;
|
||||
int bits = _fracbits;
|
||||
|
||||
uint32_t *fg2rgb = _srcblend;
|
||||
uint32_t *bg2rgb = _destblend;
|
||||
|
||||
uint32_t vplce[4] = { _vplce[0], _vplce[1], _vplce[2], _vplce[3] };
|
||||
uint32_t vince[4] = { _vince[0], _vince[1], _vince[2], _vince[3] };
|
||||
uint32_t dc_wall_texturefrac[4] = { _texturefrac[0], _texturefrac[1], _texturefrac[2], _texturefrac[3] };
|
||||
uint32_t dc_wall_iscale[4] = { _iscale[0], _iscale[1], _iscale[2], _iscale[3] };
|
||||
|
||||
count = thread->count_for_thread(_dest_y, count);
|
||||
if (count <= 0)
|
||||
|
@ -345,8 +341,8 @@ namespace swrenderer
|
|||
dest = thread->dest_for_thread(_dest_y, pitch, dest);
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
vplce[i] += vince[i] * skipped;
|
||||
vince[i] *= thread->num_cores;
|
||||
dc_wall_texturefrac[i] += dc_wall_iscale[i] * skipped;
|
||||
dc_wall_iscale[i] *= thread->num_cores;
|
||||
}
|
||||
pitch *= thread->num_cores;
|
||||
|
||||
|
@ -354,15 +350,15 @@ namespace swrenderer
|
|||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
uint8_t pix = _bufplce[i][vplce[i] >> bits];
|
||||
uint8_t pix = _source[i][dc_wall_texturefrac[i] >> bits];
|
||||
if (pix != 0)
|
||||
{
|
||||
uint32_t fg = fg2rgb[_palookupoffse[i][pix]];
|
||||
uint32_t fg = fg2rgb[_colormap[i][pix]];
|
||||
uint32_t bg = bg2rgb[dest[i]];
|
||||
fg = (fg + bg) | 0x1f07c1f;
|
||||
dest[i] = RGB32k.All[fg & (fg >> 15)];
|
||||
}
|
||||
vplce[i] += vince[i];
|
||||
dc_wall_texturefrac[i] += dc_wall_iscale[i];
|
||||
}
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
|
@ -376,7 +372,7 @@ namespace swrenderer
|
|||
int count = _count;
|
||||
const uint8_t *source = _source;
|
||||
uint8_t *dest = _dest;
|
||||
int bits = _tmvlinebits;
|
||||
int bits = _fracbits;
|
||||
int pitch = _pitch;
|
||||
|
||||
uint32_t *fg2rgb = _srcblend;
|
||||
|
@ -415,13 +411,13 @@ namespace swrenderer
|
|||
{
|
||||
uint8_t *dest = _dest;
|
||||
int count = _count;
|
||||
int bits = _tmvlinebits;
|
||||
int bits = _fracbits;
|
||||
|
||||
uint32_t *fg2rgb = _srcblend;
|
||||
uint32_t *bg2rgb = _destblend;
|
||||
|
||||
uint32_t vplce[4] = { _vplce[0], _vplce[1], _vplce[2], _vplce[3] };
|
||||
uint32_t vince[4] = { _vince[0], _vince[1], _vince[2], _vince[3] };
|
||||
uint32_t dc_wall_texturefrac[4] = { _texturefrac[0], _texturefrac[1], _texturefrac[2], _texturefrac[3] };
|
||||
uint32_t dc_wall_iscale[4] = { _iscale[0], _iscale[1], _iscale[2], _iscale[3] };
|
||||
|
||||
count = thread->count_for_thread(_dest_y, count);
|
||||
if (count <= 0)
|
||||
|
@ -432,8 +428,8 @@ namespace swrenderer
|
|||
dest = thread->dest_for_thread(_dest_y, pitch, dest);
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
vplce[i] += vince[i] * skipped;
|
||||
vince[i] *= thread->num_cores;
|
||||
dc_wall_texturefrac[i] += dc_wall_iscale[i] * skipped;
|
||||
dc_wall_iscale[i] *= thread->num_cores;
|
||||
}
|
||||
pitch *= thread->num_cores;
|
||||
|
||||
|
@ -441,10 +437,10 @@ namespace swrenderer
|
|||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
uint8_t pix = _bufplce[i][vplce[i] >> bits];
|
||||
uint8_t pix = _source[i][dc_wall_texturefrac[i] >> bits];
|
||||
if (pix != 0)
|
||||
{
|
||||
uint32_t a = fg2rgb[_palookupoffse[i][pix]] + bg2rgb[dest[i]];
|
||||
uint32_t a = fg2rgb[_colormap[i][pix]] + bg2rgb[dest[i]];
|
||||
uint32_t b = a;
|
||||
|
||||
a |= 0x01f07c1f;
|
||||
|
@ -454,7 +450,7 @@ namespace swrenderer
|
|||
a |= b;
|
||||
dest[i] = RGB32k.All[a & (a >> 15)];
|
||||
}
|
||||
vplce[i] += vince[i];
|
||||
dc_wall_texturefrac[i] += dc_wall_iscale[i];
|
||||
}
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
|
@ -468,7 +464,7 @@ namespace swrenderer
|
|||
int count = _count;
|
||||
const uint8_t *source = _source;
|
||||
uint8_t *dest = _dest;
|
||||
int bits = _tmvlinebits;
|
||||
int bits = _fracbits;
|
||||
int pitch = _pitch;
|
||||
|
||||
uint32_t *fg2rgb = _srcblend;
|
||||
|
@ -506,13 +502,13 @@ namespace swrenderer
|
|||
{
|
||||
uint8_t *dest = _dest;
|
||||
int count = _count;
|
||||
int bits = _tmvlinebits;
|
||||
int bits = _fracbits;
|
||||
|
||||
uint32_t *fg2rgb = _srcblend;
|
||||
uint32_t *bg2rgb = _destblend;
|
||||
|
||||
uint32_t vplce[4] = { _vplce[0], _vplce[1], _vplce[2], _vplce[3] };
|
||||
uint32_t vince[4] = { _vince[0], _vince[1], _vince[2], _vince[3] };
|
||||
uint32_t dc_wall_texturefrac[4] = { _texturefrac[0], _texturefrac[1], _texturefrac[2], _texturefrac[3] };
|
||||
uint32_t dc_wall_iscale[4] = { _iscale[0], _iscale[1], _iscale[2], _iscale[3] };
|
||||
|
||||
count = thread->count_for_thread(_dest_y, count);
|
||||
if (count <= 0)
|
||||
|
@ -523,8 +519,8 @@ namespace swrenderer
|
|||
dest = thread->dest_for_thread(_dest_y, pitch, dest);
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
vplce[i] += vince[i] * skipped;
|
||||
vince[i] *= thread->num_cores;
|
||||
dc_wall_texturefrac[i] += dc_wall_iscale[i] * skipped;
|
||||
dc_wall_iscale[i] *= thread->num_cores;
|
||||
}
|
||||
pitch *= thread->num_cores;
|
||||
|
||||
|
@ -532,10 +528,10 @@ namespace swrenderer
|
|||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
uint8_t pix = _bufplce[i][vplce[i] >> bits];
|
||||
uint8_t pix = _source[i][dc_wall_texturefrac[i] >> bits];
|
||||
if (pix != 0)
|
||||
{
|
||||
uint32_t a = (fg2rgb[_palookupoffse[i][pix]] | 0x40100400) - bg2rgb[dest[i]];
|
||||
uint32_t a = (fg2rgb[_colormap[i][pix]] | 0x40100400) - bg2rgb[dest[i]];
|
||||
uint32_t b = a;
|
||||
|
||||
b &= 0x40100400;
|
||||
|
@ -544,7 +540,7 @@ namespace swrenderer
|
|||
a |= 0x01f07c1f;
|
||||
dest[i] = RGB32k.All[a & (a >> 15)];
|
||||
}
|
||||
vplce[i] += vince[i];
|
||||
dc_wall_texturefrac[i] += dc_wall_iscale[i];
|
||||
}
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
|
@ -558,7 +554,7 @@ namespace swrenderer
|
|||
int count = _count;
|
||||
const uint8_t *source = _source;
|
||||
uint8_t *dest = _dest;
|
||||
int bits = _tmvlinebits;
|
||||
int bits = _fracbits;
|
||||
int pitch = _pitch;
|
||||
|
||||
uint32_t *fg2rgb = _srcblend;
|
||||
|
@ -596,13 +592,13 @@ namespace swrenderer
|
|||
{
|
||||
uint8_t *dest = _dest;
|
||||
int count = _count;
|
||||
int bits = _tmvlinebits;
|
||||
int bits = _fracbits;
|
||||
|
||||
uint32_t *fg2rgb = _srcblend;
|
||||
uint32_t *bg2rgb = _destblend;
|
||||
|
||||
uint32_t vplce[4] = { _vplce[0], _vplce[1], _vplce[2], _vplce[3] };
|
||||
uint32_t vince[4] = { _vince[0], _vince[1], _vince[2], _vince[3] };
|
||||
uint32_t dc_wall_texturefrac[4] = { _texturefrac[0], _texturefrac[1], _texturefrac[2], _texturefrac[3] };
|
||||
uint32_t dc_wall_iscale[4] = { _iscale[0], _iscale[1], _iscale[2], _iscale[3] };
|
||||
|
||||
count = thread->count_for_thread(_dest_y, count);
|
||||
if (count <= 0)
|
||||
|
@ -613,8 +609,8 @@ namespace swrenderer
|
|||
dest = thread->dest_for_thread(_dest_y, pitch, dest);
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
vplce[i] += vince[i] * skipped;
|
||||
vince[i] *= thread->num_cores;
|
||||
dc_wall_texturefrac[i] += dc_wall_iscale[i] * skipped;
|
||||
dc_wall_iscale[i] *= thread->num_cores;
|
||||
}
|
||||
pitch *= thread->num_cores;
|
||||
|
||||
|
@ -622,10 +618,10 @@ namespace swrenderer
|
|||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
uint8_t pix = _bufplce[i][vplce[i] >> bits];
|
||||
uint8_t pix = _source[i][dc_wall_texturefrac[i] >> bits];
|
||||
if (pix != 0)
|
||||
{
|
||||
uint32_t a = (bg2rgb[dest[i]] | 0x40100400) - fg2rgb[_palookupoffse[i][pix]];
|
||||
uint32_t a = (bg2rgb[dest[i]] | 0x40100400) - fg2rgb[_colormap[i][pix]];
|
||||
uint32_t b = a;
|
||||
|
||||
b &= 0x40100400;
|
||||
|
@ -634,7 +630,7 @@ namespace swrenderer
|
|||
a |= 0x01f07c1f;
|
||||
dest[i] = RGB32k.All[a & (a >> 15)];
|
||||
}
|
||||
vplce[i] += vince[i];
|
||||
dc_wall_texturefrac[i] += dc_wall_iscale[i];
|
||||
}
|
||||
dest += _pitch;
|
||||
} while (--count);
|
||||
|
@ -651,11 +647,11 @@ namespace swrenderer
|
|||
_pitch = dc_pitch;
|
||||
for (int col = 0; col < 4; col++)
|
||||
{
|
||||
_bufplce[col] = bufplce[col];
|
||||
_bufplce2[col] = bufplce2[col];
|
||||
_bufheight[col] = bufheight[col];
|
||||
_vince[col] = vince[col];
|
||||
_vplce[col] = vplce[col];
|
||||
_source[col] = dc_wall_source[col];
|
||||
_source2[col] = dc_wall_source2[col];
|
||||
_sourceheight[col] = dc_wall_sourceheight[col];
|
||||
_iscale[col] = dc_wall_iscale[col];
|
||||
_texturefrac[col] = dc_wall_texturefrac[col];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -664,11 +660,11 @@ namespace swrenderer
|
|||
uint8_t *dest = _dest;
|
||||
int count = _count;
|
||||
int pitch = _pitch;
|
||||
const uint8_t *source0 = _bufplce[0];
|
||||
int textureheight0 = _bufheight[0];
|
||||
const uint8_t *source0 = _source[0];
|
||||
int textureheight0 = _sourceheight[0];
|
||||
|
||||
int32_t frac = _vplce[0];
|
||||
int32_t fracstep = _vince[0];
|
||||
int32_t frac = _texturefrac[0];
|
||||
int32_t fracstep = _iscale[0];
|
||||
|
||||
int start_fade = 2; // How fast it should fade out
|
||||
|
||||
|
@ -729,11 +725,11 @@ namespace swrenderer
|
|||
uint8_t *dest = _dest;
|
||||
int count = _count;
|
||||
int pitch = _pitch;
|
||||
const uint8_t *source0[4] = { _bufplce[0], _bufplce[1], _bufplce[2], _bufplce[3] };
|
||||
int textureheight0 = _bufheight[0];
|
||||
const uint8_t *source0[4] = { _source[0], _source[1], _source[2], _source[3] };
|
||||
int textureheight0 = _sourceheight[0];
|
||||
const uint32_t *palette = (const uint32_t *)GPalette.BaseColors;
|
||||
int32_t frac[4] = { (int32_t)_vplce[0], (int32_t)_vplce[1], (int32_t)_vplce[2], (int32_t)_vplce[3] };
|
||||
int32_t fracstep[4] = { (int32_t)_vince[0], (int32_t)_vince[1], (int32_t)_vince[2], (int32_t)_vince[3] };
|
||||
int32_t frac[4] = { (int32_t)_texturefrac[0], (int32_t)_texturefrac[1], (int32_t)_texturefrac[2], (int32_t)_texturefrac[3] };
|
||||
int32_t fracstep[4] = { (int32_t)_iscale[0], (int32_t)_iscale[1], (int32_t)_iscale[2], (int32_t)_iscale[3] };
|
||||
uint8_t output[4];
|
||||
|
||||
int start_fade = 2; // How fast it should fade out
|
||||
|
@ -870,13 +866,13 @@ namespace swrenderer
|
|||
uint8_t *dest = _dest;
|
||||
int count = _count;
|
||||
int pitch = _pitch;
|
||||
const uint8_t *source0 = _bufplce[0];
|
||||
const uint8_t *source1 = _bufplce2[0];
|
||||
int textureheight0 = _bufheight[0];
|
||||
uint32_t maxtextureheight1 = _bufheight[1] - 1;
|
||||
const uint8_t *source0 = _source[0];
|
||||
const uint8_t *source1 = _source2[0];
|
||||
int textureheight0 = _sourceheight[0];
|
||||
uint32_t maxtextureheight1 = _sourceheight[1] - 1;
|
||||
|
||||
int32_t frac = _vplce[0];
|
||||
int32_t fracstep = _vince[0];
|
||||
int32_t frac = _texturefrac[0];
|
||||
int32_t fracstep = _iscale[0];
|
||||
|
||||
int start_fade = 2; // How fast it should fade out
|
||||
|
||||
|
@ -942,13 +938,13 @@ namespace swrenderer
|
|||
uint8_t *dest = _dest;
|
||||
int count = _count;
|
||||
int pitch = _pitch;
|
||||
const uint8_t *source0[4] = { _bufplce[0], _bufplce[1], _bufplce[2], _bufplce[3] };
|
||||
const uint8_t *source1[4] = { _bufplce2[0], _bufplce2[1], _bufplce2[2], _bufplce2[3] };
|
||||
int textureheight0 = _bufheight[0];
|
||||
uint32_t maxtextureheight1 = _bufheight[1] - 1;
|
||||
const uint8_t *source0[4] = { _source[0], _source[1], _source[2], _source[3] };
|
||||
const uint8_t *source1[4] = { _source2[0], _source2[1], _source2[2], _source2[3] };
|
||||
int textureheight0 = _sourceheight[0];
|
||||
uint32_t maxtextureheight1 = _sourceheight[1] - 1;
|
||||
const uint32_t *palette = (const uint32_t *)GPalette.BaseColors;
|
||||
int32_t frac[4] = { (int32_t)_vplce[0], (int32_t)_vplce[1], (int32_t)_vplce[2], (int32_t)_vplce[3] };
|
||||
int32_t fracstep[4] = { (int32_t)_vince[0], (int32_t)_vince[1], (int32_t)_vince[2], (int32_t)_vince[3] };
|
||||
int32_t frac[4] = { (int32_t)_texturefrac[0], (int32_t)_texturefrac[1], (int32_t)_texturefrac[2], (int32_t)_texturefrac[3] };
|
||||
int32_t fracstep[4] = { (int32_t)_iscale[0], (int32_t)_iscale[1], (int32_t)_iscale[2], (int32_t)_iscale[3] };
|
||||
uint8_t output[4];
|
||||
|
||||
int start_fade = 2; // How fast it should fade out
|
||||
|
|
|
@ -20,9 +20,7 @@ namespace swrenderer
|
|||
int _count;
|
||||
const uint8_t *_source;
|
||||
uint8_t *_dest;
|
||||
int _vlinebits;
|
||||
int _mvlinebits;
|
||||
int _tmvlinebits;
|
||||
int _fracbits;
|
||||
int _pitch;
|
||||
uint32_t *_srcblend;
|
||||
uint32_t *_destblend;
|
||||
|
@ -38,13 +36,11 @@ namespace swrenderer
|
|||
uint8_t *_dest;
|
||||
int _count;
|
||||
int _pitch;
|
||||
int _vlinebits;
|
||||
int _mvlinebits;
|
||||
int _tmvlinebits;
|
||||
uint8_t *_palookupoffse[4];
|
||||
const uint8_t *_bufplce[4];
|
||||
uint32_t _vince[4];
|
||||
uint32_t _vplce[4];
|
||||
int _fracbits;
|
||||
uint8_t *_colormap[4];
|
||||
const uint8_t *_source[4];
|
||||
uint32_t _iscale[4];
|
||||
uint32_t _texturefrac[4];
|
||||
uint32_t *_srcblend;
|
||||
uint32_t *_destblend;
|
||||
};
|
||||
|
@ -75,11 +71,11 @@ namespace swrenderer
|
|||
uint8_t *_dest;
|
||||
int _count;
|
||||
int _pitch;
|
||||
const uint8_t *_bufplce[4];
|
||||
const uint8_t *_bufplce2[4];
|
||||
int _bufheight[4];
|
||||
uint32_t _vince[4];
|
||||
uint32_t _vplce[4];
|
||||
const uint8_t *_source[4];
|
||||
const uint8_t *_source2[4];
|
||||
int _sourceheight[4];
|
||||
uint32_t _iscale[4];
|
||||
uint32_t _texturefrac[4];
|
||||
};
|
||||
|
||||
class DrawSingleSky1PalCommand : public PalSkyCommand { public: using PalSkyCommand::PalSkyCommand; void Execute(DrawerThread *thread) override; };
|
||||
|
|
|
@ -205,13 +205,13 @@ namespace swrenderer
|
|||
args.desaturate = dc_shade_constants.desaturate;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
args.texturefrac[i] = vplce[i];
|
||||
args.iscale[i] = vince[i];
|
||||
args.texturefracx[i] = buftexturefracx[i];
|
||||
args.textureheight[i] = bufheight[i];
|
||||
args.source[i] = (const uint32_t *)bufplce[i];
|
||||
args.source2[i] = (const uint32_t *)bufplce2[i];
|
||||
args.light[i] = LightBgra::calc_light_multiplier(palookuplight[i]);
|
||||
args.texturefrac[i] = dc_wall_texturefrac[i];
|
||||
args.iscale[i] = dc_wall_iscale[i];
|
||||
args.texturefracx[i] = dc_wall_texturefracx[i];
|
||||
args.textureheight[i] = dc_wall_sourceheight[i];
|
||||
args.source[i] = (const uint32_t *)dc_wall_source[i];
|
||||
args.source2[i] = (const uint32_t *)dc_wall_source2[i];
|
||||
args.light[i] = LightBgra::calc_light_multiplier(dc_wall_light[i]);
|
||||
}
|
||||
args.srcalpha = dc_srcalpha >> (FRACBITS - 8);
|
||||
args.destalpha = dc_destalpha >> (FRACBITS - 8);
|
||||
|
@ -378,13 +378,13 @@ namespace swrenderer
|
|||
args.pitch = dc_pitch;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
args.texturefrac[i] = vplce[i];
|
||||
args.iscale[i] = vince[i];
|
||||
args.source0[i] = (const uint32_t *)bufplce[i];
|
||||
args.source1[i] = (const uint32_t *)bufplce2[i];
|
||||
args.texturefrac[i] = dc_wall_texturefrac[i];
|
||||
args.iscale[i] = dc_wall_iscale[i];
|
||||
args.source0[i] = (const uint32_t *)dc_wall_source[i];
|
||||
args.source1[i] = (const uint32_t *)dc_wall_source2[i];
|
||||
}
|
||||
args.textureheight0 = bufheight[0];
|
||||
args.textureheight1 = bufheight[1];
|
||||
args.textureheight0 = dc_wall_sourceheight[0];
|
||||
args.textureheight1 = dc_wall_sourceheight[1];
|
||||
args.top_color = solid_top;
|
||||
args.bottom_color = solid_bottom;
|
||||
|
||||
|
|
|
@ -803,21 +803,21 @@ static void R_DrawSkyColumnStripe(int start_x, int y1, int y2, int columns, doub
|
|||
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
bufplce[i] = (const BYTE *)frontskytex->GetColumnBgra(angle1, nullptr);
|
||||
bufplce2[i] = backskytex ? (const BYTE *)backskytex->GetColumnBgra(angle2, nullptr) : nullptr;
|
||||
dc_wall_source[i] = (const BYTE *)frontskytex->GetColumnBgra(angle1, nullptr);
|
||||
dc_wall_source2[i] = backskytex ? (const BYTE *)backskytex->GetColumnBgra(angle2, nullptr) : nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
bufplce[i] = (const BYTE *)frontskytex->GetColumn(angle1, nullptr);
|
||||
bufplce2[i] = backskytex ? (const BYTE *)backskytex->GetColumn(angle2, nullptr) : nullptr;
|
||||
dc_wall_source[i] = (const BYTE *)frontskytex->GetColumn(angle1, nullptr);
|
||||
dc_wall_source2[i] = backskytex ? (const BYTE *)backskytex->GetColumn(angle2, nullptr) : nullptr;
|
||||
}
|
||||
|
||||
vince[i] = uv_step;
|
||||
vplce[i] = uv_pos;
|
||||
dc_wall_iscale[i] = uv_step;
|
||||
dc_wall_texturefrac[i] = uv_pos;
|
||||
}
|
||||
|
||||
bufheight[0] = height;
|
||||
bufheight[1] = backskytex ? backskytex->GetHeight() : height;
|
||||
dc_wall_sourceheight[0] = height;
|
||||
dc_wall_sourceheight[1] = backskytex ? backskytex->GetHeight() : height;
|
||||
int pixelsize = r_swtruecolor ? 4 : 1;
|
||||
dc_dest = (ylookup[y1] + start_x) * pixelsize + dc_destorg;
|
||||
dc_count = y2 - y1;
|
||||
|
|
|
@ -98,7 +98,7 @@ WallSampler::WallSampler(int y1, float swal, double yrepeat, fixed_t xoffset, FT
|
|||
}
|
||||
|
||||
// Draw a column with support for non-power-of-two ranges
|
||||
static void Draw1Column(int x, int y1, int y2, WallSampler &sampler, DWORD(*draw1column)())
|
||||
static void Draw1Column(int x, int y1, int y2, WallSampler &sampler, void(*draw1column)())
|
||||
{
|
||||
if (sampler.uv_max == 0 || sampler.uv_step == 0) // power of two
|
||||
{
|
||||
|
@ -153,9 +153,9 @@ static void Draw4Columns(int x, int y1, int y2, WallSampler *sampler, void(*draw
|
|||
int count = y2 - y1;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
bufplce[i] = sampler[i].source;
|
||||
vplce[i] = sampler[i].uv_pos;
|
||||
vince[i] = sampler[i].uv_step;
|
||||
dc_wall_source[i] = sampler[i].source;
|
||||
dc_wall_texturefrac[i] = sampler[i].uv_pos;
|
||||
dc_wall_iscale[i] = sampler[i].uv_step;
|
||||
|
||||
uint64_t step64 = sampler[i].uv_step;
|
||||
uint64_t pos64 = sampler[i].uv_pos;
|
||||
|
@ -170,7 +170,7 @@ static void Draw4Columns(int x, int y1, int y2, WallSampler *sampler, void(*draw
|
|||
dc_dest = (ylookup[y1] + x) + dc_destorg;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
bufplce[i] = sampler[i].source;
|
||||
dc_wall_source[i] = sampler[i].source;
|
||||
}
|
||||
|
||||
uint32_t left = y2 - y1;
|
||||
|
@ -190,8 +190,8 @@ static void Draw4Columns(int x, int y1, int y2, WallSampler *sampler, void(*draw
|
|||
// Draw until that column wraps
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
vplce[i] = sampler[i].uv_pos;
|
||||
vince[i] = sampler[i].uv_step;
|
||||
dc_wall_texturefrac[i] = sampler[i].uv_pos;
|
||||
dc_wall_iscale[i] = sampler[i].uv_step;
|
||||
}
|
||||
dc_count = count;
|
||||
draw4columns();
|
||||
|
@ -209,13 +209,11 @@ static void Draw4Columns(int x, int y1, int y2, WallSampler *sampler, void(*draw
|
|||
}
|
||||
}
|
||||
|
||||
typedef DWORD(*Draw1ColumnFuncPtr)();
|
||||
typedef void(*Draw4ColumnsFuncPtr)();
|
||||
typedef void(*DrawColumnFuncPtr)();
|
||||
|
||||
static void ProcessWallWorker(
|
||||
int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat,
|
||||
const BYTE *(*getcol)(FTexture *tex, int x),
|
||||
void(setupProcessNormalWall(int bits, Draw1ColumnFuncPtr &draw1, Draw4ColumnsFuncPtr &draw2)))
|
||||
const BYTE *(*getcol)(FTexture *tex, int x), DrawColumnFuncPtr draw1column, DrawColumnFuncPtr draw4columns)
|
||||
{
|
||||
if (rw_pic->UseType == FTexture::TEX_Null)
|
||||
return;
|
||||
|
@ -230,17 +228,15 @@ static void ProcessWallWorker(
|
|||
dc_texturemid = 0;
|
||||
}
|
||||
|
||||
DWORD(*draw1column)();
|
||||
void(*draw4columns)();
|
||||
setupProcessNormalWall(fracbits, draw1column, draw4columns);
|
||||
dc_wall_fracbits = fracbits;
|
||||
|
||||
bool fixed = (fixedcolormap != NULL || fixedlightlev >= 0);
|
||||
if (fixed)
|
||||
{
|
||||
palookupoffse[0] = dc_colormap;
|
||||
palookupoffse[1] = dc_colormap;
|
||||
palookupoffse[2] = dc_colormap;
|
||||
palookupoffse[3] = dc_colormap;
|
||||
dc_wall_colormap[0] = dc_colormap;
|
||||
dc_wall_colormap[1] = dc_colormap;
|
||||
dc_wall_colormap[2] = dc_colormap;
|
||||
dc_wall_colormap[3] = dc_colormap;
|
||||
}
|
||||
|
||||
if (fixedcolormap)
|
||||
|
@ -333,7 +329,7 @@ static void ProcessWallWorker(
|
|||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
palookupoffse[i] = basecolormap->Maps + (GETPALOOKUP(lights[i], wallshade) << COLORMAPSHIFT);
|
||||
dc_wall_colormap[i] = basecolormap->Maps + (GETPALOOKUP(lights[i], wallshade) << COLORMAPSHIFT);
|
||||
}
|
||||
}
|
||||
Draw4Columns(x, middle_y1, middle_y2, sampler, draw4columns);
|
||||
|
@ -369,12 +365,7 @@ static void ProcessWallWorker(
|
|||
|
||||
static void ProcessNormalWall(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const BYTE *(*getcol)(FTexture *tex, int x) = R_GetColumn)
|
||||
{
|
||||
ProcessWallWorker(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, [](int bits, Draw1ColumnFuncPtr &line1, Draw4ColumnsFuncPtr &line4)
|
||||
{
|
||||
setupvline(bits);
|
||||
line1 = dovline1;
|
||||
line4 = dovline4;
|
||||
});
|
||||
ProcessWallWorker(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, R_DrawWallCol1, R_DrawWallCol4);
|
||||
}
|
||||
|
||||
static void ProcessMaskedWall(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const BYTE *(*getcol)(FTexture *tex, int x) = R_GetColumn)
|
||||
|
@ -385,32 +376,22 @@ static void ProcessMaskedWall(int x1, int x2, short *uwal, short *dwal, float *s
|
|||
}
|
||||
else
|
||||
{
|
||||
ProcessWallWorker(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, [](int bits, Draw1ColumnFuncPtr &line1, Draw4ColumnsFuncPtr &line4)
|
||||
{
|
||||
setupmvline(bits);
|
||||
line1 = domvline1;
|
||||
line4 = domvline4;
|
||||
});
|
||||
ProcessWallWorker(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, R_DrawWallMaskedCol1, R_DrawWallMaskedCol4);
|
||||
}
|
||||
}
|
||||
|
||||
static void ProcessTranslucentWall(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const BYTE *(*getcol)(FTexture *tex, int x) = R_GetColumn)
|
||||
{
|
||||
static fixed_t(*tmvline1)();
|
||||
static void(*tmvline4)();
|
||||
if (!R_GetTransMaskDrawers(&tmvline1, &tmvline4))
|
||||
void (*drawcol1)();
|
||||
void (*drawcol4)();
|
||||
if (!R_GetTransMaskDrawers(&drawcol1, &drawcol4))
|
||||
{
|
||||
// The current translucency is unsupported, so draw with regular ProcessMaskedWall instead.
|
||||
ProcessMaskedWall(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol);
|
||||
}
|
||||
else
|
||||
{
|
||||
ProcessWallWorker(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, [](int bits, Draw1ColumnFuncPtr &line1, Draw4ColumnsFuncPtr &line4)
|
||||
{
|
||||
setuptmvline(bits);
|
||||
line1 = reinterpret_cast<DWORD(*)()>(tmvline1);
|
||||
line4 = tmvline4;
|
||||
});
|
||||
ProcessWallWorker(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, drawcol1, drawcol4);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -552,7 +533,7 @@ WallSampler::WallSampler(int y1, float swal, double yrepeat, fixed_t xoffset, do
|
|||
}
|
||||
|
||||
// Draw a column with support for non-power-of-two ranges
|
||||
static void Draw1Column(int x, int y1, int y2, WallSampler &sampler, DWORD(*draw1column)())
|
||||
static void Draw1Column(int x, int y1, int y2, WallSampler &sampler, void(*draw1column)())
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
|
@ -632,12 +613,12 @@ static void Draw4Columns(int x, int y1, int y2, WallSampler *sampler, void(*draw
|
|||
int count = y2 - y1;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
bufplce[i] = sampler[i].source;
|
||||
bufplce2[i] = sampler[i].source2;
|
||||
buftexturefracx[i] = sampler[i].texturefracx;
|
||||
bufheight[i] = sampler[i].height;
|
||||
vplce[i] = sampler[i].uv_pos;
|
||||
vince[i] = sampler[i].uv_step;
|
||||
dc_wall_source[i] = sampler[i].source;
|
||||
dc_wall_source2[i] = sampler[i].source2;
|
||||
dc_wall_texturefracx[i] = sampler[i].texturefracx;
|
||||
dc_wall_sourceheight[i] = sampler[i].height;
|
||||
dc_wall_texturefrac[i] = sampler[i].uv_pos;
|
||||
dc_wall_iscale[i] = sampler[i].uv_step;
|
||||
|
||||
uint64_t step64 = sampler[i].uv_step;
|
||||
uint64_t pos64 = sampler[i].uv_pos;
|
||||
|
@ -654,11 +635,11 @@ static void Draw4Columns(int x, int y1, int y2, WallSampler *sampler, void(*draw
|
|||
int count = y2 - y1;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
bufplce[i] = sampler[i].source;
|
||||
bufplce2[i] = sampler[i].source2;
|
||||
buftexturefracx[i] = sampler[i].texturefracx;
|
||||
vplce[i] = sampler[i].uv_pos;
|
||||
vince[i] = sampler[i].uv_step;
|
||||
dc_wall_source[i] = sampler[i].source;
|
||||
dc_wall_source2[i] = sampler[i].source2;
|
||||
dc_wall_texturefracx[i] = sampler[i].texturefracx;
|
||||
dc_wall_texturefrac[i] = sampler[i].uv_pos;
|
||||
dc_wall_iscale[i] = sampler[i].uv_step;
|
||||
|
||||
uint64_t step64 = sampler[i].uv_step;
|
||||
uint64_t pos64 = sampler[i].uv_pos;
|
||||
|
@ -673,9 +654,9 @@ static void Draw4Columns(int x, int y1, int y2, WallSampler *sampler, void(*draw
|
|||
dc_dest = (ylookup[y1] + x) + dc_destorg;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
bufplce[i] = sampler[i].source;
|
||||
bufplce2[i] = sampler[i].source2;
|
||||
buftexturefracx[i] = sampler[i].texturefracx;
|
||||
dc_wall_source[i] = sampler[i].source;
|
||||
dc_wall_source2[i] = sampler[i].source2;
|
||||
dc_wall_texturefracx[i] = sampler[i].texturefracx;
|
||||
}
|
||||
|
||||
uint32_t left = y2 - y1;
|
||||
|
@ -695,8 +676,8 @@ static void Draw4Columns(int x, int y1, int y2, WallSampler *sampler, void(*draw
|
|||
// Draw until that column wraps
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
vplce[i] = sampler[i].uv_pos;
|
||||
vince[i] = sampler[i].uv_step;
|
||||
dc_wall_texturefrac[i] = sampler[i].uv_pos;
|
||||
dc_wall_iscale[i] = sampler[i].uv_step;
|
||||
}
|
||||
dc_count = count;
|
||||
draw4columns();
|
||||
|
@ -715,13 +696,11 @@ static void Draw4Columns(int x, int y1, int y2, WallSampler *sampler, void(*draw
|
|||
}
|
||||
}
|
||||
|
||||
typedef DWORD(*Draw1ColumnFuncPtr)();
|
||||
typedef void(*Draw4ColumnsFuncPtr)();
|
||||
typedef void(*DrawColumnFuncPtr)();
|
||||
|
||||
static void ProcessWallWorker(
|
||||
int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat,
|
||||
const BYTE *(*getcol)(FTexture *tex, int x),
|
||||
void(setupProcessNormalWall(int bits, Draw1ColumnFuncPtr &draw1, Draw4ColumnsFuncPtr &draw2)))
|
||||
const BYTE *(*getcol)(FTexture *tex, int x), DrawColumnFuncPtr draw1column, DrawColumnFuncPtr draw4columns)
|
||||
{
|
||||
if (rw_pic->UseType == FTexture::TEX_Null)
|
||||
return;
|
||||
|
@ -737,21 +716,19 @@ static void ProcessWallWorker(
|
|||
dc_texturemid = 0;
|
||||
}
|
||||
|
||||
DWORD(*draw1column)();
|
||||
void(*draw4columns)();
|
||||
setupProcessNormalWall(r_swtruecolor ? FRACBITS : fracbits, draw1column, draw4columns);
|
||||
dc_wall_fracbits = r_swtruecolor ? FRACBITS : fracbits;
|
||||
|
||||
bool fixed = (fixedcolormap != NULL || fixedlightlev >= 0);
|
||||
if (fixed)
|
||||
{
|
||||
palookupoffse[0] = dc_colormap;
|
||||
palookupoffse[1] = dc_colormap;
|
||||
palookupoffse[2] = dc_colormap;
|
||||
palookupoffse[3] = dc_colormap;
|
||||
palookuplight[0] = 0;
|
||||
palookuplight[1] = 0;
|
||||
palookuplight[2] = 0;
|
||||
palookuplight[3] = 0;
|
||||
dc_wall_colormap[0] = dc_colormap;
|
||||
dc_wall_colormap[1] = dc_colormap;
|
||||
dc_wall_colormap[2] = dc_colormap;
|
||||
dc_wall_colormap[3] = dc_colormap;
|
||||
dc_wall_light[0] = 0;
|
||||
dc_wall_light[1] = 0;
|
||||
dc_wall_light[2] = 0;
|
||||
dc_wall_light[3] = 0;
|
||||
}
|
||||
|
||||
if (fixedcolormap)
|
||||
|
@ -856,13 +833,13 @@ static void ProcessWallWorker(
|
|||
{
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
palookupoffse[i] = basecolormap->Maps;
|
||||
palookuplight[i] = LIGHTSCALE(lights[i], wallshade);
|
||||
dc_wall_colormap[i] = basecolormap->Maps;
|
||||
dc_wall_light[i] = LIGHTSCALE(lights[i], wallshade);
|
||||
}
|
||||
else
|
||||
{
|
||||
palookupoffse[i] = basecolormap->Maps + (GETPALOOKUP(lights[i], wallshade) << COLORMAPSHIFT);
|
||||
palookuplight[i] = 0;
|
||||
dc_wall_colormap[i] = basecolormap->Maps + (GETPALOOKUP(lights[i], wallshade) << COLORMAPSHIFT);
|
||||
dc_wall_light[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -901,12 +878,7 @@ static void ProcessWallWorker(
|
|||
|
||||
static void ProcessNormalWall(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const BYTE *(*getcol)(FTexture *tex, int x) = R_GetColumn)
|
||||
{
|
||||
ProcessWallWorker(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, [](int bits, Draw1ColumnFuncPtr &line1, Draw4ColumnsFuncPtr &line4)
|
||||
{
|
||||
setupvline(bits);
|
||||
line1 = dovline1;
|
||||
line4 = dovline4;
|
||||
});
|
||||
ProcessWallWorker(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, R_DrawWallCol1, R_DrawWallCol4);
|
||||
}
|
||||
|
||||
static void ProcessMaskedWall(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const BYTE *(*getcol)(FTexture *tex, int x) = R_GetColumn)
|
||||
|
@ -917,32 +889,22 @@ static void ProcessMaskedWall(int x1, int x2, short *uwal, short *dwal, float *s
|
|||
}
|
||||
else
|
||||
{
|
||||
ProcessWallWorker(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, [](int bits, Draw1ColumnFuncPtr &line1, Draw4ColumnsFuncPtr &line4)
|
||||
{
|
||||
setupmvline(bits);
|
||||
line1 = domvline1;
|
||||
line4 = domvline4;
|
||||
});
|
||||
ProcessWallWorker(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, R_DrawWallMaskedCol1, R_DrawWallMaskedCol4);
|
||||
}
|
||||
}
|
||||
|
||||
static void ProcessTranslucentWall(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const BYTE *(*getcol)(FTexture *tex, int x) = R_GetColumn)
|
||||
{
|
||||
static fixed_t(*tmvline1)();
|
||||
static void(*tmvline4)();
|
||||
if (!R_GetTransMaskDrawers(&tmvline1, &tmvline4))
|
||||
static void(*drawcol1)();
|
||||
static void(*drawcol4)();
|
||||
if (!R_GetTransMaskDrawers(&drawcol1, &drawcol4))
|
||||
{
|
||||
// The current translucency is unsupported, so draw with regular ProcessMaskedWall instead.
|
||||
ProcessMaskedWall(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol);
|
||||
}
|
||||
else
|
||||
{
|
||||
ProcessWallWorker(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, [](int bits, Draw1ColumnFuncPtr &line1, Draw4ColumnsFuncPtr &line4)
|
||||
{
|
||||
setuptmvline(bits);
|
||||
line1 = reinterpret_cast<DWORD(*)()>(tmvline1);
|
||||
line4 = tmvline4;
|
||||
});
|
||||
ProcessWallWorker(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, drawcol1, drawcol4);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue