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:
authorSergey Sharybin <sergey.vfx@gmail.com>2016-01-12 14:00:48 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-01-12 14:21:30 +0300
commitac7aefd7c2bc0e87b2787e374d414f18b7887baa (patch)
tree9dddc76953051052793639d4d59a934d1e97f250 /intern/cycles/device/device_opencl.cpp
parentc6c223ade6470e7a9b61ea4a4a3ab6ed62abe79d (diff)
Cycles: Use special debug panel to fine-tune debug flags
This panel is only visible when debug_value is set to 256 and has no affect in other cases. However, if debug value is not set to this value, environment variables will be used to control which features are enabled, so there's no visible changes to anyone in fact. There are some changes needed to prevent devices re-enumeration on every Cycles session create. Reviewers: juicyfruit, lukasstockner97, dingto, brecht Reviewed By: lukasstockner97, dingto Differential Revision: https://developer.blender.org/D1720
Diffstat (limited to 'intern/cycles/device/device_opencl.cpp')
-rw-r--r--intern/cycles/device/device_opencl.cpp33
1 files changed, 16 insertions, 17 deletions
diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp
index 991d0077b10..ce854ca3031 100644
--- a/intern/cycles/device/device_opencl.cpp
+++ b/intern/cycles/device/device_opencl.cpp
@@ -27,6 +27,7 @@
#include "buffers.h"
+#include "util_debug.h"
#include "util_foreach.h"
#include "util_logging.h"
#include "util_map.h"
@@ -84,29 +85,28 @@ namespace {
cl_device_type opencl_device_type()
{
- char *device = getenv("CYCLES_OPENCL_TEST");
-
- if(device) {
- if(strcmp(device, "NONE") == 0)
+ switch(DebugFlags().opencl.device_type)
+ {
+ case DebugFlags::OpenCL::DEVICE_NONE:
return 0;
- if(strcmp(device, "ALL") == 0)
+ case DebugFlags::OpenCL::DEVICE_ALL:
return CL_DEVICE_TYPE_ALL;
- else if(strcmp(device, "DEFAULT") == 0)
+ case DebugFlags::OpenCL::DEVICE_DEFAULT:
return CL_DEVICE_TYPE_DEFAULT;
- else if(strcmp(device, "CPU") == 0)
+ case DebugFlags::OpenCL::DEVICE_CPU:
return CL_DEVICE_TYPE_CPU;
- else if(strcmp(device, "GPU") == 0)
+ case DebugFlags::OpenCL::DEVICE_GPU:
return CL_DEVICE_TYPE_GPU;
- else if(strcmp(device, "ACCELERATOR") == 0)
+ case DebugFlags::OpenCL::DEVICE_ACCELERATOR:
return CL_DEVICE_TYPE_ACCELERATOR;
+ default:
+ return CL_DEVICE_TYPE_ALL;
}
-
- return CL_DEVICE_TYPE_ALL;
}
-bool opencl_kernel_use_debug()
+inline bool opencl_kernel_use_debug()
{
- return (getenv("CYCLES_OPENCL_DEBUG") != NULL);
+ return DebugFlags().opencl.debug;
}
bool opencl_kernel_use_advanced_shading(const string& platform)
@@ -129,11 +129,11 @@ bool opencl_kernel_use_advanced_shading(const string& platform)
bool opencl_kernel_use_split(const string& platform_name,
const cl_device_type device_type)
{
- if(getenv("CYCLES_OPENCL_SPLIT_KERNEL_TEST") != NULL) {
+ if(DebugFlags().opencl.kernel_type == DebugFlags::OpenCL::KERNEL_SPLIT) {
VLOG(1) << "Forcing split kernel to use.";
return true;
}
- if(getenv("CYCLES_OPENCL_MEGA_KERNEL_TEST") != NULL) {
+ if(DebugFlags().opencl.kernel_type == DebugFlags::OpenCL::KERNEL_MEGA) {
VLOG(1) << "Forcing mega kernel to use.";
return false;
}
@@ -229,8 +229,7 @@ bool opencl_device_version_check(cl_device_id device,
void opencl_get_usable_devices(vector<OpenCLPlatformDevice> *usable_devices)
{
const bool force_all_platforms =
- (getenv("CYCLES_OPENCL_MEGA_KERNEL_TEST") != NULL) ||
- (getenv("CYCLES_OPENCL_SPLIT_KERNEL_TEST") != NULL);
+ (DebugFlags().opencl.kernel_type != DebugFlags::OpenCL::KERNEL_DEFAULT);
const cl_device_type device_type = opencl_device_type();
static bool first_time = true;
#define FIRST_VLOG(severity) if(first_time) VLOG(severity)