diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-06-15 21:41:12 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-06-15 21:41:12 +0400 |
commit | 687b6e5447855311522cc42ed980c9df3400b1c4 (patch) | |
tree | 7fc44a92998f88d58aaae6bfc2a42ed43ab270d4 /source/blender/compositor/intern/COM_WorkScheduler.cpp | |
parent | 5a9285a5c96914b61703634b69cc6ef040347683 (diff) |
style cleanup: remaining nodes in intern/
Diffstat (limited to 'source/blender/compositor/intern/COM_WorkScheduler.cpp')
-rw-r--r-- | source/blender/compositor/intern/COM_WorkScheduler.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cpp b/source/blender/compositor/intern/COM_WorkScheduler.cpp index ba8bfe55310..fb7a8f8a764 100644 --- a/source/blender/compositor/intern/COM_WorkScheduler.cpp +++ b/source/blender/compositor/intern/COM_WorkScheduler.cpp @@ -40,19 +40,19 @@ /// @brief list of all CPUDevices. for every hardware thread an instance of CPUDevice is created -static vector<CPUDevice*> cpudevices; +static vector<CPUDevice *> cpudevices; #if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE /// @brief list of all thread for every CPUDevice in cpudevices a thread exists static ListBase cputhreads; /// @brief all scheduled work for the cpu -static ThreadQueue * cpuqueue; -static ThreadQueue * gpuqueue; +static ThreadQueue *cpuqueue; +static ThreadQueue *gpuqueue; #ifdef COM_OPENCL_ENABLED static cl_context context; static cl_program program; /// @brief list of all OpenCLDevices. for every OpenCL GPU device an instance of OpenCLDevice is created -static vector<OpenCLDevice*> gpudevices; +static vector<OpenCLDevice *> gpudevices; /// @brief list of all thread for every GPUDevice in cpudevices a thread exists static ListBase gputhreads; /// @brief all scheduled work for the gpu @@ -66,10 +66,10 @@ static bool openclActive = false; #if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE void *WorkScheduler::thread_execute_cpu(void *data) { - Device *device = (Device*)data; + Device *device = (Device *)data; WorkPackage *work; - while ((work = (WorkPackage*)BLI_thread_queue_pop(cpuqueue))) { + while ((work = (WorkPackage *)BLI_thread_queue_pop(cpuqueue))) { device->execute(work); delete work; } @@ -79,10 +79,10 @@ void *WorkScheduler::thread_execute_cpu(void *data) void *WorkScheduler::thread_execute_gpu(void *data) { - Device *device = (Device*)data; + Device *device = (Device *)data; WorkPackage *work; - while ((work = (WorkPackage*)BLI_thread_queue_pop(gpuqueue))) { + while ((work = (WorkPackage *)BLI_thread_queue_pop(gpuqueue))) { device->execute(work); delete work; } @@ -120,7 +120,7 @@ void WorkScheduler::start(CompositorContext &context) unsigned int index; cpuqueue = BLI_thread_queue_init(); BLI_init_threads(&cputhreads, thread_execute_cpu, cpudevices.size()); - for (index = 0 ; index < cpudevices.size() ; index ++) { + for (index = 0; index < cpudevices.size(); index++) { Device *device = cpudevices[index]; BLI_insert_thread(&cputhreads, device); } @@ -128,7 +128,7 @@ void WorkScheduler::start(CompositorContext &context) if (context.getHasActiveOpenCLDevices()) { gpuqueue = BLI_thread_queue_init(); BLI_init_threads(&gputhreads, thread_execute_gpu, gpudevices.size()); - for (index = 0 ; index < gpudevices.size() ; index ++) { + for (index = 0; index < gpudevices.size(); index++) { Device *device = gpudevices[index]; BLI_insert_thread(&gputhreads, device); } @@ -178,7 +178,7 @@ bool WorkScheduler::hasGPUDevices() { #if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE #ifdef COM_OPENCL_ENABLED - return gpudevices.size()>0; + return gpudevices.size() > 0; #else return 0; #endif @@ -197,7 +197,7 @@ void WorkScheduler::initialize() #if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE int numberOfCPUThreads = BLI_system_thread_count(); - for (int index = 0 ; index < numberOfCPUThreads ; index ++) { + for (int index = 0; index < numberOfCPUThreads; index++) { CPUDevice *device = new CPUDevice(); device->initialize(); cpudevices.push_back(device); @@ -209,13 +209,13 @@ void WorkScheduler::initialize() cl_uint numberOfPlatforms = 0; cl_int error; error = clGetPlatformIDs(0, 0, &numberOfPlatforms); - if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } + if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } if (G.f & G_DEBUG) printf("%d number of platforms\n", numberOfPlatforms); cl_platform_id *platforms = new cl_platform_id[numberOfPlatforms]; error = clGetPlatformIDs(numberOfPlatforms, platforms, 0); unsigned int indexPlatform; cl_uint totalNumberOfDevices = 0; - for (indexPlatform = 0 ; indexPlatform < numberOfPlatforms ; indexPlatform ++) { + for (indexPlatform = 0; indexPlatform < numberOfPlatforms; indexPlatform++) { cl_platform_id platform = platforms[indexPlatform]; cl_uint numberOfDevices; clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, 0, &numberOfDevices); @@ -224,16 +224,16 @@ void WorkScheduler::initialize() cl_device_id *cldevices = new cl_device_id[totalNumberOfDevices]; unsigned int numberOfDevicesReceived = 0; - for (indexPlatform = 0 ; indexPlatform < numberOfPlatforms ; indexPlatform ++) { + for (indexPlatform = 0; indexPlatform < numberOfPlatforms; indexPlatform++) { cl_platform_id platform = platforms[indexPlatform]; cl_uint numberOfDevices; clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, 0, &numberOfDevices); - clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, numberOfDevices, cldevices+numberOfDevicesReceived*sizeof (cl_device_id), 0); + clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, numberOfDevices, cldevices + numberOfDevicesReceived * sizeof (cl_device_id), 0); numberOfDevicesReceived += numberOfDevices; } if (totalNumberOfDevices > 0) { context = clCreateContext(NULL, totalNumberOfDevices, cldevices, clContextError, NULL, &error); - if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } + if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } program = clCreateProgramWithSource(context, 1, &clkernelstoh_COM_OpenCLKernels_cl, 0, &error); error = clBuildProgram(program, totalNumberOfDevices, cldevices, 0, 0, 0); if (error != CL_SUCCESS) { @@ -241,10 +241,10 @@ void WorkScheduler::initialize() size_t ret_val_size = 0; printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); error2 = clGetProgramBuildInfo(program, cldevices[0], CL_PROGRAM_BUILD_LOG, 0, NULL, &ret_val_size); - if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } - char *build_log = new char[ret_val_size+1]; + if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } + char *build_log = new char[ret_val_size + 1]; error2 = clGetProgramBuildInfo(program, cldevices[0], CL_PROGRAM_BUILD_LOG, ret_val_size, build_log, NULL); - if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } + if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } build_log[ret_val_size] = '\0'; printf("%s", build_log); delete build_log; @@ -252,11 +252,11 @@ void WorkScheduler::initialize() } else { unsigned int indexDevices; - for (indexDevices = 0 ; indexDevices < totalNumberOfDevices ; indexDevices ++) { + for (indexDevices = 0; indexDevices < totalNumberOfDevices; indexDevices++) { cl_device_id device = cldevices[indexDevices]; OpenCLDevice *clDevice = new OpenCLDevice(context, device, program); clDevice->initialize(), - gpudevices.push_back(clDevice); + gpudevices.push_back(clDevice); if (G.f & G_DEBUG) { char resultString[32]; error = clGetDeviceInfo(device, CL_DEVICE_NAME, 32, resultString, 0); @@ -267,8 +267,8 @@ void WorkScheduler::initialize() } } } - delete [] cldevices; - delete [] platforms; + delete[] cldevices; + delete[] platforms; } #endif #endif @@ -278,14 +278,14 @@ void WorkScheduler::deinitialize() { #if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE Device *device; - while (cpudevices.size()>0) { + while (cpudevices.size() > 0) { device = cpudevices.back(); cpudevices.pop_back(); device->deinitialize(); delete device; } #ifdef COM_OPENCL_ENABLED - while (gpudevices.size()>0) { + while (gpudevices.size() > 0) { device = gpudevices.back(); gpudevices.pop_back(); device->deinitialize(); |