mirror of
https://github.com/bulletphysics/bullet3
synced 2024-12-15 06:00:12 +00:00
487 lines
13 KiB
Diff
487 lines
13 KiB
Diff
Index: build/findOpenCL.lua
|
|
===================================================================
|
|
--- build/findOpenCL.lua (revision 2640)
|
|
+++ build/findOpenCL.lua (working copy)
|
|
@@ -1,5 +1,14 @@
|
|
- -- todo: add Apple OpenCL environment vars
|
|
|
|
+
|
|
+ function findOpenCL_Apple()
|
|
+ if os.is("macosx") then
|
|
+ return true
|
|
+ else
|
|
+ return false
|
|
+ end
|
|
+ end
|
|
+
|
|
+
|
|
function findOpenCL_AMD()
|
|
local amdopenclpath = os.getenv("AMDAPPSDKROOT")
|
|
if (amdopenclpath) then
|
|
@@ -17,13 +26,33 @@
|
|
end
|
|
|
|
function findOpenCL_Intel()
|
|
- local intelopenclpath = os.getenv("INTELOCLSDKROOT")
|
|
- if (intelopenclpath) then
|
|
+ if os.is("Windows") then
|
|
+ local intelopenclpath = os.getenv("INTELOCLSDKROOT")
|
|
+ if (intelopenclpath) then
|
|
return true
|
|
+ end
|
|
end
|
|
+ if os.is("Linux") then
|
|
+ local intelsdk = io.open("/usr/include/CL/opencl.h","r")
|
|
+ if (intelsdk) then
|
|
+ return true;
|
|
+ end
|
|
+ end
|
|
return false
|
|
end
|
|
-
|
|
+
|
|
+ function initOpenCL_Apple()
|
|
+ configuration{}
|
|
+ includedirs {
|
|
+ "/System/Library/Frameworks/OpenCL.framework"
|
|
+ }
|
|
+ libdirs "/System/Library/Frameworks/OpenCL.framework"
|
|
+ links
|
|
+ {
|
|
+ "OpenCL.framework"
|
|
+ }
|
|
+ end
|
|
+
|
|
function initOpenCL_AMD()
|
|
configuration {}
|
|
local amdopenclpath = os.getenv("AMDAPPSDKROOT")
|
|
@@ -65,6 +94,7 @@
|
|
|
|
function initOpenCL_Intel()
|
|
configuration {}
|
|
+ if os.is("Windows") then
|
|
local intelopenclpath = os.getenv("INTELOCLSDKROOT")
|
|
if (intelopenclpath) then
|
|
defines { "ADL_ENABLE_CL" , "CL_PLATFORM_INTEL"}
|
|
@@ -79,6 +109,43 @@
|
|
links {"OpenCL"}
|
|
return true
|
|
end
|
|
+ end
|
|
+ if os.is("Linux") then
|
|
+ defines { "ADL_ENABLE_CL" , "CL_PLATFORM_INTEL"}
|
|
+ configuration {}
|
|
+ links {"OpenCL"}
|
|
+ end
|
|
return false
|
|
end
|
|
-
|
|
\ No newline at end of file
|
|
+
|
|
+ function findOpenCL (vendor )
|
|
+ if vendor=="AMD" then
|
|
+ return findOpenCL_AMD()
|
|
+ end
|
|
+ if vendor=="NVIDIA" then
|
|
+ return findOpenCL_NVIDIA()
|
|
+ end
|
|
+ if vendor=="Intel" then
|
|
+ return findOpenCL_Intel()
|
|
+ end
|
|
+ if vendor=="Apple" then
|
|
+ return findOpenCL_Apple()
|
|
+ end
|
|
+ return false
|
|
+ end
|
|
+
|
|
+ function initOpenCL ( vendor )
|
|
+ if vendor=="AMD" then
|
|
+ initOpenCL_AMD()
|
|
+ end
|
|
+ if vendor=="NVIDIA" then
|
|
+ return initOpenCL_NVIDIA()
|
|
+ end
|
|
+ if vendor=="Intel" then
|
|
+ initOpenCL_Intel()
|
|
+ end
|
|
+ if vendor=="Apple" then
|
|
+ return initOpenCL_Apple()
|
|
+ end
|
|
+ end
|
|
+
|
|
Index: build/premake4.lua
|
|
===================================================================
|
|
--- build/premake4.lua (revision 2640)
|
|
+++ build/premake4.lua (working copy)
|
|
@@ -1,102 +1,47 @@
|
|
---add the 0 so the solution comes first in the directory (when sorted on name)
|
|
---print "uncomment this hello premake4 world for debugging the script"
|
|
|
|
-solution "0BulletSolution"
|
|
+ solution "0MySolution"
|
|
|
|
- newoption {
|
|
- trigger = "ios",
|
|
- description = "Enable iOS target (requires xcode4)"
|
|
- }
|
|
-
|
|
- newoption {
|
|
- trigger = "without-demos",
|
|
- description = "Disable demos and extras"
|
|
- }
|
|
+ -- Multithreaded compiling
|
|
+ if _ACTION == "vs2010" or _ACTION=="vs2008" then
|
|
+ buildoptions { "/MP" }
|
|
+ end
|
|
+
|
|
+ act = ""
|
|
+
|
|
+ if _ACTION then
|
|
+ act = _ACTION
|
|
+ end
|
|
|
|
- newoption {
|
|
- trigger = "with-double-precision",
|
|
- description = "Enable double precision build"
|
|
- }
|
|
|
|
-
|
|
- newoption {
|
|
- trigger = "with-nacl",
|
|
- description = "Enable Native Client build"
|
|
- }
|
|
+ newoption
|
|
+ {
|
|
+ trigger = "ios",
|
|
+ description = "Enable iOS target (requires xcode4)"
|
|
+ }
|
|
+
|
|
+ newoption
|
|
+ {
|
|
+ trigger = "bullet2gpu",
|
|
+ description = "Enable Bullet 2.x GPU using b3GpuDynamicsWorld bridge to Bullet 3.x"
|
|
+ }
|
|
|
|
- newoption {
|
|
- trigger = "with-dx11",
|
|
- description = "Enable DirectX11 build"
|
|
- }
|
|
-
|
|
- newoption {
|
|
- trigger = "with-opencl",
|
|
- description = "Enable OpenCL builds (various SDKs)"
|
|
- }
|
|
-
|
|
- newoption {
|
|
- trigger = "with-opencl-amd",
|
|
- description = "Enable OpenCL builds (AMD SDK)"
|
|
- }
|
|
-
|
|
- newoption {
|
|
- trigger = "with-opencl-intel",
|
|
- description = "Enable OpenCL builds (Intel SDK)"
|
|
- }
|
|
- newoption {
|
|
- trigger = "with-opencl-nvidia",
|
|
- description = "Enable OpenCL builds (NVIDIA SDK)"
|
|
- }
|
|
-
|
|
-
|
|
configurations {"Release", "Debug"}
|
|
configuration "Release"
|
|
- flags { "Optimize", "EnableSSE", "StaticRuntime", "NoMinimalRebuild", "FloatFast"}
|
|
+ flags { "Optimize", "EnableSSE","StaticRuntime", "NoMinimalRebuild", "FloatFast"}
|
|
configuration "Debug"
|
|
+ defines {"_DEBUG=1"}
|
|
flags { "Symbols", "StaticRuntime" , "NoMinimalRebuild", "NoEditAndContinue" ,"FloatFast"}
|
|
|
|
- platforms {"x32", "x64"}
|
|
- --platforms {"x32"}
|
|
-
|
|
- configuration {"Windows"}
|
|
- defines { "_CRT_SECURE_NO_WARNINGS","_CRT_SECURE_NO_DEPRECATE"}
|
|
-
|
|
- configuration{}
|
|
-
|
|
- postfix="";
|
|
-
|
|
- if _OPTIONS["with-double-precision"] then
|
|
- defines {"BT_USE_DOUBLE_PRECISION"}
|
|
- end
|
|
-
|
|
- if _ACTION == "xcode4" then
|
|
- if _OPTIONS["ios"] then
|
|
- postfix = "ios";
|
|
- xcodebuildsettings
|
|
- {
|
|
- 'INFOPLIST_FILE = "../../Test/Info.plist"',
|
|
- 'CODE_SIGN_IDENTITY = "iPhone Developer"',
|
|
- "SDKROOT = iphoneos",
|
|
- 'ARCHS = "armv7"',
|
|
- 'TARGETED_DEVICE_FAMILY = "1,2"',
|
|
- 'VALID_ARCHS = "armv7"',
|
|
- }
|
|
- else
|
|
- xcodebuildsettings
|
|
- {
|
|
- 'ARCHS = "$(ARCHS_STANDARD_32_BIT) $(ARCHS_STANDARD_64_BIT)"',
|
|
- 'VALID_ARCHS = "x86_64 i386"',
|
|
- }
|
|
+ if os.is("Linux") then
|
|
+ if os.is64bit() then
|
|
+ platforms {"x64"}
|
|
+ else
|
|
+ platforms {"x32"}
|
|
end
|
|
else
|
|
-
|
|
+ platforms {"x32", "x64"}
|
|
end
|
|
|
|
- act = ""
|
|
-
|
|
- if _ACTION then
|
|
- act = _ACTION
|
|
- end
|
|
configuration {"x32"}
|
|
targetsuffix ("_" .. act)
|
|
configuration "x64"
|
|
@@ -110,89 +55,91 @@
|
|
|
|
configuration{}
|
|
|
|
+ postfix=""
|
|
|
|
+ if _ACTION == "xcode4" then
|
|
+ if _OPTIONS["ios"] then
|
|
+ postfix = "ios";
|
|
+ xcodebuildsettings
|
|
+ {
|
|
+ 'CODE_SIGN_IDENTITY = "iPhone Developer"',
|
|
+ "SDKROOT = iphoneos",
|
|
+ 'ARCHS = "armv7"',
|
|
+ 'TARGETED_DEVICE_FAMILY = "1,2"',
|
|
+ 'VALID_ARCHS = "armv7"',
|
|
+ }
|
|
+ else
|
|
+ xcodebuildsettings
|
|
+ {
|
|
+ 'ARCHS = "$(ARCHS_STANDARD_32_BIT) $(ARCHS_STANDARD_64_BIT)"',
|
|
+ 'VALID_ARCHS = "x86_64 i386"',
|
|
+ }
|
|
+ end
|
|
+ end
|
|
|
|
-if not _OPTIONS["with-nacl"] then
|
|
-
|
|
- flags { "NoRTTI"}
|
|
+
|
|
+ flags { "NoRTTI", "NoExceptions"}
|
|
+ defines { "_HAS_EXCEPTIONS=0" }
|
|
targetdir "../bin"
|
|
+ location("./" .. act .. postfix)
|
|
|
|
- -- Disable exception handling on MSVC 2008 and higher. MSVC 2005 without service pack has some linker issue (ConvexDecompositionDemo uses STL through HACD library)
|
|
- if _ACTION == "vs2010" or _ACTION=="vs2008" then
|
|
- flags { "NoExceptions"}
|
|
- defines { "_HAS_EXCEPTIONS=0" }
|
|
- end
|
|
+
|
|
+ projectRootDir = os.getcwd() .. "/../"
|
|
+ print("Project root directroy: " .. projectRootDir);
|
|
|
|
- -- Multithreaded compiling
|
|
- if _ACTION == "vs2010" then
|
|
- buildoptions { "/MP" }
|
|
- end
|
|
-
|
|
-
|
|
-else
|
|
- targetdir "../bin_html"
|
|
-end
|
|
-
|
|
-
|
|
dofile ("findOpenCL.lua")
|
|
dofile ("findDirectX11.lua")
|
|
+ dofile ("findOpenGLGlewGlut.lua")
|
|
|
|
language "C++"
|
|
|
|
- location("./" .. act .. postfix)
|
|
|
|
+
|
|
+ if not _OPTIONS["ios"] then
|
|
+-- include "../demo/gpudemo"
|
|
+-- include "../btgui/MidiTest"
|
|
+-- include "../opencl/vector_add_simplified"
|
|
+-- include "../opencl/vector_add"
|
|
+ include "../btgui/Gwen"
|
|
+ include "../btgui/GwenOpenGLTest"
|
|
+
|
|
+ include "../test/OpenCL/BasicInitialize"
|
|
+-- include "../test/OpenCL/BroadphaseCollision"
|
|
+-- include "../test/OpenCL/NarrowphaseCollision"
|
|
+ include "../test/OpenCL/ParallelPrimitives"
|
|
+ include "../test/OpenCL/RadixSortBenchmark"
|
|
+ include "../test/OpenCL/BitonicSort"
|
|
+
|
|
+ include "../src/Bullet3Dynamics"
|
|
+ include "../src/Bullet3Common"
|
|
+ include "../src/Bullet3Geometry"
|
|
+ include "../src/Bullet3Collision"
|
|
+ include "../src/Bullet3Serialize/Bullet2FileLoader"
|
|
|
|
- if _OPTIONS["with-dx11"] then
|
|
- include "../Demos/DX11ClothDemo"
|
|
- include "../src/BulletMultiThreaded/GpuSoftBodySolvers/DX11"
|
|
- end
|
|
+ include "../src/Bullet3OpenCL"
|
|
+ include "../Demos3/GpuDemos"
|
|
+
|
|
+-- include "../demo/gpu_initialize"
|
|
+-- include "../opencl/lds_bank_conflict"
|
|
+-- include "../opencl/reduce"
|
|
+-- include "../btgui/OpenGLTrueTypeFont"
|
|
+-- include "../btgui/OpenGLWindow"
|
|
+-- include "../demo/ObjLoader"
|
|
|
|
---choose any OpenCL sdk that is installed on the system
|
|
- if _OPTIONS["with-opencl"] then
|
|
- include "../Demos/OpenCLClothDemo/AMD"
|
|
- include "../src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/AMD"
|
|
- include "../Demos/OpenCLClothDemo/NVidia"
|
|
- include "../src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/NVidia"
|
|
- include "../Demos/OpenCLClothDemo/Intel"
|
|
- include "../src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/Intel"
|
|
- end
|
|
+
|
|
+-- include "../test/b3DynamicBvhBroadphase"
|
|
+
|
|
|
|
---choose a particular OpenCL sdk, this is useful for distributing project files that just work for one OpenCL SDK
|
|
- if _OPTIONS["with-opencl-amd"] then
|
|
- include "../Demos/OpenCLClothDemo/AMD"
|
|
- include "../Demos/OpenGL"
|
|
- include "../Demos/SoftDemo/AMD"
|
|
- include "../src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/AMD"
|
|
- end
|
|
-
|
|
- if _OPTIONS["with-opencl-intel"] then
|
|
- include "../Demos/OpenCLClothDemo/Intel"
|
|
- include "../src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/Intel"
|
|
- end
|
|
+
|
|
|
|
- if _OPTIONS["with-opencl-nvidia"] then
|
|
- include "../Demos/OpenCLClothDemo/NVidia"
|
|
- include "../src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/NVidia"
|
|
+ if _OPTIONS["bullet2gpu"] then
|
|
+ include "../src/LinearMath"
|
|
+ include "../src/BulletCollision"
|
|
+ include "../src/BulletDynamics"
|
|
+ include "../src/BulletSoftBody"
|
|
+ include "../Demos/HelloWorld"
|
|
+
|
|
+ include "../Demos3"
|
|
end
|
|
|
|
- if not _OPTIONS["without-demos"] then
|
|
- if not _OPTIONS["ios"] then
|
|
- include "../Demos"
|
|
end
|
|
- include "../Extras"
|
|
- end
|
|
-
|
|
-
|
|
- if _OPTIONS["with-nacl"] then
|
|
- include "../Demos/NativeClient"
|
|
- else
|
|
- include "../src/LinearMath"
|
|
- include "../src/BulletCollision"
|
|
- include "../src/BulletDynamics"
|
|
- include "../src/BulletSoftBody"
|
|
- end
|
|
-
|
|
- include "../Test"
|
|
- include "../Demos/HelloWorld"
|
|
- include "../Demos/Benchmarks"
|
|
-
|
|
Index: build/premake4_linux
|
|
===================================================================
|
|
Cannot display: file marked as a binary type.
|
|
svn:mime-type = application/octet-stream
|
|
Index: build/premake4_osx
|
|
===================================================================
|
|
Cannot display: file marked as a binary type.
|
|
svn:mime-type = application/octet-stream
|
|
Index: build/vs2010.bat
|
|
===================================================================
|
|
--- build/vs2010.bat (revision 2640)
|
|
+++ build/vs2010.bat (working copy)
|
|
@@ -1,4 +1,6 @@
|
|
|
|
+rem premake4 --with-pe vs2010
|
|
premake4 vs2010
|
|
|
|
+mkdir vs2010\cache
|
|
pause
|
|
\ No newline at end of file
|
|
Index: Demos/OpenGL/DemoApplication.cpp
|
|
===================================================================
|
|
--- Demos/OpenGL/DemoApplication.cpp (revision 2640)
|
|
+++ Demos/OpenGL/DemoApplication.cpp (working copy)
|
|
@@ -1182,8 +1182,8 @@
|
|
}
|
|
}
|
|
|
|
- btVector3 aabbMin,aabbMax;
|
|
- m_dynamicsWorld->getBroadphase()->getBroadphaseAabb(aabbMin,aabbMax);
|
|
+ btVector3 aabbMin(0,0,0),aabbMax(0,0,0);
|
|
+ //m_dynamicsWorld->getBroadphase()->getBroadphaseAabb(aabbMin,aabbMax);
|
|
|
|
aabbMin-=btVector3(BT_LARGE_FLOAT,BT_LARGE_FLOAT,BT_LARGE_FLOAT);
|
|
aabbMax+=btVector3(BT_LARGE_FLOAT,BT_LARGE_FLOAT,BT_LARGE_FLOAT);
|
|
Index: Demos/OpenGL/DemoApplication.h
|
|
===================================================================
|
|
--- Demos/OpenGL/DemoApplication.h (revision 2640)
|
|
+++ Demos/OpenGL/DemoApplication.h (working copy)
|
|
@@ -149,6 +149,11 @@
|
|
{
|
|
m_azi = azi;
|
|
}
|
|
+
|
|
+ void setEle(float ele)
|
|
+ {
|
|
+ m_ele = ele;
|
|
+ }
|
|
|
|
void setCameraUp(const btVector3& camUp)
|
|
{
|
|
Index: src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp
|
|
===================================================================
|
|
--- src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp (revision 2640)
|
|
+++ src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp (working copy)
|
|
@@ -73,7 +73,7 @@
|
|
m_debugDrawer(0),
|
|
m_forceUpdateAllAabbs(true)
|
|
{
|
|
- m_stackAlloc = collisionConfiguration->getStackAllocator();
|
|
+ m_stackAlloc = 0;//collisionConfiguration->getStackAllocator();
|
|
m_dispatchInfo.m_stackAllocator = m_stackAlloc;
|
|
}
|
|
|
|
Index: src/BulletDynamics/Dynamics/btDynamicsWorld.h
|
|
===================================================================
|
|
--- src/BulletDynamics/Dynamics/btDynamicsWorld.h (revision 2640)
|
|
+++ src/BulletDynamics/Dynamics/btDynamicsWorld.h (working copy)
|
|
@@ -33,7 +33,8 @@
|
|
BT_SIMPLE_DYNAMICS_WORLD=1,
|
|
BT_DISCRETE_DYNAMICS_WORLD=2,
|
|
BT_CONTINUOUS_DYNAMICS_WORLD=3,
|
|
- BT_SOFT_RIGID_DYNAMICS_WORLD=4
|
|
+ BT_SOFT_RIGID_DYNAMICS_WORLD=4,
|
|
+ BT_GPU_DYNAMICS_WORLD=5
|
|
};
|
|
|
|
///The btDynamicsWorld is the interface class for several dynamics implementation, basic, discrete, parallel, and continuous etc.
|