Remove TriDrawVariant from LLVM codegen

This commit is contained in:
Magnus Norddahl 2016-12-15 23:29:31 +01:00
parent e556fb16bd
commit 99435f5018
8 changed files with 189 additions and 336 deletions

View file

@ -93,128 +93,66 @@ extern "C"
void DrawSky4_SSE2(const DrawSkyArgs *, const WorkerThreadData *); void DrawSky4_SSE2(const DrawSkyArgs *, const WorkerThreadData *);
void DrawDoubleSky1_SSE2(const DrawSkyArgs *, const WorkerThreadData *); void DrawDoubleSky1_SSE2(const DrawSkyArgs *, const WorkerThreadData *);
void DrawDoubleSky4_SSE2(const DrawSkyArgs *, const WorkerThreadData *); void DrawDoubleSky4_SSE2(const DrawSkyArgs *, const WorkerThreadData *);
void TriDrawNormal8_0_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw8_0_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal8_1_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw8_1_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal8_2_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw8_2_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal8_3_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw8_3_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal8_4_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw8_4_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal8_5_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw8_5_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal8_6_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw8_6_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal8_7_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw8_7_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal8_8_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw8_8_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal8_9_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw8_9_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal8_10_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw8_10_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal8_11_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw8_11_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal8_12_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw8_12_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal8_13_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw8_13_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal8_14_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw8_14_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal32_0_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw32_0_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal32_1_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw32_1_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal32_2_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw32_2_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal32_3_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw32_3_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal32_4_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw32_4_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal32_5_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw32_5_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal32_6_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw32_6_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal32_7_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw32_7_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal32_8_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw32_8_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal32_9_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw32_9_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal32_10_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw32_10_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal32_11_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw32_11_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal32_12_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw32_12_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal32_13_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw32_13_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawNormal32_14_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriDraw32_14_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal8_0_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill8_0_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal8_1_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill8_1_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal8_2_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill8_2_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal8_3_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill8_3_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal8_4_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill8_4_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal8_5_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill8_5_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal8_6_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill8_6_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal8_7_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill8_7_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal8_8_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill8_8_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal8_9_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill8_9_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal8_10_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill8_10_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal8_11_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill8_11_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal8_12_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill8_12_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal8_13_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill8_13_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal8_14_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill8_14_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal32_0_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill32_0_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal32_1_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill32_1_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal32_2_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill32_2_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal32_3_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill32_3_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal32_4_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill32_4_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal32_5_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill32_5_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal32_6_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill32_6_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal32_7_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill32_7_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal32_8_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill32_8_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal32_9_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill32_9_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal32_10_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill32_10_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal32_11_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill32_11_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal32_12_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill32_12_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal32_13_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill32_13_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillNormal32_14_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); void TriFill32_14_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector8_0_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector8_1_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector8_2_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector8_3_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector8_4_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector8_5_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector8_6_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector8_7_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector8_8_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector8_9_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector8_10_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector8_11_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector8_12_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector8_13_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector8_14_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector32_0_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector32_1_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector32_2_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector32_3_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector32_4_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector32_5_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector32_6_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector32_7_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector32_8_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector32_9_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector32_10_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector32_11_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector32_12_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector32_13_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriDrawSubsector32_14_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector8_0_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector8_1_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector8_2_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector8_3_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector8_4_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector8_5_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector8_6_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector8_7_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector8_8_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector8_9_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector8_10_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector8_11_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector8_12_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector8_13_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector8_14_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector32_0_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector32_1_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector32_2_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector32_3_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector32_4_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector32_5_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector32_6_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector32_7_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector32_8_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector32_9_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector32_10_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector32_11_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector32_12_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector32_13_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriFillSubsector32_14_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriStencil_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
void TriStencilClose_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *);
} }
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -283,128 +221,66 @@ Drawers::Drawers()
DrawSky4 = DrawSky4_SSE2; DrawSky4 = DrawSky4_SSE2;
DrawDoubleSky1 = DrawDoubleSky1_SSE2; DrawDoubleSky1 = DrawDoubleSky1_SSE2;
DrawDoubleSky4 = DrawDoubleSky4_SSE2; DrawDoubleSky4 = DrawDoubleSky4_SSE2;
TriDrawNormal8.push_back(TriDrawNormal8_0_SSE2); TriDraw8.push_back(TriDraw8_0_SSE2);
TriDrawNormal8.push_back(TriDrawNormal8_1_SSE2); TriDraw8.push_back(TriDraw8_1_SSE2);
TriDrawNormal8.push_back(TriDrawNormal8_2_SSE2); TriDraw8.push_back(TriDraw8_2_SSE2);
TriDrawNormal8.push_back(TriDrawNormal8_3_SSE2); TriDraw8.push_back(TriDraw8_3_SSE2);
TriDrawNormal8.push_back(TriDrawNormal8_4_SSE2); TriDraw8.push_back(TriDraw8_4_SSE2);
TriDrawNormal8.push_back(TriDrawNormal8_5_SSE2); TriDraw8.push_back(TriDraw8_5_SSE2);
TriDrawNormal8.push_back(TriDrawNormal8_6_SSE2); TriDraw8.push_back(TriDraw8_6_SSE2);
TriDrawNormal8.push_back(TriDrawNormal8_7_SSE2); TriDraw8.push_back(TriDraw8_7_SSE2);
TriDrawNormal8.push_back(TriDrawNormal8_8_SSE2); TriDraw8.push_back(TriDraw8_8_SSE2);
TriDrawNormal8.push_back(TriDrawNormal8_9_SSE2); TriDraw8.push_back(TriDraw8_9_SSE2);
TriDrawNormal8.push_back(TriDrawNormal8_10_SSE2); TriDraw8.push_back(TriDraw8_10_SSE2);
TriDrawNormal8.push_back(TriDrawNormal8_11_SSE2); TriDraw8.push_back(TriDraw8_11_SSE2);
TriDrawNormal8.push_back(TriDrawNormal8_12_SSE2); TriDraw8.push_back(TriDraw8_12_SSE2);
TriDrawNormal8.push_back(TriDrawNormal8_13_SSE2); TriDraw8.push_back(TriDraw8_13_SSE2);
TriDrawNormal8.push_back(TriDrawNormal8_14_SSE2); TriDraw8.push_back(TriDraw8_14_SSE2);
TriDrawNormal32.push_back(TriDrawNormal32_0_SSE2); TriDraw32.push_back(TriDraw32_0_SSE2);
TriDrawNormal32.push_back(TriDrawNormal32_1_SSE2); TriDraw32.push_back(TriDraw32_1_SSE2);
TriDrawNormal32.push_back(TriDrawNormal32_2_SSE2); TriDraw32.push_back(TriDraw32_2_SSE2);
TriDrawNormal32.push_back(TriDrawNormal32_3_SSE2); TriDraw32.push_back(TriDraw32_3_SSE2);
TriDrawNormal32.push_back(TriDrawNormal32_4_SSE2); TriDraw32.push_back(TriDraw32_4_SSE2);
TriDrawNormal32.push_back(TriDrawNormal32_5_SSE2); TriDraw32.push_back(TriDraw32_5_SSE2);
TriDrawNormal32.push_back(TriDrawNormal32_6_SSE2); TriDraw32.push_back(TriDraw32_6_SSE2);
TriDrawNormal32.push_back(TriDrawNormal32_7_SSE2); TriDraw32.push_back(TriDraw32_7_SSE2);
TriDrawNormal32.push_back(TriDrawNormal32_8_SSE2); TriDraw32.push_back(TriDraw32_8_SSE2);
TriDrawNormal32.push_back(TriDrawNormal32_9_SSE2); TriDraw32.push_back(TriDraw32_9_SSE2);
TriDrawNormal32.push_back(TriDrawNormal32_10_SSE2); TriDraw32.push_back(TriDraw32_10_SSE2);
TriDrawNormal32.push_back(TriDrawNormal32_11_SSE2); TriDraw32.push_back(TriDraw32_11_SSE2);
TriDrawNormal32.push_back(TriDrawNormal32_12_SSE2); TriDraw32.push_back(TriDraw32_12_SSE2);
TriDrawNormal32.push_back(TriDrawNormal32_13_SSE2); TriDraw32.push_back(TriDraw32_13_SSE2);
TriDrawNormal32.push_back(TriDrawNormal32_14_SSE2); TriDraw32.push_back(TriDraw32_14_SSE2);
TriFillNormal8.push_back(TriFillNormal8_0_SSE2); TriFill8.push_back(TriFill8_0_SSE2);
TriFillNormal8.push_back(TriFillNormal8_1_SSE2); TriFill8.push_back(TriFill8_1_SSE2);
TriFillNormal8.push_back(TriFillNormal8_2_SSE2); TriFill8.push_back(TriFill8_2_SSE2);
TriFillNormal8.push_back(TriFillNormal8_3_SSE2); TriFill8.push_back(TriFill8_3_SSE2);
TriFillNormal8.push_back(TriFillNormal8_4_SSE2); TriFill8.push_back(TriFill8_4_SSE2);
TriFillNormal8.push_back(TriFillNormal8_5_SSE2); TriFill8.push_back(TriFill8_5_SSE2);
TriFillNormal8.push_back(TriFillNormal8_6_SSE2); TriFill8.push_back(TriFill8_6_SSE2);
TriFillNormal8.push_back(TriFillNormal8_7_SSE2); TriFill8.push_back(TriFill8_7_SSE2);
TriFillNormal8.push_back(TriFillNormal8_8_SSE2); TriFill8.push_back(TriFill8_8_SSE2);
TriFillNormal8.push_back(TriFillNormal8_9_SSE2); TriFill8.push_back(TriFill8_9_SSE2);
TriFillNormal8.push_back(TriFillNormal8_10_SSE2); TriFill8.push_back(TriFill8_10_SSE2);
TriFillNormal8.push_back(TriFillNormal8_11_SSE2); TriFill8.push_back(TriFill8_11_SSE2);
TriFillNormal8.push_back(TriFillNormal8_12_SSE2); TriFill8.push_back(TriFill8_12_SSE2);
TriFillNormal8.push_back(TriFillNormal8_13_SSE2); TriFill8.push_back(TriFill8_13_SSE2);
TriFillNormal8.push_back(TriFillNormal8_14_SSE2); TriFill8.push_back(TriFill8_14_SSE2);
TriFillNormal32.push_back(TriFillNormal32_0_SSE2); TriFill32.push_back(TriFill32_0_SSE2);
TriFillNormal32.push_back(TriFillNormal32_1_SSE2); TriFill32.push_back(TriFill32_1_SSE2);
TriFillNormal32.push_back(TriFillNormal32_2_SSE2); TriFill32.push_back(TriFill32_2_SSE2);
TriFillNormal32.push_back(TriFillNormal32_3_SSE2); TriFill32.push_back(TriFill32_3_SSE2);
TriFillNormal32.push_back(TriFillNormal32_4_SSE2); TriFill32.push_back(TriFill32_4_SSE2);
TriFillNormal32.push_back(TriFillNormal32_5_SSE2); TriFill32.push_back(TriFill32_5_SSE2);
TriFillNormal32.push_back(TriFillNormal32_6_SSE2); TriFill32.push_back(TriFill32_6_SSE2);
TriFillNormal32.push_back(TriFillNormal32_7_SSE2); TriFill32.push_back(TriFill32_7_SSE2);
TriFillNormal32.push_back(TriFillNormal32_8_SSE2); TriFill32.push_back(TriFill32_8_SSE2);
TriFillNormal32.push_back(TriFillNormal32_9_SSE2); TriFill32.push_back(TriFill32_9_SSE2);
TriFillNormal32.push_back(TriFillNormal32_10_SSE2); TriFill32.push_back(TriFill32_10_SSE2);
TriFillNormal32.push_back(TriFillNormal32_11_SSE2); TriFill32.push_back(TriFill32_11_SSE2);
TriFillNormal32.push_back(TriFillNormal32_12_SSE2); TriFill32.push_back(TriFill32_12_SSE2);
TriFillNormal32.push_back(TriFillNormal32_13_SSE2); TriFill32.push_back(TriFill32_13_SSE2);
TriFillNormal32.push_back(TriFillNormal32_14_SSE2); TriFill32.push_back(TriFill32_14_SSE2);
TriDrawSubsector8.push_back(TriDrawSubsector8_0_SSE2);
TriDrawSubsector8.push_back(TriDrawSubsector8_1_SSE2);
TriDrawSubsector8.push_back(TriDrawSubsector8_2_SSE2);
TriDrawSubsector8.push_back(TriDrawSubsector8_3_SSE2);
TriDrawSubsector8.push_back(TriDrawSubsector8_4_SSE2);
TriDrawSubsector8.push_back(TriDrawSubsector8_5_SSE2);
TriDrawSubsector8.push_back(TriDrawSubsector8_6_SSE2);
TriDrawSubsector8.push_back(TriDrawSubsector8_7_SSE2);
TriDrawSubsector8.push_back(TriDrawSubsector8_8_SSE2);
TriDrawSubsector8.push_back(TriDrawSubsector8_9_SSE2);
TriDrawSubsector8.push_back(TriDrawSubsector8_10_SSE2);
TriDrawSubsector8.push_back(TriDrawSubsector8_11_SSE2);
TriDrawSubsector8.push_back(TriDrawSubsector8_12_SSE2);
TriDrawSubsector8.push_back(TriDrawSubsector8_13_SSE2);
TriDrawSubsector8.push_back(TriDrawSubsector8_14_SSE2);
TriDrawSubsector32.push_back(TriDrawSubsector32_0_SSE2);
TriDrawSubsector32.push_back(TriDrawSubsector32_1_SSE2);
TriDrawSubsector32.push_back(TriDrawSubsector32_2_SSE2);
TriDrawSubsector32.push_back(TriDrawSubsector32_3_SSE2);
TriDrawSubsector32.push_back(TriDrawSubsector32_4_SSE2);
TriDrawSubsector32.push_back(TriDrawSubsector32_5_SSE2);
TriDrawSubsector32.push_back(TriDrawSubsector32_6_SSE2);
TriDrawSubsector32.push_back(TriDrawSubsector32_7_SSE2);
TriDrawSubsector32.push_back(TriDrawSubsector32_8_SSE2);
TriDrawSubsector32.push_back(TriDrawSubsector32_9_SSE2);
TriDrawSubsector32.push_back(TriDrawSubsector32_10_SSE2);
TriDrawSubsector32.push_back(TriDrawSubsector32_11_SSE2);
TriDrawSubsector32.push_back(TriDrawSubsector32_12_SSE2);
TriDrawSubsector32.push_back(TriDrawSubsector32_13_SSE2);
TriDrawSubsector32.push_back(TriDrawSubsector32_14_SSE2);
TriFillSubsector8.push_back(TriFillSubsector8_0_SSE2);
TriFillSubsector8.push_back(TriFillSubsector8_1_SSE2);
TriFillSubsector8.push_back(TriFillSubsector8_2_SSE2);
TriFillSubsector8.push_back(TriFillSubsector8_3_SSE2);
TriFillSubsector8.push_back(TriFillSubsector8_4_SSE2);
TriFillSubsector8.push_back(TriFillSubsector8_5_SSE2);
TriFillSubsector8.push_back(TriFillSubsector8_6_SSE2);
TriFillSubsector8.push_back(TriFillSubsector8_7_SSE2);
TriFillSubsector8.push_back(TriFillSubsector8_8_SSE2);
TriFillSubsector8.push_back(TriFillSubsector8_9_SSE2);
TriFillSubsector8.push_back(TriFillSubsector8_10_SSE2);
TriFillSubsector8.push_back(TriFillSubsector8_11_SSE2);
TriFillSubsector8.push_back(TriFillSubsector8_12_SSE2);
TriFillSubsector8.push_back(TriFillSubsector8_13_SSE2);
TriFillSubsector8.push_back(TriFillSubsector8_14_SSE2);
TriFillSubsector32.push_back(TriFillSubsector32_0_SSE2);
TriFillSubsector32.push_back(TriFillSubsector32_1_SSE2);
TriFillSubsector32.push_back(TriFillSubsector32_2_SSE2);
TriFillSubsector32.push_back(TriFillSubsector32_3_SSE2);
TriFillSubsector32.push_back(TriFillSubsector32_4_SSE2);
TriFillSubsector32.push_back(TriFillSubsector32_5_SSE2);
TriFillSubsector32.push_back(TriFillSubsector32_6_SSE2);
TriFillSubsector32.push_back(TriFillSubsector32_7_SSE2);
TriFillSubsector32.push_back(TriFillSubsector32_8_SSE2);
TriFillSubsector32.push_back(TriFillSubsector32_9_SSE2);
TriFillSubsector32.push_back(TriFillSubsector32_10_SSE2);
TriFillSubsector32.push_back(TriFillSubsector32_11_SSE2);
TriFillSubsector32.push_back(TriFillSubsector32_12_SSE2);
TriFillSubsector32.push_back(TriFillSubsector32_13_SSE2);
TriFillSubsector32.push_back(TriFillSubsector32_14_SSE2);
TriStencil = TriStencil_SSE2;
TriStencilClose = TriStencilClose_SSE2;
} }
Drawers *Drawers::Instance() Drawers *Drawers::Instance()

