fix Linux build

This commit is contained in:
erwincoumans
2013-06-17 21:57:04 -07:00
parent 9a92eecf10
commit 227d88f553
4 changed files with 12 additions and 9 deletions

View File

@@ -16,6 +16,11 @@ subject to the following restrictions:
#include "OpenGLInclude.h" #include "OpenGLInclude.h"
#ifndef glDrawElementsInstanced
#define glDrawElementsInstanced glDrawElementsInstancedARB
#endif
#include "GLInstancingRenderer.h" #include "GLInstancingRenderer.h"
#include <string.h> #include <string.h>

View File

@@ -41,7 +41,7 @@ bool gDebugSkipLoadingBinary = false;
#include <assert.h> #include <assert.h>
#define b3Assert assert #define b3Assert assert
#ifdef __APPLE__ #ifndef _WIN32
#include <sys/stat.h> #include <sys/stat.h>
#endif #endif
@@ -752,7 +752,6 @@ cl_program b3OpenCLUtils_compileCLProgramFromString(cl_context clContext, cl_dev
#else #else
fileUpToDate = true; fileUpToDate = true;
#ifdef __APPLE__
if (mkdir(sCachedBinaryPath,0777) == -1) if (mkdir(sCachedBinaryPath,0777) == -1)
{ {
} }
@@ -760,7 +759,6 @@ cl_program b3OpenCLUtils_compileCLProgramFromString(cl_context clContext, cl_dev
{ {
b3Printf("Succesfully created cache directory: %s\n", sCachedBinaryPath); b3Printf("Succesfully created cache directory: %s\n", sCachedBinaryPath);
} }
#endif
#endif //_WIN32 #endif //_WIN32
} }
@@ -873,10 +871,9 @@ cl_program b3OpenCLUtils_compileCLProgramFromString(cl_context clContext, cl_dev
size_t program_length = kernelSource ? strlen(kernelSource) : 0; size_t program_length = kernelSource ? strlen(kernelSource) : 0;
#ifdef MAC //or __APPLE__? #ifdef MAC //or __APPLE__?
char* flags = "-cl-mad-enable -DMAC -DGUID_ARG"; char* flags = "-cl-mad-enable -DMAC ";
#else #else
//const char* flags = "-DGUID_ARG= -fno-alias"; const char* flags = "";
const char* flags = "-DGUID_ARG= ";
#endif #endif

View File

@@ -164,9 +164,10 @@ public:
//create a new OpenCL buffer //create a new OpenCL buffer
size_t memSizeInBytes = sizeof(T)*_Count; size_t memSizeInBytes = sizeof(T)*_Count;
cl_mem buf = clCreateBuffer(m_clContext, CL_MEM_READ_WRITE, memSizeInBytes, NULL, &ciErrNum); cl_mem buf = clCreateBuffer(m_clContext, CL_MEM_READ_WRITE, memSizeInBytes, NULL, &ciErrNum);
b3Assert(ciErrNum==CL_SUCCESS);
if (ciErrNum!=CL_SUCCESS) if (ciErrNum!=CL_SUCCESS)
{ {
b3Error("OpenCL out-of-memory\n");
b3Assert(0);
_Count = 0; _Count = 0;
result = false; result = false;
} }

View File

@@ -75,7 +75,7 @@ int main(int argc, char* argv[])
b3OpenCLUtils::printDeviceInfo(dev); b3OpenCLUtils::printDeviceInfo(dev);
b3OpenCLArray<char*> memTester(g_cxMainContext,g_cqCommandQue,0,true); b3OpenCLArray<char> memTester(g_cxMainContext,g_cqCommandQue,0,true);
int maxMem = 8192; int maxMem = 8192;
bool result=true; bool result=true;
for (size_t i=1;result;i++) for (size_t i=1;result;i++)
@@ -124,7 +124,7 @@ int main(int argc, char* argv[])
oclCHECKERROR(ciErrNum, CL_SUCCESS); oclCHECKERROR(ciErrNum, CL_SUCCESS);
//normally you would create and execute kernels using this command queue //normally you would create and execute kernels using this command queue
b3OpenCLArray<char*> memTester(g_cxMainContext,g_cqCommandQue,0,true); b3OpenCLArray<char> memTester(g_cxMainContext,g_cqCommandQue,0,true);
int maxMem = 8192; int maxMem = 8192;
bool result=true; bool result=true;
for (size_t i=1;result;i++) for (size_t i=1;result;i++)