summaryrefslogtreecommitdiff
path: root/thirdparty/bullet/Bullet3OpenCL/ParallelPrimitives/b3PrefixScanFloat4CL.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-03-09 21:15:53 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-03-09 21:45:47 +0100
commit3d7f1555865a981b7144becfc58d3f3f34362f5f (patch)
treed92912c6d700468b3330148b9179026b9f4efcb4 /thirdparty/bullet/Bullet3OpenCL/ParallelPrimitives/b3PrefixScanFloat4CL.cpp
parent33c907f9f5b3ec1a43d0251d7cac80da49b5b658 (diff)
Remove unused Bullet module and thirdparty code
It has been disabled in `master` since one year (#45852) and our plan is for Bullet, and possibly other thirdparty physics engines, to be implemented via GDExtension so that they can be selected by the users who need them.
Diffstat (limited to 'thirdparty/bullet/Bullet3OpenCL/ParallelPrimitives/b3PrefixScanFloat4CL.cpp')
-rw-r--r--thirdparty/bullet/Bullet3OpenCL/ParallelPrimitives/b3PrefixScanFloat4CL.cpp120
1 files changed, 0 insertions, 120 deletions
diff --git a/thirdparty/bullet/Bullet3OpenCL/ParallelPrimitives/b3PrefixScanFloat4CL.cpp b/thirdparty/bullet/Bullet3OpenCL/ParallelPrimitives/b3PrefixScanFloat4CL.cpp
deleted file mode 100644
index 1cac97c988..0000000000
--- a/thirdparty/bullet/Bullet3OpenCL/ParallelPrimitives/b3PrefixScanFloat4CL.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-#include "b3PrefixScanFloat4CL.h"
-#include "b3FillCL.h"
-#define B3_PREFIXSCAN_FLOAT4_PROG_PATH "src/Bullet3OpenCL/ParallelPrimitives/kernels/PrefixScanFloat4Kernels.cl"
-
-#include "b3LauncherCL.h"
-#include "Bullet3OpenCL/Initialize/b3OpenCLUtils.h"
-#include "kernels/PrefixScanKernelsFloat4CL.h"
-
-b3PrefixScanFloat4CL::b3PrefixScanFloat4CL(cl_context ctx, cl_device_id device, cl_command_queue queue, int size)
- : m_commandQueue(queue)
-{
- const char* scanKernelSource = prefixScanKernelsFloat4CL;
- cl_int pErrNum;
- char* additionalMacros = 0;
-
- m_workBuffer = new b3OpenCLArray<b3Vector3>(ctx, queue, size);
- cl_program scanProg = b3OpenCLUtils::compileCLProgramFromString(ctx, device, scanKernelSource, &pErrNum, additionalMacros, B3_PREFIXSCAN_FLOAT4_PROG_PATH);
- b3Assert(scanProg);
-
- m_localScanKernel = b3OpenCLUtils::compileCLKernelFromString(ctx, device, scanKernelSource, "LocalScanKernel", &pErrNum, scanProg, additionalMacros);
- b3Assert(m_localScanKernel);
- m_blockSumKernel = b3OpenCLUtils::compileCLKernelFromString(ctx, device, scanKernelSource, "TopLevelScanKernel", &pErrNum, scanProg, additionalMacros);
- b3Assert(m_blockSumKernel);
- m_propagationKernel = b3OpenCLUtils::compileCLKernelFromString(ctx, device, scanKernelSource, "AddOffsetKernel", &pErrNum, scanProg, additionalMacros);
- b3Assert(m_propagationKernel);
-}
-
-b3PrefixScanFloat4CL::~b3PrefixScanFloat4CL()
-{
- delete m_workBuffer;
- clReleaseKernel(m_localScanKernel);
- clReleaseKernel(m_blockSumKernel);
- clReleaseKernel(m_propagationKernel);
-}
-
-template <class T>
-T b3NextPowerOf2(T n)
-{
- n -= 1;
- for (int i = 0; i < sizeof(T) * 8; i++)
- n = n | (n >> i);
- return n + 1;
-}
-
-void b3PrefixScanFloat4CL::execute(b3OpenCLArray<b3Vector3>& src, b3OpenCLArray<b3Vector3>& dst, int n, b3Vector3* sum)
-{
- // b3Assert( data->m_option == EXCLUSIVE );
- const unsigned int numBlocks = (const unsigned int)((n + BLOCK_SIZE * 2 - 1) / (BLOCK_SIZE * 2));
-
- dst.resize(src.size());
- m_workBuffer->resize(src.size());
-
- b3Int4 constBuffer;
- constBuffer.x = n;
- constBuffer.y = numBlocks;
- constBuffer.z = (int)b3NextPowerOf2(numBlocks);
-
- b3OpenCLArray<b3Vector3>* srcNative = &src;
- b3OpenCLArray<b3Vector3>* dstNative = &dst;
-
- {
- b3BufferInfoCL bInfo[] = {b3BufferInfoCL(dstNative->getBufferCL()), b3BufferInfoCL(srcNative->getBufferCL()), b3BufferInfoCL(m_workBuffer->getBufferCL())};
-
- b3LauncherCL launcher(m_commandQueue, m_localScanKernel, "m_localScanKernel");
- launcher.setBuffers(bInfo, sizeof(bInfo) / sizeof(b3BufferInfoCL));
- launcher.setConst(constBuffer);
- launcher.launch1D(numBlocks * BLOCK_SIZE, BLOCK_SIZE);
- }
-
- {
- b3BufferInfoCL bInfo[] = {b3BufferInfoCL(m_workBuffer->getBufferCL())};
-
- b3LauncherCL launcher(m_commandQueue, m_blockSumKernel, "m_blockSumKernel");
- launcher.setBuffers(bInfo, sizeof(bInfo) / sizeof(b3BufferInfoCL));
- launcher.setConst(constBuffer);
- launcher.launch1D(BLOCK_SIZE, BLOCK_SIZE);
- }
-
- if (numBlocks > 1)
- {
- b3BufferInfoCL bInfo[] = {b3BufferInfoCL(dstNative->getBufferCL()), b3BufferInfoCL(m_workBuffer->getBufferCL())};
- b3LauncherCL launcher(m_commandQueue, m_propagationKernel, "m_propagationKernel");
- launcher.setBuffers(bInfo, sizeof(bInfo) / sizeof(b3BufferInfoCL));
- launcher.setConst(constBuffer);
- launcher.launch1D((numBlocks - 1) * BLOCK_SIZE, BLOCK_SIZE);
- }
-
- if (sum)
- {
- clFinish(m_commandQueue);
- dstNative->copyToHostPointer(sum, 1, n - 1, true);
- }
-}
-
-void b3PrefixScanFloat4CL::executeHost(b3AlignedObjectArray<b3Vector3>& src, b3AlignedObjectArray<b3Vector3>& dst, int n, b3Vector3* sum)
-{
- b3Vector3 s = b3MakeVector3(0, 0, 0);
- //if( data->m_option == EXCLUSIVE )
- {
- for (int i = 0; i < n; i++)
- {
- dst[i] = s;
- s += src[i];
- }
- }
- /*else
- {
- for(int i=0; i<n; i++)
- {
- s += hSrc[i];
- hDst[i] = s;
- }
- }
- */
-
- if (sum)
- {
- *sum = dst[n - 1];
- }
-} \ No newline at end of file