View file

@ -354,16 +354,10 @@ public:
void(*DrawDoubleSky1)(const DrawSkyArgs *, const WorkerThreadData *) = nullptr; void(*DrawDoubleSky1)(const DrawSkyArgs *, const WorkerThreadData *) = nullptr;
void(*DrawDoubleSky4)(const DrawSkyArgs *, const WorkerThreadData *) = nullptr; void(*DrawDoubleSky4)(const DrawSkyArgs *, const WorkerThreadData *) = nullptr;
std::vector<void(*)(const TriDrawTriangleArgs *, WorkerThreadData *)> TriDrawNormal8; std::vector<void(*)(const TriDrawTriangleArgs *, WorkerThreadData *)> TriDraw8;
std::vector<void(*)(const TriDrawTriangleArgs *, WorkerThreadData *)> TriDrawNormal32; std::vector<void(*)(const TriDrawTriangleArgs *, WorkerThreadData *)> TriDraw32;
std::vector<void(*)(const TriDrawTriangleArgs *, WorkerThreadData *)> TriFillNormal8; std::vector<void(*)(const TriDrawTriangleArgs *, WorkerThreadData *)> TriFill8;
std::vector<void(*)(const TriDrawTriangleArgs *, WorkerThreadData *)> TriFillNormal32; std::vector<void(*)(const TriDrawTriangleArgs *, WorkerThreadData *)> TriFill32;
std::vector<void(*)(const TriDrawTriangleArgs *, WorkerThreadData *)> TriDrawSubsector8;
std::vector<void(*)(const TriDrawTriangleArgs *, WorkerThreadData *)> TriDrawSubsector32;
std::vector<void(*)(const TriDrawTriangleArgs *, WorkerThreadData *)> TriFillSubsector8;
std::vector<void(*)(const TriDrawTriangleArgs *, WorkerThreadData *)> TriFillSubsector32;
void(*TriStencil)(const TriDrawTriangleArgs *, WorkerThreadData *) = nullptr;
void(*TriStencilClose)(const TriDrawTriangleArgs *, WorkerThreadData *) = nullptr;
private: private:
Drawers(); Drawers();

