Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actuallipsryme

Posted 30 March 2013 - 06:32 AM

I've got it implemented now but somehow my "negativeMask" always results to 0.

Do I have to transform center and extent to world space first ? I tried doing that using += objPos but still 0. Or do I need to do a multiply by the world matrix ?

 

UPDATE: Ah got it working! Of course I should not have added the world position to the extent rolleyes.gif

Well its down to ~0.4ms cool.png

bool RendererD3D11::FrustumCull(SceneEntityDescription* entity,
								_Plane* frustumPlanes,
								_Plane* absFrustumPlanes)
{
	_Vector3f center = static_cast<AABB*>(this->contentManager->GetPrimitiveFromPool(entity->ID)->GetBoundingVolume())->Volume().center;
	_Vector3f extent = static_cast<AABB*>(this->contentManager->GetPrimitiveFromPool(entity->ID)->GetBoundingVolume())->Volume().extent;
	_Vector3f objPos;
	objPos.x = entity->worldPosition.x;
	objPos.y = entity->worldPosition.y;
	objPos.z = entity->worldPosition.z;

	center.x += objPos.x;
	center.y += objPos.y;
	center.z += objPos.z;

        // this was wrong...
        //**************************
	//* extent.x += objPos.x;
	//* extent.y += objPos.y;
	//* extent.z += objPos.z;
        //**************************

	__m128 xmm_aabbCenter_x = _mm_load_ss(&center.x);
	__m128 xmm_aabbCenter_y = _mm_load_ss(&center.y);
	__m128 xmm_aabbCenter_z = _mm_load_ss(&center.z);
	__m128 xmm_aabbExtent_x = _mm_load_ss(&extent.x);
	__m128 xmm_aabbExtent_y = _mm_load_ss(&extent.y);
	__m128 xmm_aabbExtent_z = _mm_load_ss(&extent.z);
	
	for(unsigned int iPlane = 0;iPlane < 6;++iPlane)
	{
		__m128 xmm_frustumPlane_Component = _mm_load_ss(&frustumPlanes[iPlane].nx);
		__m128 xmm_d = _mm_mul_ss(xmm_aabbCenter_x, xmm_frustumPlane_Component);

		xmm_frustumPlane_Component = _mm_load_ss(&frustumPlanes[iPlane].ny);
		xmm_d = _mm_add_ss(xmm_d, _mm_mul_ss(xmm_aabbCenter_y, xmm_frustumPlane_Component));

		xmm_frustumPlane_Component = _mm_load_ss(&frustumPlanes[iPlane].nz);
		xmm_d = _mm_add_ss(xmm_d, _mm_mul_ss(xmm_aabbCenter_z, xmm_frustumPlane_Component));

		__m128 xmm_absFrustumPlane_Component = _mm_load_ss(&absFrustumPlanes[iPlane].nx);
		__m128 xmm_r = _mm_mul_ss(xmm_aabbExtent_x, xmm_absFrustumPlane_Component);

		xmm_absFrustumPlane_Component = _mm_load_ss(&absFrustumPlanes[iPlane].ny);
		xmm_r = _mm_add_ss(xmm_r, _mm_mul_ss(xmm_aabbExtent_y, xmm_absFrustumPlane_Component));

		xmm_absFrustumPlane_Component = _mm_load_ss(&absFrustumPlanes[iPlane].nz);
		xmm_r = _mm_add_ss(xmm_r, _mm_mul_ss(xmm_aabbExtent_z, xmm_absFrustumPlane_Component));

		__m128 xmm_frustumPlane_d = _mm_load_ss(&frustumPlanes[iPlane].d);
		__m128 xmm_d_p_r = _mm_add_ss(_mm_add_ss(xmm_d, xmm_r), xmm_frustumPlane_d);
		__m128 xmm_d_m_r = _mm_add_ss(_mm_add_ss(xmm_d, xmm_r), xmm_frustumPlane_d);

		// Shuffle d_p_r and d_m_r in order to perform only one _mm_movmask_ps
		__m128 xmm_d_p_r__d_m_r = _mm_shuffle_ps(xmm_d_p_r, xmm_d_m_r, _MM_SHUFFLE(0, 0, 0, 0));
		int negativeMask = _mm_movemask_ps(xmm_d_p_r__d_m_r);

		// Bit 0 holds the sign of d + r and bit 2 holds the sign of d - r
		if(negativeMask & 0x01)
		{
			return true; // Outside
		}
		else if(negativeMask & 0x04)
		{
			return false; // Intersect
		}
	}


	return false;
}

