Initialize libbullet git in 2.0_beta.
[platform/upstream/libbullet.git] / src / MiniCL / MiniCLTask / MiniCLTask.cpp
1 /*
2 Bullet Continuous Collision Detection and Physics Library, Copyright (c) 2007 Erwin Coumans
3
4 This software is provided 'as-is', without any express or implied warranty.
5 In no event will the authors be held liable for any damages arising from the use of this software.
6 Permission is granted to anyone to use this software for any purpose, 
7 including commercial applications, and to alter it and redistribute it freely, 
8 subject to the following restrictions:
9
10 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
11 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
12 3. This notice may not be removed or altered from any source distribution.
13
14 */
15
16
17 #include "MiniCLTask.h"
18 #include "BulletMultiThreaded/PlatformDefinitions.h"
19 #include "BulletMultiThreaded/SpuFakeDma.h"
20 #include "LinearMath/btMinMax.h"
21 #include "MiniCLTask.h"
22 #include "MiniCL/MiniCLTaskScheduler.h"
23
24
25 #ifdef __SPU__
26 #include <spu_printf.h>
27 #else
28 #include <stdio.h>
29 #define spu_printf printf
30 #endif
31
32 int gMiniCLNumOutstandingTasks = 0;
33
34 struct MiniCLTask_LocalStoreMemory
35 {
36         
37 };
38
39
40 //-- MAIN METHOD
41 void processMiniCLTask(void* userPtr, void* lsMemory)
42 {
43         //      BT_PROFILE("processSampleTask");
44
45         MiniCLTask_LocalStoreMemory* localMemory = (MiniCLTask_LocalStoreMemory*)lsMemory;
46
47         MiniCLTaskDesc* taskDescPtr = (MiniCLTaskDesc*)userPtr;
48         MiniCLTaskDesc& taskDesc = *taskDescPtr;
49
50         for (unsigned int i=taskDesc.m_firstWorkUnit;i<taskDesc.m_lastWorkUnit;i++)
51         {
52                 taskDesc.m_kernel->m_launcher(&taskDesc, i);
53         }
54
55 //      printf("Compute Unit[%d] executed kernel %d work items [%d..%d)\n",taskDesc.m_taskId,taskDesc.m_kernelProgramId,taskDesc.m_firstWorkUnit,taskDesc.m_lastWorkUnit);
56         
57 }
58
59
60 #if defined(__CELLOS_LV2__) || defined (LIBSPE2)
61
62 ATTRIBUTE_ALIGNED16(MiniCLTask_LocalStoreMemory gLocalStoreMemory);
63
64 void* createMiniCLLocalStoreMemory()
65 {
66         return &gLocalStoreMemory;
67 }
68 #else
69 void* createMiniCLLocalStoreMemory()
70 {
71         return new MiniCLTask_LocalStoreMemory;
72 };
73
74 #endif