tweak default values of b3Config.h so some laptop GPUs can run 128k scenes

return the result of resize
use size_t instead of int for btOpenCLArray
BasicInitialize demo will test how much memory can be allocated, using the btOpenCLArray
This commit is contained in:
erwin coumans
2013-06-14 12:10:16 -07:00
parent 02a858e7c1
commit f73d11d896
3 changed files with 95 additions and 45 deletions

View File

@@ -16,6 +16,8 @@ subject to the following restrictions:
///original author: Erwin Coumans
#include "Bullet3OpenCL/Initialize/b3OpenCLUtils.h"
#include "Bullet3OpenCL/ParallelPrimitives/b3OpenCLArray.h"
#include <stdio.h>
cl_context g_cxMainContext;
@@ -71,6 +73,27 @@ int main(int argc, char* argv[])
b3OpenCLDeviceInfo devInfo;
b3OpenCLUtils::getDeviceInfo(dev,&devInfo);
b3OpenCLUtils::printDeviceInfo(dev);
b3OpenCLArray<char*> memTester(g_cxMainContext,g_cqCommandQue,0,true);
int maxMem = 8192;
bool result=true;
for (size_t i=1;result;i++)
{
size_t numBytes = i*1024*1024;
result = memTester.resize(numBytes,false);
if (result)
{
printf("allocated %d MB successfully\n",i);
} else
{
printf("allocated %d MB failed\n", i);
}
}
}
clReleaseContext(context);
@@ -101,6 +124,24 @@ int main(int argc, char* argv[])
oclCHECKERROR(ciErrNum, CL_SUCCESS);
//normally you would create and execute kernels using this command queue
b3OpenCLArray<char*> memTester(g_cxMainContext,g_cqCommandQue,0,true);
int maxMem = 8192;
bool result=true;
for (size_t i=1;result;i++)
{
size_t numBytes = i*1024*1024;
result = memTester.resize(numBytes,false);
if (result)
{
printf("allocated %d MB successfully\n",i);
} else
{
printf("allocated %d MB failed\n", i);
}
}
clReleaseCommandQueue(g_cqCommandQue);
}