Skip to content
Permalink
Browse files
Make mVisible the RasterizeAndDepthTestAABBox return value instead of…
… state
  • Loading branch information
rygorous committed Feb 24, 2013
1 parent 077217d commit 36fed2d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
@@ -97,12 +97,11 @@ void AABBoxRasterizerSSEMT::TransformAABBoxAndDepthTest(UINT taskId)
for(UINT i = base; i < end; i++)
{
mpVisible[i] = false;
mpTransformedAABBox[i].SetVisible(&mpVisible[i]);

if(mpBBoxVisible[i] && !mpTransformedAABBox[i].IsTooSmall(mViewMatrix, mProjMatrix, mpCamera))
{
mpTransformedAABBox[i].TransformAABBox();
mpTransformedAABBox[i].RasterizeAndDepthTestAABBox(mpRenderTargetPixels);
mpVisible[i] = mpTransformedAABBox[i].RasterizeAndDepthTestAABBox(mpRenderTargetPixels);
}
}
}
@@ -50,12 +50,11 @@ void AABBoxRasterizerSSEST::TransformAABBoxAndDepthTest()
for(UINT i = 0; i < mNumModels; i++)
{
mpVisible[i] = false;
mpTransformedAABBox[i].SetVisible(&mpVisible[i]);

if(mpBBoxVisible[i] && !mpTransformedAABBox[i].IsTooSmall(mViewMatrix, mProjMatrix, mpCamera))
{
mpTransformedAABBox[i].TransformAABBox();
mpTransformedAABBox[i].RasterizeAndDepthTestAABBox(mpRenderTargetPixels);
mpVisible[i] = mpTransformedAABBox[i].RasterizeAndDepthTestAABBox(mpRenderTargetPixels);
}
}
mDepthTestTime[mTimeCounter++] = mDepthTestTimer.StopTimer();
@@ -46,7 +46,6 @@ static const UINT sBBIndexList[AABB_INDICES] =

TransformedAABBoxSSE::TransformedAABBoxSSE()
: mpCPUTModel(NULL),
mVisible(NULL),
mOccludeeSizeThreshold(0.0f)
{
mWorldMatrix = (__m128*)_aligned_malloc(sizeof(float) * 4 * 4, 16);
@@ -162,7 +161,7 @@ void TransformedAABBoxSSE::Gather(vFloat4 pOut[3], UINT triId)
// If any of the rasterized AABB pixels passes the depth test exit early and mark the occludee
// as visible. If all rasterized AABB pixels are occluded then the occludee is culled
//-----------------------------------------------------------------------------------------
void TransformedAABBoxSSE::RasterizeAndDepthTestAABBox(UINT *pRenderTargetPixels)
bool TransformedAABBoxSSE::RasterizeAndDepthTestAABBox(UINT *pRenderTargetPixels)
{
// Set DAZ and FZ MXCSR bits to flush denormals to zero (i.e., make it faster)
// Denormal are zero (DAZ) is bit 6 and Flush to zero (FZ) is bit 15.
@@ -234,8 +233,7 @@ void TransformedAABBoxSSE::RasterizeAndDepthTestAABBox(UINT *pRenderTargetPixels
if(!is_all_zeros(nearClipMask))
{
// All four vertices are behind the near plane (we're processing four triangles at a time w/ SSE)
*mVisible = true;
return;
return true;
}
}

@@ -322,10 +320,11 @@ void TransformedAABBoxSSE::RasterizeAndDepthTestAABBox(UINT *pRenderTargetPixels

if(!_mm_testz_si128(anyOut.simd, _mm_set1_epi32(0x80000000)))
{
*mVisible = true;
return; //early exit
return true; //early exit
}
}// for each row
}// for each triangle
}// for each set of SIMD# triangles

return false;
}
@@ -35,9 +35,8 @@ class TransformedAABBoxSSE : public HelperSSE

void TransformAABBox();

void RasterizeAndDepthTestAABBox(UINT *pRenderTargetPixels);
bool RasterizeAndDepthTestAABBox(UINT *pRenderTargetPixels);

inline void SetVisible(bool *visible){mVisible = visible;}
inline void SetOccludeeSizeThreshold(float occludeeSizeThreshold){mOccludeeSizeThreshold = occludeeSizeThreshold;}

private:
@@ -46,7 +45,6 @@ class TransformedAABBoxSSE : public HelperSSE
__m128 *mpBBVertexList;
__m128 *mpXformedPos;
__m128 *mCumulativeMatrix;
bool *mVisible;
float mOccludeeSizeThreshold;
__m128 *mViewPortMatrix;

0 comments on commit 36fed2d

Please sign in to comment.