Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-01-04 22:06:32 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-01-04 22:06:32 +0400
commit049ab984697aa277c476833670275624c4385257 (patch)
tree28f01921f0372247a669b36fd4877d3011a1f73e /intern/cycles/app/cycles_server.cpp
parentcd84a43334f59d9ff613a240467bbec5c882b7da (diff)
Cycles: device code refactoring, no functional changes.
Diffstat (limited to 'intern/cycles/app/cycles_server.cpp')
-rw-r--r--intern/cycles/app/cycles_server.cpp31
1 files changed, 28 insertions, 3 deletions
diff --git a/intern/cycles/app/cycles_server.cpp b/intern/cycles/app/cycles_server.cpp
index bcf4d3ea769..e6a13e04b48 100644
--- a/intern/cycles/app/cycles_server.cpp
+++ b/intern/cycles/app/cycles_server.cpp
@@ -34,8 +34,9 @@ int main(int argc, const char **argv)
/* device types */
string devices = "";
string devicename = "cpu";
+ bool list = false;
- vector<DeviceType> types = Device::available_types();
+ vector<DeviceType>& types = Device::available_types();
foreach(DeviceType type, types) {
if(devices != "")
@@ -49,6 +50,7 @@ int main(int argc, const char **argv)
ap.options ("Usage: cycles_server [options]",
"--device %s", &devicename, ("Devices to use: " + devices).c_str(),
+ "--list-devices", &list, "List information about all available devices",
NULL);
if(ap.parse(argc, argv) < 0) {
@@ -56,11 +58,34 @@ int main(int argc, const char **argv)
ap.usage();
exit(EXIT_FAILURE);
}
+ else if(list) {
+ vector<DeviceInfo>& devices = Device::available_devices();
- DeviceType dtype = Device::type_from_string(devicename.c_str());
+ printf("Devices:\n");
+
+ foreach(DeviceInfo& info, devices) {
+ printf(" %s%s\n",
+ info.description.c_str(),
+ (info.display_device)? " (display)": "");
+ }
+
+ exit(EXIT_SUCCESS);
+ }
+
+ /* find matching device */
+ DeviceType device_type = Device::type_from_string(devicename.c_str());
+ vector<DeviceInfo>& devices = Device::available_devices();
+ DeviceInfo device_info;
+
+ foreach(DeviceInfo& device, devices) {
+ if(device_type == device.type) {
+ device_info = device;
+ break;
+ }
+ }
while(1) {
- Device *device = Device::create(dtype);
+ Device *device = Device::create(device_info);
printf("Cycles Server with device: %s\n", device->description().c_str());
device->server_run();
delete device;