View file

@ -88,19 +88,48 @@ void PolyTriangleDrawer::draw_arrays(const PolyDrawArgs &drawargs, TriDrawVarian
return; return;
auto llvm = Drawers::Instance(); auto llvm = Drawers::Instance();
PolyDrawFuncPtr setupfunc = nullptr;
PolyDrawFuncPtr drawfunc = nullptr; PolyDrawFuncPtr drawfuncs[3];
int num_drawfuncs = 0;
int bmode = (int)blendmode; int bmode = (int)blendmode;
switch (variant) switch (variant)
{ {
case TriDrawVariant::DrawNormal:
drawfuncs[num_drawfuncs++] = &ScreenTriangle::SetupNormal;
drawfuncs[num_drawfuncs++] = dest_bgra ? llvm->TriDraw32[bmode] : llvm->TriDraw8[bmode];
drawfuncs[num_drawfuncs++] = &ScreenTriangle::SubsectorWrite;
break;
case TriDrawVariant::FillNormal:
drawfuncs[num_drawfuncs++] = &ScreenTriangle::SetupNormal;
drawfuncs[num_drawfuncs++] = dest_bgra ? llvm->TriFill32[bmode] : llvm->TriFill8[bmode];
drawfuncs[num_drawfuncs++] = &ScreenTriangle::SubsectorWrite;
break;
case TriDrawVariant::DrawSubsector:
drawfuncs[num_drawfuncs++] = &ScreenTriangle::SetupSubsector;
drawfuncs[num_drawfuncs++] = dest_bgra ? llvm->TriDraw32[bmode] : llvm->TriDraw8[bmode];
break;
case TriDrawVariant::FillSubsector:
drawfuncs[num_drawfuncs++] = &ScreenTriangle::SetupSubsector;
drawfuncs[num_drawfuncs++] = dest_bgra ? llvm->TriFill32[bmode] : llvm->TriFill8[bmode];
break;
case TriDrawVariant::Stencil:
drawfuncs[num_drawfuncs++] = &ScreenTriangle::SetupNormal;
drawfuncs[num_drawfuncs++] = &ScreenTriangle::StencilWrite;
break;
case TriDrawVariant::StencilClose:
drawfuncs[num_drawfuncs++] = &ScreenTriangle::SetupNormal;
drawfuncs[num_drawfuncs++] = &ScreenTriangle::StencilWrite;
drawfuncs[num_drawfuncs++] = &ScreenTriangle::SubsectorWrite;
break;
default: default:
case TriDrawVariant::DrawNormal: setupfunc = &ScreenTriangle::SetupNormal; drawfunc = dest_bgra ? llvm->TriDrawNormal32[bmode] : llvm->TriDrawNormal8[bmode]; break; break;
case TriDrawVariant::FillNormal: setupfunc = &ScreenTriangle::SetupNormal; drawfunc = dest_bgra ? llvm->TriFillNormal32[bmode] : llvm->TriFillNormal8[bmode]; break;
case TriDrawVariant::DrawSubsector: setupfunc = &ScreenTriangle::SetupSubsector; drawfunc = dest_bgra ? llvm->TriDrawSubsector32[bmode] : llvm->TriDrawSubsector8[bmode]; break;
case TriDrawVariant::FuzzSubsector:
case TriDrawVariant::FillSubsector: setupfunc = &ScreenTriangle::SetupSubsector; drawfunc = dest_bgra ? llvm->TriFillSubsector32[bmode] : llvm->TriFillSubsector8[bmode]; break;
case TriDrawVariant::Stencil: drawfunc = &ScreenTriangle::StencilFunc; break;
case TriDrawVariant::StencilClose: drawfunc = &ScreenTriangle::StencilCloseFunc; break;
} }
TriDrawTriangleArgs args; TriDrawTriangleArgs args;
@ -136,7 +165,7 @@ void PolyTriangleDrawer::draw_arrays(const PolyDrawArgs &drawargs, TriDrawVarian
{ {
for (int j = 0; j < 3; j++) for (int j = 0; j < 3; j++)
vert[j] = shade_vertex(*drawargs.objectToClip, drawargs.clipPlane, *(vinput++)); vert[j] = shade_vertex(*drawargs.objectToClip, drawargs.clipPlane, *(vinput++));
draw_shaded_triangle(vert, ccw, &args, thread, setupfunc, drawfunc); draw_shaded_triangle(vert, ccw, &args, thread, drawfuncs, num_drawfuncs);
} }
} }
else if (drawargs.mode == TriangleDrawMode::Fan) else if (drawargs.mode == TriangleDrawMode::Fan)
@ -146,7 +175,7 @@ void PolyTriangleDrawer::draw_arrays(const PolyDrawArgs &drawargs, TriDrawVarian
for (int i = 2; i < vcount; i++) for (int i = 2; i < vcount; i++)
{ {
vert[2] = shade_vertex(*drawargs.objectToClip, drawargs.clipPlane, *(vinput++)); vert[2] = shade_vertex(*drawargs.objectToClip, drawargs.clipPlane, *(vinput++));
draw_shaded_triangle(vert, ccw, &args, thread, setupfunc, drawfunc); draw_shaded_triangle(vert, ccw, &args, thread, drawfuncs, num_drawfuncs);
vert[1] = vert[2]; vert[1] = vert[2];
} }
} }
@ -157,7 +186,7 @@ void PolyTriangleDrawer::draw_arrays(const PolyDrawArgs &drawargs, TriDrawVarian
for (int i = 2; i < vcount; i++) for (int i = 2; i < vcount; i++)
{ {
vert[2] = shade_vertex(*drawargs.objectToClip, drawargs.clipPlane, *(vinput++)); vert[2] = shade_vertex(*drawargs.objectToClip, drawargs.clipPlane, *(vinput++));
draw_shaded_triangle(vert, ccw, &args, thread, setupfunc, drawfunc); draw_shaded_triangle(vert, ccw, &args, thread, drawfuncs, num_drawfuncs);
vert[0] = vert[1]; vert[0] = vert[1];
vert[1] = vert[2]; vert[1] = vert[2];
ccw = !ccw; ccw = !ccw;
@ -176,7 +205,7 @@ ShadedTriVertex PolyTriangleDrawer::shade_vertex(const TriMatrix &objectToClip,
return sv; return sv;
} }
void PolyTriangleDrawer::draw_shaded_triangle(const ShadedTriVertex *vert, bool ccw, TriDrawTriangleArgs *args, WorkerThreadData *thread, PolyDrawFuncPtr setupfunc, PolyDrawFuncPtr drawfunc) void PolyTriangleDrawer::draw_shaded_triangle(const ShadedTriVertex *vert, bool ccw, TriDrawTriangleArgs *args, WorkerThreadData *thread, PolyDrawFuncPtr *drawfuncs, int num_drawfuncs)
{ {
// Cull, clip and generate additional vertices as needed // Cull, clip and generate additional vertices as needed
TriVertex clippedvert[max_additional_vertices]; TriVertex clippedvert[max_additional_vertices];
@ -220,8 +249,9 @@ void PolyTriangleDrawer::draw_shaded_triangle(const ShadedTriVertex *vert, bool
args->v1 = &clippedvert[numclipvert - 1]; args->v1 = &clippedvert[numclipvert - 1];
args->v2 = &clippedvert[i - 1]; args->v2 = &clippedvert[i - 1];
args->v3 = &clippedvert[i - 2]; args->v3 = &clippedvert[i - 2];
if (setupfunc) setupfunc(args, thread);
drawfunc(args, thread); for (int j = 0; j < num_drawfuncs; j++)
drawfuncs[j](args, thread);
} }
} }
else else
@ -231,8 +261,9 @@ void PolyTriangleDrawer::draw_shaded_triangle(const ShadedTriVertex *vert, bool
args->v1 = &clippedvert[0]; args->v1 = &clippedvert[0];
args->v2 = &clippedvert[i - 1]; args->v2 = &clippedvert[i - 1];
args->v3 = &clippedvert[i]; args->v3 = &clippedvert[i];
if (setupfunc) setupfunc(args, thread);
drawfunc(args, thread); for (int j = 0; j < num_drawfuncs; j++)
drawfuncs[j](args, thread);
} }
} }
} }
@ -1508,16 +1539,3 @@ void ScreenTriangle::Draw(const TriDrawTriangleArgs *args, WorkerThreadData *thr
} }
} }
#endif #endif
void ScreenTriangle::StencilFunc(const TriDrawTriangleArgs *args, WorkerThreadData *thread)
{
SetupNormal(args, thread);
StencilWrite(args, thread);
}
void ScreenTriangle::StencilCloseFunc(const TriDrawTriangleArgs *args, WorkerThreadData *thread)
{
SetupNormal(args, thread);
StencilWrite(args, thread);
SubsectorWrite(args, thread);
}

