create premake4 solutions for the various OpenCL configurations (AMD, NVIDIA, Intel OpenCL SDKs for Windows)

primarily to distribute project files that work.
CMake is still better supported in general (not all demos/libs have been ported)

Revert a recent change about warnings: %zu doesn't work in printf, %d does
This commit is contained in:
erwin.coumans
2011-09-16 01:28:34 +00:00
parent ce62d7615e
commit bb29d15058
15 changed files with 467 additions and 37 deletions

View File

@@ -0,0 +1,65 @@
hasCL = findOpenCL_AMD()
if (hasCL) then
project "AppOpenCLClothDemo_AMD"
defines { "USE_AMD_OPENCL","CL_PLATFORM_AMD"}
initOpenCL_AMD()
language "C++"
kind "ConsoleApp"
targetdir "../../.."
libdirs {"../../../Glut"}
links {
"LinearMath",
"BulletCollision",
"BulletDynamics",
"BulletSoftBody",
"BulletSoftBodySolvers_OpenCL_AMD",
"opengl32"
}
configuration "x64"
links {
"glut64",
"glew64"
}
configuration "x32"
links {
"glut32",
"glew32"
}
configuration{}
includedirs {
"../../../src",
"../../../Glut",
"../../SharedOpenCL",
"../../OpenGL"
}
files {
"../cl_cloth_demo.cpp",
"../../SharedOpenCL/btOclUtils.h",
"../../SharedOpenCL/btOclCommon.h",
"../../SharedOpenCL/btOclUtils.cpp",
"../../SharedOpenCL/btOclCommon.cpp",
"../../OpenGL/GLDebugDrawer.cpp",
"../../OpenGL/stb_image.cpp",
"../../OpenGL/stb_image.h",
"../gl_win.cpp",
"../clstuff.cpp",
"../clstuff.h",
"../gl_win.h",
"../cloth.h"
}
end

View File

@@ -0,0 +1,65 @@
hasCL = findOpenCL_Intel()
if (hasCL) then
project "AppOpenCLClothDemo_Intel"
defines { "USE_INTEL_OPENCL","CL_PLATFORM_INTEL"}
initOpenCL_Intel()
language "C++"
kind "ConsoleApp"
targetdir "../../.."
libdirs {"../../../Glut"}
links {
"LinearMath",
"BulletCollision",
"BulletDynamics",
"BulletSoftBody",
"BulletSoftBodySolvers_OpenCL_Intel",
"opengl32"
}
configuration "x64"
links {
"glut64",
"glew64"
}
configuration "x32"
links {
"glut32",
"glew32"
}
configuration{}
includedirs {
"../../../src",
"../../../Glut",
"../../SharedOpenCL",
"../../OpenGL"
}
files {
"../cl_cloth_demo.cpp",
"../../SharedOpenCL/btOclUtils.h",
"../../SharedOpenCL/btOclCommon.h",
"../../SharedOpenCL/btOclUtils.cpp",
"../../SharedOpenCL/btOclCommon.cpp",
"../../OpenGL/GLDebugDrawer.cpp",
"../../OpenGL/stb_image.cpp",
"../../OpenGL/stb_image.h",
"../gl_win.cpp",
"../clstuff.cpp",
"../clstuff.h",
"../gl_win.h",
"../cloth.h"
}
end

View File

@@ -0,0 +1,65 @@
hasCL = findOpenCL_NVIDIA()
if (hasCL) then
project "AppOpenCLClothDemo_NVIDIA"
defines { "USE_NVIDIA_OPENCL","CL_PLATFORM_NVIDIA"}
initOpenCL_NVIDIA()
language "C++"
kind "ConsoleApp"
targetdir "../../.."
libdirs {"../../../Glut"}
links {
"LinearMath",
"BulletCollision",
"BulletDynamics",
"BulletSoftBody",
"BulletSoftBodySolvers_OpenCL_NVIDIA",
"opengl32"
}
configuration "x64"
links {
"glut64",
"glew64"
}
configuration "x32"
links {
"glut32",
"glew32"
}
configuration{}
includedirs {
"../../../src",
"../../../Glut",
"../../SharedOpenCL",
"../../OpenGL"
}
files {
"../cl_cloth_demo.cpp",
"../../SharedOpenCL/btOclUtils.h",
"../../SharedOpenCL/btOclCommon.h",
"../../SharedOpenCL/btOclUtils.cpp",
"../../SharedOpenCL/btOclCommon.cpp",
"../../OpenGL/GLDebugDrawer.cpp",
"../../OpenGL/stb_image.cpp",
"../../OpenGL/stb_image.h",
"../gl_win.cpp",
"../clstuff.cpp",
"../clstuff.h",
"../gl_win.h",
"../cloth.h"
}
end

View File

