diff --git a/embree_ispc/embree.ispc b/embree_ispc/embree.ispc index 8dd1cba7df..c8e5b982c7 100644 --- a/embree_ispc/embree.ispc +++ b/embree_ispc/embree.ispc @@ -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 diff --git a/examples/renderer/device_ispc/framebuffers/framebuffer.ispc b/examples/renderer/device_ispc/framebuffers/framebuffer.ispc index ee285a215a..9dd106ac54 100644 --- a/examples/renderer/device_ispc/framebuffers/framebuffer.ispc +++ b/examples/renderer/device_ispc/framebuffers/framebuffer.ispc @@ -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; } diff --git a/examples/renderer/device_ispc/renderers/pathtracer.ispc b/examples/renderer/device_ispc/renderers/pathtracer.ispc index cbc4a10df4..803ed16f4d 100644 --- a/examples/renderer/device_ispc/renderers/pathtracer.ispc +++ b/examples/renderer/device_ispc/renderers/pathtracer.ispc @@ -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, diff --git a/examples/renderer/device_ispc/shapes/trianglemesh.ispc b/examples/renderer/device_ispc/shapes/trianglemesh.ispc index c37cc492c9..4e40bcb4ed 100644 --- a/examples/renderer/device_ispc/shapes/trianglemesh.ispc +++ b/examples/renderer/device_ispc/shapes/trianglemesh.ispc @@ -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; jnumTriangles; 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; jnumPositions; 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; @@ -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; iposition[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; imotion[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; inormal[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; itexcoord[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; itriangle[i] = this->triangle[i]; } return mesh; @@ -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; iposition[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; imotion[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; inormal[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; itexcoord[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; itriangle[i] = triangle[i]; } } diff --git a/examples/renderer/device_singleray/renderers/debugrenderer.cpp b/examples/renderer/device_singleray/renderers/debugrenderer.cpp index 048a3c2c99..a963ec1f70 100755 --- a/examples/renderer/device_singleray/renderers/debugrenderer.cpp +++ b/examples/renderer/device_singleray/renderers/debugrenderer.cpp @@ -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; ispp; i++) - { + //for (size_t i=0; ispp; 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; depthmaxDepth; depth++) + //for (size_t depth=0; depthmaxDepth; 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+1maxDepth) 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+1maxDepth) 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 */ @@ -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(); }