View file

@ -165,7 +165,7 @@ public:
private: private:
static ShadedTriVertex shade_vertex(const TriMatrix &objectToClip, const float *clipPlane, const TriVertex &v); static ShadedTriVertex shade_vertex(const TriMatrix &objectToClip, const float *clipPlane, const TriVertex &v);
static void draw_arrays(const PolyDrawArgs &args, TriDrawVariant variant, TriBlendMode blendmode, WorkerThreadData *thread); static void draw_arrays(const PolyDrawArgs &args, TriDrawVariant variant, TriBlendMode blendmode, WorkerThreadData *thread);
static void draw_shaded_triangle(const ShadedTriVertex *vertices, bool ccw, TriDrawTriangleArgs *args, WorkerThreadData *thread, PolyDrawFuncPtr setupfunc, PolyDrawFuncPtr drawfunc); static void draw_shaded_triangle(const ShadedTriVertex *vertices, bool ccw, TriDrawTriangleArgs *args, WorkerThreadData *thread, PolyDrawFuncPtr *drawfuncs, int num_drawfuncs);
static bool cullhalfspace(float clipdistance1, float clipdistance2, float &t1, float &t2); static bool cullhalfspace(float clipdistance1, float clipdistance2, float &t1, float &t2);
static void clipedge(const ShadedTriVertex *verts, TriVertex *clippedvert, int &numclipvert); static void clipedge(const ShadedTriVertex *verts, TriVertex *clippedvert, int &numclipvert);
@ -276,9 +276,6 @@ struct ScreenTriangleStepVariables
class ScreenTriangle class ScreenTriangle
{ {
public: public:
static void StencilFunc(const TriDrawTriangleArgs *args, WorkerThreadData *thread);
static void StencilCloseFunc(const TriDrawTriangleArgs *args, WorkerThreadData *thread);
static void SetupNormal(const TriDrawTriangleArgs *args, WorkerThreadData *thread); static void SetupNormal(const TriDrawTriangleArgs *args, WorkerThreadData *thread);
static void SetupSubsector(const TriDrawTriangleArgs *args, WorkerThreadData *thread); static void SetupSubsector(const TriDrawTriangleArgs *args, WorkerThreadData *thread);
static void StencilWrite(const TriDrawTriangleArgs *args, WorkerThreadData *thread); static void StencilWrite(const TriDrawTriangleArgs *args, WorkerThreadData *thread);

View file

@ -32,11 +32,11 @@
#include "ssa/ssa_struct_type.h" #include "ssa/ssa_struct_type.h"
#include "ssa/ssa_value.h" #include "ssa/ssa_value.h"
void DrawTriangleCodegen::Generate(TriDrawVariant variant, TriBlendMode blendmode, bool truecolor, SSAValue args, SSAValue thread_data) void DrawTriangleCodegen::Generate(TriBlendMode blendmode, bool truecolor, bool colorfill, SSAValue args, SSAValue thread_data)
{ {
this->variant = variant;
this->blendmode = blendmode; this->blendmode = blendmode;
this->truecolor = truecolor; this->truecolor = truecolor;
this->colorfill = colorfill;
pixelsize = truecolor ? 4 : 1; pixelsize = truecolor ? 4 : 1;
LoadArgs(args, thread_data); LoadArgs(args, thread_data);
@ -60,7 +60,6 @@ void DrawTriangleCodegen::DrawFullSpans()
SSAInt height = SSAInt(8); SSAInt height = SSAInt(8);
stack_dest.store(destOrg[(spanX + spanY * pitch) * pixelsize]); stack_dest.store(destOrg[(spanX + spanY * pitch) * pixelsize]);
stack_subsector.store(subsectorGBuffer[spanX + spanY * pitch]);
stack_posYW.store(start.W + gradientX.W * (spanX - startX) + gradientY.W * (spanY - startY)); stack_posYW.store(start.W + gradientX.W * (spanX - startX) + gradientY.W * (spanY - startY));
for (int j = 0; j < TriVertex::NumVarying; j++) for (int j = 0; j < TriVertex::NumVarying; j++)
stack_posYVarying[j].store(start.Varying[j] + gradientX.Varying[j] * (spanX - startX) + gradientY.Varying[j] * (spanY - startY)); stack_posYVarying[j].store(start.Varying[j] + gradientX.Varying[j] * (spanX - startX) + gradientY.Varying[j] * (spanY - startY));
@ -69,7 +68,6 @@ void DrawTriangleCodegen::DrawFullSpans()
SSAForBlock loop_y; SSAForBlock loop_y;
SSAInt y = stack_y.load(); SSAInt y = stack_y.load();
SSAUBytePtr dest = stack_dest.load(); SSAUBytePtr dest = stack_dest.load();
SSAIntPtr subsector = stack_subsector.load();
SSAStepVariables blockPosY; SSAStepVariables blockPosY;
blockPosY.W = stack_posYW.load(); blockPosY.W = stack_posYW.load();
for (int j = 0; j < TriVertex::NumVarying; j++) for (int j = 0; j < TriVertex::NumVarying; j++)
@ -121,9 +119,6 @@ void DrawTriangleCodegen::DrawFullSpans()
SSAUBytePtr destptr = dest[(x * 8 + ix) * 4]; SSAUBytePtr destptr = dest[(x * 8 + ix) * 4];
destptr.store_vec4ub(ProcessPixel32(destptr.load_vec4ub(false), varyingPos)); destptr.store_vec4ub(ProcessPixel32(destptr.load_vec4ub(false), varyingPos));
if (variant != TriDrawVariant::DrawSubsector && variant != TriDrawVariant::FillSubsector && variant != TriDrawVariant::FuzzSubsector)
subsector[x * 8 + ix].store(subsectorDepth);
} }
else else
{ {
@ -133,9 +128,6 @@ void DrawTriangleCodegen::DrawFullSpans()
SSAUBytePtr destptr = dest[(x * 8 + ix)]; SSAUBytePtr destptr = dest[(x * 8 + ix)];
destptr.store(ProcessPixel8(destptr.load(false).zext_int(), varyingPos).trunc_ubyte()); destptr.store(ProcessPixel8(destptr.load(false).zext_int(), varyingPos).trunc_ubyte());
if (variant != TriDrawVariant::DrawSubsector && variant != TriDrawVariant::FillSubsector && variant != TriDrawVariant::FuzzSubsector)
subsector[x * 8 + ix].store(subsectorDepth);
} }
for (int j = 0; j < TriVertex::NumVarying; j++) for (int j = 0; j < TriVertex::NumVarying; j++)
@ -157,7 +149,6 @@ void DrawTriangleCodegen::DrawFullSpans()
for (int j = 0; j < TriVertex::NumVarying; j++) for (int j = 0; j < TriVertex::NumVarying; j++)
stack_posYVarying[j].store(blockPosY.Varying[j] + gradientY.Varying[j]); stack_posYVarying[j].store(blockPosY.Varying[j] + gradientY.Varying[j]);
stack_dest.store(dest[pitch * pixelsize]); stack_dest.store(dest[pitch * pixelsize]);
stack_subsector.store(subsector[pitch]);
stack_y.store(y + 1); stack_y.store(y + 1);
} }
loop_y.end_block(); loop_y.end_block();
@ -180,7 +171,6 @@ void DrawTriangleCodegen::DrawPartialBlocks()
SSAInt mask1 = partialBlocks[i][3].load(true); SSAInt mask1 = partialBlocks[i][3].load(true);
SSAUBytePtr dest = destOrg[(blockX + blockY * pitch) * pixelsize]; SSAUBytePtr dest = destOrg[(blockX + blockY * pitch) * pixelsize];
SSAIntPtr subsector = subsectorGBuffer[blockX + blockY * pitch];
SSAStepVariables blockPosY; SSAStepVariables blockPosY;
blockPosY.W = start.W + gradientX.W * (blockX - startX) + gradientY.W * (blockY - startY); blockPosY.W = start.W + gradientX.W * (blockX - startX) + gradientY.W * (blockY - startY);
@ -229,9 +219,6 @@ void DrawTriangleCodegen::DrawPartialBlocks()
SSAUBytePtr destptr = dest[x * 4]; SSAUBytePtr destptr = dest[x * 4];
destptr.store_vec4ub(ProcessPixel32(destptr.load_vec4ub(false), varyingPos)); destptr.store_vec4ub(ProcessPixel32(destptr.load_vec4ub(false), varyingPos));
if (variant != TriDrawVariant::DrawSubsector && variant != TriDrawVariant::FillSubsector && variant != TriDrawVariant::FuzzSubsector)
subsector[x].store(subsectorDepth);
} }
else else
{ {
@ -241,9 +228,6 @@ void DrawTriangleCodegen::DrawPartialBlocks()
SSAUBytePtr destptr = dest[x]; SSAUBytePtr destptr = dest[x];
destptr.store(ProcessPixel8(destptr.load(false).zext_int(), varyingPos).trunc_ubyte()); destptr.store(ProcessPixel8(destptr.load(false).zext_int(), varyingPos).trunc_ubyte());
if (variant != TriDrawVariant::DrawSubsector && variant != TriDrawVariant::FillSubsector && variant != TriDrawVariant::FuzzSubsector)
subsector[x].store(subsectorDepth);
} }
} }
branch.end_block(); branch.end_block();
@ -258,7 +242,6 @@ void DrawTriangleCodegen::DrawPartialBlocks()
blockPosY.Varying[j] = blockPosY.Varying[j] + gradientY.Varying[j]; blockPosY.Varying[j] = blockPosY.Varying[j] + gradientY.Varying[j];
dest = dest[pitch * pixelsize]; dest = dest[pitch * pixelsize];
subsector = subsector[pitch];
} }
} }
@ -276,7 +259,7 @@ SSAVec4i DrawTriangleCodegen::TranslateSample32(SSAInt *varying)
SSAInt vpos = ((vfrac >> 16) * textureHeight) >> 16; SSAInt vpos = ((vfrac >> 16) * textureHeight) >> 16;
SSAInt uvoffset = upos * textureHeight + vpos; SSAInt uvoffset = upos * textureHeight + vpos;
if (variant == TriDrawVariant::FillNormal || variant == TriDrawVariant::FillSubsector || variant == TriDrawVariant::FuzzSubsector) if (colorfill)
return translation[color * 4].load_vec4ub(true); return translation[color * 4].load_vec4ub(true);
else else
return translation[texturePixels[uvoffset].load(true).zext_int() * 4].load_vec4ub(true); return translation[texturePixels[uvoffset].load(true).zext_int() * 4].load_vec4ub(true);
@ -291,7 +274,7 @@ SSAInt DrawTriangleCodegen::TranslateSample8(SSAInt *varying)
SSAInt vpos = ((vfrac >> 16) * textureHeight) >> 16; SSAInt vpos = ((vfrac >> 16) * textureHeight) >> 16;
SSAInt uvoffset = upos * textureHeight + vpos; SSAInt uvoffset = upos * textureHeight + vpos;
if (variant == TriDrawVariant::FillNormal || variant == TriDrawVariant::FillSubsector || variant == TriDrawVariant::FuzzSubsector) if (colorfill)
return translation[color].load(true).zext_int(); return translation[color].load(true).zext_int();
else else
return translation[texturePixels[uvoffset].load(true).zext_int()].load(true).zext_int(); return translation[texturePixels[uvoffset].load(true).zext_int()].load(true).zext_int();
@ -299,7 +282,7 @@ SSAInt DrawTriangleCodegen::TranslateSample8(SSAInt *varying)
SSAVec4i DrawTriangleCodegen::Sample32(SSAInt *varying) SSAVec4i DrawTriangleCodegen::Sample32(SSAInt *varying)
{ {
if (variant == TriDrawVariant::FillNormal || variant == TriDrawVariant::FillSubsector || variant == TriDrawVariant::FuzzSubsector) if (colorfill)
return SSAVec4i::unpack(color); return SSAVec4i::unpack(color);
SSAInt ufrac = varying[0] << 8; SSAInt ufrac = varying[0] << 8;
@ -362,7 +345,7 @@ SSAInt DrawTriangleCodegen::Sample8(SSAInt *varying)
SSAInt vpos = ((vfrac >> 16) * textureHeight) >> 16; SSAInt vpos = ((vfrac >> 16) * textureHeight) >> 16;
SSAInt uvoffset = upos * textureHeight + vpos; SSAInt uvoffset = upos * textureHeight + vpos;
if (variant == TriDrawVariant::FillNormal || variant == TriDrawVariant::FillSubsector || variant == TriDrawVariant::FuzzSubsector) if (colorfill)
return color; return color;
else else
return texturePixels[uvoffset].load(true).zext_int(); return texturePixels[uvoffset].load(true).zext_int();
@ -593,7 +576,6 @@ void DrawTriangleCodegen::LoadArgs(SSAValue args, SSAValue thread_data)
textureHeight = args[0][11].load(true); textureHeight = args[0][11].load(true);
translation = args[0][12].load(true); translation = args[0][12].load(true);
LoadUniforms(args[0][13].load(true)); LoadUniforms(args[0][13].load(true));
subsectorGBuffer = args[0][19].load(true);
if (!truecolor) if (!truecolor)
{ {
Colormaps = args[0][20].load(true); Colormaps = args[0][20].load(true);
@ -624,7 +606,6 @@ SSATriVertex DrawTriangleCodegen::LoadTriVertex(SSAValue ptr)
void DrawTriangleCodegen::LoadUniforms(SSAValue uniforms) void DrawTriangleCodegen::LoadUniforms(SSAValue uniforms)
{ {
light = uniforms[0][0].load(true); light = uniforms[0][0].load(true);
subsectorDepth = uniforms[0][1].load(true);
color = uniforms[0][2].load(true); color = uniforms[0][2].load(true);
srcalpha = uniforms[0][3].load(true); srcalpha = uniforms[0][3].load(true);
destalpha = uniforms[0][4].load(true); destalpha = uniforms[0][4].load(true);

View file

@ -39,7 +39,7 @@ struct SSAStepVariables
class DrawTriangleCodegen : public DrawerCodegen class DrawTriangleCodegen : public DrawerCodegen
{ {
public: public:
void Generate(TriDrawVariant variant, TriBlendMode blendmode, bool truecolor, SSAValue args, SSAValue thread_data); void Generate(TriBlendMode blendmode, bool truecolor, bool colorfill, SSAValue args, SSAValue thread_data);
private: private:
void LoadArgs(SSAValue args, SSAValue thread_data); void LoadArgs(SSAValue args, SSAValue thread_data);
@ -69,7 +69,6 @@ private:
SSAStack<SSAInt> stack_varyingPos[TriVertex::NumVarying]; SSAStack<SSAInt> stack_varyingPos[TriVertex::NumVarying];
SSAStack<SSAInt> stack_lightpos; SSAStack<SSAInt> stack_lightpos;
SSAStack<SSAUBytePtr> stack_dest; SSAStack<SSAUBytePtr> stack_dest;
SSAStack<SSAIntPtr> stack_subsector;
SSAStepVariables gradientX, gradientY, start; SSAStepVariables gradientX, gradientY, start;
SSAFloat shade, globVis; SSAFloat shade, globVis;
@ -78,7 +77,6 @@ private:
SSAUBytePtr currentcolormap; SSAUBytePtr currentcolormap;
SSAUBytePtr destOrg; SSAUBytePtr destOrg;
SSAIntPtr subsectorGBuffer;
SSAInt pitch; SSAInt pitch;
SSATriVertex v1; SSATriVertex v1;
SSATriVertex v2; SSATriVertex v2;
@ -90,7 +88,6 @@ private:
SSAInt color, srcalpha, destalpha; SSAInt color, srcalpha, destalpha;
SSAInt light; SSAInt light;
SSAInt subsectorDepth;
SSAShadeConstants shade_constants; SSAShadeConstants shade_constants;
SSABool is_simple_shade; SSABool is_simple_shade;
SSABool is_nearest_filter; SSABool is_nearest_filter;
@ -107,9 +104,9 @@ private:
SSAValue fullSpans; // TriFullSpan[] SSAValue fullSpans; // TriFullSpan[]
SSAValue partialBlocks; // TriPartialBlock[] SSAValue partialBlocks; // TriPartialBlock[]
TriDrawVariant variant;
TriBlendMode blendmode; TriBlendMode blendmode;
bool truecolor; bool truecolor;
bool colorfill;
int pixelsize; int pixelsize;
}; };
@ -160,10 +157,8 @@ private:
SSAStack<SSAInt> stack_C1, stack_C2, stack_C3; SSAStack<SSAInt> stack_C1, stack_C2, stack_C3;
SSAStack<SSAInt> stack_y; SSAStack<SSAInt> stack_y;
SSAStack<SSAUBytePtr> stack_dest; SSAStack<SSAUBytePtr> stack_dest;
SSAStack<SSAIntPtr> stack_subsectorGBuffer;
SSAStack<SSAInt> stack_x; SSAStack<SSAInt> stack_x;
SSAStack<SSAUBytePtr> stack_buffer; SSAStack<SSAUBytePtr> stack_buffer;
SSAStack<SSAIntPtr> stack_subsectorbuffer;
SSAStack<SSAInt> stack_iy, stack_ix; SSAStack<SSAInt> stack_iy, stack_ix;
SSAStack<SSAInt> stack_CY1, stack_CY2, stack_CY3; SSAStack<SSAInt> stack_CY1, stack_CY2, stack_CY3;
SSAStack<SSAInt> stack_CX1, stack_CX2, stack_CX3; SSAStack<SSAInt> stack_CX1, stack_CX2, stack_CX3;
@ -189,7 +184,6 @@ private:
SSAInt color, srcalpha, destalpha; SSAInt color, srcalpha, destalpha;
SSAInt light; SSAInt light;
SSAInt subsectorDepth;
SSAShadeConstants shade_constants; SSAShadeConstants shade_constants;
SSABool is_simple_shade; SSABool is_simple_shade;
SSABool is_nearest_filter; SSABool is_nearest_filter;
@ -200,7 +194,6 @@ private:
SSAInt stencilPitch; SSAInt stencilPitch;
SSAUByte stencilTestValue; SSAUByte stencilTestValue;
SSAUByte stencilWriteValue; SSAUByte stencilWriteValue;
SSAIntPtr subsectorGBuffer;
SSAUBytePtr Colormaps; SSAUBytePtr Colormaps;
SSAUBytePtr RGB32k; SSAUBytePtr RGB32k;

View file

@ -93,17 +93,11 @@ LLVMDrawers::LLVMDrawers(const std::string &triple, const std::string &cpuName,
CodegenDrawSky("DrawDoubleSky4", DrawSkyVariant::Double, 4); CodegenDrawSky("DrawDoubleSky4", DrawSkyVariant::Double, 4);
for (int i = 0; i < NumTriBlendModes(); i++) for (int i = 0; i < NumTriBlendModes(); i++)
{ {
CodegenDrawTriangle("TriDrawNormal8_" + std::to_string(i), TriDrawVariant::DrawNormal, (TriBlendMode)i, false); CodegenDrawTriangle("TriDraw8_" + std::to_string(i), (TriBlendMode)i, false, false);
CodegenDrawTriangle("TriDrawNormal32_" + std::to_string(i), TriDrawVariant::DrawNormal, (TriBlendMode)i, true); CodegenDrawTriangle("TriDraw32_" + std::to_string(i), (TriBlendMode)i, true, false);
CodegenDrawTriangle("TriFillNormal8_" + std::to_string(i), TriDrawVariant::FillNormal, (TriBlendMode)i, false); CodegenDrawTriangle("TriFill8_" + std::to_string(i), (TriBlendMode)i, false, true);
CodegenDrawTriangle("TriFillNormal32_" + std::to_string(i), TriDrawVariant::FillNormal, (TriBlendMode)i, true); CodegenDrawTriangle("TriFill32_" + std::to_string(i), (TriBlendMode)i, true, true);
CodegenDrawTriangle("TriDrawSubsector8_" + std::to_string(i), TriDrawVariant::DrawSubsector, (TriBlendMode)i, false);
CodegenDrawTriangle("TriDrawSubsector32_" + std::to_string(i), TriDrawVariant::DrawSubsector, (TriBlendMode)i, true);
CodegenDrawTriangle("TriFillSubsector8_" + std::to_string(i), TriDrawVariant::FillSubsector, (TriBlendMode)i, false);
CodegenDrawTriangle("TriFillSubsector32_" + std::to_string(i), TriDrawVariant::FillSubsector, (TriBlendMode)i, true);
} }
CodegenDrawTriangle("TriStencil", TriDrawVariant::Stencil, TriBlendMode::Copy, false);
CodegenDrawTriangle("TriStencilClose", TriDrawVariant::StencilClose, TriBlendMode::Copy, false);
ObjectFile = mProgram.GenerateObjectFile(triple, cpuName, features); ObjectFile = mProgram.GenerateObjectFile(triple, cpuName, features);
} }
@ -183,7 +177,7 @@ void LLVMDrawers::CodegenDrawSky(const char *name, DrawSkyVariant variant, int c
throw Exception("verifyFunction failed for CodegenDrawSky()"); throw Exception("verifyFunction failed for CodegenDrawSky()");
} }
void LLVMDrawers::CodegenDrawTriangle(const std::string &name, TriDrawVariant variant, TriBlendMode blendmode, bool truecolor) void LLVMDrawers::CodegenDrawTriangle(const std::string &name, TriBlendMode blendmode, bool truecolor, bool colorfill)
{ {
llvm::IRBuilder<> builder(mProgram.context()); llvm::IRBuilder<> builder(mProgram.context());
SSAScope ssa_scope(&mProgram.context(), mProgram.module(), &builder); SSAScope ssa_scope(&mProgram.context(), mProgram.module(), &builder);
@ -194,12 +188,12 @@ void LLVMDrawers::CodegenDrawTriangle(const std::string &name, TriDrawVariant va
function.create_public(); function.create_public();
DrawTriangleCodegen codegen; DrawTriangleCodegen codegen;
codegen.Generate(variant, blendmode, truecolor, function.parameter(0), function.parameter(1)); codegen.Generate(blendmode, truecolor, colorfill, function.parameter(0), function.parameter(1));
builder.CreateRetVoid(); builder.CreateRetVoid();
if (llvm::verifyFunction(*function.func)) if (llvm::verifyFunction(*function.func))
throw Exception(std::string("verifyFunction failed for CodegenDrawTriangle(") + std::to_string((int)variant) + ", " + std::to_string((int)blendmode) + ", " + std::to_string((int)truecolor) + ")"); throw Exception("verifyFunction failed for CodegenDrawTriangle()");
} }
llvm::Type *LLVMDrawers::GetDrawColumnArgsStruct(llvm::LLVMContext &context) llvm::Type *LLVMDrawers::GetDrawColumnArgsStruct(llvm::LLVMContext &context)

View file

@ -51,7 +51,7 @@ private:
void CodegenDrawSpan(const char *name, DrawSpanVariant variant); void CodegenDrawSpan(const char *name, DrawSpanVariant variant);
void CodegenDrawWall(const char *name, DrawWallVariant variant, int columns); void CodegenDrawWall(const char *name, DrawWallVariant variant, int columns);
void CodegenDrawSky(const char *name, DrawSkyVariant variant, int columns); void CodegenDrawSky(const char *name, DrawSkyVariant variant, int columns);
void CodegenDrawTriangle(const std::string &name, TriDrawVariant variant, TriBlendMode blendmode, bool truecolor); void CodegenDrawTriangle(const std::string &name, TriBlendMode blendmode, bool truecolor, bool colorfill);
llvm::Type *GetDrawColumnArgsStruct(llvm::LLVMContext &context); llvm::Type *GetDrawColumnArgsStruct(llvm::LLVMContext &context);
llvm::Type *GetDrawSpanArgsStruct(llvm::LLVMContext &context); llvm::Type *GetDrawSpanArgsStruct(llvm::LLVMContext &context);