[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43097] branches/tile/source/blender/ compositor/intern/COM_WorkScheduler.cpp: Tile Branch

Jeroen Bakker j.bakker at atmind.nl
Tue Jan 3 13:41:02 CET 2012


Revision: 43097
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43097
Author:   jbakker
Date:     2012-01-03 12:40:51 +0000 (Tue, 03 Jan 2012)
Log Message:
-----------
Tile Branch
 * make sure that OpenCL initialization works for the MS compiler. Issue concerned the way when local variables are initialized.
GNU based compilers initialize locals when the variable is defined.
MS compiler first initialize all local variables, before any code will be executed.

The arrays are now initialized in code to make sure it compiles on MS compiler.

Modified Paths:
--------------
    branches/tile/source/blender/compositor/intern/COM_WorkScheduler.cpp

Modified: branches/tile/source/blender/compositor/intern/COM_WorkScheduler.cpp
===================================================================
--- branches/tile/source/blender/compositor/intern/COM_WorkScheduler.cpp	2012-01-03 12:06:30 UTC (rev 43096)
+++ branches/tile/source/blender/compositor/intern/COM_WorkScheduler.cpp	2012-01-03 12:40:51 UTC (rev 43097)
@@ -224,7 +224,7 @@
 		error = clGetPlatformIDs(0, 0, &numberOfPlatforms);
 		if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error));	}
 		printf("%d number of platforms\n", numberOfPlatforms);
-		cl_platform_id platforms[numberOfPlatforms];
+		cl_platform_id *platforms = new cl_platform_id[numberOfPlatforms];
 		error = clGetPlatformIDs(numberOfPlatforms, platforms, 0);
 		unsigned int indexPlatform;
 		cl_uint totalNumberOfDevices = 0;
@@ -235,7 +235,7 @@
 			totalNumberOfDevices += numberOfDevices;
 		}
 
-		cl_device_id cldevices[totalNumberOfDevices];
+		cl_device_id *cldevices = new cl_device_id[totalNumberOfDevices];
 		unsigned int numberOfDevicesReceived = 0;
 		for (indexPlatform = 0 ; indexPlatform < numberOfPlatforms ; indexPlatform ++) {
 			cl_platform_id platform = platforms[indexPlatform];
@@ -274,6 +274,8 @@
 			error = clGetDeviceInfo(device, CL_DEVICE_VENDOR, 32, resultString, 0);
 			printf("%s\n", resultString);
 		}
+		delete cldevices;
+		delete platforms;
 	}
 #endif
 #endif




More information about the Bf-blender-cvs mailing list