MiniCLTask.cpp

Go to the documentation of this file.
00001 /*
00002 Bullet Continuous Collision Detection and Physics Library, Copyright (c) 2007 Erwin Coumans
00003 
00004 This software is provided 'as-is', without any express or implied warranty.
00005 In no event will the authors be held liable for any damages arising from the use of this software.
00006 Permission is granted to anyone to use this software for any purpose, 
00007 including commercial applications, and to alter it and redistribute it freely, 
00008 subject to the following restrictions:
00009 
00010 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.
00011 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
00012 3. This notice may not be removed or altered from any source distribution.
00013 
00014 */
00015 
00016 
00017 #include "MiniCLTask.h"
00018 #include "BulletMultiThreaded/PlatformDefinitions.h"
00019 #include "BulletMultiThreaded/SpuFakeDma.h"
00020 #include "LinearMath/btMinMax.h"
00021 #include "MiniCLTask.h"
00022 #include "MiniCL/MiniCLTaskScheduler.h"
00023 
00024 
00025 #ifdef __SPU__
00026 #include <spu_printf.h>
00027 #else
00028 #include <stdio.h>
00029 #define spu_printf printf
00030 #endif
00031 
00032 int gMiniCLNumOutstandingTasks = 0;
00033 
00034 struct MiniCLTask_LocalStoreMemory
00035 {
00036         
00037 };
00038 
00039 
00040 //-- MAIN METHOD
00041 void processMiniCLTask(void* userPtr, void* lsMemory)
00042 {
00043         //      BT_PROFILE("processSampleTask");
00044 
00045         MiniCLTask_LocalStoreMemory* localMemory = (MiniCLTask_LocalStoreMemory*)lsMemory;
00046 
00047         MiniCLTaskDesc* taskDescPtr = (MiniCLTaskDesc*)userPtr;
00048         MiniCLTaskDesc& taskDesc = *taskDescPtr;
00049 
00050         for (unsigned int i=taskDesc.m_firstWorkUnit;i<taskDesc.m_lastWorkUnit;i++)
00051         {
00052                 taskDesc.m_kernel->m_launcher(&taskDesc, i);
00053         }
00054 
00055 //      printf("Compute Unit[%d] executed kernel %d work items [%d..%d)\n",taskDesc.m_taskId,taskDesc.m_kernelProgramId,taskDesc.m_firstWorkUnit,taskDesc.m_lastWorkUnit);
00056         
00057 }
00058 
00059 
00060 #if defined(__CELLOS_LV2__) || defined (LIBSPE2)
00061 
00062 ATTRIBUTE_ALIGNED16(MiniCLTask_LocalStoreMemory gLocalStoreMemory);
00063 
00064 void* createMiniCLLocalStoreMemory()
00065 {
00066         return &gLocalStoreMemory;
00067 }
00068 #else
00069 void* createMiniCLLocalStoreMemory()
00070 {
00071         return new MiniCLTask_LocalStoreMemory;
00072 };
00073 
00074 #endif