diff options
216 files changed, 855 insertions, 786 deletions
diff --git a/intern/cycles/app/cycles_xml.h b/intern/cycles/app/cycles_xml.h index 6a48980d8ea..a7bc1895d4e 100644 --- a/intern/cycles/app/cycles_xml.h +++ b/intern/cycles/app/cycles_xml.h @@ -29,4 +29,4 @@ void xml_read_file(Scene *scene, const char *filepath); CCL_NAMESPACE_END -#endif /* __CYCLES_XML_H__ */ +#endif /* __CYCLES_XML_H__ */ diff --git a/intern/cycles/blender/CCL_api.h b/intern/cycles/blender/CCL_api.h index 233ffc8802c..b9750ad0c53 100644 --- a/intern/cycles/blender/CCL_api.h +++ b/intern/cycles/blender/CCL_api.h @@ -33,4 +33,4 @@ void CCL_logging_verbosity_set(int verbosity); } #endif -#endif /* __CCL_API_H__ */ +#endif /* __CCL_API_H__ */ diff --git a/intern/cycles/blender/blender_logging.cpp b/intern/cycles/blender/blender_logging.cpp index d0f82e37662..3fca4efd097 100644 --- a/intern/cycles/blender/blender_logging.cpp +++ b/intern/cycles/blender/blender_logging.cpp @@ -22,7 +22,7 @@ void CCL_init_logging(const char *argv0) ccl::util_logging_init(argv0); } -void CCL_start_debug_logging(void) +void CCL_start_debug_logging() { ccl::util_logging_start(); } diff --git a/intern/cycles/blender/blender_object_cull.h b/intern/cycles/blender/blender_object_cull.h index 2147877a860..6e2a22438ec 100644 --- a/intern/cycles/blender/blender_object_cull.h +++ b/intern/cycles/blender/blender_object_cull.h @@ -46,4 +46,4 @@ private: CCL_NAMESPACE_END -#endif /* __BLENDER_OBJECT_CULL_H__ */ +#endif /* __BLENDER_OBJECT_CULL_H__ */ diff --git a/intern/cycles/blender/blender_python.cpp b/intern/cycles/blender/blender_python.cpp index 2a0a7895763..ba9d6181e1c 100644 --- a/intern/cycles/blender/blender_python.cpp +++ b/intern/cycles/blender/blender_python.cpp @@ -843,18 +843,18 @@ void *CCL_python_module_init() #ifdef WITH_NETWORK PyModule_AddObject(mod, "with_network", Py_True); Py_INCREF(Py_True); -#else /* WITH_NETWORK */ +#else /* WITH_NETWORK */ PyModule_AddObject(mod, "with_network", Py_False); Py_INCREF(Py_False); -#endif /* WITH_NETWORK */ +#endif /* WITH_NETWORK */ #ifdef WITH_EMBREE PyModule_AddObject(mod, "with_embree", Py_True); Py_INCREF(Py_True); -#else /* WITH_EMBREE */ +#else /* WITH_EMBREE */ PyModule_AddObject(mod, "with_embree", Py_False); Py_INCREF(Py_False); -#endif /* WITH_EMBREE */ +#endif /* WITH_EMBREE */ return (void*)mod; } diff --git a/intern/cycles/blender/blender_session.h b/intern/cycles/blender/blender_session.h index c83d3ee9aa3..5db71873946 100644 --- a/intern/cycles/blender/blender_session.h +++ b/intern/cycles/blender/blender_session.h @@ -179,4 +179,4 @@ protected: CCL_NAMESPACE_END -#endif /* __BLENDER_SESSION_H__ */ +#endif /* __BLENDER_SESSION_H__ */ diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp index 439f6bdd32e..b89e3004403 100644 --- a/intern/cycles/blender/blender_shader.cpp +++ b/intern/cycles/blender/blender_shader.cpp @@ -628,8 +628,8 @@ static ShaderNode *add_node(Scene *scene, } } #else - (void)b_data; - (void)b_ntree; + (void) b_data; + (void) b_ntree; #endif } else if(b_node.is_a(&RNA_ShaderNodeTexImage)) { diff --git a/intern/cycles/blender/blender_sync.h b/intern/cycles/blender/blender_sync.h index d2b362be24d..ddc5e00cf9d 100644 --- a/intern/cycles/blender/blender_sync.h +++ b/intern/cycles/blender/blender_sync.h @@ -208,4 +208,4 @@ private: CCL_NAMESPACE_END -#endif /* __BLENDER_SYNC_H__ */ +#endif /* __BLENDER_SYNC_H__ */ diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h index 02e3c292349..53800cab90d 100644 --- a/intern/cycles/blender/blender_util.h +++ b/intern/cycles/blender/blender_util.h @@ -20,6 +20,7 @@ #include "render/mesh.h" #include "util/util_algorithm.h" +#include "util/util_array.h" #include "util/util_map.h" #include "util/util_path.h" #include "util/util_set.h" @@ -838,4 +839,4 @@ protected: CCL_NAMESPACE_END -#endif /* __BLENDER_UTIL_H__ */ +#endif /* __BLENDER_UTIL_H__ */ diff --git a/intern/cycles/bvh/bvh.h b/intern/cycles/bvh/bvh.h index f14c8f53c80..c8ad29004d7 100644 --- a/intern/cycles/bvh/bvh.h +++ b/intern/cycles/bvh/bvh.h @@ -19,7 +19,7 @@ #define __BVH_H__ #include "bvh/bvh_params.h" - +#include "util/util_array.h" #include "util/util_types.h" #include "util/util_vector.h" @@ -126,4 +126,4 @@ struct BVHStackEntry CCL_NAMESPACE_END -#endif /* __BVH_H__ */ +#endif /* __BVH_H__ */ diff --git a/intern/cycles/bvh/bvh2.h b/intern/cycles/bvh/bvh2.h index df65ddca5b7..ecc697567bb 100644 --- a/intern/cycles/bvh/bvh2.h +++ b/intern/cycles/bvh/bvh2.h @@ -84,4 +84,4 @@ protected: CCL_NAMESPACE_END -#endif /* __BVH2_H__ */ +#endif /* __BVH2_H__ */ diff --git a/intern/cycles/bvh/bvh4.h b/intern/cycles/bvh/bvh4.h index 310909a37e1..28bab2fe327 100644 --- a/intern/cycles/bvh/bvh4.h +++ b/intern/cycles/bvh/bvh4.h @@ -84,4 +84,4 @@ protected: CCL_NAMESPACE_END -#endif /* __BVH4_H__ */ +#endif /* __BVH4_H__ */ diff --git a/intern/cycles/bvh/bvh8.h b/intern/cycles/bvh/bvh8.h index 274a2442c7e..834daf3abce 100644 --- a/intern/cycles/bvh/bvh8.h +++ b/intern/cycles/bvh/bvh8.h @@ -95,4 +95,4 @@ protected: CCL_NAMESPACE_END -#endif /* __BVH8_H__ */ +#endif /* __BVH8_H__ */ diff --git a/intern/cycles/bvh/bvh_build.h b/intern/cycles/bvh/bvh_build.h index 7b245139819..dd95a5cc0e8 100644 --- a/intern/cycles/bvh/bvh_build.h +++ b/intern/cycles/bvh/bvh_build.h @@ -23,6 +23,7 @@ #include "bvh/bvh_params.h" #include "bvh/bvh_unaligned.h" +#include "util/util_array.h" #include "util/util_task.h" #include "util/util_vector.h" @@ -142,4 +143,4 @@ protected: CCL_NAMESPACE_END -#endif /* __BVH_BUILD_H__ */ +#endif /* __BVH_BUILD_H__ */ diff --git a/intern/cycles/bvh/bvh_embree.cpp b/intern/cycles/bvh/bvh_embree.cpp index 87891b68c4b..7489fe8ea42 100644 --- a/intern/cycles/bvh/bvh_embree.cpp +++ b/intern/cycles/bvh/bvh_embree.cpp @@ -881,4 +881,4 @@ void BVHEmbree::refit_nodes() } CCL_NAMESPACE_END -#endif /* WITH_EMBREE */ +#endif /* WITH_EMBREE */ diff --git a/intern/cycles/bvh/bvh_embree.h b/intern/cycles/bvh/bvh_embree.h index 4b3219d575e..9990826ba98 100644 --- a/intern/cycles/bvh/bvh_embree.h +++ b/intern/cycles/bvh/bvh_embree.h @@ -74,6 +74,6 @@ private: CCL_NAMESPACE_END -#endif /* WITH_EMBREE */ +#endif /* WITH_EMBREE */ -#endif /* __BVH_EMBREE_H__ */ +#endif /* __BVH_EMBREE_H__ */ diff --git a/intern/cycles/bvh/bvh_node.h b/intern/cycles/bvh/bvh_node.h index ed89d52a50a..65d5df01158 100644 --- a/intern/cycles/bvh/bvh_node.h +++ b/intern/cycles/bvh/bvh_node.h @@ -169,4 +169,4 @@ public: CCL_NAMESPACE_END -#endif /* __BVH_NODE_H__ */ +#endif /* __BVH_NODE_H__ */ diff --git a/intern/cycles/bvh/bvh_params.h b/intern/cycles/bvh/bvh_params.h index ebede6af4a3..6408d56da80 100644 --- a/intern/cycles/bvh/bvh_params.h +++ b/intern/cycles/bvh/bvh_params.h @@ -286,4 +286,4 @@ struct BVHSpatialStorage { CCL_NAMESPACE_END -#endif /* __BVH_PARAMS_H__ */ +#endif /* __BVH_PARAMS_H__ */ diff --git a/intern/cycles/bvh/bvh_sort.h b/intern/cycles/bvh/bvh_sort.h index 936401d8607..6910cc1e9b4 100644 --- a/intern/cycles/bvh/bvh_sort.h +++ b/intern/cycles/bvh/bvh_sort.h @@ -35,4 +35,4 @@ void bvh_reference_sort(int start, CCL_NAMESPACE_END -#endif /* __BVH_SORT_H__ */ +#endif /* __BVH_SORT_H__ */ diff --git a/intern/cycles/bvh/bvh_split.h b/intern/cycles/bvh/bvh_split.h index a874a118b99..cb47deab211 100644 --- a/intern/cycles/bvh/bvh_split.h +++ b/intern/cycles/bvh/bvh_split.h @@ -259,4 +259,4 @@ public: CCL_NAMESPACE_END -#endif /* __BVH_SPLIT_H__ */ +#endif /* __BVH_SPLIT_H__ */ diff --git a/intern/cycles/bvh/bvh_unaligned.h b/intern/cycles/bvh/bvh_unaligned.h index c3ece051cd5..bcfb6ed68da 100644 --- a/intern/cycles/bvh/bvh_unaligned.h +++ b/intern/cycles/bvh/bvh_unaligned.h @@ -77,4 +77,4 @@ protected: CCL_NAMESPACE_END -#endif /* __BVH_UNALIGNED_H__ */ +#endif /* __BVH_UNALIGNED_H__ */ diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h index b09843e9f12..5d1308c3030 100644 --- a/intern/cycles/device/device.h +++ b/intern/cycles/device/device.h @@ -181,7 +181,7 @@ public: /* Convert the requested features structure to a build options, * which could then be passed to compilers. */ - string get_build_options(void) const + string get_build_options() const { string build_options = ""; if(experimental) { @@ -240,8 +240,8 @@ std::ostream& operator <<(std::ostream &os, /* Device */ struct DeviceDrawParams { - function<void(void)> bind_display_space_shader_cb; - function<void(void)> unbind_display_space_shader_cb; + function<void()> bind_display_space_shader_cb; + function<void()> unbind_display_space_shader_cb; }; class Device { @@ -374,4 +374,4 @@ private: CCL_NAMESPACE_END -#endif /* __DEVICE_H__ */ +#endif /* __DEVICE_H__ */ diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp index 9e27a48b341..76f6466bbde 100644 --- a/intern/cycles/device/device_cpu.cpp +++ b/intern/cycles/device/device_cpu.cpp @@ -81,11 +81,11 @@ public: /* Silence potential warnings about unused variables * when compiling without some architectures. */ - (void)kernel_sse2; - (void)kernel_sse3; - (void)kernel_sse41; - (void)kernel_avx; - (void)kernel_avx2; + (void) kernel_sse2; + (void) kernel_sse3; + (void) kernel_sse41; + (void) kernel_avx; + (void) kernel_avx2; #ifdef WITH_CYCLES_OPTIMIZED_KERNEL_AVX2 if(DebugFlags().cpu.has_avx2() && system_cpu_support_avx2()) { architecture_name = "AVX2"; @@ -288,7 +288,7 @@ public: } #ifdef WITH_EMBREE bvh_layout_mask |= BVH_LAYOUT_EMBREE; -#endif /* WITH_EMBREE */ +#endif /* WITH_EMBREE */ return bvh_layout_mask; } @@ -1065,7 +1065,7 @@ void device_cpu_info(vector<DeviceInfo>& devices) devices.insert(devices.begin(), info); } -string device_cpu_capabilities(void) +string device_cpu_capabilities() { string capabilities = ""; capabilities += system_cpu_support_sse2() ? "SSE2 " : ""; diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp index 1c2d35061cc..2da113f2edb 100644 --- a/intern/cycles/device/device_cuda.cpp +++ b/intern/cycles/device/device_cuda.cpp @@ -73,12 +73,12 @@ const char *cuewErrorString(CUresult result) return error.c_str(); } -const char *cuewCompilerPath(void) +const char *cuewCompilerPath() { return CYCLES_CUDA_NVCC_EXECUTABLE; } -int cuewCompilerVersion(void) +int cuewCompilerVersion() { return (CUDA_VERSION / 100) + (CUDA_VERSION % 100 / 10); } @@ -211,7 +211,7 @@ public: /*cuda_abort();*/ \ cuda_error_documentation(); \ } \ - } (void)0 + } (void) 0 bool cuda_error_(CUresult result, const string& stmt) { @@ -2164,7 +2164,7 @@ public: /*cuda_abort();*/ \ device->cuda_error_documentation(); \ } \ - } (void)0 + } (void) 0 /* CUDA context scope. */ @@ -2373,7 +2373,7 @@ int2 CUDASplitKernel::split_kernel_global_size(device_memory& kg, device_memory& return global_size; } -bool device_cuda_init(void) +bool device_cuda_init() { #ifdef WITH_CUDA_DYNLOAD static bool initialized = false; @@ -2411,7 +2411,7 @@ bool device_cuda_init(void) return result; #else /* WITH_CUDA_DYNLOAD */ return true; -#endif /* WITH_CUDA_DYNLOAD */ +#endif /* WITH_CUDA_DYNLOAD */ } Device *device_cuda_create(DeviceInfo& info, Stats &stats, bool background) @@ -2515,7 +2515,7 @@ void device_cuda_info(vector<DeviceInfo>& devices) devices.insert(devices.end(), display_devices.begin(), display_devices.end()); } -string device_cuda_capabilities(void) +string device_cuda_capabilities() { CUresult result = device_cuda_safe_init(); if(result != CUDA_SUCCESS) { @@ -2548,7 +2548,7 @@ string device_cuda_capabilities(void) capabilities += string_printf("\t\tCU_DEVICE_ATTRIBUTE_" #attr "\t\t\t%d\n", \ value); \ } \ - } (void)0 + } (void) 0 /* TODO(sergey): Strip all attributes which are not useful for us * or does not depend on the driver. */ diff --git a/intern/cycles/device/device_denoising.h b/intern/cycles/device/device_denoising.h index 7474f71ff78..8e0666d0e59 100644 --- a/intern/cycles/device/device_denoising.h +++ b/intern/cycles/device/device_denoising.h @@ -166,4 +166,4 @@ protected: CCL_NAMESPACE_END -#endif /* __DEVICE_DENOISING_H__ */ +#endif /* __DEVICE_DENOISING_H__ */ diff --git a/intern/cycles/device/device_intern.h b/intern/cycles/device/device_intern.h index 941be448101..e6495c2bff3 100644 --- a/intern/cycles/device/device_intern.h +++ b/intern/cycles/device/device_intern.h @@ -22,9 +22,9 @@ CCL_NAMESPACE_BEGIN class Device; Device *device_cpu_create(DeviceInfo& info, Stats &stats, bool background); -bool device_opencl_init(void); +bool device_opencl_init(); Device *device_opencl_create(DeviceInfo& info, Stats &stats, bool background); -bool device_cuda_init(void); +bool device_cuda_init(); Device *device_cuda_create(DeviceInfo& info, Stats &stats, bool background); Device *device_network_create(DeviceInfo& info, Stats &stats, const char *address); Device *device_multi_create(DeviceInfo& info, Stats &stats, bool background); @@ -34,10 +34,10 @@ void device_opencl_info(vector<DeviceInfo>& devices); void device_cuda_info(vector<DeviceInfo>& devices); void device_network_info(vector<DeviceInfo>& devices); -string device_cpu_capabilities(void); -string device_opencl_capabilities(void); -string device_cuda_capabilities(void); +string device_cpu_capabilities(); +string device_opencl_capabilities(); +string device_cuda_capabilities(); CCL_NAMESPACE_END -#endif /* __DEVICE_INTERN_H__ */ +#endif /* __DEVICE_INTERN_H__ */ diff --git a/intern/cycles/device/device_memory.h b/intern/cycles/device/device_memory.h index 2b4835c9c65..e43834bdc8d 100644 --- a/intern/cycles/device/device_memory.h +++ b/intern/cycles/device/device_memory.h @@ -21,6 +21,7 @@ * * Data types for allocating, copying and freeing device memory. */ +#include "util/util_array.h" #include "util/util_half.h" #include "util/util_texture.h" #include "util/util_types.h" @@ -496,4 +497,4 @@ protected: CCL_NAMESPACE_END -#endif /* __DEVICE_MEMORY_H__ */ +#endif /* __DEVICE_MEMORY_H__ */ diff --git a/intern/cycles/device/device_network.h b/intern/cycles/device/device_network.h index 96e0de742db..67626ae177f 100644 --- a/intern/cycles/device/device_network.h +++ b/intern/cycles/device/device_network.h @@ -488,4 +488,4 @@ CCL_NAMESPACE_END #endif -#endif /* __DEVICE_NETWORK_H__ */ +#endif /* __DEVICE_NETWORK_H__ */ diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp index 0f622430abb..71410f80d57 100644 --- a/intern/cycles/device/device_opencl.cpp +++ b/intern/cycles/device/device_opencl.cpp @@ -44,7 +44,7 @@ Device *device_opencl_create(DeviceInfo& info, Stats &stats, bool background) } } -bool device_opencl_init(void) +bool device_opencl_init() { static bool initialized = false; static bool result = false; @@ -146,7 +146,7 @@ void device_opencl_info(vector<DeviceInfo>& devices) } } -string device_opencl_capabilities(void) +string device_opencl_capabilities() { if(OpenCLInfo::device_type() == 0) { return "All OpenCL devices are forced to be OFF"; @@ -245,4 +245,4 @@ string device_opencl_capabilities(void) CCL_NAMESPACE_END -#endif /* WITH_OPENCL */ +#endif /* WITH_OPENCL */ diff --git a/intern/cycles/device/device_split_kernel.h b/intern/cycles/device/device_split_kernel.h index 26ddce5bb22..5af4367d1b6 100644 --- a/intern/cycles/device/device_split_kernel.h +++ b/intern/cycles/device/device_split_kernel.h @@ -130,4 +130,4 @@ public: CCL_NAMESPACE_END -#endif /* __DEVICE_SPLIT_KERNEL_H__ */ +#endif /* __DEVICE_SPLIT_KERNEL_H__ */ diff --git a/intern/cycles/device/device_task.h b/intern/cycles/device/device_task.h index ec87aa8c560..861014373b3 100644 --- a/intern/cycles/device/device_task.h +++ b/intern/cycles/device/device_task.h @@ -64,7 +64,7 @@ public: function<void(long, int)> update_progress_sample; function<void(RenderTile&)> update_tile_sample; function<void(RenderTile&)> release_tile; - function<bool(void)> get_cancel; + function<bool()> get_cancel; function<void(RenderTile*, Device*)> map_neighbor_tiles; function<void(RenderTile*, Device*)> unmap_neighbor_tiles; @@ -85,4 +85,4 @@ protected: CCL_NAMESPACE_END -#endif /* __DEVICE_TASK_H__ */ +#endif /* __DEVICE_TASK_H__ */ diff --git a/intern/cycles/device/opencl/opencl.h b/intern/cycles/device/opencl/opencl.h index 6c73d10a376..8cb7f6d0b82 100644 --- a/intern/cycles/device/opencl/opencl.h +++ b/intern/cycles/device/opencl/opencl.h @@ -245,7 +245,7 @@ public: (device)->set_error(message); \ fprintf(stderr, "%s\n", message.c_str()); \ } \ - } (void)0 + } (void) 0 #define opencl_assert(stmt) \ { \ @@ -257,7 +257,7 @@ public: error_msg = message; \ fprintf(stderr, "%s\n", message.c_str()); \ } \ - } (void)0 + } (void) 0 class OpenCLDeviceBase : public Device { diff --git a/intern/cycles/device/opencl/opencl_split.cpp b/intern/cycles/device/opencl/opencl_split.cpp index 83389ef7cc8..adb73bc6e2c 100644 --- a/intern/cycles/device/opencl/opencl_split.cpp +++ b/intern/cycles/device/opencl/opencl_split.cpp @@ -463,4 +463,4 @@ Device *opencl_create_split_device(DeviceInfo& info, Stats& stats, bool backgrou CCL_NAMESPACE_END -#endif /* WITH_OPENCL */ +#endif /* WITH_OPENCL */ diff --git a/intern/cycles/device/opencl/opencl_util.cpp b/intern/cycles/device/opencl/opencl_util.cpp index 895e4149a3a..4c9f3cd6ef7 100644 --- a/intern/cycles/device/opencl/opencl_util.cpp +++ b/intern/cycles/device/opencl/opencl_util.cpp @@ -106,7 +106,7 @@ cl_context OpenCLCache::get_context(cl_platform_id platform, cl_int ciErr = clRetainContext(slot.context); assert(ciErr == CL_SUCCESS); - (void)ciErr; + (void) ciErr; return slot.context; } @@ -153,7 +153,7 @@ cl_program OpenCLCache::get_program(cl_platform_id platform, cl_int ciErr = clRetainProgram(entry.program); assert(ciErr == CL_SUCCESS); - (void)ciErr; + (void) ciErr; return entry.program; } @@ -188,7 +188,7 @@ void OpenCLCache::store_context(cl_platform_id platform, * The caller is going to release the object when done with it. */ cl_int ciErr = clRetainContext(context); assert(ciErr == CL_SUCCESS); - (void)ciErr; + (void) ciErr; } void OpenCLCache::store_program(cl_platform_id platform, @@ -227,7 +227,7 @@ void OpenCLCache::store_program(cl_platform_id platform, */ cl_int ciErr = clRetainProgram(program); assert(ciErr == CL_SUCCESS); - (void)ciErr; + (void) ciErr; } string OpenCLCache::get_kernel_md5() diff --git a/intern/cycles/graph/node.h b/intern/cycles/graph/node.h index 11695a8631d..d50a3786139 100644 --- a/intern/cycles/graph/node.h +++ b/intern/cycles/graph/node.h @@ -18,9 +18,9 @@ #include "graph/node_type.h" +#include "util/util_array.h" #include "util/util_map.h" #include "util/util_param.h" -#include "util/util_vector.h" CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/graph/node_type.h b/intern/cycles/graph/node_type.h index 1d565794b27..7d6abae2314 100644 --- a/intern/cycles/graph/node_type.h +++ b/intern/cycles/graph/node_type.h @@ -17,7 +17,7 @@ #pragma once #include "graph/node_enum.h" - +#include "util/util_array.h" #include "util/util_map.h" #include "util/util_param.h" #include "util/util_string.h" diff --git a/intern/cycles/kernel/bvh/bvh.h b/intern/cycles/kernel/bvh/bvh.h index 0d39ac8f5ec..1ef6500e78c 100644 --- a/intern/cycles/kernel/bvh/bvh.h +++ b/intern/cycles/kernel/bvh/bvh.h @@ -26,7 +26,7 @@ * with CPU/CUDA/OpenCL. */ #ifdef __EMBREE__ -#include "kernel/bvh/bvh_embree.h" +# include "kernel/bvh/bvh_embree.h" #endif CCL_NAMESPACE_BEGIN @@ -36,9 +36,9 @@ CCL_NAMESPACE_BEGIN /* Common QBVH functions. */ #ifdef __QBVH__ # include "kernel/bvh/qbvh_nodes.h" -#ifdef __KERNEL_AVX2__ -# include "kernel/bvh/obvh_nodes.h" -#endif +# ifdef __KERNEL_AVX2__ +# include "kernel/bvh/obvh_nodes.h" +# endif #endif /* Regular BVH traversal */ @@ -190,53 +190,45 @@ ccl_device_intersect bool scene_intersect(KernelGlobals *kg, return false; } #ifdef __EMBREE__ - if(kernel_data.bvh.scene) { - isect->t = ray.t; - CCLIntersectContext ctx(kg, CCLIntersectContext::RAY_REGULAR); - IntersectContext rtc_ctx(&ctx); - RTCRayHit ray_hit; - kernel_embree_setup_rayhit(ray, ray_hit, visibility); - rtcIntersect1(kernel_data.bvh.scene, &rtc_ctx.context, &ray_hit); - if(ray_hit.hit.geomID != RTC_INVALID_GEOMETRY_ID && ray_hit.hit.primID != RTC_INVALID_GEOMETRY_ID) { - kernel_embree_convert_hit(kg, &ray_hit.ray, &ray_hit.hit, isect); - return true; - } - return false; + if(kernel_data.bvh.scene != NULL) { + return embree_scene_intersect(kg, ray, visibility, isect); } -#endif /* __EMBREE__ */ +#endif /* __EMBREE__ */ #ifdef __OBJECT_MOTION__ if(kernel_data.bvh.have_motion) { # ifdef __HAIR__ if(kernel_data.bvh.have_curves) - return bvh_intersect_hair_motion(kg, &ray, isect, visibility, lcg_state, difl, extmax); -# endif /* __HAIR__ */ + return bvh_intersect_hair_motion( + kg, &ray, isect, visibility, lcg_state, difl, extmax); +# endif /* __HAIR__ */ return bvh_intersect_motion(kg, &ray, isect, visibility); } -#endif /* __OBJECT_MOTION__ */ +#endif /* __OBJECT_MOTION__ */ #ifdef __HAIR__ if(kernel_data.bvh.have_curves) - return bvh_intersect_hair(kg, &ray, isect, visibility, lcg_state, difl, extmax); -#endif /* __HAIR__ */ + return bvh_intersect_hair( + kg, &ray, isect, visibility, lcg_state, difl, extmax); +#endif /* __HAIR__ */ #ifdef __KERNEL_CPU__ # ifdef __INSTANCING__ if(kernel_data.bvh.have_instancing) return bvh_intersect_instancing(kg, &ray, isect, visibility); -# endif /* __INSTANCING__ */ +# endif /* __INSTANCING__ */ return bvh_intersect(kg, &ray, isect, visibility); -#else /* __KERNEL_CPU__ */ +#else /* __KERNEL_CPU__ */ # ifdef __INSTANCING__ return bvh_intersect_instancing(kg, &ray, isect, visibility); # else return bvh_intersect(kg, &ray, isect, visibility); -# endif /* __INSTANCING__ */ +# endif /* __INSTANCING__ */ -#endif /* __KERNEL_CPU__ */ +#endif /* __KERNEL_CPU__ */ } #ifdef __BVH_LOCAL__ @@ -252,69 +244,19 @@ ccl_device_intersect bool scene_intersect_local(KernelGlobals *kg, return false; } #ifdef __EMBREE__ - if(kernel_data.bvh.scene) { - CCLIntersectContext ctx(kg, CCLIntersectContext::RAY_SSS); - ctx.lcg_state = lcg_state; - ctx.max_hits = max_hits; - ctx.ss_isect = local_isect; - local_isect->num_hits = 0; - ctx.sss_object_id = local_object; - IntersectContext rtc_ctx(&ctx); - RTCRay rtc_ray; - kernel_embree_setup_ray(ray, rtc_ray, PATH_RAY_ALL_VISIBILITY); - - /* Get the Embree scene for this intersection. */ - RTCGeometry geom = rtcGetGeometry(kernel_data.bvh.scene, local_object * 2); - if(geom) { - float3 P = ray.P; - float3 dir = ray.D; - float3 idir = ray.D; - const int object_flag = kernel_tex_fetch(__object_flag, local_object); - if(!(object_flag & SD_OBJECT_TRANSFORM_APPLIED)) { - Transform ob_itfm; - rtc_ray.tfar = bvh_instance_motion_push(kg, - local_object, - &ray, - &P, - &dir, - &idir, - ray.t, - &ob_itfm); - /* bvh_instance_motion_push() returns the inverse transform but it's not needed here. */ - (void)ob_itfm; - - rtc_ray.org_x = P.x; - rtc_ray.org_y = P.y; - rtc_ray.org_z = P.z; - rtc_ray.dir_x = dir.x; - rtc_ray.dir_y = dir.y; - rtc_ray.dir_z = dir.z; - } - RTCScene scene = (RTCScene)rtcGetGeometryUserData(geom); - if(scene) { - rtcOccluded1(scene, &rtc_ctx.context, &rtc_ray); - } - } - - return local_isect->num_hits > 0; + if(kernel_data.bvh.scene != NULL) { + return embree_scene_intersect_local( + kg, ray, local_isect, local_object, lcg_state, max_hits); } -#endif /* __EMBREE__ */ +#endif /* __EMBREE__ */ #ifdef __OBJECT_MOTION__ if(kernel_data.bvh.have_motion) { - return bvh_intersect_local_motion(kg, - &ray, - local_isect, - local_object, - lcg_state, - max_hits); + return bvh_intersect_local_motion( + kg, &ray, local_isect, local_object, lcg_state, max_hits); } -#endif /* __OBJECT_MOTION__ */ - return bvh_intersect_local(kg, - &ray, - local_isect, - local_object, - lcg_state, - max_hits); +#endif /* __OBJECT_MOTION__ */ + return bvh_intersect_local( + kg, &ray, local_isect, local_object, lcg_state, max_hits); } #endif @@ -330,73 +272,41 @@ ccl_device_intersect bool scene_intersect_shadow_all(KernelGlobals *kg, return false; } # ifdef __EMBREE__ - if(kernel_data.bvh.scene) { - CCLIntersectContext ctx(kg, CCLIntersectContext::RAY_SHADOW_ALL); - ctx.isect_s = isect; - ctx.max_hits = max_hits; - ctx.num_hits = 0; - IntersectContext rtc_ctx(&ctx); - RTCRay rtc_ray; - kernel_embree_setup_ray(*ray, rtc_ray, PATH_RAY_SHADOW); - rtcOccluded1(kernel_data.bvh.scene, &rtc_ctx.context, &rtc_ray); - - if(ctx.num_hits > max_hits) { - return true; - } - *num_hits = ctx.num_hits; - return rtc_ray.tfar == -INFINITY; + if(kernel_data.bvh.scene != NULL) { + return embree_scene_intersect_shadow_all( + kg, ray, isect, max_hits, num_hits); } # endif # ifdef __OBJECT_MOTION__ if(kernel_data.bvh.have_motion) { # ifdef __HAIR__ if(kernel_data.bvh.have_curves) { - return bvh_intersect_shadow_all_hair_motion(kg, - ray, - isect, - visibility, - max_hits, - num_hits); + return bvh_intersect_shadow_all_hair_motion( + kg, ray, isect, visibility, max_hits, num_hits); } -# endif /* __HAIR__ */ - - return bvh_intersect_shadow_all_motion(kg, - ray, - isect, - visibility, - max_hits, - num_hits); +# endif /* __HAIR__ */ + + return bvh_intersect_shadow_all_motion( + kg, ray, isect, visibility, max_hits, num_hits); } -# endif /* __OBJECT_MOTION__ */ +# endif /* __OBJECT_MOTION__ */ # ifdef __HAIR__ if(kernel_data.bvh.have_curves) { - return bvh_intersect_shadow_all_hair(kg, - ray, - isect, - visibility, - max_hits, - num_hits); + return bvh_intersect_shadow_all_hair( + kg, ray, isect, visibility, max_hits, num_hits); } -# endif /* __HAIR__ */ +# endif /* __HAIR__ */ # ifdef __INSTANCING__ if(kernel_data.bvh.have_instancing) { - return bvh_intersect_shadow_all_instancing(kg, - ray, - isect, - visibility, - max_hits, - num_hits); + return bvh_intersect_shadow_all_instancing( + kg, ray, isect, visibility, max_hits, num_hits); } -# endif /* __INSTANCING__ */ - - return bvh_intersect_shadow_all(kg, - ray, - isect, - visibility, - max_hits, - num_hits); +# endif /* __INSTANCING__ */ + + return bvh_intersect_shadow_all( + kg, ray, isect, visibility, max_hits, num_hits); } #endif /* __SHADOW_RECORD_ALL__ */ @@ -413,20 +323,20 @@ ccl_device_intersect bool scene_intersect_volume(KernelGlobals *kg, if(kernel_data.bvh.have_motion) { return bvh_intersect_volume_motion(kg, ray, isect, visibility); } -# endif /* __OBJECT_MOTION__ */ +# endif /* __OBJECT_MOTION__ */ # ifdef __KERNEL_CPU__ # ifdef __INSTANCING__ if(kernel_data.bvh.have_instancing) return bvh_intersect_volume_instancing(kg, ray, isect, visibility); -# endif /* __INSTANCING__ */ +# endif /* __INSTANCING__ */ return bvh_intersect_volume(kg, ray, isect, visibility); -# else /* __KERNEL_CPU__ */ +# else /* __KERNEL_CPU__ */ # ifdef __INSTANCING__ return bvh_intersect_volume_instancing(kg, ray, isect, visibility); # else return bvh_intersect_volume(kg, ray, isect, visibility); -# endif /* __INSTANCING__ */ -# endif /* __KERNEL_CPU__ */ +# endif /* __INSTANCING__ */ +# endif /* __KERNEL_CPU__ */ } #endif /* __VOLUME__ */ @@ -441,27 +351,22 @@ ccl_device_intersect uint scene_intersect_volume_all(KernelGlobals *kg, return false; } # ifdef __EMBREE__ - if(kernel_data.bvh.scene) { - CCLIntersectContext ctx(kg, CCLIntersectContext::RAY_VOLUME_ALL); - ctx.isect_s = isect; - ctx.max_hits = max_hits; - ctx.num_hits = 0; - IntersectContext rtc_ctx(&ctx); - RTCRay rtc_ray; - kernel_embree_setup_ray(*ray, rtc_ray, visibility); - rtcOccluded1(kernel_data.bvh.scene, &rtc_ctx.context, &rtc_ray); - return rtc_ray.tfar == -INFINITY; + if(kernel_data.bvh.scene != NULL) { + return embree_scene_intersect_volume_all( + kg, ray, isect, max_hits, visibility); } # endif # ifdef __OBJECT_MOTION__ if(kernel_data.bvh.have_motion) { - return bvh_intersect_volume_all_motion(kg, ray, isect, max_hits, visibility); + return bvh_intersect_volume_all_motion( + kg, ray, isect, max_hits, visibility); } -# endif /* __OBJECT_MOTION__ */ +# endif /* __OBJECT_MOTION__ */ # ifdef __INSTANCING__ if(kernel_data.bvh.have_instancing) - return bvh_intersect_volume_all_instancing(kg, ray, isect, max_hits, visibility); -# endif /* __INSTANCING__ */ + return bvh_intersect_volume_all_instancing( + kg, ray, isect, max_hits, visibility); +# endif /* __INSTANCING__ */ return bvh_intersect_volume_all(kg, ray, isect, max_hits, visibility); } #endif /* __VOLUME_RECORD_ALL__ */ diff --git a/intern/cycles/kernel/bvh/bvh_embree.h b/intern/cycles/kernel/bvh/bvh_embree.h index 34a099ebb4d..72bc06cc831 100644 --- a/intern/cycles/kernel/bvh/bvh_embree.h +++ b/intern/cycles/kernel/bvh/bvh_embree.h @@ -71,7 +71,9 @@ public: CCLIntersectContext* userRayExt; }; -ccl_device_inline void kernel_embree_setup_ray(const Ray& ray, RTCRay& rtc_ray, const uint visibility) +ccl_device_inline void kernel_embree_setup_ray(const Ray& ray, + RTCRay& rtc_ray, + const uint visibility) { rtc_ray.org_x = ray.P.x; rtc_ray.org_y = ray.P.y; @@ -85,14 +87,19 @@ ccl_device_inline void kernel_embree_setup_ray(const Ray& ray, RTCRay& rtc_ray, rtc_ray.mask = visibility; } -ccl_device_inline void kernel_embree_setup_rayhit(const Ray& ray, RTCRayHit& rayhit, const uint visibility) +ccl_device_inline void kernel_embree_setup_rayhit(const Ray& ray, + RTCRayHit& rayhit, + const uint visibility) { kernel_embree_setup_ray(ray, rayhit.ray, visibility); rayhit.hit.geomID = RTC_INVALID_GEOMETRY_ID; rayhit.hit.primID = RTC_INVALID_GEOMETRY_ID; } -ccl_device_inline void kernel_embree_convert_hit(KernelGlobals *kg, const RTCRay *ray, const RTCHit *hit, Intersection *isect) +ccl_device_inline void kernel_embree_convert_hit(KernelGlobals *kg, + const RTCRay *ray, + const RTCHit *hit, + Intersection *isect) { bool is_hair = hit->geomID & 1; isect->u = is_hair ? hit->u : 1.0f - hit->v - hit->u; @@ -100,27 +107,161 @@ ccl_device_inline void kernel_embree_convert_hit(KernelGlobals *kg, const RTCRay isect->t = ray->tfar; isect->Ng = make_float3(hit->Ng_x, hit->Ng_y, hit->Ng_z); if(hit->instID[0] != RTC_INVALID_GEOMETRY_ID) { - RTCScene inst_scene = (RTCScene)rtcGetGeometryUserData(rtcGetGeometry(kernel_data.bvh.scene, hit->instID[0])); - isect->prim = hit->primID + (intptr_t)rtcGetGeometryUserData(rtcGetGeometry(inst_scene, hit->geomID)) + kernel_tex_fetch(__object_node, hit->instID[0]/2); + RTCScene inst_scene = (RTCScene)rtcGetGeometryUserData( + rtcGetGeometry(kernel_data.bvh.scene, hit->instID[0])); + isect->prim = hit->primID + (intptr_t)rtcGetGeometryUserData( + rtcGetGeometry(inst_scene, hit->geomID)) + + kernel_tex_fetch(__object_node, hit->instID[0]/2); isect->object = hit->instID[0]/2; } else { - isect->prim = hit->primID + (intptr_t)rtcGetGeometryUserData(rtcGetGeometry(kernel_data.bvh.scene, hit->geomID)); + isect->prim = hit->primID + (intptr_t)rtcGetGeometryUserData( + rtcGetGeometry(kernel_data.bvh.scene, hit->geomID)); isect->object = OBJECT_NONE; } isect->type = kernel_tex_fetch(__prim_type, isect->prim); } -ccl_device_inline void kernel_embree_convert_local_hit(KernelGlobals *kg, const RTCRay *ray, const RTCHit *hit, Intersection *isect, int local_object_id) +ccl_device_inline void kernel_embree_convert_local_hit(KernelGlobals *kg, + const RTCRay *ray, + const RTCHit *hit, + Intersection *isect, + int local_object_id) { isect->u = 1.0f - hit->v - hit->u; isect->v = hit->u; isect->t = ray->tfar; isect->Ng = make_float3(hit->Ng_x, hit->Ng_y, hit->Ng_z); - RTCScene inst_scene = (RTCScene)rtcGetGeometryUserData(rtcGetGeometry(kernel_data.bvh.scene, local_object_id * 2)); - isect->prim = hit->primID + (intptr_t)rtcGetGeometryUserData(rtcGetGeometry(inst_scene, hit->geomID)) + kernel_tex_fetch(__object_node, local_object_id); + RTCScene inst_scene = (RTCScene)rtcGetGeometryUserData( + rtcGetGeometry(kernel_data.bvh.scene, local_object_id * 2)); + isect->prim = hit->primID + (intptr_t)rtcGetGeometryUserData( + rtcGetGeometry(inst_scene, hit->geomID)) + + kernel_tex_fetch(__object_node, local_object_id); isect->object = local_object_id; isect->type = kernel_tex_fetch(__prim_type, isect->prim); } +ccl_device_inline bool embree_scene_intersect(KernelGlobals *kg, + const Ray *ray, + const uint visibility, + Intersection *isect) +{ + kernel_assert(kernel_data.bvh.scene != NULL); + isect->t = ray->t; + CCLIntersectContext ctx(kg, CCLIntersectContext::RAY_REGULAR); + IntersectContext rtc_ctx(&ctx); + RTCRayHit ray_hit; + kernel_embree_setup_rayhit(*ray, ray_hit, visibility); + rtcIntersect1(kernel_data.bvh.scene, &rtc_ctx.context, &ray_hit); + if(ray_hit.hit.geomID != RTC_INVALID_GEOMETRY_ID && + ray_hit.hit.primID != RTC_INVALID_GEOMETRY_ID) + { + kernel_embree_convert_hit(kg, &ray_hit.ray, &ray_hit.hit, isect); + return true; + } + return false; +} + +#ifdef __BVH_LOCAL__ +ccl_device_inline bool embree_scene_intersect_local( + KernelGlobals *kg, + const Ray ray, + LocalIntersection *local_isect, + int local_object, + uint *lcg_state, + int max_hits) +{ + kernel_assert(kernel_data.bvh.scene != NULL); + CCLIntersectContext ctx(kg, CCLIntersectContext::RAY_SSS); + ctx.lcg_state = lcg_state; + ctx.max_hits = max_hits; + ctx.ss_isect = local_isect; + local_isect->num_hits = 0; + ctx.sss_object_id = local_object; + IntersectContext rtc_ctx(&ctx); + RTCRay rtc_ray; + kernel_embree_setup_ray(ray, rtc_ray, PATH_RAY_ALL_VISIBILITY); + /* Get the Embree scene for this intersection. */ + RTCGeometry geom = rtcGetGeometry(kernel_data.bvh.scene, local_object * 2); + if(geom) { + float3 P = ray.P; + float3 dir = ray.D; + float3 idir = ray.D; + const int object_flag = kernel_tex_fetch(__object_flag, local_object); + if(!(object_flag & SD_OBJECT_TRANSFORM_APPLIED)) { + Transform ob_itfm; + rtc_ray.tfar = bvh_instance_motion_push(kg, + local_object, + &ray, + &P, + &dir, + &idir, + ray.t, + &ob_itfm); + /* bvh_instance_motion_push() returns the inverse transform but + * it's not needed here. */ + (void) ob_itfm; + + rtc_ray.org_x = P.x; + rtc_ray.org_y = P.y; + rtc_ray.org_z = P.z; + rtc_ray.dir_x = dir.x; + rtc_ray.dir_y = dir.y; + rtc_ray.dir_z = dir.z; + } + RTCScene scene = (RTCScene)rtcGetGeometryUserData(geom); + if(scene) { + rtcOccluded1(scene, &rtc_ctx.context, &rtc_ray); + } + } + return local_isect->num_hits > 0; +} +#endif /* __BVH_LOCAL__ */ + +#ifdef __SHADOW_RECORD_ALL__ +ccl_device_inline bool embree_scene_intersect_shadow_all( + KernelGlobals *kg, + const Ray *ray, + Intersection *isect, + uint max_hits, + uint *num_hits) +{ + kernel_assert(kernel_data.bvh.scene != NULL); + CCLIntersectContext ctx(kg, CCLIntersectContext::RAY_SHADOW_ALL); + ctx.isect_s = isect; + ctx.max_hits = max_hits; + ctx.num_hits = 0; + IntersectContext rtc_ctx(&ctx); + RTCRay rtc_ray; + kernel_embree_setup_ray(*ray, rtc_ray, PATH_RAY_SHADOW); + rtcOccluded1(kernel_data.bvh.scene, &rtc_ctx.context, &rtc_ray); + if(ctx.num_hits > max_hits) { + return true; + } + *num_hits = ctx.num_hits; + return rtc_ray.tfar == -INFINITY; +} +#endif /* __SHADOW_RECORD_ALL__ */ + +#ifdef __VOLUME_RECORD_ALL__ +ccl_device_inline uint embree_scene_intersect_volume_all( + KernelGlobals *kg, + const Ray *ray, + Intersection *isect, + const uint max_hits, + const uint visibility) +{ + kernel_assert(kernel_data.bvh.scene != NULL); + CCLIntersectContext ctx(kg, CCLIntersectContext::RAY_VOLUME_ALL); + ctx.isect_s = isect; + ctx.max_hits = max_hits; + ctx.num_hits = 0; + IntersectContext rtc_ctx(&ctx); + RTCRay rtc_ray; + kernel_embree_setup_ray(*ray, rtc_ray, visibility); + rtcOccluded1(kernel_data.bvh.scene, &rtc_ctx.context, &rtc_ray); + return rtc_ray.tfar == -INFINITY; +} +#endif /* __VOLUME_RECORD_ALL__ */ + CCL_NAMESPACE_END diff --git a/intern/cycles/kernel/bvh/bvh_local.h b/intern/cycles/kernel/bvh/bvh_local.h index 2b02f4527bb..8364bc3aa9a 100644 --- a/intern/cycles/kernel/bvh/bvh_local.h +++ b/intern/cycles/kernel/bvh/bvh_local.h @@ -136,7 +136,7 @@ bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, node_addr, PATH_RAY_ALL_VISIBILITY, dist); -#else // __KERNEL_SSE2__ +#else // __KERNEL_SSE2__ traverse_mask = NODE_INTERSECT(kg, P, dir, @@ -151,7 +151,7 @@ bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, node_addr, PATH_RAY_ALL_VISIBILITY, dist); -#endif // __KERNEL_SSE2__ +#endif // __KERNEL_SSE2__ node_addr = __float_as_int(cnodes.z); node_addr_child1 = __float_as_int(cnodes.w); diff --git a/intern/cycles/kernel/bvh/bvh_shadow_all.h b/intern/cycles/kernel/bvh/bvh_shadow_all.h index d525b29fd94..64eb2f3f659 100644 --- a/intern/cycles/kernel/bvh/bvh_shadow_all.h +++ b/intern/cycles/kernel/bvh/bvh_shadow_all.h @@ -124,7 +124,7 @@ bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, node_addr, visibility, dist); -#else // __KERNEL_SSE2__ +#else // __KERNEL_SSE2__ traverse_mask = NODE_INTERSECT(kg, P, dir, @@ -139,7 +139,7 @@ bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, node_addr, visibility, dist); -#endif // __KERNEL_SSE2__ +#endif // __KERNEL_SSE2__ node_addr = __float_as_int(cnodes.z); node_addr_child1 = __float_as_int(cnodes.w); diff --git a/intern/cycles/kernel/bvh/bvh_traversal.h b/intern/cycles/kernel/bvh/bvh_traversal.h index e95d2408201..af9f04db0ba 100644 --- a/intern/cycles/kernel/bvh/bvh_traversal.h +++ b/intern/cycles/kernel/bvh/bvh_traversal.h @@ -146,7 +146,7 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, visibility, dist); } -#else // __KERNEL_SSE2__ +#else // __KERNEL_SSE2__ # if BVH_FEATURE(BVH_HAIR_MINIMUM_WIDTH) if(difl != 0.0f) { traverse_mask = NODE_INTERSECT_ROBUST(kg, @@ -184,7 +184,7 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, visibility, dist); } -#endif // __KERNEL_SSE2__ +#endif // __KERNEL_SSE2__ node_addr = __float_as_int(cnodes.z); node_addr_child1 = __float_as_int(cnodes.w); diff --git a/intern/cycles/kernel/bvh/bvh_volume.h b/intern/cycles/kernel/bvh/bvh_volume.h index 7d03855cb8f..12d4c5eb94a 100644 --- a/intern/cycles/kernel/bvh/bvh_volume.h +++ b/intern/cycles/kernel/bvh/bvh_volume.h @@ -120,7 +120,7 @@ bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, node_addr, visibility, dist); -#else // __KERNEL_SSE2__ +#else // __KERNEL_SSE2__ traverse_mask = NODE_INTERSECT(kg, P, dir, @@ -135,7 +135,7 @@ bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, node_addr, visibility, dist); -#endif // __KERNEL_SSE2__ +#endif // __KERNEL_SSE2__ node_addr = __float_as_int(cnodes.z); node_addr_child1 = __float_as_int(cnodes.w); diff --git a/intern/cycles/kernel/bvh/bvh_volume_all.h b/intern/cycles/kernel/bvh/bvh_volume_all.h index 3d9b598914f..6205b9bcf7a 100644 --- a/intern/cycles/kernel/bvh/bvh_volume_all.h +++ b/intern/cycles/kernel/bvh/bvh_volume_all.h @@ -124,7 +124,7 @@ uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, node_addr, visibility, dist); -#else // __KERNEL_SSE2__ +#else // __KERNEL_SSE2__ traverse_mask = NODE_INTERSECT(kg, P, dir, @@ -139,7 +139,7 @@ uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, node_addr, visibility, dist); -#endif // __KERNEL_SSE2__ +#endif // __KERNEL_SSE2__ node_addr = __float_as_int(cnodes.z); node_addr_child1 = __float_as_int(cnodes.w); diff --git a/intern/cycles/kernel/bvh/obvh_shadow_all.h b/intern/cycles/kernel/bvh/obvh_shadow_all.h index 6ea93c5e7b2..8b739b3438a 100644 --- a/intern/cycles/kernel/bvh/obvh_shadow_all.h +++ b/intern/cycles/kernel/bvh/obvh_shadow_all.h @@ -97,7 +97,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(OBVH)(KernelGlobals *kg, /* Traverse internal nodes. */ while(node_addr >= 0 && node_addr != ENTRYPOINT_SENTINEL) { float4 inodes = kernel_tex_fetch(__bvh_nodes, node_addr+0); - (void)inodes; + (void) inodes; if(false #ifdef __VISIBILITY_FLAG__ diff --git a/intern/cycles/kernel/bvh/obvh_traversal.h b/intern/cycles/kernel/bvh/obvh_traversal.h index 5010983057d..6bb19eb1ed9 100644 --- a/intern/cycles/kernel/bvh/obvh_traversal.h +++ b/intern/cycles/kernel/bvh/obvh_traversal.h @@ -97,7 +97,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(OBVH)(KernelGlobals *kg, /* Traverse internal nodes. */ while(node_addr >= 0 && node_addr != ENTRYPOINT_SENTINEL) { float4 inodes = kernel_tex_fetch(__bvh_nodes, node_addr+0); - (void)inodes; + (void) inodes; if(UNLIKELY(node_dist > isect->t) #if BVH_FEATURE(BVH_MOTION) diff --git a/intern/cycles/kernel/bvh/qbvh_shadow_all.h b/intern/cycles/kernel/bvh/qbvh_shadow_all.h index 3610bdd560b..37606e10b92 100644 --- a/intern/cycles/kernel/bvh/qbvh_shadow_all.h +++ b/intern/cycles/kernel/bvh/qbvh_shadow_all.h @@ -98,7 +98,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, /* Traverse internal nodes. */ while(node_addr >= 0 && node_addr != ENTRYPOINT_SENTINEL) { float4 inodes = kernel_tex_fetch(__bvh_nodes, node_addr+0); - (void)inodes; + (void) inodes; if(false #ifdef __VISIBILITY_FLAG__ diff --git a/intern/cycles/kernel/bvh/qbvh_traversal.h b/intern/cycles/kernel/bvh/qbvh_traversal.h index ff675cab76b..35c6e3aeec9 100644 --- a/intern/cycles/kernel/bvh/qbvh_traversal.h +++ b/intern/cycles/kernel/bvh/qbvh_traversal.h @@ -106,7 +106,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, /* Traverse internal nodes. */ while(node_addr >= 0 && node_addr != ENTRYPOINT_SENTINEL) { float4 inodes = kernel_tex_fetch(__bvh_nodes, node_addr+0); - (void)inodes; + (void) inodes; if(UNLIKELY(node_dist > isect->t) #if BVH_FEATURE(BVH_MOTION) diff --git a/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h b/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h index ff238b7a834..4e7425bd800 100644 --- a/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h +++ b/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h @@ -232,4 +232,4 @@ ccl_device int bsdf_ashikhmin_shirley_sample(const ShaderClosure *sc, float3 Ng, CCL_NAMESPACE_END -#endif /* __BSDF_ASHIKHMIN_SHIRLEY_H__ */ +#endif /* __BSDF_ASHIKHMIN_SHIRLEY_H__ */ diff --git a/intern/cycles/kernel/closure/bsdf_ashikhmin_velvet.h b/intern/cycles/kernel/closure/bsdf_ashikhmin_velvet.h index b0bdea723b9..80fd9ba2b37 100644 --- a/intern/cycles/kernel/closure/bsdf_ashikhmin_velvet.h +++ b/intern/cycles/kernel/closure/bsdf_ashikhmin_velvet.h @@ -158,4 +158,4 @@ ccl_device int bsdf_ashikhmin_velvet_sample(const ShaderClosure *sc, float3 Ng, CCL_NAMESPACE_END -#endif /* __BSDF_ASHIKHMIN_VELVET_H__ */ +#endif /* __BSDF_ASHIKHMIN_VELVET_H__ */ diff --git a/intern/cycles/kernel/closure/bsdf_diffuse.h b/intern/cycles/kernel/closure/bsdf_diffuse.h index ee6d4cdf2df..946c460a70e 100644 --- a/intern/cycles/kernel/closure/bsdf_diffuse.h +++ b/intern/cycles/kernel/closure/bsdf_diffuse.h @@ -139,4 +139,4 @@ ccl_device int bsdf_translucent_sample(const ShaderClosure *sc, float3 Ng, float CCL_NAMESPACE_END -#endif /* __BSDF_DIFFUSE_H__ */ +#endif /* __BSDF_DIFFUSE_H__ */ diff --git a/intern/cycles/kernel/closure/bsdf_diffuse_ramp.h b/intern/cycles/kernel/closure/bsdf_diffuse_ramp.h index 35bb2fdf0e8..ca33a5b275c 100644 --- a/intern/cycles/kernel/closure/bsdf_diffuse_ramp.h +++ b/intern/cycles/kernel/closure/bsdf_diffuse_ramp.h @@ -103,8 +103,8 @@ ccl_device int bsdf_diffuse_ramp_sample(const ShaderClosure *sc, float3 Ng, floa return LABEL_REFLECT|LABEL_DIFFUSE; } -#endif /* __OSL__ */ +#endif /* __OSL__ */ CCL_NAMESPACE_END -#endif /* __BSDF_DIFFUSE_RAMP_H__ */ +#endif /* __BSDF_DIFFUSE_RAMP_H__ */ diff --git a/intern/cycles/kernel/closure/bsdf_hair.h b/intern/cycles/kernel/closure/bsdf_hair.h index 7b44a23f05b..e1a0cfaa3f5 100644 --- a/intern/cycles/kernel/closure/bsdf_hair.h +++ b/intern/cycles/kernel/closure/bsdf_hair.h @@ -277,4 +277,4 @@ ccl_device int bsdf_hair_transmission_sample(const ShaderClosure *sc, float3 Ng, CCL_NAMESPACE_END -#endif /* __BSDF_HAIR_H__ */ +#endif /* __BSDF_HAIR_H__ */ diff --git a/intern/cycles/kernel/closure/bsdf_hair_principled.h b/intern/cycles/kernel/closure/bsdf_hair_principled.h index 720517380ce..68335ee887a 100644 --- a/intern/cycles/kernel/closure/bsdf_hair_principled.h +++ b/intern/cycles/kernel/closure/bsdf_hair_principled.h @@ -229,7 +229,7 @@ ccl_device int bsdf_principled_hair_setup(ShaderData *sd, PrincipledHairBSDF *bs return SD_BSDF|SD_BSDF_HAS_EVAL|SD_BSDF_NEEDS_LCG; } -#endif /* __HAIR__ */ +#endif /* __HAIR__ */ /* Given the Fresnel term and transmittance, generate the attenuation terms for each bounce. */ ccl_device_inline void hair_attenuation(KernelGlobals *kg, @@ -499,4 +499,4 @@ ccl_device void bsdf_principled_hair_blur(ShaderClosure *sc, float roughness) CCL_NAMESPACE_END -#endif /* __BSDF_HAIR_PRINCIPLED_H__ */ +#endif /* __BSDF_HAIR_PRINCIPLED_H__ */ diff --git a/intern/cycles/kernel/closure/bsdf_microfacet.h b/intern/cycles/kernel/closure/bsdf_microfacet.h index e74d5ebaa42..32b6e50b09a 100644 --- a/intern/cycles/kernel/closure/bsdf_microfacet.h +++ b/intern/cycles/kernel/closure/bsdf_microfacet.h @@ -1124,4 +1124,4 @@ ccl_device int bsdf_microfacet_beckmann_sample(KernelGlobals *kg, const ShaderCl CCL_NAMESPACE_END -#endif /* __BSDF_MICROFACET_H__ */ +#endif /* __BSDF_MICROFACET_H__ */ diff --git a/intern/cycles/kernel/closure/bsdf_microfacet_multi_impl.h b/intern/cycles/kernel/closure/bsdf_microfacet_multi_impl.h index e73915dbda7..5d300ef6db5 100644 --- a/intern/cycles/kernel/closure/bsdf_microfacet_multi_impl.h +++ b/intern/cycles/kernel/closure/bsdf_microfacet_multi_impl.h @@ -76,7 +76,7 @@ ccl_device_forceinline float3 MF_FUNCTION_FULL_NAME(mf_eval)( eval *= -lambda_r / (shadowing_lambda - lambda_r); else eval *= -lambda_r * beta(-lambda_r, shadowing_lambda+1.0f); -#else /* MF_MULTI_GLOSSY */ +#else /* MF_MULTI_GLOSSY */ const float G2 = 1.0f / (1.0f - (lambda_r + 1.0f) + shadowing_lambda); float val = G2 * 0.25f / wi.z; if(alpha.x == alpha.y) @@ -129,7 +129,7 @@ ccl_device_forceinline float3 MF_FUNCTION_FULL_NAME(mf_eval)( phase = mf_eval_phase_glass(wr, lambda_r, wo, wo_outside, alpha, eta); else phase = mf_eval_phase_glass(wr, lambda_r, -wo, !wo_outside, alpha, 1.0f/eta); -#else /* MF_MULTI_GLOSSY */ +#else /* MF_MULTI_GLOSSY */ phase = mf_eval_phase_glossy(wr, lambda_r, wo, alpha) * throughput; #endif eval += throughput * phase * mf_G1(wo_outside? wo: -wo, mf_C1((outside == wo_outside)? hr: -hr), shadowing_lambda); @@ -153,7 +153,7 @@ ccl_device_forceinline float3 MF_FUNCTION_FULL_NAME(mf_eval)( else if(use_fresnel && order > 0) { throughput *= interpolate_fresnel_color(wi_prev, wm, eta, F0, cspec0); } -#else /* MF_MULTI_GLOSSY */ +#else /* MF_MULTI_GLOSSY */ if(use_fresnel && order > 0) { throughput *= interpolate_fresnel_color(-wr, wm, eta, F0, cspec0); } @@ -248,7 +248,7 @@ ccl_device_forceinline float3 MF_FUNCTION_FULL_NAME(mf_sample)( throughput *= t_color; } } -#else /* MF_MULTI_GLOSSY */ +#else /* MF_MULTI_GLOSSY */ if(use_fresnel) { float3 t_color = interpolate_fresnel_color(-wr, wm, eta, F0, cspec0); diff --git a/intern/cycles/kernel/closure/bsdf_oren_nayar.h b/intern/cycles/kernel/closure/bsdf_oren_nayar.h index 6b770fc0c16..3446d1609d9 100644 --- a/intern/cycles/kernel/closure/bsdf_oren_nayar.h +++ b/intern/cycles/kernel/closure/bsdf_oren_nayar.h @@ -108,4 +108,4 @@ ccl_device int bsdf_oren_nayar_sample(const ShaderClosure *sc, float3 Ng, float3 CCL_NAMESPACE_END -#endif /* __BSDF_OREN_NAYAR_H__ */ +#endif /* __BSDF_OREN_NAYAR_H__ */ diff --git a/intern/cycles/kernel/closure/bsdf_phong_ramp.h b/intern/cycles/kernel/closure/bsdf_phong_ramp.h index 91c7803346d..83da05ac435 100644 --- a/intern/cycles/kernel/closure/bsdf_phong_ramp.h +++ b/intern/cycles/kernel/closure/bsdf_phong_ramp.h @@ -135,8 +135,8 @@ ccl_device int bsdf_phong_ramp_sample(const ShaderClosure *sc, float3 Ng, float3 return LABEL_REFLECT|LABEL_GLOSSY; } -#endif /* __OSL__ */ +#endif /* __OSL__ */ CCL_NAMESPACE_END -#endif /* __BSDF_PHONG_RAMP_H__ */ +#endif /* __BSDF_PHONG_RAMP_H__ */ diff --git a/intern/cycles/kernel/closure/bsdf_principled_diffuse.h b/intern/cycles/kernel/closure/bsdf_principled_diffuse.h index 83be2b35a00..2f65fd54be2 100644 --- a/intern/cycles/kernel/closure/bsdf_principled_diffuse.h +++ b/intern/cycles/kernel/closure/bsdf_principled_diffuse.h @@ -122,4 +122,4 @@ ccl_device int bsdf_principled_diffuse_sample(const ShaderClosure *sc, CCL_NAMESPACE_END -#endif /* __BSDF_PRINCIPLED_DIFFUSE_H__ */ +#endif /* __BSDF_PRINCIPLED_DIFFUSE_H__ */ diff --git a/intern/cycles/kernel/closure/bsdf_principled_sheen.h b/intern/cycles/kernel/closure/bsdf_principled_sheen.h index 8b7c4399516..ccdcb1babd2 100644 --- a/intern/cycles/kernel/closure/bsdf_principled_sheen.h +++ b/intern/cycles/kernel/closure/bsdf_principled_sheen.h @@ -108,4 +108,4 @@ ccl_device int bsdf_principled_sheen_sample(const ShaderClosure *sc, CCL_NAMESPACE_END -#endif /* __BSDF_PRINCIPLED_SHEEN_H__ */ +#endif /* __BSDF_PRINCIPLED_SHEEN_H__ */ diff --git a/intern/cycles/kernel/closure/bsdf_reflection.h b/intern/cycles/kernel/closure/bsdf_reflection.h index b33b6e3597b..94f1c283af7 100644 --- a/intern/cycles/kernel/closure/bsdf_reflection.h +++ b/intern/cycles/kernel/closure/bsdf_reflection.h @@ -77,4 +77,4 @@ ccl_device int bsdf_reflection_sample(const ShaderClosure *sc, float3 Ng, float3 CCL_NAMESPACE_END -#endif /* __BSDF_REFLECTION_H__ */ +#endif /* __BSDF_REFLECTION_H__ */ diff --git a/intern/cycles/kernel/closure/bsdf_refraction.h b/intern/cycles/kernel/closure/bsdf_refraction.h index b181650e928..abdd01c7a1d 100644 --- a/intern/cycles/kernel/closure/bsdf_refraction.h +++ b/intern/cycles/kernel/closure/bsdf_refraction.h @@ -86,4 +86,4 @@ ccl_device int bsdf_refraction_sample(const ShaderClosure *sc, float3 Ng, float3 CCL_NAMESPACE_END -#endif /* __BSDF_REFRACTION_H__ */ +#endif /* __BSDF_REFRACTION_H__ */ diff --git a/intern/cycles/kernel/closure/bsdf_toon.h b/intern/cycles/kernel/closure/bsdf_toon.h index 6d8074b7130..097a56f22eb 100644 --- a/intern/cycles/kernel/closure/bsdf_toon.h +++ b/intern/cycles/kernel/closure/bsdf_toon.h @@ -215,4 +215,4 @@ ccl_device int bsdf_glossy_toon_sample(const ShaderClosure *sc, float3 Ng, float CCL_NAMESPACE_END -#endif /* __BSDF_TOON_H__ */ +#endif /* __BSDF_TOON_H__ */ diff --git a/intern/cycles/kernel/closure/bsdf_transparent.h b/intern/cycles/kernel/closure/bsdf_transparent.h index f788dbcd0ff..060dff69f52 100644 --- a/intern/cycles/kernel/closure/bsdf_transparent.h +++ b/intern/cycles/kernel/closure/bsdf_transparent.h @@ -106,4 +106,4 @@ ccl_device int bsdf_transparent_sample(const ShaderClosure *sc, float3 Ng, float CCL_NAMESPACE_END -#endif /* __BSDF_TRANSPARENT_H__ */ +#endif /* __BSDF_TRANSPARENT_H__ */ diff --git a/intern/cycles/kernel/closure/bsdf_util.h b/intern/cycles/kernel/closure/bsdf_util.h index b080e025d16..4f3453675c7 100644 --- a/intern/cycles/kernel/closure/bsdf_util.h +++ b/intern/cycles/kernel/closure/bsdf_util.h @@ -158,4 +158,4 @@ ccl_device_forceinline float3 interpolate_fresnel_color(float3 L, float3 H, floa CCL_NAMESPACE_END -#endif /* __BSDF_UTIL_H__ */ +#endif /* __BSDF_UTIL_H__ */ diff --git a/intern/cycles/kernel/closure/bssrdf.h b/intern/cycles/kernel/closure/bssrdf.h index ba0c6ae8c61..98c7f23c288 100644 --- a/intern/cycles/kernel/closure/bssrdf.h +++ b/intern/cycles/kernel/closure/bssrdf.h @@ -499,4 +499,4 @@ ccl_device_forceinline float bssrdf_pdf(const ShaderClosure *sc, float r) CCL_NAMESPACE_END -#endif /* __KERNEL_BSSRDF_H__ */ +#endif /* __KERNEL_BSSRDF_H__ */ diff --git a/intern/cycles/kernel/filter/filter.h b/intern/cycles/kernel/filter/filter.h index f6e474d6702..4209d69ee73 100644 --- a/intern/cycles/kernel/filter/filter.h +++ b/intern/cycles/kernel/filter/filter.h @@ -49,4 +49,4 @@ CCL_NAMESPACE_BEGIN CCL_NAMESPACE_END -#endif /* __FILTER_H__ */ +#endif /* __FILTER_H__ */ diff --git a/intern/cycles/kernel/filter/filter_defines.h b/intern/cycles/kernel/filter/filter_defines.h index 1a2f22a6987..67f4e62ac0f 100644 --- a/intern/cycles/kernel/filter/filter_defines.h +++ b/intern/cycles/kernel/filter/filter_defines.h @@ -68,4 +68,4 @@ typedef struct TileInfo { # define ccl_get_tile_buffer(id) (tile_info->buffers[id]) #endif -#endif /* __FILTER_DEFINES_H__*/ +#endif /* __FILTER_DEFINES_H__*/ diff --git a/intern/cycles/kernel/geom/geom_curve_intersect.h b/intern/cycles/kernel/geom/geom_curve_intersect.h index 5901429918c..b6b58b52a29 100644 --- a/intern/cycles/kernel/geom/geom_curve_intersect.h +++ b/intern/cycles/kernel/geom/geom_curve_intersect.h @@ -379,7 +379,7 @@ ccl_device_forceinline bool cardinal_curve_intersect( float inv_mw_extension = 1.0f/mw_extension; if(d0 >= 0) coverage = (min(d1 * inv_mw_extension, 1.0f) - min(d0 * inv_mw_extension, 1.0f)) * 0.5f; - else // inside + else // inside coverage = (min(d1 * inv_mw_extension, 1.0f) + min(-d0 * inv_mw_extension, 1.0f)) * 0.5f; } diff --git a/intern/cycles/kernel/geom/geom_subd_triangle.h b/intern/cycles/kernel/geom/geom_subd_triangle.h index 00ce89ae567..8c0d0a9770e 100644 --- a/intern/cycles/kernel/geom/geom_subd_triangle.h +++ b/intern/cycles/kernel/geom/geom_subd_triangle.h @@ -146,7 +146,7 @@ ccl_device_noinline float subd_triangle_attribute_float(KernelGlobals *kg, const return a; } else -#endif /* __PATCH_EVAL__ */ +#endif /* __PATCH_EVAL__ */ if(desc.element == ATTR_ELEMENT_FACE) { if(dx) *dx = 0.0f; if(dy) *dy = 0.0f; @@ -271,7 +271,7 @@ ccl_device_noinline float3 subd_triangle_attribute_float3(KernelGlobals *kg, con return a; } else -#endif /* __PATCH_EVAL__ */ +#endif /* __PATCH_EVAL__ */ if(desc.element == ATTR_ELEMENT_FACE) { if(dx) *dx = make_float3(0.0f, 0.0f, 0.0f); if(dy) *dy = make_float3(0.0f, 0.0f, 0.0f); diff --git a/intern/cycles/kernel/geom/geom_triangle_intersect.h b/intern/cycles/kernel/geom/geom_triangle_intersect.h index aa6b102a0f3..6b4fbcbbb7c 100644 --- a/intern/cycles/kernel/geom/geom_triangle_intersect.h +++ b/intern/cycles/kernel/geom/geom_triangle_intersect.h @@ -544,7 +544,7 @@ int triangle_intersect8(KernelGlobals *kg, return result; } -#endif /* __KERNEL_AVX2__ */ +#endif /* __KERNEL_AVX2__ */ /* Special ray intersection routines for subsurface scattering. In that case we * only want to intersect with primitives in the same object, and if case of diff --git a/intern/cycles/kernel/kernel.h b/intern/cycles/kernel/kernel.h index 373324afb01..1c8c91d15e6 100644 --- a/intern/cycles/kernel/kernel.h +++ b/intern/cycles/kernel/kernel.h @@ -63,4 +63,4 @@ void kernel_tex_copy(KernelGlobals *kg, CCL_NAMESPACE_END -#endif /* __KERNEL_H__ */ +#endif /* __KERNEL_H__ */ diff --git a/intern/cycles/kernel/kernel_color.h b/intern/cycles/kernel/kernel_color.h index 990e798543a..ea478a8a5d3 100644 --- a/intern/cycles/kernel/kernel_color.h +++ b/intern/cycles/kernel/kernel_color.h @@ -35,4 +35,4 @@ ccl_device float linear_rgb_to_gray(KernelGlobals *kg, float3 c) CCL_NAMESPACE_END -#endif /* __KERNEL_COLOR_H__ */ +#endif /* __KERNEL_COLOR_H__ */ diff --git a/intern/cycles/kernel/kernel_compat_cpu.h b/intern/cycles/kernel/kernel_compat_cpu.h index aa7a16afa1d..4ee80850402 100644 --- a/intern/cycles/kernel/kernel_compat_cpu.h +++ b/intern/cycles/kernel/kernel_compat_cpu.h @@ -153,4 +153,4 @@ typedef vector3<avxf> avx3f; CCL_NAMESPACE_END -#endif /* __KERNEL_COMPAT_CPU_H__ */ +#endif /* __KERNEL_COMPAT_CPU_H__ */ diff --git a/intern/cycles/kernel/kernel_compat_cuda.h b/intern/cycles/kernel/kernel_compat_cuda.h index ac63bcf7ac9..8ed96bbae64 100644 --- a/intern/cycles/kernel/kernel_compat_cuda.h +++ b/intern/cycles/kernel/kernel_compat_cuda.h @@ -150,4 +150,4 @@ ccl_device_inline uint ccl_num_groups(uint d) #define logf(x) __logf(((float)(x))) #define expf(x) __expf(((float)(x))) -#endif /* __KERNEL_COMPAT_CUDA_H__ */ +#endif /* __KERNEL_COMPAT_CUDA_H__ */ diff --git a/intern/cycles/kernel/kernel_compat_opencl.h b/intern/cycles/kernel/kernel_compat_opencl.h index 3f7e264fbee..21a95098894 100644 --- a/intern/cycles/kernel/kernel_compat_opencl.h +++ b/intern/cycles/kernel/kernel_compat_opencl.h @@ -159,4 +159,4 @@ #include "util/util_half.h" #include "util/util_types.h" -#endif /* __KERNEL_COMPAT_OPENCL_H__ */ +#endif /* __KERNEL_COMPAT_OPENCL_H__ */ diff --git a/intern/cycles/kernel/kernel_id_passes.h b/intern/cycles/kernel/kernel_id_passes.h index 8d092374d8b..0cd65b1f2e8 100644 --- a/intern/cycles/kernel/kernel_id_passes.h +++ b/intern/cycles/kernel/kernel_id_passes.h @@ -43,7 +43,7 @@ ccl_device_inline void kernel_write_id_slots(ccl_global float *buffer, int num_s atomic_add_and_fetch_float(buffer+slot*2+1, weight); break; } -#else /* __ATOMIC_PASS_WRITE__ */ +#else /* __ATOMIC_PASS_WRITE__ */ /* If the loop reaches an empty slot, the ID isn't in any slot yet - so add it! */ if(id_buffer[slot].x == ID_NONE) { id_buffer[slot].x = id; @@ -56,7 +56,7 @@ ccl_device_inline void kernel_write_id_slots(ccl_global float *buffer, int num_s id_buffer[slot].y += weight; break; } -#endif /* __ATOMIC_PASS_WRITE__ */ +#endif /* __ATOMIC_PASS_WRITE__ */ } } diff --git a/intern/cycles/kernel/kernel_math.h b/intern/cycles/kernel/kernel_math.h index 96391db7649..a8a43f3ea4a 100644 --- a/intern/cycles/kernel/kernel_math.h +++ b/intern/cycles/kernel/kernel_math.h @@ -25,4 +25,4 @@ #include "util/util_texture.h" #include "util/util_transform.h" -#endif /* __KERNEL_MATH_H__ */ +#endif /* __KERNEL_MATH_H__ */ diff --git a/intern/cycles/kernel/kernel_montecarlo.h b/intern/cycles/kernel/kernel_montecarlo.h index ce68aa16af8..dde93844dd3 100644 --- a/intern/cycles/kernel/kernel_montecarlo.h +++ b/intern/cycles/kernel/kernel_montecarlo.h @@ -282,4 +282,4 @@ ccl_device float3 ensure_valid_reflection(float3 Ng, float3 I, float3 N) CCL_NAMESPACE_END -#endif /* __KERNEL_MONTECARLO_CL__ */ +#endif /* __KERNEL_MONTECARLO_CL__ */ diff --git a/intern/cycles/kernel/kernel_passes.h b/intern/cycles/kernel/kernel_passes.h index 49a1b2c848e..1f5929e4938 100644 --- a/intern/cycles/kernel/kernel_passes.h +++ b/intern/cycles/kernel/kernel_passes.h @@ -110,7 +110,7 @@ ccl_device_inline void kernel_write_denoising_shadow(KernelGlobals *kg, ccl_glob float value = path_total_shaded / max(path_total, 1e-7f); kernel_write_pass_float(buffer+2, value*value); } -#endif /* __DENOISING_FEATURES__ */ +#endif /* __DENOISING_FEATURES__ */ ccl_device_inline void kernel_update_denoising_features(KernelGlobals *kg, ShaderData *sd, @@ -189,7 +189,7 @@ ccl_device_inline void kernel_write_debug_passes(KernelGlobals *kg, L->debug_data.num_ray_bounces); } } -#endif /* __KERNEL_DEBUG__ */ +#endif /* __KERNEL_DEBUG__ */ #ifdef __KERNEL_CPU__ #define WRITE_ID_SLOT(buffer, depth, id, matte_weight, name) kernel_write_id_pass_cpu(buffer, depth * 2, id, matte_weight, kg->coverage_##name) @@ -199,11 +199,11 @@ ccl_device_inline size_t kernel_write_id_pass_cpu(float *buffer, size_t depth, f (*map)[id] += matte_weight; return 0; } -#else /* __KERNEL_CPU__ */ +#else /* __KERNEL_CPU__ */ #define WRITE_ID_SLOT(buffer, depth, id, matte_weight, name) kernel_write_id_slots_gpu(buffer, depth * 2, id, matte_weight) ccl_device_inline size_t kernel_write_id_slots_gpu(ccl_global float *buffer, size_t depth, float id, float matte_weight) { -#endif /* __KERNEL_CPU__ */ +#endif /* __KERNEL_CPU__ */ kernel_write_id_slots(buffer, depth, id, matte_weight); return depth * 2; } diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h index 5745762e183..cb1f410b09f 100644 --- a/intern/cycles/kernel/kernel_path.h +++ b/intern/cycles/kernel/kernel_path.h @@ -266,7 +266,7 @@ ccl_device_forceinline VolumeIntegrateResult kernel_path_volume( } #endif /* __VOLUME__ */ -#endif /* __SPLIT_KERNEL__ */ +#endif /* __SPLIT_KERNEL__ */ ccl_device_forceinline bool kernel_path_shader_apply( KernelGlobals *kg, @@ -434,7 +434,7 @@ ccl_device void kernel_path_indirect(KernelGlobals *kg, else if(result == VOLUME_PATH_MISSED) { break; } -#endif /* __VOLUME__*/ +#endif /* __VOLUME__*/ /* Shade background. */ if(!hit) { @@ -557,7 +557,7 @@ ccl_device void kernel_path_indirect(KernelGlobals *kg, #endif /* __SUBSURFACE__ */ } -#endif /* defined(__BRANCHED_PATH__) || defined(__BAKING__) */ +#endif /* defined(__BRANCHED_PATH__) || defined(__BAKING__) */ ccl_device_forceinline void kernel_path_integrate( KernelGlobals *kg, @@ -605,7 +605,7 @@ ccl_device_forceinline void kernel_path_integrate( else if(result == VOLUME_PATH_MISSED) { break; } -#endif /* __VOLUME__*/ +#endif /* __VOLUME__*/ /* Shade background. */ if(!hit) { diff --git a/intern/cycles/kernel/kernel_path_volume.h b/intern/cycles/kernel/kernel_path_volume.h index feaea15d3c4..d2506fc1e7e 100644 --- a/intern/cycles/kernel/kernel_path_volume.h +++ b/intern/cycles/kernel/kernel_path_volume.h @@ -55,7 +55,7 @@ ccl_device_inline void kernel_path_volume_connect_light( } } } -#endif /* __EMISSION__ */ +#endif /* __EMISSION__ */ } #ifdef __KERNEL_GPU__ @@ -277,10 +277,10 @@ ccl_device void kernel_branched_path_volume_connect_light( } } } -#endif /* __EMISSION__ */ +#endif /* __EMISSION__ */ } -#endif /* __SPLIT_KERNEL__ */ +#endif /* __SPLIT_KERNEL__ */ -#endif /* __VOLUME_SCATTER__ */ +#endif /* __VOLUME_SCATTER__ */ CCL_NAMESPACE_END diff --git a/intern/cycles/kernel/kernel_queues.h b/intern/cycles/kernel/kernel_queues.h index e32d4bbbc1b..de8cc4a0cef 100644 --- a/intern/cycles/kernel/kernel_queues.h +++ b/intern/cycles/kernel/kernel_queues.h @@ -145,4 +145,4 @@ ccl_device int dequeue_ray_index( CCL_NAMESPACE_END -#endif // __KERNEL_QUEUE_H__ +#endif // __KERNEL_QUEUE_H__ diff --git a/intern/cycles/kernel/kernel_random.h b/intern/cycles/kernel/kernel_random.h index b33e4eba8a4..61ddf4a4f81 100644 --- a/intern/cycles/kernel/kernel_random.h +++ b/intern/cycles/kernel/kernel_random.h @@ -50,7 +50,7 @@ ccl_device uint sobol_dimension(KernelGlobals *kg, int index, int dimension) return result; } -#endif /* __SOBOL__ */ +#endif /* __SOBOL__ */ ccl_device_forceinline float path_rng_1D(KernelGlobals *kg, diff --git a/intern/cycles/kernel/kernel_shadow.h b/intern/cycles/kernel/kernel_shadow.h index 8a0da6c3b13..fafa3ad4bfa 100644 --- a/intern/cycles/kernel/kernel_shadow.h +++ b/intern/cycles/kernel/kernel_shadow.h @@ -446,7 +446,7 @@ ccl_device bool shadow_blocked_transparent_stepped( } # endif /* __KERNEL_GPU__ || !__SHADOW_RECORD_ALL__ */ -#endif /* __TRANSPARENT_SHADOWS__ */ +#endif /* __TRANSPARENT_SHADOWS__ */ ccl_device_inline bool shadow_blocked(KernelGlobals *kg, ShaderData *sd, diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index 14d5ff29bd8..864aa7c470a 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -615,7 +615,7 @@ typedef ccl_addr_space struct PathRadiance { #ifdef __KERNEL_DEBUG__ DebugData debug_data; -#endif /* __KERNEL_DEBUG__ */ +#endif /* __KERNEL_DEBUG__ */ } PathRadiance; typedef struct BsdfEval { @@ -1705,4 +1705,4 @@ typedef struct WorkTile { CCL_NAMESPACE_END -#endif /* __KERNEL_TYPES_H__ */ +#endif /* __KERNEL_TYPES_H__ */ diff --git a/intern/cycles/kernel/kernel_volume.h b/intern/cycles/kernel/kernel_volume.h index d71761a97bc..d6d283c42c5 100644 --- a/intern/cycles/kernel/kernel_volume.h +++ b/intern/cycles/kernel/kernel_volume.h @@ -87,7 +87,7 @@ ccl_device_inline bool volume_shader_sample(KernelGlobals *kg, return true; } -#endif /* __VOLUME__ */ +#endif /* __VOLUME__ */ ccl_device float3 volume_color_transmittance(float3 sigma, float t) { @@ -270,7 +270,7 @@ ccl_device_noinline void kernel_volume_shadow(KernelGlobals *kg, kernel_volume_shadow_homogeneous(kg, state, ray, shadow_sd, throughput); } -#endif /* __VOLUME__ */ +#endif /* __VOLUME__ */ /* Equi-angular sampling as in: * "Importance Sampling Techniques for Path Tracing in Participating Media" */ @@ -1075,7 +1075,7 @@ ccl_device VolumeIntegrateResult kernel_volume_decoupled_scatter( return VOLUME_PATH_SCATTERED; } -#endif /* __SPLIT_KERNEL */ +#endif /* __SPLIT_KERNEL */ /* decide if we need to use decoupled or not */ ccl_device bool kernel_volume_use_decoupled(KernelGlobals *kg, bool heterogeneous, bool direct, int sampling_method) @@ -1377,6 +1377,6 @@ ccl_device_inline void kernel_volume_clean_stack(KernelGlobals *kg, } } -#endif /* __VOLUME__ */ +#endif /* __VOLUME__ */ CCL_NAMESPACE_END diff --git a/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h b/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h index b77b7350d86..ae4fd85780d 100644 --- a/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h +++ b/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h @@ -26,7 +26,7 @@ template<typename T> struct TextureInterpolator { u[1] = (( 0.5f * t - 1.0f) * t ) * t + (2.0f/3.0f); \ u[2] = (( -0.5f * t + 0.5f) * t + 0.5f) * t + (1.0f/6.0f); \ u[3] = (1.0f / 6.0f) * t * t * t; \ - } (void)0 + } (void) 0 static ccl_always_inline float4 read(float4 r) { @@ -540,4 +540,4 @@ ccl_device float4 kernel_tex_image_interp_3d(KernelGlobals *kg, int id, float x, CCL_NAMESPACE_END -#endif // __KERNEL_CPU_IMAGE_H__ +#endif // __KERNEL_CPU_IMAGE_H__ diff --git a/intern/cycles/kernel/kernels/cpu/kernel_cpu_impl.h b/intern/cycles/kernel/kernels/cpu/kernel_cpu_impl.h index 5ec1655ab05..759b7e4c20d 100644 --- a/intern/cycles/kernel/kernels/cpu/kernel_cpu_impl.h +++ b/intern/cycles/kernel/kernels/cpu/kernel_cpu_impl.h @@ -97,7 +97,7 @@ void KERNEL_FUNCTION_FULL_NAME(path_trace)(KernelGlobals *kg, { kernel_path_trace(kg, buffer, sample, x, y, offset, stride); } -#endif /* KERNEL_STUB */ +#endif /* KERNEL_STUB */ } /* Film */ @@ -120,7 +120,7 @@ void KERNEL_FUNCTION_FULL_NAME(convert_to_byte)(KernelGlobals *kg, x, y, offset, stride); -#endif /* KERNEL_STUB */ +#endif /* KERNEL_STUB */ } void KERNEL_FUNCTION_FULL_NAME(convert_to_half_float)(KernelGlobals *kg, @@ -141,7 +141,7 @@ void KERNEL_FUNCTION_FULL_NAME(convert_to_half_float)(KernelGlobals *kg, x, y, offset, stride); -#endif /* KERNEL_STUB */ +#endif /* KERNEL_STUB */ } /* Shader Evaluate */ @@ -176,7 +176,7 @@ void KERNEL_FUNCTION_FULL_NAME(shader)(KernelGlobals *kg, else { kernel_background_evaluate(kg, input, output, i); } -#endif /* KERNEL_STUB */ +#endif /* KERNEL_STUB */ } #else /* __SPLIT_KERNEL__ */ @@ -208,7 +208,7 @@ void KERNEL_FUNCTION_FULL_NAME(shader)(KernelGlobals *kg, ccl_local type locals; \ kernel_##name(kg, &locals); \ } -#endif /* KERNEL_STUB */ +#endif /* KERNEL_STUB */ DEFINE_SPLIT_KERNEL_FUNCTION(path_init) DEFINE_SPLIT_KERNEL_FUNCTION(scene_intersect) diff --git a/intern/cycles/kernel/kernels/opencl/kernel_opencl_image.h b/intern/cycles/kernel/kernels/opencl/kernel_opencl_image.h index dd9d683e030..79af831c2fb 100644 --- a/intern/cycles/kernel/kernels/opencl/kernel_opencl_image.h +++ b/intern/cycles/kernel/kernels/opencl/kernel_opencl_image.h @@ -142,7 +142,7 @@ ccl_device_inline float svm_image_texture_frac(float x, int *ix) u[1] = (( 0.5f * t - 1.0f) * t ) * t + (2.0f/3.0f); \ u[2] = (( -0.5f * t + 0.5f) * t + 0.5f) * t + (1.0f/6.0f); \ u[3] = (1.0f / 6.0f) * t * t * t; \ - } (void)0 + } (void) 0 ccl_device float4 kernel_tex_image_interp(KernelGlobals *kg, int id, float x, float y) { diff --git a/intern/cycles/kernel/osl/osl_closures.h b/intern/cycles/kernel/osl/osl_closures.h index d9aeb9ab9fb..2a50704b569 100644 --- a/intern/cycles/kernel/osl/osl_closures.h +++ b/intern/cycles/kernel/osl/osl_closures.h @@ -146,4 +146,4 @@ CCLOSURE_PREPARE_STATIC(bsdf_##lower##_prepare, Upper##Closure) CCL_NAMESPACE_END -#endif /* __OSL_CLOSURES_H__ */ +#endif /* __OSL_CLOSURES_H__ */ diff --git a/intern/cycles/kernel/osl/osl_globals.h b/intern/cycles/kernel/osl/osl_globals.h index 30b29793e2d..88192fbcccb 100644 --- a/intern/cycles/kernel/osl/osl_globals.h +++ b/intern/cycles/kernel/osl/osl_globals.h @@ -94,4 +94,4 @@ CCL_NAMESPACE_END #endif -#endif /* __OSL_GLOBALS_H__ */ +#endif /* __OSL_GLOBALS_H__ */ diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp index 81348f5594d..5a82748f345 100644 --- a/intern/cycles/kernel/osl/osl_services.cpp +++ b/intern/cycles/kernel/osl/osl_services.cpp @@ -1053,7 +1053,7 @@ bool OSLRenderServices::texture(ustring filename, * other nasty stuff happening. */ string err = ts->geterror(); - (void)err; + (void) err; } return status; @@ -1132,7 +1132,7 @@ bool OSLRenderServices::texture3d(ustring filename, * other nasty stuff happening. */ string err = ts->geterror(); - (void)err; + (void) err; } return status; diff --git a/intern/cycles/kernel/osl/osl_services.h b/intern/cycles/kernel/osl/osl_services.h index 5dcaa4d7445..712b06b41b8 100644 --- a/intern/cycles/kernel/osl/osl_services.h +++ b/intern/cycles/kernel/osl/osl_services.h @@ -199,4 +199,4 @@ private: CCL_NAMESPACE_END -#endif /* __OSL_SERVICES_H__ */ +#endif /* __OSL_SERVICES_H__ */ diff --git a/intern/cycles/kernel/osl/osl_shader.cpp b/intern/cycles/kernel/osl/osl_shader.cpp index 6a690e880ad..a89bb3fd1a3 100644 --- a/intern/cycles/kernel/osl/osl_shader.cpp +++ b/intern/cycles/kernel/osl/osl_shader.cpp @@ -193,7 +193,7 @@ void OSLShader::eval_surface(KernelGlobals *kg, ShaderData *sd, PathState *state float data[9]; bool found = kg->osl->services->get_attribute(sd, true, OSLRenderServices::u_empty, TypeDesc::TypeVector, OSLRenderServices::u_geom_undisplaced, data); - (void)found; + (void) found; assert(found); memcpy(&sd->P, data, sizeof(float)*3); diff --git a/intern/cycles/kernel/osl/osl_shader.h b/intern/cycles/kernel/osl/osl_shader.h index 571a3f502be..9824f966a44 100644 --- a/intern/cycles/kernel/osl/osl_shader.h +++ b/intern/cycles/kernel/osl/osl_shader.h @@ -66,4 +66,4 @@ CCL_NAMESPACE_END #endif -#endif /* __OSL_SHADER_H__ */ +#endif /* __OSL_SHADER_H__ */ diff --git a/intern/cycles/kernel/shaders/oslutil.h b/intern/cycles/kernel/shaders/oslutil.h index 141e5d27e3a..592a8ad12d9 100644 --- a/intern/cycles/kernel/shaders/oslutil.h +++ b/intern/cycles/kernel/shaders/oslutil.h @@ -92,4 +92,4 @@ float wireframe(string edge_type, float line_width) { return wireframe(edge_type float wireframe(string edge_type) { return wireframe(edge_type, 1.0, 1); } float wireframe() { return wireframe("polygons", 1.0, 1); } -#endif /* CCL_OSLUTIL_H */ +#endif /* CCL_OSLUTIL_H */ diff --git a/intern/cycles/kernel/shaders/stdosl.h b/intern/cycles/kernel/shaders/stdosl.h index f1235500f2b..7136c746321 100644 --- a/intern/cycles/kernel/shaders/stdosl.h +++ b/intern/cycles/kernel/shaders/stdosl.h @@ -515,7 +515,7 @@ float smooth_linearstep (float edge0, float edge1, float x_, float eps_) { else if (x >= eps && x <= 1.0-eps) result = x; else if (x >= 1.0+eps) result = 1; else if (x < eps) result = rampup (x+eps, 2.0*eps); - else /* if (x < 1.0+eps) */ result = 1.0 - rampup (1.0+eps - x, 2.0*eps); + else /* if (x < 1.0+eps) */ result = 1.0 - rampup (1.0+eps - x, 2.0*eps); } else { result = step (edge0, x_); } @@ -686,4 +686,4 @@ int getmatrix (string fromspace, output matrix M) { #undef PERCOMP2 #undef PERCOMP2F -#endif /* CCL_STDOSL_H */ +#endif /* CCL_STDOSL_H */ diff --git a/intern/cycles/kernel/split/kernel_shader_sort.h b/intern/cycles/kernel/split/kernel_shader_sort.h index 2132c42220f..666355de334 100644 --- a/intern/cycles/kernel/split/kernel_shader_sort.h +++ b/intern/cycles/kernel/split/kernel_shader_sort.h @@ -78,7 +78,7 @@ ccl_device void kernel_shader_sort(KernelGlobals *kg, } } } -# endif /* __KERNEL_OPENCL__ */ +# endif /* __KERNEL_OPENCL__ */ /* copy to destination */ for(uint i = 0; i < SHADER_SORT_BLOCK_SIZE; i += SHADER_SORT_LOCAL_SIZE) { @@ -91,7 +91,7 @@ ccl_device void kernel_shader_sort(KernelGlobals *kg, kernel_split_state.queue_data[outi] = (value == (~0)) ? QUEUE_EMPTY_SLOT : kernel_split_state.queue_data[ini]; } } -#endif /* __KERNEL_CUDA__ */ +#endif /* __KERNEL_CUDA__ */ } CCL_NAMESPACE_END diff --git a/intern/cycles/kernel/split/kernel_split_data.h b/intern/cycles/kernel/split/kernel_split_data.h index 9297e1e0ad5..3f6b3977d79 100644 --- a/intern/cycles/kernel/split/kernel_split_data.h +++ b/intern/cycles/kernel/split/kernel_split_data.h @@ -24,7 +24,7 @@ CCL_NAMESPACE_BEGIN ccl_device_inline uint64_t split_data_buffer_size(KernelGlobals *kg, size_t num_elements) { - (void)kg; /* Unused on CPU. */ + (void) kg; /* Unused on CPU. */ uint64_t size = 0; #define SPLIT_DATA_ENTRY(type, name, num) + align_up(num_elements * num * sizeof(type), 16) @@ -48,7 +48,7 @@ ccl_device_inline void split_data_init(KernelGlobals *kg, ccl_global void *data, ccl_global char *ray_state) { - (void)kg; /* Unused on CPU. */ + (void) kg; /* Unused on CPU. */ ccl_global char *p = (ccl_global char*)data; diff --git a/intern/cycles/kernel/split/kernel_split_data_types.h b/intern/cycles/kernel/split/kernel_split_data_types.h index 56194d9f857..83df1e2a0a6 100644 --- a/intern/cycles/kernel/split/kernel_split_data_types.h +++ b/intern/cycles/kernel/split/kernel_split_data_types.h @@ -86,14 +86,14 @@ typedef ccl_global struct SplitBranchedState { SPLIT_DATA_ENTRY(ccl_global SubsurfaceIndirectRays, ss_rays, 1) #else # define SPLIT_DATA_SUBSURFACE_ENTRIES -#endif /* __SUBSURFACE__ */ +#endif /* __SUBSURFACE__ */ #ifdef __VOLUME__ # define SPLIT_DATA_VOLUME_ENTRIES \ SPLIT_DATA_ENTRY(ccl_global PathState, state_shadow, 1) #else # define SPLIT_DATA_VOLUME_ENTRIES -#endif /* __VOLUME__ */ +#endif /* __VOLUME__ */ #define SPLIT_DATA_ENTRIES \ SPLIT_DATA_ENTRY(ccl_global float3, throughput, 1) \ diff --git a/intern/cycles/kernel/svm/svm.h b/intern/cycles/kernel/svm/svm.h index ab69afa051e..ccb9aef7a5b 100644 --- a/intern/cycles/kernel/svm/svm.h +++ b/intern/cycles/kernel/svm/svm.h @@ -313,7 +313,7 @@ ccl_device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, ccl_a case NODE_LEAVE_BUMP_EVAL: svm_node_leave_bump_eval(kg, sd, stack, node.y); break; -# endif /* NODES_FEATURE(NODE_FEATURE_BUMP_STATE) */ +# endif /* NODES_FEATURE(NODE_FEATURE_BUMP_STATE) */ # endif /* NODES_FEATURE(NODE_FEATURE_BUMP) */ case NODE_HSV: svm_node_hsv(kg, sd, stack, node, &offset); @@ -497,4 +497,4 @@ ccl_device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, ccl_a CCL_NAMESPACE_END -#endif /* __SVM_H__ */ +#endif /* __SVM_H__ */ diff --git a/intern/cycles/kernel/svm/svm_closure.h b/intern/cycles/kernel/svm/svm_closure.h index 64bf8244999..e834d75c513 100644 --- a/intern/cycles/kernel/svm/svm_closure.h +++ b/intern/cycles/kernel/svm/svm_closure.h @@ -285,7 +285,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float * /* setup bsdf */ if(distribution == CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID || roughness <= 0.075f) /* use single-scatter GGX */ sd->flag |= bsdf_microfacet_ggx_aniso_fresnel_setup(bsdf, sd); - else /* use multi-scatter GGX */ + else /* use multi-scatter GGX */ sd->flag |= bsdf_microfacet_multi_ggx_aniso_fresnel_setup(bsdf, sd); } } diff --git a/intern/cycles/kernel/svm/svm_hsv.h b/intern/cycles/kernel/svm/svm_hsv.h index 27127b85323..41538d1138d 100644 --- a/intern/cycles/kernel/svm/svm_hsv.h +++ b/intern/cycles/kernel/svm/svm_hsv.h @@ -59,4 +59,4 @@ ccl_device void svm_node_hsv(KernelGlobals *kg, ShaderData *sd, float *stack, ui CCL_NAMESPACE_END -#endif /* __SVM_HSV_H__ */ +#endif /* __SVM_HSV_H__ */ diff --git a/intern/cycles/kernel/svm/svm_ramp.h b/intern/cycles/kernel/svm/svm_ramp.h index a3e4b6e87cd..6f39391057e 100644 --- a/intern/cycles/kernel/svm/svm_ramp.h +++ b/intern/cycles/kernel/svm/svm_ramp.h @@ -108,4 +108,4 @@ ccl_device void svm_node_curves(KernelGlobals *kg, ShaderData *sd, float *stack, CCL_NAMESPACE_END -#endif /* __SVM_RAMP_H__ */ +#endif /* __SVM_RAMP_H__ */ diff --git a/intern/cycles/kernel/svm/svm_ramp_util.h b/intern/cycles/kernel/svm/svm_ramp_util.h index a67689ff9d1..847108ff1c2 100644 --- a/intern/cycles/kernel/svm/svm_ramp_util.h +++ b/intern/cycles/kernel/svm/svm_ramp_util.h @@ -95,4 +95,4 @@ ccl_device float float_ramp_lookup(const float *ramp, CCL_NAMESPACE_END -#endif /* __SVM_RAMP_UTIL_H__ */ +#endif /* __SVM_RAMP_UTIL_H__ */ diff --git a/intern/cycles/kernel/svm/svm_types.h b/intern/cycles/kernel/svm/svm_types.h index 910537a2539..0f1dfa4936b 100644 --- a/intern/cycles/kernel/svm/svm_types.h +++ b/intern/cycles/kernel/svm/svm_types.h @@ -531,4 +531,4 @@ typedef enum ClosureType { CCL_NAMESPACE_END -#endif /* __SVM_TYPES_H__ */ +#endif /* __SVM_TYPES_H__ */ diff --git a/intern/cycles/kernel/svm/svm_wave.h b/intern/cycles/kernel/svm/svm_wave.h index 7b60ab6e6ae..80b63dc80cd 100644 --- a/intern/cycles/kernel/svm/svm_wave.h +++ b/intern/cycles/kernel/svm/svm_wave.h @@ -24,7 +24,7 @@ ccl_device_noinline float svm_wave(NodeWaveType type, NodeWaveProfile profile, f if(type == NODE_WAVE_BANDS) n = (p.x + p.y + p.z) * 10.0f; - else /* NODE_WAVE_RINGS */ + else /* NODE_WAVE_RINGS */ n = len(p) * 20.0f; if(distortion != 0.0f) diff --git a/intern/cycles/render/attribute.h b/intern/cycles/render/attribute.h index 40e5be2e1b2..e7438f4513d 100644 --- a/intern/cycles/render/attribute.h +++ b/intern/cycles/render/attribute.h @@ -172,4 +172,4 @@ public: CCL_NAMESPACE_END -#endif /* __ATTRIBUTE_H__ */ +#endif /* __ATTRIBUTE_H__ */ diff --git a/intern/cycles/render/background.h b/intern/cycles/render/background.h index 3f56dedb2c8..17c3eaaaaf5 100644 --- a/intern/cycles/render/background.h +++ b/intern/cycles/render/background.h @@ -59,4 +59,4 @@ public: CCL_NAMESPACE_END -#endif /* __BACKGROUND_H__ */ +#endif /* __BACKGROUND_H__ */ diff --git a/intern/cycles/render/bake.h b/intern/cycles/render/bake.h index a811eac3327..fce8f2fa606 100644 --- a/intern/cycles/render/bake.h +++ b/intern/cycles/render/bake.h @@ -83,4 +83,4 @@ private: CCL_NAMESPACE_END -#endif /* __BAKE_H__ */ +#endif /* __BAKE_H__ */ diff --git a/intern/cycles/render/buffers.h b/intern/cycles/render/buffers.h index a8f019dddd6..46c3b89bd84 100644 --- a/intern/cycles/render/buffers.h +++ b/intern/cycles/render/buffers.h @@ -146,4 +146,4 @@ public: CCL_NAMESPACE_END -#endif /* __BUFFERS_H__ */ +#endif /* __BUFFERS_H__ */ diff --git a/intern/cycles/render/camera.h b/intern/cycles/render/camera.h index 323f2c61ca4..37f5dea624f 100644 --- a/intern/cycles/render/camera.h +++ b/intern/cycles/render/camera.h @@ -21,6 +21,7 @@ #include "graph/node.h" +#include "util/util_array.h" #include "util/util_boundbox.h" #include "util/util_projection.h" #include "util/util_transform.h" @@ -212,4 +213,4 @@ private: CCL_NAMESPACE_END -#endif /* __CAMERA_H__ */ +#endif /* __CAMERA_H__ */ diff --git a/intern/cycles/render/constant_fold.h b/intern/cycles/render/constant_fold.h index 26fa4e8b1c8..6ec94b055e3 100644 --- a/intern/cycles/render/constant_fold.h +++ b/intern/cycles/render/constant_fold.h @@ -70,4 +70,4 @@ public: CCL_NAMESPACE_END -#endif /* __CONSTANT_FOLD_H__ */ +#endif /* __CONSTANT_FOLD_H__ */ diff --git a/intern/cycles/render/coverage.h b/intern/cycles/render/coverage.h index 16176ce4beb..9ee0bce7517 100644 --- a/intern/cycles/render/coverage.h +++ b/intern/cycles/render/coverage.h @@ -46,4 +46,4 @@ private: CCL_NAMESPACE_END -#endif /* __COVERAGE_H__ */ +#endif /* __COVERAGE_H__ */ diff --git a/intern/cycles/render/curves.h b/intern/cycles/render/curves.h index 62066d8a809..cf75751c58f 100644 --- a/intern/cycles/render/curves.h +++ b/intern/cycles/render/curves.h @@ -17,8 +17,8 @@ #ifndef __CURVES_H__ #define __CURVES_H__ +#include "util/util_array.h" #include "util/util_types.h" -#include "util/util_vector.h" CCL_NAMESPACE_BEGIN @@ -119,4 +119,4 @@ public: CCL_NAMESPACE_END -#endif /* __CURVES_H__ */ +#endif /* __CURVES_H__ */ diff --git a/intern/cycles/render/film.h b/intern/cycles/render/film.h index 57f1bf4eb64..c597db4e4c5 100644 --- a/intern/cycles/render/film.h +++ b/intern/cycles/render/film.h @@ -95,4 +95,4 @@ public: CCL_NAMESPACE_END -#endif /* __FILM_H__ */ +#endif /* __FILM_H__ */ diff --git a/intern/cycles/render/graph.h b/intern/cycles/render/graph.h index 426522066b3..d14a59b4900 100644 --- a/intern/cycles/render/graph.h +++ b/intern/cycles/render/graph.h @@ -293,4 +293,4 @@ protected: CCL_NAMESPACE_END -#endif /* __GRAPH_H__ */ +#endif /* __GRAPH_H__ */ diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h index 0bf06c322d0..5d4e99401b2 100644 --- a/intern/cycles/render/image.h +++ b/intern/cycles/render/image.h @@ -168,4 +168,4 @@ private: CCL_NAMESPACE_END -#endif /* __IMAGE_H__ */ +#endif /* __IMAGE_H__ */ diff --git a/intern/cycles/render/integrator.h b/intern/cycles/render/integrator.h index f68400ac416..6a7e2056851 100644 --- a/intern/cycles/render/integrator.h +++ b/intern/cycles/render/integrator.h @@ -94,4 +94,4 @@ public: CCL_NAMESPACE_END -#endif /* __INTEGRATOR_H__ */ +#endif /* __INTEGRATOR_H__ */ diff --git a/intern/cycles/render/light.h b/intern/cycles/render/light.h index ec957c7cc68..b7f3a047ad7 100644 --- a/intern/cycles/render/light.h +++ b/intern/cycles/render/light.h @@ -140,4 +140,4 @@ protected: CCL_NAMESPACE_END -#endif /* __LIGHT_H__ */ +#endif /* __LIGHT_H__ */ diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp index adc9a076fa4..5f884a3f871 100644 --- a/intern/cycles/render/mesh.cpp +++ b/intern/cycles/render/mesh.cpp @@ -1291,9 +1291,9 @@ void MeshManager::update_osl_attributes(Device *device, Scene *scene, vector<Att } } #else - (void)device; - (void)scene; - (void)mesh_attributes; + (void) device; + (void) scene; + (void) mesh_attributes; #endif } @@ -2301,7 +2301,7 @@ void MeshManager::device_free(Device *device, DeviceScene *dscene) og->object_names.clear(); } #else - (void)device; + (void) device; #endif } diff --git a/intern/cycles/render/mesh.h b/intern/cycles/render/mesh.h index 444f03a3664..7d36b2cd7ca 100644 --- a/intern/cycles/render/mesh.h +++ b/intern/cycles/render/mesh.h @@ -22,6 +22,7 @@ #include "render/attribute.h" #include "render/shader.h" +#include "util/util_array.h" #include "util/util_boundbox.h" #include "util/util_list.h" #include "util/util_map.h" @@ -390,4 +391,4 @@ protected: CCL_NAMESPACE_END -#endif /* __MESH_H__ */ +#endif /* __MESH_H__ */ diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h index c2cf13ad020..e77fb22f5ed 100644 --- a/intern/cycles/render/nodes.h +++ b/intern/cycles/render/nodes.h @@ -20,6 +20,7 @@ #include "render/graph.h" #include "graph/node.h" +#include "util/util_array.h" #include "util/util_string.h" CCL_NAMESPACE_BEGIN @@ -1163,4 +1164,4 @@ public: CCL_NAMESPACE_END -#endif /* __NODES_H__ */ +#endif /* __NODES_H__ */ diff --git a/intern/cycles/render/object.h b/intern/cycles/render/object.h index 288c3f5457a..87e6e6652ad 100644 --- a/intern/cycles/render/object.h +++ b/intern/cycles/render/object.h @@ -20,11 +20,13 @@ #include "graph/node.h" #include "render/scene.h" +#include "util/util_array.h" #include "util/util_boundbox.h" #include "util/util_param.h" #include "util/util_transform.h" #include "util/util_thread.h" #include "util/util_types.h" +#include "util/util_vector.h" CCL_NAMESPACE_BEGIN @@ -132,4 +134,4 @@ protected: CCL_NAMESPACE_END -#endif /* __OBJECT_H__ */ +#endif /* __OBJECT_H__ */ diff --git a/intern/cycles/render/osl.cpp b/intern/cycles/render/osl.cpp index 496e9d9491a..3fbc7d33a74 100644 --- a/intern/cycles/render/osl.cpp +++ b/intern/cycles/render/osl.cpp @@ -1255,6 +1255,6 @@ void OSLCompiler::parameter_color_array(const char * /*name*/, const array<float { } -#endif /* WITH_OSL */ +#endif /* WITH_OSL */ CCL_NAMESPACE_END diff --git a/intern/cycles/render/osl.h b/intern/cycles/render/osl.h index 966fc1965d7..e196e0be787 100644 --- a/intern/cycles/render/osl.h +++ b/intern/cycles/render/osl.h @@ -17,6 +17,7 @@ #ifndef __OSL_H__ #define __OSL_H__ +#include "util/util_array.h" #include "util/util_set.h" #include "util/util_string.h" #include "util/util_thread.h" @@ -171,4 +172,4 @@ private: CCL_NAMESPACE_END -#endif /* __OSL_H__ */ +#endif /* __OSL_H__ */ diff --git a/intern/cycles/render/particles.h b/intern/cycles/render/particles.h index 7e7afd5d054..27821907af0 100644 --- a/intern/cycles/render/particles.h +++ b/intern/cycles/render/particles.h @@ -17,8 +17,8 @@ #ifndef __PARTICLES_H__ #define __PARTICLES_H__ +#include "util/util_array.h" #include "util/util_types.h" -#include "util/util_vector.h" CCL_NAMESPACE_BEGIN @@ -68,4 +68,4 @@ public: CCL_NAMESPACE_END -#endif /* __PARTICLES_H__ */ +#endif /* __PARTICLES_H__ */ diff --git a/intern/cycles/render/scene.h b/intern/cycles/render/scene.h index 543feedf72f..57ea1d471e8 100644 --- a/intern/cycles/render/scene.h +++ b/intern/cycles/render/scene.h @@ -268,4 +268,4 @@ protected: CCL_NAMESPACE_END -#endif /* __SCENE_H__ */ +#endif /* __SCENE_H__ */ diff --git a/intern/cycles/render/session.h b/intern/cycles/render/session.h index d2ec13ada1f..56a69919a7a 100644 --- a/intern/cycles/render/session.h +++ b/intern/cycles/render/session.h @@ -238,4 +238,4 @@ protected: CCL_NAMESPACE_END -#endif /* __SESSION_H__ */ +#endif /* __SESSION_H__ */ diff --git a/intern/cycles/render/shader.cpp b/intern/cycles/render/shader.cpp index 86860bbc8ac..11780062e44 100644 --- a/intern/cycles/render/shader.cpp +++ b/intern/cycles/render/shader.cpp @@ -389,7 +389,7 @@ ShaderManager *ShaderManager::create(Scene *scene, int shadingsystem) { ShaderManager *manager; - (void)shadingsystem; /* Ignored when built without OSL. */ + (void) shadingsystem; /* Ignored when built without OSL. */ #ifdef WITH_OSL if(shadingsystem == SHADINGSYSTEM_OSL) { diff --git a/intern/cycles/render/shader.h b/intern/cycles/render/shader.h index 890208c4bf8..05772b9a9cd 100644 --- a/intern/cycles/render/shader.h +++ b/intern/cycles/render/shader.h @@ -225,4 +225,4 @@ protected: CCL_NAMESPACE_END -#endif /* __SHADER_H__ */ +#endif /* __SHADER_H__ */ diff --git a/intern/cycles/render/sobol.h b/intern/cycles/render/sobol.h index d38857d2b35..ce7a28587f2 100644 --- a/intern/cycles/render/sobol.h +++ b/intern/cycles/render/sobol.h @@ -28,4 +28,4 @@ void sobol_generate_direction_vectors(uint vectors[][SOBOL_BITS], int dimensions CCL_NAMESPACE_END -#endif /* __SOBOL_H__ */ +#endif /* __SOBOL_H__ */ diff --git a/intern/cycles/render/stats.h b/intern/cycles/render/stats.h index 72d5f1dd93d..2ff0ec3e0e9 100644 --- a/intern/cycles/render/stats.h +++ b/intern/cycles/render/stats.h @@ -101,4 +101,4 @@ public: CCL_NAMESPACE_END -#endif /* __RENDER_STATS_H__ */ +#endif /* __RENDER_STATS_H__ */ diff --git a/intern/cycles/render/svm.cpp b/intern/cycles/render/svm.cpp index 44b7eeec6db..b380117e729 100644 --- a/intern/cycles/render/svm.cpp +++ b/intern/cycles/render/svm.cpp @@ -266,7 +266,7 @@ int SVMCompiler::stack_assign(ShaderInput *input) add_node(NODE_VALUE_V, input->stack_offset); add_node(NODE_VALUE_V, node->get_float3(input->socket_type)); } - else /* should not get called for closure */ + else /* should not get called for closure */ assert(0); } } diff --git a/intern/cycles/render/svm.h b/intern/cycles/render/svm.h index 1d0613bbfdc..af97a490a87 100644 --- a/intern/cycles/render/svm.h +++ b/intern/cycles/render/svm.h @@ -21,6 +21,7 @@ #include "render/graph.h" #include "render/shader.h" +#include "util/util_array.h" #include "util/util_set.h" #include "util/util_string.h" #include "util/util_thread.h" @@ -223,4 +224,4 @@ protected: CCL_NAMESPACE_END -#endif /* __SVM_H__ */ +#endif /* __SVM_H__ */ diff --git a/intern/cycles/render/tables.h b/intern/cycles/render/tables.h index 09d961a9c3c..709333cb1b6 100644 --- a/intern/cycles/render/tables.h +++ b/intern/cycles/render/tables.h @@ -50,4 +50,4 @@ public: CCL_NAMESPACE_END -#endif /* __TABLES_H__ */ +#endif /* __TABLES_H__ */ diff --git a/intern/cycles/render/tile.h b/intern/cycles/render/tile.h index f72f653f4c2..2835c793073 100644 --- a/intern/cycles/render/tile.h +++ b/intern/cycles/render/tile.h @@ -154,4 +154,4 @@ protected: CCL_NAMESPACE_END -#endif /* __TILE_H__ */ +#endif /* __TILE_H__ */ diff --git a/intern/cycles/subd/subd_dice.h b/intern/cycles/subd/subd_dice.h index 4617c782b3a..2bef8d4cf8d 100644 --- a/intern/cycles/subd/subd_dice.h +++ b/intern/cycles/subd/subd_dice.h @@ -134,4 +134,4 @@ public: CCL_NAMESPACE_END -#endif /* __SUBD_DICE_H__ */ +#endif /* __SUBD_DICE_H__ */ diff --git a/intern/cycles/subd/subd_patch.h b/intern/cycles/subd/subd_patch.h index 64ec8f70951..84100139f2c 100644 --- a/intern/cycles/subd/subd_patch.h +++ b/intern/cycles/subd/subd_patch.h @@ -56,4 +56,4 @@ public: CCL_NAMESPACE_END -#endif /* __SUBD_PATCH_H__ */ +#endif /* __SUBD_PATCH_H__ */ diff --git a/intern/cycles/subd/subd_patch_table.cpp b/intern/cycles/subd/subd_patch_table.cpp index 13a6f284542..0e9d3f37af4 100644 --- a/intern/cycles/subd/subd_patch_table.cpp +++ b/intern/cycles/subd/subd_patch_table.cpp @@ -252,8 +252,8 @@ void PackedPatchTable::pack(Far::PatchTable* patch_table, int offset) build_patch_map(*this, patch_table, offset); #else - (void)patch_table; - (void)offset; + (void) patch_table; + (void) offset; #endif } diff --git a/intern/cycles/subd/subd_patch_table.h b/intern/cycles/subd/subd_patch_table.h index 45be7051992..1765578c42e 100644 --- a/intern/cycles/subd/subd_patch_table.h +++ b/intern/cycles/subd/subd_patch_table.h @@ -17,8 +17,8 @@ #ifndef __SUBD_PATCH_TABLE_H__ #define __SUBD_PATCH_TABLE_H__ +#include "util/util_array.h" #include "util/util_types.h" -#include "util/util_vector.h" #ifdef WITH_OPENSUBDIV #ifdef _MSC_VER @@ -59,4 +59,4 @@ struct PackedPatchTable { CCL_NAMESPACE_END -#endif /* __SUBD_PATCH_TABLE_H__ */ +#endif /* __SUBD_PATCH_TABLE_H__ */ diff --git a/intern/cycles/subd/subd_split.h b/intern/cycles/subd/subd_split.h index 7a276b35382..3368c93944b 100644 --- a/intern/cycles/subd/subd_split.h +++ b/intern/cycles/subd/subd_split.h @@ -56,4 +56,4 @@ public: CCL_NAMESPACE_END -#endif /* __SUBD_SPLIT_H__ */ +#endif /* __SUBD_SPLIT_H__ */ diff --git a/intern/cycles/test/render_graph_finalize_test.cpp b/intern/cycles/test/render_graph_finalize_test.cpp index b66a91adbda..cfdab7a6433 100644 --- a/intern/cycles/test/render_graph_finalize_test.cpp +++ b/intern/cycles/test/render_graph_finalize_test.cpp @@ -20,6 +20,7 @@ #include "render/graph.h" #include "render/scene.h" #include "render/nodes.h" +#include "util/util_array.h" #include "util/util_logging.h" #include "util/util_string.h" #include "util/util_vector.h" diff --git a/intern/cycles/test/util_path_test.cpp b/intern/cycles/test/util_path_test.cpp index c2f400c105d..1df568493d8 100644 --- a/intern/cycles/test/util_path_test.cpp +++ b/intern/cycles/test/util_path_test.cpp @@ -370,7 +370,7 @@ TEST(util_path_is_relative, relative_windir_on_unix) bool is_relative = path_is_relative("tmp\\foo.txt"); EXPECT_TRUE(is_relative); } -#endif /* !_WIN32 */ +#endif /* !_WIN32 */ #ifdef _WIN32 TEST(util_path_is_relative, absolute_windows) @@ -396,6 +396,6 @@ TEST(util_path_is_relative, relative_unixdir_on_windows) bool is_relative = path_is_relative("tmp/foo.txt"); EXPECT_TRUE(is_relative); } -#endif /* _WIN32 */ +#endif /* _WIN32 */ CCL_NAMESPACE_END diff --git a/intern/cycles/util/CMakeLists.txt b/intern/cycles/util/CMakeLists.txt index 4f623c5dfb7..77d47984ee7 100644 --- a/intern/cycles/util/CMakeLists.txt +++ b/intern/cycles/util/CMakeLists.txt @@ -37,6 +37,7 @@ set(SRC_HEADERS util_algorithm.h util_aligned_malloc.h util_args.h + util_array.h util_atomic.h util_boundbox.h util_debug.h diff --git a/intern/cycles/util/util_algorithm.h b/intern/cycles/util/util_algorithm.h index eb874713d43..f9e6476cc52 100644 --- a/intern/cycles/util/util_algorithm.h +++ b/intern/cycles/util/util_algorithm.h @@ -29,4 +29,4 @@ using std::remove; CCL_NAMESPACE_END -#endif /* __UTIL_ALGORITHM_H__ */ +#endif /* __UTIL_ALGORITHM_H__ */ diff --git a/intern/cycles/util/util_args.h b/intern/cycles/util/util_args.h index be6f2c2b9f1..9fe54b14d77 100644 --- a/intern/cycles/util/util_args.h +++ b/intern/cycles/util/util_args.h @@ -28,4 +28,4 @@ OIIO_NAMESPACE_USING CCL_NAMESPACE_END -#endif /* __UTIL_ARGS_H__ */ +#endif /* __UTIL_ARGS_H__ */ diff --git a/intern/cycles/util/util_array.h b/intern/cycles/util/util_array.h new file mode 100644 index 00000000000..5f18d434c31 --- /dev/null +++ b/intern/cycles/util/util_array.h @@ -0,0 +1,289 @@ +/* + * Copyright 2011-2018 Blender Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __UTIL_ARRAY_H__ +#define __UTIL_ARRAY_H__ + +#include <cassert> +#include <cstring> + +#include "util/util_aligned_malloc.h" +#include "util/util_guarded_allocator.h" +#include "util/util_types.h" +#include "util/util_vector.h" + +CCL_NAMESPACE_BEGIN + +/* Simplified version of vector, serving multiple purposes: + * - somewhat faster in that it does not clear memory on resize/alloc, + * this was actually showing up in profiles quite significantly. it + * also does not run any constructors/destructors + * - if this is used, we are not tempted to use inefficient operations + * - aligned allocation for CPU native data types */ + +template<typename T, size_t alignment = MIN_ALIGNMENT_CPU_DATA_TYPES> +class array +{ +public: + array() + : data_(NULL), + datasize_(0), + capacity_(0) + {} + + explicit array(size_t newsize) + { + if(newsize == 0) { + data_ = NULL; + datasize_ = 0; + capacity_ = 0; + } + else { + data_ = mem_allocate(newsize); + datasize_ = newsize; + capacity_ = datasize_; + } + } + + array(const array& from) + { + if(from.datasize_ == 0) { + data_ = NULL; + datasize_ = 0; + capacity_ = 0; + } + else { + data_ = mem_allocate(from.datasize_); + memcpy(data_, from.data_, from.datasize_*sizeof(T)); + datasize_ = from.datasize_; + capacity_ = datasize_; + } + } + + array& operator=(const array& from) + { + if(this != &from) { + resize(from.size()); + memcpy((void*)data_, from.data_, datasize_*sizeof(T)); + } + + return *this; + } + + array& operator=(const vector<T>& from) + { + resize(from.size()); + + if(from.size() > 0) { + memcpy(data_, &from[0], datasize_*sizeof(T)); + } + + return *this; + } + + ~array() + { + mem_free(data_, capacity_); + } + + bool operator==(const array<T>& other) const + { + if(datasize_ != other.datasize_) { + return false; + } + + return memcmp(data_, other.data_, datasize_*sizeof(T)) == 0; + } + + bool operator!=(const array<T>& other) const + { + return !(*this == other); + } + + void steal_data(array& from) + { + if(this != &from) { + clear(); + + data_ = from.data_; + datasize_ = from.datasize_; + capacity_ = from.capacity_; + + from.data_ = NULL; + from.datasize_ = 0; + from.capacity_ = 0; + } + } + + T *steal_pointer() + { + T *ptr = data_; + data_ = NULL; + clear(); + return ptr; + } + + T* resize(size_t newsize) + { + if(newsize == 0) { + clear(); + } + else if(newsize != datasize_) { + if(newsize > capacity_) { + T *newdata = mem_allocate(newsize); + if(newdata == NULL) { + /* Allocation failed, likely out of memory. */ + clear(); + return NULL; + } + else if(data_ != NULL) { + memcpy((void *)newdata, + data_, + ((datasize_ < newsize)? datasize_: newsize)*sizeof(T)); + mem_free(data_, capacity_); + } + data_ = newdata; + capacity_ = newsize; + } + datasize_ = newsize; + } + return data_; + } + + T* resize(size_t newsize, const T& value) + { + size_t oldsize = size(); + resize(newsize); + + for(size_t i = oldsize; i < size(); i++) { + data_[i] = value; + } + + return data_; + } + + void clear() + { + if(data_ != NULL) { + mem_free(data_, capacity_); + data_ = NULL; + } + datasize_ = 0; + capacity_ = 0; + } + + size_t empty() const + { + return datasize_ == 0; + } + + size_t size() const + { + return datasize_; + } + + T* data() + { + return data_; + } + + const T* data() const + { + return data_; + } + + T& operator[](size_t i) const + { + assert(i < datasize_); + return data_[i]; + } + + void reserve(size_t newcapacity) + { + if(newcapacity > capacity_) { + T *newdata = mem_allocate(newcapacity); + if(data_ != NULL) { + memcpy(newdata, data_, ((datasize_ < newcapacity)? datasize_: newcapacity)*sizeof(T)); + mem_free(data_, capacity_); + } + data_ = newdata; + capacity_ = newcapacity; + } + } + + size_t capacity() const + { + return capacity_; + } + + // do not use this method unless you are sure the code is not performance critical + void push_back_slow(const T& t) + { + if(capacity_ == datasize_) + { + reserve(datasize_ == 0 ? 1 : (size_t)((datasize_ + 1) * 1.2)); + } + + data_[datasize_++] = t; + } + + void push_back_reserved(const T& t) + { + assert(datasize_ < capacity_); + push_back_slow(t); + } + + void append(const array<T>& from) + { + if(from.size()) { + size_t old_size = size(); + resize(old_size + from.size()); + memcpy(data_ + old_size, from.data(), sizeof(T) * from.size()); + } + } + +protected: + inline T* mem_allocate(size_t N) + { + if(N == 0) { + return NULL; + } + T *mem = (T*)util_aligned_malloc(sizeof(T)*N, alignment); + if(mem != NULL) { + util_guarded_mem_alloc(sizeof(T)*N); + } + else { + throw std::bad_alloc(); + } + return mem; + } + + inline void mem_free(T *mem, size_t N) + { + if(mem != NULL) { + util_guarded_mem_free(sizeof(T)*N); + util_aligned_free(mem); + } + } + + T *data_; + size_t datasize_; + size_t capacity_; +}; + +CCL_NAMESPACE_END + +#endif /* __UTIL_ARRAY_H__ */ diff --git a/intern/cycles/util/util_atomic.h b/intern/cycles/util/util_atomic.h index e17e99d0acd..477b667a6fe 100644 --- a/intern/cycles/util/util_atomic.h +++ b/intern/cycles/util/util_atomic.h @@ -29,7 +29,7 @@ #define atomic_fetch_and_dec_uint32(p) atomic_fetch_and_add_uint32((p), -1) #define CCL_LOCAL_MEM_FENCE 0 -#define ccl_barrier(flags) (void)0 +#define ccl_barrier(flags) ((void) 0) #else /* __KERNEL_GPU__ */ @@ -110,4 +110,4 @@ ccl_device_inline float atomic_compare_and_swap_float(volatile float *dest, #endif /* __KERNEL_GPU__ */ -#endif /* __UTIL_ATOMIC_H__ */ +#endif /* __UTIL_ATOMIC_H__ */ diff --git a/intern/cycles/util/util_avxf.h b/intern/cycles/util/util_avxf.h index 0c15ba5cbbd..f00c722f25b 100644 --- a/intern/cycles/util/util_avxf.h +++ b/intern/cycles/util/util_avxf.h @@ -40,8 +40,8 @@ struct avxf __forceinline avxf(const __m256 a) : m256(a) {} __forceinline avxf(const __m256i a) : m256(_mm256_castsi256_ps (a)) {} - __forceinline operator const __m256&(void) const { return m256; } - __forceinline operator __m256&(void) { return m256; } + __forceinline operator const __m256&() const { return m256; } + __forceinline operator __m256&() { return m256; } __forceinline avxf (float a) : m256(_mm256_set1_ps(a)) {} diff --git a/intern/cycles/util/util_boundbox.h b/intern/cycles/util/util_boundbox.h index b1bd5be0df3..fe89e398840 100644 --- a/intern/cycles/util/util_boundbox.h +++ b/intern/cycles/util/util_boundbox.h @@ -282,4 +282,4 @@ public: CCL_NAMESPACE_END -#endif /* __UTIL_BOUNDBOX_H__ */ +#endif /* __UTIL_BOUNDBOX_H__ */ diff --git a/intern/cycles/util/util_color.h b/intern/cycles/util/util_color.h index 826db469d25..e6efc7d73fc 100644 --- a/intern/cycles/util/util_color.h +++ b/intern/cycles/util/util_color.h @@ -240,4 +240,4 @@ ccl_device float4 color_srgb_to_linear_v4(float4 c) CCL_NAMESPACE_END -#endif /* __UTIL_COLOR_H__ */ +#endif /* __UTIL_COLOR_H__ */ diff --git a/intern/cycles/util/util_debug.h b/intern/cycles/util/util_debug.h index f17f8a560ee..864089bb118 100644 --- a/intern/cycles/util/util_debug.h +++ b/intern/cycles/util/util_debug.h @@ -182,4 +182,4 @@ std::ostream& operator <<(std::ostream &os, CCL_NAMESPACE_END -#endif /* __UTIL_DEBUG_H__ */ +#endif /* __UTIL_DEBUG_H__ */ diff --git a/intern/cycles/util/util_defines.h b/intern/cycles/util/util_defines.h index 8bce4aca699..429cfe647ef 100644 --- a/intern/cycles/util/util_defines.h +++ b/intern/cycles/util/util_defines.h @@ -72,7 +72,7 @@ # if defined(__GNUC__) && (__GNUC__ >= 7) /* gcc7.0+ only */ # define ATTR_FALLTHROUGH __attribute__((fallthrough)) # else -# define ATTR_FALLTHROUGH ((void)0) +# define ATTR_FALLTHROUGH ((void) 0) # endif #endif /* __KERNEL_GPU__ */ @@ -104,14 +104,14 @@ template<typename T> static inline T decltype_helper(T x) { return x; } #define CHECK_TYPE(var, type) { \ TYPEOF(var) *__tmp; \ __tmp = (type *)NULL; \ - (void)__tmp; \ -} (void)0 + (void) __tmp; \ +} (void) 0 #define CHECK_TYPE_PAIR(var_a, var_b) { \ TYPEOF(var_a) *__tmp; \ __tmp = (typeof(var_b) *)NULL; \ - (void)__tmp; \ -} (void)0 + (void) __tmp; \ +} (void) 0 #else # define CHECK_TYPE(var, type) # define CHECK_TYPE_PAIR(var_a, var_b) @@ -128,4 +128,4 @@ template<typename T> static inline T decltype_helper(T x) { return x; } # define util_assert(statement) #endif -#endif /* __UTIL_DEFINES_H__ */ +#endif /* __UTIL_DEFINES_H__ */ diff --git a/intern/cycles/util/util_foreach.h b/intern/cycles/util/util_foreach.h index 2a74ff0a55d..fd106d58b43 100644 --- a/intern/cycles/util/util_foreach.h +++ b/intern/cycles/util/util_foreach.h @@ -21,4 +21,4 @@ #define foreach(x, y) for(x : y) -#endif /* __UTIL_FOREACH_H__ */ +#endif /* __UTIL_FOREACH_H__ */ diff --git a/intern/cycles/util/util_function.h b/intern/cycles/util/util_function.h index f3cc00329ad..72c7ce43073 100644 --- a/intern/cycles/util/util_function.h +++ b/intern/cycles/util/util_function.h @@ -36,4 +36,4 @@ using std::placeholders::_9; CCL_NAMESPACE_END -#endif /* __UTIL_FUNCTION_H__ */ +#endif /* __UTIL_FUNCTION_H__ */ diff --git a/intern/cycles/util/util_guarded_allocator.cpp b/intern/cycles/util/util_guarded_allocator.cpp index 54fa6a80df5..ae1d217c54f 100644 --- a/intern/cycles/util/util_guarded_allocator.cpp +++ b/intern/cycles/util/util_guarded_allocator.cpp @@ -35,12 +35,12 @@ void util_guarded_mem_free(size_t n) /* Public API. */ -size_t util_guarded_get_mem_used(void) +size_t util_guarded_get_mem_used() { return global_stats.mem_used; } -size_t util_guarded_get_mem_peak(void) +size_t util_guarded_get_mem_peak() { return global_stats.mem_peak; } diff --git a/intern/cycles/util/util_guarded_allocator.h b/intern/cycles/util/util_guarded_allocator.h index 87c1526dee4..2c6f1790fd0 100644 --- a/intern/cycles/util/util_guarded_allocator.h +++ b/intern/cycles/util/util_guarded_allocator.h @@ -47,7 +47,7 @@ public: T *allocate(size_t n, const void *hint = 0) { - (void)hint; + (void) hint; size_t size = n * sizeof(T); util_guarded_mem_alloc(size); if(n == 0) { @@ -158,8 +158,8 @@ public: }; /* Get memory usage and peak from the guarded STL allocator. */ -size_t util_guarded_get_mem_used(void); -size_t util_guarded_get_mem_peak(void); +size_t util_guarded_get_mem_used(); +size_t util_guarded_get_mem_peak(); /* Call given function and keep track if it runs out of memory. * diff --git a/intern/cycles/util/util_half.h b/intern/cycles/util/util_half.h index 53b7f2472bd..3868509c21b 100644 --- a/intern/cycles/util/util_half.h +++ b/intern/cycles/util/util_half.h @@ -148,4 +148,4 @@ ccl_device_inline half float_to_half(float f) CCL_NAMESPACE_END -#endif /* __UTIL_HALF_H__ */ +#endif /* __UTIL_HALF_H__ */ diff --git a/intern/cycles/util/util_hash.h b/intern/cycles/util/util_hash.h index a8a5076fbb3..f343252eaca 100644 --- a/intern/cycles/util/util_hash.h +++ b/intern/cycles/util/util_hash.h @@ -68,4 +68,4 @@ ccl_device_inline float hash_int_01(uint k) CCL_NAMESPACE_END -#endif /* __UTIL_HASH_H__ */ +#endif /* __UTIL_HASH_H__ */ diff --git a/intern/cycles/util/util_ies.h b/intern/cycles/util/util_ies.h index 5933cb3962a..663ad649a9c 100644 --- a/intern/cycles/util/util_ies.h +++ b/intern/cycles/util/util_ies.h @@ -58,4 +58,4 @@ protected: CCL_NAMESPACE_END -#endif /* __UTIL_IES_H__ */ +#endif /* __UTIL_IES_H__ */ diff --git a/intern/cycles/util/util_image.h b/intern/cycles/util/util_image.h index 85bdb0d8050..da5f56271c8 100644 --- a/intern/cycles/util/util_image.h +++ b/intern/cycles/util/util_image.h @@ -102,6 +102,6 @@ inline half util_image_cast_from_float(float value) CCL_NAMESPACE_END -#endif /* __UTIL_IMAGE_H__ */ +#endif /* __UTIL_IMAGE_H__ */ #include "util/util_image_impl.h" diff --git a/intern/cycles/util/util_list.h b/intern/cycles/util/util_list.h index f555b001186..fcf8e4f5c74 100644 --- a/intern/cycles/util/util_list.h +++ b/intern/cycles/util/util_list.h @@ -25,4 +25,4 @@ using std::list; CCL_NAMESPACE_END -#endif /* __UTIL_LIST_H__ */ +#endif /* __UTIL_LIST_H__ */ diff --git a/intern/cycles/util/util_logging.cpp b/intern/cycles/util/util_logging.cpp index f38683bf7de..b0922db32fb 100644 --- a/intern/cycles/util/util_logging.cpp +++ b/intern/cycles/util/util_logging.cpp @@ -45,7 +45,7 @@ void util_logging_init(const char *argv0) #endif } -void util_logging_start(void) +void util_logging_start() { #ifdef WITH_CYCLES_LOGGING using CYCLES_GFLAGS_NAMESPACE::SetCommandLineOption; diff --git a/intern/cycles/util/util_logging.h b/intern/cycles/util/util_logging.h index 5c84b6593d3..f66d7c92dcc 100644 --- a/intern/cycles/util/util_logging.h +++ b/intern/cycles/util/util_logging.h @@ -41,7 +41,7 @@ public: void operator&(StubStream&) { } }; -# define LOG_SUPPRESS() (true) ? (void) 0 : LogMessageVoidify() & StubStream() +# define LOG_SUPPRESS() (true) ? ((void) 0) : LogMessageVoidify() & StubStream() # define LOG(severity) LOG_SUPPRESS() # define VLOG(severity) LOG_SUPPRESS() #endif @@ -52,7 +52,7 @@ struct int2; struct float3; void util_logging_init(const char *argv0); -void util_logging_start(void); +void util_logging_start(); void util_logging_verbosity_set(int verbosity); std::ostream& operator <<(std::ostream &os, @@ -62,4 +62,4 @@ std::ostream& operator <<(std::ostream &os, CCL_NAMESPACE_END -#endif /* __UTIL_LOGGING_H__ */ +#endif /* __UTIL_LOGGING_H__ */ diff --git a/intern/cycles/util/util_map.h b/intern/cycles/util/util_map.h index 3c9288417cf..1952d33ada8 100644 --- a/intern/cycles/util/util_map.h +++ b/intern/cycles/util/util_map.h @@ -28,4 +28,4 @@ using std::unordered_map; CCL_NAMESPACE_END -#endif /* __UTIL_MAP_H__ */ +#endif /* __UTIL_MAP_H__ */ diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h index eafae5f31c0..6167119f873 100644 --- a/intern/cycles/util/util_math.h +++ b/intern/cycles/util/util_math.h @@ -157,7 +157,7 @@ ccl_device_inline T max4(const T& a, const T& b, const T& c, const T& d) { return max(max(a,b),max(c,d)); } -#endif /* __KERNEL_GPU__ */ +#endif /* __KERNEL_GPU__ */ ccl_device_inline float min4(float a, float b, float c, float d) { @@ -244,7 +244,7 @@ ccl_device_inline float4 __int4_as_float4(int4 i) __int_as_float(i.w)); #endif } -#endif /* __KERNEL_OPENCL__ */ +#endif /* __KERNEL_OPENCL__ */ /* Versions of functions which are safe for fast math. */ ccl_device_inline bool isnan_safe(float f) @@ -639,4 +639,4 @@ ccl_device_inline float2 map_to_sphere(const float3 co) CCL_NAMESPACE_END -#endif /* __UTIL_MATH_H__ */ +#endif /* __UTIL_MATH_H__ */ diff --git a/intern/cycles/util/util_math_cdf.h b/intern/cycles/util/util_math_cdf.h index 79643fe26e3..983855e3e9b 100644 --- a/intern/cycles/util/util_math_cdf.h +++ b/intern/cycles/util/util_math_cdf.h @@ -75,4 +75,4 @@ void util_cdf_inverted(const int resolution, CCL_NAMESPACE_END -#endif /* __UTIL_MATH_H_CDF__ */ +#endif /* __UTIL_MATH_H_CDF__ */ diff --git a/intern/cycles/util/util_math_float2.h b/intern/cycles/util/util_math_float2.h index 6f9d0855d50..e937509367f 100644 --- a/intern/cycles/util/util_math_float2.h +++ b/intern/cycles/util/util_math_float2.h @@ -224,4 +224,4 @@ ccl_device_inline float2 interp(const float2& a, const float2& b, float t) CCL_NAMESPACE_END -#endif /* __UTIL_MATH_FLOAT2_H__ */ +#endif /* __UTIL_MATH_FLOAT2_H__ */ diff --git a/intern/cycles/util/util_math_float3.h b/intern/cycles/util/util_math_float3.h index 75265c1c9a2..a54a3f3087c 100644 --- a/intern/cycles/util/util_math_float3.h +++ b/intern/cycles/util/util_math_float3.h @@ -419,4 +419,4 @@ ccl_device_inline float3 ensure_finite3(float3 v) CCL_NAMESPACE_END -#endif /* __UTIL_MATH_FLOAT3_H__ */ +#endif /* __UTIL_MATH_FLOAT3_H__ */ diff --git a/intern/cycles/util/util_math_float4.h b/intern/cycles/util/util_math_float4.h index 105547098b5..479ccf202ba 100644 --- a/intern/cycles/util/util_math_float4.h +++ b/intern/cycles/util/util_math_float4.h @@ -457,4 +457,4 @@ ccl_device_inline float4 load_float4(const float *v) CCL_NAMESPACE_END -#endif /* __UTIL_MATH_FLOAT4_H__ */ +#endif /* __UTIL_MATH_FLOAT4_H__ */ diff --git a/intern/cycles/util/util_math_int2.h b/intern/cycles/util/util_math_int2.h index 828c49a131c..dd401d9a091 100644 --- a/intern/cycles/util/util_math_int2.h +++ b/intern/cycles/util/util_math_int2.h @@ -74,4 +74,4 @@ ccl_device_inline int2 operator/(const int2 &a, const int2 &b) CCL_NAMESPACE_END -#endif /* __UTIL_MATH_INT2_H__ */ +#endif /* __UTIL_MATH_INT2_H__ */ diff --git a/intern/cycles/util/util_math_int3.h b/intern/cycles/util/util_math_int3.h index 81b10f31f4a..2f4752f90f1 100644 --- a/intern/cycles/util/util_math_int3.h +++ b/intern/cycles/util/util_math_int3.h @@ -113,4 +113,4 @@ ccl_device_inline int3 operator-(const int3 &a, const int3 &b) CCL_NAMESPACE_END -#endif /* __UTIL_MATH_INT3_H__ */ +#endif /* __UTIL_MATH_INT3_H__ */ diff --git a/intern/cycles/util/util_math_int4.h b/intern/cycles/util/util_math_int4.h index cde366b8c27..763c42318d5 100644 --- a/intern/cycles/util/util_math_int4.h +++ b/intern/cycles/util/util_math_int4.h @@ -156,4 +156,4 @@ ccl_device_inline int4 load_int4(const int *v) CCL_NAMESPACE_END -#endif /* __UTIL_MATH_INT4_H__ */ +#endif /* __UTIL_MATH_INT4_H__ */ diff --git a/intern/cycles/util/util_math_intersect.h b/intern/cycles/util/util_math_intersect.h index bc3dd1500a9..aa75783d378 100644 --- a/intern/cycles/util/util_math_intersect.h +++ b/intern/cycles/util/util_math_intersect.h @@ -227,4 +227,4 @@ ccl_device bool ray_quad_intersect(float3 ray_P, float3 ray_D, CCL_NAMESPACE_END -#endif /* __UTIL_MATH_INTERSECT_H__ */ +#endif /* __UTIL_MATH_INTERSECT_H__ */ diff --git a/intern/cycles/util/util_md5.h b/intern/cycles/util/util_md5.h index 9023ccee4c2..f8c0115d8ce 100644 --- a/intern/cycles/util/util_md5.h +++ b/intern/cycles/util/util_md5.h @@ -58,4 +58,4 @@ string util_md5_string(const string& str); CCL_NAMESPACE_END -#endif /* __UTIL_MD5_H__ */ +#endif /* __UTIL_MD5_H__ */ diff --git a/intern/cycles/util/util_murmurhash.h b/intern/cycles/util/util_murmurhash.h index 824ed59cb16..3e7897d3ae6 100644 --- a/intern/cycles/util/util_murmurhash.h +++ b/intern/cycles/util/util_murmurhash.h @@ -27,4 +27,4 @@ float util_hash_to_float(uint32_t hash); CCL_NAMESPACE_END -#endif /* __UTIL_MURMURHASH_H__ */ +#endif /* __UTIL_MURMURHASH_H__ */ diff --git a/intern/cycles/util/util_opengl.h b/intern/cycles/util/util_opengl.h index 7a8d5eec1f9..04f0fbaf288 100644 --- a/intern/cycles/util/util_opengl.h +++ b/intern/cycles/util/util_opengl.h @@ -22,4 +22,4 @@ #include <GL/glew.h> -#endif /* __UTIL_OPENGL_H__ */ +#endif /* __UTIL_OPENGL_H__ */ diff --git a/intern/cycles/util/util_optimization.h b/intern/cycles/util/util_optimization.h index 3b3627242d5..5267bd9a97a 100644 --- a/intern/cycles/util/util_optimization.h +++ b/intern/cycles/util/util_optimization.h @@ -68,4 +68,4 @@ #endif -#endif /* __UTIL_OPTIMIZATION_H__ */ +#endif /* __UTIL_OPTIMIZATION_H__ */ diff --git a/intern/cycles/util/util_param.h b/intern/cycles/util/util_param.h index 246b5cb7d63..4453c66aae2 100644 --- a/intern/cycles/util/util_param.h +++ b/intern/cycles/util/util_param.h @@ -30,4 +30,4 @@ OIIO_NAMESPACE_USING CCL_NAMESPACE_END -#endif /* __UTIL_PARAM_H__ */ +#endif /* __UTIL_PARAM_H__ */ diff --git a/intern/cycles/util/util_path.cpp b/intern/cycles/util/util_path.cpp index 51b7944705e..93080a6c80c 100644 --- a/intern/cycles/util/util_path.cpp +++ b/intern/cycles/util/util_path.cpp @@ -614,7 +614,7 @@ bool path_exists(const string& path) return 0; } return st.st_mode != 0; -#endif /* _WIN32 */ +#endif /* _WIN32 */ } bool path_is_directory(const string& path) diff --git a/intern/cycles/util/util_progress.h b/intern/cycles/util/util_progress.h index 3ef15c5c09a..4ed9ebd60ff 100644 --- a/intern/cycles/util/util_progress.h +++ b/intern/cycles/util/util_progress.h @@ -114,7 +114,7 @@ public: return cancel_message; } - void set_cancel_callback(function<void(void)> function) + void set_cancel_callback(function<void()> function) { cancel_cb = function; } @@ -323,7 +323,7 @@ public: } } - void set_update_callback(function<void(void)> function) + void set_update_callback(function<void()> function) { update_cb = function; } @@ -331,8 +331,8 @@ public: protected: thread_mutex progress_mutex; thread_mutex update_mutex; - function<void(void)> update_cb; - function<void(void)> cancel_cb; + function<void()> update_cb; + function<void()> cancel_cb; /* pixel_samples counts how many samples have been rendered over all pixel, not just per pixel. * This makes the progress estimate more accurate when tiles with different sizes are used. @@ -365,4 +365,4 @@ protected: CCL_NAMESPACE_END -#endif /* __UTIL_PROGRESS_H__ */ +#endif /* __UTIL_PROGRESS_H__ */ diff --git a/intern/cycles/util/util_projection.h b/intern/cycles/util/util_projection.h index 26b4843928c..d1af013ae3a 100644 --- a/intern/cycles/util/util_projection.h +++ b/intern/cycles/util/util_projection.h @@ -169,8 +169,8 @@ ccl_device_inline ProjectionTransform projection_orthographic(float znear, float return ProjectionTransform(t); } -#endif /* __KERNEL_GPU__ */ +#endif /* __KERNEL_GPU__ */ CCL_NAMESPACE_END -#endif /* __UTIL_PROJECTION_H__ */ +#endif /* __UTIL_PROJECTION_H__ */ diff --git a/intern/cycles/util/util_queue.h b/intern/cycles/util/util_queue.h index 622f4fe3e47..0a2b7718f57 100644 --- a/intern/cycles/util/util_queue.h +++ b/intern/cycles/util/util_queue.h @@ -25,4 +25,4 @@ using std::queue; CCL_NAMESPACE_END -#endif /* __UTIL_LIST_H__ */ +#endif /* __UTIL_LIST_H__ */ diff --git a/intern/cycles/util/util_rect.h b/intern/cycles/util/util_rect.h index d13baefe85e..389669acf2e 100644 --- a/intern/cycles/util/util_rect.h +++ b/intern/cycles/util/util_rect.h @@ -69,4 +69,4 @@ ccl_device_inline int rect_size(int4 rect) CCL_NAMESPACE_END -#endif /* __UTIL_RECT_H__ */ +#endif /* __UTIL_RECT_H__ */ diff --git a/intern/cycles/util/util_set.h b/intern/cycles/util/util_set.h index 298e1f7729a..a9c56bb4919 100644 --- a/intern/cycles/util/util_set.h +++ b/intern/cycles/util/util_set.h @@ -31,4 +31,4 @@ using std::unordered_set; CCL_NAMESPACE_END -#endif /* __UTIL_SET_H__ */ +#endif /* __UTIL_SET_H__ */ diff --git a/intern/cycles/util/util_simd.h b/intern/cycles/util/util_simd.h index cc7f436c8fe..565ea768089 100644 --- a/intern/cycles/util/util_simd.h +++ b/intern/cycles/util/util_simd.h @@ -219,9 +219,9 @@ __forceinline size_t __bscf(size_t& v) return i; } -#endif /* __KERNEL_64_BIT__ */ +#endif /* __KERNEL_64_BIT__ */ -#else /* _WIN32 */ +#else /* _WIN32 */ __forceinline unsigned int __popcnt(unsigned int in) { int r = 0; asm ("popcnt %1,%0" : "=r"(r) : "r"(in)); return r; @@ -344,7 +344,7 @@ __forceinline size_t __bscf(size_t& v) } #endif -#endif /* _WIN32 */ +#endif /* _WIN32 */ /* Test __KERNEL_SSE41__ for MSVC which does not define __SSE4_1__, and test * __SSE4_1__ to avoid OpenImageIO conflicts with our emulation macros on other @@ -442,7 +442,7 @@ __forceinline __m128 _mm_round_ps_emu( __m128 value, const int flags) return value; } -#endif /* !(defined(__KERNEL_SSE41__) || defined(__SSE4_1__) || defined(__SSE4_2__)) */ +#endif /* !(defined(__KERNEL_SSE41__) || defined(__SSE4_1__) || defined(__SSE4_2__)) */ #else /* __KERNEL_SSE2__ */ @@ -470,7 +470,7 @@ ccl_device_inline int __bsr(int value) return bit; } -#endif /* __KERNEL_SSE2__ */ +#endif /* __KERNEL_SSE2__ */ /* quiet unused define warnings */ #if defined(__KERNEL_SSE2__) || \ @@ -484,6 +484,6 @@ ccl_device_inline int __bsr(int value) CCL_NAMESPACE_END -#endif /* __KERNEL_GPU__ */ +#endif /* __KERNEL_GPU__ */ -#endif /* __UTIL_SIMD_TYPES_H__ */ +#endif /* __UTIL_SIMD_TYPES_H__ */ diff --git a/intern/cycles/util/util_sky_model.h b/intern/cycles/util/util_sky_model.h index 237e4e61bf5..2e593f58c39 100644 --- a/intern/cycles/util/util_sky_model.h +++ b/intern/cycles/util/util_sky_model.h @@ -437,6 +437,6 @@ double arhosekskymodel_solar_radiance(ArHosekSkyModelState* state, double wavelength); -#endif // _SKY_MODEL_H_ +#endif // _SKY_MODEL_H_ CCL_NAMESPACE_END diff --git a/intern/cycles/util/util_ssef.h b/intern/cycles/util/util_ssef.h index b5623860e33..66670c9a779 100644 --- a/intern/cycles/util/util_ssef.h +++ b/intern/cycles/util/util_ssef.h @@ -44,8 +44,8 @@ struct ssef __forceinline ssef& operator=(const ssef& other) { m128 = other.m128; return *this; } __forceinline ssef(const __m128 a) : m128(a) {} - __forceinline operator const __m128&(void) const { return m128; } - __forceinline operator __m128&(void) { return m128; } + __forceinline operator const __m128&() const { return m128; } + __forceinline operator __m128&() { return m128; } __forceinline ssef (float a) : m128(_mm_set1_ps(a)) {} __forceinline ssef (float a, float b, float c, float d) : m128(_mm_setr_ps(a, b, c, d)) {} @@ -517,12 +517,12 @@ ccl_device_inline float len3(const ssef& a) /* faster version for SSSE3 */ typedef ssei shuffle_swap_t; -ccl_device_inline shuffle_swap_t shuffle_swap_identity(void) +ccl_device_inline shuffle_swap_t shuffle_swap_identity() { return _mm_set_epi8(15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0); } -ccl_device_inline shuffle_swap_t shuffle_swap_swap(void) +ccl_device_inline shuffle_swap_t shuffle_swap_swap() { return _mm_set_epi8(7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8); } @@ -537,12 +537,12 @@ ccl_device_inline const ssef shuffle_swap(const ssef& a, const shuffle_swap_t& s /* somewhat slower version for SSE2 */ typedef int shuffle_swap_t; -ccl_device_inline shuffle_swap_t shuffle_swap_identity(void) +ccl_device_inline shuffle_swap_t shuffle_swap_identity() { return 0; } -ccl_device_inline shuffle_swap_t shuffle_swap_swap(void) +ccl_device_inline shuffle_swap_t shuffle_swap_swap() { return 1; } diff --git a/intern/cycles/util/util_stack_allocator.h b/intern/cycles/util/util_stack_allocator.h index 79a535bd170..6b52e73ee4e 100644 --- a/intern/cycles/util/util_stack_allocator.h +++ b/intern/cycles/util/util_stack_allocator.h @@ -53,7 +53,7 @@ public: T *allocate(size_t n, const void *hint = 0) { - (void)hint; + (void) hint; if(n == 0) { return NULL; } diff --git a/intern/cycles/util/util_static_assert.h b/intern/cycles/util/util_static_assert.h index dc3cb3f6ecc..b1c6c374693 100644 --- a/intern/cycles/util/util_static_assert.h +++ b/intern/cycles/util/util_static_assert.h @@ -47,4 +47,4 @@ CCL_NAMESPACE_BEGIN CCL_NAMESPACE_END -#endif /* __UTIL_STATIC_ASSERT_H__ */ +#endif /* __UTIL_STATIC_ASSERT_H__ */ diff --git a/intern/cycles/util/util_stats.h b/intern/cycles/util/util_stats.h index 7667f58eb7d..0ba58422a67 100644 --- a/intern/cycles/util/util_stats.h +++ b/intern/cycles/util/util_stats.h @@ -44,4 +44,4 @@ public: CCL_NAMESPACE_END -#endif /* __UTIL_STATS_H__ */ +#endif /* __UTIL_STATS_H__ */ diff --git a/intern/cycles/util/util_string.h b/intern/cycles/util/util_string.h index 3a4f4398158..f17112c30d2 100644 --- a/intern/cycles/util/util_string.h +++ b/intern/cycles/util/util_string.h @@ -74,4 +74,4 @@ string string_human_readable_number(size_t num); CCL_NAMESPACE_END -#endif /* __UTIL_STRING_H__ */ +#endif /* __UTIL_STRING_H__ */ diff --git a/intern/cycles/util/util_system.cpp b/intern/cycles/util/util_system.cpp index 1b039888452..34f428f111c 100644 --- a/intern/cycles/util/util_system.cpp +++ b/intern/cycles/util/util_system.cpp @@ -52,14 +52,14 @@ int system_cpu_group_thread_count(int group) util_windows_init_numa_groups(); return GetActiveProcessorCount(group); #elif defined(__APPLE__) - (void)group; + (void) group; int count; size_t len = sizeof(count); int mib[2] = { CTL_HW, HW_NCPU }; sysctl(mib, 2, &count, &len, NULL, 0); return count; #else - (void)group; + (void) group; return sysconf(_SC_NPROCESSORS_ONLN); #endif } diff --git a/intern/cycles/util/util_system.h b/intern/cycles/util/util_system.h index 42ad72356b9..241ac897157 100644 --- a/intern/cycles/util/util_system.h +++ b/intern/cycles/util/util_system.h @@ -46,4 +46,4 @@ size_t system_physical_ram(); CCL_NAMESPACE_END -#endif /* __UTIL_SYSTEM_H__ */ +#endif /* __UTIL_SYSTEM_H__ */ diff --git a/intern/cycles/util/util_texture.h b/intern/cycles/util/util_texture.h index f752e81128d..233cfe33305 100644 --- a/intern/cycles/util/util_texture.h +++ b/intern/cycles/util/util_texture.h @@ -89,4 +89,4 @@ typedef struct TextureInfo { CCL_NAMESPACE_END -#endif /* __UTIL_TEXTURE_H__ */ +#endif /* __UTIL_TEXTURE_H__ */ diff --git a/intern/cycles/util/util_thread.cpp b/intern/cycles/util/util_thread.cpp index 16a8591a8a9..37d8bdbd4b0 100644 --- a/intern/cycles/util/util_thread.cpp +++ b/intern/cycles/util/util_thread.cpp @@ -21,7 +21,7 @@ CCL_NAMESPACE_BEGIN -thread::thread(function<void(void)> run_cb, int group) +thread::thread(function<void()> run_cb, int group) : run_cb_(run_cb), joined_(false), group_(group) diff --git a/intern/cycles/util/util_thread.h b/intern/cycles/util/util_thread.h index f39fcfb4279..6250bb95dcf 100644 --- a/intern/cycles/util/util_thread.h +++ b/intern/cycles/util/util_thread.h @@ -46,14 +46,14 @@ typedef std::condition_variable thread_condition_variable; class thread { public: - thread(function<void(void)> run_cb, int group = -1); + thread(function<void()> run_cb, int group = -1); ~thread(); static void *run(void *arg); bool join(); protected: - function<void(void)> run_cb_; + function<void()> run_cb_; std::thread thread_; bool joined_; int group_; @@ -138,4 +138,4 @@ protected: CCL_NAMESPACE_END -#endif /* __UTIL_THREAD_H__ */ +#endif /* __UTIL_THREAD_H__ */ diff --git a/intern/cycles/util/util_transform.h b/intern/cycles/util/util_transform.h index 6bdf56fda7f..e4cadd3e81a 100644 --- a/intern/cycles/util/util_transform.h +++ b/intern/cycles/util/util_transform.h @@ -495,4 +495,4 @@ OPENCL_TRANSFORM_ADDRSPACE_DECLARE(transform_direction_transposed) CCL_NAMESPACE_END -#endif /* __UTIL_TRANSFORM_H__ */ +#endif /* __UTIL_TRANSFORM_H__ */ diff --git a/intern/cycles/util/util_types.h b/intern/cycles/util/util_types.h index 96c549b9be5..535048d8f8c 100644 --- a/intern/cycles/util/util_types.h +++ b/intern/cycles/util/util_types.h @@ -156,4 +156,4 @@ CCL_NAMESPACE_END #endif #endif -#endif /* __UTIL_TYPES_H__ */ +#endif /* __UTIL_TYPES_H__ */ diff --git a/intern/cycles/util/util_types_float3.h b/intern/cycles/util/util_types_float3.h index 28146ad04f7..ed2300e7996 100644 --- a/intern/cycles/util/util_types_float3.h +++ b/intern/cycles/util/util_types_float3.h @@ -35,8 +35,8 @@ struct ccl_try_align(16) float3 { __forceinline float3(const float3& a); __forceinline explicit float3(const __m128& a); - __forceinline operator const __m128&(void) const; - __forceinline operator __m128&(void); + __forceinline operator const __m128&() const; + __forceinline operator __m128&(); __forceinline float3& operator =(const float3& a); #else /* __KERNEL_SSE__ */ diff --git a/intern/cycles/util/util_types_float3_impl.h b/intern/cycles/util/util_types_float3_impl.h index 45f61767d3f..2e840a5c399 100644 --- a/intern/cycles/util/util_types_float3_impl.h +++ b/intern/cycles/util/util_types_float3_impl.h @@ -43,12 +43,12 @@ __forceinline float3::float3(const __m128& a) { } -__forceinline float3::operator const __m128&(void) const +__forceinline float3::operator const __m128&() const { return m128; } -__forceinline float3::operator __m128&(void) +__forceinline float3::operator __m128&() { return m128; } diff --git a/intern/cycles/util/util_types_float4.h b/intern/cycles/util/util_types_float4.h index 154391f6881..5c10d483c2e 100644 --- a/intern/cycles/util/util_types_float4.h +++ b/intern/cycles/util/util_types_float4.h @@ -36,8 +36,8 @@ struct ccl_try_align(16) float4 { __forceinline float4(); __forceinline explicit float4(const __m128& a); - __forceinline operator const __m128&(void) const; - __forceinline operator __m128&(void); + __forceinline operator const __m128&() const; + __forceinline operator __m128&(); __forceinline float4& operator =(const float4& a); diff --git a/intern/cycles/util/util_types_float4_impl.h b/intern/cycles/util/util_types_float4_impl.h index a49fac65b10..a83148031f1 100644 --- a/intern/cycles/util/util_types_float4_impl.h +++ b/intern/cycles/util/util_types_float4_impl.h @@ -38,12 +38,12 @@ __forceinline float4::float4(const __m128& a) { } -__forceinline float4::operator const __m128&(void) const +__forceinline float4::operator const __m128&() const { return m128; } -__forceinline float4::operator __m128&(void) +__forceinline float4::operator __m128&() { return m128; } diff --git a/intern/cycles/util/util_types_float8.h b/intern/cycles/util/util_types_float8.h index a91fddb2038..08720b8ff48 100644 --- a/intern/cycles/util/util_types_float8.h +++ b/intern/cycles/util/util_types_float8.h @@ -48,8 +48,8 @@ struct ccl_try_align(32) float8 { __forceinline float8(const float8& a); __forceinline explicit float8(const __m256& a); - __forceinline operator const __m256&(void) const; - __forceinline operator __m256&(void); + __forceinline operator const __m256&() const; + __forceinline operator __m256&(); __forceinline float8& operator =(const float8& a); diff --git a/intern/cycles/util/util_types_float8_impl.h b/intern/cycles/util/util_types_float8_impl.h index ebf8260bc7c..84fe233c334 100644 --- a/intern/cycles/util/util_types_float8_impl.h +++ b/intern/cycles/util/util_types_float8_impl.h @@ -55,12 +55,12 @@ __forceinline float8::float8(const __m256& f) { } -__forceinline float8::operator const __m256&(void) const +__forceinline float8::operator const __m256&() const { return m256; } -__forceinline float8::operator __m256&(void) +__forceinline float8::operator __m256&() { return m256; } diff --git a/intern/cycles/util/util_types_int3.h b/intern/cycles/util/util_types_int3.h index 9d43b201c02..f68074b982b 100644 --- a/intern/cycles/util/util_types_int3.h +++ b/intern/cycles/util/util_types_int3.h @@ -35,8 +35,8 @@ struct ccl_try_align(16) int3 { __forceinline int3(const int3& a); __forceinline explicit int3(const __m128i& a); - __forceinline operator const __m128i&(void) const; - __forceinline operator __m128i&(void); + __forceinline operator const __m128i&() const; + __forceinline operator __m128i&(); __forceinline int3& operator =(const int3& a); #else /* __KERNEL_SSE__ */ diff --git a/intern/cycles/util/util_types_int3_impl.h b/intern/cycles/util/util_types_int3_impl.h index ada50c4812c..1b195ca753f 100644 --- a/intern/cycles/util/util_types_int3_impl.h +++ b/intern/cycles/util/util_types_int3_impl.h @@ -43,12 +43,12 @@ __forceinline int3::int3(const int3& a) { } -__forceinline int3::operator const __m128i&(void) const +__forceinline int3::operator const __m128i&() const { return m128; } -__forceinline int3::operator __m128i&(void) +__forceinline int3::operator __m128i&() { return m128; } diff --git a/intern/cycles/util/util_types_int4.h b/intern/cycles/util/util_types_int4.h index 4ef162f1ac6..52e6fed8c14 100644 --- a/intern/cycles/util/util_types_int4.h +++ b/intern/cycles/util/util_types_int4.h @@ -39,8 +39,8 @@ struct ccl_try_align(16) int4 { __forceinline int4(const int4& a); __forceinline explicit int4(const __m128i& a); - __forceinline operator const __m128i&(void) const; - __forceinline operator __m128i&(void); + __forceinline operator const __m128i&() const; + __forceinline operator __m128i&(); __forceinline int4& operator=(const int4& a); #else /* __KERNEL_SSE__ */ diff --git a/intern/cycles/util/util_types_int4_impl.h b/intern/cycles/util/util_types_int4_impl.h index a62561709de..c058f86c400 100644 --- a/intern/cycles/util/util_types_int4_impl.h +++ b/intern/cycles/util/util_types_int4_impl.h @@ -43,12 +43,12 @@ __forceinline int4::int4(const __m128i& a) { } -__forceinline int4::operator const __m128i&(void) const +__forceinline int4::operator const __m128i&() const { return m128; } -__forceinline int4::operator __m128i&(void) +__forceinline int4::operator __m128i&() { return m128; } diff --git a/intern/cycles/util/util_vector.h b/intern/cycles/util/util_vector.h index 0b33221ad4d..18fa231d6e7 100644 --- a/intern/cycles/util/util_vector.h +++ b/intern/cycles/util/util_vector.h @@ -17,8 +17,6 @@ #ifndef __UTIL_VECTOR_H__ #define __UTIL_VECTOR_H__ -/* Vector */ - #include <cassert> #include <cstring> #include <vector> @@ -29,12 +27,9 @@ CCL_NAMESPACE_BEGIN -/* Vector - * - * Own subclass-ed vestion of std::vector. Subclass is needed because: +/* Own subclass-ed vestion of std::vector. Subclass is needed because: * * - Use own allocator which keeps track of used/peak memory. - * * - Have method to ensure capacity is re-set to 0. */ template<typename value_type, @@ -42,30 +37,16 @@ template<typename value_type, class vector : public std::vector<value_type, allocator_type> { public: - /* Default constructor. */ - explicit vector() : std::vector<value_type, allocator_type>() { } - - /* Fill constructor. */ - explicit vector(size_t n, const value_type& val = value_type()) - : std::vector<value_type, allocator_type>(n, val) { } - - /* Range constructor. */ - template <class InputIterator> - vector(InputIterator first, InputIterator last) - : std::vector<value_type, allocator_type>(first, last) { } - - /* Copy constructor. */ - vector(const vector &x) : std::vector<value_type, allocator_type>(x) { } + typedef std::vector<value_type, allocator_type> BaseClass; - void shrink_to_fit(void) - { - std::vector<value_type, allocator_type>::shrink_to_fit(); - } + /* Inherit all constructors from base class. */ + using BaseClass::vector; - void free_memory(void) + /* Try as hard as possible to use zero memory. */ + void free_memory() { - std::vector<value_type, allocator_type>::resize(0); - shrink_to_fit(); + BaseClass::resize(0); + BaseClass::shrink_to_fit(); } /* Some external API might demand working with std::vector. */ @@ -75,265 +56,6 @@ public: } }; -/* Array - * - * Simplified version of vector, serving multiple purposes: - * - somewhat faster in that it does not clear memory on resize/alloc, - * this was actually showing up in profiles quite significantly. it - * also does not run any constructors/destructors - * - if this is used, we are not tempted to use inefficient operations - * - aligned allocation for CPU native data types */ - -template<typename T, size_t alignment = MIN_ALIGNMENT_CPU_DATA_TYPES> -class array -{ -public: - array() - : data_(NULL), - datasize_(0), - capacity_(0) - {} - - explicit array(size_t newsize) - { - if(newsize == 0) { - data_ = NULL; - datasize_ = 0; - capacity_ = 0; - } - else { - data_ = mem_allocate(newsize); - datasize_ = newsize; - capacity_ = datasize_; - } - } - - array(const array& from) - { - if(from.datasize_ == 0) { - data_ = NULL; - datasize_ = 0; - capacity_ = 0; - } - else { - data_ = mem_allocate(from.datasize_); - memcpy(data_, from.data_, from.datasize_*sizeof(T)); - datasize_ = from.datasize_; - capacity_ = datasize_; - } - } - - array& operator=(const array& from) - { - if(this != &from) { - resize(from.size()); - memcpy((void*)data_, from.data_, datasize_*sizeof(T)); - } - - return *this; - } - - array& operator=(const vector<T>& from) - { - resize(from.size()); - - if(from.size() > 0) { - memcpy(data_, &from[0], datasize_*sizeof(T)); - } - - return *this; - } - - ~array() - { - mem_free(data_, capacity_); - } - - bool operator==(const array<T>& other) const - { - if(datasize_ != other.datasize_) { - return false; - } - - return memcmp(data_, other.data_, datasize_*sizeof(T)) == 0; - } - - bool operator!=(const array<T>& other) const - { - return !(*this == other); - } - - void steal_data(array& from) - { - if(this != &from) { - clear(); - - data_ = from.data_; - datasize_ = from.datasize_; - capacity_ = from.capacity_; - - from.data_ = NULL; - from.datasize_ = 0; - from.capacity_ = 0; - } - } - - T *steal_pointer() - { - T *ptr = data_; - data_ = NULL; - clear(); - return ptr; - } - - T* resize(size_t newsize) - { - if(newsize == 0) { - clear(); - } - else if(newsize != datasize_) { - if(newsize > capacity_) { - T *newdata = mem_allocate(newsize); - if(newdata == NULL) { - /* Allocation failed, likely out of memory. */ - clear(); - return NULL; - } - else if(data_ != NULL) { - memcpy((void *)newdata, - data_, - ((datasize_ < newsize)? datasize_: newsize)*sizeof(T)); - mem_free(data_, capacity_); - } - data_ = newdata; - capacity_ = newsize; - } - datasize_ = newsize; - } - return data_; - } - - T* resize(size_t newsize, const T& value) - { - size_t oldsize = size(); - resize(newsize); - - for(size_t i = oldsize; i < size(); i++) { - data_[i] = value; - } - - return data_; - } - - void clear() - { - if(data_ != NULL) { - mem_free(data_, capacity_); - data_ = NULL; - } - datasize_ = 0; - capacity_ = 0; - } - - size_t empty() const - { - return datasize_ == 0; - } - - size_t size() const - { - return datasize_; - } - - T* data() - { - return data_; - } - - const T* data() const - { - return data_; - } - - T& operator[](size_t i) const - { - assert(i < datasize_); - return data_[i]; - } - - void reserve(size_t newcapacity) - { - if(newcapacity > capacity_) { - T *newdata = mem_allocate(newcapacity); - if(data_ != NULL) { - memcpy(newdata, data_, ((datasize_ < newcapacity)? datasize_: newcapacity)*sizeof(T)); - mem_free(data_, capacity_); - } - data_ = newdata; - capacity_ = newcapacity; - } - } - - size_t capacity() const - { - return capacity_; - } - - // do not use this method unless you are sure the code is not performance critical - void push_back_slow(const T& t) - { - if(capacity_ == datasize_) - { - reserve(datasize_ == 0 ? 1 : (size_t)((datasize_ + 1) * 1.2)); - } - - data_[datasize_++] = t; - } - - void push_back_reserved(const T& t) - { - assert(datasize_ < capacity_); - push_back_slow(t); - } - - void append(const array<T>& from) - { - if(from.size()) { - size_t old_size = size(); - resize(old_size + from.size()); - memcpy(data_ + old_size, from.data(), sizeof(T) * from.size()); - } - } - -protected: - inline T* mem_allocate(size_t N) - { - if(N == 0) { - return NULL; - } - T *mem = (T*)util_aligned_malloc(sizeof(T)*N, alignment); - if(mem != NULL) { - util_guarded_mem_alloc(sizeof(T)*N); - } - else { - throw std::bad_alloc(); - } - return mem; - } - - inline void mem_free(T *mem, size_t N) - { - if(mem != NULL) { - util_guarded_mem_free(sizeof(T)*N); - util_aligned_free(mem); - } - } - - T *data_; - size_t datasize_; - size_t capacity_; -}; - CCL_NAMESPACE_END -#endif /* __UTIL_VECTOR_H__ */ +#endif /* __UTIL_VECTOR_H__ */ diff --git a/intern/cycles/util/util_version.h b/intern/cycles/util/util_version.h index 112255f447b..980c5a269e6 100644 --- a/intern/cycles/util/util_version.h +++ b/intern/cycles/util/util_version.h @@ -34,4 +34,4 @@ CCL_NAMESPACE_BEGIN CCL_NAMESPACE_END -#endif /* __UTIL_VERSION_H__ */ +#endif /* __UTIL_VERSION_H__ */ diff --git a/intern/cycles/util/util_view.cpp b/intern/cycles/util/util_view.cpp index 05094c7b327..c0ddc2a88bf 100644 --- a/intern/cycles/util/util_view.cpp +++ b/intern/cycles/util/util_view.cpp @@ -215,7 +215,7 @@ static void view_motion(int x, int y) V.mouseY = y; } -static void view_idle(void) +static void view_idle() { if(V.redraw) { V.redraw = false; diff --git a/intern/cycles/util/util_view.h b/intern/cycles/util/util_view.h index e603e605776..ae50b098b39 100644 --- a/intern/cycles/util/util_view.h +++ b/intern/cycles/util/util_view.h @@ -22,10 +22,10 @@ CCL_NAMESPACE_BEGIN -typedef void (*ViewInitFunc)(void); -typedef void (*ViewExitFunc)(void); +typedef void (*ViewInitFunc)(); +typedef void (*ViewExitFunc)(); typedef void (*ViewResizeFunc)(int width, int height); -typedef void (*ViewDisplayFunc)(void); +typedef void (*ViewDisplayFunc)(); typedef void (*ViewKeyboardFunc)(unsigned char key); typedef void (*ViewMotionFunc)(int x, int y, int button); @@ -40,4 +40,4 @@ void view_redraw(); CCL_NAMESPACE_END -#endif /*__UTIL_VIEW_H__*/ +#endif /*__UTIL_VIEW_H__*/ diff --git a/intern/cycles/util/util_windows.h b/intern/cycles/util/util_windows.h index 3b23ce8a3cb..9b9268fed7a 100644 --- a/intern/cycles/util/util_windows.h +++ b/intern/cycles/util/util_windows.h @@ -56,4 +56,4 @@ CCL_NAMESPACE_END #endif /* WIN32 */ -#endif /* __UTIL_WINDOWS_H__ */ +#endif /* __UTIL_WINDOWS_H__ */ diff --git a/intern/cycles/util/util_xml.h b/intern/cycles/util/util_xml.h index 6f06f17937b..c8a3a495f30 100644 --- a/intern/cycles/util/util_xml.h +++ b/intern/cycles/util/util_xml.h @@ -38,4 +38,4 @@ using PUGIXML_NAMESPACE::xml_parse_result; CCL_NAMESPACE_END -#endif /* __UTIL_XML_H__ */ +#endif /* __UTIL_XML_H__ */ |