When I try to compile my project, the compiler produces these errors:
1>Signal: caught in VHO Processing phase.
1><input>(0): Error: Signal caught in phase VHO Processing -- processing aborted
1>nvopencc ERROR: C:\CUDA\bin/../open64/lib//be.exe returned non-zero status 3
Here is my command line:
nvcc.exe -ccbin "$(VCInstallDir)bin" -c [Defines] -Xcompiler "/EHsc [Warning] /nologo /Wp64 [Optimization] /Zi [RuntimeChecks] [Runtime] [TypeInfo]" [Include] -o $(ConfigurationName)\$(InputName).obj $(InputFileName)
Here is the page that produces the error:
#ifndef _RAY_TRACER_KERNEL_CU_
#define _RAY_TRACER_KERNEL_CU_
#include <cutil.h>
#include <cstdlib>
#include <cstdio>
#include <string.h>
#include <math.h>
#include "Vector.cu"
#include "Ray.cu"
#include "Camera.cu"
#include "Scene.cu"
#include "ISect.cu"
#include "Light.cu"
#include "Surface.cu"
#include "Sphere.cu"
#include "Plane.cu"
#include "SceneObject.cu"
__device__ float* Shade(ISect isect, Scene* scene, int depth, int MaxDepth);
__host__ Scene*
CreateDefaultScene()
{
SceneObject things[] =
{
Sphere( Vector(-0.5, 1, 1.5), 0.5, new MatteShinySurface ),
Sphere( Vector(0, 1, -0.25), 0.5, new ShinySurface ),
Plane( Vector(0, 1, 0), 0, new CheckerboardSurface )
};
float* color1 = new float[3];
color1[0] = 0.5; color1[1] = 0.45; color1[2] = 0.41;
float* color2 = new float[3];
color2[0] = 0.99; color2[1] = 0.95; color2[2] = 0.8;
Light lights[] =
{
Light(Vector(-2, 2.5, 0), color1),
Light(Vector(2, 4.5, 2), color2)
};
Camera* cam = Camera::Create(Vector(2.75, 2, 3.75), Vector(-0.6, 0.5, 0));
return new Scene(things, lights, cam);
}
__device__ ISect
MinIntersection(Ray ray, Scene* scene)
{
ISect min = ISect();
for(int i = 0; i < sizeof(scene->Things); i++)
{
ISect isect;
scene->Things[i].Intersect(ray, isect);
if(!ISect::IsNull(isect))
{
if(ISect::IsNull(min) || min.Dist > isect.Dist)
{
min = isect;
}
}
}
return min;
}
__device__ float RecenterX(float x, int width)
{
return (x - (width / 2.f)) / (2.f * width);
}
__device__ float RecenterY(float y, int height)
{
return (y - (height / 2.f)) / (2.f * height);
}
__device__ Vector
GetPoint(float x, float y, Camera* cam, int width, int height)
{
return Vector::Norm(Vector::Plus(cam->Forward, Vector::Plus(Vector::Times(RecenterX(x, width), cam->Right),
Vector::Times(RecenterY(y, height), cam->Up))));
}
__device__ float
TestRay(Ray ray, Scene* scene)
{
ISect isect = MinIntersection(ray, scene);
if(ISect::IsNull(isect))
return 0;
return isect.Dist;
}
__device__ float*
GetNaturalColor(SceneObject* thing, Vector pos, Vector norm, Vector rd, Scene* scene)
{
float* ret = new float[3];
ret[0] = 0;
ret[1] = 0;
ret[2] = 0;
for(int i = 0; i < sizeof(scene->Lights); i++)
{
Light light = scene->Lights[i];
Vector ldis = Vector::Minus(light.Pos, pos);
Vector livec = Vector::Norm(ldis);
Ray ray = Ray(pos, livec);
float neatIsect = TestRay(ray, scene);
bool isInShadow = !((neatIsect > Vector::Mag(ldis)) || (neatIsect == 0));
if(!isInShadow)
{
float illum = Vector::Dot(livec, norm);
float* lcolor = new float[3];
if(illum > 0) { lcolor[0] = illum * light.Color[0]; lcolor[1] = illum * light.Color[1]; lcolor[2] = illum * light.Color[2]; }
else { lcolor[0] = 0; lcolor[1] = 0; lcolor[2] = 0; }
float specular = Vector::Dot(livec, Vector::Norm(rd));
float* scolor = new float[3];
if(specular > 0) { scolor[0] = pow(specular, thing->_Surface->Roughness) * light.Color[0];
scolor[1] = pow(specular, thing->_Surface->Roughness) * light.Color[2];
scolor[2] = pow(specular, thing->_Surface->Roughness) * light.Color[2]; }
else { scolor[0] = 0; scolor[1] = 0; scolor[2] = 0; }
float* c1 = new float[3];
c1[0] = thing->_Surface->Diffuse(pos)[0] * lcolor[0];
c1[1] = thing->_Surface->Diffuse(pos)[1] * lcolor[1];
c1[2] = thing->_Surface->Diffuse(pos)[2] * lcolor[2];
float* c2 = new float[3];
c2[0] = thing->_Surface->Specular(pos)[0] * scolor[0];
c2[1] = thing->_Surface->Specular(pos)[1] * scolor[1];
c2[2] = thing->_Surface->Specular(pos)[2] * scolor[2];
float* c3 = new float[3];
c3[0] = c1[0] + c2[0];
c3[1] = c1[1] + c2[1];
c3[2] = c1[2] + c2[2];
float* retCopy = ret;
retCopy[0] = ret[0] + c3[0];
retCopy[1] = ret[1] + c3[1];
retCopy[2] = ret[2] + c3[2];
ret = retCopy;
}
}
return ret;
}
__device__ float*
_TraceRay(Ray ray, Scene* scene, int depth, int MaxDepth)
{
float* n = new float[3];
ISect isect = MinIntersection(ray, scene);
if(ISect::IsNull(isect))
{
n[0] = 0;
n[1] = 0;
n[2] = 0;
return n;
}
return Shade(isect, scene, depth, MaxDepth);
}
__device__ float*
GetReflectionColor(int MaxDepth, SceneObject* thing, Vector pos, Vector norm, Vector rd, Scene* scene, int depth)
{
float* n = new float[3];
Ray r = Ray(pos, rd);
n[0] = thing->_Surface->Reflect(pos) * _TraceRay(r, scene, depth + 1, MaxDepth)[0];
n[1] = thing->_Surface->Reflect(pos) * _TraceRay(r, scene, depth + 1, MaxDepth)[1];
n[2] = thing->_Surface->Reflect(pos) * _TraceRay(r, scene, depth + 1, MaxDepth)[2];
return n;
}
__device__ float*
Shade(ISect isect, Scene* scene, int depth, int MaxDepth)
{
Vector d = isect._Ray.Dir;
Vector pos = Vector::Plus(Vector::Times(isect.Dist, isect._Ray.Dir), isect._Ray.Start);
Vector normal = isect.Thing->Normal(pos);
Vector reflectDir = Vector::Minus(d, Vector::Times(2 * Vector::Dot(normal, d), normal));
float* ret = new float[3];
ret[0] = 0;
ret[1] = 0;
ret[2] = 0;
float* nat = GetNaturalColor(isect.Thing, pos, normal, reflectDir, scene);
float* retCopy = ret;
ret[0] = nat[0] + retCopy[0];
ret[1] = nat[1] + retCopy[1];
ret[2] = nat[2] + retCopy[2];
if(depth >= MaxDepth)
{
float* n = new float[3];
n[0] = ret[0] + 0.5;
n[1] = ret[1] + 0.5;
n[2] = ret[2] + 0.5;
return n;
}
float* q = new float[3];
q[0] = ret[0] + GetReflectionColor(MaxDepth, isect.Thing, Vector::Plus(pos, Vector::Times(0.001, reflectDir)), normal, reflectDir, scene, depth)[0];
q[1] = ret[1] + GetReflectionColor(MaxDepth, isect.Thing, Vector::Plus(pos, Vector::Times(0.001, reflectDir)), normal, reflectDir, scene, depth)[1];
q[2] = ret[2] + GetReflectionColor(MaxDepth, isect.Thing, Vector::Plus(pos, Vector::Times(0.001, reflectDir)), normal, reflectDir, scene, depth)[2];
return q;
}
__global__ void
TraceRay(Camera* cam, Scene* scene, float* color, int width, int height, int depth, int MaxDepth)
{
// TODO: calculate x, y values with corresponding thread ids
Ray ray = Ray(cam->Pos, GetPoint(2, 2, cam, width, height));
ISect isect = MinIntersection(ray, scene);
if(ISect::IsNull(isect))
{
color[0] = 0;
color[1] = 0;
color[2] = 0;
}
else
{
float* c = Shade(isect, scene, depth, MaxDepth);
color[0] = c[0];
color[1] = c[1];
color[2] = c[2];
}
}
#endif
Any ideas as to what causes this error?