diff --git a/src/r_drawers.cpp b/src/r_drawers.cpp index acbe71de45..dd81af1096 100644 --- a/src/r_drawers.cpp +++ b/src/r_drawers.cpp @@ -93,128 +93,66 @@ extern "C" void DrawSky4_SSE2(const DrawSkyArgs *, const WorkerThreadData *); void DrawDoubleSky1_SSE2(const DrawSkyArgs *, const WorkerThreadData *); void DrawDoubleSky4_SSE2(const DrawSkyArgs *, const WorkerThreadData *); - void TriDrawNormal8_0_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal8_1_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal8_2_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal8_3_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal8_4_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal8_5_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal8_6_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal8_7_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal8_8_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal8_9_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal8_10_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal8_11_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal8_12_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal8_13_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal8_14_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal32_0_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal32_1_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal32_2_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal32_3_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal32_4_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal32_5_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal32_6_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal32_7_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal32_8_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal32_9_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal32_10_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal32_11_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal32_12_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal32_13_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriDrawNormal32_14_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal8_0_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal8_1_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal8_2_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal8_3_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal8_4_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal8_5_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal8_6_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal8_7_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal8_8_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal8_9_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal8_10_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal8_11_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal8_12_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal8_13_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal8_14_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal32_0_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal32_1_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal32_2_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal32_3_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal32_4_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal32_5_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal32_6_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal32_7_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal32_8_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal32_9_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal32_10_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal32_11_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal32_12_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal32_13_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); - void TriFillNormal32_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 *); + void TriDraw8_0_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw8_1_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw8_2_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw8_3_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw8_4_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw8_5_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw8_6_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw8_7_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw8_8_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw8_9_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw8_10_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw8_11_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw8_12_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw8_13_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw8_14_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw32_0_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw32_1_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw32_2_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw32_3_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw32_4_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw32_5_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw32_6_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw32_7_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw32_8_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw32_9_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw32_10_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw32_11_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw32_12_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw32_13_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriDraw32_14_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill8_0_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill8_1_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill8_2_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill8_3_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill8_4_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill8_5_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill8_6_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill8_7_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill8_8_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill8_9_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill8_10_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill8_11_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill8_12_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill8_13_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill8_14_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill32_0_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill32_1_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill32_2_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill32_3_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill32_4_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill32_5_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill32_6_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill32_7_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill32_8_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill32_9_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill32_10_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill32_11_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill32_12_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill32_13_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); + void TriFill32_14_SSE2(const TriDrawTriangleArgs *, WorkerThreadData *); } ///////////////////////////////////////////////////////////////////////////// @@ -283,128 +221,66 @@ Drawers::Drawers() DrawSky4 = DrawSky4_SSE2; DrawDoubleSky1 = DrawDoubleSky1_SSE2; DrawDoubleSky4 = DrawDoubleSky4_SSE2; - TriDrawNormal8.push_back(TriDrawNormal8_0_SSE2); - TriDrawNormal8.push_back(TriDrawNormal8_1_SSE2); - TriDrawNormal8.push_back(TriDrawNormal8_2_SSE2); - TriDrawNormal8.push_back(TriDrawNormal8_3_SSE2); - TriDrawNormal8.push_back(TriDrawNormal8_4_SSE2); - TriDrawNormal8.push_back(TriDrawNormal8_5_SSE2); - TriDrawNormal8.push_back(TriDrawNormal8_6_SSE2); - TriDrawNormal8.push_back(TriDrawNormal8_7_SSE2); - TriDrawNormal8.push_back(TriDrawNormal8_8_SSE2); - TriDrawNormal8.push_back(TriDrawNormal8_9_SSE2); - TriDrawNormal8.push_back(TriDrawNormal8_10_SSE2); - TriDrawNormal8.push_back(TriDrawNormal8_11_SSE2); - TriDrawNormal8.push_back(TriDrawNormal8_12_SSE2); - TriDrawNormal8.push_back(TriDrawNormal8_13_SSE2); - TriDrawNormal8.push_back(TriDrawNormal8_14_SSE2); - TriDrawNormal32.push_back(TriDrawNormal32_0_SSE2); - TriDrawNormal32.push_back(TriDrawNormal32_1_SSE2); - TriDrawNormal32.push_back(TriDrawNormal32_2_SSE2); - TriDrawNormal32.push_back(TriDrawNormal32_3_SSE2); - TriDrawNormal32.push_back(TriDrawNormal32_4_SSE2); - TriDrawNormal32.push_back(TriDrawNormal32_5_SSE2); - TriDrawNormal32.push_back(TriDrawNormal32_6_SSE2); - TriDrawNormal32.push_back(TriDrawNormal32_7_SSE2); - TriDrawNormal32.push_back(TriDrawNormal32_8_SSE2); - TriDrawNormal32.push_back(TriDrawNormal32_9_SSE2); - TriDrawNormal32.push_back(TriDrawNormal32_10_SSE2); - TriDrawNormal32.push_back(TriDrawNormal32_11_SSE2); - TriDrawNormal32.push_back(TriDrawNormal32_12_SSE2); - TriDrawNormal32.push_back(TriDrawNormal32_13_SSE2); - TriDrawNormal32.push_back(TriDrawNormal32_14_SSE2); - TriFillNormal8.push_back(TriFillNormal8_0_SSE2); - TriFillNormal8.push_back(TriFillNormal8_1_SSE2); - TriFillNormal8.push_back(TriFillNormal8_2_SSE2); - TriFillNormal8.push_back(TriFillNormal8_3_SSE2); - TriFillNormal8.push_back(TriFillNormal8_4_SSE2); - TriFillNormal8.push_back(TriFillNormal8_5_SSE2); - TriFillNormal8.push_back(TriFillNormal8_6_SSE2); - TriFillNormal8.push_back(TriFillNormal8_7_SSE2); - TriFillNormal8.push_back(TriFillNormal8_8_SSE2); - TriFillNormal8.push_back(TriFillNormal8_9_SSE2); - TriFillNormal8.push_back(TriFillNormal8_10_SSE2); - TriFillNormal8.push_back(TriFillNormal8_11_SSE2); - TriFillNormal8.push_back(TriFillNormal8_12_SSE2); - TriFillNormal8.push_back(TriFillNormal8_13_SSE2); - TriFillNormal8.push_back(TriFillNormal8_14_SSE2); - TriFillNormal32.push_back(TriFillNormal32_0_SSE2); - TriFillNormal32.push_back(TriFillNormal32_1_SSE2); - TriFillNormal32.push_back(TriFillNormal32_2_SSE2); - TriFillNormal32.push_back(TriFillNormal32_3_SSE2); - TriFillNormal32.push_back(TriFillNormal32_4_SSE2); - TriFillNormal32.push_back(TriFillNormal32_5_SSE2); - TriFillNormal32.push_back(TriFillNormal32_6_SSE2); - TriFillNormal32.push_back(TriFillNormal32_7_SSE2); - TriFillNormal32.push_back(TriFillNormal32_8_SSE2); - TriFillNormal32.push_back(TriFillNormal32_9_SSE2); - TriFillNormal32.push_back(TriFillNormal32_10_SSE2); - TriFillNormal32.push_back(TriFillNormal32_11_SSE2); - TriFillNormal32.push_back(TriFillNormal32_12_SSE2); - TriFillNormal32.push_back(TriFillNormal32_13_SSE2); - TriFillNormal32.push_back(TriFillNormal32_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; + TriDraw8.push_back(TriDraw8_0_SSE2); + TriDraw8.push_back(TriDraw8_1_SSE2); + TriDraw8.push_back(TriDraw8_2_SSE2); + TriDraw8.push_back(TriDraw8_3_SSE2); + TriDraw8.push_back(TriDraw8_4_SSE2); + TriDraw8.push_back(TriDraw8_5_SSE2); + TriDraw8.push_back(TriDraw8_6_SSE2); + TriDraw8.push_back(TriDraw8_7_SSE2); + TriDraw8.push_back(TriDraw8_8_SSE2); + TriDraw8.push_back(TriDraw8_9_SSE2); + TriDraw8.push_back(TriDraw8_10_SSE2); + TriDraw8.push_back(TriDraw8_11_SSE2); + TriDraw8.push_back(TriDraw8_12_SSE2); + TriDraw8.push_back(TriDraw8_13_SSE2); + TriDraw8.push_back(TriDraw8_14_SSE2); + TriDraw32.push_back(TriDraw32_0_SSE2); + TriDraw32.push_back(TriDraw32_1_SSE2); + TriDraw32.push_back(TriDraw32_2_SSE2); + TriDraw32.push_back(TriDraw32_3_SSE2); + TriDraw32.push_back(TriDraw32_4_SSE2); + TriDraw32.push_back(TriDraw32_5_SSE2); + TriDraw32.push_back(TriDraw32_6_SSE2); + TriDraw32.push_back(TriDraw32_7_SSE2); + TriDraw32.push_back(TriDraw32_8_SSE2); + TriDraw32.push_back(TriDraw32_9_SSE2); + TriDraw32.push_back(TriDraw32_10_SSE2); + TriDraw32.push_back(TriDraw32_11_SSE2); + TriDraw32.push_back(TriDraw32_12_SSE2); + TriDraw32.push_back(TriDraw32_13_SSE2); + TriDraw32.push_back(TriDraw32_14_SSE2); + TriFill8.push_back(TriFill8_0_SSE2); + TriFill8.push_back(TriFill8_1_SSE2); + TriFill8.push_back(TriFill8_2_SSE2); + TriFill8.push_back(TriFill8_3_SSE2); + TriFill8.push_back(TriFill8_4_SSE2); + TriFill8.push_back(TriFill8_5_SSE2); + TriFill8.push_back(TriFill8_6_SSE2); + TriFill8.push_back(TriFill8_7_SSE2); + TriFill8.push_back(TriFill8_8_SSE2); + TriFill8.push_back(TriFill8_9_SSE2); + TriFill8.push_back(TriFill8_10_SSE2); + TriFill8.push_back(TriFill8_11_SSE2); + TriFill8.push_back(TriFill8_12_SSE2); + TriFill8.push_back(TriFill8_13_SSE2); + TriFill8.push_back(TriFill8_14_SSE2); + TriFill32.push_back(TriFill32_0_SSE2); + TriFill32.push_back(TriFill32_1_SSE2); + TriFill32.push_back(TriFill32_2_SSE2); + TriFill32.push_back(TriFill32_3_SSE2); + TriFill32.push_back(TriFill32_4_SSE2); + TriFill32.push_back(TriFill32_5_SSE2); + TriFill32.push_back(TriFill32_6_SSE2); + TriFill32.push_back(TriFill32_7_SSE2); + TriFill32.push_back(TriFill32_8_SSE2); + TriFill32.push_back(TriFill32_9_SSE2); + TriFill32.push_back(TriFill32_10_SSE2); + TriFill32.push_back(TriFill32_11_SSE2); + TriFill32.push_back(TriFill32_12_SSE2); + TriFill32.push_back(TriFill32_13_SSE2); + TriFill32.push_back(TriFill32_14_SSE2); } Drawers *Drawers::Instance() diff --git a/src/r_drawers.h b/src/r_drawers.h index bc776be5bc..5437966093 100644 --- a/src/r_drawers.h +++ b/src/r_drawers.h @@ -354,16 +354,10 @@ public: void(*DrawDoubleSky1)(const DrawSkyArgs *, const WorkerThreadData *) = nullptr; void(*DrawDoubleSky4)(const DrawSkyArgs *, const WorkerThreadData *) = nullptr; - std::vector TriDrawNormal8; - std::vector TriDrawNormal32; - std::vector TriFillNormal8; - std::vector TriFillNormal32; - std::vector TriDrawSubsector8; - std::vector TriDrawSubsector32; - std::vector TriFillSubsector8; - std::vector TriFillSubsector32; - void(*TriStencil)(const TriDrawTriangleArgs *, WorkerThreadData *) = nullptr; - void(*TriStencilClose)(const TriDrawTriangleArgs *, WorkerThreadData *) = nullptr; + std::vector TriDraw8; + std::vector TriDraw32; + std::vector TriFill8; + std::vector TriFill32; private: Drawers(); diff --git a/src/r_poly_triangle.cpp b/src/r_poly_triangle.cpp index 164fc98e2c..90f78b639e 100644 --- a/src/r_poly_triangle.cpp +++ b/src/r_poly_triangle.cpp @@ -88,19 +88,48 @@ void PolyTriangleDrawer::draw_arrays(const PolyDrawArgs &drawargs, TriDrawVarian return; auto llvm = Drawers::Instance(); - PolyDrawFuncPtr setupfunc = nullptr; - PolyDrawFuncPtr drawfunc = nullptr; + + PolyDrawFuncPtr drawfuncs[3]; + int num_drawfuncs = 0; + int bmode = (int)blendmode; 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: - case TriDrawVariant::DrawNormal: setupfunc = &ScreenTriangle::SetupNormal; drawfunc = dest_bgra ? llvm->TriDrawNormal32[bmode] : llvm->TriDrawNormal8[bmode]; 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; + break; } TriDrawTriangleArgs args; @@ -136,7 +165,7 @@ void PolyTriangleDrawer::draw_arrays(const PolyDrawArgs &drawargs, TriDrawVarian { for (int j = 0; j < 3; j++) 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) @@ -146,7 +175,7 @@ void PolyTriangleDrawer::draw_arrays(const PolyDrawArgs &drawargs, TriDrawVarian for (int i = 2; i < vcount; i++) { 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]; } } @@ -157,7 +186,7 @@ void PolyTriangleDrawer::draw_arrays(const PolyDrawArgs &drawargs, TriDrawVarian for (int i = 2; i < vcount; i++) { 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[1] = vert[2]; ccw = !ccw; @@ -176,7 +205,7 @@ ShadedTriVertex PolyTriangleDrawer::shade_vertex(const TriMatrix &objectToClip, 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 TriVertex clippedvert[max_additional_vertices]; @@ -220,8 +249,9 @@ void PolyTriangleDrawer::draw_shaded_triangle(const ShadedTriVertex *vert, bool args->v1 = &clippedvert[numclipvert - 1]; args->v2 = &clippedvert[i - 1]; 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 @@ -231,8 +261,9 @@ void PolyTriangleDrawer::draw_shaded_triangle(const ShadedTriVertex *vert, bool args->v1 = &clippedvert[0]; args->v2 = &clippedvert[i - 1]; 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 - -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); -} diff --git a/src/r_poly_triangle.h b/src/r_poly_triangle.h index 59e52ef66d..4fc302eaba 100644 --- a/src/r_poly_triangle.h +++ b/src/r_poly_triangle.h @@ -165,7 +165,7 @@ public: private: 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_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 void clipedge(const ShadedTriVertex *verts, TriVertex *clippedvert, int &numclipvert); @@ -276,9 +276,6 @@ struct ScreenTriangleStepVariables class ScreenTriangle { 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 SetupSubsector(const TriDrawTriangleArgs *args, WorkerThreadData *thread); static void StencilWrite(const TriDrawTriangleArgs *args, WorkerThreadData *thread); diff --git a/tools/drawergen/fixedfunction/drawtrianglecodegen.cpp b/tools/drawergen/fixedfunction/drawtrianglecodegen.cpp index f1cd25c359..38e9922c0a 100644 --- a/tools/drawergen/fixedfunction/drawtrianglecodegen.cpp +++ b/tools/drawergen/fixedfunction/drawtrianglecodegen.cpp @@ -32,11 +32,11 @@ #include "ssa/ssa_struct_type.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->truecolor = truecolor; + this->colorfill = colorfill; pixelsize = truecolor ? 4 : 1; LoadArgs(args, thread_data); @@ -60,7 +60,6 @@ void DrawTriangleCodegen::DrawFullSpans() SSAInt height = SSAInt(8); 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)); 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)); @@ -69,7 +68,6 @@ void DrawTriangleCodegen::DrawFullSpans() SSAForBlock loop_y; SSAInt y = stack_y.load(); SSAUBytePtr dest = stack_dest.load(); - SSAIntPtr subsector = stack_subsector.load(); SSAStepVariables blockPosY; blockPosY.W = stack_posYW.load(); for (int j = 0; j < TriVertex::NumVarying; j++) @@ -121,9 +119,6 @@ void DrawTriangleCodegen::DrawFullSpans() SSAUBytePtr destptr = dest[(x * 8 + ix) * 4]; 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 { @@ -133,9 +128,6 @@ void DrawTriangleCodegen::DrawFullSpans() SSAUBytePtr destptr = dest[(x * 8 + ix)]; 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++) @@ -157,7 +149,6 @@ void DrawTriangleCodegen::DrawFullSpans() for (int j = 0; j < TriVertex::NumVarying; j++) stack_posYVarying[j].store(blockPosY.Varying[j] + gradientY.Varying[j]); stack_dest.store(dest[pitch * pixelsize]); - stack_subsector.store(subsector[pitch]); stack_y.store(y + 1); } loop_y.end_block(); @@ -180,7 +171,6 @@ void DrawTriangleCodegen::DrawPartialBlocks() SSAInt mask1 = partialBlocks[i][3].load(true); SSAUBytePtr dest = destOrg[(blockX + blockY * pitch) * pixelsize]; - SSAIntPtr subsector = subsectorGBuffer[blockX + blockY * pitch]; SSAStepVariables blockPosY; blockPosY.W = start.W + gradientX.W * (blockX - startX) + gradientY.W * (blockY - startY); @@ -229,9 +219,6 @@ void DrawTriangleCodegen::DrawPartialBlocks() SSAUBytePtr destptr = dest[x * 4]; destptr.store_vec4ub(ProcessPixel32(destptr.load_vec4ub(false), varyingPos)); - - if (variant != TriDrawVariant::DrawSubsector && variant != TriDrawVariant::FillSubsector && variant != TriDrawVariant::FuzzSubsector) - subsector[x].store(subsectorDepth); } else { @@ -241,9 +228,6 @@ void DrawTriangleCodegen::DrawPartialBlocks() SSAUBytePtr destptr = dest[x]; 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(); @@ -258,7 +242,6 @@ void DrawTriangleCodegen::DrawPartialBlocks() blockPosY.Varying[j] = blockPosY.Varying[j] + gradientY.Varying[j]; dest = dest[pitch * pixelsize]; - subsector = subsector[pitch]; } } @@ -276,7 +259,7 @@ SSAVec4i DrawTriangleCodegen::TranslateSample32(SSAInt *varying) SSAInt vpos = ((vfrac >> 16) * textureHeight) >> 16; SSAInt uvoffset = upos * textureHeight + vpos; - if (variant == TriDrawVariant::FillNormal || variant == TriDrawVariant::FillSubsector || variant == TriDrawVariant::FuzzSubsector) + if (colorfill) return translation[color * 4].load_vec4ub(true); else 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 uvoffset = upos * textureHeight + vpos; - if (variant == TriDrawVariant::FillNormal || variant == TriDrawVariant::FillSubsector || variant == TriDrawVariant::FuzzSubsector) + if (colorfill) return translation[color].load(true).zext_int(); else 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) { - if (variant == TriDrawVariant::FillNormal || variant == TriDrawVariant::FillSubsector || variant == TriDrawVariant::FuzzSubsector) + if (colorfill) return SSAVec4i::unpack(color); SSAInt ufrac = varying[0] << 8; @@ -362,7 +345,7 @@ SSAInt DrawTriangleCodegen::Sample8(SSAInt *varying) SSAInt vpos = ((vfrac >> 16) * textureHeight) >> 16; SSAInt uvoffset = upos * textureHeight + vpos; - if (variant == TriDrawVariant::FillNormal || variant == TriDrawVariant::FillSubsector || variant == TriDrawVariant::FuzzSubsector) + if (colorfill) return color; else 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); translation = args[0][12].load(true); LoadUniforms(args[0][13].load(true)); - subsectorGBuffer = args[0][19].load(true); if (!truecolor) { Colormaps = args[0][20].load(true); @@ -624,7 +606,6 @@ SSATriVertex DrawTriangleCodegen::LoadTriVertex(SSAValue ptr) void DrawTriangleCodegen::LoadUniforms(SSAValue uniforms) { light = uniforms[0][0].load(true); - subsectorDepth = uniforms[0][1].load(true); color = uniforms[0][2].load(true); srcalpha = uniforms[0][3].load(true); destalpha = uniforms[0][4].load(true); diff --git a/tools/drawergen/fixedfunction/drawtrianglecodegen.h b/tools/drawergen/fixedfunction/drawtrianglecodegen.h index 02db1451c1..8197656fa2 100644 --- a/tools/drawergen/fixedfunction/drawtrianglecodegen.h +++ b/tools/drawergen/fixedfunction/drawtrianglecodegen.h @@ -39,7 +39,7 @@ struct SSAStepVariables class DrawTriangleCodegen : public DrawerCodegen { 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: void LoadArgs(SSAValue args, SSAValue thread_data); @@ -69,7 +69,6 @@ private: SSAStack stack_varyingPos[TriVertex::NumVarying]; SSAStack stack_lightpos; SSAStack stack_dest; - SSAStack stack_subsector; SSAStepVariables gradientX, gradientY, start; SSAFloat shade, globVis; @@ -78,7 +77,6 @@ private: SSAUBytePtr currentcolormap; SSAUBytePtr destOrg; - SSAIntPtr subsectorGBuffer; SSAInt pitch; SSATriVertex v1; SSATriVertex v2; @@ -90,7 +88,6 @@ private: SSAInt color, srcalpha, destalpha; SSAInt light; - SSAInt subsectorDepth; SSAShadeConstants shade_constants; SSABool is_simple_shade; SSABool is_nearest_filter; @@ -107,9 +104,9 @@ private: SSAValue fullSpans; // TriFullSpan[] SSAValue partialBlocks; // TriPartialBlock[] - TriDrawVariant variant; TriBlendMode blendmode; bool truecolor; + bool colorfill; int pixelsize; }; @@ -160,10 +157,8 @@ private: SSAStack stack_C1, stack_C2, stack_C3; SSAStack stack_y; SSAStack stack_dest; - SSAStack stack_subsectorGBuffer; SSAStack stack_x; SSAStack stack_buffer; - SSAStack stack_subsectorbuffer; SSAStack stack_iy, stack_ix; SSAStack stack_CY1, stack_CY2, stack_CY3; SSAStack stack_CX1, stack_CX2, stack_CX3; @@ -189,7 +184,6 @@ private: SSAInt color, srcalpha, destalpha; SSAInt light; - SSAInt subsectorDepth; SSAShadeConstants shade_constants; SSABool is_simple_shade; SSABool is_nearest_filter; @@ -200,7 +194,6 @@ private: SSAInt stencilPitch; SSAUByte stencilTestValue; SSAUByte stencilWriteValue; - SSAIntPtr subsectorGBuffer; SSAUBytePtr Colormaps; SSAUBytePtr RGB32k; diff --git a/tools/drawergen/llvmdrawers.cpp b/tools/drawergen/llvmdrawers.cpp index 83f1b14163..e0300946cb 100644 --- a/tools/drawergen/llvmdrawers.cpp +++ b/tools/drawergen/llvmdrawers.cpp @@ -93,17 +93,11 @@ LLVMDrawers::LLVMDrawers(const std::string &triple, const std::string &cpuName, CodegenDrawSky("DrawDoubleSky4", DrawSkyVariant::Double, 4); for (int i = 0; i < NumTriBlendModes(); i++) { - CodegenDrawTriangle("TriDrawNormal8_" + std::to_string(i), TriDrawVariant::DrawNormal, (TriBlendMode)i, false); - CodegenDrawTriangle("TriDrawNormal32_" + std::to_string(i), TriDrawVariant::DrawNormal, (TriBlendMode)i, true); - CodegenDrawTriangle("TriFillNormal8_" + std::to_string(i), TriDrawVariant::FillNormal, (TriBlendMode)i, false); - CodegenDrawTriangle("TriFillNormal32_" + std::to_string(i), TriDrawVariant::FillNormal, (TriBlendMode)i, 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("TriDraw8_" + std::to_string(i), (TriBlendMode)i, false, false); + CodegenDrawTriangle("TriDraw32_" + std::to_string(i), (TriBlendMode)i, true, false); + CodegenDrawTriangle("TriFill8_" + std::to_string(i), (TriBlendMode)i, false, true); + CodegenDrawTriangle("TriFill32_" + std::to_string(i), (TriBlendMode)i, true, true); } - CodegenDrawTriangle("TriStencil", TriDrawVariant::Stencil, TriBlendMode::Copy, false); - CodegenDrawTriangle("TriStencilClose", TriDrawVariant::StencilClose, TriBlendMode::Copy, false); 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()"); } -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()); SSAScope ssa_scope(&mProgram.context(), mProgram.module(), &builder); @@ -194,12 +188,12 @@ void LLVMDrawers::CodegenDrawTriangle(const std::string &name, TriDrawVariant va function.create_public(); 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(); 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) diff --git a/tools/drawergen/llvmdrawers.h b/tools/drawergen/llvmdrawers.h index df6078f4d8..a1b7b53616 100644 --- a/tools/drawergen/llvmdrawers.h +++ b/tools/drawergen/llvmdrawers.h @@ -51,7 +51,7 @@ private: void CodegenDrawSpan(const char *name, DrawSpanVariant variant); void CodegenDrawWall(const char *name, DrawWallVariant 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 *GetDrawSpanArgsStruct(llvm::LLVMContext &context);