{
// degenerate triangles won't be sent to rasterizer; just enable all edges
pfnWork = GetRasterizerFunc(rastState.sampleCount, rastState.bIsCenterPattern, (rastState.conservativeRast > 0),
- (SWR_INPUT_COVERAGE)pDC->pState->state.psState.inputCoverage, ALL_EDGES_VALID, (state.scissorsTileAligned == false));
+ (SWR_INPUT_COVERAGE)pDC->pState->state.psState.inputCoverage, EdgeValToEdgeState(ALL_EDGES_VALID), (state.scissorsTileAligned == false));
}
if (!triMask)
// only rasterize valid edges if we have a degenerate primitive
int32_t triEdgeEnable = (edgeEnable >> (triIndex * 3)) & ALL_EDGES_VALID;
work.pfnWork = GetRasterizerFunc(rastState.sampleCount, rastState.bIsCenterPattern, (rastState.conservativeRast > 0),
- (SWR_INPUT_COVERAGE)pDC->pState->state.psState.inputCoverage, triEdgeEnable, (state.scissorsTileAligned == false));
+ (SWR_INPUT_COVERAGE)pDC->pState->state.psState.inputCoverage, EdgeValToEdgeState(triEdgeEnable), (state.scissorsTileAligned == false));
// Degenerate triangles are required to be constant interpolated
isDegenerate = (triEdgeEnable != ALL_EDGES_VALID) ? true : false;
{
// degenerate triangles won't be sent to rasterizer; just enable all edges
pfnWork = GetRasterizerFunc(rastState.sampleCount, rastState.bIsCenterPattern, (rastState.conservativeRast > 0),
- (SWR_INPUT_COVERAGE)pDC->pState->state.psState.inputCoverage, ALL_EDGES_VALID, (state.scissorsTileAligned == false));
+ (SWR_INPUT_COVERAGE)pDC->pState->state.psState.inputCoverage, EdgeValToEdgeState(ALL_EDGES_VALID), (state.scissorsTileAligned == false));
}
if (!triMask)
// only rasterize valid edges if we have a degenerate primitive
int32_t triEdgeEnable = (edgeEnable >> (triIndex * 3)) & ALL_EDGES_VALID;
work.pfnWork = GetRasterizerFunc(rastState.sampleCount, rastState.bIsCenterPattern, (rastState.conservativeRast > 0),
- (SWR_INPUT_COVERAGE)pDC->pState->state.psState.inputCoverage, triEdgeEnable, (state.scissorsTileAligned == false));
+ (SWR_INPUT_COVERAGE)pDC->pState->state.psState.inputCoverage, EdgeValToEdgeState(triEdgeEnable), (state.scissorsTileAligned == false));
// Degenerate triangles are required to be constant interpolated
isDegenerate = (triEdgeEnable != ALL_EDGES_VALID) ? true : false;
PFN_WORK_FUNC pfnTriRast;
// conservative rast not supported for points/lines
pfnTriRast = GetRasterizerFunc(rastState.sampleCount, rastState.bIsCenterPattern, false,
- SWR_INPUT_COVERAGE_NONE, ALL_EDGES_VALID, (pDC->pState->state.scissorsTileAligned == false));
+ SWR_INPUT_COVERAGE_NONE, EdgeValToEdgeState(ALL_EDGES_VALID), (pDC->pState->state.scissorsTileAligned == false));
// overwrite texcoords for point sprites
if (isPointSpriteTexCoordEnabled)
PFN_WORK_FUNC pfnTriRast;
// conservative rast not supported for points/lines
pfnTriRast = GetRasterizerFunc(rastState.sampleCount, rastState.bIsCenterPattern, false,
- SWR_INPUT_COVERAGE_NONE, ALL_EDGES_VALID, (pDC->pState->state.scissorsTileAligned == false));
+ SWR_INPUT_COVERAGE_NONE, EdgeValToEdgeState(ALL_EDGES_VALID), (pDC->pState->state.scissorsTileAligned == false));
// make sure this macrotile intersects the triangle
__m128i vXai = fpToFixedPoint(vXa);
IsCenter,
IsConservative,
IntArg<SWR_INPUT_COVERAGE_NONE, SWR_INPUT_COVERAGE_COUNT-1>{InputCoverage},
- IntArg<0, VALID_TRI_EDGE_COUNT-1>{EdgeEnable},
+ IntArg<0, STATE_VALID_TRI_EDGE_COUNT-1>{EdgeEnable},
RasterizeScissorEdges);
}
uint32_t EdgeEnable,
bool RasterizeScissorEdges);
-enum ValidTriEdges
+enum TriEdgesStates
+{
+ STATE_NO_VALID_EDGES = 0,
+ STATE_E0_E1_VALID,
+ STATE_E0_E2_VALID,
+ STATE_E1_E2_VALID,
+ STATE_ALL_EDGES_VALID,
+ STATE_VALID_TRI_EDGE_COUNT,
+};
+
+enum TriEdgesValues
{
NO_VALID_EDGES = 0,
E0_E1_VALID = 0x3,
typedef std::integral_constant<uint32_t, E1_E2_VALID> E1E2ValidT;
typedef std::integral_constant<uint32_t, NO_VALID_EDGES> NoEdgesValidT;
+typedef std::integral_constant<uint32_t, STATE_ALL_EDGES_VALID> StateAllEdgesValidT;
+typedef std::integral_constant<uint32_t, STATE_E0_E1_VALID> StateE0E1ValidT;
+typedef std::integral_constant<uint32_t, STATE_E0_E2_VALID> StateE0E2ValidT;
+typedef std::integral_constant<uint32_t, STATE_E1_E2_VALID> StateE1E2ValidT;
+typedef std::integral_constant<uint32_t, STATE_NO_VALID_EDGES> StateNoEdgesValidT;
+
+// some specializations to convert from edge state to edge bitmask values
+template <typename EdgeMask>
+struct EdgeMaskVal
+{
+ static_assert(EdgeMask::value > STATE_ALL_EDGES_VALID, "Primary EdgeMaskVal shouldn't be instantiated");
+};
+
+template <>
+struct EdgeMaskVal<StateAllEdgesValidT>
+{
+ typedef AllEdgesValidT T;
+};
+
+template <>
+struct EdgeMaskVal<StateE0E1ValidT>
+{
+ typedef E0E1ValidT T;
+};
+
+template <>
+struct EdgeMaskVal<StateE0E2ValidT>
+{
+ typedef E0E2ValidT T;
+};
+
+template <>
+struct EdgeMaskVal<StateE1E2ValidT>
+{
+ typedef E1E2ValidT T;
+};
+
+template <>
+struct EdgeMaskVal<StateNoEdgesValidT>
+{
+ typedef NoEdgesValidT T;
+};
+
+INLINE uint32_t EdgeValToEdgeState(uint32_t val)
+{
+ SWR_ASSERT(val < VALID_TRI_EDGE_COUNT, "Unexpected tri edge mask");
+ static const uint32_t edgeValToEdgeState[VALID_TRI_EDGE_COUNT] = { 0, 0, 0, 1, 0, 2, 3, 4 };
+ return edgeValToEdgeState[val];
+}
+
//////////////////////////////////////////////////////////////////////////
/// @struct RasterScissorEdgesT
/// @brief Primary RasterScissorEdgesT templated struct that holds compile
{
typedef std::true_type RasterizeScissorEdgesT;
typedef std::integral_constant<uint32_t, 7> NumEdgesT;
- typedef std::integral_constant<uint32_t, EdgeMaskT::value> ValidEdgeMaskT;
+ //typedef std::integral_constant<uint32_t, EdgeMaskT::value> ValidEdgeMaskT;
+ typedef typename EdgeMaskVal<EdgeMaskT>::T ValidEdgeMaskT;
};
//////////////////////////////////////////////////////////////////////////
/// @tparam RasterScissorEdgesT: do we need to rasterize with a scissor?
template <typename NumSamplesT, typename CenterPatternT, typename ConservativeT, typename InputCoverageT, typename EdgeEnableT, typename RasterScissorEdgesT>
struct RasterizerTraits final : public ConservativeRastBETraits<ConservativeT, InputCoverageT>,
- public RasterEdgeTraits<RasterScissorEdgesT, ConservativeT, std::integral_constant<uint32_t, EdgeEnableT::value>>
+ public RasterEdgeTraits<RasterScissorEdgesT, ConservativeT, EdgeEnableT>
{
typedef MultisampleTraits<static_cast<SWR_MULTISAMPLE_COUNT>(NumSamplesT::value), CenterPatternT::value> MT;