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
path: root/intern
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-02-19 21:00:46 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-02-19 21:00:46 +0300
commite2a90b804566843416e15558095083ec2e735195 (patch)
tree41aec97570e494ad3d0fb0f0e70663a5de92c408 /intern
parent2be29999bd4174b99afc634bb3262decccd5278d (diff)
parent667033e89e7fe5241592e72e088a19723ca906b5 (diff)
Merge branch 'blender2.7'
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/device/opencl/opencl_util.cpp36
-rw-r--r--intern/cycles/util/util_system.cpp5
2 files changed, 31 insertions, 10 deletions
diff --git a/intern/cycles/device/opencl/opencl_util.cpp b/intern/cycles/device/opencl/opencl_util.cpp
index fe5ba4886a9..a6a80b0c2de 100644
--- a/intern/cycles/device/opencl/opencl_util.cpp
+++ b/intern/cycles/device/opencl/opencl_util.cpp
@@ -383,6 +383,12 @@ bool OpenCLDeviceBase::OpenCLProgram::compile_kernel(const string *debug_src)
return true;
}
+static void escape_python_string(string& str)
+{
+ /* Escape string to be passed as a Python raw string with '' quotes'. */
+ string_replace(str, "'", "\'");
+}
+
bool OpenCLDeviceBase::OpenCLProgram::compile_separate(const string& clbin)
{
vector<string> args;
@@ -390,16 +396,30 @@ bool OpenCLDeviceBase::OpenCLProgram::compile_separate(const string& clbin)
args.push_back("--factory-startup");
args.push_back("--python-expr");
+ const char *force_all_platforms = (DebugFlags().opencl.kernel_type != DebugFlags::OpenCL::KERNEL_DEFAULT)? "true" : "false";
+ int device_platform_id = device->device_num;
+ string device_name = device->device_name;
+ string platform_name = device->platform_name;
+ string build_options = device->kernel_build_options(NULL) + kernel_build_options;
+ string kernel_file_escaped = kernel_file;
+ string clbin_escaped = clbin;
+
+ escape_python_string(device_name);
+ escape_python_string(platform_name);
+ escape_python_string(build_options);
+ escape_python_string(kernel_file_escaped);
+ escape_python_string(clbin_escaped);
+
args.push_back(
string_printf(
- "import _cycles; _cycles.opencl_compile('%s', '%d', '%s', '%s', '%s', '%s', '%s')",
- (DebugFlags().opencl.kernel_type != DebugFlags::OpenCL::KERNEL_DEFAULT)? "true" : "false",
- device->device_num,
- device->device_name.c_str(),
- device->platform_name.c_str(),
- (device->kernel_build_options(NULL) + kernel_build_options).c_str(),
- kernel_file.c_str(),
- clbin.c_str()));
+ "import _cycles; _cycles.opencl_compile(r'%s', r'%d', r'%s', r'%s', r'%s', r'%s', r'%s')",
+ force_all_platforms,
+ device_platform_id,
+ device_name.c_str(),
+ platform_name.c_str(),
+ build_options.c_str(),
+ kernel_file_escaped.c_str(),
+ clbin_escaped.c_str()));
double starttime = time_dt();
add_log(string("Cycles: compiling OpenCL program ") + program_name + "...", false);
diff --git a/intern/cycles/util/util_system.cpp b/intern/cycles/util/util_system.cpp
index a79829a3dd9..2a5c4a8f012 100644
--- a/intern/cycles/util/util_system.cpp
+++ b/intern/cycles/util/util_system.cpp
@@ -341,10 +341,11 @@ bool system_call_self(const vector<string>& args)
cmd += " \"" + args[i] + "\"";
}
- /* Quiet output. */
#ifdef _WIN32
- cmd += " > nul";
+ /* Use cmd /S to avoid issues with spaces in arguments. */
+ cmd = "cmd /S /C \"" + cmd + " > nul \"";
#else
+ /* Quiet output. */
cmd += " > /dev/null";
#endif