Hooked up LLVM wall drawers

This commit is contained in:
Magnus Norddahl 2016-09-30 07:27:25 +02:00
commit 28bb5da181
9 changed files with 411 additions and 48 deletions

View file

@ -404,6 +404,219 @@ public:
/////////////////////////////////////////////////////////////////////////////
class DrawWall4LLVMCommand : public DrawerCommand
{
protected:
DrawWallArgs args;
WorkerThreadData ThreadData(DrawerThread *thread)
{
WorkerThreadData d;
d.core = thread->core;
d.num_cores = thread->num_cores;
d.pass_start_y = thread->pass_start_y;
d.pass_end_y = thread->pass_end_y;
return d;
}
public:
DrawWall4LLVMCommand()
{
args.dest = (uint32_t*)dc_dest;
args.dest_y = _dest_y;
args.count = dc_count;
args.pitch = dc_pitch;
args.light_red = dc_shade_constants.light_red;
args.light_green = dc_shade_constants.light_green;
args.light_blue = dc_shade_constants.light_blue;
args.light_alpha = dc_shade_constants.light_alpha;
args.fade_red = dc_shade_constants.fade_red;
args.fade_green = dc_shade_constants.fade_green;
args.fade_blue = dc_shade_constants.fade_blue;
args.fade_alpha = dc_shade_constants.fade_alpha;
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.srcalpha = dc_srcalpha >> (FRACBITS - 8);
args.destalpha = dc_destalpha >> (FRACBITS - 8);
args.flags = 0;
if (dc_shade_constants.simple_shade)
args.flags |= DrawWallArgs::simple_shade;
if (args.source2[0] == nullptr)
args.flags |= DrawWallArgs::nearest_filter;
}
void Execute(DrawerThread *thread) override
{
WorkerThreadData d = ThreadData(thread);
LLVMDrawers::Instance()->vlinec4(&args, &d);
}
};
class DrawWallMasked4LLVMCommand : public DrawWall4LLVMCommand
{
public:
void Execute(DrawerThread *thread) override
{
WorkerThreadData d = ThreadData(thread);
LLVMDrawers::Instance()->mvlinec4(&args, &d);
}
};
class DrawWallAdd4LLVMCommand : public DrawWall4LLVMCommand
{
public:
void Execute(DrawerThread *thread) override
{
WorkerThreadData d = ThreadData(thread);
LLVMDrawers::Instance()->tmvline4_add(&args, &d);
}
};
class DrawWallAddClamp4LLVMCommand : public DrawWall4LLVMCommand
{
public:
void Execute(DrawerThread *thread) override
{
WorkerThreadData d = ThreadData(thread);
LLVMDrawers::Instance()->tmvline4_addclamp(&args, &d);
}
};
class DrawWallSubClamp4LLVMCommand : public DrawWall4LLVMCommand
{
public:
void Execute(DrawerThread *thread) override
{
WorkerThreadData d = ThreadData(thread);
LLVMDrawers::Instance()->tmvline4_subclamp(&args, &d);
}
};
class DrawWallRevSubClamp4LLVMCommand : public DrawWall4LLVMCommand
{
public:
void Execute(DrawerThread *thread) override
{
WorkerThreadData d = ThreadData(thread);
LLVMDrawers::Instance()->tmvline4_revsubclamp(&args, &d);
}
};
class DrawWall1LLVMCommand : public DrawerCommand
{
protected:
DrawWallArgs args;
WorkerThreadData ThreadData(DrawerThread *thread)
{
WorkerThreadData d;
d.core = thread->core;
d.num_cores = thread->num_cores;
d.pass_start_y = thread->pass_start_y;
d.pass_end_y = thread->pass_end_y;
return d;
}
public:
DrawWall1LLVMCommand()
{
args.dest = (uint32_t*)dc_dest;
args.dest_y = _dest_y;
args.pitch = dc_pitch;
args.count = dc_count;
args.texturefrac[0] = dc_texturefrac;
args.texturefracx[0] = dc_texturefracx;
args.iscale[0] = dc_iscale;
args.textureheight[0] = dc_textureheight;
args.source[0] = (const uint32 *)dc_source;
args.source2[0] = (const uint32 *)dc_source2;
args.light[0] = LightBgra::calc_light_multiplier(dc_light);
args.light_red = dc_shade_constants.light_red;
args.light_green = dc_shade_constants.light_green;
args.light_blue = dc_shade_constants.light_blue;
args.light_alpha = dc_shade_constants.light_alpha;
args.fade_red = dc_shade_constants.fade_red;
args.fade_green = dc_shade_constants.fade_green;
args.fade_blue = dc_shade_constants.fade_blue;
args.fade_alpha = dc_shade_constants.fade_alpha;
args.desaturate = dc_shade_constants.desaturate;
args.srcalpha = dc_srcalpha >> (FRACBITS - 8);
args.destalpha = dc_destalpha >> (FRACBITS - 8);
args.flags = 0;
if (dc_shade_constants.simple_shade)
args.flags |= DrawWallArgs::simple_shade;
if (args.source2[0] == nullptr)
args.flags |= DrawWallArgs::nearest_filter;
}
void Execute(DrawerThread *thread) override
{
WorkerThreadData d = ThreadData(thread);
LLVMDrawers::Instance()->vlinec1(&args, &d);
}
};
class DrawWallMasked1LLVMCommand : public DrawWall1LLVMCommand
{
public:
void Execute(DrawerThread *thread) override
{
WorkerThreadData d = ThreadData(thread);
LLVMDrawers::Instance()->mvlinec1(&args, &d);
}
};
class DrawWallAdd1LLVMCommand : public DrawWall1LLVMCommand
{
public:
void Execute(DrawerThread *thread) override
{
WorkerThreadData d = ThreadData(thread);
LLVMDrawers::Instance()->tmvline1_add(&args, &d);
}
};
class DrawWallAddClamp1LLVMCommand : public DrawWall1LLVMCommand
{
public:
void Execute(DrawerThread *thread) override
{
WorkerThreadData d = ThreadData(thread);
LLVMDrawers::Instance()->tmvline1_addclamp(&args, &d);
}
};
class DrawWallSubClamp1LLVMCommand : public DrawWall1LLVMCommand
{
public:
void Execute(DrawerThread *thread) override
{
WorkerThreadData d = ThreadData(thread);
LLVMDrawers::Instance()->tmvline1_subclamp(&args, &d);
}
};
class DrawWallRevSubClamp1LLVMCommand : public DrawWall1LLVMCommand
{
public:
void Execute(DrawerThread *thread) override
{
WorkerThreadData d = ThreadData(thread);
LLVMDrawers::Instance()->tmvline1_revsubclamp(&args, &d);
}
};
/////////////////////////////////////////////////////////////////////////////
class DrawerColumnCommand : public DrawerCommand
{
public:
@ -2901,7 +3114,11 @@ void R_DrawSlab_rgba(int dx, fixed_t v, int dy, fixed_t vi, const BYTE *vptr, BY
DWORD vlinec1_rgba()
{
#if !defined(NO_LLVM)
DrawerCommandQueue::QueueCommand<DrawWall1LLVMCommand>();
#else
DrawerCommandQueue::QueueCommand<Vlinec1RGBACommand>();
#endif
return dc_texturefrac + dc_count * dc_iscale;
}
@ -2920,72 +3137,116 @@ void queue_wallcommand()
void vlinec4_rgba()
{
#if !defined(NO_LLVM)
DrawerCommandQueue::QueueCommand<DrawWall4LLVMCommand>();
#else
queue_wallcommand<Vlinec4NearestSimpleRGBACommand, Vlinec4NearestRGBACommand, Vlinec4LinearSimpleRGBACommand, Vlinec4LinearRGBACommand>();
#endif
for (int i = 0; i < 4; i++)
vplce[i] += vince[i] * dc_count;
}
DWORD mvlinec1_rgba()
{
#if !defined(NO_LLVM)
DrawerCommandQueue::QueueCommand<DrawWallMasked1LLVMCommand>();
#else
DrawerCommandQueue::QueueCommand<Mvlinec1RGBACommand>();
#endif
return dc_texturefrac + dc_count * dc_iscale;
}
void mvlinec4_rgba()
{
#if !defined(NO_LLVM)
DrawerCommandQueue::QueueCommand<DrawWallMasked4LLVMCommand>();
#else
queue_wallcommand<Mvlinec4NearestSimpleRGBACommand, Mvlinec4NearestRGBACommand, Mvlinec4LinearSimpleRGBACommand, Mvlinec4LinearRGBACommand>();
#endif
for (int i = 0; i < 4; i++)
vplce[i] += vince[i] * dc_count;
}
fixed_t tmvline1_add_rgba()
{
#if !defined(NO_LLVM)
DrawerCommandQueue::QueueCommand<DrawWallAdd1LLVMCommand>();
#else
DrawerCommandQueue::QueueCommand<Tmvline1AddRGBACommand>();
#endif
return dc_texturefrac + dc_count * dc_iscale;
}
void tmvline4_add_rgba()
{
#if !defined(NO_LLVM)
DrawerCommandQueue::QueueCommand<DrawWallAdd4LLVMCommand>();
#else
queue_wallcommand<Tmvline4AddNearestSimpleRGBACommand, Tmvline4AddNearestRGBACommand, Tmvline4AddLinearSimpleRGBACommand, Tmvline4AddLinearRGBACommand>();
#endif
for (int i = 0; i < 4; i++)
vplce[i] += vince[i] * dc_count;
}
fixed_t tmvline1_addclamp_rgba()
{
#if !defined(NO_LLVM)
DrawerCommandQueue::QueueCommand<DrawWallAddClamp1LLVMCommand>();
#else
DrawerCommandQueue::QueueCommand<Tmvline1AddClampRGBACommand>();
#endif
return dc_texturefrac + dc_count * dc_iscale;
}
void tmvline4_addclamp_rgba()
{
#if !defined(NO_LLVM)
DrawerCommandQueue::QueueCommand<DrawWallAddClamp4LLVMCommand>();
#else
queue_wallcommand<Tmvline4AddClampNearestSimpleRGBACommand, Tmvline4AddClampNearestRGBACommand, Tmvline4AddClampLinearSimpleRGBACommand, Tmvline4AddClampLinearRGBACommand>();
#endif
for (int i = 0; i < 4; i++)
vplce[i] += vince[i] * dc_count;
}
fixed_t tmvline1_subclamp_rgba()
{
#if !defined(NO_LLVM)
DrawerCommandQueue::QueueCommand<DrawWallSubClamp1LLVMCommand>();
#else
DrawerCommandQueue::QueueCommand<Tmvline1SubClampRGBACommand>();
#endif
return dc_texturefrac + dc_count * dc_iscale;
}
void tmvline4_subclamp_rgba()
{
#if !defined(NO_LLVM)
DrawerCommandQueue::QueueCommand<DrawWallSubClamp4LLVMCommand>();
#else
queue_wallcommand<Tmvline4SubClampNearestSimpleRGBACommand, Tmvline4SubClampNearestRGBACommand, Tmvline4SubClampLinearSimpleRGBACommand, Tmvline4SubClampLinearRGBACommand>();
#endif
for (int i = 0; i < 4; i++)
vplce[i] += vince[i] * dc_count;
}
fixed_t tmvline1_revsubclamp_rgba()
{
#if !defined(NO_LLVM)
DrawerCommandQueue::QueueCommand<DrawWallRevSubClamp1LLVMCommand>();
#else
DrawerCommandQueue::QueueCommand<Tmvline1RevSubClampRGBACommand>();
#endif
return dc_texturefrac + dc_count * dc_iscale;
}
void tmvline4_revsubclamp_rgba()
{
#if !defined(NO_LLVM)
DrawerCommandQueue::QueueCommand<DrawWallRevSubClamp4LLVMCommand>();
#else
queue_wallcommand<Tmvline4RevSubClampNearestSimpleRGBACommand, Tmvline4RevSubClampNearestRGBACommand, Tmvline4RevSubClampLinearSimpleRGBACommand, Tmvline4RevSubClampLinearRGBACommand>();
#endif
for (int i = 0; i < 4; i++)
vplce[i] += vince[i] * dc_count;
}