int i;
};
-bool isNaN( float a )
+static bool tess_isNaN( float a )
{
static const int exponentMask = 0x7f800000;
static const int mantissaMask = 0x007fffff;
//---------------------------------------------------------------------------------------------------------------------------------
// flush (denorm)
//---------------------------------------------------------------------------------------------------------------------------------
-float flush( float a )
+static float tess_flush( float a )
{
static const int minNormalizedFloat = 0x00800000;
static const int signBit = 0x80000000;
//---------------------------------------------------------------------------------------------------------------------------------
// IEEE754R min
//---------------------------------------------------------------------------------------------------------------------------------
-float fmin( float a, float b )
+static float tess_fmin( float a, float b )
{
- float _a = flush( a );
- float _b = flush( b );
- if( isNaN( _b ) )
+ float _a = tess_flush( a );
+ float _b = tess_flush( b );
+ if( tess_isNaN( _b ) )
{
return a;
}
//---------------------------------------------------------------------------------------------------------------------------------
// IEEE754R max
//---------------------------------------------------------------------------------------------------------------------------------
-float fmax( float a, float b )
+static float tess_fmax( float a, float b )
{
- float _a = flush( a );
- float _b = flush( b );
+ float _a = tess_flush( a );
+ float _b = tess_flush( b );
- if( isNaN( _b ) )
+ if( tess_isNaN( _b ) )
{
return a;
}
break;
}
- tessFactor_Ueq0 = fmin( upperBound, fmax( lowerBound, tessFactor_Ueq0 ) );
- tessFactor_Veq0 = fmin( upperBound, fmax( lowerBound, tessFactor_Veq0 ) );
- tessFactor_Ueq1 = fmin( upperBound, fmax( lowerBound, tessFactor_Ueq1 ) );
- tessFactor_Veq1 = fmin( upperBound, fmax( lowerBound, tessFactor_Veq1 ) );
+ tessFactor_Ueq0 = tess_fmin( upperBound, tess_fmax( lowerBound, tessFactor_Ueq0 ) );
+ tessFactor_Veq0 = tess_fmin( upperBound, tess_fmax( lowerBound, tessFactor_Veq0 ) );
+ tessFactor_Ueq1 = tess_fmin( upperBound, tess_fmax( lowerBound, tessFactor_Ueq1 ) );
+ tessFactor_Veq1 = tess_fmin( upperBound, tess_fmax( lowerBound, tessFactor_Veq1 ) );
if( HWIntegerPartitioning()) // pow2 or integer, round to next int (hw doesn't care about pow2 distinction)
{
}
}
- insideTessFactor_U = fmin( upperBound, fmax( lowerBound, insideTessFactor_U ) );
- insideTessFactor_V = fmin( upperBound, fmax( lowerBound, insideTessFactor_V ) );
+ insideTessFactor_U = tess_fmin( upperBound, tess_fmax( lowerBound, insideTessFactor_U ) );
+ insideTessFactor_V = tess_fmin( upperBound, tess_fmax( lowerBound, insideTessFactor_V ) );
// Note the above clamps map NaN to lowerBound
break;
}
- tessFactor_Ueq0 = fmin( upperBound, fmax( lowerBound, tessFactor_Ueq0 ) );
- tessFactor_Veq0 = fmin( upperBound, fmax( lowerBound, tessFactor_Veq0 ) );
- tessFactor_Weq0 = fmin( upperBound, fmax( lowerBound, tessFactor_Weq0 ) );
+ tessFactor_Ueq0 = tess_fmin( upperBound, tess_fmax( lowerBound, tessFactor_Ueq0 ) );
+ tessFactor_Veq0 = tess_fmin( upperBound, tess_fmax( lowerBound, tessFactor_Veq0 ) );
+ tessFactor_Weq0 = tess_fmin( upperBound, tess_fmax( lowerBound, tessFactor_Weq0 ) );
if( HWIntegerPartitioning()) // pow2 or integer, round to next int (hw doesn't care about pow2 distinction)
{
}
}
- insideTessFactor = fmin( upperBound, fmax( lowerBound, insideTessFactor ) );
+ insideTessFactor = tess_fmin( upperBound, tess_fmax( lowerBound, insideTessFactor ) );
// Note the above clamps map NaN to lowerBound
if( HWIntegerPartitioning()) // pow2 or integer, round to next int (hw doesn't care about pow2 distinction)
break;
}
- TessFactor_V_LineDensity = fmin( D3D11_TESSELLATOR_MAX_ISOLINE_DENSITY_TESSELLATION_FACTOR,
- fmax( D3D11_TESSELLATOR_MIN_ISOLINE_DENSITY_TESSELLATION_FACTOR, TessFactor_V_LineDensity ) );
- TessFactor_U_LineDetail = fmin( upperBound, fmax( lowerBound, TessFactor_U_LineDetail ) );
+ TessFactor_V_LineDensity = tess_fmin( D3D11_TESSELLATOR_MAX_ISOLINE_DENSITY_TESSELLATION_FACTOR,
+ tess_fmax( D3D11_TESSELLATOR_MIN_ISOLINE_DENSITY_TESSELLATION_FACTOR, TessFactor_V_LineDensity ) );
+ TessFactor_U_LineDetail = tess_fmin( upperBound, tess_fmax( lowerBound, TessFactor_U_LineDetail ) );
// Reset our vertex and index buffers. We have enough storage for the max tessFactor.
m_NumPoints = 0;
switch( m_insideTessFactorReduction )
{
case D3D11_TESSELLATOR_REDUCTION_MIN:
- insideTessFactor[U] = fmin(fmin(tessFactor_Veq0,tessFactor_Veq1),fmin(tessFactor_Ueq0,tessFactor_Ueq1));
+ insideTessFactor[U] = tess_fmin(tess_fmin(tessFactor_Veq0,tessFactor_Veq1),tess_fmin(tessFactor_Ueq0,tessFactor_Ueq1));
break;
case D3D11_TESSELLATOR_REDUCTION_MAX:
- insideTessFactor[U] = fmax(fmax(tessFactor_Veq0,tessFactor_Veq1),fmax(tessFactor_Ueq0,tessFactor_Ueq1));
+ insideTessFactor[U] = tess_fmax(tess_fmax(tessFactor_Veq0,tessFactor_Veq1),tess_fmax(tessFactor_Ueq0,tessFactor_Ueq1));
break;
case D3D11_TESSELLATOR_REDUCTION_AVERAGE:
insideTessFactor[U] = (tessFactor_Veq0 + tessFactor_Veq1 + tessFactor_Ueq0 + tessFactor_Ueq1) / 4;
{
if(D3D11_TESSELLATOR_REDUCTION_MAX == m_insideTessFactorReduction)
{
- insideTessFactor[U] = fmin(FLOAT_THREE,fmax(fmax(tessFactor_Veq0,tessFactor_Veq1),fmax(tessFactor_Ueq0,tessFactor_Ueq1)));
+ insideTessFactor[U] = tess_fmin(FLOAT_THREE,tess_fmax(tess_fmax(tessFactor_Veq0,tessFactor_Veq1),tess_fmax(tessFactor_Ueq0,tessFactor_Ueq1)));
}
else
{
- insideTessFactor[U] = fmin(FLOAT_THREE,(tessFactor_Veq0 + tessFactor_Veq1 + tessFactor_Ueq0 + tessFactor_Ueq1) / 4);
+ insideTessFactor[U] = tess_fmin(FLOAT_THREE,(tessFactor_Veq0 + tessFactor_Veq1 + tessFactor_Ueq0 + tessFactor_Ueq1) / 4);
}
ClampTessFactor(insideTessFactor[U]); // clamp reduction result that is based on unbounded user input
m_LastUnRoundedComputedTessFactors[4] = m_LastUnRoundedComputedTessFactors[5] = insideTessFactor[U]; // Save off TessFactors so they can be returned to app
switch( m_insideTessFactorReduction )
{
case D3D11_TESSELLATOR_REDUCTION_MIN:
- insideTessFactor[U] = fmin(tessFactor_Veq0,tessFactor_Veq1);
- insideTessFactor[V] = fmin(tessFactor_Ueq0,tessFactor_Ueq1);
+ insideTessFactor[U] = tess_fmin(tessFactor_Veq0,tessFactor_Veq1);
+ insideTessFactor[V] = tess_fmin(tessFactor_Ueq0,tessFactor_Ueq1);
break;
case D3D11_TESSELLATOR_REDUCTION_MAX:
- insideTessFactor[U] = fmax(tessFactor_Veq0,tessFactor_Veq1);
- insideTessFactor[V] = fmax(tessFactor_Ueq0,tessFactor_Ueq1);
+ insideTessFactor[U] = tess_fmax(tessFactor_Veq0,tessFactor_Veq1);
+ insideTessFactor[V] = tess_fmax(tessFactor_Ueq0,tessFactor_Ueq1);
break;
case D3D11_TESSELLATOR_REDUCTION_AVERAGE:
insideTessFactor[U] = (tessFactor_Veq0 + tessFactor_Veq1) / 2;
{
if(D3D11_TESSELLATOR_REDUCTION_MAX == m_insideTessFactorReduction)
{
- insideTessFactor[U] = fmin(FLOAT_THREE,fmax(tessFactor_Veq0,tessFactor_Veq1));
+ insideTessFactor[U] = tess_fmin(FLOAT_THREE,tess_fmax(tessFactor_Veq0,tessFactor_Veq1));
}
else
{
- insideTessFactor[U] = fmin(FLOAT_THREE,(tessFactor_Veq0 + tessFactor_Veq1) / 2);
+ insideTessFactor[U] = tess_fmin(FLOAT_THREE,(tessFactor_Veq0 + tessFactor_Veq1) / 2);
}
ClampTessFactor(insideTessFactor[U]); // clamp reduction result that is based on unbounded user input
m_LastUnRoundedComputedTessFactors[4] = insideTessFactor[U]; // Save off TessFactors so they can be returned to app
{
if(D3D11_TESSELLATOR_REDUCTION_MAX == m_insideTessFactorReduction)
{
- insideTessFactor[V] = fmin(FLOAT_THREE,fmax(tessFactor_Ueq0,tessFactor_Ueq1));
+ insideTessFactor[V] = tess_fmin(FLOAT_THREE,tess_fmax(tessFactor_Ueq0,tessFactor_Ueq1));
}
else
{
- insideTessFactor[V] = fmin(FLOAT_THREE,(tessFactor_Ueq0 + tessFactor_Ueq1) / 2);
+ insideTessFactor[V] = tess_fmin(FLOAT_THREE,(tessFactor_Ueq0 + tessFactor_Ueq1) / 2);
}
ClampTessFactor(insideTessFactor[V]);// clamp reduction result that is based on unbounded user input
m_LastUnRoundedComputedTessFactors[5] = insideTessFactor[V]; // Save off TessFactors so they can be returned to app
// as much as the side with the minimum TessFactor. Prevents snapping to edge.
if( (insideTessFactor[axis] < FLOAT_THREE) && (insideTessFactor[axis] < insideTessFactor[(axis+1)&0x1]))
{
- insideTessFactor[axis] = fmin(insideTessFactor[(axis+1)&0x1],FLOAT_THREE);
+ insideTessFactor[axis] = tess_fmin(insideTessFactor[(axis+1)&0x1],FLOAT_THREE);
m_LastUnRoundedComputedTessFactors[4+axis] = insideTessFactor[axis]; // Save off TessFactors so they can be returned to app
}
}
switch( m_insideTessFactorReduction )
{
case D3D11_TESSELLATOR_REDUCTION_MIN:
- insideTessFactor = fmin(fmin(tessFactor_Ueq0,tessFactor_Veq0),tessFactor_Weq0);
+ insideTessFactor = tess_fmin(tess_fmin(tessFactor_Ueq0,tessFactor_Veq0),tessFactor_Weq0);
break;
case D3D11_TESSELLATOR_REDUCTION_MAX:
- insideTessFactor = fmax(fmax(tessFactor_Ueq0,tessFactor_Veq0),tessFactor_Weq0);
+ insideTessFactor = tess_fmax(tess_fmax(tessFactor_Ueq0,tessFactor_Veq0),tessFactor_Weq0);
break;
case D3D11_TESSELLATOR_REDUCTION_AVERAGE:
insideTessFactor = (tessFactor_Ueq0 + tessFactor_Veq0 + tessFactor_Weq0) / 3;
// Scale inside TessFactor based on user scale factor.
ClampFloatTessFactorScale(insideTessFactorScale); // clamp scale value to [0..1], NaN->0
- insideTessFactor = insideTessFactor*fmin(FLOAT_ONE,insideTessFactorScale);
+ insideTessFactor = insideTessFactor*tess_fmin(FLOAT_ONE,insideTessFactorScale);
ClampTessFactor(insideTessFactor); // clamp reduction + scale result that is based on unbounded user input
m_LastUnRoundedComputedTessFactors[3] = insideTessFactor;// Save off TessFactors so they can be returned to app
// in using avg or max (and ignore inside TessFactor scaling) until it is at least 3.
if(D3D11_TESSELLATOR_REDUCTION_MAX == m_insideTessFactorReduction)
{
- insideTessFactor = fmin(FLOAT_THREE,fmax(tessFactor_Ueq0,fmax(tessFactor_Veq0,tessFactor_Weq0)));
+ insideTessFactor = tess_fmin(FLOAT_THREE,tess_fmax(tessFactor_Ueq0,tess_fmax(tessFactor_Veq0,tessFactor_Weq0)));
}
else
{
- insideTessFactor = fmin(FLOAT_THREE,(tessFactor_Ueq0 + tessFactor_Veq0 + tessFactor_Weq0) / 3);
+ insideTessFactor = tess_fmin(FLOAT_THREE,(tessFactor_Ueq0 + tessFactor_Veq0 + tessFactor_Weq0) / 3);
}
ClampTessFactor(insideTessFactor); // clamp reduction result that is based on unbounded user input
m_LastUnRoundedComputedTessFactors[3] = insideTessFactor;// Save off TessFactors so they can be returned to app
{
if( Pow2Partitioning() )
{
- TessFactor = fmin( D3D11_TESSELLATOR_MAX_EVEN_TESSELLATION_FACTOR, fmax( TessFactor, D3D11_TESSELLATOR_MIN_ODD_TESSELLATION_FACTOR) );
+ TessFactor = tess_fmin( D3D11_TESSELLATOR_MAX_EVEN_TESSELLATION_FACTOR, tess_fmax( TessFactor, D3D11_TESSELLATOR_MIN_ODD_TESSELLATION_FACTOR) );
}
else if( IntegerPartitioning() )
{
- TessFactor = fmin( D3D11_TESSELLATOR_MAX_TESSELLATION_FACTOR, fmax( TessFactor, D3D11_TESSELLATOR_MIN_ODD_TESSELLATION_FACTOR) );
+ TessFactor = tess_fmin( D3D11_TESSELLATOR_MAX_TESSELLATION_FACTOR, tess_fmax( TessFactor, D3D11_TESSELLATOR_MIN_ODD_TESSELLATION_FACTOR) );
}
else if( Odd() )
{
- TessFactor = fmin( D3D11_TESSELLATOR_MAX_ODD_TESSELLATION_FACTOR, fmax( TessFactor, D3D11_TESSELLATOR_MIN_ODD_TESSELLATION_FACTOR) );
+ TessFactor = tess_fmin( D3D11_TESSELLATOR_MAX_ODD_TESSELLATION_FACTOR, tess_fmax( TessFactor, D3D11_TESSELLATOR_MIN_ODD_TESSELLATION_FACTOR) );
}
else // even
{
- TessFactor = fmin( D3D11_TESSELLATOR_MAX_EVEN_TESSELLATION_FACTOR, fmax( TessFactor, D3D11_TESSELLATOR_MIN_EVEN_TESSELLATION_FACTOR) );
+ TessFactor = tess_fmin( D3D11_TESSELLATOR_MAX_EVEN_TESSELLATION_FACTOR, tess_fmax( TessFactor, D3D11_TESSELLATOR_MIN_EVEN_TESSELLATION_FACTOR) );
}
}