clray

changeset 11:d9a1bab1c3f5

ported to windows
author John Tsiombikas
date Sat, 31 Jul 2010 22:23:57 +0100
parents 2da57bedc550
children 85fd61f374d9
files clray.vcproj src/mesh.cc src/ocl.cc src/rt.cc
diffstat 4 files changed, 29 insertions(+), 5 deletions(-) [+]
line diff
     1.1 --- a/clray.vcproj	Fri Jul 30 19:28:18 2010 +0100
     1.2 +++ b/clray.vcproj	Sat Jul 31 22:23:57 2010 +0100
     1.3 @@ -41,7 +41,7 @@
     1.4  			<Tool
     1.5  				Name="VCCLCompilerTool"
     1.6  				Optimization="0"
     1.7 -				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
     1.8 +				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_USE_MATH_DEFINES"
     1.9  				MinimalRebuild="true"
    1.10  				BasicRuntimeChecks="3"
    1.11  				RuntimeLibrary="3"
    1.12 @@ -60,6 +60,7 @@
    1.13  			/>
    1.14  			<Tool
    1.15  				Name="VCLinkerTool"
    1.16 +				AdditionalDependencies="OpenCL.lib"
    1.17  				LinkIncremental="2"
    1.18  				GenerateDebugInformation="true"
    1.19  				SubSystem="1"
    1.20 @@ -114,7 +115,7 @@
    1.21  				Name="VCCLCompilerTool"
    1.22  				Optimization="2"
    1.23  				EnableIntrinsicFunctions="true"
    1.24 -				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
    1.25 +				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_USE_MATH_DEFINES"
    1.26  				RuntimeLibrary="2"
    1.27  				EnableFunctionLevelLinking="true"
    1.28  				UsePrecompiledHeader="0"
    1.29 @@ -132,6 +133,7 @@
    1.30  			/>
    1.31  			<Tool
    1.32  				Name="VCLinkerTool"
    1.33 +				AdditionalDependencies="OpenCL.lib"
    1.34  				LinkIncremental="1"
    1.35  				GenerateDebugInformation="true"
    1.36  				SubSystem="1"
     2.1 --- a/src/mesh.cc	Fri Jul 30 19:28:18 2010 +0100
     2.2 +++ b/src/mesh.cc	Sat Jul 31 22:23:57 2010 +0100
     2.3 @@ -8,6 +8,10 @@
     2.4  #include <map>
     2.5  #include "mesh.h"
     2.6  
     2.7 +#ifndef PATH_MAX
     2.8 +#define PATH_MAX	512
     2.9 +#endif
    2.10 +
    2.11  using namespace std;
    2.12  
    2.13  #define COMMANDS	\
     3.1 --- a/src/ocl.cc	Fri Jul 30 19:28:18 2010 +0100
     3.2 +++ b/src/ocl.cc	Sat Jul 31 22:23:57 2010 +0100
     3.3 @@ -5,7 +5,11 @@
     3.4  #include <string.h>
     3.5  #include <stdarg.h>
     3.6  #include <errno.h>
     3.7 +#ifndef _MSC_VER
     3.8  #include <alloca.h>
     3.9 +#else
    3.10 +#include <malloc.h>
    3.11 +#endif
    3.12  #include <sys/stat.h>
    3.13  #include "ocl.h"
    3.14  #include "ocl_errstr.h"
     4.1 --- a/src/rt.cc	Fri Jul 30 19:28:18 2010 +0100
     4.2 +++ b/src/rt.cc	Sat Jul 31 22:23:57 2010 +0100
     4.3 @@ -5,19 +5,33 @@
     4.4  #include "ocl.h"
     4.5  #include "mesh.h"
     4.6  
     4.7 +#ifdef __GNUC__
     4.8 +#define PACKED	__attribute__((packed))
     4.9 +#else
    4.10 +#define PACKED
    4.11 +#endif
    4.12 +
    4.13 +#ifdef _MSC_VER
    4.14 +#pragma push(pack, 1)
    4.15 +#endif
    4.16 +
    4.17  struct RendInfo {
    4.18  	int xsz, ysz;
    4.19  	int num_faces, num_lights;
    4.20  	int max_iter;
    4.21 -} __attribute__((packed));
    4.22 +} PACKED;
    4.23  
    4.24  struct Ray {
    4.25  	float origin[4], dir[4];
    4.26 -} __attribute__((packed));
    4.27 +} PACKED;
    4.28  
    4.29  struct Light {
    4.30  	float pos[4], color[4];
    4.31 -} __attribute__((packed));
    4.32 +} PACKED;
    4.33 +
    4.34 +#ifdef _MSC_VER
    4.35 +#pragma pop(pack)
    4.36 +#endif
    4.37  
    4.38  static Ray get_primary_ray(int x, int y, int w, int h, float vfov_deg);
    4.39