#8lipsryme

Posted 30 March 2013 - 06:32 AM

I've got it implemented now but somehow my "negativeMask" always results to 0.

Do I have to transform center and extent to world space first ? I tried doing that using += objPos but still 0. Or do I need to do a multiply by the world matrix ?

 

UPDATE: Ah got it working! Of course I should not have added the world position to the extent rolleyes.gif

Well its down to 0.4 - 0.6ms cool.png

bool RendererD3D11::FrustumCull(SceneEntityDescription* entity,
								_Plane* frustumPlanes,
								_Plane* absFrustumPlanes)
{
	_Vector3f center = static_cast<AABB*>(this->contentManager->GetPrimitiveFromPool(entity->ID)->GetBoundingVolume())->Volume().center;
	_Vector3f extent = static_cast<AABB*>(this->contentManager->GetPrimitiveFromPool(entity->ID)->GetBoundingVolume())->Volume().extent;
	_Vector3f objPos;
	objPos.x = entity->worldPosition.x;
	objPos.y = entity->worldPosition.y;
	objPos.z = entity->worldPosition.z;

	center.x += objPos.x;
	center.y += objPos.y;
	center.z += objPos.z;

        // this was wrong...
        //**************************
	//* extent.x += objPos.x;
	//* extent.y += objPos.y;
	//* extent.z += objPos.z;
        //**************************

	__m128 xmm_aabbCenter_x = _mm_load_ss(&center.x);
	__m128 xmm_aabbCenter_y = _mm_load_ss(&center.y);
	__m128 xmm_aabbCenter_z = _mm_load_ss(&center.z);
	__m128 xmm_aabbExtent_x = _mm_load_ss(&extent.x);
	__m128 xmm_aabbExtent_y = _mm_load_ss(&extent.y);
	__m128 xmm_aabbExtent_z = _mm_load_ss(&extent.z);
	
	for(unsigned int iPlane = 0;iPlane < 6;++iPlane)
	{
		__m128 xmm_frustumPlane_Component = _mm_load_ss(&frustumPlanes[iPlane].nx);
		__m128 xmm_d = _mm_mul_ss(xmm_aabbCenter_x, xmm_frustumPlane_Component);

		xmm_frustumPlane_Component = _mm_load_ss(&frustumPlanes[iPlane].ny);
		xmm_d = _mm_add_ss(xmm_d, _mm_mul_ss(xmm_aabbCenter_y, xmm_frustumPlane_Component));

		xmm_frustumPlane_Component = _mm_load_ss(&frustumPlanes[iPlane].nz);
		xmm_d = _mm_add_ss(xmm_d, _mm_mul_ss(xmm_aabbCenter_z, xmm_frustumPlane_Component));

		__m128 xmm_absFrustumPlane_Component = _mm_load_ss(&absFrustumPlanes[iPlane].nx);
		__m128 xmm_r = _mm_mul_ss(xmm_aabbExtent_x, xmm_absFrustumPlane_Component);

		xmm_absFrustumPlane_Component = _mm_load_ss(&absFrustumPlanes[iPlane].ny);
		xmm_r = _mm_add_ss(xmm_r, _mm_mul_ss(xmm_aabbExtent_y, xmm_absFrustumPlane_Component));

		xmm_absFrustumPlane_Component = _mm_load_ss(&absFrustumPlanes[iPlane].nz);
		xmm_r = _mm_add_ss(xmm_r, _mm_mul_ss(xmm_aabbExtent_z, xmm_absFrustumPlane_Component));

		__m128 xmm_frustumPlane_d = _mm_load_ss(&frustumPlanes[iPlane].d);
		__m128 xmm_d_p_r = _mm_add_ss(_mm_add_ss(xmm_d, xmm_r), xmm_frustumPlane_d);
		__m128 xmm_d_m_r = _mm_add_ss(_mm_add_ss(xmm_d, xmm_r), xmm_frustumPlane_d);

		// Shuffle d_p_r and d_m_r in order to perform only one _mm_movmask_ps
		__m128 xmm_d_p_r__d_m_r = _mm_shuffle_ps(xmm_d_p_r, xmm_d_m_r, _MM_SHUFFLE(0, 0, 0, 0));
		int negativeMask = _mm_movemask_ps(xmm_d_p_r__d_m_r);

		// Bit 0 holds the sign of d + r and bit 2 holds the sign of d - r
		if(negativeMask & 0x01)
		{
			return true; // Outside
		}
		else if(negativeMask & 0x04)
		{
			return false; // Intersect
		}
	}


	return false;
}

