Skip to content

Commit

Permalink
- rewrite screen triangle drawer to be more modular and better suppor…
Browse files Browse the repository at this point in the history
…t the hwrenderer shaders
  • Loading branch information
dpjudas committed Aug 5, 2019
1 parent ebe377e commit f73470d
Show file tree
Hide file tree
Showing 4 changed files with 389 additions and 10 deletions.
2 changes: 2 additions & 0 deletions src/rendering/polyrenderer/drawers/poly_triangle.cpp
Expand Up @@ -909,6 +909,7 @@ void PolyTriangleThreadData::DrawShadedTriangle(const ShadedTriVertex *const* ve
}
#endif

#if 0
// Keep varyings in -128 to 128 range if possible
// But don't do this for the skycap mode since the V texture coordinate is used for blending
if (numclipvert > 0 && drawargs.BlendMode() != TriBlendMode::Skycap)
Expand All @@ -921,6 +922,7 @@ void PolyTriangleThreadData::DrawShadedTriangle(const ShadedTriVertex *const* ve
clippedvert[i].v -= newOriginV;
}
}
#endif

if (twosided && numclipvert > 2)
{
Expand Down
24 changes: 14 additions & 10 deletions src/rendering/polyrenderer/drawers/poly_triangle.h
Expand Up @@ -198,16 +198,20 @@ class PolyTriangleThreadData
return MAX(c, 0);
}

// Varyings
float worldposX[MAXWIDTH];
float worldposY[MAXWIDTH];
float worldposZ[MAXWIDTH];
uint32_t texel[MAXWIDTH];
int32_t texelV[MAXWIDTH];
uint16_t lightarray[MAXWIDTH];
uint32_t dynlights[MAXWIDTH];
float depthvalues[MAXWIDTH];
uint8_t alphatestbuffer[MAXWIDTH];
struct Scanline
{
float W[MAXWIDTH];
float U[MAXWIDTH];
float V[MAXWIDTH];
float WorldX[MAXWIDTH];
float WorldY[MAXWIDTH];
float WorldZ[MAXWIDTH];
uint32_t FragColor[MAXWIDTH];
#if 0
uint16_t lightarray[MAXWIDTH];
uint32_t dynlights[MAXWIDTH];
#endif
} scanline;

static PolyTriangleThreadData *Get(DrawerThread *thread);

Expand Down

0 comments on commit f73470d

Please sign in to comment.