@@ -528,12 +528,12 @@ void doFlags()
{
m_dynamicsWorld->stepSimulation(1./60.,0);
btDefaultSerializer* serializer = new btDefaultSerializer();
m_dynamicsWorld->serialize(serializer);
FILE* file = fopen("testFile.bullet","wb");
fwrite(serializer->getBufferPointer(),serializer->getCurrentBufferSize(),1, file);
fclose(file);
// Option to save a .bullet file
// btDefaultSerializer* serializer = new btDefaultSerializer();
// m_dynamicsWorld->serialize(serializer);
// FILE* file = fopen("testFile.bullet","wb");
// fwrite(serializer->getBufferPointer(),serializer->getCurrentBufferSize(),1, file);
// fclose(file);
CProfileManager::dumpAll();
}

View File

@@ -137,8 +137,12 @@ class piece_of_cloth
{
int width,height,n;
unsigned char *data = stbi_load(filename.c_str(), &width, &height, &n, 0);
if (!data)
{
//premake project happens to be 2 levels above the root of Bullet, so try this instead:
std::string newname = "../../"+filename;
data = stbi_load(newname.c_str(), &width, &height, &n, 0);
}
GLubyte* image=new GLubyte[512*256*4];
for(int y=0;y<256;++y)

View File

@@ -255,17 +255,17 @@ void btOclPrintDevInfo(cl_device_id device)
// CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS
size_t workitem_dims;
clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, sizeof(workitem_dims), &workitem_dims, NULL);
printf(" CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS:\t%zu\n", workitem_dims);
printf(" CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS:\t%d\n", workitem_dims);
// CL_DEVICE_MAX_WORK_ITEM_SIZES
size_t workitem_size[3];
clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_ITEM_SIZES, sizeof(workitem_size), &workitem_size, NULL);
printf(" CL_DEVICE_MAX_WORK_ITEM_SIZES:\t%zu / %zu / %zu \n", workitem_size[0], workitem_size[1], workitem_size[2]);
printf(" CL_DEVICE_MAX_WORK_ITEM_SIZES:\t%d / %d / %d \n", workitem_size[0], workitem_size[1], workitem_size[2]);
// CL_DEVICE_MAX_WORK_GROUP_SIZE
size_t workgroup_size;
clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof(workgroup_size), &workgroup_size, NULL);
printf(" CL_DEVICE_MAX_WORK_GROUP_SIZE:\t%zu\n", workgroup_size);
printf(" CL_DEVICE_MAX_WORK_GROUP_SIZE:\t%d\n", workgroup_size);
// CL_DEVICE_MAX_CLOCK_FREQUENCY
cl_uint clock_frequency;
@@ -332,15 +332,15 @@ void btOclPrintDevInfo(cl_device_id device)
size_t szMaxDims[5];
printf("\n CL_DEVICE_IMAGE <dim>");
clGetDeviceInfo(device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof(size_t), &szMaxDims[0], NULL);
printf("\t\t\t2D_MAX_WIDTH\t %zu\n", szMaxDims[0]);
printf("\t\t\t2D_MAX_WIDTH\t %d\n", szMaxDims[0]);
clGetDeviceInfo(device, CL_DEVICE_IMAGE2D_MAX_HEIGHT, sizeof(size_t), &szMaxDims[1], NULL);
printf("\t\t\t\t\t2D_MAX_HEIGHT\t %zu\n", szMaxDims[1]);
printf("\t\t\t\t\t2D_MAX_HEIGHT\t %d\n", szMaxDims[1]);
clGetDeviceInfo(device, CL_DEVICE_IMAGE3D_MAX_WIDTH, sizeof(size_t), &szMaxDims[2], NULL);
printf("\t\t\t\t\t3D_MAX_WIDTH\t %zu\n", szMaxDims[2]);
printf("\t\t\t\t\t3D_MAX_WIDTH\t %d\n", szMaxDims[2]);
clGetDeviceInfo(device, CL_DEVICE_IMAGE3D_MAX_HEIGHT, sizeof(size_t), &szMaxDims[3], NULL);
printf("\t\t\t\t\t3D_MAX_HEIGHT\t %zu\n", szMaxDims[3]);
printf("\t\t\t\t\t3D_MAX_HEIGHT\t %d\n", szMaxDims[3]);
clGetDeviceInfo(device, CL_DEVICE_IMAGE3D_MAX_DEPTH, sizeof(size_t), &szMaxDims[4], NULL);
printf("\t\t\t\t\t3D_MAX_DEPTH\t %zu\n", szMaxDims[4]);
printf("\t\t\t\t\t3D_MAX_DEPTH\t %d\n", szMaxDims[4]);
// CL_DEVICE_EXTENSIONS: get device extensions, and if any then parse & log the string onto separate lines
clGetDeviceInfo(device, CL_DEVICE_EXTENSIONS, sizeof(device_string), &device_string, NULL);

View File

@@ -18,7 +18,7 @@ function createDemos( demos, incdirs, linknames)
files { "../msvc/bullet.rc" }
configuration {"MaxOSX"}
print "hello"
--print "hello"
linkoptions { "-framework Carbon -framework OpenGL -framework AGL -framework Glut" }
configuration {"not Windows", "not MacOSX"}