#7lipsryme

Posted 30 March 2013 - 06:32 AM

I've got it implemented now but somehow my "negativeMask" always results to 0.

Do I have to transform center and extent to world space first ? I tried doing that using += objPos but still 0. Or do I need to do a multiply by the world matrix ?

 

UPDATE: Ah got it working! Of course I should not have added the world position to the extent rolleyes.gif

Well its down to 0.4 - 0.6ms.

bool RendererD3D11::FrustumCull(SceneEntityDescription* entity,
								_Plane* frustumPlanes,
								_Plane* absFrustumPlanes)
{
	_Vector3f center = static_cast<AABB*>(this->contentManager->GetPrimitiveFromPool(entity->ID)->GetBoundingVolume())->Volume().center;
	_Vector3f extent = static_cast<AABB*>(this->contentManager->GetPrimitiveFromPool(entity->ID)->GetBoundingVolume())->Volume().extent;
	_Vector3f objPos;
	objPos.x = entity->worldPosition.x;
	objPos.y = entity->worldPosition.y;
	objPos.z = entity->worldPosition.z;

	center.x += objPos.x;
	center.y += objPos.y;
	center.z += objPos.z;

        // this was wrong...
        //**************************
	//* extent.x += objPos.x;
	//* extent.y += objPos.y;
	//* extent.z += objPos.z;
        //**************************

	__m128 xmm_aabbCenter_x = _mm_load_ss(&center.x);
	__m128 xmm_aabbCenter_y = _mm_load_ss(&center.y);
	__m128 xmm_aabbCenter_z = _mm_load_ss(&center.z);
	__m128 xmm_aabbExtent_x = _mm_load_ss(&extent.x);
	__m128 xmm_aabbExtent_y = _mm_load_ss(&extent.y);
	__m128 xmm_aabbExtent_z = _mm_load_ss(&extent.z);
	
	for(unsigned int iPlane = 0;iPlane < 6;++iPlane)
	{
		__m128 xmm_frustumPlane_Component = _mm_load_ss(&frustumPlanes[iPlane].nx);
		__m128 xmm_d = _mm_mul_ss(xmm_aabbCenter_x, xmm_frustumPlane_Component);

		xmm_frustumPlane_Component = _mm_load_ss(&frustumPlanes[iPlane].ny);
		xmm_d = _mm_add_ss(xmm_d, _mm_mul_ss(xmm_aabbCenter_y, xmm_frustumPlane_Component));

		xmm_frustumPlane_Component = _mm_load_ss(&frustumPlanes[iPlane].nz);
		xmm_d = _mm_add_ss(xmm_d, _mm_mul_ss(xmm_aabbCenter_z, xmm_frustumPlane_Component));

		__m128 xmm_absFrustumPlane_Component = _mm_load_ss(&absFrustumPlanes[iPlane].nx);
		__m128 xmm_r = _mm_mul_ss(xmm_aabbExtent_x, xmm_absFrustumPlane_Component);

		xmm_absFrustumPlane_Component = _mm_load_ss(&absFrustumPlanes[iPlane].ny);
		xmm_r = _mm_add_ss(xmm_r, _mm_mul_ss(xmm_aabbExtent_y, xmm_absFrustumPlane_Component));

		xmm_absFrustumPlane_Component = _mm_load_ss(&absFrustumPlanes[iPlane].nz);
		xmm_r = _mm_add_ss(xmm_r, _mm_mul_ss(xmm_aabbExtent_z, xmm_absFrustumPlane_Component));

		__m128 xmm_frustumPlane_d = _mm_load_ss(&frustumPlanes[iPlane].d);
		__m128 xmm_d_p_r = _mm_add_ss(_mm_add_ss(xmm_d, xmm_r), xmm_frustumPlane_d);
		__m128 xmm_d_m_r = _mm_add_ss(_mm_add_ss(xmm_d, xmm_r), xmm_frustumPlane_d);

		// Shuffle d_p_r and d_m_r in order to perform only one _mm_movmask_ps
		__m128 xmm_d_p_r__d_m_r = _mm_shuffle_ps(xmm_d_p_r, xmm_d_m_r, _MM_SHUFFLE(0, 0, 0, 0));
		int negativeMask = _mm_movemask_ps(xmm_d_p_r__d_m_r);

		// Bit 0 holds the sign of d + r and bit 2 holds the sign of d - r
		if(negativeMask & 0x01)
		{
			return true; // Outside
		}
		else if(negativeMask & 0x04)
		{
			return false; // Intersect
		}
	}


	return false;
}

