diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /intern/cycles/app/cycles_server.cpp | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'intern/cycles/app/cycles_server.cpp')
-rw-r--r-- | intern/cycles/app/cycles_server.cpp | 158 |
1 files changed, 83 insertions, 75 deletions
diff --git a/intern/cycles/app/cycles_server.cpp b/intern/cycles/app/cycles_server.cpp index e2166473aa3..c5a4c9b375b 100644 --- a/intern/cycles/app/cycles_server.cpp +++ b/intern/cycles/app/cycles_server.cpp @@ -30,85 +30,93 @@ using namespace ccl; int main(int argc, const char **argv) { - util_logging_init(argv[0]); - path_init(); + util_logging_init(argv[0]); + path_init(); + + /* device types */ + string devicelist = ""; + string devicename = "cpu"; + bool list = false, debug = false; + int threads = 0, verbosity = 1; + + vector<DeviceType> &types = Device::available_types(); + + foreach (DeviceType type, types) { + if (devicelist != "") + devicelist += ", "; + + devicelist += Device::string_from_type(type); + } + + /* parse options */ + ArgParse ap; + + ap.options("Usage: cycles_server [options]", + "--device %s", + &devicename, + ("Devices to use: " + devicelist).c_str(), + "--list-devices", + &list, + "List information about all available devices", + "--threads %d", + &threads, + "Number of threads to use for CPU device", +#ifdef WITH_CYCLES_LOGGING + "--debug", + &debug, + "Enable debug logging", + "--verbose %d", + &verbosity, + "Set verbosity of the logger", +#endif + NULL); - /* device types */ - string devicelist = ""; - string devicename = "cpu"; - bool list = false, debug = false; - int threads = 0, verbosity = 1; + if (ap.parse(argc, argv) < 0) { + fprintf(stderr, "%s\n", ap.geterror().c_str()); + ap.usage(); + exit(EXIT_FAILURE); + } - vector<DeviceType>& types = Device::available_types(); + if (debug) { + util_logging_start(); + util_logging_verbosity_set(verbosity); + } - foreach(DeviceType type, types) { - if(devicelist != "") - devicelist += ", "; + if (list) { + vector<DeviceInfo> &devices = Device::available_devices(); - devicelist += Device::string_from_type(type); - } + printf("Devices:\n"); - /* parse options */ - ArgParse ap; + foreach (DeviceInfo &info, devices) { + printf(" %s%s\n", info.description.c_str(), (info.display_device) ? " (display)" : ""); + } - ap.options ("Usage: cycles_server [options]", - "--device %s", &devicename, ("Devices to use: " + devicelist).c_str(), - "--list-devices", &list, "List information about all available devices", - "--threads %d", &threads, "Number of threads to use for CPU device", -#ifdef WITH_CYCLES_LOGGING - "--debug", &debug, "Enable debug logging", - "--verbose %d", &verbosity, "Set verbosity of the logger", -#endif - NULL); - - if(ap.parse(argc, argv) < 0) { - fprintf(stderr, "%s\n", ap.geterror().c_str()); - ap.usage(); - exit(EXIT_FAILURE); - } - - if(debug) { - util_logging_start(); - util_logging_verbosity_set(verbosity); - } - - if(list) { - vector<DeviceInfo>& devices = Device::available_devices(); - - 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; - } - } - - TaskScheduler::init(threads); - - while(1) { - Stats stats; - Device *device = Device::create(device_info, stats, true); - printf("Cycles Server with device: %s\n", device->info.description.c_str()); - device->server_run(); - delete device; - } - - TaskScheduler::exit(); - - return 0; + 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; + } + } + + TaskScheduler::init(threads); + + while (1) { + Stats stats; + Device *device = Device::create(device_info, stats, true); + printf("Cycles Server with device: %s\n", device->info.description.c_str()); + device->server_run(); + delete device; + } + + TaskScheduler::exit(); + + return 0; } |