From 1f7ac51c360f69e82244324161c87cbc32c518fb Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 1 Sep 2011 22:40:52 +0000 Subject: [PATCH] Cycles: fix opencl device bug that crashed on windows. Now shows diffuse meshes here on windows/nvidia. --- intern/cycles/device/device_opencl.cpp | 3 ++- intern/cycles/kernel/kernel_shader.h | 2 +- intern/cycles/util/util_opencl.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp index d67fdc970a9..4020cc87392 100644 --- a/intern/cycles/device/device_opencl.cpp +++ b/intern/cycles/device/device_opencl.cpp @@ -140,13 +140,14 @@ public: /* compile kernel */ string source = string_printf("#include \"kernel.cl\" // %lf\n", time_dt()); size_t source_len = source.size(); + const char *source_str = source.c_str(); string build_options = ""; build_options += "-I " + path_get("kernel") + " -I " + path_get("util"); /* todo: escape path */ build_options += " -Werror -cl-fast-relaxed-math -cl-strict-aliasing"; - cpProgram = clCreateProgramWithSource(cxContext, 1, (const char **)&source, &source_len, &ciErr); + cpProgram = clCreateProgramWithSource(cxContext, 1, (const char **)&source_str, &source_len, &ciErr); opencl_assert(ciErr); diff --git a/intern/cycles/kernel/kernel_shader.h b/intern/cycles/kernel/kernel_shader.h index 237033eff8b..92d920b5c61 100644 --- a/intern/cycles/kernel/kernel_shader.h +++ b/intern/cycles/kernel/kernel_shader.h @@ -377,7 +377,7 @@ __device void shader_eval_surface(KernelGlobals *kg, ShaderData *sd, #ifdef __SVM__ svm_eval_nodes(kg, sd, SHADER_TYPE_SURFACE, randb, path_flag); #else - sd->svm_closure = CLOSURE_BSDF_DIFFUSE_ID; + bsdf_diffuse_setup(sd, sd->N); sd->svm_closure_weight = make_float3(0.8f, 0.8f, 0.8f); #endif diff --git a/intern/cycles/util/util_opencl.c b/intern/cycles/util/util_opencl.c index d0b7bb331a8..10429ffcd80 100755 --- a/intern/cycles/util/util_opencl.c +++ b/intern/cycles/util/util_opencl.c @@ -130,7 +130,7 @@ static void clewExit(void) int clLibraryInit() { #ifdef _WIN32 - const char *path = "opencl.dll"; + const char *path = "OpenCL.dll"; #elif defined(__APPLE__) const char *path = "/Library/Frameworks/OpenCL.framework/OpenCL"; #else