#6lipsryme

Posted 30 March 2013 - 06:14 AM

I've got it implemented now but somehow my "negativeMask" always results to 0.

Do I have to transform center and extent to world space first ? I tried doing that using += objPos but still 0. Or do I need to do a multiply by the world matrix ?

 

UPDATE: Ah got it working! Of course I should not have added the world position to the extent rolleyes.gif

Well its down to 0.6ms.

bool RendererD3D11::FrustumCull(SceneEntityDescription* entity,
								_Plane* frustumPlanes,
								_Plane* absFrustumPlanes)
{
	_Vector3f center = static_cast<AABB*>(this->contentManager->GetPrimitiveFromPool(entity->ID)->GetBoundingVolume())->Volume().center;
	_Vector3f extent = static_cast<AABB*>(this->contentManager->GetPrimitiveFromPool(entity->ID)->GetBoundingVolume())->Volume().extent;
	_Vector3f objPos;
	objPos.x = entity->worldPosition.x;
	objPos.y = entity->worldPosition.y;
	objPos.z = entity->worldPosition.z;

	center.x += objPos.x;
	center.y += objPos.y;
	center.z += objPos.z;

        // this was wrong...
        //**************************
	//* extent.x += objPos.x;
	//* extent.y += objPos.y;
	//* extent.z += objPos.z;
        //**************************

	__m128 xmm_aabbCenter_x = _mm_load_ss(&center.x);
	__m128 xmm_aabbCenter_y = _mm_load_ss(&center.y);
	__m128 xmm_aabbCenter_z = _mm_load_ss(&center.z);
	__m128 xmm_aabbExtent_x = _mm_load_ss(&extent.x);
	__m128 xmm_aabbExtent_y = _mm_load_ss(&extent.y);
	__m128 xmm_aabbExtent_z = _mm_load_ss(&extent.z);
	
	for(unsigned int iPlane = 0;iPlane < 6;++iPlane)
	{
		__m128 xmm_frustumPlane_Component = _mm_load_ss(&frustumPlanes[iPlane].nx);
		__m128 xmm_d = _mm_mul_ss(xmm_aabbCenter_x, xmm_frustumPlane_Component);

		xmm_frustumPlane_Component = _mm_load_ss(&frustumPlanes[iPlane].ny);
		xmm_d = _mm_add_ss(xmm_d, _mm_mul_ss(xmm_aabbCenter_y, xmm_frustumPlane_Component));

		xmm_frustumPlane_Component = _mm_load_ss(&frustumPlanes[iPlane].nz);
		xmm_d = _mm_add_ss(xmm_d, _mm_mul_ss(xmm_aabbCenter_z, xmm_frustumPlane_Component));

		__m128 xmm_absFrustumPlane_Component = _mm_load_ss(&absFrustumPlanes[iPlane].nx);
		__m128 xmm_r = _mm_mul_ss(xmm_aabbExtent_x, xmm_absFrustumPlane_Component);

		xmm_absFrustumPlane_Component = _mm_load_ss(&absFrustumPlanes[iPlane].ny);
		xmm_r = _mm_add_ss(xmm_r, _mm_mul_ss(xmm_aabbExtent_y, xmm_absFrustumPlane_Component));

		xmm_absFrustumPlane_Component = _mm_load_ss(&absFrustumPlanes[iPlane].nz);
		xmm_r = _mm_add_ss(xmm_r, _mm_mul_ss(xmm_aabbExtent_z, xmm_absFrustumPlane_Component));

		__m128 xmm_frustumPlane_d = _mm_load_ss(&frustumPlanes[iPlane].d);
		__m128 xmm_d_p_r = _mm_add_ss(_mm_add_ss(xmm_d, xmm_r), xmm_frustumPlane_d);
		__m128 xmm_d_m_r = _mm_add_ss(_mm_add_ss(xmm_d, xmm_r), xmm_frustumPlane_d);

		// Shuffle d_p_r and d_m_r in order to perform only one _mm_movmask_ps
		__m128 xmm_d_p_r__d_m_r = _mm_shuffle_ps(xmm_d_p_r, xmm_d_m_r, _MM_SHUFFLE(0, 0, 0, 0));
		int negativeMask = _mm_movemask_ps(xmm_d_p_r__d_m_r);

		// Bit 0 holds the sign of d + r and bit 2 holds the sign of d - r
		if(negativeMask & 0x01)
		{
			return true; // Outside
		}
		else if(negativeMask & 0x04)
		{
			return false; // Intersect
		}
	}


	return false;
}

