Text archives Help
- From: "Thiago Ize" <thiago@sci.utah.edu>
- To: manta@sci.utah.edu
- Subject: [Manta] r2043 - in trunk: Engine/Shadows Model/Groups
- Date: Thu, 7 Feb 2008 17:52:16 -0700 (MST)
Author: thiago
Date: Thu Feb 7 17:52:15 2008
New Revision: 2043
Modified:
trunk/Engine/Shadows/HardShadows.cc
trunk/Model/Groups/KDTree.cc
Log:
Model/Groups/KDTree.cc:
-check for case where sse_begin>=sse_end. Not doing
this causes uninitialized rays to be accessed.
Engine/Shadows/HardShadows.cc:
-Fixing mistake that James pointed out. This, combined
with James' previous fix, will allow for partially valid
simd groups of variables at the start of the packet to
remain as a simd group.
Modified: trunk/Engine/Shadows/HardShadows.cc
==============================================================================
--- trunk/Engine/Shadows/HardShadows.cc (original)
+++ trunk/Engine/Shadows/HardShadows.cc Thu Feb 7 17:52:15 2008
@@ -156,6 +156,7 @@
sse_t validOx=set4(0), validOy=set4(0), validOz=set4(0);
sse_t validDx=set4(0), validDy=set4(0), validDz=set4(0);
sse_t validTimes=set4(0);
+ int firstSSE = first;
for(;i<e;i+=4){
__m128 normalx = _mm_load_ps(&sourceData->ffnormal[0][i]);
__m128 normaly = _mm_load_ps(&sourceData->ffnormal[1][i]);
@@ -185,7 +186,7 @@
if (first < 0) {
// If we haven't found our first valid ray, set first to be the
// first ray that is valid.
-
+ firstSSE = i;
if (maskResults == 0) {
// All rays are valid, so just use the first one
first = i;
@@ -277,6 +278,11 @@
shadowRays.maskRay(i);
}
}
+
+ //It should be usually faster to have the ray packet be aligned
+ //to a simd boundary.
+ if (firstSSE >= 0)
+ first = firstSSE;
}
#else // ifdef MANTA_SSE
Modified: trunk/Model/Groups/KDTree.cc
==============================================================================
--- trunk/Model/Groups/KDTree.cc (original)
+++ trunk/Model/Groups/KDTree.cc Thu Feb 7 17:52:15 2008
@@ -411,6 +411,8 @@
origin = rays.getOrigin(ray_begin);
bool leading = true;
+ if (sse_begin >=sse_end)
+ leading = false;
for (int ray = ray_begin; /*no test*/ ; ++ray) {
if (leading && ray >= sse_begin) {
leading = false;
@@ -619,6 +621,9 @@
int back=0;
if (ray_begin < sse_begin || sse_end < ray_end) {
bool leading = true;
+ if (sse_begin >=sse_end)
+ leading = false;
+
for (int ray = ray_begin; /*no test*/ ; ++ray) {
if (leading && ray >= sse_begin) {
leading = false;
@@ -711,6 +716,9 @@
#ifdef SSE
if (ray_begin < sse_begin || sse_end < ray_end) {
bool leading = true;
+ if (sse_begin >=sse_end)
+ leading = false;
+
for (int ray = ray_begin; /*no test*/ ; ++ray) {
if (leading && ray >= sse_begin) {
leading = false;
@@ -779,6 +787,9 @@
#ifdef SSE
if (ray_begin < sse_begin || sse_end < ray_end) {
bool leading = true;
+ if (sse_begin >=sse_end)
+ leading = false;
+
for (int ray = ray_begin; /*no test*/ ; ++ray) {
if (leading && ray >= sse_begin) {
leading = false;
- [Manta] r2043 - in trunk: Engine/Shadows Model/Groups, Thiago Ize, 02/07/2008
Archive powered by MHonArc 2.6.16.