diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-10-11 16:17:14 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-10-11 16:22:54 +0400 |
commit | 54ee22130ca0ce59500c6eddb562b78eb4526bcd (patch) | |
tree | ba21cdaa35656c590059c864e028e24b6e234082 /intern/cycles | |
parent | b09f7dcaa7b487ada53c8dbaa811deaa1201d163 (diff) | |
parent | 04814476c08e9350c424619cd99ccb1149d65365 (diff) |
Merge branch 'master' into dyntopo_holesdyntopo_holes
Conflicts:
source/blender/blenkernel/intern/pbvh_bmesh.c
Diffstat (limited to 'intern/cycles')
24 files changed, 153 insertions, 98 deletions
diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt index 981499b3a91..fb747c1313e 100644 --- a/intern/cycles/CMakeLists.txt +++ b/intern/cycles/CMakeLists.txt @@ -165,7 +165,9 @@ include_directories( # Warnings if(CMAKE_COMPILER_IS_GNUCXX) ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS _has_cxxflag_float_conversion "-Werror=float-conversion") + ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS _has_cxxflag_double_promotion "-Werror=double-promotion") unset(_has_cxxflag_float_conversion) + unset(_has_cxxflag_double_promotion) endif() diff --git a/intern/cycles/SConscript b/intern/cycles/SConscript index 594b43c88b2..b399844534d 100644 --- a/intern/cycles/SConscript +++ b/intern/cycles/SConscript @@ -45,7 +45,7 @@ incs = [] defs = [] cxxflags = Split(env['CXXFLAGS']) -defs.append('GLEW_STATIC') +defs += env['BF_GL_DEFINITIONS'] defs.append('CCL_NAMESPACE_BEGIN=namespace ccl {') defs.append('CCL_NAMESPACE_END=}') @@ -65,7 +65,12 @@ if env['WITH_BF_CYCLES_DEBUG']: incs.extend('. bvh render device kernel kernel/osl kernel/svm util subd'.split()) incs.extend('#intern/guardedalloc #source/blender/makesrna #source/blender/makesdna #source/blender/blenlib'.split()) incs.extend('#source/blender/blenloader ../../source/blender/makesrna/intern'.split()) + +incs.append(env['BF_GLEW_INC']) +incs.append('#/intern/glew-mx') +incs.append('#intern/mikktspace') incs.extend('#extern/glew/include #extern/clew/include #extern/cuew/include #intern/mikktspace'.split()) + incs.append(cycles['BF_OIIO_INC']) incs.append(cycles['BF_BOOST_INC']) incs.append(cycles['BF_OPENEXR_INC'].split()) diff --git a/intern/cycles/app/CMakeLists.txt b/intern/cycles/app/CMakeLists.txt index 5876ac3779c..c8464899725 100644 --- a/intern/cycles/app/CMakeLists.txt +++ b/intern/cycles/app/CMakeLists.txt @@ -21,8 +21,9 @@ set(LIBRARIES cycles_util ${BOOST_LIBRARIES} ${OPENEXR_LIBRARIES} - ${OPENGL_LIBRARIES} - ${CYCLES_GLEW_LIBRARY} + ${BLENDER_GL_LIBRARIES} + bf_intern_glew_mx + ${CYCLES_APP_GLEW_LIBRARY} ${OPENIMAGEIO_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} @@ -32,6 +33,8 @@ set(LIBRARIES extern_cuew ) +add_definitions(${GL_DEFINITIONS}) + if(WIN32) list(APPEND LIBRARIES ${PTHREADS_LIBRARIES}) endif() diff --git a/intern/cycles/blender/CMakeLists.txt b/intern/cycles/blender/CMakeLists.txt index 13ac0be0562..e1d592d32b4 100644 --- a/intern/cycles/blender/CMakeLists.txt +++ b/intern/cycles/blender/CMakeLists.txt @@ -6,6 +6,7 @@ set(INC ../kernel/svm ../util ../subd + ../../glew-mx ../../guardedalloc ../../mikktspace ../../../source/blender/makesdna @@ -47,7 +48,7 @@ set(ADDON_FILES addon/version_update.py ) -add_definitions(-DGLEW_STATIC) +add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_intern_cycles "${SRC}" "${INC}" "${INC_SYS}") diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp index 0610c3f6579..57ffea4b1a9 100644 --- a/intern/cycles/blender/blender_session.cpp +++ b/intern/cycles/blender/blender_session.cpp @@ -830,7 +830,7 @@ void BlenderSession::update_status_progress() if(background) { if(progress>0) - remaining_time = (1-progress) * (total_time / progress); + remaining_time = (1.0 - (double)progress) * (total_time / (double)progress); scene += " | " + b_scene.name(); if(b_rlay_name != "") @@ -849,7 +849,7 @@ void BlenderSession::update_status_progress() timestatus += "Remaining:" + string(time_str) + " | "; } - timestatus += string_printf("Mem:%.2fM, Peak:%.2fM", mem_used, mem_peak); + timestatus += string_printf("Mem:%.2fM, Peak:%.2fM", (double)mem_used, (double)mem_peak); if(status.size() > 0) status = " | " + status; diff --git a/intern/cycles/cmake/external_libs.cmake b/intern/cycles/cmake/external_libs.cmake index bb174d6df26..4f02b93f04a 100644 --- a/intern/cycles/cmake/external_libs.cmake +++ b/intern/cycles/cmake/external_libs.cmake @@ -1,4 +1,3 @@ - ########################################################################### # GLUT @@ -14,10 +13,11 @@ if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI) ) endif() -if(WITH_SYSTEM_GLEW) - set(CYCLES_GLEW_LIBRARY ${GLEW_LIBRARY}) -else() - set(CYCLES_GLEW_LIBRARY extern_glew) +########################################################################### +# GLEW + +if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI) + set(CYCLES_APP_GLEW_LIBRARY ${BLENDER_GLEW_LIBRARIES}) endif() ########################################################################### @@ -32,4 +32,3 @@ if(WITH_CYCLES_CUDA_BINARIES) set(WITH_CYCLES_CUDA_BINARIES OFF) endif() endif() - diff --git a/intern/cycles/device/CMakeLists.txt b/intern/cycles/device/CMakeLists.txt index a62ce29f722..998b35351e3 100644 --- a/intern/cycles/device/CMakeLists.txt +++ b/intern/cycles/device/CMakeLists.txt @@ -6,10 +6,10 @@ set(INC ../kernel/osl ../util ../render + ../../glew-mx ) set(INC_SYS - ${OPENGL_INCLUDE_DIR} ${GLEW_INCLUDE_PATH} ../../../extern/cuew/include ../../../extern/clew/include @@ -38,7 +38,7 @@ set(SRC_HEADERS device_task.h ) -add_definitions(-DGLEW_STATIC) +add_definitions(${GL_DEFINITIONS}) include_directories(${INC}) include_directories(SYSTEM ${INC_SYS}) diff --git a/intern/cycles/kernel/closure/bsdf_microfacet.h b/intern/cycles/kernel/closure/bsdf_microfacet.h index 2079d26e5ad..8737b0e2d94 100644 --- a/intern/cycles/kernel/closure/bsdf_microfacet.h +++ b/intern/cycles/kernel/closure/bsdf_microfacet.h @@ -43,30 +43,65 @@ CCL_NAMESPACE_BEGIN * Some constants are baked into the code. */ -ccl_device_inline float approx_erff(float x) +ccl_device_inline float approx_erff_do(float x) { - float s = 1.0f; - if(x < 0.0f) { - s = -1.0f; - x = -x; - } /* Such a clamp doesn't give much distortion to the output value * and gives quite a few of the speedup. */ if(x > 3.0f) { - return s; + return 1.0f; } float t = 1.0f / (1.0f + 0.47047f*x); - return s * (1.0f - - t*(0.3480242f + t*(-0.0958798f + t*0.7478556f)) * expf(-x*x)); + return (1.0f - + t*(0.3480242f + t*(-0.0958798f + t*0.7478556f)) * expf(-x*x)); +} + +ccl_device_inline float approx_erff(float x) +{ + if(x >= 0.0f) { + return approx_erff_do(x); + } + else { + return -approx_erff_do(-x); + } +} + +ccl_device_inline float approx_erfinvf_do(float x) +{ + if(x <= 0.7f) { + const float x2 = x * x; + const float a1 = 0.886226899f; + const float a2 = -1.645349621f; + const float a3 = 0.914624893f; + const float a4 = -0.140543331f; + const float b1 = -2.118377725f; + const float b2 = 1.442710462f; + const float b3 = -0.329097515f; + const float b4 = 0.012229801f; + return x * (((a4 * x2 + a3) * x2 + a2) * x2 + a1) / + ((((b4 * x2 + b3) * x2 + b2) * x2 + b1) * x2 + 1.0f); + } + else { + const float c1 = -1.970840454f; + const float c2 = -1.624906493f; + const float c3 = 3.429567803f; + const float c4 = 1.641345311f; + const float d1 = 3.543889200f; + const float d2 = 1.637067800f; + const float z = sqrtf(-logf((1.0f - x) * 0.5f)); + return (((c4 * z + c3) * z + c2) * z + c1) / + ((d2 * z + d1) * z + 1.0f); + } } ccl_device_inline float approx_erfinvf(float x) { - float ln1_x2 = logf(1.0f - x*x); - float term = 4.546884979448f + ln1_x2 * 0.5f; - return copysignf(1.0f, x) * - sqrtf(sqrtf(term*term - ln1_x2 * 7.142230224076f) - term); + if(x >= 0.0f) { + return approx_erfinvf_do(x); + } + else { + return -approx_erfinvf_do(-x); + } } /* Beckmann and GGX microfacet importance sampling from: diff --git a/intern/cycles/kernel/geom/geom_bvh_traversal.h b/intern/cycles/kernel/geom/geom_bvh_traversal.h index eed54a4d00d..114d30a479d 100644 --- a/intern/cycles/kernel/geom/geom_bvh_traversal.h +++ b/intern/cycles/kernel/geom/geom_bvh_traversal.h @@ -63,10 +63,10 @@ ccl_device bool BVH_FUNCTION_NAME #endif isect->t = ray->t; - isect->object = OBJECT_NONE; - isect->prim = PRIM_NONE; isect->u = 0.0f; isect->v = 0.0f; + isect->prim = PRIM_NONE; + isect->object = OBJECT_NONE; #if defined(__KERNEL_DEBUG__) isect->num_traversal_steps = 0; diff --git a/intern/cycles/kernel/geom/geom_bvh_volume.h b/intern/cycles/kernel/geom/geom_bvh_volume.h index aac0a18647a..9dd8d226f5b 100644 --- a/intern/cycles/kernel/geom/geom_bvh_volume.h +++ b/intern/cycles/kernel/geom/geom_bvh_volume.h @@ -61,10 +61,10 @@ ccl_device bool BVH_FUNCTION_NAME(KernelGlobals *kg, #endif isect->t = ray->t; - isect->object = OBJECT_NONE; - isect->prim = PRIM_NONE; isect->u = 0.0f; isect->v = 0.0f; + isect->prim = PRIM_NONE; + isect->object = OBJECT_NONE; #if defined(__KERNEL_SSE2__) const shuffle_swap_t shuf_identity = shuffle_swap_identity(); diff --git a/intern/cycles/kernel/geom/geom_curve.h b/intern/cycles/kernel/geom/geom_curve.h index c4e9e2ababe..b6d21c91916 100644 --- a/intern/cycles/kernel/geom/geom_curve.h +++ b/intern/cycles/kernel/geom/geom_curve.h @@ -600,12 +600,12 @@ ccl_device_inline bool bvh_cardinal_curve_intersect(KernelGlobals *kg, Intersect #endif { /* record intersection */ + isect->t = t; + isect->u = u; + isect->v = gd; isect->prim = curveAddr; isect->object = object; isect->type = type; - isect->u = u; - isect->v = gd; - isect->t = t; hit = true; } @@ -835,12 +835,12 @@ ccl_device_inline bool bvh_curve_intersect(KernelGlobals *kg, Intersection *isec #endif { /* record intersection */ + isect->t = t; + isect->u = z*invl; + isect->v = gd; isect->prim = curveAddr; isect->object = object; isect->type = type; - isect->u = z*invl; - isect->v = gd; - isect->t = t; return true; } diff --git a/intern/cycles/kernel/geom/geom_motion_triangle.h b/intern/cycles/kernel/geom/geom_motion_triangle.h index b275b89a8a4..3a4b20e61aa 100644 --- a/intern/cycles/kernel/geom/geom_motion_triangle.h +++ b/intern/cycles/kernel/geom/geom_motion_triangle.h @@ -336,12 +336,12 @@ ccl_device_inline bool motion_triangle_intersect(KernelGlobals *kg, Intersection if(kernel_tex_fetch(__prim_visibility, triAddr) & visibility) #endif { + isect->t = t; + isect->u = u; + isect->v = v; isect->prim = triAddr; isect->object = object; isect->type = PRIMITIVE_MOTION_TRIANGLE; - isect->u = u; - isect->v = v; - isect->t = t; return true; } @@ -388,12 +388,12 @@ ccl_device_inline void motion_triangle_intersect_subsurface(KernelGlobals *kg, I /* record intersection */ Intersection *isect = &isect_array[hit]; + isect->t = t; + isect->u = u; + isect->v = v; isect->prim = triAddr; isect->object = object; isect->type = PRIMITIVE_MOTION_TRIANGLE; - isect->u = u; - isect->v = v; - isect->t = t; } } #endif diff --git a/intern/cycles/kernel/geom/geom_triangle.h b/intern/cycles/kernel/geom/geom_triangle.h index 3d3a5e72485..c08a82ee038 100644 --- a/intern/cycles/kernel/geom/geom_triangle.h +++ b/intern/cycles/kernel/geom/geom_triangle.h @@ -120,7 +120,7 @@ ccl_device_inline float3 triangle_refine_subsurface(KernelGlobals *kg, ShaderDat ccl_device_inline float3 triangle_normal(KernelGlobals *kg, ShaderData *sd) { /* load triangle vertices */ - float3 tri_vindex = float4_to_float3(kernel_tex_fetch(__tri_vindex, sd->prim)); + float4 tri_vindex = kernel_tex_fetch(__tri_vindex, sd->prim); float3 v0 = float4_to_float3(kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.x))); float3 v1 = float4_to_float3(kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.y))); @@ -137,7 +137,7 @@ ccl_device_inline float3 triangle_normal(KernelGlobals *kg, ShaderData *sd) ccl_device_inline void triangle_point_normal(KernelGlobals *kg, int object, int prim, float u, float v, float3 *P, float3 *Ng, int *shader) { /* load triangle vertices */ - float3 tri_vindex = float4_to_float3(kernel_tex_fetch(__tri_vindex, prim)); + float4 tri_vindex = kernel_tex_fetch(__tri_vindex, prim); float3 v0 = float4_to_float3(kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.x))); float3 v1 = float4_to_float3(kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.y))); @@ -164,7 +164,7 @@ ccl_device_inline void triangle_point_normal(KernelGlobals *kg, int object, int ccl_device_inline void triangle_vertices(KernelGlobals *kg, int prim, float3 P[3]) { - float3 tri_vindex = float4_to_float3(kernel_tex_fetch(__tri_vindex, prim)); + float4 tri_vindex = kernel_tex_fetch(__tri_vindex, prim); P[0] = float4_to_float3(kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.x))); P[1] = float4_to_float3(kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.y))); @@ -176,7 +176,7 @@ ccl_device_inline void triangle_vertices(KernelGlobals *kg, int prim, float3 P[3 ccl_device_inline float3 triangle_smooth_normal(KernelGlobals *kg, int prim, float u, float v) { /* load triangle vertices */ - float3 tri_vindex = float4_to_float3(kernel_tex_fetch(__tri_vindex, prim)); + float4 tri_vindex = kernel_tex_fetch(__tri_vindex, prim); float3 n0 = float4_to_float3(kernel_tex_fetch(__tri_vnormal, __float_as_int(tri_vindex.x))); float3 n1 = float4_to_float3(kernel_tex_fetch(__tri_vnormal, __float_as_int(tri_vindex.y))); @@ -190,7 +190,7 @@ ccl_device_inline float3 triangle_smooth_normal(KernelGlobals *kg, int prim, flo ccl_device_inline void triangle_dPdudv(KernelGlobals *kg, int prim, float3 *dPdu, float3 *dPdv) { /* fetch triangle vertex coordinates */ - float3 tri_vindex = float4_to_float3(kernel_tex_fetch(__tri_vindex, prim)); + float4 tri_vindex = kernel_tex_fetch(__tri_vindex, prim); float3 p0 = float4_to_float3(kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.x))); float3 p1 = float4_to_float3(kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.y))); @@ -212,7 +212,7 @@ ccl_device float triangle_attribute_float(KernelGlobals *kg, const ShaderData *s return kernel_tex_fetch(__attributes_float, offset + sd->prim); } else if(elem == ATTR_ELEMENT_VERTEX || elem == ATTR_ELEMENT_VERTEX_MOTION) { - float3 tri_vindex = float4_to_float3(kernel_tex_fetch(__tri_vindex, sd->prim)); + float4 tri_vindex = kernel_tex_fetch(__tri_vindex, sd->prim); float f0 = kernel_tex_fetch(__attributes_float, offset + __float_as_int(tri_vindex.x)); float f1 = kernel_tex_fetch(__attributes_float, offset + __float_as_int(tri_vindex.y)); @@ -255,7 +255,7 @@ ccl_device float3 triangle_attribute_float3(KernelGlobals *kg, const ShaderData return float4_to_float3(kernel_tex_fetch(__attributes_float3, offset + sd->prim)); } else if(elem == ATTR_ELEMENT_VERTEX || elem == ATTR_ELEMENT_VERTEX_MOTION) { - float3 tri_vindex = float4_to_float3(kernel_tex_fetch(__tri_vindex, sd->prim)); + float4 tri_vindex = kernel_tex_fetch(__tri_vindex, sd->prim); float3 f0 = float4_to_float3(kernel_tex_fetch(__attributes_float3, offset + __float_as_int(tri_vindex.x))); float3 f1 = float4_to_float3(kernel_tex_fetch(__attributes_float3, offset + __float_as_int(tri_vindex.y))); @@ -334,12 +334,12 @@ ccl_device_inline bool triangle_intersect(KernelGlobals *kg, Intersection *isect #endif { /* record intersection */ + isect->t = t; + isect->u = u; + isect->v = v; isect->prim = triAddr; isect->object = object; isect->type = PRIMITIVE_TRIANGLE; - isect->u = u; - isect->v = v; - isect->t = t; return true; } } @@ -397,12 +397,12 @@ ccl_device_inline void triangle_intersect_subsurface(KernelGlobals *kg, Intersec /* record intersection */ Intersection *isect = &isect_array[hit]; + isect->t = t; + isect->u = u; + isect->v = v; isect->prim = triAddr; isect->object = object; isect->type = PRIMITIVE_TRIANGLE; - isect->u = u; - isect->v = v; - isect->t = t; } } } diff --git a/intern/cycles/kernel/kernel_compat_cpu.h b/intern/cycles/kernel/kernel_compat_cpu.h index 25531843993..403fd0a67f7 100644 --- a/intern/cycles/kernel/kernel_compat_cpu.h +++ b/intern/cycles/kernel/kernel_compat_cpu.h @@ -29,7 +29,7 @@ * double precision version, even with float<->double conversion involved. */ #if !defined(__KERNEL_GPU__) && defined(__linux__) && defined(__x86_64__) -# define expf(x) ((float)exp((double)x)) +# define expf(x) ((float)exp((double)(x))) #endif CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/kernel/kernel_compat_cuda.h b/intern/cycles/kernel/kernel_compat_cuda.h index e4c20d26ff1..f14f3262274 100644 --- a/intern/cycles/kernel/kernel_compat_cuda.h +++ b/intern/cycles/kernel/kernel_compat_cuda.h @@ -75,12 +75,11 @@ typedef texture<uchar4, 2, cudaReadModeNormalizedFloat> texture_image_uchar4; /* Use fast math functions */ -#define cosf(x) __cosf(((float)x)) -#define sinf(x) __sinf(((float)x)) -#define powf(x, y) __powf(((float)x), ((float)y)) -#define tanf(x) __tanf(((float)x)) -#define logf(x) __logf(((float)x)) -#define expf(x) __expf(((float)x)) +#define cosf(x) __cosf(((float)(x))) +#define sinf(x) __sinf(((float)(x))) +#define powf(x, y) __powf(((float)(x)), ((float)(y))) +#define tanf(x) __tanf(((float)(x))) +#define logf(x) __logf(((float)(x))) +#define expf(x) __expf(((float)(x))) #endif /* __KERNEL_COMPAT_CUDA_H__ */ - diff --git a/intern/cycles/kernel/kernel_compat_opencl.h b/intern/cycles/kernel/kernel_compat_opencl.h index 78b3fd012dd..58031a41b78 100644 --- a/intern/cycles/kernel/kernel_compat_opencl.h +++ b/intern/cycles/kernel/kernel_compat_opencl.h @@ -77,34 +77,34 @@ #define __float_as_uint(x) as_uint(x) #define __int_as_float(x) as_float(x) #define __float_as_int(x) as_int(x) -#define powf(x, y) pow(((float)x), ((float)y)) -#define fabsf(x) fabs(((float)x)) -#define copysignf(x, y) copysign(((float)x), ((float)y)) -#define asinf(x) asin(((float)x)) -#define acosf(x) acos(((float)x)) -#define atanf(x) atan(((float)x)) -#define floorf(x) floor(((float)x)) -#define ceilf(x) ceil(((float)x)) -#define hypotf(x, y) hypot(((float)x), ((float)y)) -#define atan2f(x, y) atan2(((float)x), ((float)y)) -#define fmaxf(x, y) fmax(((float)x), ((float)y)) -#define fminf(x, y) fmin(((float)x), ((float)y)) -#define fmodf(x, y) fmod((float)x, (float)y) +#define powf(x, y) pow(((float)(x)), ((float)(y))) +#define fabsf(x) fabs(((float)(x))) +#define copysignf(x, y) copysign(((float)(x)), ((float)(y))) +#define asinf(x) asin(((float)(x))) +#define acosf(x) acos(((float)(x))) +#define atanf(x) atan(((float)(x))) +#define floorf(x) floor(((float)(x))) +#define ceilf(x) ceil(((float)(x))) +#define hypotf(x, y) hypot(((float)(x)), ((float)(y))) +#define atan2f(x, y) atan2(((float)(x)), ((float)(y))) +#define fmaxf(x, y) fmax(((float)(x)), ((float)(y))) +#define fminf(x, y) fmin(((float)(x)), ((float)(y))) +#define fmodf(x, y) fmod((float)(x), (float)(y)) #ifndef __CL_USE_NATIVE__ -#define sinf(x) native_sin(((float)x)) -#define cosf(x) native_cos(((float)x)) -#define tanf(x) native_tan(((float)x)) -#define expf(x) native_exp(((float)x)) -#define sqrtf(x) native_sqrt(((float)x)) -#define logf(x) native_log(((float)x)) +#define sinf(x) native_sin(((float)(x))) +#define cosf(x) native_cos(((float)(x))) +#define tanf(x) native_tan(((float)(x))) +#define expf(x) native_exp(((float)(x))) +#define sqrtf(x) native_sqrt(((float)(x))) +#define logf(x) native_log(((float)(x))) #else -#define sinf(x) sin(((float)x)) -#define cosf(x) cos(((float)x)) -#define tanf(x) tan(((float)x)) -#define expf(x) exp(((float)x)) -#define sqrtf(x) sqrt(((float)x)) -#define logf(x) log(((float)x)) +#define sinf(x) sin(((float)(x))) +#define cosf(x) cos(((float)(x))) +#define tanf(x) tan(((float)(x))) +#define expf(x) exp(((float)(x))) +#define sqrtf(x) sqrt(((float)(x))) +#define logf(x) log(((float)(x))) #endif /* data lookup defines */ diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp index 1475e5a0a62..a9694651e14 100644 --- a/intern/cycles/kernel/osl/osl_services.cpp +++ b/intern/cycles/kernel/osl/osl_services.cpp @@ -1018,7 +1018,7 @@ bool OSLRenderServices::trace(TraceOpt &options, OSL::ShaderGlobals *sg, ray.P = TO_FLOAT3(P); ray.D = TO_FLOAT3(R); - ray.t = (options.maxdist == 1.0e30)? FLT_MAX: options.maxdist - options.mindist; + ray.t = (options.maxdist == 1.0e30f)? FLT_MAX: options.maxdist - options.mindist; ray.time = sd->time; if(options.mindist == 0.0f) { diff --git a/intern/cycles/kernel/shaders/node_image_texture.osl b/intern/cycles/kernel/shaders/node_image_texture.osl index 7238a1e8862..18b5fb4b31f 100644 --- a/intern/cycles/kernel/shaders/node_image_texture.osl +++ b/intern/cycles/kernel/shaders/node_image_texture.osl @@ -113,6 +113,10 @@ shader node_image_texture( weight[2] = ((2.0 - limit) * Nob[2] + (limit - 1.0)) / (2.0 * limit - 1.0); } } + else { + /* Desperate mode, no valid choice anyway, fallback to one side.*/ + weight[0] = 1.0; + } Color = color(0.0, 0.0, 0.0); Alpha = 0.0; diff --git a/intern/cycles/kernel/svm/svm_image.h b/intern/cycles/kernel/svm/svm_image.h index a7abeda18e5..8a256c9bda5 100644 --- a/intern/cycles/kernel/svm/svm_image.h +++ b/intern/cycles/kernel/svm/svm_image.h @@ -435,6 +435,10 @@ ccl_device void svm_node_tex_image_box(KernelGlobals *kg, ShaderData *sd, float weight.z = ((2.0f - limit)*N.z + (limit - 1.0f))/(2.0f*limit - 1.0f); } } + else { + /* Desperate mode, no valid choice anyway, fallback to one side.*/ + weight.x = 1.0f; + } /* now fetch textures */ uint co_offset, out_offset, alpha_offset, srgb; diff --git a/intern/cycles/render/CMakeLists.txt b/intern/cycles/render/CMakeLists.txt index 449c1391980..c3907da39d0 100644 --- a/intern/cycles/render/CMakeLists.txt +++ b/intern/cycles/render/CMakeLists.txt @@ -7,6 +7,7 @@ set(INC ../kernel/osl ../bvh ../util + ../../glew-mx ) set(INC_SYS @@ -76,5 +77,6 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${RTTI_DISABLE_FLAGS}") include_directories(${INC}) include_directories(SYSTEM ${INC_SYS}) -add_library(cycles_render ${SRC} ${SRC_HEADERS}) +add_definitions(${GL_DEFINITIONS}) +add_library(cycles_render ${SRC} ${SRC_HEADERS}) diff --git a/intern/cycles/render/shader.cpp b/intern/cycles/render/shader.cpp index d76e511859a..d8925852c21 100644 --- a/intern/cycles/render/shader.cpp +++ b/intern/cycles/render/shader.cpp @@ -83,7 +83,7 @@ static void beckmann_table_rows(float *table, int row_from, int row_to) } /* CDF of P22_{omega_i}(x_slope, 1, 1), Eq. (10) */ - CDF_P22_omega_i[index_slope_x] = CDF_P22_omega_i[index_slope_x - 1] + P22_omega_i; + CDF_P22_omega_i[index_slope_x] = CDF_P22_omega_i[index_slope_x - 1] + (double)P22_omega_i; } /* renormalize CDF_P22_omega_i */ @@ -106,8 +106,8 @@ static void beckmann_table_rows(float *table, int row_from, int row_to) /* store value */ table[index_U + index_theta*BECKMANN_TABLE_SIZE] = (float)( - interp * slope_x[index_slope_x - 1] - + (1.0f-interp) * slope_x[index_slope_x]); + interp * slope_x[index_slope_x - 1] + + (1.0 - interp) * slope_x[index_slope_x]); } } } diff --git a/intern/cycles/util/CMakeLists.txt b/intern/cycles/util/CMakeLists.txt index 6120e7e8456..842d5efac79 100644 --- a/intern/cycles/util/CMakeLists.txt +++ b/intern/cycles/util/CMakeLists.txt @@ -1,11 +1,11 @@ set(INC . + ../../glew-mx ) set(INC_SYS ${GLEW_INCLUDE_PATH} - ${OPENGL_INCLUDE_DIR} ) set(SRC @@ -71,4 +71,6 @@ set(SRC_HEADERS include_directories(${INC}) include_directories(SYSTEM ${INC_SYS}) +add_definitions(${GL_DEFINITIONS}) + add_library(cycles_util ${SRC} ${SRC_HEADERS}) diff --git a/intern/cycles/util/util_opengl.h b/intern/cycles/util/util_opengl.h index 04a3e039c9d..667a5db653d 100644 --- a/intern/cycles/util/util_opengl.h +++ b/intern/cycles/util/util_opengl.h @@ -20,7 +20,6 @@ /* OpenGL header includes, used everywhere we use OpenGL, to deal with * platform differences in one central place. */ -#include <GL/glew.h> +#include "glew-mx.h" #endif /* __UTIL_OPENGL_H__ */ - diff --git a/intern/cycles/util/util_view.cpp b/intern/cycles/util/util_view.cpp index 6bf9c9ed8c0..fe08389fe3f 100644 --- a/intern/cycles/util/util_view.cpp +++ b/intern/cycles/util/util_view.cpp @@ -248,7 +248,7 @@ void view_main_loop(const char *title, int width, int height, glutInitDisplayMode(GLUT_RGB|GLUT_DOUBLE|GLUT_DEPTH); glutCreateWindow(title); - glewInit(); + mxMakeCurrentContext(mxCreateContext()); view_reshape(width, height); |