#5lipsryme

Posted 30 March 2013 - 06:10 AM

I've got it implemented now but somehow my "negativeMask" always results to 0.

Do I have to transform center and extent to world space first ? I tried doing that using += objPos but still 0. Or do I need to do a multiply by the world matrix ?

 

UPDATE: Ah got it working! Of course I should not have added the world position to the extent rolleyes.gif

bool RendererD3D11::FrustumCull(SceneEntityDescription* entity,
								_Plane* frustumPlanes,
								_Plane* absFrustumPlanes)
{
	_Vector3f center = static_cast<AABB*>(this->contentManager->GetPrimitiveFromPool(entity->ID)->GetBoundingVolume())->Volume().center;
	_Vector3f extent = static_cast<AABB*>(this->contentManager->GetPrimitiveFromPool(entity->ID)->GetBoundingVolume())->Volume().extent;
	_Vector3f objPos;
	objPos.x = entity->worldPosition.x;
	objPos.y = entity->worldPosition.y;
	objPos.z = entity->worldPosition.z;

	center.x += objPos.x;
	center.y += objPos.y;
	center.z += objPos.z;

        // this was wrong...
        //**************************
	//* extent.x += objPos.x;
	//* extent.y += objPos.y;
	//* extent.z += objPos.z;
        //**************************

	__m128 xmm_aabbCenter_x = _mm_load_ss(&center.x);
	__m128 xmm_aabbCenter_y = _mm_load_ss(&center.y);
	__m128 xmm_aabbCenter_z = _mm_load_ss(&center.z);
	__m128 xmm_aabbExtent_x = _mm_load_ss(&extent.x);
	__m128 xmm_aabbExtent_y = _mm_load_ss(&extent.y);
	__m128 xmm_aabbExtent_z = _mm_load_ss(&extent.z);
	
	for(unsigned int iPlane = 0;iPlane < 6;++iPlane)
	{
		__m128 xmm_frustumPlane_Component = _mm_load_ss(&frustumPlanes[iPlane].nx);
		__m128 xmm_d = _mm_mul_ss(xmm_aabbCenter_x, xmm_frustumPlane_Component);

		xmm_frustumPlane_Component = _mm_load_ss(&frustumPlanes[iPlane].ny);
		xmm_d = _mm_add_ss(xmm_d, _mm_mul_ss(xmm_aabbCenter_y, xmm_frustumPlane_Component));

		xmm_frustumPlane_Component = _mm_load_ss(&frustumPlanes[iPlane].nz);
		xmm_d = _mm_add_ss(xmm_d, _mm_mul_ss(xmm_aabbCenter_z, xmm_frustumPlane_Component));

		__m128 xmm_absFrustumPlane_Component = _mm_load_ss(&absFrustumPlanes[iPlane].nx);
		__m128 xmm_r = _mm_mul_ss(xmm_aabbExtent_x, xmm_absFrustumPlane_Component);

		xmm_absFrustumPlane_Component = _mm_load_ss(&absFrustumPlanes[iPlane].ny);
		xmm_r = _mm_add_ss(xmm_r, _mm_mul_ss(xmm_aabbExtent_y, xmm_absFrustumPlane_Component));

		xmm_absFrustumPlane_Component = _mm_load_ss(&absFrustumPlanes[iPlane].nz);
		xmm_r = _mm_add_ss(xmm_r, _mm_mul_ss(xmm_aabbExtent_z, xmm_absFrustumPlane_Component));

		__m128 xmm_frustumPlane_d = _mm_load_ss(&frustumPlanes[iPlane].d);
		__m128 xmm_d_p_r = _mm_add_ss(_mm_add_ss(xmm_d, xmm_r), xmm_frustumPlane_d);
		__m128 xmm_d_m_r = _mm_add_ss(_mm_add_ss(xmm_d, xmm_r), xmm_frustumPlane_d);

		// Shuffle d_p_r and d_m_r in order to perform only one _mm_movmask_ps
		__m128 xmm_d_p_r__d_m_r = _mm_shuffle_ps(xmm_d_p_r, xmm_d_m_r, _MM_SHUFFLE(0, 0, 0, 0));
		int negativeMask = _mm_movemask_ps(xmm_d_p_r__d_m_r);

		// Bit 0 holds the sign of d + r and bit 2 holds the sign of d - r
		if(negativeMask & 0x01)
		{
			return true; // Outside
		}
		else if(negativeMask & 0x04)
		{
			return false; // Intersect
		}
	}


	return false;
}

