Skip to content

Commit

Permalink
compile fixes for ISPC 1.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
svenwoop committed May 7, 2015
1 parent fd7f530 commit 3821c62
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 33 deletions.
6 changes: 3 additions & 3 deletions embree_ispc/embree.ispc
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ void rtcSetVirtualGeometryBounds (uniform RTCGeometry* uniform geom, const unifo

void rtcSetVirtualGeometryIntersector (uniform RTCGeometry* uniform geom, const uniform int i, const uniform Intersector* uniform intersector) {
#if defined (__SSE4__)
rtcISPCSetVirtualGeometryIntersector4(geom, i, intersector);
rtcISPCSetVirtualGeometryIntersector4((void* uniform)geom, i, (void* uniform)intersector);
#elif defined (__AVX__)
rtcISPCSetVirtualGeometryIntersector8(geom, i, intersector);
rtcISPCSetVirtualGeometryIntersector8((void* uniform)geom, i, (void* uniform) intersector);
#elif defined(__MIC__)
rtcISPCSetVirtualGeometryIntersector16(geom, i, intersector);
rtcISPCSetVirtualGeometryIntersector16((void* uniform)geom, i, (void* uniform)intersector);
#else
# error "Unsupported SIMD configuration."
#endif
Expand Down
4 changes: 2 additions & 2 deletions examples/renderer/device_ispc/framebuffers/framebuffer.ispc
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ void FrameBuffer__Constructor(uniform FrameBuffer* uniform this,
RefCount__Constructor(&this->base,destructor);
this->size.x = width;
this->size.y = height;
this->invSize.x = rcp(width);
this->invSize.y = rcp(height);
this->invSize.x = rcp((uniform float)width);
this->invSize.y = rcp((uniform float)height);
this->set = set;
this->map = map;
}
2 changes: 1 addition & 1 deletion examples/renderer/device_ispc/renderers/pathtracer.ispc
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ inline vec3f PathTracer__renderPixel(const uniform PathTracer* uniform this,
LightPath lightPath; init_LightPath(lightPath,ray);
L = add(L, PathTraceIntegrator_Li(this,screenSample,lightPath,scene,sample,numRays));
}
return mul(L, rcp(this->spp));
return mul(L, rcp((float)this->spp));
}

task void PathTracer__renderTile(uniform PathTracer* uniform this,
Expand Down
40 changes: 26 additions & 14 deletions examples/renderer/device_ispc/shapes/trianglemesh.ispc
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,18 @@ void TriangleMesh__extract(const uniform Shape* uniform _this,

vec3f lower = make_vec3f(+inf);
vec3f upper = make_vec3f(-inf);
foreach(j=0 ... this->numTriangles) {
const vec4i tri = this->triangle[j];
//foreach(j=0 ... this->numTriangles) {
for(uniform int j=0; j<this->numTriangles; j++) {
const uniform vec4i tri = this->triangle[j];
triangles[numTriangles+j].v0 = numVertices+tri.x;
triangles[numTriangles+j].v1 = numVertices+tri.y;
triangles[numTriangles+j].v2 = numVertices+tri.z;
triangles[numTriangles+j].id0 = id0;
triangles[numTriangles+j].id1 = j;
}
foreach(j=0 ... this->numPositions) {
const vec3f p = make_vec3f(this->position[j]);
//foreach(j=0 ... this->numPositions) {
for(uniform int j=0; j<this->numPositions; j++) {
const uniform vec3f p = make_vec3f(this->position[j]);
vertices[numVertices+j].x = p.x;
vertices[numVertices+j].y = p.y;
vertices[numVertices+j].z = p.z;
Expand Down Expand Up @@ -162,32 +164,37 @@ void* uniform TriangleMesh__transform(const uniform Shape* uniform _this, const

if (this->position) {
mesh->position = uniform new uniform vec3fa[numVertices];
foreach(i=0 ... numVertices)
//foreach(i=0 ... numVertices)
for(uniform int i=0; i<numVertices; i++)
mesh->position[i] = make_vec3fa(xfmPoint(xfm,make_vec3f(this->position[i])));
}

if (this->motion) {
mesh->motion = uniform new uniform vec3fa[numVertices];
foreach(i=0 ... numVertices)
//foreach(i=0 ... numVertices)
for(uniform int i=0; i<numVertices; i++)
mesh->motion[i] = make_vec3fa(xfmVector(xfm,make_vec3f(this->motion[i])));
}

if (this->normal) {
uniform LinearSpace3f normal2world = transposed(rcp(xfm.l));
mesh->normal = uniform new uniform vec3fa[numVertices];
foreach(i=0 ... numVertices)
//foreach(i=0 ... numVertices)
for(uniform int i=0; i<numVertices; i++)
mesh->normal[i] = make_vec3fa(xfmVector(normal2world,make_vec3f(this->normal[i])));
}

if (this->texcoord) {
mesh->texcoord = uniform new uniform vec2f[numVertices];
foreach(i=0 ... numVertices)
//foreach(i=0 ... numVertices)
for(uniform int i=0; i<numVertices; i++)
mesh->texcoord[i] = this->texcoord[i];
}

if (this->triangle) {
mesh->triangle = uniform new uniform vec4i[numTriangles];
foreach(i=0 ... numTriangles)
//foreach(i=0 ... numTriangles)
for(uniform int i=0; i<numTriangles; i++)
mesh->triangle[i] = this->triangle[i];
}
return mesh;
Expand Down Expand Up @@ -220,31 +227,36 @@ void TriangleMesh__Constructor(uniform TriangleMesh* uniform this,

if (position) {
this->position = uniform new uniform vec3fa[numVertices];
foreach(i=0 ... numVertices)
//foreach(i=0 ... numVertices)
for(uniform int i=0; i<numVertices; i++)
this->position[i] = position[i];
}

if (motion) {
this->motion = uniform new uniform vec3fa[numVertices];
foreach(i=0 ... numVertices)
//foreach(i=0 ... numVertices)
for(uniform int i=0; i<numVertices; i++)
this->motion[i] = motion[i];
}

if (normal) {
this->normal = uniform new uniform vec3fa[numVertices];
foreach(i=0 ... numVertices)
//foreach(i=0 ... numVertices)
for(uniform int i=0; i<numVertices; i++)
this->normal[i] = normal[i];
}

if (texcoord) {
this->texcoord = uniform new uniform vec2f[numVertices];
foreach(i=0 ... numVertices)
//foreach(i=0 ... numVertices)
for(uniform int i=0; i<numVertices; i++)
this->texcoord[i] = texcoord[i];
}

if (triangle) {
this->triangle = uniform new uniform vec4i[numTriangles];
foreach(i=0 ... numTriangles)
//foreach(i=0 ... numTriangles)
for(uniform int i=0; i<numTriangles; i++)
this->triangle[i] = triangle[i];
}
}
Expand Down
27 changes: 14 additions & 13 deletions examples/renderer/device_singleray/renderers/debugrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,22 +97,23 @@ namespace embree
size_t ix = x0+dx; float fx = ix*rcpWidth;
if (ix >= framebuffer->getWidth()) continue;

for (size_t i=0; i<renderer->spp; i++)
{
//for (size_t i=0; i<renderer->spp; i++)
//{
/*! create primary ray */
Ray ray; camera->ray(Vec2f(fx,fy), Vec2f(rand.getFloat(),rand.getFloat()), ray);
//Ray ray; camera->ray(Vec2f(fx,fy), Vec2f(rand.getFloat(),rand.getFloat()), ray);
Ray ray; camera->ray(Vec2f(fx,fy), Vec2f(zero), ray);

for (size_t depth=0; depth<renderer->maxDepth; depth++)
//for (size_t depth=0; depth<renderer->maxDepth; depth++)
{
/*! shoot current ray */
scene->intersector->intersect(ray);
numRays++;
if (!ray) break;
//if (!ray) break;

/*! compute new ray through diffuse bounce */
Vector3f Nf = normalize(ray.Ng);
if (dot(-ray.dir,Nf) < 0) Nf = -Nf;
if (depth+1<renderer->maxDepth) new (&ray) Ray(ray.org+0.999f*ray.tfar*ray.dir,cosineSampleHemisphere(rand.getFloat(),rand.getFloat(),Nf),4.0f*float(ulp)/**hit.error*/);
//Vector3f Nf = normalize(ray.Ng);
//if (dot(-ray.dir,Nf) < 0) Nf = -Nf;
//if (depth+1<renderer->maxDepth) new (&ray) Ray(ray.org+0.999f*ray.tfar*ray.dir,cosineSampleHemisphere(rand.getFloat(),rand.getFloat(),Nf),4.0f*float(ulp)/**hit.error*/);
}

/*! update framebuffer */
Expand All @@ -123,15 +124,15 @@ namespace embree
framebuffer->set(ix,iy,Color(abs(hit.Ng.x),abs(hit.Ng.y),abs(hit.Ng.z)));
}*/
//else framebuffer->set(ix,iy,Color(clamp(dot(ray.dir,normalize(hit.Ng))),0,0));
//else framebuffer->set(ix,iy,Color(hit.u,hit.v,1.0f-hit.u-hit.v));
else framebuffer->set(ix,iy,Color(ray.u,ray.v,1.0f-ray.u-ray.v));
//else framebuffer->get(ix,iy) = Vec4f(hit.st.x,hit.st.y,1.0f-hit.st.x-hit.st.y,1.0f);
//else framebuffer->get(ix,iy) = Vec4f(hit.st.x,0,0,1.0f);
//else framebuffer->get(ix,iy) = Vec4f(abs(dot(ray.dir,normalize(hit.dPds))),0,0,1.0f);
else framebuffer->set(ix,iy,Color(((3434553*((unsigned)(ray.id0+ray.id1+3243)))%255)/255.0f,
((7342453*((unsigned)(ray.id0+ray.id1+8237)))%255)/255.0f,
((9234454*((unsigned)(ray.id0+ray.id1+2343)))%255)/255.0f));
//else framebuffer->set(ix,iy,Color(((3434553*((unsigned)(ray.id0+ray.id1+3243)))%255)/255.0f,
// ((7342453*((unsigned)(ray.id0+ray.id1+8237)))%255)/255.0f,
// ((9234454*((unsigned)(ray.id0+ray.id1+2343)))%255)/255.0f));
}
}
//}
}
framebuffer->finishTile();
}
Expand Down

0 comments on commit 3821c62

Please sign in to comment.