#4lipsryme

Posted 30 March 2013 - 06:10 AM

I've got it implemented now but somehow my "negativeMask" always results to 0.

Do I have to transform center and extent to world space first ? I tried doing that using += objPos but still 0. Or do I need to do a multiply by the world matrix ?

 

UPDATE: Ah got it working! Of course I should not have added the world position to the extent rolleyes.gif

bool RendererD3D11::FrustumCull(SceneEntityDescription* entity,
								_Plane* frustumPlanes,
								_Plane* absFrustumPlanes)
{
	_Vector3f center = static_cast<AABB*>(this->contentManager->GetPrimitiveFromPool(entity->ID)->GetBoundingVolume())->Volume().center;
	_Vector3f extent = static_cast<AABB*>(this->contentManager->GetPrimitiveFromPool(entity->ID)->GetBoundingVolume())->Volume().extent;
	_Vector3f objPos;
	objPos.x = entity->worldPosition.x;
	objPos.y = entity->worldPosition.y;
	objPos.z = entity->worldPosition.z;

	center.x += objPos.x;
	center.y += objPos.y;
	center.z += objPos.z;

        // this was wrong...
        // -----------------------
	extent.x += objPos.x;
	extent.y += objPos.y;
	extent.z += objPos.z;
        // -----------------------

	__m128 xmm_aabbCenter_x = _mm_load_ss(&center.x);
	__m128 xmm_aabbCenter_y = _mm_load_ss(&center.y);
	__m128 xmm_aabbCenter_z = _mm_load_ss(&center.z);
	__m128 xmm_aabbExtent_x = _mm_load_ss(&extent.x);
	__m128 xmm_aabbExtent_y = _mm_load_ss(&extent.y);
	__m128 xmm_aabbExtent_z = _mm_load_ss(&extent.z);
	
	for(unsigned int iPlane = 0;iPlane < 6;++iPlane)
	{
		__m128 xmm_frustumPlane_Component = _mm_load_ss(&frustumPlanes[iPlane].nx);
		__m128 xmm_d = _mm_mul_ss(xmm_aabbCenter_x, xmm_frustumPlane_Component);

		xmm_frustumPlane_Component = _mm_load_ss(&frustumPlanes[iPlane].ny);
		xmm_d = _mm_add_ss(xmm_d, _mm_mul_ss(xmm_aabbCenter_y, xmm_frustumPlane_Component));

		xmm_frustumPlane_Component = _mm_load_ss(&frustumPlanes[iPlane].nz);
		xmm_d = _mm_add_ss(xmm_d, _mm_mul_ss(xmm_aabbCenter_z, xmm_frustumPlane_Component));

		__m128 xmm_absFrustumPlane_Component = _mm_load_ss(&absFrustumPlanes[iPlane].nx);
		__m128 xmm_r = _mm_mul_ss(xmm_aabbExtent_x, xmm_absFrustumPlane_Component);

		xmm_absFrustumPlane_Component = _mm_load_ss(&absFrustumPlanes[iPlane].ny);
		xmm_r = _mm_add_ss(xmm_r, _mm_mul_ss(xmm_aabbExtent_y, xmm_absFrustumPlane_Component));

		xmm_absFrustumPlane_Component = _mm_load_ss(&absFrustumPlanes[iPlane].nz);
		xmm_r = _mm_add_ss(xmm_r, _mm_mul_ss(xmm_aabbExtent_z, xmm_absFrustumPlane_Component));

		__m128 xmm_frustumPlane_d = _mm_load_ss(&frustumPlanes[iPlane].d);
		__m128 xmm_d_p_r = _mm_add_ss(_mm_add_ss(xmm_d, xmm_r), xmm_frustumPlane_d);
		__m128 xmm_d_m_r = _mm_add_ss(_mm_add_ss(xmm_d, xmm_r), xmm_frustumPlane_d);

		// Shuffle d_p_r and d_m_r in order to perform only one _mm_movmask_ps
		__m128 xmm_d_p_r__d_m_r = _mm_shuffle_ps(xmm_d_p_r, xmm_d_m_r, _MM_SHUFFLE(0, 0, 0, 0));
		int negativeMask = _mm_movemask_ps(xmm_d_p_r__d_m_r);

		// Bit 0 holds the sign of d + r and bit 2 holds the sign of d - r
		if(negativeMask & 0x01)
		{
			return true; // Outside
		}
		else if(negativeMask & 0x04)
		{
			return false; // Intersect
		}
	}


	return false;
}

PARTNERS