Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
Diffstat (limited to 'intern')
-rw-r--r--intern/atomic/atomic_ops.h14
-rw-r--r--intern/atomic/intern/atomic_ops_utils.h6
-rw-r--r--intern/audaspace/CMakeLists.txt5
-rw-r--r--intern/audaspace/intern/AUD_PyInit.cpp6
-rw-r--r--intern/clog/clog.c3
-rw-r--r--intern/cycles/app/CMakeLists.txt1
-rw-r--r--intern/cycles/app/cycles_xml.cpp2
-rw-r--r--intern/cycles/app/io_export_cycles_xml.py2
-rw-r--r--intern/cycles/blender/addon/properties.py18
-rw-r--r--intern/cycles/blender/addon/ui.py13
-rw-r--r--intern/cycles/blender/addon/version_update.py201
-rw-r--r--intern/cycles/blender/blender_curves.cpp4
-rw-r--r--intern/cycles/blender/blender_object.cpp5
-rw-r--r--intern/cycles/blender/blender_session.cpp16
-rw-r--r--intern/cycles/blender/blender_shader.cpp28
-rw-r--r--intern/cycles/blender/blender_sync.cpp2
-rw-r--r--intern/cycles/blender/blender_util.h8
-rw-r--r--intern/cycles/bvh/bvh8.cpp52
-rw-r--r--intern/cycles/bvh/bvh8.h58
-rw-r--r--intern/cycles/bvh/bvh_embree.cpp22
-rw-r--r--intern/cycles/device/CMakeLists.txt3
-rw-r--r--intern/cycles/device/device.cpp3
-rw-r--r--intern/cycles/device/device_cuda.cpp7
-rw-r--r--intern/cycles/device/device_denoising.cpp12
-rw-r--r--intern/cycles/device/device_opencl.cpp4
-rw-r--r--intern/cycles/device/device_split_kernel.h2
-rw-r--r--intern/cycles/device/device_task.h3
-rw-r--r--intern/cycles/device/opencl/opencl.h4
-rw-r--r--intern/cycles/device/opencl/opencl_split.cpp8
-rw-r--r--intern/cycles/kernel/bvh/bvh.h13
-rw-r--r--intern/cycles/kernel/bvh/bvh_nodes.h310
-rw-r--r--intern/cycles/kernel/bvh/bvh_shadow_all.h10
-rw-r--r--intern/cycles/kernel/bvh/bvh_traversal.h124
-rw-r--r--intern/cycles/kernel/bvh/bvh_types.h1
-rw-r--r--intern/cycles/kernel/bvh/obvh_nodes.h181
-rw-r--r--intern/cycles/kernel/bvh/obvh_shadow_all.h14
-rw-r--r--intern/cycles/kernel/bvh/obvh_traversal.h81
-rw-r--r--intern/cycles/kernel/bvh/qbvh_nodes.h189
-rw-r--r--intern/cycles/kernel/bvh/qbvh_shadow_all.h12
-rw-r--r--intern/cycles/kernel/bvh/qbvh_traversal.h73
-rw-r--r--intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h19
-rw-r--r--intern/cycles/kernel/closure/bsdf_hair.h4
-rw-r--r--intern/cycles/kernel/closure/bsdf_hair_principled.h3
-rw-r--r--intern/cycles/kernel/closure/bsdf_microfacet_multi.h18
-rw-r--r--intern/cycles/kernel/closure/bsdf_microfacet_multi_impl.h23
-rw-r--r--intern/cycles/kernel/closure/bsdf_util.h2
-rw-r--r--intern/cycles/kernel/closure/bssrdf.h6
-rw-r--r--intern/cycles/kernel/filter/filter_features.h5
-rw-r--r--intern/cycles/kernel/filter/filter_features_sse.h4
-rw-r--r--intern/cycles/kernel/filter/filter_nlm_cpu.h3
-rw-r--r--intern/cycles/kernel/filter/filter_prefilter.h26
-rw-r--r--intern/cycles/kernel/filter/filter_transform.h8
-rw-r--r--intern/cycles/kernel/filter/filter_transform_gpu.h8
-rw-r--r--intern/cycles/kernel/filter/filter_transform_sse.h8
-rw-r--r--intern/cycles/kernel/geom/geom_curve_intersect.h121
-rw-r--r--intern/cycles/kernel/geom/geom_object.h3
-rw-r--r--intern/cycles/kernel/geom/geom_triangle_intersect.h58
-rw-r--r--intern/cycles/kernel/kernel_bake.h6
-rw-r--r--intern/cycles/kernel/kernel_id_passes.h32
-rw-r--r--intern/cycles/kernel/kernel_light.h3
-rw-r--r--intern/cycles/kernel/kernel_montecarlo.h31
-rw-r--r--intern/cycles/kernel/kernel_path.h32
-rw-r--r--intern/cycles/kernel/kernel_path_branched.h4
-rw-r--r--intern/cycles/kernel/kernel_path_surface.h12
-rw-r--r--intern/cycles/kernel/kernel_shadow.h12
-rw-r--r--intern/cycles/kernel/kernel_types.h3
-rw-r--r--intern/cycles/kernel/kernel_volume.h4
-rw-r--r--intern/cycles/kernel/kernels/cuda/kernel_config.h3
-rw-r--r--intern/cycles/kernel/osl/osl_closures.cpp8
-rw-r--r--intern/cycles/kernel/osl/osl_services.cpp6
-rw-r--r--intern/cycles/kernel/shaders/stdosl.h65
-rw-r--r--intern/cycles/kernel/split/kernel_buffer_update.h4
-rw-r--r--intern/cycles/kernel/split/kernel_data_init.h8
-rw-r--r--intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h6
-rw-r--r--intern/cycles/kernel/split/kernel_next_iteration_setup.h6
-rw-r--r--intern/cycles/kernel/split/kernel_split_data_types.h11
-rw-r--r--intern/cycles/kernel/svm/svm_ao.h30
-rw-r--r--intern/cycles/kernel/svm/svm_ies.h18
-rw-r--r--intern/cycles/kernel/svm/svm_voronoi.h3
-rw-r--r--intern/cycles/render/attribute.cpp3
-rw-r--r--intern/cycles/render/camera.cpp19
-rw-r--r--intern/cycles/render/curves.cpp7
-rw-r--r--intern/cycles/render/curves.h3
-rw-r--r--intern/cycles/render/denoising.cpp12
-rw-r--r--intern/cycles/render/denoising.h15
-rw-r--r--intern/cycles/render/graph.cpp7
-rw-r--r--intern/cycles/render/graph.h2
-rw-r--r--intern/cycles/render/mesh.cpp5
-rw-r--r--intern/cycles/render/nodes.cpp6
-rw-r--r--intern/cycles/render/shader.h6
-rw-r--r--intern/cycles/render/svm.cpp6
-rw-r--r--intern/cycles/render/tile.cpp31
-rw-r--r--intern/cycles/subd/subd_split.cpp2
-rw-r--r--intern/cycles/util/util_color.h3
-rw-r--r--intern/cycles/util/util_debug.h3
-rw-r--r--intern/cycles/util/util_half.h3
-rw-r--r--intern/cycles/util/util_ies.cpp28
-rw-r--r--intern/cycles/util/util_math.h4
-rw-r--r--intern/cycles/util/util_math_fast.h12
-rw-r--r--intern/cycles/util/util_math_intersect.h2
-rw-r--r--intern/cycles/util/util_math_matrix.h38
-rw-r--r--intern/cycles/util/util_profiling.cpp3
-rw-r--r--intern/cycles/util/util_progress.h3
-rw-r--r--intern/cycles/util/util_task.cpp2
-rw-r--r--intern/cycles/util/util_transform.h6
-rw-r--r--intern/cycles/util/util_types_float8.h52
-rw-r--r--intern/cycles/util/util_types_float8_impl.h52
-rw-r--r--intern/dualcon/intern/MemoryAllocator.h32
-rw-r--r--intern/dualcon/intern/Projections.h14
-rw-r--r--intern/dualcon/intern/octree.cpp178
-rw-r--r--intern/dualcon/intern/octree.h12
-rw-r--r--intern/ffmpeg/ffmpeg_compat.h10
-rw-r--r--intern/ghost/GHOST_C-api.h17
-rw-r--r--intern/ghost/GHOST_ISystem.h22
-rw-r--r--intern/ghost/GHOST_IWindow.h9
-rw-r--r--intern/ghost/GHOST_Rect.h25
-rw-r--r--intern/ghost/GHOST_Types.h13
-rw-r--r--intern/ghost/intern/GHOST_C-api.cpp7
-rw-r--r--intern/ghost/intern/GHOST_Context.h12
-rw-r--r--intern/ghost/intern/GHOST_ContextCGL.h1
-rw-r--r--intern/ghost/intern/GHOST_ContextCGL.mm75
-rw-r--r--intern/ghost/intern/GHOST_ContextEGL.cpp37
-rw-r--r--intern/ghost/intern/GHOST_ContextEGL.h1
-rw-r--r--intern/ghost/intern/GHOST_ContextGLX.cpp35
-rw-r--r--intern/ghost/intern/GHOST_ContextGLX.h9
-rw-r--r--intern/ghost/intern/GHOST_ContextNone.h3
-rw-r--r--intern/ghost/intern/GHOST_ContextSDL.cpp19
-rw-r--r--intern/ghost/intern/GHOST_ContextSDL.h1
-rw-r--r--intern/ghost/intern/GHOST_ContextWGL.cpp159
-rw-r--r--intern/ghost/intern/GHOST_ContextWGL.h12
-rw-r--r--intern/ghost/intern/GHOST_DisplayManagerCocoa.h6
-rw-r--r--intern/ghost/intern/GHOST_DisplayManagerCocoa.mm14
-rw-r--r--intern/ghost/intern/GHOST_DropTargetWin32.cpp11
-rw-r--r--intern/ghost/intern/GHOST_EventDragnDrop.h37
-rw-r--r--intern/ghost/intern/GHOST_ImeWin32.cpp18
-rw-r--r--intern/ghost/intern/GHOST_ImeWin32.h2
-rw-r--r--intern/ghost/intern/GHOST_NDOFManager.cpp58
-rw-r--r--intern/ghost/intern/GHOST_System.cpp21
-rw-r--r--intern/ghost/intern/GHOST_System.h6
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.h12
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm183
-rw-r--r--intern/ghost/intern/GHOST_SystemSDL.cpp29
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp85
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.h14
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp70
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.h6
-rw-r--r--intern/ghost/intern/GHOST_Window.cpp13
-rw-r--r--intern/ghost/intern/GHOST_Window.h19
-rw-r--r--intern/ghost/intern/GHOST_WindowCocoa.h5
-rw-r--r--intern/ghost/intern/GHOST_WindowCocoa.mm37
-rw-r--r--intern/ghost/intern/GHOST_WindowManager.cpp4
-rw-r--r--intern/ghost/intern/GHOST_WindowNULL.h5
-rw-r--r--intern/ghost/intern/GHOST_WindowSDL.cpp46
-rw-r--r--intern/ghost/intern/GHOST_WindowSDL.h3
-rw-r--r--intern/ghost/intern/GHOST_WindowWin32.cpp17
-rw-r--r--intern/ghost/intern/GHOST_WindowWin32.h9
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.cpp155
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.h5
-rw-r--r--intern/ghost/test/gears/GHOST_Test.cpp23
-rw-r--r--intern/guardedalloc/MEM_guardedalloc.h86
-rw-r--r--intern/guardedalloc/intern/mallocn_guarded_impl.c22
-rw-r--r--intern/guardedalloc/intern/mmap_win.c6
-rw-r--r--intern/guardedalloc/test/simpletest/memtest.c2
-rw-r--r--intern/iksolver/intern/IK_QJacobianSolver.cpp4
-rw-r--r--intern/iksolver/intern/IK_QSegment.cpp2
-rw-r--r--intern/iksolver/intern/IK_QSegment.h6
-rw-r--r--intern/iksolver/intern/IK_Solver.cpp5
-rw-r--r--intern/libmv/.clang-format2
-rw-r--r--intern/locale/boost_locale_wrapper.cpp5
-rw-r--r--intern/mikktspace/mikktspace.c61
-rw-r--r--intern/mikktspace/mikktspace.h55
-rw-r--r--intern/opencolorio/CMakeLists.txt1
-rw-r--r--intern/opencolorio/ocio_impl.cc8
-rw-r--r--intern/opencolorio/ocio_impl_glsl.cc4
-rw-r--r--intern/opensubdiv/internal/opensubdiv_device_context_opencl.cc32
-rw-r--r--intern/rigidbody/RBI_api.h3
-rw-r--r--intern/rigidbody/rb_bullet_api.cpp46
-rw-r--r--intern/string/STR_String.h4
-rw-r--r--intern/string/intern/STR_String.cpp20
-rw-r--r--intern/utfconv/utf_winfunc.h4
-rw-r--r--intern/utfconv/utfconv.c26
-rw-r--r--intern/utfconv/utfconv.h10
182 files changed, 1594 insertions, 2917 deletions
diff --git a/intern/atomic/atomic_ops.h b/intern/atomic/atomic_ops.h
index 07b7ce38b94..106e19567da 100644
--- a/intern/atomic/atomic_ops.h
+++ b/intern/atomic/atomic_ops.h
@@ -113,8 +113,8 @@ ATOMIC_INLINE size_t atomic_sub_and_fetch_z(size_t *p, size_t x);
ATOMIC_INLINE size_t atomic_fetch_and_add_z(size_t *p, size_t x);
ATOMIC_INLINE size_t atomic_fetch_and_sub_z(size_t *p, size_t x);
ATOMIC_INLINE size_t atomic_cas_z(size_t *v, size_t old, size_t _new);
-ATOMIC_INLINE size_t
-atomic_fetch_and_update_max_z(size_t *p, size_t x); /* Uses CAS loop, see warning below. */
+/* Uses CAS loop, see warning below. */
+ATOMIC_INLINE size_t atomic_fetch_and_update_max_z(size_t *p, size_t x);
ATOMIC_INLINE unsigned int atomic_add_and_fetch_u(unsigned int *p, unsigned int x);
ATOMIC_INLINE unsigned int atomic_sub_and_fetch_u(unsigned int *p, unsigned int x);
@@ -126,15 +126,17 @@ ATOMIC_INLINE void *atomic_cas_ptr(void **v, void *old, void *_new);
ATOMIC_INLINE float atomic_cas_float(float *v, float old, float _new);
-/* WARNING! Float 'atomics' are really faked ones, those are actually closer to some kind of spinlock-sync'ed operation,
- * which means they are only efficient if collisions are highly unlikely (i.e. if probability of two threads
- * working on the same pointer at the same time is very low). */
+/* WARNING! Float 'atomics' are really faked ones, those are actually closer to some kind of
+ * spinlock-sync'ed operation, which means they are only efficient if collisions are highly
+ * unlikely (i.e. if probability of two threads working on the same pointer at the same time is
+ * very low). */
ATOMIC_INLINE float atomic_add_and_fetch_fl(float *p, const float x);
/******************************************************************************/
/* Include system-dependent implementations. */
-/* Note that we are using _unix flavor as fallback here (it will raise precompiler errors as needed). */
+/* Note that we are using _unix flavor as fallback here
+ * (it will raise precompiler errors as needed). */
#if defined(_MSC_VER)
# include "intern/atomic_ops_msvc.h"
#else
diff --git a/intern/atomic/intern/atomic_ops_utils.h b/intern/atomic/intern/atomic_ops_utils.h
index 4010051607c..b54e12eb49d 100644
--- a/intern/atomic/intern/atomic_ops_utils.h
+++ b/intern/atomic/intern/atomic_ops_utils.h
@@ -116,9 +116,9 @@
enum { ATOMIC_ASSERT_CONCAT(static_assert_, __COUNTER__) = 1 / (int)(!!(a)) };
# else /* older gcc, clang... */
/* This can't be used twice on the same line so ensure if using in headers
- * that the headers are not included twice (by wrapping in #ifndef...#endif)
- * Note it doesn't cause an issue when used on same line of separate modules
- * compiled with gcc -combine -fwhole-program. */
+ * that the headers are not included twice (by wrapping in #ifndef...#endif)
+ * Note it doesn't cause an issue when used on same line of separate modules
+ * compiled with gcc -combine -fwhole-program. */
# define ATOMIC_STATIC_ASSERT(a, msg) \
; \
enum { ATOMIC_ASSERT_CONCAT(assert_line_, __LINE__) = 1 / (int)(!!(a)) };
diff --git a/intern/audaspace/CMakeLists.txt b/intern/audaspace/CMakeLists.txt
index 7baaf301f6c..1972a5fc94c 100644
--- a/intern/audaspace/CMakeLists.txt
+++ b/intern/audaspace/CMakeLists.txt
@@ -45,6 +45,11 @@ if(NOT WITH_SYSTEM_AUDASPACE)
list(APPEND LIB
audaspace
)
+ if(WITH_SDL_DYNLOAD)
+ list(APPEND LIB
+ extern_sdlew
+ )
+ endif()
endif()
if(WITH_PYTHON)
diff --git a/intern/audaspace/intern/AUD_PyInit.cpp b/intern/audaspace/intern/AUD_PyInit.cpp
index b65d2740f32..843fe1e6cf1 100644
--- a/intern/audaspace/intern/AUD_PyInit.cpp
+++ b/intern/audaspace/intern/AUD_PyInit.cpp
@@ -34,11 +34,11 @@ extern void *BKE_sound_get_factory(void *sound);
static PyObject *AUD_getSoundFromPointer(PyObject *self, PyObject *args)
{
- long int lptr;
+ PyObject *lptr = NULL;
- if (PyArg_Parse(args, "l:_sound_from_pointer", &lptr)) {
+ if (PyArg_Parse(args, "O:_sound_from_pointer", &lptr)) {
if (lptr) {
- AUD_Sound *sound = BKE_sound_get_factory((void *)lptr);
+ AUD_Sound *sound = BKE_sound_get_factory(PyLong_AsVoidPtr(lptr));
if (sound) {
Sound *obj = (Sound *)Sound_empty();
diff --git a/intern/clog/clog.c b/intern/clog/clog.c
index ea6f215e8f0..da94acd97b1 100644
--- a/intern/clog/clog.c
+++ b/intern/clog/clog.c
@@ -356,7 +356,8 @@ static void clg_ctx_fatal_action(CLogContext *ctx)
static void clg_ctx_backtrace(CLogContext *ctx)
{
/* Note: we avoid writing fo 'FILE', for backtrace we make an exception,
- * if necessary we could have a version of the callback that writes to file descriptor all at once. */
+ * if necessary we could have a version of the callback that writes to file
+ * descriptor all at once. */
ctx->callbacks.backtrace_fn(ctx->output_file);
fflush(ctx->output_file);
}
diff --git a/intern/cycles/app/CMakeLists.txt b/intern/cycles/app/CMakeLists.txt
index 36e3e179be5..d67a72ab7db 100644
--- a/intern/cycles/app/CMakeLists.txt
+++ b/intern/cycles/app/CMakeLists.txt
@@ -22,7 +22,6 @@ set(LIBRARIES
${ZLIB_LIBRARIES}
${TIFF_LIBRARY}
${PTHREADS_LIBRARIES}
- extern_clew
)
if(WITH_CUDA_DYNLOAD)
diff --git a/intern/cycles/app/cycles_xml.cpp b/intern/cycles/app/cycles_xml.cpp
index 9caf7068d3d..1dbe8a30ff2 100644
--- a/intern/cycles/app/cycles_xml.cpp
+++ b/intern/cycles/app/cycles_xml.cpp
@@ -495,7 +495,7 @@ static void xml_read_mesh(const XMLReadState &state, xml_node node)
float3 *fdata = attr->data_float3();
#if 0
- if(subdivide_uvs) {
+ if (subdivide_uvs) {
attr->flags |= ATTR_SUBDIVIDED;
}
#endif
diff --git a/intern/cycles/app/io_export_cycles_xml.py b/intern/cycles/app/io_export_cycles_xml.py
index a1b42f72f7c..d2c6dc493e8 100644
--- a/intern/cycles/app/io_export_cycles_xml.py
+++ b/intern/cycles/app/io_export_cycles_xml.py
@@ -64,7 +64,7 @@ class RenderButtonsPanel():
bl_context = "render"
@classmethod
- def poll(self, context):
+ def poll(cls, context):
return context.engine == 'CYCLES'
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index ae07bcd38fe..6da88a769f5 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -1192,20 +1192,6 @@ class CyclesCurveRenderSettings(bpy.types.PropertyGroup):
min=3, max=64,
default=3,
)
- minimum_width: FloatProperty(
- name="Minimal width",
- description="Minimal pixel width for strands (0 - deactivated)",
- min=0.0, max=100.0,
- default=0.0,
- subtype='PIXEL'
- )
- maximum_width: FloatProperty(
- name="Maximal width",
- description="Maximum extension that strand radius can be increased by",
- min=0.0, max=100.0,
- default=0.1,
- subtype='PIXEL'
- )
subdivisions: IntProperty(
name="Subdivisions",
description="Number of subdivisions used in Cardinal curve intersection (power of 2)",
@@ -1504,7 +1490,9 @@ class CyclesPreferences(bpy.types.AddonPreferences):
break
if not found_device:
- box.label(text="No compatible GPUs found", icon='INFO')
+ col = box.column(align=True);
+ col.label(text="No compatible GPUs found for path tracing", icon='INFO')
+ col.label(text="Cycles will render on the CPU", icon='BLANK1')
return
for device in devices:
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index 4b0e179a388..0845f567056 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -185,7 +185,7 @@ class CYCLES_RENDER_PT_sampling_sub_samples(CyclesButtonsPanel, Panel):
bl_parent_id = "CYCLES_RENDER_PT_sampling"
@classmethod
- def poll(self, context):
+ def poll(cls, context):
scene = context.scene
cscene = scene.cycles
return cscene.progressive != 'PATH' and use_branched_path(context)
@@ -256,7 +256,7 @@ class CYCLES_RENDER_PT_sampling_total(CyclesButtonsPanel, Panel):
bl_parent_id = "CYCLES_RENDER_PT_sampling"
@classmethod
- def poll(self, context):
+ def poll(cls, context):
scene = context.scene
cscene = scene.cycles
@@ -312,7 +312,7 @@ class CYCLES_RENDER_PT_subdivision(CyclesButtonsPanel, Panel):
bl_options = {'DEFAULT_CLOSED'}
@classmethod
- def poll(self, context):
+ def poll(cls, context):
return (context.scene.render.engine == 'CYCLES') and (context.scene.cycles.feature_set == 'EXPERIMENTAL')
def draw(self, context):
@@ -358,8 +358,6 @@ class CYCLES_RENDER_PT_hair(CyclesButtonsPanel, Panel):
layout.active = ccscene.use_curves
col = layout.column()
- col.prop(ccscene, "minimum_width", text="Min Pixels")
- col.prop(ccscene, "maximum_width", text="Max Extension")
col.prop(ccscene, "shape", text="Shape")
if not (ccscene.primitive in {'CURVE_SEGMENTS', 'LINE_SEGMENTS'} and ccscene.shape == 'RIBBONS'):
col.prop(ccscene, "cull_backfacing", text="Cull back-faces")
@@ -747,7 +745,6 @@ class CYCLES_RENDER_PT_override(CyclesButtonsPanel, Panel):
class CYCLES_RENDER_PT_passes(CyclesButtonsPanel, Panel):
bl_label = "Passes"
bl_context = "view_layer"
- bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
pass
@@ -2133,13 +2130,13 @@ classes = (
CYCLES_RENDER_PT_performance_acceleration_structure,
CYCLES_RENDER_PT_performance_final_render,
CYCLES_RENDER_PT_performance_viewport,
- CYCLES_RENDER_PT_filter,
- CYCLES_RENDER_PT_override,
CYCLES_RENDER_PT_passes,
CYCLES_RENDER_PT_passes_data,
CYCLES_RENDER_PT_passes_light,
CYCLES_RENDER_PT_passes_crypto,
CYCLES_RENDER_PT_passes_debug,
+ CYCLES_RENDER_PT_filter,
+ CYCLES_RENDER_PT_override,
CYCLES_RENDER_PT_denoising,
CYCLES_PT_post_processing,
CYCLES_CAMERA_PT_dof,
diff --git a/intern/cycles/blender/addon/version_update.py b/intern/cycles/blender/addon/version_update.py
index 6f005727b95..899245db03e 100644
--- a/intern/cycles/blender/addon/version_update.py
+++ b/intern/cycles/blender/addon/version_update.py
@@ -22,140 +22,6 @@ import math
from bpy.app.handlers import persistent
-def foreach_cycles_nodetree_group(nodetree, traversed):
- for node in nodetree.nodes:
- if node.bl_idname == 'ShaderNodeGroup':
- group = node.node_tree
- if group and group not in traversed:
- traversed.add(group)
- yield group, group.library
- yield from foreach_cycles_nodetree_group(group, traversed)
-
-
-def foreach_cycles_nodetree():
- traversed = set()
-
- for material in bpy.data.materials:
- nodetree = material.node_tree
- if nodetree:
- yield nodetree, material.library
- yield from foreach_cycles_nodetree_group(nodetree, traversed)
-
- for world in bpy.data.worlds:
- nodetree = world.node_tree
- if nodetree:
- yield nodetree, world.library
- foreach_cycles_nodetree_group(nodetree, traversed)
-
- for light in bpy.data.lights:
- nodetree = light.node_tree
- if nodetree:
- yield nodetree, light.library
- foreach_cycles_nodetree_group(nodetree, traversed)
-
-
-def displacement_node_insert(nodetree):
- # Gather links to replace
- displacement_links = []
- for link in nodetree.links:
- if (
- link.to_node.bl_idname == 'ShaderNodeOutputMaterial' and
- link.from_node.bl_idname != 'ShaderNodeDisplacement' and
- link.to_socket.identifier == 'Displacement'
- ):
- displacement_links.append(link)
-
- # Replace links with displacement node
- for link in displacement_links:
- from_node = link.from_node
- from_socket = link.from_socket
- to_node = link.to_node
- to_socket = link.to_socket
-
- nodetree.links.remove(link)
-
- node = nodetree.nodes.new(type='ShaderNodeDisplacement')
- node.location[0] = 0.5 * (from_node.location[0] + to_node.location[0])
- node.location[1] = 0.5 * (from_node.location[1] + to_node.location[1])
- node.inputs['Scale'].default_value = 0.1
- node.inputs['Midlevel'].default_value = 0.0
-
- nodetree.links.new(from_socket, node.inputs['Height'])
- nodetree.links.new(node.outputs['Displacement'], to_socket)
-
-
-def displacement_principled_nodes(node):
- if node.bl_idname == 'ShaderNodeDisplacement':
- if node.space != 'WORLD':
- node.space = 'OBJECT'
- if node.bl_idname == 'ShaderNodeBsdfPrincipled':
- if node.subsurface_method != 'RANDOM_WALK':
- node.subsurface_method = 'BURLEY'
-
-
-def square_roughness_node_insert(nodetree):
- roughness_node_types = {
- 'ShaderNodeBsdfAnisotropic',
- 'ShaderNodeBsdfGlass',
- 'ShaderNodeBsdfGlossy',
- 'ShaderNodeBsdfRefraction'}
-
- # Update default values
- for node in nodetree.nodes:
- if node.bl_idname in roughness_node_types:
- roughness_input = node.inputs['Roughness']
- roughness_input.default_value = math.sqrt(max(roughness_input.default_value, 0.0))
-
- # Gather roughness links to replace
- roughness_links = []
- for link in nodetree.links:
- if link.to_node.bl_idname in roughness_node_types and \
- link.to_socket.identifier == 'Roughness':
- roughness_links.append(link)
-
- # Replace links with sqrt node
- for link in roughness_links:
- from_node = link.from_node
- from_socket = link.from_socket
- to_node = link.to_node
- to_socket = link.to_socket
-
- nodetree.links.remove(link)
-
- node = nodetree.nodes.new(type='ShaderNodeMath')
- node.operation = 'POWER'
- node.location[0] = 0.5 * (from_node.location[0] + to_node.location[0])
- node.location[1] = 0.5 * (from_node.location[1] + to_node.location[1])
-
- nodetree.links.new(from_socket, node.inputs[0])
- node.inputs[1].default_value = 0.5
- nodetree.links.new(node.outputs['Value'], to_socket)
-
-
-def mapping_node_order_flip(node):
- """
- Flip euler order of mapping shader node
- """
- if node.bl_idname == 'ShaderNodeMapping':
- rot = node.rotation.copy()
- rot.order = 'ZYX'
- quat = rot.to_quaternion()
- node.rotation = quat.to_euler('XYZ')
-
-
-def vector_curve_node_remap(node):
- """
- Remap values of vector curve node from normalized to absolute values
- """
- if node.bl_idname == 'ShaderNodeVectorCurve':
- node.mapping.use_clip = False
- for curve in node.mapping.curves:
- for point in curve.points:
- point.location.x = (point.location.x * 2.0) - 1.0
- point.location.y = (point.location.y - 0.5) * 2.0
- node.mapping.update()
-
-
def custom_bake_remap(scene):
"""
Remap bake types into the new types and set the flags accordingly
@@ -213,28 +79,6 @@ def custom_bake_remap(scene):
scene.render.bake.use_pass_indirect = False
-def ambient_occlusion_node_relink(nodetree):
- for node in nodetree.nodes:
- if node.bl_idname == 'ShaderNodeAmbientOcclusion':
- node.samples = 1
- node.only_local = False
- node.inputs['Distance'].default_value = 0.0
-
- # Gather links to replace
- ao_links = []
- for link in nodetree.links:
- if link.from_node.bl_idname == 'ShaderNodeAmbientOcclusion':
- ao_links.append(link)
-
- # Replace links
- for link in ao_links:
- from_node = link.from_node
- to_socket = link.to_socket
-
- nodetree.links.remove(link)
- nodetree.links.new(from_node.outputs['Color'], to_socket)
-
-
@persistent
def do_versions(self):
if bpy.context.preferences.version <= (2, 78, 1):
@@ -411,48 +255,3 @@ def do_versions(self):
cmat = mat.cycles
if not cmat.is_property_set("displacement_method"):
cmat.displacement_method = 'DISPLACEMENT'
-
- # Nodes
- for nodetree, library in foreach_cycles_nodetree():
- if library not in libraries:
- continue
-
- # Euler order was ZYX in previous versions.
- if version <= (2, 73, 4):
- for node in nodetree.nodes:
- mapping_node_order_flip(node)
-
- if version <= (2, 76, 5):
- for node in nodetree.nodes:
- vector_curve_node_remap(node)
-
- if version <= (2, 79, 1) or \
- (version >= (2, 80, 0) and version <= (2, 80, 3)):
- displacement_node_insert(nodetree)
-
- if version <= (2, 79, 2):
- for node in nodetree.nodes:
- displacement_principled_nodes(node)
-
- if version <= (2, 79, 3) or \
- (version >= (2, 80, 0) and version <= (2, 80, 4)):
- # Switch to squared roughness convention
- square_roughness_node_insert(nodetree)
-
- if version <= (2, 79, 4):
- ambient_occlusion_node_relink(nodetree)
-
- # Particles
- for part in bpy.data.particles:
- if part.library not in libraries:
- continue
-
- # Copy cycles hair settings to internal settings
- if version <= (2, 80, 15):
- cpart = part.get("cycles", None)
- if cpart:
- part.shape = cpart.get("shape", 0.0)
- part.root_radius = cpart.get("root_width", 1.0)
- part.tip_radius = cpart.get("tip_width", 0.0)
- part.radius_scale = cpart.get("radius_scale", 0.01)
- part.use_close_tip = cpart.get("use_closetip", True)
diff --git a/intern/cycles/blender/blender_curves.cpp b/intern/cycles/blender/blender_curves.cpp
index d0375ceb79c..1a36376f36e 100644
--- a/intern/cycles/blender/blender_curves.cpp
+++ b/intern/cycles/blender/blender_curves.cpp
@@ -766,7 +766,7 @@ static void ExportCurveSegmentsMotion(Mesh *mesh, ParticleCurveData *CData, int
}
}
else {
- /* Number of keys has changed. Genereate an interpolated version
+ /* Number of keys has changed. Generate an interpolated version
* to preserve motion blur. */
const float step_size = num_center_curve_keys > 1 ? 1.0f / (num_center_curve_keys - 1) :
0.0f;
@@ -897,8 +897,6 @@ void BlenderSync::sync_curve_settings()
CurveSystemManager prev_curve_system_manager = *curve_system_manager;
curve_system_manager->use_curves = get_boolean(csscene, "use_curves");
- curve_system_manager->minimum_width = get_float(csscene, "minimum_width");
- curve_system_manager->maximum_width = get_float(csscene, "maximum_width");
curve_system_manager->primitive = (CurvePrimitiveType)get_enum(
csscene, "primitive", CURVE_NUM_PRIMITIVE_TYPES, CURVE_LINE_SEGMENTS);
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp
index 095ecd59985..00f53804e38 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -307,8 +307,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
/* TODO: don't use lights for excluded layers used as mask layer,
* when dynamic overrides are back. */
#if 0
- if(!((layer_flag & view_layer.holdout_layer) &&
- (layer_flag & view_layer.exclude_layer)))
+ if (!((layer_flag & view_layer.holdout_layer) && (layer_flag & view_layer.exclude_layer)))
#endif
{
sync_light(b_parent,
@@ -345,7 +344,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
/* TODO: make holdout objects on excluded layer invisible for non-camera rays. */
#if 0
- if(use_holdout && (layer_flag & view_layer.exclude_layer)) {
+ if (use_holdout && (layer_flag & view_layer.exclude_layer)) {
visibility &= ~(PATH_RAY_ALL_VISIBILITY - PATH_RAY_CAMERA);
}
#endif
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp
index 29a97bf6546..3a7e5f02b1d 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -155,8 +155,8 @@ void BlenderSession::create_session()
/* There is no single depsgraph to use for the entire render.
* So we need to handle this differently.
*
- * We could loop over the final render result render layers in pipeline and keep Cycles unaware of multiple layers,
- * or perhaps move syncing further down in the pipeline.
+ * We could loop over the final render result render layers in pipeline and keep Cycles unaware
+ * of multiple layers, or perhaps move syncing further down in the pipeline.
*/
/* create sync */
sync = new BlenderSync(b_engine, b_data, b_scene, scene, !background, session->progress);
@@ -528,14 +528,15 @@ void BlenderSession::render(BL::Depsgraph &b_depsgraph_)
/* Attempt to free all data which is held by Blender side, since at this
* point we knwo that we've got everything to render current view layer.
*/
- /* At the moment we only free if we are not doing multi-view (or if we are rendering the last view).
- * See T58142/D4239 for discussion.
+ /* At the moment we only free if we are not doing multi-view
+ * (or if we are rendering the last view). See T58142/D4239 for discussion.
*/
if (view_index == num_views - 1) {
free_blender_memory_if_possible();
}
- /* Make sure all views have different noise patterns. - hardcoded value just to make it random */
+ /* Make sure all views have different noise patterns. - hardcoded value just to make it random
+ */
if (view_index != 0) {
scene->integrator->seed += hash_int_2d(scene->integrator->seed,
hash_int(view_index * 0xdeadbeef));
@@ -1057,8 +1058,9 @@ void BlenderSession::update_status_progress()
}
double current_time = time_dt();
- /* When rendering in a window, redraw the status at least once per second to keep the elapsed and remaining time up-to-date.
- * For headless rendering, only report when something significant changes to keep the console output readable. */
+ /* When rendering in a window, redraw the status at least once per second to keep the elapsed and
+ * remaining time up-to-date. For headless rendering, only report when something significant
+ * changes to keep the console output readable. */
if (status != last_status || (!headless && (current_time - last_status_time) > 1.0)) {
b_engine.update_stats("", (timestatus + scene_status + status).c_str());
b_engine.update_memory_stats(mem_used, mem_peak);
diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp
index 169c4d414a6..d1f823bc2b8 100644
--- a/intern/cycles/blender/blender_shader.cpp
+++ b/intern/cycles/blender/blender_shader.cpp
@@ -656,13 +656,12 @@ static ShaderNode *add_node(Scene *scene,
/* TODO: restore */
/* TODO(sergey): Does not work properly when we change builtin type. */
#if 0
- if(b_image.is_updated()) {
- scene->image_manager->tag_reload_image(
- image->filename.string(),
- image->builtin_data,
- get_image_interpolation(b_image_node),
- get_image_extension(b_image_node),
- image->use_alpha);
+ if (b_image.is_updated()) {
+ scene->image_manager->tag_reload_image(image->filename.string(),
+ image->builtin_data,
+ get_image_interpolation(b_image_node),
+ get_image_extension(b_image_node),
+ image->use_alpha);
}
#endif
}
@@ -702,13 +701,12 @@ static ShaderNode *add_node(Scene *scene,
/* TODO: restore */
/* TODO(sergey): Does not work properly when we change builtin type. */
#if 0
- if(b_image.is_updated()) {
- scene->image_manager->tag_reload_image(
- env->filename.string(),
- env->builtin_data,
- get_image_interpolation(b_env_node),
- EXTENSION_REPEAT,
- env->use_alpha);
+ if (b_image.is_updated()) {
+ scene->image_manager->tag_reload_image(env->filename.string(),
+ env->builtin_data,
+ get_image_interpolation(b_env_node),
+ EXTENSION_REPEAT,
+ env->use_alpha);
}
#endif
}
@@ -910,7 +908,7 @@ static ShaderNode *add_node(Scene *scene,
static bool node_use_modified_socket_name(ShaderNode *node)
{
- if (node->special_type == SHADER_SPECIAL_TYPE_SCRIPT)
+ if (node->special_type == SHADER_SPECIAL_TYPE_OSL)
return false;
return true;
diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp
index 0ab6d88487e..8d93d517d4e 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -583,7 +583,7 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay, BL::ViewLa
}
/* Cryptomatte stores two ID/weight pairs per RGBA layer.
- * User facing paramter is the number of pairs. */
+ * User facing parameter is the number of pairs. */
int crypto_depth = min(16, get_int(crp, "pass_crypto_depth")) / 2;
scene->film->cryptomatte_depth = crypto_depth;
scene->film->cryptomatte_passes = CRYPT_NONE;
diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h
index e68f92474bf..500634e7526 100644
--- a/intern/cycles/blender/blender_util.h
+++ b/intern/cycles/blender/blender_util.h
@@ -54,8 +54,8 @@ static inline BL::Mesh object_to_mesh(BL::BlendData &data,
bool subsurf_mod_show_render = false;
bool subsurf_mod_show_viewport = false;
- if(subdivision_type != Mesh::SUBDIVISION_NONE) {
- BL::Modifier subsurf_mod = object.modifiers[object.modifiers.length()-1];
+ if (subdivision_type != Mesh::SUBDIVISION_NONE) {
+ BL::Modifier subsurf_mod = object.modifiers[object.modifiers.length() - 1];
subsurf_mod_show_render = subsurf_mod.show_render();
subsurf_mod_show_viewport = subsurf_mod.show_viewport();
@@ -83,8 +83,8 @@ static inline BL::Mesh object_to_mesh(BL::BlendData &data,
}
#if 0
- if(subdivision_type != Mesh::SUBDIVISION_NONE) {
- BL::Modifier subsurf_mod = object.modifiers[object.modifiers.length()-1];
+ if (subdivision_type != Mesh::SUBDIVISION_NONE) {
+ BL::Modifier subsurf_mod = object.modifiers[object.modifiers.length() - 1];
subsurf_mod.show_render(subsurf_mod_show_render);
subsurf_mod.show_viewport(subsurf_mod_show_viewport);
diff --git a/intern/cycles/bvh/bvh8.cpp b/intern/cycles/bvh/bvh8.cpp
index e812d806b94..10fd01dd8d0 100644
--- a/intern/cycles/bvh/bvh8.cpp
+++ b/intern/cycles/bvh/bvh8.cpp
@@ -1,30 +1,30 @@
/*
-* Original code Copyright 2017, Intel Corporation
-* Modifications Copyright 2018, Blender Foundation.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-*
-* * Redistributions of source code must retain the above copyright notice,
-* this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of Intel Corporation nor the names of its contributors
-* may be used to endorse or promote products derived from this software
-* without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
+ * Original code Copyright 2017, Intel Corporation
+ * Modifications Copyright 2018, Blender Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Intel Corporation nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
#include "bvh/bvh8.h"
diff --git a/intern/cycles/bvh/bvh8.h b/intern/cycles/bvh/bvh8.h
index fc07eadcada..6292353c7d4 100644
--- a/intern/cycles/bvh/bvh8.h
+++ b/intern/cycles/bvh/bvh8.h
@@ -1,30 +1,30 @@
/*
-* Original code Copyright 2017, Intel Corporation
-* Modifications Copyright 2018, Blender Foundation.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-*
-* * Redistributions of source code must retain the above copyright notice,
-* this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of Intel Corporation nor the names of its contributors
-* may be used to endorse or promote products derived from this software
-* without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
+ * Original code Copyright 2017, Intel Corporation
+ * Modifications Copyright 2018, Blender Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Intel Corporation nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
#ifndef __BVH8_H__
#define __BVH8_H__
@@ -50,9 +50,9 @@ class Progress;
#define BVH_UNALIGNED_ONODE_SIZE 28
/* BVH8
-*
-* Octo BVH, with each node having eight children, to use with SIMD instructions.
-*/
+ *
+ * Octo BVH, with each node having eight children, to use with SIMD instructions.
+ */
class BVH8 : public BVH {
protected:
/* constructor */
diff --git a/intern/cycles/bvh/bvh_embree.cpp b/intern/cycles/bvh/bvh_embree.cpp
index 5ef9622aba2..088ec759331 100644
--- a/intern/cycles/bvh/bvh_embree.cpp
+++ b/intern/cycles/bvh/bvh_embree.cpp
@@ -18,18 +18,19 @@
* It supports triangles, curves, object and deformation blur and instancing.
* Not supported are thick line segments, those have no native equivalent in Embree.
* They could be implemented using Embree's thick curves, at the expense of wasted memory.
- * User defined intersections for Embree could also be an option, but since Embree only uses aligned BVHs
- * for user geometry, this would come with reduced performance and/or higher memory usage.
+ * User defined intersections for Embree could also be an option, but since Embree only uses
+ * aligned BVHs for user geometry, this would come with reduced performance and/or higher memory
+ * usage.
*
- * Since Embree allows object to be either curves or triangles but not both, Cycles object IDs are maapped
- * to Embree IDs by multiplying by two and adding one for curves.
+ * Since Embree allows object to be either curves or triangles but not both, Cycles object IDs are
+ * maapped to Embree IDs by multiplying by two and adding one for curves.
*
- * This implementation shares RTCDevices between Cycles instances. Eventually each instance should get
- * a separate RTCDevice to correctly keep track of memory usage.
+ * This implementation shares RTCDevices between Cycles instances. Eventually each instance should
+ * get a separate RTCDevice to correctly keep track of memory usage.
*
- * Vertex and index buffers are duplicated between Cycles device arrays and Embree. These could be merged,
- * which would requrie changes to intersection refinement, shader setup, mesh light sampling and a few
- * other places in Cycles where direct access to vertex data is required.
+ * Vertex and index buffers are duplicated between Cycles device arrays and Embree. These could be
+ * merged, which would requrie changes to intersection refinement, shader setup, mesh light
+ * sampling and a few other places in Cycles where direct access to vertex data is required.
*/
#ifdef WITH_EMBREE
@@ -40,7 +41,8 @@
# include "bvh/bvh_embree.h"
-/* Kernel includes are necessary so that the filter function for Embree can access the packed BVH. */
+/* Kernel includes are necessary so that the filter function for Embree can access the packed BVH.
+ */
# include "kernel/bvh/bvh_embree.h"
# include "kernel/kernel_compat_cpu.h"
# include "kernel/split/kernel_split_data_types.h"
diff --git a/intern/cycles/device/CMakeLists.txt b/intern/cycles/device/CMakeLists.txt
index 75f4a72bee3..3e14480e2ad 100644
--- a/intern/cycles/device/CMakeLists.txt
+++ b/intern/cycles/device/CMakeLists.txt
@@ -77,6 +77,9 @@ if(WITH_CYCLES_NETWORK)
add_definitions(-DWITH_NETWORK)
endif()
if(WITH_CYCLES_DEVICE_OPENCL)
+ list(APPEND LIB
+ extern_clew
+ )
add_definitions(-DWITH_OPENCL)
endif()
if(WITH_CYCLES_DEVICE_CUDA)
diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp
index 16a68e8b855..47d111802cd 100644
--- a/intern/cycles/device/device.cpp
+++ b/intern/cycles/device/device.cpp
@@ -287,7 +287,8 @@ void Device::draw_pixels(device_memory &rgba,
}
glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer);
- /* invalidate old contents - avoids stalling if buffer is still waiting in queue to be rendered */
+ /* invalidate old contents - avoids stalling if buffer is still waiting in queue to be rendered
+ */
glBufferData(GL_ARRAY_BUFFER, 16 * sizeof(float), NULL, GL_STREAM_DRAW);
float *vpointer = (float *)glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp
index 68bc3bd4045..cac1edb188e 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -653,7 +653,7 @@ class CUDADevice : public Device {
/* For testing mapped host memory, fill up device memory. */
const size_t keep_mb = 1024;
- while(free_after > keep_mb * 1024 * 1024LL) {
+ while (free_after > keep_mb * 1024 * 1024LL) {
CUdeviceptr tmp;
cuda_assert(cuMemAlloc(&tmp, 10 * 1024 * 1024LL));
cuMemGetInfo(&free_after, &total);
@@ -1019,7 +1019,7 @@ class CUDADevice : public Device {
size_t bytes;
cuda_assert(cuModuleGetGlobal(&mem, &bytes, cuModule, name));
- //assert(bytes == size);
+ // assert(bytes == size);
cuda_assert(cuMemcpyHtoD(mem, host, size));
}
@@ -2127,7 +2127,8 @@ class CUDADevice : public Device {
}
glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer);
- /* invalidate old contents - avoids stalling if buffer is still waiting in queue to be rendered */
+ /* invalidate old contents -
+ * avoids stalling if buffer is still waiting in queue to be rendered */
glBufferData(GL_ARRAY_BUFFER, 16 * sizeof(float), NULL, GL_STREAM_DRAW);
vpointer = (float *)glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
diff --git a/intern/cycles/device/device_denoising.cpp b/intern/cycles/device/device_denoising.cpp
index 05a7fb8ae4d..55548c98b97 100644
--- a/intern/cycles/device/device_denoising.cpp
+++ b/intern/cycles/device/device_denoising.cpp
@@ -104,7 +104,8 @@ void DenoisingTask::set_render_buffer(RenderTile *rtiles)
void DenoisingTask::setup_denoising_buffer()
{
- /* Expand filter_area by radius pixels and clamp the result to the extent of the neighboring tiles */
+ /* Expand filter_area by radius pixels and clamp the result to the extent of the neighboring
+ * tiles */
rect = rect_from_shape(filter_area.x, filter_area.y, filter_area.z, filter_area.w);
rect = rect_expand(rect, radius);
rect = rect_clip(rect,
@@ -149,16 +150,19 @@ void DenoisingTask::prefilter_shadowing()
device_sub_ptr buffer_var(buffer.mem, 5 * buffer.pass_stride, buffer.pass_stride);
device_sub_ptr filtered_var(buffer.mem, 6 * buffer.pass_stride, buffer.pass_stride);
- /* Get the A/B unfiltered passes, the combined sample variance, the estimated variance of the sample variance and the buffer variance. */
+ /* Get the A/B unfiltered passes, the combined sample variance, the estimated variance of the
+ * sample variance and the buffer variance. */
functions.divide_shadow(*unfiltered_a, *unfiltered_b, *sample_var, *sample_var_var, *buffer_var);
- /* Smooth the (generally pretty noisy) buffer variance using the spatial information from the sample variance. */
+ /* Smooth the (generally pretty noisy) buffer variance using the spatial information from the
+ * sample variance. */
nlm_state.set_parameters(6, 3, 4.0f, 1.0f, false);
functions.non_local_means(*buffer_var, *sample_var, *sample_var_var, *filtered_var);
/* Reuse memory, the previous data isn't needed anymore. */
device_ptr filtered_a = *buffer_var, filtered_b = *sample_var;
- /* Use the smoothed variance to filter the two shadow half images using each other for weight calculation. */
+ /* Use the smoothed variance to filter the two shadow half images using each other for weight
+ * calculation. */
nlm_state.set_parameters(5, 3, 1.0f, 0.25f, false);
functions.non_local_means(*unfiltered_a, *unfiltered_b, *filtered_var, filtered_a);
functions.non_local_means(*unfiltered_b, *unfiltered_a, *filtered_var, filtered_b);
diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp
index 99a8d2438d6..b07596c60ff 100644
--- a/intern/cycles/device/device_opencl.cpp
+++ b/intern/cycles/device/device_opencl.cpp
@@ -136,8 +136,8 @@ string device_opencl_capabilities()
}
string result = "";
string error_msg = ""; /* Only used by opencl_assert(), but in the future
- * it could also be nicely reported to the console.
- */
+ * it could also be nicely reported to the console.
+ */
cl_uint num_platforms = 0;
opencl_assert(device_opencl_get_num_platforms_safe(&num_platforms));
if (num_platforms == 0) {
diff --git a/intern/cycles/device/device_split_kernel.h b/intern/cycles/device/device_split_kernel.h
index c9fb2ac844f..6ff326bf214 100644
--- a/intern/cycles/device/device_split_kernel.h
+++ b/intern/cycles/device/device_split_kernel.h
@@ -27,7 +27,7 @@ CCL_NAMESPACE_BEGIN
* Since some bytes may be needed for aligning chunks of memory;
* This is the amount of memory that we dedicate for that purpose.
*/
-#define DATA_ALLOCATION_MEM_FACTOR 5000000 //5MB
+#define DATA_ALLOCATION_MEM_FACTOR 5000000 // 5MB
/* Types used for split kernel */
diff --git a/intern/cycles/device/device_task.h b/intern/cycles/device/device_task.h
index 5cc2e5e25db..a04062ed4ef 100644
--- a/intern/cycles/device/device_task.h
+++ b/intern/cycles/device/device_task.h
@@ -40,7 +40,8 @@ class DenoiseParams {
float strength;
/* Preserve more or less detail based on feature passes. */
float feature_strength;
- /* When removing pixels that don't carry information, use a relative threshold instead of an absolute one. */
+ /* When removing pixels that don't carry information,
+ * use a relative threshold instead of an absolute one. */
bool relative_pca;
/* How many frames before and after the current center frame are included. */
int neighbor_frames;
diff --git a/intern/cycles/device/opencl/opencl.h b/intern/cycles/device/opencl/opencl.h
index e7bafa0b8a8..70773902790 100644
--- a/intern/cycles/device/opencl/opencl.h
+++ b/intern/cycles/device/opencl/opencl.h
@@ -358,8 +358,8 @@ class OpenCLDevice : public Device {
OpenCLSplitPrograms(OpenCLDevice *device);
~OpenCLSplitPrograms();
- /* Load the kernels and put the created kernels in the given `programs`
- * paramter. */
+ /* Load the kernels and put the created kernels in the given
+ * `programs` paramter. */
void load_kernels(vector<OpenCLProgram *> &programs,
const DeviceRequestedFeatures &requested_features,
bool is_preview = false);
diff --git a/intern/cycles/device/opencl/opencl_split.cpp b/intern/cycles/device/opencl/opencl_split.cpp
index 70b1a643044..442b92100bb 100644
--- a/intern/cycles/device/opencl/opencl_split.cpp
+++ b/intern/cycles/device/opencl/opencl_split.cpp
@@ -265,7 +265,7 @@ void OpenCLDevice::OpenCLSplitPrograms::load_kernels(
ADD_SPLIT_KERNEL_PROGRAM(shader_eval);
/* Quick kernels bundled in a single program to reduce overhead of starting
- * Blender processes. */
+ * Blender processes. */
program_split = OpenCLDevice::OpenCLProgram(
device,
"split_bundle",
@@ -668,7 +668,8 @@ OpenCLDevice::OpenCLDevice(DeviceInfo &info, Stats &stats, Profiler &profiler, b
return;
}
- /* Allocate this right away so that texture_info is placed at offset 0 in the device memory buffers */
+ /* Allocate this right away so that texture_info
+ * is placed at offset 0 in the device memory buffers. */
texture_info.resize(1);
memory_manager.alloc("texture_info", texture_info);
@@ -1149,7 +1150,8 @@ void OpenCLDevice::tex_alloc(device_memory &mem)
<< string_human_readable_size(mem.memory_size()) << ")";
memory_manager.alloc(mem.name, mem);
- /* Set the pointer to non-null to keep code that inspects its value from thinking its unallocated. */
+ /* Set the pointer to non-null to keep code that inspects its value from thinking its
+ * unallocated. */
mem.device_pointer = 1;
textures[mem.name] = &mem;
textures_need_update = true;
diff --git a/intern/cycles/kernel/bvh/bvh.h b/intern/cycles/kernel/bvh/bvh.h
index 13e72ed299f..7503bad37b0 100644
--- a/intern/cycles/kernel/bvh/bvh.h
+++ b/intern/cycles/kernel/bvh/bvh.h
@@ -57,7 +57,7 @@ CCL_NAMESPACE_BEGIN
#if defined(__HAIR__)
# define BVH_FUNCTION_NAME bvh_intersect_hair
-# define BVH_FUNCTION_FEATURES BVH_INSTANCING | BVH_HAIR | BVH_HAIR_MINIMUM_WIDTH
+# define BVH_FUNCTION_FEATURES BVH_INSTANCING | BVH_HAIR
# include "kernel/bvh/bvh_traversal.h"
#endif
@@ -69,7 +69,7 @@ CCL_NAMESPACE_BEGIN
#if defined(__HAIR__) && defined(__OBJECT_MOTION__)
# define BVH_FUNCTION_NAME bvh_intersect_hair_motion
-# define BVH_FUNCTION_FEATURES BVH_INSTANCING | BVH_HAIR | BVH_HAIR_MINIMUM_WIDTH | BVH_MOTION
+# define BVH_FUNCTION_FEATURES BVH_INSTANCING | BVH_HAIR | BVH_MOTION
# include "kernel/bvh/bvh_traversal.h"
#endif
@@ -181,10 +181,7 @@ ccl_device_inline bool scene_intersect_valid(const Ray *ray)
ccl_device_intersect bool scene_intersect(KernelGlobals *kg,
const Ray ray,
const uint visibility,
- Intersection *isect,
- uint *lcg_state,
- float difl,
- float extmax)
+ Intersection *isect)
{
PROFILING_INIT(kg, PROFILING_INTERSECT);
@@ -211,7 +208,7 @@ ccl_device_intersect bool scene_intersect(KernelGlobals *kg,
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);
+ return bvh_intersect_hair_motion(kg, &ray, isect, visibility);
# endif /* __HAIR__ */
return bvh_intersect_motion(kg, &ray, isect, visibility);
@@ -220,7 +217,7 @@ ccl_device_intersect bool scene_intersect(KernelGlobals *kg,
#ifdef __HAIR__
if (kernel_data.bvh.have_curves)
- return bvh_intersect_hair(kg, &ray, isect, visibility, lcg_state, difl, extmax);
+ return bvh_intersect_hair(kg, &ray, isect, visibility);
#endif /* __HAIR__ */
#ifdef __KERNEL_CPU__
diff --git a/intern/cycles/kernel/bvh/bvh_nodes.h b/intern/cycles/kernel/bvh/bvh_nodes.h
index 042630121c8..a33bc73e25b 100644
--- a/intern/cycles/kernel/bvh/bvh_nodes.h
+++ b/intern/cycles/kernel/bvh/bvh_nodes.h
@@ -75,67 +75,6 @@ ccl_device_forceinline int bvh_aligned_node_intersect(KernelGlobals *kg,
# endif
}
-ccl_device_forceinline int bvh_aligned_node_intersect_robust(KernelGlobals *kg,
- const float3 P,
- const float3 idir,
- const float t,
- const float difl,
- const float extmax,
- const int node_addr,
- const uint visibility,
- float dist[2])
-{
-
- /* fetch node data */
- float4 cnodes = kernel_tex_fetch(__bvh_nodes, node_addr + 0);
- float4 node0 = kernel_tex_fetch(__bvh_nodes, node_addr + 1);
- float4 node1 = kernel_tex_fetch(__bvh_nodes, node_addr + 2);
- float4 node2 = kernel_tex_fetch(__bvh_nodes, node_addr + 3);
-
- /* intersect ray against child nodes */
- float c0lox = (node0.x - P.x) * idir.x;
- float c0hix = (node0.z - P.x) * idir.x;
- float c0loy = (node1.x - P.y) * idir.y;
- float c0hiy = (node1.z - P.y) * idir.y;
- float c0loz = (node2.x - P.z) * idir.z;
- float c0hiz = (node2.z - P.z) * idir.z;
- float c0min = max4(0.0f, min(c0lox, c0hix), min(c0loy, c0hiy), min(c0loz, c0hiz));
- float c0max = min4(t, max(c0lox, c0hix), max(c0loy, c0hiy), max(c0loz, c0hiz));
-
- float c1lox = (node0.y - P.x) * idir.x;
- float c1hix = (node0.w - P.x) * idir.x;
- float c1loy = (node1.y - P.y) * idir.y;
- float c1hiy = (node1.w - P.y) * idir.y;
- float c1loz = (node2.y - P.z) * idir.z;
- float c1hiz = (node2.w - P.z) * idir.z;
- float c1min = max4(0.0f, min(c1lox, c1hix), min(c1loy, c1hiy), min(c1loz, c1hiz));
- float c1max = min4(t, max(c1lox, c1hix), max(c1loy, c1hiy), max(c1loz, c1hiz));
-
- if (difl != 0.0f) {
- float hdiff = 1.0f + difl;
- float ldiff = 1.0f - difl;
- if (__float_as_int(cnodes.z) & PATH_RAY_CURVE) {
- c0min = max(ldiff * c0min, c0min - extmax);
- c0max = min(hdiff * c0max, c0max + extmax);
- }
- if (__float_as_int(cnodes.w) & PATH_RAY_CURVE) {
- c1min = max(ldiff * c1min, c1min - extmax);
- c1max = min(hdiff * c1max, c1max + extmax);
- }
- }
-
- dist[0] = c0min;
- dist[1] = c1min;
-
-# ifdef __VISIBILITY_FLAG__
- /* this visibility test gives a 5% performance hit, how to solve? */
- return (((c0max >= c0min) && (__float_as_uint(cnodes.x) & visibility)) ? 1 : 0) |
- (((c1max >= c1min) && (__float_as_uint(cnodes.y) & visibility)) ? 2 : 0);
-# else
- return ((c0max >= c0min) ? 1 : 0) | ((c1max >= c1min) ? 2 : 0);
-# endif
-}
-
ccl_device_forceinline bool bvh_unaligned_node_intersect_child(KernelGlobals *kg,
const float3 P,
const float3 dir,
@@ -162,41 +101,6 @@ ccl_device_forceinline bool bvh_unaligned_node_intersect_child(KernelGlobals *kg
return tnear <= tfar;
}
-ccl_device_forceinline bool bvh_unaligned_node_intersect_child_robust(KernelGlobals *kg,
- const float3 P,
- const float3 dir,
- const float t,
- const float difl,
- int node_addr,
- int child,
- float dist[2])
-{
- Transform space = bvh_unaligned_node_fetch_space(kg, node_addr, child);
- float3 aligned_dir = transform_direction(&space, dir);
- float3 aligned_P = transform_point(&space, P);
- float3 nrdir = -bvh_inverse_direction(aligned_dir);
- float3 tLowerXYZ = aligned_P * nrdir;
- float3 tUpperXYZ = tLowerXYZ - nrdir;
- const float near_x = min(tLowerXYZ.x, tUpperXYZ.x);
- const float near_y = min(tLowerXYZ.y, tUpperXYZ.y);
- const float near_z = min(tLowerXYZ.z, tUpperXYZ.z);
- const float far_x = max(tLowerXYZ.x, tUpperXYZ.x);
- const float far_y = max(tLowerXYZ.y, tUpperXYZ.y);
- const float far_z = max(tLowerXYZ.z, tUpperXYZ.z);
- const float tnear = max4(0.0f, near_x, near_y, near_z);
- const float tfar = min4(t, far_x, far_y, far_z);
- *dist = tnear;
- if (difl != 0.0f) {
- /* TODO(sergey): Same as for QBVH, needs a proper use. */
- const float round_down = 1.0f - difl;
- const float round_up = 1.0f + difl;
- return round_down * tnear <= round_up * tfar;
- }
- else {
- return tnear <= tfar;
- }
-}
-
ccl_device_forceinline int bvh_unaligned_node_intersect(KernelGlobals *kg,
const float3 P,
const float3 dir,
@@ -227,38 +131,6 @@ ccl_device_forceinline int bvh_unaligned_node_intersect(KernelGlobals *kg,
return mask;
}
-ccl_device_forceinline int bvh_unaligned_node_intersect_robust(KernelGlobals *kg,
- const float3 P,
- const float3 dir,
- const float3 idir,
- const float t,
- const float difl,
- const float extmax,
- const int node_addr,
- const uint visibility,
- float dist[2])
-{
- int mask = 0;
- float4 cnodes = kernel_tex_fetch(__bvh_nodes, node_addr + 0);
- if (bvh_unaligned_node_intersect_child_robust(kg, P, dir, t, difl, node_addr, 0, &dist[0])) {
-# ifdef __VISIBILITY_FLAG__
- if ((__float_as_uint(cnodes.x) & visibility))
-# endif
- {
- mask |= 1;
- }
- }
- if (bvh_unaligned_node_intersect_child_robust(kg, P, dir, t, difl, node_addr, 1, &dist[1])) {
-# ifdef __VISIBILITY_FLAG__
- if ((__float_as_uint(cnodes.y) & visibility))
-# endif
- {
- mask |= 2;
- }
- }
- return mask;
-}
-
ccl_device_forceinline int bvh_node_intersect(KernelGlobals *kg,
const float3 P,
const float3 dir,
@@ -277,27 +149,6 @@ ccl_device_forceinline int bvh_node_intersect(KernelGlobals *kg,
}
}
-ccl_device_forceinline int bvh_node_intersect_robust(KernelGlobals *kg,
- const float3 P,
- const float3 dir,
- const float3 idir,
- const float t,
- const float difl,
- const float extmax,
- const int node_addr,
- const uint visibility,
- float dist[2])
-{
- float4 node = kernel_tex_fetch(__bvh_nodes, node_addr);
- if (__float_as_uint(node.x) & PATH_RAY_NODE_UNALIGNED) {
- return bvh_unaligned_node_intersect_robust(
- kg, P, dir, idir, t, difl, extmax, node_addr, visibility, dist);
- }
- else {
- return bvh_aligned_node_intersect_robust(
- kg, P, idir, t, difl, extmax, node_addr, visibility, dist);
- }
-}
#else /* !defined(__KERNEL_SSE2__) */
int ccl_device_forceinline bvh_aligned_node_intersect(KernelGlobals *kg,
@@ -343,69 +194,6 @@ int ccl_device_forceinline bvh_aligned_node_intersect(KernelGlobals *kg,
# endif
}
-ccl_device_forceinline int bvh_aligned_node_intersect_robust(KernelGlobals *kg,
- const float3 &P,
- const float3 &dir,
- const ssef &tsplat,
- const ssef Psplat[3],
- const ssef idirsplat[3],
- const shuffle_swap_t shufflexyz[3],
- const float difl,
- const float extmax,
- const int nodeAddr,
- const uint visibility,
- float dist[2])
-{
- /* Intersect two child bounding boxes, SSE3 version adapted from Embree */
- const ssef pn = cast(ssei(0, 0, 0x80000000, 0x80000000));
-
- /* fetch node data */
- const ssef *bvh_nodes = (ssef *)kg->__bvh_nodes.data + nodeAddr;
-
- /* intersect ray against child nodes */
- const ssef tminmaxx = (shuffle_swap(bvh_nodes[1], shufflexyz[0]) - Psplat[0]) * idirsplat[0];
- const ssef tminmaxy = (shuffle_swap(bvh_nodes[2], shufflexyz[1]) - Psplat[1]) * idirsplat[1];
- const ssef tminmaxz = (shuffle_swap(bvh_nodes[3], shufflexyz[2]) - Psplat[2]) * idirsplat[2];
-
- /* calculate { c0min, c1min, -c0max, -c1max} */
- ssef minmax = max(max(tminmaxx, tminmaxy), max(tminmaxz, tsplat));
- const ssef tminmax = minmax ^ pn;
-
- if (difl != 0.0f) {
- float4 cnodes = kernel_tex_fetch(__bvh_nodes, nodeAddr + 0);
- float4 *tminmaxview = (float4 *)&tminmax;
- float &c0min = tminmaxview->x, &c1min = tminmaxview->y;
- float &c0max = tminmaxview->z, &c1max = tminmaxview->w;
- float hdiff = 1.0f + difl;
- float ldiff = 1.0f - difl;
- if (__float_as_int(cnodes.x) & PATH_RAY_CURVE) {
- c0min = max(ldiff * c0min, c0min - extmax);
- c0max = min(hdiff * c0max, c0max + extmax);
- }
- if (__float_as_int(cnodes.y) & PATH_RAY_CURVE) {
- c1min = max(ldiff * c1min, c1min - extmax);
- c1max = min(hdiff * c1max, c1max + extmax);
- }
- }
-
- const sseb lrhit = tminmax <= shuffle<2, 3, 0, 1>(tminmax);
-
- dist[0] = tminmax[0];
- dist[1] = tminmax[1];
-
- int mask = movemask(lrhit);
-
-# ifdef __VISIBILITY_FLAG__
- /* this visibility test gives a 5% performance hit, how to solve? */
- float4 cnodes = kernel_tex_fetch(__bvh_nodes, nodeAddr + 0);
- int cmask = (((mask & 1) && (__float_as_uint(cnodes.x) & visibility)) ? 1 : 0) |
- (((mask & 2) && (__float_as_uint(cnodes.y) & visibility)) ? 2 : 0);
- return cmask;
-# else
- return mask & 3;
-# endif
-}
-
ccl_device_forceinline int bvh_unaligned_node_intersect(KernelGlobals *kg,
const float3 P,
const float3 dir,
@@ -458,68 +246,6 @@ ccl_device_forceinline int bvh_unaligned_node_intersect(KernelGlobals *kg,
# endif
}
-ccl_device_forceinline int bvh_unaligned_node_intersect_robust(KernelGlobals *kg,
- const float3 P,
- const float3 dir,
- const ssef &isect_near,
- const ssef &isect_far,
- const float difl,
- const int node_addr,
- const uint visibility,
- float dist[2])
-{
- Transform space0 = bvh_unaligned_node_fetch_space(kg, node_addr, 0);
- Transform space1 = bvh_unaligned_node_fetch_space(kg, node_addr, 1);
-
- float3 aligned_dir0 = transform_direction(&space0, dir),
- aligned_dir1 = transform_direction(&space1, dir);
- float3 aligned_P0 = transform_point(&space0, P), aligned_P1 = transform_point(&space1, P);
- float3 nrdir0 = -bvh_inverse_direction(aligned_dir0),
- nrdir1 = -bvh_inverse_direction(aligned_dir1);
-
- ssef lower_x = ssef(aligned_P0.x * nrdir0.x, aligned_P1.x * nrdir1.x, 0.0f, 0.0f),
- lower_y = ssef(aligned_P0.y * nrdir0.y, aligned_P1.y * nrdir1.y, 0.0f, 0.0f),
- lower_z = ssef(aligned_P0.z * nrdir0.z, aligned_P1.z * nrdir1.z, 0.0f, 0.0f);
-
- ssef upper_x = lower_x - ssef(nrdir0.x, nrdir1.x, 0.0f, 0.0f),
- upper_y = lower_y - ssef(nrdir0.y, nrdir1.y, 0.0f, 0.0f),
- upper_z = lower_z - ssef(nrdir0.z, nrdir1.z, 0.0f, 0.0f);
-
- ssef tnear_x = min(lower_x, upper_x);
- ssef tnear_y = min(lower_y, upper_y);
- ssef tnear_z = min(lower_z, upper_z);
- ssef tfar_x = max(lower_x, upper_x);
- ssef tfar_y = max(lower_y, upper_y);
- ssef tfar_z = max(lower_z, upper_z);
-
- const ssef tnear = max4(isect_near, tnear_x, tnear_y, tnear_z);
- const ssef tfar = min4(isect_far, tfar_x, tfar_y, tfar_z);
- sseb vmask;
- if (difl != 0.0f) {
- const float round_down = 1.0f - difl;
- const float round_up = 1.0f + difl;
- vmask = round_down * tnear <= round_up * tfar;
- }
- else {
- vmask = tnear <= tfar;
- }
-
- dist[0] = tnear.f[0];
- dist[1] = tnear.f[1];
-
- int mask = (int)movemask(vmask);
-
-# ifdef __VISIBILITY_FLAG__
- /* this visibility test gives a 5% performance hit, how to solve? */
- float4 cnodes = kernel_tex_fetch(__bvh_nodes, node_addr + 0);
- int cmask = (((mask & 1) && (__float_as_uint(cnodes.x) & visibility)) ? 1 : 0) |
- (((mask & 2) && (__float_as_uint(cnodes.y) & visibility)) ? 2 : 0);
- return cmask;
-# else
- return mask & 3;
-# endif
-}
-
ccl_device_forceinline int bvh_node_intersect(KernelGlobals *kg,
const float3 &P,
const float3 &dir,
@@ -543,40 +269,4 @@ ccl_device_forceinline int bvh_node_intersect(KernelGlobals *kg,
kg, P, dir, tsplat, Psplat, idirsplat, shufflexyz, node_addr, visibility, dist);
}
}
-
-ccl_device_forceinline int bvh_node_intersect_robust(KernelGlobals *kg,
- const float3 &P,
- const float3 &dir,
- const ssef &isect_near,
- const ssef &isect_far,
- const ssef &tsplat,
- const ssef Psplat[3],
- const ssef idirsplat[3],
- const shuffle_swap_t shufflexyz[3],
- const float difl,
- const float extmax,
- const int node_addr,
- const uint visibility,
- float dist[2])
-{
- float4 node = kernel_tex_fetch(__bvh_nodes, node_addr);
- if (__float_as_uint(node.x) & PATH_RAY_NODE_UNALIGNED) {
- return bvh_unaligned_node_intersect_robust(
- kg, P, dir, isect_near, isect_far, difl, node_addr, visibility, dist);
- }
- else {
- return bvh_aligned_node_intersect_robust(kg,
- P,
- dir,
- tsplat,
- Psplat,
- idirsplat,
- shufflexyz,
- difl,
- extmax,
- node_addr,
- visibility,
- dist);
- }
-}
#endif /* !defined(__KERNEL_SSE2__) */
diff --git a/intern/cycles/kernel/bvh/bvh_shadow_all.h b/intern/cycles/kernel/bvh/bvh_shadow_all.h
index b362779549c..268bb149970 100644
--- a/intern/cycles/kernel/bvh/bvh_shadow_all.h
+++ b/intern/cycles/kernel/bvh/bvh_shadow_all.h
@@ -219,10 +219,7 @@ ccl_device_inline
object,
prim_addr,
ray->time,
- curve_type,
- NULL,
- 0,
- 0);
+ curve_type);
}
else {
hit = curve_intersect(kg,
@@ -233,10 +230,7 @@ ccl_device_inline
object,
prim_addr,
ray->time,
- curve_type,
- NULL,
- 0,
- 0);
+ curve_type);
}
break;
}
diff --git a/intern/cycles/kernel/bvh/bvh_traversal.h b/intern/cycles/kernel/bvh/bvh_traversal.h
index 34a06d003bb..18afc6ae4eb 100644
--- a/intern/cycles/kernel/bvh/bvh_traversal.h
+++ b/intern/cycles/kernel/bvh/bvh_traversal.h
@@ -26,10 +26,8 @@
#if BVH_FEATURE(BVH_HAIR)
# define NODE_INTERSECT bvh_node_intersect
-# define NODE_INTERSECT_ROBUST bvh_node_intersect_robust
#else
# define NODE_INTERSECT bvh_aligned_node_intersect
-# define NODE_INTERSECT_ROBUST bvh_aligned_node_intersect_robust
#endif
/* This is a template BVH traversal function, where various features can be
@@ -38,21 +36,13 @@
*
* BVH_INSTANCING: object instancing
* BVH_HAIR: hair curve rendering
- * BVH_HAIR_MINIMUM_WIDTH: hair curve rendering with minimum width
* BVH_MOTION: motion blur rendering
*/
ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
const Ray *ray,
Intersection *isect,
- const uint visibility
-#if BVH_FEATURE(BVH_HAIR_MINIMUM_WIDTH)
- ,
- uint *lcg_state,
- float difl,
- float extmax
-#endif
-)
+ const uint visibility)
{
/* todo:
* - test if pushing distance on the stack helps (for non shadow rays)
@@ -117,23 +107,6 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
float4 cnodes = kernel_tex_fetch(__bvh_nodes, node_addr + 0);
#if !defined(__KERNEL_SSE2__)
-# if BVH_FEATURE(BVH_HAIR_MINIMUM_WIDTH)
- if (difl != 0.0f) {
- traverse_mask = NODE_INTERSECT_ROBUST(kg,
- P,
-# if BVH_FEATURE(BVH_HAIR)
- dir,
-# endif
- idir,
- isect->t,
- difl,
- extmax,
- node_addr,
- visibility,
- dist);
- }
- else
-# endif
{
traverse_mask = NODE_INTERSECT(kg,
P,
@@ -147,27 +120,6 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
dist);
}
#else // __KERNEL_SSE2__
-# if BVH_FEATURE(BVH_HAIR_MINIMUM_WIDTH)
- if (difl != 0.0f) {
- traverse_mask = NODE_INTERSECT_ROBUST(kg,
- P,
- dir,
-# if BVH_FEATURE(BVH_HAIR)
- tnear,
- tfar,
-# endif
- tsplat,
- Psplat,
- idirsplat,
- shufflexyz,
- difl,
- extmax,
- node_addr,
- visibility,
- dist);
- }
- else
-# endif
{
traverse_mask = NODE_INTERSECT(kg,
P,
@@ -287,32 +239,12 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
kernel_assert((curve_type & PRIMITIVE_ALL) == (type & PRIMITIVE_ALL));
bool hit;
if (kernel_data.curve.curveflags & CURVE_KN_INTERPOLATE) {
- hit = cardinal_curve_intersect(kg,
- isect,
- P,
- dir,
- visibility,
- object,
- prim_addr,
- ray->time,
- curve_type,
- lcg_state,
- difl,
- extmax);
+ hit = cardinal_curve_intersect(
+ kg, isect, P, dir, visibility, object, prim_addr, ray->time, curve_type);
}
else {
- hit = curve_intersect(kg,
- isect,
- P,
- dir,
- visibility,
- object,
- prim_addr,
- ray->time,
- curve_type,
- lcg_state,
- difl,
- extmax);
+ hit = curve_intersect(
+ kg, isect, P, dir, visibility, object, prim_addr, ray->time, curve_type);
}
if (hit) {
/* shadow ray early termination */
@@ -408,56 +340,19 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
ccl_device_inline bool BVH_FUNCTION_NAME(KernelGlobals *kg,
const Ray *ray,
Intersection *isect,
- const uint visibility
-#if BVH_FEATURE(BVH_HAIR_MINIMUM_WIDTH)
- ,
- uint *lcg_state,
- float difl,
- float extmax
-#endif
-)
+ const uint visibility)
{
switch (kernel_data.bvh.bvh_layout) {
#ifdef __KERNEL_AVX2__
case BVH_LAYOUT_BVH8:
- return BVH_FUNCTION_FULL_NAME(OBVH)(kg,
- ray,
- isect,
- visibility
-# if BVH_FEATURE(BVH_HAIR_MINIMUM_WIDTH)
- ,
- lcg_state,
- difl,
- extmax
-# endif
- );
+ return BVH_FUNCTION_FULL_NAME(OBVH)(kg, ray, isect, visibility);
#endif
#ifdef __QBVH__
case BVH_LAYOUT_BVH4:
- return BVH_FUNCTION_FULL_NAME(QBVH)(kg,
- ray,
- isect,
- visibility
-# if BVH_FEATURE(BVH_HAIR_MINIMUM_WIDTH)
- ,
- lcg_state,
- difl,
- extmax
-# endif
- );
+ return BVH_FUNCTION_FULL_NAME(QBVH)(kg, ray, isect, visibility);
#endif /* __QBVH__ */
case BVH_LAYOUT_BVH2:
- return BVH_FUNCTION_FULL_NAME(BVH)(kg,
- ray,
- isect,
- visibility
-#if BVH_FEATURE(BVH_HAIR_MINIMUM_WIDTH)
- ,
- lcg_state,
- difl,
- extmax
-#endif
- );
+ return BVH_FUNCTION_FULL_NAME(BVH)(kg, ray, isect, visibility);
}
kernel_assert(!"Should not happen");
return false;
@@ -466,4 +361,3 @@ ccl_device_inline bool BVH_FUNCTION_NAME(KernelGlobals *kg,
#undef BVH_FUNCTION_NAME
#undef BVH_FUNCTION_FEATURES
#undef NODE_INTERSECT
-#undef NODE_INTERSECT_ROBUST
diff --git a/intern/cycles/kernel/bvh/bvh_types.h b/intern/cycles/kernel/bvh/bvh_types.h
index 16f3b03f842..84dc0dbaef5 100644
--- a/intern/cycles/kernel/bvh/bvh_types.h
+++ b/intern/cycles/kernel/bvh/bvh_types.h
@@ -38,7 +38,6 @@ CCL_NAMESPACE_BEGIN
#define BVH_INSTANCING 1
#define BVH_MOTION 2
#define BVH_HAIR 4
-#define BVH_HAIR_MINIMUM_WIDTH 8
#define BVH_NAME_JOIN(x, y) x##_##y
#define BVH_NAME_EVAL(x, y) BVH_NAME_JOIN(x, y)
diff --git a/intern/cycles/kernel/bvh/obvh_nodes.h b/intern/cycles/kernel/bvh/obvh_nodes.h
index 6831562cade..e5c935b75ed 100644
--- a/intern/cycles/kernel/bvh/obvh_nodes.h
+++ b/intern/cycles/kernel/bvh/obvh_nodes.h
@@ -276,53 +276,6 @@ ccl_device_inline int obvh_aligned_node_intersect(KernelGlobals *ccl_restrict kg
#endif
}
-ccl_device_inline int obvh_aligned_node_intersect_robust(KernelGlobals *ccl_restrict kg,
- const avxf &isect_near,
- const avxf &isect_far,
-#ifdef __KERNEL_AVX2__
- const avx3f &P_idir,
-#else
- const avx3f &P,
-#endif
- const avx3f &idir,
- const int near_x,
- const int near_y,
- const int near_z,
- const int far_x,
- const int far_y,
- const int far_z,
- const int node_addr,
- const float difl,
- avxf *ccl_restrict dist)
-{
- const int offset = node_addr + 2;
-#ifdef __KERNEL_AVX2__
- const avxf tnear_x = msub(
- kernel_tex_fetch_avxf(__bvh_nodes, offset + near_x * 2), idir.x, P_idir.x);
- const avxf tfar_x = msub(
- kernel_tex_fetch_avxf(__bvh_nodes, offset + far_x * 2), idir.x, P_idir.x);
- const avxf tnear_y = msub(
- kernel_tex_fetch_avxf(__bvh_nodes, offset + near_y * 2), idir.y, P_idir.y);
- const avxf tfar_y = msub(
- kernel_tex_fetch_avxf(__bvh_nodes, offset + far_y * 2), idir.y, P_idir.y);
- const avxf tnear_z = msub(
- kernel_tex_fetch_avxf(__bvh_nodes, offset + near_z * 2), idir.z, P_idir.z);
- const avxf tfar_z = msub(
- kernel_tex_fetch_avxf(__bvh_nodes, offset + far_z * 2), idir.z, P_idir.z);
-
- const float round_down = 1.0f - difl;
- const float round_up = 1.0f + difl;
- const avxf tnear = max4(tnear_x, tnear_y, tnear_z, isect_near);
- const avxf tfar = min4(tfar_x, tfar_y, tfar_z, isect_far);
- const avxb vmask = round_down * tnear <= round_up * tfar;
- int mask = (int)movemask(vmask);
- *dist = tnear;
- return mask;
-#else
- return 0;
-#endif
-}
-
/* Unaligned nodes intersection */
ccl_device_inline int obvh_unaligned_node_intersect(KernelGlobals *ccl_restrict kg,
@@ -391,77 +344,6 @@ ccl_device_inline int obvh_unaligned_node_intersect(KernelGlobals *ccl_restrict
return movemask(vmask);
}
-ccl_device_inline int obvh_unaligned_node_intersect_robust(KernelGlobals *ccl_restrict kg,
- const avxf &isect_near,
- const avxf &isect_far,
-#ifdef __KERNEL_AVX2__
- const avx3f &P_idir,
-#endif
- const avx3f &P,
- const avx3f &dir,
- const avx3f &idir,
- const int near_x,
- const int near_y,
- const int near_z,
- const int far_x,
- const int far_y,
- const int far_z,
- const int node_addr,
- const float difl,
- avxf *ccl_restrict dist)
-{
- const int offset = node_addr;
- const avxf tfm_x_x = kernel_tex_fetch_avxf(__bvh_nodes, offset + 2);
- const avxf tfm_x_y = kernel_tex_fetch_avxf(__bvh_nodes, offset + 4);
- const avxf tfm_x_z = kernel_tex_fetch_avxf(__bvh_nodes, offset + 6);
-
- const avxf tfm_y_x = kernel_tex_fetch_avxf(__bvh_nodes, offset + 8);
- const avxf tfm_y_y = kernel_tex_fetch_avxf(__bvh_nodes, offset + 10);
- const avxf tfm_y_z = kernel_tex_fetch_avxf(__bvh_nodes, offset + 12);
-
- const avxf tfm_z_x = kernel_tex_fetch_avxf(__bvh_nodes, offset + 14);
- const avxf tfm_z_y = kernel_tex_fetch_avxf(__bvh_nodes, offset + 16);
- const avxf tfm_z_z = kernel_tex_fetch_avxf(__bvh_nodes, offset + 18);
-
- const avxf tfm_t_x = kernel_tex_fetch_avxf(__bvh_nodes, offset + 20);
- const avxf tfm_t_y = kernel_tex_fetch_avxf(__bvh_nodes, offset + 22);
- const avxf tfm_t_z = kernel_tex_fetch_avxf(__bvh_nodes, offset + 24);
-
- const avxf aligned_dir_x = dir.x * tfm_x_x + dir.y * tfm_x_y + dir.z * tfm_x_z,
- aligned_dir_y = dir.x * tfm_y_x + dir.y * tfm_y_y + dir.z * tfm_y_z,
- aligned_dir_z = dir.x * tfm_z_x + dir.y * tfm_z_y + dir.z * tfm_z_z;
-
- const avxf aligned_P_x = P.x * tfm_x_x + P.y * tfm_x_y + P.z * tfm_x_z + tfm_t_x,
- aligned_P_y = P.x * tfm_y_x + P.y * tfm_y_y + P.z * tfm_y_z + tfm_t_y,
- aligned_P_z = P.x * tfm_z_x + P.y * tfm_z_y + P.z * tfm_z_z + tfm_t_z;
-
- const avxf neg_one(-1.0f);
- const avxf nrdir_x = neg_one / aligned_dir_x, nrdir_y = neg_one / aligned_dir_y,
- nrdir_z = neg_one / aligned_dir_z;
-
- const avxf tlower_x = aligned_P_x * nrdir_x, tlower_y = aligned_P_y * nrdir_y,
- tlower_z = aligned_P_z * nrdir_z;
-
- const avxf tupper_x = tlower_x - nrdir_x, tupper_y = tlower_y - nrdir_y,
- tupper_z = tlower_z - nrdir_z;
-
- const float round_down = 1.0f - difl;
- const float round_up = 1.0f + difl;
-
- const avxf tnear_x = min(tlower_x, tupper_x);
- const avxf tnear_y = min(tlower_y, tupper_y);
- const avxf tnear_z = min(tlower_z, tupper_z);
- const avxf tfar_x = max(tlower_x, tupper_x);
- const avxf tfar_y = max(tlower_y, tupper_y);
- const avxf tfar_z = max(tlower_z, tupper_z);
-
- const avxf tnear = max4(isect_near, tnear_x, tnear_y, tnear_z);
- const avxf tfar = min4(isect_far, tfar_x, tfar_y, tfar_z);
- const avxb vmask = round_down * tnear <= round_up * tfar;
- *dist = tnear;
- return movemask(vmask);
-}
-
/* Intersectors wrappers.
*
* They'll check node type and call appropriate intersection code.
@@ -526,66 +408,3 @@ ccl_device_inline int obvh_node_intersect(KernelGlobals *ccl_restrict kg,
dist);
}
}
-
-ccl_device_inline int obvh_node_intersect_robust(KernelGlobals *ccl_restrict kg,
- const avxf &isect_near,
- const avxf &isect_far,
-#ifdef __KERNEL_AVX2__
- const avx3f &P_idir,
-#endif
- const avx3f &P,
- const avx3f &dir,
- const avx3f &idir,
- const int near_x,
- const int near_y,
- const int near_z,
- const int far_x,
- const int far_y,
- const int far_z,
- const int node_addr,
- const float difl,
- avxf *ccl_restrict dist)
-{
- const int offset = node_addr;
- const float4 node = kernel_tex_fetch(__bvh_nodes, offset);
- if (__float_as_uint(node.x) & PATH_RAY_NODE_UNALIGNED) {
- return obvh_unaligned_node_intersect_robust(kg,
- isect_near,
- isect_far,
-#ifdef __KERNEL_AVX2__
- P_idir,
-#endif
- P,
- dir,
- idir,
- near_x,
- near_y,
- near_z,
- far_x,
- far_y,
- far_z,
- node_addr,
- difl,
- dist);
- }
- else {
- return obvh_aligned_node_intersect_robust(kg,
- isect_near,
- isect_far,
-#ifdef __KERNEL_AVX2__
- P_idir,
-#else
- P,
-#endif
- idir,
- near_x,
- near_y,
- near_z,
- far_x,
- far_y,
- far_z,
- node_addr,
- difl,
- dist);
- }
-}
diff --git a/intern/cycles/kernel/bvh/obvh_shadow_all.h b/intern/cycles/kernel/bvh/obvh_shadow_all.h
index 98efb003788..b7ab75b723c 100644
--- a/intern/cycles/kernel/bvh/obvh_shadow_all.h
+++ b/intern/cycles/kernel/bvh/obvh_shadow_all.h
@@ -431,7 +431,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(OBVH)(KernelGlobals *kg,
}
prim_addr++;
- } //while
+ } // while
}
else {
kernel_assert((kernel_tex_fetch(__prim_type, (prim_addr)) & PRIMITIVE_ALL) ==
@@ -503,10 +503,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(OBVH)(KernelGlobals *kg,
object,
prim_addr,
ray->time,
- curve_type,
- NULL,
- 0,
- 0);
+ curve_type);
}
else {
hit = curve_intersect(kg,
@@ -517,10 +514,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(OBVH)(KernelGlobals *kg,
object,
prim_addr,
ray->time,
- curve_type,
- NULL,
- 0,
- 0);
+ curve_type);
}
break;
}
@@ -574,7 +568,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(OBVH)(KernelGlobals *kg,
}
prim_addr++;
- } //while prim
+ } // while prim
}
}
#if BVH_FEATURE(BVH_INSTANCING)
diff --git a/intern/cycles/kernel/bvh/obvh_traversal.h b/intern/cycles/kernel/bvh/obvh_traversal.h
index 86b1de48aaa..9095233f8b6 100644
--- a/intern/cycles/kernel/bvh/obvh_traversal.h
+++ b/intern/cycles/kernel/bvh/obvh_traversal.h
@@ -20,29 +20,19 @@
*
* BVH_INSTANCING: object instancing
* BVH_HAIR: hair curve rendering
- * BVH_HAIR_MINIMUM_WIDTH: hair curve rendering with minimum width
* BVH_MOTION: motion blur rendering
*/
#if BVH_FEATURE(BVH_HAIR)
# define NODE_INTERSECT obvh_node_intersect
-# define NODE_INTERSECT_ROBUST obvh_node_intersect_robust
#else
# define NODE_INTERSECT obvh_aligned_node_intersect
-# define NODE_INTERSECT_ROBUST obvh_aligned_node_intersect_robust
#endif
ccl_device bool BVH_FUNCTION_FULL_NAME(OBVH)(KernelGlobals *kg,
const Ray *ray,
Intersection *isect,
- const uint visibility
-#if BVH_FEATURE(BVH_HAIR_MINIMUM_WIDTH)
- ,
- uint *lcg_state,
- float difl,
- float extmax
-#endif
-)
+ const uint visibility)
{
/* Traversal stack in CUDA thread-local memory. */
OBVHStackItem traversal_stack[BVH_OSTACK_SIZE];
@@ -117,38 +107,6 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(OBVH)(KernelGlobals *kg,
BVH_DEBUG_NEXT_NODE();
-#if BVH_FEATURE(BVH_HAIR_MINIMUM_WIDTH)
- if (difl != 0.0f) {
- /* NOTE: We extend all the child BB instead of fetching
- * and checking visibility flags for each of the,
- *
- * Need to test if doing opposite would be any faster.
- */
- child_mask = NODE_INTERSECT_ROBUST(kg,
- tnear,
- tfar,
-# ifdef __KERNEL_AVX2__
- P_idir4,
-# endif
-# if BVH_FEATURE(BVH_HAIR) || !defined(__KERNEL_AVX2__)
- org4,
-# endif
-# if BVH_FEATURE(BVH_HAIR)
- dir4,
-# endif
- idir4,
- near_x,
- near_y,
- near_z,
- far_x,
- far_y,
- far_z,
- node_addr,
- difl,
- &dist);
- }
- else
-#endif /* BVH_HAIR_MINIMUM_WIDTH */
{
child_mask = NODE_INTERSECT(kg,
tnear,
@@ -375,8 +333,8 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(OBVH)(KernelGlobals *kg,
}
/* Eight children are hit, push all onto stack and sort 8
- * stack items, continue with closest child.
- */
+ * stack items, continue with closest child.
+ */
r = __bscf(child_mask);
int c7 = __float_as_int(cnodes[r]);
float d7 = ((float *)&dist)[r];
@@ -451,7 +409,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(OBVH)(KernelGlobals *kg,
return true;
}
}
- } //for
+ } // for
}
else {
kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type);
@@ -472,7 +430,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(OBVH)(KernelGlobals *kg,
return true;
}
}
- } //prim count
+ } // prim count
break;
}
#if BVH_FEATURE(BVH_MOTION)
@@ -501,32 +459,12 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(OBVH)(KernelGlobals *kg,
kernel_assert((curve_type & PRIMITIVE_ALL) == (type & PRIMITIVE_ALL));
bool hit;
if (kernel_data.curve.curveflags & CURVE_KN_INTERPOLATE) {
- hit = cardinal_curve_intersect(kg,
- isect,
- P,
- dir,
- visibility,
- object,
- prim_addr,
- ray->time,
- curve_type,
- lcg_state,
- difl,
- extmax);
+ hit = cardinal_curve_intersect(
+ kg, isect, P, dir, visibility, object, prim_addr, ray->time, curve_type);
}
else {
- hit = curve_intersect(kg,
- isect,
- P,
- dir,
- visibility,
- object,
- prim_addr,
- ray->time,
- curve_type,
- lcg_state,
- difl,
- extmax);
+ hit = curve_intersect(
+ kg, isect, P, dir, visibility, object, prim_addr, ray->time, curve_type);
}
if (hit) {
tfar = avxf(isect->t);
@@ -617,4 +555,3 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(OBVH)(KernelGlobals *kg,
}
#undef NODE_INTERSECT
-#undef NODE_INTERSECT_ROBUST
diff --git a/intern/cycles/kernel/bvh/qbvh_nodes.h b/intern/cycles/kernel/bvh/qbvh_nodes.h
index 7c1d8c8c72e..070406fb18a 100644
--- a/intern/cycles/kernel/bvh/qbvh_nodes.h
+++ b/intern/cycles/kernel/bvh/qbvh_nodes.h
@@ -127,7 +127,7 @@ ccl_device_inline void qbvh_stack_sort(QBVHStackItem *ccl_restrict s1,
/* Axis-aligned nodes intersection */
-//ccl_device_inline int qbvh_aligned_node_intersect(KernelGlobals *ccl_restrict kg,
+// ccl_device_inline int qbvh_aligned_node_intersect(KernelGlobals *ccl_restrict kg,
static int qbvh_aligned_node_intersect(KernelGlobals *ccl_restrict kg,
const ssef &isect_near,
const ssef &isect_far,
@@ -181,51 +181,6 @@ static int qbvh_aligned_node_intersect(KernelGlobals *ccl_restrict kg,
return mask;
}
-ccl_device_inline int qbvh_aligned_node_intersect_robust(KernelGlobals *ccl_restrict kg,
- const ssef &isect_near,
- const ssef &isect_far,
-#ifdef __KERNEL_AVX2__
- const sse3f &P_idir,
-#else
- const sse3f &P,
-#endif
- const sse3f &idir,
- const int near_x,
- const int near_y,
- const int near_z,
- const int far_x,
- const int far_y,
- const int far_z,
- const int node_addr,
- const float difl,
- ssef *ccl_restrict dist)
-{
- const int offset = node_addr + 1;
-#ifdef __KERNEL_AVX2__
- const ssef tnear_x = msub(kernel_tex_fetch_ssef(__bvh_nodes, offset + near_x), idir.x, P_idir.x);
- const ssef tnear_y = msub(kernel_tex_fetch_ssef(__bvh_nodes, offset + near_y), idir.y, P_idir.y);
- const ssef tnear_z = msub(kernel_tex_fetch_ssef(__bvh_nodes, offset + near_z), idir.z, P_idir.z);
- const ssef tfar_x = msub(kernel_tex_fetch_ssef(__bvh_nodes, offset + far_x), idir.x, P_idir.x);
- const ssef tfar_y = msub(kernel_tex_fetch_ssef(__bvh_nodes, offset + far_y), idir.y, P_idir.y);
- const ssef tfar_z = msub(kernel_tex_fetch_ssef(__bvh_nodes, offset + far_z), idir.z, P_idir.z);
-#else
- const ssef tnear_x = (kernel_tex_fetch_ssef(__bvh_nodes, offset + near_x) - P.x) * idir.x;
- const ssef tnear_y = (kernel_tex_fetch_ssef(__bvh_nodes, offset + near_y) - P.y) * idir.y;
- const ssef tnear_z = (kernel_tex_fetch_ssef(__bvh_nodes, offset + near_z) - P.z) * idir.z;
- const ssef tfar_x = (kernel_tex_fetch_ssef(__bvh_nodes, offset + far_x) - P.x) * idir.x;
- const ssef tfar_y = (kernel_tex_fetch_ssef(__bvh_nodes, offset + far_y) - P.y) * idir.y;
- const ssef tfar_z = (kernel_tex_fetch_ssef(__bvh_nodes, offset + far_z) - P.z) * idir.z;
-#endif
-
- const float round_down = 1.0f - difl;
- const float round_up = 1.0f + difl;
- const ssef tnear = max4(isect_near, tnear_x, tnear_y, tnear_z);
- const ssef tfar = min4(isect_far, tfar_x, tfar_y, tfar_z);
- const sseb vmask = round_down * tnear <= round_up * tfar;
- *dist = tnear;
- return (int)movemask(vmask);
-}
-
/* Unaligned nodes intersection */
ccl_device_inline int qbvh_unaligned_node_intersect(KernelGlobals *ccl_restrict kg,
@@ -308,85 +263,6 @@ ccl_device_inline int qbvh_unaligned_node_intersect(KernelGlobals *ccl_restrict
#endif
}
-ccl_device_inline int qbvh_unaligned_node_intersect_robust(KernelGlobals *ccl_restrict kg,
- const ssef &isect_near,
- const ssef &isect_far,
-#ifdef __KERNEL_AVX2__
- const sse3f &P_idir,
-#endif
- const sse3f &P,
- const sse3f &dir,
- const sse3f &idir,
- const int near_x,
- const int near_y,
- const int near_z,
- const int far_x,
- const int far_y,
- const int far_z,
- const int node_addr,
- const float difl,
- ssef *ccl_restrict dist)
-{
- const int offset = node_addr;
- const ssef tfm_x_x = kernel_tex_fetch_ssef(__bvh_nodes, offset + 1);
- const ssef tfm_x_y = kernel_tex_fetch_ssef(__bvh_nodes, offset + 2);
- const ssef tfm_x_z = kernel_tex_fetch_ssef(__bvh_nodes, offset + 3);
-
- const ssef tfm_y_x = kernel_tex_fetch_ssef(__bvh_nodes, offset + 4);
- const ssef tfm_y_y = kernel_tex_fetch_ssef(__bvh_nodes, offset + 5);
- const ssef tfm_y_z = kernel_tex_fetch_ssef(__bvh_nodes, offset + 6);
-
- const ssef tfm_z_x = kernel_tex_fetch_ssef(__bvh_nodes, offset + 7);
- const ssef tfm_z_y = kernel_tex_fetch_ssef(__bvh_nodes, offset + 8);
- const ssef tfm_z_z = kernel_tex_fetch_ssef(__bvh_nodes, offset + 9);
-
- const ssef tfm_t_x = kernel_tex_fetch_ssef(__bvh_nodes, offset + 10);
- const ssef tfm_t_y = kernel_tex_fetch_ssef(__bvh_nodes, offset + 11);
- const ssef tfm_t_z = kernel_tex_fetch_ssef(__bvh_nodes, offset + 12);
-
- const ssef aligned_dir_x = dir.x * tfm_x_x + dir.y * tfm_x_y + dir.z * tfm_x_z,
- aligned_dir_y = dir.x * tfm_y_x + dir.y * tfm_y_y + dir.z * tfm_y_z,
- aligned_dir_z = dir.x * tfm_z_x + dir.y * tfm_z_y + dir.z * tfm_z_z;
-
- const ssef aligned_P_x = P.x * tfm_x_x + P.y * tfm_x_y + P.z * tfm_x_z + tfm_t_x,
- aligned_P_y = P.x * tfm_y_x + P.y * tfm_y_y + P.z * tfm_y_z + tfm_t_y,
- aligned_P_z = P.x * tfm_z_x + P.y * tfm_z_y + P.z * tfm_z_z + tfm_t_z;
-
- const ssef neg_one(-1.0f, -1.0f, -1.0f, -1.0f);
- const ssef nrdir_x = neg_one / aligned_dir_x, nrdir_y = neg_one / aligned_dir_y,
- nrdir_z = neg_one / aligned_dir_z;
-
- const ssef tlower_x = aligned_P_x * nrdir_x, tlower_y = aligned_P_y * nrdir_y,
- tlower_z = aligned_P_z * nrdir_z;
-
- const ssef tupper_x = tlower_x - nrdir_x, tupper_y = tlower_y - nrdir_y,
- tupper_z = tlower_z - nrdir_z;
-
- const float round_down = 1.0f - difl;
- const float round_up = 1.0f + difl;
-
-#ifdef __KERNEL_SSE41__
- const ssef tnear_x = mini(tlower_x, tupper_x);
- const ssef tnear_y = mini(tlower_y, tupper_y);
- const ssef tnear_z = mini(tlower_z, tupper_z);
- const ssef tfar_x = maxi(tlower_x, tupper_x);
- const ssef tfar_y = maxi(tlower_y, tupper_y);
- const ssef tfar_z = maxi(tlower_z, tupper_z);
-#else
- const ssef tnear_x = min(tlower_x, tupper_x);
- const ssef tnear_y = min(tlower_y, tupper_y);
- const ssef tnear_z = min(tlower_z, tupper_z);
- const ssef tfar_x = max(tlower_x, tupper_x);
- const ssef tfar_y = max(tlower_y, tupper_y);
- const ssef tfar_z = max(tlower_z, tupper_z);
-#endif
- const ssef tnear = max4(isect_near, tnear_x, tnear_y, tnear_z);
- const ssef tfar = min4(isect_far, tfar_x, tfar_y, tfar_z);
- const sseb vmask = round_down * tnear <= round_up * tfar;
- *dist = tnear;
- return movemask(vmask);
-}
-
/* Intersectors wrappers.
*
* They'll check node type and call appropriate intersection code.
@@ -451,66 +327,3 @@ ccl_device_inline int qbvh_node_intersect(KernelGlobals *ccl_restrict kg,
dist);
}
}
-
-ccl_device_inline int qbvh_node_intersect_robust(KernelGlobals *ccl_restrict kg,
- const ssef &isect_near,
- const ssef &isect_far,
-#ifdef __KERNEL_AVX2__
- const sse3f &P_idir,
-#endif
- const sse3f &P,
- const sse3f &dir,
- const sse3f &idir,
- const int near_x,
- const int near_y,
- const int near_z,
- const int far_x,
- const int far_y,
- const int far_z,
- const int node_addr,
- const float difl,
- ssef *ccl_restrict dist)
-{
- const int offset = node_addr;
- const float4 node = kernel_tex_fetch(__bvh_nodes, offset);
- if (__float_as_uint(node.x) & PATH_RAY_NODE_UNALIGNED) {
- return qbvh_unaligned_node_intersect_robust(kg,
- isect_near,
- isect_far,
-#ifdef __KERNEL_AVX2__
- P_idir,
-#endif
- P,
- dir,
- idir,
- near_x,
- near_y,
- near_z,
- far_x,
- far_y,
- far_z,
- node_addr,
- difl,
- dist);
- }
- else {
- return qbvh_aligned_node_intersect_robust(kg,
- isect_near,
- isect_far,
-#ifdef __KERNEL_AVX2__
- P_idir,
-#else
- P,
-#endif
- idir,
- near_x,
- near_y,
- near_z,
- far_x,
- far_y,
- far_z,
- node_addr,
- difl,
- dist);
- }
-}
diff --git a/intern/cycles/kernel/bvh/qbvh_shadow_all.h b/intern/cycles/kernel/bvh/qbvh_shadow_all.h
index 49e607bfbd0..682251bf25b 100644
--- a/intern/cycles/kernel/bvh/qbvh_shadow_all.h
+++ b/intern/cycles/kernel/bvh/qbvh_shadow_all.h
@@ -37,7 +37,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
uint *num_hits)
{
/* TODO(sergey):
- * - Test if pushing distance on the stack helps.
+ * - Test if pushing distance on the stack helps.
* - Likely and unlikely for if() statements.
* - Test restrict attribute for pointers.
*/
@@ -293,10 +293,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
object,
prim_addr,
ray->time,
- curve_type,
- NULL,
- 0,
- 0);
+ curve_type);
}
else {
hit = curve_intersect(kg,
@@ -307,10 +304,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
object,
prim_addr,
ray->time,
- curve_type,
- NULL,
- 0,
- 0);
+ curve_type);
}
break;
}
diff --git a/intern/cycles/kernel/bvh/qbvh_traversal.h b/intern/cycles/kernel/bvh/qbvh_traversal.h
index 9ee0f7b5933..f43e84bf368 100644
--- a/intern/cycles/kernel/bvh/qbvh_traversal.h
+++ b/intern/cycles/kernel/bvh/qbvh_traversal.h
@@ -20,29 +20,19 @@
*
* BVH_INSTANCING: object instancing
* BVH_HAIR: hair curve rendering
- * BVH_HAIR_MINIMUM_WIDTH: hair curve rendering with minimum width
* BVH_MOTION: motion blur rendering
*/
#if BVH_FEATURE(BVH_HAIR)
# define NODE_INTERSECT qbvh_node_intersect
-# define NODE_INTERSECT_ROBUST qbvh_node_intersect_robust
#else
# define NODE_INTERSECT qbvh_aligned_node_intersect
-# define NODE_INTERSECT_ROBUST qbvh_aligned_node_intersect_robust
#endif
ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
const Ray *ray,
Intersection *isect,
- const uint visibility
-#if BVH_FEATURE(BVH_HAIR_MINIMUM_WIDTH)
- ,
- uint *lcg_state,
- float difl,
- float extmax
-#endif
-)
+ const uint visibility)
{
/* TODO(sergey):
* - Test if pushing distance on the stack helps (for non shadow rays).
@@ -126,38 +116,6 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
BVH_DEBUG_NEXT_NODE();
-#if BVH_FEATURE(BVH_HAIR_MINIMUM_WIDTH)
- if (difl != 0.0f) {
- /* NOTE: We extend all the child BB instead of fetching
- * and checking visibility flags for each of the,
- *
- * Need to test if doing opposite would be any faster.
- */
- child_mask = NODE_INTERSECT_ROBUST(kg,
- tnear,
- tfar,
-# ifdef __KERNEL_AVX2__
- P_idir4,
-# endif
-# if BVH_FEATURE(BVH_HAIR) || !defined(__KERNEL_AVX2__)
- org4,
-# endif
-# if BVH_FEATURE(BVH_HAIR)
- dir4,
-# endif
- idir4,
- near_x,
- near_y,
- near_z,
- far_x,
- far_y,
- far_z,
- node_addr,
- difl,
- &dist);
- }
- else
-#endif /* BVH_HAIR_MINIMUM_WIDTH */
{
child_mask = NODE_INTERSECT(kg,
tnear,
@@ -364,32 +322,12 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
kernel_assert((curve_type & PRIMITIVE_ALL) == (type & PRIMITIVE_ALL));
bool hit;
if (kernel_data.curve.curveflags & CURVE_KN_INTERPOLATE) {
- hit = cardinal_curve_intersect(kg,
- isect,
- P,
- dir,
- visibility,
- object,
- prim_addr,
- ray->time,
- curve_type,
- lcg_state,
- difl,
- extmax);
+ hit = cardinal_curve_intersect(
+ kg, isect, P, dir, visibility, object, prim_addr, ray->time, curve_type);
}
else {
- hit = curve_intersect(kg,
- isect,
- P,
- dir,
- visibility,
- object,
- prim_addr,
- ray->time,
- curve_type,
- lcg_state,
- difl,
- extmax);
+ hit = curve_intersect(
+ kg, isect, P, dir, visibility, object, prim_addr, ray->time, curve_type);
}
if (hit) {
tfar = ssef(isect->t);
@@ -480,4 +418,3 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
}
#undef NODE_INTERSECT
-#undef NODE_INTERSECT_ROBUST
diff --git a/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h b/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h
index b3b1c37748d..6495ae743ab 100644
--- a/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h
+++ b/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h
@@ -85,15 +85,11 @@ ccl_device_forceinline float3 bsdf_ashikhmin_shirley_eval_reflect(const ShaderCl
float HdotI = fmaxf(fabsf(dot(H, I)), 1e-6f);
float HdotN = fmaxf(dot(H, N), 1e-6f);
- float pump =
- 1.0f /
- fmaxf(
- 1e-6f,
- (HdotI *
- fmaxf(
- NdotO,
- NdotI))); /* pump from original paper (first derivative disc., but cancels the HdotI in the pdf nicely) */
- /*float pump = 1.0f / fmaxf(1e-4f, ((NdotO + NdotI) * (NdotO*NdotI))); */ /* pump from d-brdf paper */
+ /* pump from original paper
+ * (first derivative disc., but cancels the HdotI in the pdf nicely) */
+ float pump = 1.0f / fmaxf(1e-6f, (HdotI * fmaxf(NdotO, NdotI)));
+ /* pump from d-brdf paper */
+ /*float pump = 1.0f / fmaxf(1e-4f, ((NdotO + NdotI) * (NdotO*NdotI))); */
float n_x = bsdf_ashikhmin_shirley_roughness_to_exponent(bsdf->alpha_x);
float n_y = bsdf_ashikhmin_shirley_roughness_to_exponent(bsdf->alpha_y);
@@ -105,9 +101,8 @@ ccl_device_forceinline float3 bsdf_ashikhmin_shirley_eval_reflect(const ShaderCl
float norm = (n_x + 1.0f) / (8.0f * M_PI_F);
out = NdotO * norm * lobe * pump;
- *pdf =
- norm * lobe /
- HdotI; /* this is p_h / 4(H.I) (conversion from 'wh measure' to 'wi measure', eq. 8 in paper) */
+ /* this is p_h / 4(H.I) (conversion from 'wh measure' to 'wi measure', eq. 8 in paper). */
+ *pdf = norm * lobe / HdotI;
}
else {
/* anisotropic */
diff --git a/intern/cycles/kernel/closure/bsdf_hair.h b/intern/cycles/kernel/closure/bsdf_hair.h
index 6b2a9a97d30..4b6f5b3b439 100644
--- a/intern/cycles/kernel/closure/bsdf_hair.h
+++ b/intern/cycles/kernel/closure/bsdf_hair.h
@@ -224,7 +224,7 @@ ccl_device int bsdf_hair_reflection_sample(const ShaderClosure *sc,
fast_sincosf(phi, &sinphi, &cosphi);
*omega_in = (cosphi * costheta_i) * locy - (sinphi * costheta_i) * locx + (sintheta_i)*Tg;
- //differentials - TODO: find a better approximation for the reflective bounce
+ // differentials - TODO: find a better approximation for the reflective bounce
#ifdef __RAY_DIFFERENTIALS__
*domega_in_dx = 2 * dot(locy, dIdx) * locy - dIdx;
*domega_in_dy = 2 * dot(locy, dIdy) * locy - dIdy;
@@ -285,7 +285,7 @@ ccl_device int bsdf_hair_transmission_sample(const ShaderClosure *sc,
fast_sincosf(phi, &sinphi, &cosphi);
*omega_in = (cosphi * costheta_i) * locy - (sinphi * costheta_i) * locx + (sintheta_i)*Tg;
- //differentials - TODO: find a better approximation for the transmission bounce
+ // differentials - TODO: find a better approximation for the transmission bounce
#ifdef __RAY_DIFFERENTIALS__
*domega_in_dx = 2 * dot(locy, dIdx) * locy - dIdx;
*domega_in_dy = 2 * dot(locy, dIdy) * locy - dIdy;
diff --git a/intern/cycles/kernel/closure/bsdf_hair_principled.h b/intern/cycles/kernel/closure/bsdf_hair_principled.h
index a4bba2fbf6c..4db5a6cc830 100644
--- a/intern/cycles/kernel/closure/bsdf_hair_principled.h
+++ b/intern/cycles/kernel/closure/bsdf_hair_principled.h
@@ -60,7 +60,8 @@ ccl_device_inline float cos_from_sin(const float s)
return safe_sqrtf(1.0f - s * s);
}
-/* Gives the change in direction in the normal plane for the given angles and p-th-order scattering. */
+/* Gives the change in direction in the normal plane for the given angles and p-th-order
+ * scattering. */
ccl_device_inline float delta_phi(int p, float gamma_o, float gamma_t)
{
return 2.0f * p * gamma_t - 2.0f * gamma_o + p * M_PI_F;
diff --git a/intern/cycles/kernel/closure/bsdf_microfacet_multi.h b/intern/cycles/kernel/closure/bsdf_microfacet_multi.h
index 2cc1a9c5299..07be33ee6b5 100644
--- a/intern/cycles/kernel/closure/bsdf_microfacet_multi.h
+++ b/intern/cycles/kernel/closure/bsdf_microfacet_multi.h
@@ -16,7 +16,8 @@
CCL_NAMESPACE_BEGIN
-/* Most of the code is based on the supplemental implementations from https://eheitzresearch.wordpress.com/240-2/. */
+/* Most of the code is based on the supplemental implementations from
+ * https://eheitzresearch.wordpress.com/240-2/. */
/* === GGX Microfacet distribution functions === */
@@ -80,7 +81,8 @@ ccl_device_forceinline float2 mf_sampleP22_11(const float cosI,
return make_float2(slopeX, -slopeY);
}
-/* Visible normal sampling for the GGX distribution (based on page 7 of the supplemental implementation). */
+/* Visible normal sampling for the GGX distribution
+ * (based on page 7 of the supplemental implementation). */
ccl_device_forceinline float3 mf_sample_vndf(const float3 wi,
const float2 alpha,
const float randx,
@@ -134,7 +136,8 @@ ccl_device_forceinline float3 mf_eval_phase_glossy(const float3 w,
return make_float3(phase, phase, phase);
}
-/* Phase function for dielectric transmissive materials, including both reflection and refraction according to the dielectric fresnel term. */
+/* Phase function for dielectric transmissive materials, including both reflection and refraction
+ * according to the dielectric fresnel term. */
ccl_device_forceinline float3 mf_sample_phase_glass(
const float3 wi, const float eta, const float3 wm, const float randV, bool *outside)
{
@@ -227,7 +230,8 @@ ccl_device_forceinline float mf_G1(const float3 w, const float C1, const float l
return powf(C1, lambda);
}
-/* Sampling from the visible height distribution (based on page 17 of the supplemental implementation). */
+/* Sampling from the visible height distribution (based on page 17 of the supplemental
+ * implementation). */
ccl_device_forceinline bool mf_sample_height(
const float3 w, float *h, float *C1, float *G1, float *lambda, const float U)
{
@@ -254,7 +258,8 @@ ccl_device_forceinline bool mf_sample_height(
}
/* === PDF approximations for the different phase functions. ===
- * As explained in bsdf_microfacet_multi_impl.h, using approximations with MIS still produces an unbiased result. */
+ * As explained in bsdf_microfacet_multi_impl.h, using approximations with MIS still produces an
+ * unbiased result. */
/* Approximation for the albedo of the single-scattering GGX distribution,
* the missing energy is then approximated as a diffuse reflection for the PDF. */
@@ -342,7 +347,8 @@ ccl_device_forceinline float mf_glass_pdf(const float3 wi,
}
}
-/* === Actual random walk implementations, one version of mf_eval and mf_sample per phase function. === */
+/* === Actual random walk implementations === */
+/* One version of mf_eval and mf_sample per phase function. */
#define MF_NAME_JOIN(x, y) x##_##y
#define MF_NAME_EVAL(x, y) MF_NAME_JOIN(x, y)
diff --git a/intern/cycles/kernel/closure/bsdf_microfacet_multi_impl.h b/intern/cycles/kernel/closure/bsdf_microfacet_multi_impl.h
index 79247ee8057..04d9b22d7d2 100644
--- a/intern/cycles/kernel/closure/bsdf_microfacet_multi_impl.h
+++ b/intern/cycles/kernel/closure/bsdf_microfacet_multi_impl.h
@@ -16,14 +16,14 @@
/* Evaluate the BSDF from wi to wo.
* Evaluation is split into the analytical single-scattering BSDF and the multi-scattering BSDF,
- * which is evaluated stochastically through a random walk. At each bounce (except for the first one),
- * the amount of reflection from here towards wo is evaluated before bouncing again.
+ * which is evaluated stochastically through a random walk. At each bounce (except for the first
+ * one), the amount of reflection from here towards wo is evaluated before bouncing again.
*
- * Because of the random walk, the evaluation is not deterministic, but its expected value is equal to
- * the correct BSDF, which is enough for Monte-Carlo rendering. The PDF also can't be determined
- * analytically, so the single-scattering PDF plus a diffuse term to account for the multi-scattered
- * energy is used. In combination with MIS, that is enough to produce an unbiased result, although
- * the balance heuristic isn't necessarily optimal anymore.
+ * Because of the random walk, the evaluation is not deterministic, but its expected value is equal
+ * to the correct BSDF, which is enough for Monte-Carlo rendering. The PDF also can't be determined
+ * analytically, so the single-scattering PDF plus a diffuse term to account for the
+ * multi-scattered energy is used. In combination with MIS, that is enough to produce an unbiased
+ * result, although the balance heuristic isn't necessarily optimal anymore.
*/
ccl_device_forceinline float3 MF_FUNCTION_FULL_NAME(mf_eval)(float3 wi,
float3 wo,
@@ -36,7 +36,8 @@ ccl_device_forceinline float3 MF_FUNCTION_FULL_NAME(mf_eval)(float3 wi,
bool use_fresnel,
const float3 cspec0)
{
- /* Evaluating for a shallower incoming direction produces less noise, and the properties of the BSDF guarantee reciprocity. */
+ /* Evaluating for a shallower incoming direction produces less noise, and the properties of the
+ * BSDF guarantee reciprocity. */
bool swapped = false;
#ifdef MF_MULTI_GLASS
if (wi.z * wo.z < 0.0f) {
@@ -180,9 +181,9 @@ ccl_device_forceinline float3 MF_FUNCTION_FULL_NAME(mf_eval)(float3 wi,
return eval;
}
-/* Perform a random walk on the microsurface starting from wi, returning the direction in which the walk
- * escaped the surface in wo. The function returns the throughput between wi and wo.
- * Without reflection losses due to coloring or fresnel absorption in conductors, the sampling is optimal.
+/* Perform a random walk on the microsurface starting from wi, returning the direction in which the
+ * walk escaped the surface in wo. The function returns the throughput between wi and wo. Without
+ * reflection losses due to coloring or fresnel absorption in conductors, the sampling is optimal.
*/
ccl_device_forceinline float3 MF_FUNCTION_FULL_NAME(mf_sample)(float3 wi,
float3 *wo,
diff --git a/intern/cycles/kernel/closure/bsdf_util.h b/intern/cycles/kernel/closure/bsdf_util.h
index a9a27edd7de..3bce47caedb 100644
--- a/intern/cycles/kernel/closure/bsdf_util.h
+++ b/intern/cycles/kernel/closure/bsdf_util.h
@@ -155,7 +155,7 @@ interpolate_fresnel_color(float3 L, float3 H, float ior, float F0, float3 cspec0
/* Calculate the fresnel interpolation factor
* The value from fresnel_dielectric_cos(...) has to be normalized because
* the cspec0 keeps the F0 color
- */
+ */
float F0_norm = 1.0f / (1.0f - F0);
float FH = (fresnel_dielectric_cos(dot(L, H), ior) - F0) * F0_norm;
diff --git a/intern/cycles/kernel/closure/bssrdf.h b/intern/cycles/kernel/closure/bssrdf.h
index 57804eca269..a7d9f90b443 100644
--- a/intern/cycles/kernel/closure/bssrdf.h
+++ b/intern/cycles/kernel/closure/bssrdf.h
@@ -450,7 +450,8 @@ ccl_device void bssrdf_sample(const ShaderClosure *sc, float xi, float *r, float
else if (bssrdf->type == CLOSURE_BSSRDF_GAUSSIAN_ID) {
bssrdf_gaussian_sample(radius, xi, r, h);
}
- else { /*if(bssrdf->type == CLOSURE_BSSRDF_BURLEY_ID || bssrdf->type == CLOSURE_BSSRDF_PRINCIPLED_ID)*/
+ else { /* if (bssrdf->type == CLOSURE_BSSRDF_BURLEY_ID ||
+ * bssrdf->type == CLOSURE_BSSRDF_PRINCIPLED_ID) */
bssrdf_burley_sample(radius, xi, r, h);
}
}
@@ -466,7 +467,8 @@ ccl_device float bssrdf_channel_pdf(const Bssrdf *bssrdf, float radius, float r)
else if (bssrdf->type == CLOSURE_BSSRDF_GAUSSIAN_ID) {
return bssrdf_gaussian_pdf(radius, r);
}
- else { /*if(bssrdf->type == CLOSURE_BSSRDF_BURLEY_ID || bssrdf->type == CLOSURE_BSSRDF_PRINCIPLED_ID)*/
+ else { /* if (bssrdf->type == CLOSURE_BSSRDF_BURLEY_ID ||
+ * bssrdf->type == CLOSURE_BSSRDF_PRINCIPLED_ID)*/
return bssrdf_burley_pdf(radius, r);
}
}
diff --git a/intern/cycles/kernel/filter/filter_features.h b/intern/cycles/kernel/filter/filter_features.h
index 809ccfe8be6..8a2af957146 100644
--- a/intern/cycles/kernel/filter/filter_features.h
+++ b/intern/cycles/kernel/filter/filter_features.h
@@ -18,8 +18,9 @@ CCL_NAMESPACE_BEGIN
#define ccl_get_feature(buffer, pass) (buffer)[(pass)*pass_stride]
-/* Loop over the pixels in the range [low.x, high.x) x [low.y, high.y).+ * pixel_buffer always points to the current pixel in the first pass.
- * Repeat the loop for every secondary frame if there are any. */
+/* Loop over the pixels in the range [low.x, high.x) x [low.y, high.y).+ * pixel_buffer always
+ * points to the current pixel in the first pass. Repeat the loop for every secondary frame if
+ * there are any. */
#define FOR_PIXEL_WINDOW \
for (int frame = 0; frame < tile_info->num_frames; frame++) { \
pixel.z = tile_info->frames[frame]; \
diff --git a/intern/cycles/kernel/filter/filter_features_sse.h b/intern/cycles/kernel/filter/filter_features_sse.h
index 1e0d6e93453..7bbd17066fd 100644
--- a/intern/cycles/kernel/filter/filter_features_sse.h
+++ b/intern/cycles/kernel/filter/filter_features_sse.h
@@ -20,8 +20,8 @@ CCL_NAMESPACE_BEGIN
/* Loop over the pixels in the range [low.x, high.x) x [low.y, high.y), 4 at a time.
* pixel_buffer always points to the first of the 4 current pixel in the first pass.
- * x4 and y4 contain the coordinates of the four pixels, active_pixels contains a mask that's set for all pixels within the window.
- * Repeat the loop for every secondary frame if there are any. */
+ * x4 and y4 contain the coordinates of the four pixels, active_pixels contains a mask that's set
+ * for all pixels within the window. Repeat the loop for every secondary frame if there are any. */
#define FOR_PIXEL_WINDOW_SSE \
for (int frame = 0; frame < tile_info->num_frames; frame++) { \
pixel.z = tile_info->frames[frame]; \
diff --git a/intern/cycles/kernel/filter/filter_nlm_cpu.h b/intern/cycles/kernel/filter/filter_nlm_cpu.h
index a94266a8786..24200c29203 100644
--- a/intern/cycles/kernel/filter/filter_nlm_cpu.h
+++ b/intern/cycles/kernel/filter/filter_nlm_cpu.h
@@ -197,7 +197,8 @@ ccl_device_inline void kernel_filter_nlm_construct_gramian(int dx,
bool use_time)
{
int4 clip_area = rect_clip(rect, filter_window);
- /* fy and fy are in filter-window-relative coordinates, while x and y are in feature-window-relative coordinates. */
+ /* fy and fy are in filter-window-relative coordinates,
+ * while x and y are in feature-window-relative coordinates. */
for (int y = clip_area.y; y < clip_area.w; y++) {
for (int x = clip_area.x; x < clip_area.z; x++) {
const int low = max(rect.x, x - f);
diff --git a/intern/cycles/kernel/filter/filter_prefilter.h b/intern/cycles/kernel/filter/filter_prefilter.h
index 8211311313d..b48a3f3f68b 100644
--- a/intern/cycles/kernel/filter/filter_prefilter.h
+++ b/intern/cycles/kernel/filter/filter_prefilter.h
@@ -16,14 +16,19 @@
CCL_NAMESPACE_BEGIN
-/* First step of the shadow prefiltering, performs the shadow division and stores all data
+/**
+ * First step of the shadow prefiltering, performs the shadow division and stores all data
* in a nice and easy rectangular array that can be passed to the NLM filter.
*
* Calculates:
- * unfiltered: Contains the two half images of the shadow feature pass
- * sampleVariance: The sample-based variance calculated in the kernel. Note: This calculation is biased in general, and especially here since the variance of the ratio can only be approximated.
- * sampleVarianceV: Variance of the sample variance estimation, quite noisy (since it's essentially the buffer variance of the two variance halves)
- * bufferVariance: The buffer-based variance of the shadow feature. Unbiased, but quite noisy.
+ * \param unfiltered: Contains the two half images of the shadow feature pass
+ * \param sampleVariance: The sample-based variance calculated in the kernel.
+ * Note: This calculation is biased in general,
+ * and especially here since the variance of the ratio can only be approximated.
+ * \param sampleVarianceV: Variance of the sample variance estimation, quite noisy
+ * (since it's essentially the buffer variance of the two variance halves)
+ * \param bufferVariance: The buffer-based variance of the shadow feature.
+ * Unbiased, but quite noisy.
*/
ccl_device void kernel_filter_divide_shadow(int sample,
CCL_FILTER_TILE_INFO,
@@ -204,10 +209,10 @@ ccl_device void kernel_filter_detect_outliers(int x,
if (L > ref) {
/* The pixel appears to be an outlier.
- * However, it may just be a legitimate highlight. Therefore, it is checked how likely it is that the pixel
- * should actually be at the reference value:
- * If the reference is within the 3-sigma interval, the pixel is assumed to be a statistical outlier.
- * Otherwise, it is very unlikely that the pixel should be darker, which indicates a legitimate highlight.
+ * However, it may just be a legitimate highlight. Therefore, it is checked how likely it is
+ * that the pixel should actually be at the reference value: If the reference is within the
+ * 3-sigma interval, the pixel is assumed to be a statistical outlier. Otherwise, it is very
+ * unlikely that the pixel should be darker, which indicates a legitimate highlight.
*/
if (pixel_variance < 0.0f || pixel_variance > 9.0f * max_variance) {
@@ -219,7 +224,8 @@ ccl_device void kernel_filter_detect_outliers(int x,
float stddev = sqrtf(pixel_variance);
if (L - 3 * stddev < ref) {
/* The pixel is an outlier, so negate the depth value to mark it as one.
- * Also, scale its brightness down to the outlier threshold to avoid trouble with the NLM weights. */
+ * Also, scale its brightness down to the outlier threshold to avoid trouble with the NLM
+ * weights. */
depth[idx] = -depth[idx];
float fac = ref / L;
color *= fac;
diff --git a/intern/cycles/kernel/filter/filter_transform.h b/intern/cycles/kernel/filter/filter_transform.h
index 69e3c7c458d..585c4b33787 100644
--- a/intern/cycles/kernel/filter/filter_transform.h
+++ b/intern/cycles/kernel/filter/filter_transform.h
@@ -55,7 +55,8 @@ ccl_device void kernel_filter_construct_transform(const float *ccl_restrict buff
math_vector_scale(feature_means, 1.0f / num_pixels, num_features);
- /* === Scale the shifted feature passes to a range of [-1; 1], will be baked into the transform later. === */
+ /* === Scale the shifted feature passes to a range of [-1; 1] ===
+ * Will be baked into the transform later. */
float feature_scale[DENOISE_FEATURES];
math_vector_zero(feature_scale, num_features);
@@ -69,8 +70,9 @@ ccl_device void kernel_filter_construct_transform(const float *ccl_restrict buff
filter_calculate_scale(feature_scale, use_time);
/* === Generate the feature transformation. ===
- * This transformation maps the num_features-dimentional feature space to a reduced feature (r-feature) space
- * which generally has fewer dimensions. This mainly helps to prevent overfitting. */
+ * This transformation maps the num_features-dimentional feature space to a reduced feature
+ * (r-feature) space which generally has fewer dimensions. This mainly helps to prevent
+ * overfitting. */
float feature_matrix[DENOISE_FEATURES * DENOISE_FEATURES];
math_matrix_zero(feature_matrix, num_features);
FOR_PIXEL_WINDOW
diff --git a/intern/cycles/kernel/filter/filter_transform_gpu.h b/intern/cycles/kernel/filter/filter_transform_gpu.h
index 89cddfd927f..41bbadb621d 100644
--- a/intern/cycles/kernel/filter/filter_transform_gpu.h
+++ b/intern/cycles/kernel/filter/filter_transform_gpu.h
@@ -61,7 +61,8 @@ ccl_device void kernel_filter_construct_transform(const ccl_global float *ccl_re
math_vector_scale(feature_means, 1.0f / num_pixels, num_features);
- /* === Scale the shifted feature passes to a range of [-1; 1], will be baked into the transform later. === */
+ /* === Scale the shifted feature passes to a range of [-1; 1] ===
+ * Will be baked into the transform later. */
float feature_scale[DENOISE_FEATURES];
math_vector_zero(feature_scale, num_features);
@@ -75,8 +76,9 @@ ccl_device void kernel_filter_construct_transform(const ccl_global float *ccl_re
filter_calculate_scale(feature_scale, use_time);
/* === Generate the feature transformation. ===
- * This transformation maps the num_features-dimentional feature space to a reduced feature (r-feature) space
- * which generally has fewer dimensions. This mainly helps to prevent overfitting. */
+ * This transformation maps the num_features-dimentional feature space to a reduced feature
+ * (r-feature) space which generally has fewer dimensions. This mainly helps to prevent
+ * overfitting. */
float feature_matrix[DENOISE_FEATURES * DENOISE_FEATURES];
math_matrix_zero(feature_matrix, num_features);
FOR_PIXEL_WINDOW
diff --git a/intern/cycles/kernel/filter/filter_transform_sse.h b/intern/cycles/kernel/filter/filter_transform_sse.h
index 22397b292db..830444645d7 100644
--- a/intern/cycles/kernel/filter/filter_transform_sse.h
+++ b/intern/cycles/kernel/filter/filter_transform_sse.h
@@ -58,7 +58,8 @@ ccl_device void kernel_filter_construct_transform(const float *ccl_restrict buff
feature_means[i] = reduce_add(feature_means[i]) * pixel_scale;
}
- /* === Scale the shifted feature passes to a range of [-1; 1], will be baked into the transform later. === */
+ /* === Scale the shifted feature passes to a range of [-1; 1] ===
+ * Will be baked into the transform later. */
float4 feature_scale[DENOISE_FEATURES];
math_vector_zero_sse(feature_scale, num_features);
FOR_PIXEL_WINDOW_SSE
@@ -72,8 +73,9 @@ ccl_device void kernel_filter_construct_transform(const float *ccl_restrict buff
filter_calculate_scale_sse(feature_scale, use_time);
/* === Generate the feature transformation. ===
- * This transformation maps the num_features-dimentional feature space to a reduced feature (r-feature) space
- * which generally has fewer dimensions. This mainly helps to prevent overfitting. */
+ * This transformation maps the num_features-dimentional feature space to a reduced feature
+ * (r-feature) space which generally has fewer dimensions. This mainly helps to prevent
+ * overfitting. */
float4 feature_matrix_sse[DENOISE_FEATURES * DENOISE_FEATURES];
math_matrix_zero_sse(feature_matrix_sse, num_features);
FOR_PIXEL_WINDOW_SSE
diff --git a/intern/cycles/kernel/geom/geom_curve_intersect.h b/intern/cycles/kernel/geom/geom_curve_intersect.h
index 5fd277c2f99..0327ebf8890 100644
--- a/intern/cycles/kernel/geom/geom_curve_intersect.h
+++ b/intern/cycles/kernel/geom/geom_curve_intersect.h
@@ -34,10 +34,7 @@ ccl_device_forceinline bool cardinal_curve_intersect(KernelGlobals *kg,
int object,
int curveAddr,
float time,
- int type,
- uint *lcg_state,
- float difl,
- float extmax)
+ int type)
{
const bool is_curve_primitive = (type & PRIMITIVE_CURVE);
@@ -239,9 +236,6 @@ ccl_device_forceinline bool cardinal_curve_intersect(KernelGlobals *kg,
return false;
/* minimum width extension */
- float mw_extension = min(difl * fabsf(upper), extmax);
- float r_ext = mw_extension + r_curr;
-
float xextrem[4];
curvebounds(&lower,
&upper,
@@ -253,7 +247,7 @@ ccl_device_forceinline bool cardinal_curve_intersect(KernelGlobals *kg,
curve_coef[1].x,
curve_coef[2].x,
curve_coef[3].x);
- if (lower > r_ext || upper < -r_ext)
+ if (lower > r_curr || upper < -r_curr)
return false;
float yextrem[4];
@@ -267,7 +261,7 @@ ccl_device_forceinline bool cardinal_curve_intersect(KernelGlobals *kg,
curve_coef[1].y,
curve_coef[2].y,
curve_coef[3].y);
- if (lower > r_ext || upper < -r_ext)
+ if (lower > r_curr || upper < -r_curr)
return false;
/* setup recurrent loop */
@@ -340,12 +334,8 @@ ccl_device_forceinline bool cardinal_curve_intersect(KernelGlobals *kg,
float r2 = r_st + (r_en - r_st) * i_en;
r_curr = max(r1, r2);
- mw_extension = min(difl * fabsf(bmaxz), extmax);
- float r_ext = mw_extension + r_curr;
- float coverage = 1.0f;
-
- if (bminz - r_curr > isect->t || bmaxz + r_curr < epsilon || bminx > r_ext || bmaxx < -r_ext ||
- bminy > r_ext || bmaxy < -r_ext) {
+ if (bminz - r_curr > isect->t || bmaxz + r_curr < epsilon || bminx > r_curr ||
+ bmaxx < -r_curr || bminy > r_curr || bmaxy < -r_curr) {
/* the bounding box does not overlap the square centered at O */
tree += level;
level = tree & -tree;
@@ -404,31 +394,7 @@ ccl_device_forceinline bool cardinal_curve_intersect(KernelGlobals *kg,
continue;
}
- /* compute coverage */
- float r_ext = r_curr;
- coverage = 1.0f;
- if (difl != 0.0f) {
- mw_extension = min(difl * fabsf(bmaxz), extmax);
- r_ext = mw_extension + r_curr;
-# ifdef __KERNEL_SSE__
- const float3 p_curr_sq = p_curr * p_curr;
- const float3 dxxx(_mm_sqrt_ss(_mm_hadd_ps(p_curr_sq.m128, p_curr_sq.m128)));
- float d = dxxx.x;
-# else
- float d = sqrtf(p_curr.x * p_curr.x + p_curr.y * p_curr.y);
-# endif
- float d0 = d - r_curr;
- float d1 = d + r_curr;
- 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
- coverage = (min(d1 * inv_mw_extension, 1.0f) + min(-d0 * inv_mw_extension, 1.0f)) *
- 0.5f;
- }
-
- if (p_curr.x * p_curr.x + p_curr.y * p_curr.y >= r_ext * r_ext || p_curr.z <= epsilon ||
+ if (p_curr.x * p_curr.x + p_curr.y * p_curr.y >= r_curr * r_curr || p_curr.z <= epsilon ||
isect->t < p_curr.z) {
tree++;
level = tree & -tree;
@@ -436,41 +402,23 @@ ccl_device_forceinline bool cardinal_curve_intersect(KernelGlobals *kg,
}
t = p_curr.z;
-
- /* stochastic fade from minimum width */
- if (difl != 0.0f && lcg_state) {
- if (coverage != 1.0f && (lcg_step_float(lcg_state) > coverage))
- return hit;
- }
}
else {
float l = len(p_en - p_st);
- /* minimum width extension */
- float or1 = r1;
- float or2 = r2;
-
- if (difl != 0.0f) {
- mw_extension = min(len(p_st - P) * difl, extmax);
- or1 = r1 < mw_extension ? mw_extension : r1;
- mw_extension = min(len(p_en - P) * difl, extmax);
- or2 = r2 < mw_extension ? mw_extension : r2;
- }
- /* --- */
float invl = 1.0f / l;
float3 tg = (p_en - p_st) * invl;
- gd = (or2 - or1) * invl;
+ gd = (r2 - r1) * invl;
float difz = -dot(p_st, tg);
float cyla = 1.0f - (tg.z * tg.z * (1 + gd * gd));
float invcyla = 1.0f / cyla;
- float halfb = (-p_st.z - tg.z * (difz + gd * (difz * gd + or1)));
+ float halfb = (-p_st.z - tg.z * (difz + gd * (difz * gd + r1)));
float tcentre = -halfb * invcyla;
float zcentre = difz + (tg.z * tcentre);
float3 tdif = -p_st;
tdif.z += tcentre;
float tdifz = dot(tdif, tg);
- float tb = 2 * (tdif.z - tg.z * (tdifz + gd * (tdifz * gd + or1)));
- float tc = dot(tdif, tdif) - tdifz * tdifz * (1 + gd * gd) - or1 * or1 -
- 2 * or1 * tdifz * gd;
+ float tb = 2 * (tdif.z - tg.z * (tdifz + gd * (tdifz * gd + r1)));
+ float tc = dot(tdif, tdif) - tdifz * tdifz * (1 + gd * gd) - r1 * r1 - 2 * r1 * tdifz * gd;
float td = tb * tb - 4 * cyla * tc;
if (td < 0.0f) {
tree++;
@@ -507,16 +455,6 @@ ccl_device_forceinline bool cardinal_curve_intersect(KernelGlobals *kg,
w = saturate(w);
/* compute u on the curve segment */
u = i_st * (1 - w) + i_en * w;
-
- /* stochastic fade from minimum width */
- if (difl != 0.0f && lcg_state) {
- r_curr = r1 + (r2 - r1) * w;
- r_ext = or1 + (or2 - or1) * w;
- coverage = r_curr / r_ext;
-
- if (coverage != 1.0f && (lcg_step_float(lcg_state) > coverage))
- return hit;
- }
}
/* we found a new intersection */
@@ -556,10 +494,7 @@ ccl_device_forceinline bool curve_intersect(KernelGlobals *kg,
int object,
int curveAddr,
float time,
- int type,
- uint *lcg_state,
- float difl,
- float extmax)
+ int type)
{
/* define few macros to minimize code duplication for SSE */
# ifndef __KERNEL_SSE2__
@@ -600,23 +535,14 @@ ccl_device_forceinline bool curve_intersect(KernelGlobals *kg,
motion_curve_keys(kg, fobject, prim, time, k0, k1, P_curve);
}
- float or1 = P_curve[0].w;
- float or2 = P_curve[1].w;
+ float r1 = P_curve[0].w;
+ float r2 = P_curve[1].w;
float3 p1 = float4_to_float3(P_curve[0]);
float3 p2 = float4_to_float3(P_curve[1]);
/* minimum width extension */
- float r1 = or1;
- float r2 = or2;
float3 dif = P - p1;
float3 dif_second = P - p2;
- if (difl != 0.0f) {
- float pixelsize = min(len3(dif) * difl, extmax);
- r1 = or1 < pixelsize ? pixelsize : or1;
- pixelsize = min(len3(dif_second) * difl, extmax);
- r2 = or2 < pixelsize ? pixelsize : or2;
- }
- /* --- */
float3 p21_diff = p2 - p1;
float3 sphere_dif1 = (dif + dif_second) * 0.5f;
@@ -635,20 +561,10 @@ ccl_device_forceinline bool curve_intersect(KernelGlobals *kg,
motion_curve_keys(kg, fobject, prim, time, k0, k1, (float4 *)&P_curve);
}
- const ssef or12 = shuffle<3, 3, 3, 3>(P_curve[0], P_curve[1]);
-
- ssef r12 = or12;
+ ssef r12 = shuffle<3, 3, 3, 3>(P_curve[0], P_curve[1]);
const ssef vP = load4f(P);
const ssef dif = vP - P_curve[0];
const ssef dif_second = vP - P_curve[1];
- if (difl != 0.0f) {
- const ssef len1_sq = len3_squared_splat(dif);
- const ssef len2_sq = len3_squared_splat(dif_second);
- const ssef len12 = mm_sqrt(shuffle<0, 0, 0, 0>(len1_sq, len2_sq));
- const ssef pixelsize12 = min(len12 * difl, ssef(extmax));
- r12 = max(or12, pixelsize12);
- }
- float or1 = extract<0>(or12), or2 = extract<0>(shuffle<2>(or12));
float r1 = extract<0>(r12), r2 = extract<0>(shuffle<2>(r12));
const ssef p21_diff = P_curve[1] - P_curve[0];
@@ -754,15 +670,6 @@ ccl_device_forceinline bool curve_intersect(KernelGlobals *kg,
z = zcentre + (dirz * correction);
}
- /* stochastic fade from minimum width */
- float adjradius = or1 + z * (or2 - or1) * invl;
- adjradius = adjradius / (r1 + z * gd);
- if (lcg_state && adjradius != 1.0f) {
- if (lcg_step_float(lcg_state) > adjradius)
- return false;
- }
- /* --- */
-
if (t > 0.0f && t < isect->t && z >= 0 && z <= l) {
if (flags & CURVE_KN_ENCLOSEFILTER) {
diff --git a/intern/cycles/kernel/geom/geom_object.h b/intern/cycles/kernel/geom/geom_object.h
index 2792fd64c61..f410e6e27e2 100644
--- a/intern/cycles/kernel/geom/geom_object.h
+++ b/intern/cycles/kernel/geom/geom_object.h
@@ -386,7 +386,8 @@ ccl_device float3 particle_angular_velocity(KernelGlobals *kg, int particle)
ccl_device_inline float3 bvh_clamp_direction(float3 dir)
{
- /* clamp absolute values by exp2f(-80.0f) to avoid division by zero when calculating inverse direction */
+ /* clamp absolute values by exp2f(-80.0f) to avoid division by zero when calculating inverse
+ * direction */
#if defined(__KERNEL_SSE__) && defined(__KERNEL_SSE2__)
const ssef oopes(8.271806E-25f, 8.271806E-25f, 8.271806E-25f, 0.0f);
const ssef mask = _mm_cmpgt_ps(fabs(dir), oopes);
diff --git a/intern/cycles/kernel/geom/geom_triangle_intersect.h b/intern/cycles/kernel/geom/geom_triangle_intersect.h
index bcad03102d2..9c6fd498a80 100644
--- a/intern/cycles/kernel/geom/geom_triangle_intersect.h
+++ b/intern/cycles/kernel/geom/geom_triangle_intersect.h
@@ -178,7 +178,7 @@ ccl_device_inline int ray_triangle_intersect8(KernelGlobals *kg,
_mm256_cmpeq_epi32(two256, UVW_256_1));
unsigned char mask_minmaxUVW_pos = _mm256_movemask_ps(_mm256_castsi256_ps(mask_minmaxUVW_256));
- if ((mask_minmaxUVW_pos & prim_num_mask) == prim_num_mask) { //all bits set
+ if ((mask_minmaxUVW_pos & prim_num_mask) == prim_num_mask) { // all bits set
return false;
}
@@ -375,7 +375,7 @@ ccl_device_inline int triangle_intersect8(KernelGlobals *kg,
tri_b[i] = *(__m128 *)&kg->__prim_tri_verts.data[tri_vindex++];
tri_c[i] = *(__m128 *)&kg->__prim_tri_verts.data[tri_vindex++];
}
- //create 9 or 12 placeholders
+ // create 9 or 12 placeholders
tri[0] = _mm256_castps128_ps256(tri_a[0]); //_mm256_zextps128_ps256
tri[1] = _mm256_castps128_ps256(tri_b[0]); //_mm256_zextps128_ps256
tri[2] = _mm256_castps128_ps256(tri_c[0]); //_mm256_zextps128_ps256
@@ -401,40 +401,40 @@ ccl_device_inline int triangle_intersect8(KernelGlobals *kg,
}
//------------------------------------------------
- //0! Xa0 Ya0 Za0 1 Xa4 Ya4 Za4 1
- //1! Xb0 Yb0 Zb0 1 Xb4 Yb4 Zb4 1
- //2! Xc0 Yc0 Zc0 1 Xc4 Yc4 Zc4 1
+ // 0! Xa0 Ya0 Za0 1 Xa4 Ya4 Za4 1
+ // 1! Xb0 Yb0 Zb0 1 Xb4 Yb4 Zb4 1
+ // 2! Xc0 Yc0 Zc0 1 Xc4 Yc4 Zc4 1
- //3! Xa1 Ya1 Za1 1 Xa5 Ya5 Za5 1
- //4! Xb1 Yb1 Zb1 1 Xb5 Yb5 Zb5 1
- //5! Xc1 Yc1 Zc1 1 Xc5 Yc5 Zc5 1
+ // 3! Xa1 Ya1 Za1 1 Xa5 Ya5 Za5 1
+ // 4! Xb1 Yb1 Zb1 1 Xb5 Yb5 Zb5 1
+ // 5! Xc1 Yc1 Zc1 1 Xc5 Yc5 Zc5 1
- //6! Xa2 Ya2 Za2 1 Xa6 Ya6 Za6 1
- //7! Xb2 Yb2 Zb2 1 Xb6 Yb6 Zb6 1
- //8! Xc2 Yc2 Zc2 1 Xc6 Yc6 Zc6 1
+ // 6! Xa2 Ya2 Za2 1 Xa6 Ya6 Za6 1
+ // 7! Xb2 Yb2 Zb2 1 Xb6 Yb6 Zb6 1
+ // 8! Xc2 Yc2 Zc2 1 Xc6 Yc6 Zc6 1
- //9! Xa3 Ya3 Za3 1 Xa7 Ya7 Za7 1
- //10! Xb3 Yb3 Zb3 1 Xb7 Yb7 Zb7 1
- //11! Xc3 Yc3 Zc3 1 Xc7 Yc7 Zc7 1
+ // 9! Xa3 Ya3 Za3 1 Xa7 Ya7 Za7 1
+ // 10! Xb3 Yb3 Zb3 1 Xb7 Yb7 Zb7 1
+ // 11! Xc3 Yc3 Zc3 1 Xc7 Yc7 Zc7 1
//"transpose"
- tritmp[0] = _mm256_unpacklo_ps(tri[0], tri[3]); //0! Xa0 Xa1 Ya0 Ya1 Xa4 Xa5 Ya4 Ya5
- tritmp[1] = _mm256_unpackhi_ps(tri[0], tri[3]); //1! Za0 Za1 1 1 Za4 Za5 1 1
+ tritmp[0] = _mm256_unpacklo_ps(tri[0], tri[3]); // 0! Xa0 Xa1 Ya0 Ya1 Xa4 Xa5 Ya4 Ya5
+ tritmp[1] = _mm256_unpackhi_ps(tri[0], tri[3]); // 1! Za0 Za1 1 1 Za4 Za5 1 1
- tritmp[2] = _mm256_unpacklo_ps(tri[6], tri[9]); //2! Xa2 Xa3 Ya2 Ya3 Xa6 Xa7 Ya6 Ya7
- tritmp[3] = _mm256_unpackhi_ps(tri[6], tri[9]); //3! Za2 Za3 1 1 Za6 Za7 1 1
+ tritmp[2] = _mm256_unpacklo_ps(tri[6], tri[9]); // 2! Xa2 Xa3 Ya2 Ya3 Xa6 Xa7 Ya6 Ya7
+ tritmp[3] = _mm256_unpackhi_ps(tri[6], tri[9]); // 3! Za2 Za3 1 1 Za6 Za7 1 1
- tritmp[4] = _mm256_unpacklo_ps(tri[1], tri[4]); //4! Xb0 Xb1 Yb0 Yb1 Xb4 Xb5 Yb4 Yb5
- tritmp[5] = _mm256_unpackhi_ps(tri[1], tri[4]); //5! Zb0 Zb1 1 1 Zb4 Zb5 1 1
+ tritmp[4] = _mm256_unpacklo_ps(tri[1], tri[4]); // 4! Xb0 Xb1 Yb0 Yb1 Xb4 Xb5 Yb4 Yb5
+ tritmp[5] = _mm256_unpackhi_ps(tri[1], tri[4]); // 5! Zb0 Zb1 1 1 Zb4 Zb5 1 1
- tritmp[6] = _mm256_unpacklo_ps(tri[7], tri[10]); //6! Xb2 Xb3 Yb2 Yb3 Xb6 Xb7 Yb6 Yb7
- tritmp[7] = _mm256_unpackhi_ps(tri[7], tri[10]); //7! Zb2 Zb3 1 1 Zb6 Zb7 1 1
+ tritmp[6] = _mm256_unpacklo_ps(tri[7], tri[10]); // 6! Xb2 Xb3 Yb2 Yb3 Xb6 Xb7 Yb6 Yb7
+ tritmp[7] = _mm256_unpackhi_ps(tri[7], tri[10]); // 7! Zb2 Zb3 1 1 Zb6 Zb7 1 1
- tritmp[8] = _mm256_unpacklo_ps(tri[2], tri[5]); //8! Xc0 Xc1 Yc0 Yc1 Xc4 Xc5 Yc4 Yc5
- tritmp[9] = _mm256_unpackhi_ps(tri[2], tri[5]); //9! Zc0 Zc1 1 1 Zc4 Zc5 1 1
+ tritmp[8] = _mm256_unpacklo_ps(tri[2], tri[5]); // 8! Xc0 Xc1 Yc0 Yc1 Xc4 Xc5 Yc4 Yc5
+ tritmp[9] = _mm256_unpackhi_ps(tri[2], tri[5]); // 9! Zc0 Zc1 1 1 Zc4 Zc5 1 1
- tritmp[10] = _mm256_unpacklo_ps(tri[8], tri[11]); //10! Xc2 Xc3 Yc2 Yc3 Xc6 Xc7 Yc6 Yc7
- tritmp[11] = _mm256_unpackhi_ps(tri[8], tri[11]); //11! Zc2 Zc3 1 1 Zc6 Zc7 1 1
+ tritmp[10] = _mm256_unpacklo_ps(tri[8], tri[11]); // 10! Xc2 Xc3 Yc2 Yc3 Xc6 Xc7 Yc6 Yc7
+ tritmp[11] = _mm256_unpackhi_ps(tri[8], tri[11]); // 11! Zc2 Zc3 1 1 Zc6 Zc7 1 1
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
triA[0] = _mm256_castpd_ps(
@@ -459,13 +459,13 @@ ccl_device_inline int triangle_intersect8(KernelGlobals *kg,
triC[0] = _mm256_castpd_ps(
_mm256_unpacklo_pd(_mm256_castps_pd(tritmp[8]),
- _mm256_castps_pd(tritmp[10]))); //Xc0 Xc1 Xc2 Xc3 Xc4 Xc5 Xc6 Xc7
+ _mm256_castps_pd(tritmp[10]))); // Xc0 Xc1 Xc2 Xc3 Xc4 Xc5 Xc6 Xc7
triC[1] = _mm256_castpd_ps(
_mm256_unpackhi_pd(_mm256_castps_pd(tritmp[8]),
- _mm256_castps_pd(tritmp[10]))); //Yc0 Yc1 Yc2 Yc3 Yc4 Yc5 Yc6 Yc7
+ _mm256_castps_pd(tritmp[10]))); // Yc0 Yc1 Yc2 Yc3 Yc4 Yc5 Yc6 Yc7
triC[2] = _mm256_castpd_ps(
_mm256_unpacklo_pd(_mm256_castps_pd(tritmp[9]),
- _mm256_castps_pd(tritmp[11]))); //Zc0 Zc1 Zc2 Zc3 Zc4 Zc5 Zc6 Zc7
+ _mm256_castps_pd(tritmp[11]))); // Zc0 Zc1 Zc2 Zc3 Zc4 Zc5 Zc6 Zc7
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
diff --git a/intern/cycles/kernel/kernel_bake.h b/intern/cycles/kernel/kernel_bake.h
index 10b71bc6bdf..cd1ca5ea7ec 100644
--- a/intern/cycles/kernel/kernel_bake.h
+++ b/intern/cycles/kernel/kernel_bake.h
@@ -72,7 +72,8 @@ ccl_device_inline void compute_light_pass(
# ifdef __SUBSURFACE__
/* sample subsurface scattering */
if ((pass_filter & BAKE_FILTER_SUBSURFACE) && (sd->flag & SD_BSSRDF)) {
- /* when mixing BSSRDF and BSDF closures we should skip BSDF lighting if scattering was successful */
+ /* When mixing BSSRDF and BSDF closures we should skip BSDF lighting
+ * if scattering was successful. */
SubsurfaceIndirectRays ss_indirect;
kernel_path_subsurface_init_indirect(&ss_indirect);
if (kernel_path_subsurface_scatter(
@@ -123,7 +124,8 @@ ccl_device_inline void compute_light_pass(
# ifdef __SUBSURFACE__
/* sample subsurface scattering */
if ((pass_filter & BAKE_FILTER_SUBSURFACE) && (sd->flag & SD_BSSRDF)) {
- /* when mixing BSSRDF and BSDF closures we should skip BSDF lighting if scattering was successful */
+ /* When mixing BSSRDF and BSDF closures we should skip BSDF lighting
+ * if scattering was successful. */
kernel_branched_path_subsurface_scatter(
kg, sd, &indirect_sd, &emission_sd, &L_sample, &state, &ray, throughput);
}
diff --git a/intern/cycles/kernel/kernel_id_passes.h b/intern/cycles/kernel/kernel_id_passes.h
index c1f4e39e5e7..1ca42e933d1 100644
--- a/intern/cycles/kernel/kernel_id_passes.h
+++ b/intern/cycles/kernel/kernel_id_passes.h
@@ -1,18 +1,18 @@
/*
-* Copyright 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.
-*/
+ * Copyright 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.
+ */
CCL_NAMESPACE_BEGIN
@@ -32,7 +32,7 @@ ccl_device_inline void kernel_write_id_slots(ccl_global float *buffer,
/* 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) {
/* Use an atomic to claim this slot.
- * If a different thread got here first, try again from this slot on. */
+ * If a different thread got here first, try again from this slot on. */
float old_id = atomic_compare_and_swap_float(buffer + slot * 2, ID_NONE, id);
if (old_id != ID_NONE && old_id != id) {
continue;
@@ -54,7 +54,7 @@ ccl_device_inline void kernel_write_id_slots(ccl_global float *buffer,
break;
}
/* If there already is a slot for that ID, add the weight.
- * If no slot was found, add it to the last. */
+ * If no slot was found, add it to the last. */
else if (id_buffer[slot].x == id || slot == num_slots - 1) {
id_buffer[slot].y += weight;
break;
diff --git a/intern/cycles/kernel/kernel_light.h b/intern/cycles/kernel/kernel_light.h
index 5e24f8dedaf..9128bfa9d95 100644
--- a/intern/cycles/kernel/kernel_light.h
+++ b/intern/cycles/kernel/kernel_light.h
@@ -524,7 +524,8 @@ ccl_device float background_light_pdf(KernelGlobals *kg, float3 P, float3 direct
portal_pdf = background_portal_pdf(kg, P, direction, -1, &is_possible) * portal_sampling_pdf;
if (!is_possible) {
/* Portal sampling is not possible here because all portals point to the wrong side.
- * If map sampling is possible, it would be used instead, otherwise fallback sampling is used. */
+ * If map sampling is possible, it would be used instead,
+ * otherwise fallback sampling is used. */
if (portal_sampling_pdf == 1.0f) {
return kernel_data.integrator.pdf_lights / M_4PI_F;
}
diff --git a/intern/cycles/kernel/kernel_montecarlo.h b/intern/cycles/kernel/kernel_montecarlo.h
index a933be970c2..acd5086be3a 100644
--- a/intern/cycles/kernel/kernel_montecarlo.h
+++ b/intern/cycles/kernel/kernel_montecarlo.h
@@ -199,21 +199,27 @@ ccl_device float3 ensure_valid_reflection(float3 Ng, float3 I, float3 N)
float NdotNg = dot(N, Ng);
float3 X = normalize(N - NdotNg * Ng);
+ /* Keep math expressions. */
+ /* clang-format off */
/* Calculate N.z and N.x in the local coordinate system.
*
* The goal of this computation is to find a N' that is rotated towards Ng just enough
* to lift R' above the threshold (here called t), therefore dot(R', Ng) = t.
*
- * According to the standard reflection equation, this means that we want dot(2*dot(N', I)*N' - I, Ng) = t.
+ * According to the standard reflection equation,
+ * this means that we want dot(2*dot(N', I)*N' - I, Ng) = t.
*
- * Since the Z axis of our local coordinate system is Ng, dot(x, Ng) is just x.z, so we get 2*dot(N', I)*N'.z - I.z = t.
+ * Since the Z axis of our local coordinate system is Ng, dot(x, Ng) is just x.z, so we get
+ * 2*dot(N', I)*N'.z - I.z = t.
*
- * The rotation is simple to express in the coordinate system we formed - since N lies in the X-Z-plane, we know that
- * N' will also lie in the X-Z-plane, so N'.y = 0 and therefore dot(N', I) = N'.x*I.x + N'.z*I.z .
+ * The rotation is simple to express in the coordinate system we formed -
+ * since N lies in the X-Z-plane, we know that N' will also lie in the X-Z-plane,
+ * so N'.y = 0 and therefore dot(N', I) = N'.x*I.x + N'.z*I.z .
*
* Furthermore, we want N' to be normalized, so N'.x = sqrt(1 - N'.z^2).
*
- * With these simplifications, we get the final equation 2*(sqrt(1 - N'.z^2)*I.x + N'.z*I.z)*N'.z - I.z = t.
+ * With these simplifications,
+ * we get the final equation 2*(sqrt(1 - N'.z^2)*I.x + N'.z*I.z)*N'.z - I.z = t.
*
* The only unknown here is N'.z, so we can solve for that.
*
@@ -227,8 +233,11 @@ ccl_device float3 ensure_valid_reflection(float3 Ng, float3 I, float3 N)
* c = I.z*t + a
* N'.z = +-sqrt(0.5*(+-b + c)/a)
*
- * Two solutions can immediately be discarded because they're negative so N' would lie in the lower hemisphere.
+ * Two solutions can immediately be discarded because they're negative so N' would lie in the
+ * lower hemisphere.
*/
+ /* clang-format on */
+
float Ix = dot(I, X), Iz = dot(I, Ng);
float Ix2 = sqr(Ix), Iz2 = sqr(Iz);
float a = Ix2 + Iz2;
@@ -237,8 +246,9 @@ ccl_device float3 ensure_valid_reflection(float3 Ng, float3 I, float3 N)
float c = Iz * threshold + a;
/* Evaluate both solutions.
- * In many cases one can be immediately discarded (if N'.z would be imaginary or larger than one), so check for that first.
- * If no option is viable (might happen in extreme cases like N being in the wrong hemisphere), give up and return Ng. */
+ * In many cases one can be immediately discarded (if N'.z would be imaginary or larger than
+ * one), so check for that first. If no option is viable (might happen in extreme cases like N
+ * being in the wrong hemisphere), give up and return Ng. */
float fac = 0.5f / a;
float N1_z2 = fac * (b + c), N2_z2 = fac * (-b + c);
bool valid1 = (N1_z2 > 1e-5f) && (N1_z2 <= (1.0f + 1e-5f));
@@ -256,8 +266,9 @@ ccl_device float3 ensure_valid_reflection(float3 Ng, float3 I, float3 N)
valid1 = (R1 >= 1e-5f);
valid2 = (R2 >= 1e-5f);
if (valid1 && valid2) {
- /* If both solutions are valid, return the one with the shallower reflection since it will be closer to the input
- * (if the original reflection wasn't shallow, we would not be in this part of the function). */
+ /* If both solutions are valid, return the one with the shallower reflection since it will be
+ * closer to the input (if the original reflection wasn't shallow, we would not be in this
+ * part of the function). */
N_new = (R1 < R2) ? N1 : N2;
}
else {
diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h
index 2be1b745632..f3e2a8a234a 100644
--- a/intern/cycles/kernel/kernel_path.h
+++ b/intern/cycles/kernel/kernel_path.h
@@ -65,25 +65,7 @@ ccl_device_forceinline bool kernel_path_scene_intersect(KernelGlobals *kg,
ray->t = kernel_data.background.ao_distance;
}
-#ifdef __HAIR__
- float difl = 0.0f, extmax = 0.0f;
- uint lcg_state = 0;
-
- if (kernel_data.bvh.have_curves) {
- if ((kernel_data.cam.resolution == 1) && (state->flag & PATH_RAY_CAMERA)) {
- float3 pixdiff = ray->dD.dx + ray->dD.dy;
- /*pixdiff = pixdiff - dot(pixdiff, ray.D)*ray.D;*/
- difl = kernel_data.curve.minimum_width * len(pixdiff) * 0.5f;
- }
-
- extmax = kernel_data.curve.maximum_width;
- lcg_state = lcg_state_init_addrspace(state, 0x51633e2d);
- }
-
- bool hit = scene_intersect(kg, *ray, visibility, isect, &lcg_state, difl, extmax);
-#else
- bool hit = scene_intersect(kg, *ray, visibility, isect, NULL, 0.0f, 0.0f);
-#endif /* __HAIR__ */
+ bool hit = scene_intersect(kg, *ray, visibility, isect);
#ifdef __KERNEL_DEBUG__
if (state->flag & PATH_RAY_CAMERA) {
@@ -455,8 +437,8 @@ ccl_device void kernel_path_indirect(KernelGlobals *kg,
}
/* path termination. this is a strange place to put the termination, it's
- * mainly due to the mixed in MIS that we use. gives too many unneeded
- * shader evaluations, only need emission if we are going to terminate */
+ * mainly due to the mixed in MIS that we use. gives too many unneeded
+ * shader evaluations, only need emission if we are going to terminate */
float probability = path_state_continuation_probability(kg, state, throughput);
if (probability == 0.0f) {
@@ -482,7 +464,7 @@ ccl_device void kernel_path_indirect(KernelGlobals *kg,
# ifdef __SUBSURFACE__
/* bssrdf scatter to a different location on the same object, replacing
- * the closures with a diffuse BSDF */
+ * the closures with a diffuse BSDF */
if (sd->flag & SD_BSSRDF) {
if (kernel_path_subsurface_scatter(
kg, sd, emission_sd, L, state, ray, &throughput, &ss_indirect)) {
@@ -593,8 +575,8 @@ ccl_device_forceinline void kernel_path_integrate(KernelGlobals *kg,
}
/* path termination. this is a strange place to put the termination, it's
- * mainly due to the mixed in MIS that we use. gives too many unneeded
- * shader evaluations, only need emission if we are going to terminate */
+ * mainly due to the mixed in MIS that we use. gives too many unneeded
+ * shader evaluations, only need emission if we are going to terminate */
float probability = path_state_continuation_probability(kg, state, throughput);
if (probability == 0.0f) {
@@ -619,7 +601,7 @@ ccl_device_forceinline void kernel_path_integrate(KernelGlobals *kg,
# ifdef __SUBSURFACE__
/* bssrdf scatter to a different location on the same object, replacing
- * the closures with a diffuse BSDF */
+ * the closures with a diffuse BSDF */
if (sd.flag & SD_BSSRDF) {
if (kernel_path_subsurface_scatter(
kg, &sd, emission_sd, L, state, ray, &throughput, &ss_indirect)) {
diff --git a/intern/cycles/kernel/kernel_path_branched.h b/intern/cycles/kernel/kernel_path_branched.h
index e8ce61024b3..f3a1ea3f4fd 100644
--- a/intern/cycles/kernel/kernel_path_branched.h
+++ b/intern/cycles/kernel/kernel_path_branched.h
@@ -428,8 +428,8 @@ ccl_device void kernel_branched_path_integrate(KernelGlobals *kg,
/* transparency termination */
if (state.flag & PATH_RAY_TRANSPARENT) {
/* path termination. this is a strange place to put the termination, it's
- * mainly due to the mixed in MIS that we use. gives too many unneeded
- * shader evaluations, only need emission if we are going to terminate */
+ * mainly due to the mixed in MIS that we use. gives too many unneeded
+ * shader evaluations, only need emission if we are going to terminate */
float probability = path_state_continuation_probability(kg, &state, throughput);
if (probability == 0.0f) {
diff --git a/intern/cycles/kernel/kernel_path_surface.h b/intern/cycles/kernel/kernel_path_surface.h
index 6251313c5f8..a1ab4951565 100644
--- a/intern/cycles/kernel/kernel_path_surface.h
+++ b/intern/cycles/kernel/kernel_path_surface.h
@@ -18,7 +18,8 @@ CCL_NAMESPACE_BEGIN
#if defined(__BRANCHED_PATH__) || defined(__SUBSURFACE__) || defined(__SHADOW_TRICKS__) || \
defined(__BAKING__)
-/* branched path tracing: connect path directly to position on one or more lights and add it to L */
+/* branched path tracing: connect path directly to position on one or more lights and add it to L
+ */
ccl_device_noinline void kernel_branched_path_surface_connect_light(
KernelGlobals *kg,
ShaderData *sd,
@@ -62,8 +63,10 @@ ccl_device_noinline void kernel_branched_path_surface_connect_light(
LightSample ls;
if (lamp_light_sample(kg, i, light_u, light_v, sd->P, &ls)) {
- /* The sampling probability returned by lamp_light_sample assumes that all lights were sampled.
- * However, this code only samples lamps, so if the scene also had mesh lights, the real probability is twice as high. */
+ /* The sampling probability returned by lamp_light_sample assumes that all lights were
+ * sampled.
+ * However, this code only samples lamps, so if the scene also had mesh lights, the real
+ * probability is twice as high. */
if (kernel_data.integrator.pdf_triangles != 0.0f)
ls.pdf *= 2.0f;
@@ -109,7 +112,8 @@ ccl_device_noinline void kernel_branched_path_surface_connect_light(
LightSample ls;
if (light_sample(kg, light_u, light_v, sd->time, sd->P, state->bounce, &ls)) {
- /* Same as above, probability needs to be corrected since the sampling was forced to select a mesh light. */
+ /* Same as above, probability needs to be corrected since the sampling was forced to
+ * select a mesh light. */
if (kernel_data.integrator.num_all_lights)
ls.pdf *= 2.0f;
diff --git a/intern/cycles/kernel/kernel_shadow.h b/intern/cycles/kernel/kernel_shadow.h
index 6af1369feab..07201819030 100644
--- a/intern/cycles/kernel/kernel_shadow.h
+++ b/intern/cycles/kernel/kernel_shadow.h
@@ -103,8 +103,7 @@ ccl_device bool shadow_blocked_opaque(KernelGlobals *kg,
Intersection *isect,
float3 *shadow)
{
- const bool blocked = scene_intersect(
- kg, *ray, visibility & PATH_RAY_SHADOW_OPAQUE, isect, NULL, 0.0f, 0.0f);
+ const bool blocked = scene_intersect(kg, *ray, visibility & PATH_RAY_SHADOW_OPAQUE, isect);
#ifdef __VOLUME__
if (!blocked && state->volume_stack[0].shader != SHADER_NONE) {
/* Apply attenuation from current volume shader. */
@@ -319,8 +318,7 @@ ccl_device bool shadow_blocked_transparent_stepped_loop(KernelGlobals *kg,
if (bounce >= kernel_data.integrator.transparent_max_bounce) {
return true;
}
- if (!scene_intersect(
- kg, *ray, visibility & PATH_RAY_SHADOW_TRANSPARENT, isect, NULL, 0.0f, 0.0f)) {
+ if (!scene_intersect(kg, *ray, visibility & PATH_RAY_SHADOW_TRANSPARENT, isect)) {
break;
}
if (!shader_transparent_shadow(kg, isect)) {
@@ -376,8 +374,7 @@ ccl_device bool shadow_blocked_transparent_stepped(KernelGlobals *kg,
Intersection *isect,
float3 *shadow)
{
- bool blocked = scene_intersect(
- kg, *ray, visibility & PATH_RAY_SHADOW_OPAQUE, isect, NULL, 0.0f, 0.0f);
+ bool blocked = scene_intersect(kg, *ray, visibility & PATH_RAY_SHADOW_OPAQUE, isect);
bool is_transparent_isect = blocked ? shader_transparent_shadow(kg, isect) : false;
return shadow_blocked_transparent_stepped_loop(
kg, sd, shadow_sd, state, visibility, ray, isect, blocked, is_transparent_isect, shadow);
@@ -436,8 +433,7 @@ ccl_device_inline bool shadow_blocked(KernelGlobals *kg,
* TODO(sergey): Check why using record-all behavior causes slowdown in such
* cases. Could that be caused by a higher spill pressure?
*/
- const bool blocked = scene_intersect(
- kg, *ray, visibility & PATH_RAY_SHADOW_OPAQUE, &isect, NULL, 0.0f, 0.0f);
+ const bool blocked = scene_intersect(kg, *ray, visibility & PATH_RAY_SHADOW_OPAQUE, &isect);
const bool is_transparent_isect = blocked ? shader_transparent_shadow(kg, &isect) : false;
if (!blocked || !is_transparent_isect || max_hits + 1 >= SHADOW_STACK_MAX_HITS) {
return shadow_blocked_transparent_stepped_loop(
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h
index 3f62b726b6a..0c6b4b401f0 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -1372,8 +1372,7 @@ typedef struct KernelCurves {
int curveflags;
int subdivisions;
- float minimum_width;
- float maximum_width;
+ int pad1, pad2;
} KernelCurves;
static_assert_align(KernelCurves, 16);
diff --git a/intern/cycles/kernel/kernel_volume.h b/intern/cycles/kernel/kernel_volume.h
index e024003252f..1705f58b87d 100644
--- a/intern/cycles/kernel/kernel_volume.h
+++ b/intern/cycles/kernel/kernel_volume.h
@@ -559,7 +559,7 @@ kernel_volume_integrate_heterogeneous_distance(KernelGlobals *kg,
float dt = new_t - t;
/* use random position inside this segment to sample shader,
- * for last shorter step we remap it to fit within the segment. */
+ * for last shorter step we remap it to fit within the segment. */
if (new_t == ray->t) {
step_offset *= (new_t - t) / step_size;
}
@@ -794,7 +794,7 @@ ccl_device void kernel_volume_decoupled_record(KernelGlobals *kg,
float dt = new_t - t;
/* use random position inside this segment to sample shader,
- * for last shorter step we remap it to fit within the segment. */
+ * for last shorter step we remap it to fit within the segment. */
if (new_t == ray->t) {
step_offset *= (new_t - t) / step_size;
}
diff --git a/intern/cycles/kernel/kernels/cuda/kernel_config.h b/intern/cycles/kernel/kernels/cuda/kernel_config.h
index d9f349837a8..3ec00762e72 100644
--- a/intern/cycles/kernel/kernels/cuda/kernel_config.h
+++ b/intern/cycles/kernel/kernels/cuda/kernel_config.h
@@ -61,7 +61,8 @@
/* tunable parameters */
# define CUDA_THREADS_BLOCK_WIDTH 16
-/* CUDA 9.0 seems to cause slowdowns on high-end Pascal cards unless we increase the number of registers */
+/* CUDA 9.0 seems to cause slowdowns on high-end Pascal cards unless we increase the number of
+ * registers */
# if __CUDACC_VER_MAJOR__ >= 9 && __CUDA_ARCH__ >= 600
# define CUDA_KERNEL_MAX_REGISTERS 64
# else
diff --git a/intern/cycles/kernel/osl/osl_closures.cpp b/intern/cycles/kernel/osl/osl_closures.cpp
index aa7e2727577..27205df3732 100644
--- a/intern/cycles/kernel/osl/osl_closures.cpp
+++ b/intern/cycles/kernel/osl/osl_closures.cpp
@@ -497,8 +497,8 @@ class MicrofacetFresnelClosure : public CBSDFClosure {
MicrofacetBsdf *alloc(ShaderData *sd, int path_flag, float3 weight)
{
/* Technically, the MultiGGX Glass closure may also transmit. However,
- * since this is set statically and only used for caustic flags, this
- * is probably as good as it gets. */
+ * since this is set statically and only used for caustic flags, this
+ * is probably as good as it gets. */
if (skip(sd, path_flag, LABEL_GLOSSY | LABEL_REFLECT)) {
return NULL;
}
@@ -715,8 +715,8 @@ class MicrofacetMultiFresnelClosure : public CBSDFClosure {
MicrofacetBsdf *alloc(ShaderData *sd, int path_flag, float3 weight)
{
/* Technically, the MultiGGX closure may also transmit. However,
- * since this is set statically and only used for caustic flags, this
- * is probably as good as it gets. */
+ * since this is set statically and only used for caustic flags, this
+ * is probably as good as it gets. */
if (skip(sd, path_flag, LABEL_GLOSSY | LABEL_REFLECT)) {
return NULL;
}
diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp
index eb9f672fd8a..6404690224a 100644
--- a/intern/cycles/kernel/osl/osl_services.cpp
+++ b/intern/cycles/kernel/osl/osl_services.cpp
@@ -733,7 +733,7 @@ bool OSLRenderServices::get_object_standard_attribute(
return set_attribute_float3(f, type, derivatives, val);
}
#if 0 /* unsupported */
- else if(name == u_particle_rotation) {
+ else if (name == u_particle_rotation) {
int particle_id = object_particle_id(kg, sd->object);
float4 f = particle_rotation(kg, particle_id);
return set_attribute_float4(f, type, derivatives, val);
@@ -1017,7 +1017,7 @@ bool OSLRenderServices::texture(ustring filename,
PtexPtr<PtexTexture> r(ptex_cache->get(filename.c_str(), error));
if (!r) {
- //std::cerr << error.c_str() << std::endl;
+ // std::cerr << error.c_str() << std::endl;
return false;
}
@@ -1373,7 +1373,7 @@ bool OSLRenderServices::trace(TraceOpt &options,
/* Raytrace, leaving out shadow opaque to avoid early exit. */
uint visibility = PATH_RAY_ALL_VISIBILITY - PATH_RAY_SHADOW_OPAQUE;
- return scene_intersect(sd->osl_globals, ray, visibility, &tracedata->isect, NULL, 0.0f, 0.0f);
+ return scene_intersect(sd->osl_globals, ray, visibility, &tracedata->isect);
}
bool OSLRenderServices::getmessage(OSL::ShaderGlobals *sg,
diff --git a/intern/cycles/kernel/shaders/stdosl.h b/intern/cycles/kernel/shaders/stdosl.h
index 9b9720ffff9..6515d914909 100644
--- a/intern/cycles/kernel/shaders/stdosl.h
+++ b/intern/cycles/kernel/shaders/stdosl.h
@@ -235,15 +235,42 @@ int clamp(int x, int minval, int maxval)
return max(min(x, maxval), minval);
}
#if 0
-normal mix (normal x, normal y, normal a) { return x*(1-a) + y*a; }
-normal mix (normal x, normal y, float a) { return x*(1-a) + y*a; }
-vector mix (vector x, vector y, vector a) { return x*(1-a) + y*a; }
-vector mix (vector x, vector y, float a) { return x*(1-a) + y*a; }
-point mix (point x, point y, point a) { return x*(1-a) + y*a; }
-point mix (point x, point y, float a) { return x*(1-a) + y*a; }
-color mix (color x, color y, color a) { return x*(1-a) + y*a; }
-color mix (color x, color y, float a) { return x*(1-a) + y*a; }
-float mix (float x, float y, float a) { return x*(1-a) + y*a; }
+normal mix(normal x, normal y, normal a)
+{
+ return x * (1 - a) + y * a;
+}
+normal mix(normal x, normal y, float a)
+{
+ return x * (1 - a) + y * a;
+}
+vector mix(vector x, vector y, vector a)
+{
+ return x * (1 - a) + y * a;
+}
+vector mix(vector x, vector y, float a)
+{
+ return x * (1 - a) + y * a;
+}
+point mix(point x, point y, point a)
+{
+ return x * (1 - a) + y * a;
+}
+point mix(point x, point y, float a)
+{
+ return x * (1 - a) + y * a;
+}
+color mix(color x, color y, color a)
+{
+ return x * (1 - a) + y * a;
+}
+color mix(color x, color y, float a)
+{
+ return x * (1 - a) + y * a;
+}
+float mix(float x, float y, float a)
+{
+ return x * (1 - a) + y * a;
+}
#else
normal mix(normal x, normal y, normal a) BUILTIN;
normal mix(normal x, normal y, float a) BUILTIN;
@@ -360,16 +387,16 @@ point rotate(point p, float angle, point a, point b)
vector axis = normalize(b - a);
float cosang, sinang;
/* Older OSX has major issues with sincos() function,
- * it's likely a big in OSL or LLVM. For until we've
- * updated to new versions of this libraries we'll
- * use a workaround to prevent possible crashes on all
- * the platforms.
- *
- * Shouldn't be that bad because it's mainly used for
- * anisotropic shader where angle is usually constant.
- */
+ * it's likely a big in OSL or LLVM. For until we've
+ * updated to new versions of this libraries we'll
+ * use a workaround to prevent possible crashes on all
+ * the platforms.
+ *
+ * Shouldn't be that bad because it's mainly used for
+ * anisotropic shader where angle is usually constant.
+ */
#if 0
- sincos (angle, sinang, cosang);
+ sincos(angle, sinang, cosang);
#else
sinang = sin(angle);
cosang = cos(angle);
@@ -398,7 +425,7 @@ point rotate(point p, float angle, point a, point b)
normal ensure_valid_reflection(normal Ng, vector I, normal N)
{
/* The implementation here mirrors the one in kernel_montecarlo.h,
- * check there for an explanation of the algorithm. */
+ * check there for an explanation of the algorithm. */
float sqr(float x)
{
diff --git a/intern/cycles/kernel/split/kernel_buffer_update.h b/intern/cycles/kernel/split/kernel_buffer_update.h
index e77743350dc..e37be5b405e 100644
--- a/intern/cycles/kernel/split/kernel_buffer_update.h
+++ b/intern/cycles/kernel/split/kernel_buffer_update.h
@@ -132,8 +132,8 @@ ccl_device void kernel_buffer_update(KernelGlobals *kg,
if (ray->t != 0.0f) {
/* Initialize throughput, path radiance, Ray, PathState;
- * These rays proceed with path-iteration.
- */
+ * These rays proceed with path-iteration.
+ */
*throughput = make_float3(1.0f, 1.0f, 1.0f);
path_radiance_init(L, kernel_data.film.use_light_pass);
path_state_init(kg,
diff --git a/intern/cycles/kernel/split/kernel_data_init.h b/intern/cycles/kernel/split/kernel_data_init.h
index 52930843f56..2f83a10316d 100644
--- a/intern/cycles/kernel/split/kernel_data_init.h
+++ b/intern/cycles/kernel/split/kernel_data_init.h
@@ -46,10 +46,10 @@ void KERNEL_FUNCTION_FULL_NAME(data_init)(
int sh,
int offset,
int stride,
- ccl_global int *Queue_index, /* Tracks the number of elements in queues */
- int queuesize, /* size (capacity) of the queue */
- ccl_global char *
- use_queues_flag, /* flag to decide if scene-intersect kernel should use queues to fetch ray index */
+ ccl_global int *Queue_index, /* Tracks the number of elements in queues */
+ int queuesize, /* size (capacity) of the queue */
+ ccl_global char *use_queues_flag, /* flag to decide if scene-intersect kernel should use queues
+ to fetch ray index */
ccl_global unsigned int *work_pools, /* Work pool for each work group */
unsigned int num_samples,
ccl_global float *buffer)
diff --git a/intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h b/intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h
index 63bc5a8e0ce..5cd4131e2ae 100644
--- a/intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h
+++ b/intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h
@@ -114,9 +114,9 @@ ccl_device void kernel_holdout_emission_blurring_pathtermination_ao(
if (IS_STATE(ray_state, ray_index, RAY_ACTIVE)) {
/* Path termination. this is a strange place to put the termination, it's
- * mainly due to the mixed in MIS that we use. gives too many unneeded
- * shader evaluations, only need emission if we are going to terminate.
- */
+ * mainly due to the mixed in MIS that we use. gives too many unneeded
+ * shader evaluations, only need emission if we are going to terminate.
+ */
float probability = path_state_continuation_probability(kg, state, throughput);
if (probability == 0.0f) {
diff --git a/intern/cycles/kernel/split/kernel_next_iteration_setup.h b/intern/cycles/kernel/split/kernel_next_iteration_setup.h
index 781ce869374..3c2f6038035 100644
--- a/intern/cycles/kernel/split/kernel_next_iteration_setup.h
+++ b/intern/cycles/kernel/split/kernel_next_iteration_setup.h
@@ -109,9 +109,9 @@ ccl_device void kernel_next_iteration_setup(KernelGlobals *kg,
if (ccl_global_id(0) == 0 && ccl_global_id(1) == 0) {
/* If we are here, then it means that scene-intersect kernel
- * has already been executed atleast once. From the next time,
- * scene-intersect kernel may operate on queues to fetch ray index
- */
+ * has already been executed atleast once. From the next time,
+ * scene-intersect kernel may operate on queues to fetch ray index
+ */
*kernel_split_params.use_queues_flag = 1;
/* Mark queue indices of QUEUE_SHADOW_RAY_CAST_AO_RAYS and
diff --git a/intern/cycles/kernel/split/kernel_split_data_types.h b/intern/cycles/kernel/split/kernel_split_data_types.h
index 6ff3f5bdb55..ac4a450ca2b 100644
--- a/intern/cycles/kernel/split/kernel_split_data_types.h
+++ b/intern/cycles/kernel/split/kernel_split_data_types.h
@@ -19,7 +19,8 @@
CCL_NAMESPACE_BEGIN
-/* parameters used by the split kernels, we use a single struct to avoid passing these to each kernel */
+/* parameters used by the split kernels, we use a single struct to avoid passing these to each
+ * kernel */
typedef struct SplitParams {
WorkTile tile;
@@ -112,7 +113,8 @@ typedef ccl_global struct SplitBranchedState {
SPLIT_DATA_BRANCHED_ENTRIES \
SPLIT_DATA_ENTRY(ShaderData, _sd, 0)
-/* entries to be copied to inactive rays when sharing branched samples (TODO: which are actually needed?) */
+/* Entries to be copied to inactive rays when sharing branched samples
+ * (TODO: which are actually needed?) */
#define SPLIT_DATA_ENTRIES_BRANCHED_SHARED \
SPLIT_DATA_ENTRY(ccl_global float3, throughput, 1) \
SPLIT_DATA_ENTRY(PathRadiance, path_radiance, 1) \
@@ -134,8 +136,9 @@ typedef struct SplitData {
SPLIT_DATA_ENTRIES
#undef SPLIT_DATA_ENTRY
- /* this is actually in a separate buffer from the rest of the split state data (so it can be read back from
- * the host easily) but is still used the same as the other data so we have it here in this struct as well
+ /* this is actually in a separate buffer from the rest of the split state data (so it can be read
+ * back from the host easily) but is still used the same as the other data so we have it here in
+ * this struct as well
*/
ccl_global char *ray_state;
} SplitData;
diff --git a/intern/cycles/kernel/svm/svm_ao.h b/intern/cycles/kernel/svm/svm_ao.h
index 06076175c40..62413979201 100644
--- a/intern/cycles/kernel/svm/svm_ao.h
+++ b/intern/cycles/kernel/svm/svm_ao.h
@@ -1,18 +1,18 @@
/*
-* 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.
-*/
+ * 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.
+ */
CCL_NAMESPACE_BEGIN
@@ -70,7 +70,7 @@ ccl_device_noinline float svm_ao(KernelGlobals *kg,
}
else {
Intersection isect;
- if (!scene_intersect(kg, ray, PATH_RAY_SHADOW_OPAQUE, &isect, NULL, 0.0f, 0.0f)) {
+ if (!scene_intersect(kg, ray, PATH_RAY_SHADOW_OPAQUE, &isect)) {
unoccluded++;
}
}
diff --git a/intern/cycles/kernel/svm/svm_ies.h b/intern/cycles/kernel/svm/svm_ies.h
index 9434c0c5505..f13527c03db 100644
--- a/intern/cycles/kernel/svm/svm_ies.h
+++ b/intern/cycles/kernel/svm/svm_ies.h
@@ -21,12 +21,12 @@ CCL_NAMESPACE_BEGIN
ccl_device_inline float interpolate_ies_vertical(
KernelGlobals *kg, int ofs, int v, int v_num, float v_frac, int h)
{
- /* Since lookups are performed in spherical coordinates, clamping the coordinates at the low end of v
- * (corresponding to the north pole) would result in artifacts.
- * The proper way of dealing with this would be to lookup the corresponding value on the other side of the pole,
- * but since the horizontal coordinates might be nonuniform, this would require yet another interpolation.
- * Therefore, the assumtion is made that the light is going to be symmetrical, which means that we can just take
- * the corresponding value at the current horizontal coordinate. */
+ /* Since lookups are performed in spherical coordinates, clamping the coordinates at the low end
+ * of v (corresponding to the north pole) would result in artifacts. The proper way of dealing
+ * with this would be to lookup the corresponding value on the other side of the pole, but since
+ * the horizontal coordinates might be nonuniform, this would require yet another interpolation.
+ * Therefore, the assumtion is made that the light is going to be symmetrical, which means that
+ * we can just take the corresponding value at the current horizontal coordinate. */
#define IES_LOOKUP(v) kernel_tex_fetch(__ies, ofs + h * v_num + (v))
/* If v is zero, assume symmetry and read at v=1 instead of v=-1. */
@@ -66,7 +66,8 @@ ccl_device_inline float kernel_ies_interp(KernelGlobals *kg,
/* Lookup the angles to find the table position. */
int h_i, v_i;
- /* TODO(lukas): Consider using bisection. Probably not worth it for the vast majority of IES files. */
+ /* TODO(lukas): Consider using bisection.
+ * Probably not worth it for the vast majority of IES files. */
for (h_i = 0; IES_LOOKUP_ANGLE_H(h_i + 1) < h_angle; h_i++)
;
for (v_i = 0; IES_LOOKUP_ANGLE_V(v_i + 1) < v_angle; v_i++)
@@ -83,7 +84,8 @@ ccl_device_inline float kernel_ies_interp(KernelGlobals *kg,
/* Perform cubic interpolation along the horizontal coordinate to get the intensity value.
* If h_i is zero, just wrap around since the horizontal angles always go over the full circle.
- * However, the last entry (360°) equals the first one, so we need to wrap around to the one before that. */
+ * However, the last entry (360°) equals the first one, so we need to wrap around to the one
+ * before that. */
float a = interpolate_ies_vertical(
kg, ofs, v_i, v_num, v_frac, (h_i == 0) ? h_num - 2 : h_i - 1);
float b = interpolate_ies_vertical(kg, ofs, v_i, v_num, v_frac, h_i);
diff --git a/intern/cycles/kernel/svm/svm_voronoi.h b/intern/cycles/kernel/svm/svm_voronoi.h
index c311aefaf38..3e28a316169 100644
--- a/intern/cycles/kernel/svm/svm_voronoi.h
+++ b/intern/cycles/kernel/svm/svm_voronoi.h
@@ -70,7 +70,8 @@ ccl_device void voronoi_neighbors(
}
}
- /* To keep the shortest four distances and associated points we have to keep them in sorted order. */
+ /* To keep the shortest four distances and associated points we have to keep them in sorted
+ * order. */
if (d < da[0]) {
da[3] = da[2];
da[2] = da[1];
diff --git a/intern/cycles/render/attribute.cpp b/intern/cycles/render/attribute.cpp
index dad6cb4fe6d..f1341d50b9d 100644
--- a/intern/cycles/render/attribute.cpp
+++ b/intern/cycles/render/attribute.cpp
@@ -251,6 +251,9 @@ void Attribute::add_with_weight(void *dst, void *src, float weight)
else if (same_storage(type, TypeDesc::TypeFloat)) {
*((float *)dst) += *((float *)src) * weight;
}
+ else if (same_storage(type, TypeFloat2)) {
+ *((float2 *)dst) += *((float2 *)src) * weight;
+ }
else if (same_storage(type, TypeDesc::TypeVector)) {
*((float4 *)dst) += *((float4 *)src) * weight;
}
diff --git a/intern/cycles/render/camera.cpp b/intern/cycles/render/camera.cpp
index 9c9070c8a90..baa3ce77f84 100644
--- a/intern/cycles/render/camera.cpp
+++ b/intern/cycles/render/camera.cpp
@@ -642,7 +642,8 @@ float Camera::world_to_raster_size(float3 P)
float3 D = normalize(Ddiff);
res = len(dist * dDdx - dot(dist * dDdx, D) * D);
- /* Decent approx distance to frustum (doesn't handle corners correctly, but not that big of a deal) */
+ /* Decent approx distance to frustum
+ * (doesn't handle corners correctly, but not that big of a deal) */
float f_dist = 0.0f;
if (offscreen_dicing_scale > 1.0f) {
@@ -686,7 +687,8 @@ float Camera::world_to_raster_size(float3 P)
f_dist = max(f_dist, *d);
}
else {
- /* Possibly far enough behind the frustum to use distance to origin instead of edge */
+ /* Possibly far enough behind the frustum to use distance to origin instead of edge
+ */
test_o = true;
}
}
@@ -716,10 +718,17 @@ float Camera::world_to_raster_size(float3 P)
float3 raster = transform_perspective(&full_cameratoraster, make_float3(dir.x, dir.y, 0.0f));
ray.t = 1.0f;
- camera_sample_panorama(&kernel_camera, kernel_camera_motion.data(), raster.x, raster.y, 0.0f, 0.0f, &ray);
- if(ray.t == 0.0f) {
+ camera_sample_panorama(
+ &kernel_camera, kernel_camera_motion.data(), raster.x, raster.y, 0.0f, 0.0f, &ray);
+ if (ray.t == 0.0f) {
/* No differentials, just use from directly ahead. */
- camera_sample_panorama(&kernel_camera, kernel_camera_motion.data(), 0.5f*full_width, 0.5f*full_height, 0.0f, 0.0f, &ray);
+ camera_sample_panorama(&kernel_camera,
+ kernel_camera_motion.data(),
+ 0.5f * full_width,
+ 0.5f * full_height,
+ 0.0f,
+ 0.0f,
+ &ray);
}
#else
camera_sample_panorama(&kernel_camera,
diff --git a/intern/cycles/render/curves.cpp b/intern/cycles/render/curves.cpp
index 49ab70541c2..66fbc9eb4a8 100644
--- a/intern/cycles/render/curves.cpp
+++ b/intern/cycles/render/curves.cpp
@@ -88,9 +88,6 @@ CurveSystemManager::CurveSystemManager()
resolution = 3;
subdivisions = 3;
- minimum_width = 0.0f;
- maximum_width = 0.0f;
-
use_curves = true;
use_encasing = true;
use_backfacing = false;
@@ -138,8 +135,6 @@ void CurveSystemManager::device_update(Device *device,
if (use_encasing)
kcurve->curveflags |= CURVE_KN_ENCLOSEFILTER;
- kcurve->minimum_width = minimum_width;
- kcurve->maximum_width = maximum_width;
kcurve->subdivisions = subdivisions;
}
@@ -160,8 +155,6 @@ bool CurveSystemManager::modified(const CurveSystemManager &CurveSystemManager)
line_method == CurveSystemManager.line_method && primitive == CurveSystemManager.primitive &&
use_encasing == CurveSystemManager.use_encasing &&
use_tangent_normal_geometry == CurveSystemManager.use_tangent_normal_geometry &&
- minimum_width == CurveSystemManager.minimum_width &&
- maximum_width == CurveSystemManager.maximum_width &&
use_backfacing == CurveSystemManager.use_backfacing &&
triangle_method == CurveSystemManager.triangle_method &&
resolution == CurveSystemManager.resolution && use_curves == CurveSystemManager.use_curves &&
diff --git a/intern/cycles/render/curves.h b/intern/cycles/render/curves.h
index 81e7b4ac88d..ade289a402e 100644
--- a/intern/cycles/render/curves.h
+++ b/intern/cycles/render/curves.h
@@ -92,9 +92,6 @@ class CurveSystemManager {
int resolution;
int subdivisions;
- float minimum_width;
- float maximum_width;
-
bool use_curves;
bool use_encasing;
bool use_backfacing;
diff --git a/intern/cycles/render/denoising.cpp b/intern/cycles/render/denoising.cpp
index c4f21d9c771..82bbfa5f823 100644
--- a/intern/cycles/render/denoising.cpp
+++ b/intern/cycles/render/denoising.cpp
@@ -69,8 +69,8 @@ static void print_progress(int num, int total, int frame, int num_frames)
fflush(stdout);
}
-/* Splits in at its last dot, setting suffix to the part after the dot and in to the part before it.
- * Returns whether a dot was found. */
+/* Splits in at its last dot, setting suffix to the part after the dot and in to the part before
+ * it. Returns whether a dot was found. */
static bool split_last_dot(string &in, string &suffix)
{
size_t pos = in.rfind(".");
@@ -84,9 +84,8 @@ static bool split_last_dot(string &in, string &suffix)
/* Separate channel names as generated by Blender.
* If views is true:
- * Inputs are expected in the form RenderLayer.Pass.View.Channel, sets renderlayer to "RenderLayer.View"
- * Otherwise:
- * Inputs are expected in the form RenderLayer.Pass.Channel */
+ * Inputs are expected in the form RenderLayer.Pass.View.Channel, sets renderlayer to
+ * "RenderLayer.View" Otherwise: Inputs are expected in the form RenderLayer.Pass.Channel */
static bool parse_channel_name(
string name, string &renderlayer, string &pass, string &channel, bool multiview_channels)
{
@@ -631,7 +630,8 @@ bool DenoiseImage::parse_channels(const ImageSpec &in_spec, string &error)
layer.name = name;
layer.samples = samples;
- /* If the sample value isn't set yet, check if there is a layer-specific one in the input file. */
+ /* If the sample value isn't set yet, check if there is a layer-specific one in the input file.
+ */
if (layer.samples < 1) {
string sample_string = in_spec.get_string_attribute("cycles." + name + ".samples", "");
if (sample_string != "") {
diff --git a/intern/cycles/render/denoising.h b/intern/cycles/render/denoising.h
index dcb842a4603..c234d00eb49 100644
--- a/intern/cycles/render/denoising.h
+++ b/intern/cycles/render/denoising.h
@@ -87,14 +87,17 @@ struct DenoiseImageLayer {
/* input_to_image_channel of the secondary frames, if any are used. */
vector<vector<int>> neighbor_input_to_image_channel;
- /* Write i-th channel of the processing output to output_to_image_channel[i]-th channel of the file. */
+ /* Write i-th channel of the processing output to output_to_image_channel[i]-th channel of the
+ * file. */
vector<int> output_to_image_channel;
- /* Detect whether this layer contains a full set of channels and set up the offsets accordingly. */
+ /* Detect whether this layer contains a full set of channels and set up the offsets accordingly.
+ */
bool detect_denoising_channels();
/* Map the channels of a secondary frame to the channels that are required for processing,
- * fill neighbor_input_to_image_channel if all are present or return false if a channel are missing. */
+ * fill neighbor_input_to_image_channel if all are present or return false if a channel are
+ * missing. */
bool match_channels(int neighbor,
const std::vector<string> &channelnames,
const std::vector<string> &neighbor_channelnames);
@@ -125,7 +128,8 @@ class DenoiseImage {
void free();
- /* Open the input image, parse its channels, open the output image and allocate the output buffer. */
+ /* Open the input image, parse its channels, open the output image and allocate the output
+ * buffer. */
bool load(const string &in_filepath, string &error);
/* Load neighboring frames. */
@@ -139,7 +143,8 @@ class DenoiseImage {
bool save_output(const string &out_filepath, string &error);
protected:
- /* Parse input file channels, separate them into DenoiseImageLayers, detect DenoiseImageLayers with full channel sets,
+ /* Parse input file channels, separate them into DenoiseImageLayers,
+ * detect DenoiseImageLayers with full channel sets,
* fill layers and set up the output channels and passthrough map. */
bool parse_channels(const ImageSpec &in_spec, string &error);
diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp
index c284c64b5bf..e5fd39f08b7 100644
--- a/intern/cycles/render/graph.cpp
+++ b/intern/cycles/render/graph.cpp
@@ -721,6 +721,13 @@ void ShaderGraph::compute_displacement_hash()
int link_id = (input->link) ? input->link->parent->id : 0;
md5.append((uint8_t *)&link_id, sizeof(link_id));
}
+
+ if (node->special_type == SHADER_SPECIAL_TYPE_OSL) {
+ /* Hash takes into account socket values, to detect changes
+ * in the code of the node we need an exception. */
+ OSLNode *oslnode = static_cast<OSLNode *>(node);
+ md5.append(oslnode->bytecode_hash);
+ }
}
displacement_hash = md5.get_hex();
diff --git a/intern/cycles/render/graph.h b/intern/cycles/render/graph.h
index a2c030fd226..b1aa5cf3168 100644
--- a/intern/cycles/render/graph.h
+++ b/intern/cycles/render/graph.h
@@ -61,7 +61,7 @@ enum ShaderNodeSpecialType {
SHADER_SPECIAL_TYPE_PROXY,
SHADER_SPECIAL_TYPE_AUTOCONVERT,
SHADER_SPECIAL_TYPE_GEOMETRY,
- SHADER_SPECIAL_TYPE_SCRIPT,
+ SHADER_SPECIAL_TYPE_OSL,
SHADER_SPECIAL_TYPE_IMAGE_SLOT,
SHADER_SPECIAL_TYPE_CLOSURE,
SHADER_SPECIAL_TYPE_COMBINE_CLOSURE,
diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp
index 54dacf5d1f4..f1622493455 100644
--- a/intern/cycles/render/mesh.cpp
+++ b/intern/cycles/render/mesh.cpp
@@ -839,8 +839,9 @@ void Mesh::add_undisplaced()
size_t size = attr->buffer_size(
this, (subdivision_type == SUBDIVISION_NONE) ? ATTR_PRIM_TRIANGLE : ATTR_PRIM_SUBD);
- /* Center points for ngons aren't stored in Mesh::verts but are included in size since they will be
- * calculated later, we subtract them from size here so we don't have an overflow while copying.
+ /* Center points for ngons aren't stored in Mesh::verts but are included in size since they will
+ * be calculated later, we subtract them from size here so we don't have an overflow while
+ * copying.
*/
size -= num_ngons * attr->data_sizeof();
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index f3572ee1585..16416a9a009 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -3888,7 +3888,7 @@ void ParticleInfoNode::attributes(Shader *shader, AttributeRequestSet *attribute
if (!output("Location")->links.empty())
attributes->add(ATTR_STD_PARTICLE);
#if 0 /* not yet supported */
- if(!output("Rotation")->links.empty())
+ if (!output("Rotation")->links.empty())
attributes->add(ATTR_STD_PARTICLE);
#endif
if (!output("Size")->links.empty())
@@ -3933,7 +3933,7 @@ void ParticleInfoNode::compile(SVMCompiler &compiler)
/* quaternion data is not yet supported by Cycles */
#if 0
out = output("Rotation");
- if(!out->links.empty()) {
+ if (!out->links.empty()) {
compiler.add_node(NODE_PARTICLE_INFO, NODE_INFO_PAR_ROTATION, compiler.stack_assign(out));
}
#endif
@@ -5718,7 +5718,7 @@ void SetNormalNode::compile(OSLCompiler &compiler)
OSLNode::OSLNode() : ShaderNode(new NodeType(NodeType::SHADER))
{
- special_type = SHADER_SPECIAL_TYPE_SCRIPT;
+ special_type = SHADER_SPECIAL_TYPE_OSL;
}
OSLNode::~OSLNode()
diff --git a/intern/cycles/render/shader.h b/intern/cycles/render/shader.h
index 600b0cc59d4..f74204df355 100644
--- a/intern/cycles/render/shader.h
+++ b/intern/cycles/render/shader.h
@@ -143,8 +143,10 @@ class Shader : public Node {
Shader();
~Shader();
- /* Checks whether the shader consists of just a emission node with fixed inputs that's connected directly to the output.
- * If yes, it sets the content of emission to the constant value (color * strength), which is then used for speeding up light evaluation. */
+ /* Checks whether the shader consists of just a emission node with fixed inputs that's connected
+ * directly to the output.
+ * If yes, it sets the content of emission to the constant value (color * strength), which is
+ * then used for speeding up light evaluation. */
bool is_constant_emission(float3 *emission);
void set_graph(ShaderGraph *graph);
diff --git a/intern/cycles/render/svm.cpp b/intern/cycles/render/svm.cpp
index d8e3e24f39e..040aa074f28 100644
--- a/intern/cycles/render/svm.cpp
+++ b/intern/cycles/render/svm.cpp
@@ -773,7 +773,8 @@ void SVMCompiler::compile_type(Shader *shader, ShaderGraph *graph, ShaderType ty
compile_failed = false;
}
- /* for bump shaders we fall thru to the surface shader, but if this is any other kind of shader it ends here */
+ /* for bump shaders we fall thru to the surface shader, but if this is any other kind of shader
+ * it ends here */
if (type != SHADER_TYPE_BUMP) {
add_node(NODE_END, 0, 0, 0);
}
@@ -828,7 +829,8 @@ void SVMCompiler::compile(
{
scoped_timer timer((summary != NULL) ? &summary->time_generate_surface : NULL);
compile_type(shader, shader->graph, SHADER_TYPE_SURFACE);
- /* only set jump offset if there's no bump shader, as the bump shader will fall thru to this one if it exists */
+ /* only set jump offset if there's no bump shader, as the bump shader will fall thru to this
+ * one if it exists */
if (!has_bump) {
svm_nodes[index].y = svm_nodes.size();
}
diff --git a/intern/cycles/render/tile.cpp b/intern/cycles/render/tile.cpp
index 3148b5ef664..9ef0c695667 100644
--- a/intern/cycles/render/tile.cpp
+++ b/intern/cycles/render/tile.cpp
@@ -170,8 +170,9 @@ void TileManager::set_samples(int num_samples_)
}
else {
uint64_t pixel_samples = 0;
- /* While rendering in the viewport, the initial preview resolution is increased to the native resolution
- * before the actual rendering begins. Therefore, additional pixel samples will be rendered. */
+ /* While rendering in the viewport, the initial preview resolution is increased to the native
+ * resolution before the actual rendering begins. Therefore, additional pixel samples will be
+ * rendered. */
int divider = max(get_divider(params.width, params.height, start_resolution) / 2, pixel_size);
while (divider > pixel_size) {
int image_w = max(1, params.width / divider);
@@ -190,8 +191,9 @@ void TileManager::set_samples(int num_samples_)
}
}
-/* If sliced is false, splits image into tiles and assigns equal amount of tiles to every render device.
- * If sliced is true, slice image into as much pieces as how many devices are rendering this image. */
+/* If sliced is false, splits image into tiles and assigns equal amount of tiles to every render
+ * device. If sliced is true, slice image into as much pieces as how many devices are rendering
+ * this image. */
int TileManager::gen_tiles(bool sliced)
{
int resolution = state.resolution_divider;
@@ -255,7 +257,8 @@ int TileManager::gen_tiles(bool sliced)
}
int2 pos = block * block_size + tile * tile_size + offset;
- /* Only add tiles which are in the image (tiles outside of the image can be generated since the spiral is always square). */
+ /* Only add tiles which are in the image (tiles outside of the image can be generated since
+ * the spiral is always square). */
if (pos.x >= 0 && pos.y >= 0 && pos.x < image_w && pos.y < image_h) {
int w = min(tile_size.x, image_w - pos.x);
int h = min(tile_size.y, image_h - pos.y);
@@ -336,7 +339,8 @@ int TileManager::gen_tiles(bool sliced)
cur_tiles++;
if (cur_tiles == tiles_per_device) {
- /* Tiles are already generated in Bottom-to-Top order, so no sort is necessary in that case. */
+ /* Tiles are already generated in Bottom-to-Top order, so no sort is necessary in that
+ * case. */
if (tile_order != TILE_BOTTOM_TO_TOP) {
tile_list->sort(TileComparator(tile_order, center, &state.tiles[0]));
}
@@ -398,7 +402,8 @@ int TileManager::get_neighbor_index(int index, int neighbor)
return ny * state.tile_stride + nx;
}
-/* Checks whether all neighbors of a tile (as well as the tile itself) are at least at state min_state. */
+/* Checks whether all neighbors of a tile (as well as the tile itself) are at least at state
+ * min_state. */
bool TileManager::check_neighbor_state(int index, Tile::State min_state)
{
if (index < 0 || state.tiles[index].state < min_state) {
@@ -415,7 +420,8 @@ bool TileManager::check_neighbor_state(int index, Tile::State min_state)
return true;
}
-/* Returns whether the tile should be written (and freed if no denoising is used) instead of updating. */
+/* Returns whether the tile should be written (and freed if no denoising is used) instead of
+ * updating. */
bool TileManager::finish_tile(int index, bool &delete_tile)
{
delete_tile = false;
@@ -432,7 +438,8 @@ bool TileManager::finish_tile(int index, bool &delete_tile)
return true;
}
state.tiles[index].state = Tile::RENDERED;
- /* For each neighbor and the tile itself, check whether all of its neighbors have been rendered. If yes, it can be denoised. */
+ /* For each neighbor and the tile itself, check whether all of its neighbors have been
+ * rendered. If yes, it can be denoised. */
for (int neighbor = 0; neighbor < 9; neighbor++) {
int nindex = get_neighbor_index(index, neighbor);
if (check_neighbor_state(nindex, Tile::RENDERED)) {
@@ -444,13 +451,15 @@ bool TileManager::finish_tile(int index, bool &delete_tile)
}
case Tile::DENOISE: {
state.tiles[index].state = Tile::DENOISED;
- /* For each neighbor and the tile itself, check whether all of its neighbors have been denoised. If yes, it can be freed. */
+ /* For each neighbor and the tile itself, check whether all of its neighbors have been
+ * denoised. If yes, it can be freed. */
for (int neighbor = 0; neighbor < 9; neighbor++) {
int nindex = get_neighbor_index(index, neighbor);
if (check_neighbor_state(nindex, Tile::DENOISED)) {
state.tiles[nindex].state = Tile::DONE;
/* It can happen that the tile just finished denoising and already can be freed here.
- * However, in that case it still has to be written before deleting, so we can't delete it yet. */
+ * However, in that case it still has to be written before deleting, so we can't delete
+ * it yet. */
if (neighbor == 8) {
delete_tile = true;
}
diff --git a/intern/cycles/subd/subd_split.cpp b/intern/cycles/subd/subd_split.cpp
index 803363bc240..e6603632ba7 100644
--- a/intern/cycles/subd/subd_split.cpp
+++ b/intern/cycles/subd/subd_split.cpp
@@ -141,7 +141,7 @@ void DiagSplit::split(QuadDice::SubPatch &sub, QuadDice::EdgeFactors &ef, int de
bool split_v = (ef.tv0 == DSPLIT_NON_UNIFORM || ef.tv1 == DSPLIT_NON_UNIFORM);
/* Split subpatches such that the ratio of T for opposite edges doesn't
- * exceed 1.5, this reduces over tessellation for some patches
+ * exceed 1.5, this reduces over tessellation for some patches
*/
bool tmp_split_v = split_v;
if (!split_u && min(ef.tu0, ef.tu1) > 8 && min(ef.tu0, ef.tu1) * 1.5f < max(ef.tu0, ef.tu1))
diff --git a/intern/cycles/util/util_color.h b/intern/cycles/util/util_color.h
index ca4c393f66e..85f241c6221 100644
--- a/intern/cycles/util/util_color.h
+++ b/intern/cycles/util/util_color.h
@@ -167,7 +167,8 @@ ccl_device float3 xyY_to_xyz(float x, float y, float Y)
#ifdef __KERNEL_SSE2__
/*
* Calculate initial guess for arg^exp based on float representation
- * This method gives a constant bias, which can be easily compensated by multiplication with bias_coeff.
+ * This method gives a constant bias,
+ * which can be easily compensated by multiplication with bias_coeff.
* Gives better results for exponents near 1 (e. g. 4/5).
* exp = exponent, encoded as uint32_t
* e2coeff = 2^(127/exponent - 127) * bias_coeff^(1/exponent), encoded as uint32_t
diff --git a/intern/cycles/util/util_debug.h b/intern/cycles/util/util_debug.h
index d668ddc6d6c..83d9e96ffa5 100644
--- a/intern/cycles/util/util_debug.h
+++ b/intern/cycles/util/util_debug.h
@@ -141,7 +141,8 @@ class DebugFlags {
/* Use debug version of the kernel. */
bool debug;
- /* TODO(mai): Currently this is only for OpenCL, but we should have it implemented for all devices. */
+ /* TODO(mai): Currently this is only for OpenCL, but we should have it implemented for all
+ * devices. */
/* Artificial memory limit in bytes (0 if disabled). */
size_t mem_limit;
};
diff --git a/intern/cycles/util/util_half.h b/intern/cycles/util/util_half.h
index 9c40f5310c2..647e9cf2fd6 100644
--- a/intern/cycles/util/util_half.h
+++ b/intern/cycles/util/util_half.h
@@ -36,7 +36,8 @@ CCL_NAMESPACE_BEGIN
/* CUDA has its own half data type, no need to define then */
# ifndef __KERNEL_CUDA__
-/* Implementing this as a class rather than a typedef so that the compiler can tell it apart from unsigned shorts. */
+/* Implementing this as a class rather than a typedef so that the compiler can tell it apart from
+ * unsigned shorts. */
class half {
public:
half() : v(0)
diff --git a/intern/cycles/util/util_ies.cpp b/intern/cycles/util/util_ies.cpp
index ff5c709b406..7c24a4ec28c 100644
--- a/intern/cycles/util/util_ies.cpp
+++ b/intern/cycles/util/util_ies.cpp
@@ -155,7 +155,8 @@ bool IESFile::parse(ustring ies)
type = (IESType)parser.get_long(); /* Photometric type */
/* TODO(lukas): Test whether the current type B processing can also deal with type A files.
- * In theory the only difference should be orientation which we ignore anyways, but with IES you never know...
+ * In theory the only difference should be orientation which we ignore anyways, but with IES you
+ * never know...
*/
if (type != TYPE_B && type != TYPE_C) {
return false;
@@ -173,12 +174,13 @@ bool IESFile::parse(ustring ies)
* Cycles expects radiometric quantities, though, which requires a conversion.
* However, the Luminous efficacy (ratio of lumens per Watt) depends on the spectral distribution
* of the light source since lumens take human perception into account.
- * Since this spectral distribution is not known from the IES file, a typical one must be assumed.
- * The D65 standard illuminant has a Luminous efficacy of 177.83, which is used here to convert to Watt/sr.
- * A more advanced approach would be to add a Blackbody Temperature input to the node and numerically
- * integrate the Luminous efficacy from the resulting spectral distribution.
- * Also, the Watt/sr value must be multiplied by 4*pi to get the Watt value that Cycles expects
- * for lamp strength. Therefore, the conversion here uses 4*pi/177.83 as a Candela to Watt factor.
+ * Since this spectral distribution is not known from the IES file, a typical one must be
+ * assumed. The D65 standard illuminant has a Luminous efficacy of 177.83, which is used here to
+ * convert to Watt/sr. A more advanced approach would be to add a Blackbody Temperature input to
+ * the node and numerically integrate the Luminous efficacy from the resulting spectral
+ * distribution. Also, the Watt/sr value must be multiplied by 4*pi to get the Watt value that
+ * Cycles expects for lamp strength. Therefore, the conversion here uses 4*pi/177.83 as a Candela
+ * to Watt factor.
*/
factor *= 0.0706650768394;
@@ -294,7 +296,8 @@ bool IESFile::process_type_b()
bool IESFile::process_type_c()
{
if (h_angles[0] == 90.0f) {
- /* Some files are stored from 90° to 270°, so we just rotate them to the regular 0°-180° range here. */
+ /* Some files are stored from 90° to 270°, so we just rotate them to the regular 0°-180° range
+ * here. */
for (int i = 0; i < h_angles.size(); i++) {
h_angles[i] -= 90.0f;
}
@@ -311,8 +314,9 @@ bool IESFile::process_type_c()
if (h_angles[h_angles.size() - 1] == 90.0f) {
/* Only one quadrant is defined, so we need to mirror twice (from one to two, then to four).
- * Since the two->four mirroring step might also be required if we get an input of two quadrants,
- * we only do the first mirror here and later do the second mirror in either case. */
+ * Since the two->four mirroring step might also be required if we get an input of two
+ * quadrants, we only do the first mirror here and later do the second mirror in either case.
+ */
int hnum = h_angles.size();
for (int i = hnum - 2; i >= 0; i--) {
h_angles.push_back(180.0f - h_angles[i]);
@@ -329,8 +333,8 @@ bool IESFile::process_type_c()
}
}
- /* Some files skip the 360° entry (contrary to standard) because it's supposed to be identical to the 0° entry.
- * If the file has a discernible order in its spacing, just fix this. */
+ /* Some files skip the 360° entry (contrary to standard) because it's supposed to be identical to
+ * the 0° entry. If the file has a discernible order in its spacing, just fix this. */
if (h_angles[h_angles.size() - 1] != 360.0f) {
int hnum = h_angles.size();
float last_step = h_angles[hnum - 1] - h_angles[hnum - 2];
diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h
index 2c7f826db93..92cab29346a 100644
--- a/intern/cycles/util/util_math.h
+++ b/intern/cycles/util/util_math.h
@@ -417,12 +417,12 @@ ccl_device_inline float triangle_area(const float3 v1, const float3 v2, const fl
ccl_device_inline void make_orthonormals(const float3 N, float3 *a, float3 *b)
{
#if 0
- if(fabsf(N.y) >= 0.999f) {
+ if (fabsf(N.y) >= 0.999f) {
*a = make_float3(1, 0, 0);
*b = make_float3(0, 0, 1);
return;
}
- if(fabsf(N.z) >= 0.999f) {
+ if (fabsf(N.z) >= 0.999f) {
*a = make_float3(1, 0, 0);
*b = make_float3(0, 1, 0);
return;
diff --git a/intern/cycles/util/util_math_fast.h b/intern/cycles/util/util_math_fast.h
index 872271666aa..dbed83ab84d 100644
--- a/intern/cycles/util/util_math_fast.h
+++ b/intern/cycles/util/util_math_fast.h
@@ -282,8 +282,10 @@ ccl_device float fast_acosf(float x)
const float m = (f < 1.0f) ? 1.0f - (1.0f - f) : 1.0f;
/* Based on http://www.pouet.net/topic.php?which=9132&page=2
* 85% accurate (ulp 0)
- * Examined 2130706434 values of acos: 15.2000597 avg ulp diff, 4492 max ulp, 4.51803e-05 max error // without "denormal crush"
- * Examined 2130706434 values of acos: 15.2007108 avg ulp diff, 4492 max ulp, 4.51803e-05 max error // with "denormal crush"
+ * Examined 2130706434 values of acos:
+ * 15.2000597 avg ulp diff, 4492 max ulp, 4.51803e-05 max error // without "denormal crush"
+ * Examined 2130706434 values of acos:
+ * 15.2007108 avg ulp diff, 4492 max ulp, 4.51803e-05 max error // with "denormal crush"
*/
const float a = sqrtf(1.0f - m) *
(1.5707963267f + m * (-0.213300989f + m * (0.077980478f + m * -0.02164095f)));
@@ -312,8 +314,10 @@ ccl_device float fast_atanf(float x)
const float s = 1.0f - (1.0f - k); /* Crush denormals. */
const float t = s * s;
/* http://mathforum.org/library/drmath/view/62672.html
- * Examined 4278190080 values of atan: 2.36864877 avg ulp diff, 302 max ulp, 6.55651e-06 max error // (with denormals)
- * Examined 4278190080 values of atan: 171160502 avg ulp diff, 855638016 max ulp, 6.55651e-06 max error // (crush denormals)
+ * Examined 4278190080 values of atan:
+ * 2.36864877 avg ulp diff, 302 max ulp, 6.55651e-06 max error // (with denormals)
+ * Examined 4278190080 values of atan:
+ * 171160502 avg ulp diff, 855638016 max ulp, 6.55651e-06 max error // (crush denormals)
*/
float r = s * madd(0.43157974f, t, 1.0f) / madd(madd(0.05831938f, t, 0.76443945f), t, 1.0f);
if (a > 1.0f) {
diff --git a/intern/cycles/util/util_math_intersect.h b/intern/cycles/util/util_math_intersect.h
index 95ac231c611..fa3a541eea9 100644
--- a/intern/cycles/util/util_math_intersect.h
+++ b/intern/cycles/util/util_math_intersect.h
@@ -163,7 +163,7 @@ ccl_device_forceinline bool ray_triangle_intersect(float3 ray_P,
/* Calculate geometry normal and denominator. */
const float3 Ng1 = cross(e1, e0);
- //const Vec3vfM Ng1 = stable_triangle_normal(e2,e1,e0);
+ // const Vec3vfM Ng1 = stable_triangle_normal(e2,e1,e0);
const float3 Ng = Ng1 + Ng1;
const float den = dot3(Ng, dir);
/* Avoid division by 0. */
diff --git a/intern/cycles/util/util_math_matrix.h b/intern/cycles/util/util_math_matrix.h
index fe80fab6ebd..e1c7d5d838f 100644
--- a/intern/cycles/util/util_math_matrix.h
+++ b/intern/cycles/util/util_math_matrix.h
@@ -110,7 +110,8 @@ ccl_device_inline void math_vec3_add_strided(
}
/* Elementary matrix operations.
- * Note: TriMatrix refers to a square matrix that is symmetric, and therefore its upper-triangular part isn't stored. */
+ * Note: TriMatrix refers to a square matrix that is symmetric,
+ * and therefore its upper-triangular part isn't stored. */
ccl_device_inline void math_trimatrix_add_diagonal(ccl_global float *A,
int n,
@@ -196,7 +197,8 @@ ccl_device void math_trimatrix_cholesky(ccl_global float *A, int n, int stride)
}
}
-/* Solve A*S=y for S given A and y, where A is symmetrical positive-semidefinite and both inputs are destroyed in the process.
+/* Solve A*S=y for S given A and y,
+ * where A is symmetrical positive-semidefinite and both inputs are destroyed in the process.
*
* We can apply Cholesky decomposition to find a lower triangular L so that L*Lt = A.
* With that we get (L*Lt)*S = L*(Lt*S) = L*b = y, defining b as Lt*S.
@@ -204,15 +206,16 @@ ccl_device void math_trimatrix_cholesky(ccl_global float *A, int n, int stride)
* Then, the remaining problem is Lt*S = b, which again can be solved easily.
*
* This is useful for solving the normal equation S=inv(Xt*W*X)*Xt*W*y, since Xt*W*X is
- * symmetrical positive-semidefinite by construction, so we can just use this function with A=Xt*W*X and y=Xt*W*y. */
+ * symmetrical positive-semidefinite by construction,
+ * so we can just use this function with A=Xt*W*X and y=Xt*W*y. */
ccl_device_inline void math_trimatrix_vec3_solve(ccl_global float *A,
ccl_global float3 *y,
int n,
int stride)
{
/* Since the first entry of the design row is always 1, the upper-left element of XtWX is a good
- * heuristic for the amount of pixels considered (with weighting), therefore the amount of correction
- * is scaled based on it. */
+ * heuristic for the amount of pixels considered (with weighting),
+ * therefore the amount of correction is scaled based on it. */
math_trimatrix_add_diagonal(A, n, 3e-7f * A[0], stride); /* Improve the numerical stability. */
math_trimatrix_cholesky(A, n, stride); /* Replace A with L so that L*Lt = A. */
@@ -234,8 +237,8 @@ ccl_device_inline void math_trimatrix_vec3_solve(ccl_global float *A,
}
/* Perform the Jacobi Eigenvalue Methon on matrix A.
- * A is assumed to be a symmetrical matrix, therefore only the lower-triangular part is ever accessed.
- * The algorithm overwrites the contents of A.
+ * A is assumed to be a symmetrical matrix, therefore only the lower-triangular part is ever
+ * accessed. The algorithm overwrites the contents of A.
*
* After returning, A will be overwritten with D, which is (almost) diagonal,
* and V will contain the eigenvectors of the original A in its rows (!),
@@ -263,7 +266,8 @@ ccl_device void math_matrix_jacobi_eigendecomposition(float *A,
}
if (off_diagonal < 1e-7f) {
/* The matrix has nearly reached diagonal form.
- * Since the eigenvalues are only used to determine truncation, their exact values aren't required - a relative error of a few ULPs won't matter at all. */
+ * Since the eigenvalues are only used to determine truncation, their exact values aren't
+ * required - a relative error of a few ULPs won't matter at all. */
break;
}
@@ -277,7 +281,8 @@ ccl_device void math_matrix_jacobi_eigendecomposition(float *A,
float element = MAT(A, n, row, col);
float abs_element = fabsf(element);
- /* If we're in a later sweep and the element already is very small, just set it to zero and skip the rotation. */
+ /* If we're in a later sweep and the element already is very small,
+ * just set it to zero and skip the rotation. */
if (sweep > 3 && abs_element <= singular_epsilon * fabsf(MAT(A, n, row, row)) &&
abs_element <= singular_epsilon * fabsf(MAT(A, n, col, col))) {
MAT(A, n, row, col) = 0.0f;
@@ -288,13 +293,16 @@ ccl_device void math_matrix_jacobi_eigendecomposition(float *A,
continue;
}
- /* If we're in one of the first sweeps and the element is smaller than the threshold, skip it. */
+ /* If we're in one of the first sweeps and the element is smaller than the threshold,
+ * skip it. */
if (sweep < 3 && (abs_element < threshold)) {
continue;
}
- /* Determine rotation: The rotation is characterized by its angle phi - or, in the actual implementation, sin(phi) and cos(phi).
- * To find those, we first compute their ratio - that might be unstable if the angle approaches 90°, so there's a fallback for that case.
+ /* Determine rotation: The rotation is characterized by its angle phi - or,
+ * in the actual implementation, sin(phi) and cos(phi).
+ * To find those, we first compute their ratio - that might be unstable if the angle
+ * approaches 90°, so there's a fallback for that case.
* Then, we compute sin(phi) and cos(phi) themselves. */
float singular_diff = MAT(A, n, row, row) - MAT(A, n, col, col);
float ratio;
@@ -310,7 +318,8 @@ ccl_device void math_matrix_jacobi_eigendecomposition(float *A,
float c = 1.0f / sqrtf(1.0f + ratio * ratio);
float s = ratio * c;
- /* To improve numerical stability by avoiding cancellation, the update equations are reformulized to use sin(phi) and tan(phi/2) instead. */
+ /* To improve numerical stability by avoiding cancellation, the update equations are
+ * reformulized to use sin(phi) and tan(phi/2) instead. */
float tan_phi_2 = s / (1.0f + c);
/* Update the singular values in the diagonal. */
@@ -330,7 +339,8 @@ ccl_device void math_matrix_jacobi_eigendecomposition(float *A,
MATS(M, n, r2, c2, stride) += s * (M1 - tan_phi_2 * M2); \
}
- /* Split into three parts to ensure correct accesses since we only store the lower-triangular part of A. */
+ /* Split into three parts to ensure correct accesses since we only store the
+ * lower-triangular part of A. */
for (int i = 0; i < col; i++)
ROT(A, col, i, row, i, 1);
for (int i = col + 1; i < row; i++)
diff --git a/intern/cycles/util/util_profiling.cpp b/intern/cycles/util/util_profiling.cpp
index e3edf219435..bbefbadd0fe 100644
--- a/intern/cycles/util/util_profiling.cpp
+++ b/intern/cycles/util/util_profiling.cpp
@@ -47,7 +47,8 @@ void Profiler::run()
}
if (cur_shader >= 0 && cur_shader < shader_samples.size()) {
- /* Only consider the active shader during events whose runtime significantly depends on it. */
+ /* Only consider the active shader during events whose runtime significantly depends on it.
+ */
if (((cur_event >= PROFILING_SHADER_EVAL) && (cur_event <= PROFILING_SUBSURFACE)) ||
((cur_event >= PROFILING_CLOSURE_EVAL) &&
(cur_event <= PROFILING_CLOSURE_VOLUME_SAMPLE))) {
diff --git a/intern/cycles/util/util_progress.h b/intern/cycles/util/util_progress.h
index f05e5b918f3..379beaeeefa 100644
--- a/intern/cycles/util/util_progress.h
+++ b/intern/cycles/util/util_progress.h
@@ -362,7 +362,8 @@ class Progress {
* It's used to display the sample count if only one tile is active. */
int current_tile_sample;
/* Stores the number of tiles that's already finished.
- * Used to determine whether all but the last tile are finished rendering, in which case the current_tile_sample is displayed. */
+ * Used to determine whether all but the last tile are finished rendering,
+ * in which case the current_tile_sample is displayed. */
int rendered_tiles, denoised_tiles;
double start_time, render_start_time;
diff --git a/intern/cycles/util/util_task.cpp b/intern/cycles/util/util_task.cpp
index 4b11ce73ea9..2f771e2717e 100644
--- a/intern/cycles/util/util_task.cpp
+++ b/intern/cycles/util/util_task.cpp
@@ -261,7 +261,7 @@ vector<int> distribute_threads_on_nodes(const int num_threads)
const int num_nodes = num_per_node_processors.size();
int thread_index = 0;
/* First pass: fill in all the nodes to their maximum.
- *
+ *
* If there is less threads than the overall nodes capacity, some of the
* nodes or parts of them will idle.
*
diff --git a/intern/cycles/util/util_transform.h b/intern/cycles/util/util_transform.h
index 13ca27c2fed..cfe71d696ed 100644
--- a/intern/cycles/util/util_transform.h
+++ b/intern/cycles/util/util_transform.h
@@ -328,11 +328,11 @@ ccl_device_inline float4 quat_interpolate(float4 q1, float4 q2, float t)
/* possible optimization: it might be possible to precompute theta/qperp */
- if(costheta > 0.9995f) {
+ if (costheta > 0.9995f) {
/* linear interpolation in degenerate case */
- return normalize((1.0f - t)*q1 + t*q2);
+ return normalize((1.0f - t) * q1 + t * q2);
}
- else {
+ else {
/* slerp */
float theta = acosf(clamp(costheta, -1.0f, 1.0f));
float4 qperp = normalize(q2 - q1 * costheta);
diff --git a/intern/cycles/util/util_types_float8.h b/intern/cycles/util/util_types_float8.h
index 7289e3298c3..27da120a4ba 100644
--- a/intern/cycles/util/util_types_float8.h
+++ b/intern/cycles/util/util_types_float8.h
@@ -1,30 +1,30 @@
/*
-* Original code Copyright 2017, Intel Corporation
-* Modifications Copyright 2018, Blender Foundation.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-*
-* * Redistributions of source code must retain the above copyright notice,
-* this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of Intel Corporation nor the names of its contributors
-* may be used to endorse or promote products derived from this software
-* without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
+ * Original code Copyright 2017, Intel Corporation
+ * Modifications Copyright 2018, Blender Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Intel Corporation nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
#ifndef __UTIL_TYPES_FLOAT8_H__
#define __UTIL_TYPES_FLOAT8_H__
diff --git a/intern/cycles/util/util_types_float8_impl.h b/intern/cycles/util/util_types_float8_impl.h
index 8ce3d81b1bb..4e4ea28c6a4 100644
--- a/intern/cycles/util/util_types_float8_impl.h
+++ b/intern/cycles/util/util_types_float8_impl.h
@@ -1,30 +1,30 @@
/*
-* Original code Copyright 2017, Intel Corporation
-* Modifications Copyright 2018, Blender Foundation.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-*
-* * Redistributions of source code must retain the above copyright notice,
-* this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of Intel Corporation nor the names of its contributors
-* may be used to endorse or promote products derived from this software
-* without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
+ * Original code Copyright 2017, Intel Corporation
+ * Modifications Copyright 2018, Blender Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Intel Corporation nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
#ifndef __UTIL_TYPES_FLOAT8_IMPL_H__
#define __UTIL_TYPES_FLOAT8_IMPL_H__
diff --git a/intern/dualcon/intern/MemoryAllocator.h b/intern/dualcon/intern/MemoryAllocator.h
index 933b9dea197..f39e8255521 100644
--- a/intern/dualcon/intern/MemoryAllocator.h
+++ b/intern/dualcon/intern/MemoryAllocator.h
@@ -81,8 +81,8 @@ template<int N> class MemoryAllocator : public VirtualMemoryAllocator {
int available;
/**
- * Allocate a memory block
- */
+ * Allocate a memory block
+ */
void allocateDataBlock()
{
// Allocate a data block
@@ -98,8 +98,8 @@ template<int N> class MemoryAllocator : public VirtualMemoryAllocator {
}
/**
- * Allocate a stack block, to store more deallocated objects
- */
+ * Allocate a stack block, to store more deallocated objects
+ */
void allocateStackBlock()
{
// Allocate a stack block
@@ -111,8 +111,8 @@ template<int N> class MemoryAllocator : public VirtualMemoryAllocator {
public:
/**
- * Constructor
- */
+ * Constructor
+ */
MemoryAllocator()
{
HEAP_UNIT = 1 << HEAP_BASE;
@@ -134,8 +134,8 @@ template<int N> class MemoryAllocator : public VirtualMemoryAllocator {
}
/**
- * Destructor
- */
+ * Destructor
+ */
void destroy()
{
int i;
@@ -150,8 +150,8 @@ template<int N> class MemoryAllocator : public VirtualMemoryAllocator {
}
/**
- * Allocation method
- */
+ * Allocation method
+ */
void *allocate()
{
if (available == 0) {
@@ -164,8 +164,8 @@ template<int N> class MemoryAllocator : public VirtualMemoryAllocator {
}
/**
- * De-allocation method
- */
+ * De-allocation method
+ */
void deallocate(void *obj)
{
if (available == stacksize) {
@@ -179,8 +179,8 @@ template<int N> class MemoryAllocator : public VirtualMemoryAllocator {
}
/**
- * Print information
- */
+ * Print information
+ */
void printInfo()
{
printf("Bytes: %d Used: %d Allocated: %d Maxfree: %d\n",
@@ -191,8 +191,8 @@ template<int N> class MemoryAllocator : public VirtualMemoryAllocator {
}
/**
- * Query methods
- */
+ * Query methods
+ */
int getAllocated()
{
return HEAP_UNIT * datablocknum - available;
diff --git a/intern/dualcon/intern/Projections.h b/intern/dualcon/intern/Projections.h
index fc650158a0b..dcd5de7dff0 100644
--- a/intern/dualcon/intern/Projections.h
+++ b/intern/dualcon/intern/Projections.h
@@ -32,11 +32,11 @@
#endif
/**
-* Structures and classes for computing projections of triangles onto
-* separating axes during scan conversion
-*
-* @author Tao Ju
-*/
+ * Structures and classes for computing projections of triangles onto
+ * separating axes during scan conversion
+ *
+ * @author Tao Ju
+ */
extern const int vertmap[8][3];
extern const int centmap[3][3][3][2];
@@ -45,9 +45,9 @@ extern const int facemap[6][4];
/* Axes:
* 0, 1, 2: cube face normals
- *
+ *
* 3: triangle normal
- *
+ *
* 4, 5, 6,
* 7, 8, 9,
* 10, 11, 12: cross of each triangle edge vector with each cube
diff --git a/intern/dualcon/intern/octree.cpp b/intern/dualcon/intern/octree.cpp
index 46783176fc1..a6fac6fed33 100644
--- a/intern/dualcon/intern/octree.cpp
+++ b/intern/dualcon/intern/octree.cpp
@@ -531,9 +531,11 @@ Node *Octree::trace(Node *newnode, int *st, int len, int depth, PathList *&paths
findPaths((Node **)nf, lf, df, nstf, depth - 1, cellProcFaceMask[i][2], conn[i]);
- //if(conn[i]) {
- // printPath(conn[i]);
- //}
+#if 0
+ if (conn[i]) {
+ printPath(conn[i]);
+ }
+#endif
}
// Connect paths
@@ -1045,14 +1047,19 @@ Node *Octree::patchSplitSingle(Node *newnode,
PathElement *pre2 = NULL;
int side = findPair(head, st[dir] + len / 2, dir, pre1, pre2);
- /*
- if(pre1 == pre2) {
- int edgelen =(dimen >> maxDepth);
- dc_printf("Location: %d %d %d Direction: %d Reso: %d\n", st[0]/edgelen, st[1]/edgelen, st[2]/edgelen, dir, len/edgelen);
- printPath(head);
- exit(0);
- }
- */
+#if 0
+ if (pre1 == pre2) {
+ int edgelen = (dimen >> maxDepth);
+ dc_printf("Location: %d %d %d Direction: %d Reso: %d\n",
+ st[0] / edgelen,
+ st[1] / edgelen,
+ st[2] / edgelen,
+ dir,
+ len / edgelen);
+ printPath(head);
+ exit(0);
+ }
+#endif
if (side) {
// Entirely on one side
@@ -1247,9 +1254,11 @@ Node *Octree::connectFace(
spt[(dir + walkdir) % 3] += mindimen;
}
- // dc_printf("new x,y: %d %d\n", ori[xdir] / edgelen, ori[ydir] / edgelen);
- // dc_printf("nori: %d %d %d alpha: %f walkdir: %d\n", nori[0], nori[1], nori[2], alpha, walkdir);
- // dc_printf("%f %f %f\n", spt[0], spt[1], spt[2]);
+#if 0
+ dc_printf("new x,y: %d %d\n", ori[xdir] / edgelen, ori[ydir] / edgelen);
+ dc_printf("nori: %d %d %d alpha: %f walkdir: %d\n", nori[0], nori[1], nori[2], alpha, walkdir);
+ dc_printf("%f %f %f\n", spt[0], spt[1], spt[2]);
+#endif
// Locate the current cells on both sides
newnode = locateCell(&newnode->internal, st, len, nori, dir, 1, nodeN, stN, lenN);
@@ -1436,8 +1445,20 @@ Node *Octree::locateCell(InternalNode *node,
}
#ifdef IN_DEBUG_MODE
- // dc_printf("In LOCATECELL index of ori(%d %d %d) with dir %d side %d in st(%d %d %d, %d) is: %d\n",
- // ori[0], ori[1], ori[2], dir, side, st[0], st[1], st[2], len, ind);
+# if 0
+ dc_printf(
+ "In LOCATECELL index of ori(%d %d %d) with dir %d side %d in st(%d %d %d, %d) is: %d\n",
+ ori[0],
+ ori[1],
+ ori[2],
+ dir,
+ side,
+ st[0],
+ st[1],
+ st[2],
+ len,
+ ind);
+# endif
#endif
rst[0] = st[0] + vertmap[ind][0] * len;
@@ -1481,12 +1502,15 @@ Node *Octree::locateCell(InternalNode *node,
void Octree::checkElement(PathElement * /*ele*/)
{
- /*
- if(ele != NULL && locateLeafCheck(ele->pos) != ele->node) {
- dc_printf("Screwed! at pos: %d %d %d\n", ele->pos[0]>>minshift, ele->pos[1]>>minshift, ele->pos[2]>>minshift);
- exit(0);
- }
- */
+#if 0
+ if (ele != NULL && locateLeafCheck(ele->pos) != ele->node) {
+ dc_printf("Screwed! at pos: %d %d %d\n",
+ ele->pos[0] >> minshift,
+ ele->pos[1] >> minshift,
+ ele->pos[2] >> minshift);
+ exit(0);
+ }
+#endif
}
void Octree::checkPath(PathElement *path)
@@ -1564,9 +1588,9 @@ void Octree::getFacePoint(PathElement *leaf, int dir, int &x, int &y, float &p,
avg[1] /= num;
avg[2] /= num;
- //avg[0] =(float) leaf->pos[0];
- //avg[1] =(float) leaf->pos[1];
- //avg[2] =(float) leaf->pos[2];
+ // avg[0] =(float) leaf->pos[0];
+ // avg[1] =(float) leaf->pos[1];
+ // avg[2] =(float) leaf->pos[2];
}
int xdir = (dir + 1) % 3;
@@ -1578,32 +1602,48 @@ void Octree::getFacePoint(PathElement *leaf, int dir, int &x, int &y, float &p,
#ifdef IN_DEBUG_MODE
// Is it outside?
// PathElement* leaf = leaf1->len < leaf2->len ? leaf1 : leaf2;
- /*
- float* m =(leaf == leaf1 ? m1 : m2);
- if(xf < leaf->pos[xdir] ||
- yf < leaf->pos[ydir] ||
- xf > leaf->pos[xdir] + leaf->len ||
- yf > leaf->pos[ydir] + leaf->len) {
- dc_printf("Outside cube(%d %d %d), %d : %d %d %f %f\n", leaf->pos[0], leaf->pos[1], leaf->pos[2], leaf->len,
- pos, dir, xf, yf);
-
- // For now, snap to cell
- xf = m[xdir];
- yf = m[ydir];
- }
- */
+# if 0
+ float *m = (leaf == leaf1 ? m1 : m2);
+ if (xf < leaf->pos[xdir] || yf < leaf->pos[ydir] || xf > leaf->pos[xdir] + leaf->len ||
+ yf > leaf->pos[ydir] + leaf->len) {
+ dc_printf("Outside cube(%d %d %d), %d : %d %d %f %f\n",
+ leaf->pos[0],
+ leaf->pos[1],
+ leaf->pos[2],
+ leaf->len,
+ pos,
+ dir,
+ xf,
+ yf);
- /*
- if(alpha < 0 || alpha > 1 ||
- xf < leaf->pos[xdir] || xf > leaf->pos[xdir] + leaf->len ||
- yf < leaf->pos[ydir] || yf > leaf->pos[ydir] + leaf->len) {
- dc_printf("Alpha: %f Address: %d and %d\n", alpha, leaf1->node, leaf2->node);
- dc_printf("GETFACEPOINT result:(%d %d %d) %d min:(%f %f %f);(%d %d %d) %d min:(%f %f %f).\n",
- leaf1->pos[0], leaf1->pos[1], leaf1->pos[2], leaf1->len, m1[0], m1[1], m1[2],
- leaf2->pos[0], leaf2->pos[1], leaf2->pos[2], leaf2->len, m2[0], m2[1], m2[2]);
- dc_printf("Face point at dir %d pos %d: %f %f\n", dir, pos, xf, yf);
- }
- */
+ // For now, snap to cell
+ xf = m[xdir];
+ yf = m[ydir];
+ }
+# endif
+
+# if 0
+ if (alpha < 0 || alpha > 1 || xf < leaf->pos[xdir] || xf > leaf->pos[xdir] + leaf->len ||
+ yf < leaf->pos[ydir] || yf > leaf->pos[ydir] + leaf->len) {
+ dc_printf("Alpha: %f Address: %d and %d\n", alpha, leaf1->node, leaf2->node);
+ dc_printf("GETFACEPOINT result:(%d %d %d) %d min:(%f %f %f);(%d %d %d) %d min:(%f %f %f).\n",
+ leaf1->pos[0],
+ leaf1->pos[1],
+ leaf1->pos[2],
+ leaf1->len,
+ m1[0],
+ m1[1],
+ m1[2],
+ leaf2->pos[0],
+ leaf2->pos[1],
+ leaf2->pos[2],
+ leaf2->len,
+ m2[0],
+ m2[1],
+ m2[2]);
+ dc_printf("Face point at dir %d pos %d: %f %f\n", dir, pos, xf, yf);
+ }
+# endif
#endif
// Get the integer and float part
@@ -1860,7 +1900,13 @@ int Octree::floodFill(LeafNode *leaf, int st[3], int len, int /*height*/, int th
// Queue processing
int nst[3], dir;
while (queue->popQueue(nst, dir) == 1) {
- // dc_printf("nst: %d %d %d, dir: %d\n", nst[0]/mindimen, nst[1]/mindimen, nst[2]/mindimen, dir);
+#if 0
+ dc_printf("nst: %d %d %d, dir: %d\n",
+ nst[0] / mindimen,
+ nst[1] / mindimen,
+ nst[2] / mindimen,
+ dir);
+#endif
// locations
int stMask[3][3] = {{0, 0 - len, 0 - len}, {0 - len, 0, 0 - len}, {0 - len, 0 - len, 0}};
int cst[2][3];
@@ -1920,7 +1966,13 @@ int Octree::floodFill(LeafNode *leaf, int st[3], int len, int /*height*/, int th
if (isInProcess(cs[cind], edge) == 0) {
setInProcessAll(est, edir);
queue->pushQueue(est, edir);
- // dc_printf("Pushed: est: %d %d %d, edir: %d\n", est[0]/len, est[1]/len, est[2]/len, edir);
+#if 0
+ dc_printf("Pushed: est: %d %d %d, edir: %d\n",
+ est[0] / len,
+ est[1] / len,
+ est[2] / len,
+ edir);
+#endif
total++;
}
}
@@ -1957,7 +2009,13 @@ int Octree::floodFill(LeafNode *leaf, int st[3], int len, int /*height*/, int th
// Queue processing
while (queue->popQueue(nst, dir) == 1) {
- // dc_printf("nst: %d %d %d, dir: %d\n", nst[0]/mindimen, nst[1]/mindimen, nst[2]/mindimen, dir);
+#if 0
+ dc_printf("nst: %d %d %d, dir: %d\n",
+ nst[0] / mindimen,
+ nst[1] / mindimen,
+ nst[2] / mindimen,
+ dir);
+#endif
// locations
int stMask[3][3] = {{0, 0 - len, 0 - len}, {0 - len, 0, 0 - len}, {0 - len, 0 - len, 0}};
int cst[2][3];
@@ -2016,7 +2074,13 @@ int Octree::floodFill(LeafNode *leaf, int st[3], int len, int /*height*/, int th
if (getEdgeParity(cs[cind], edge) == 1) {
flipParityAll(est, edir);
queue->pushQueue(est, edir);
- // dc_printf("Pushed: est: %d %d %d, edir: %d\n", est[0]/len, est[1]/len, est[2]/len, edir);
+#if 0
+ dc_printf("Pushed: est: %d %d %d, edir: %d\n",
+ est[0] / len,
+ est[1] / len,
+ est[2] / len,
+ edir);
+#endif
total++;
}
}
@@ -2283,10 +2347,10 @@ void Octree::generateMinimizer(Node *node, int st[3], int len, int height, int &
computeMinimizer(&node->leaf, st, len, rvalue);
// Update
- //float fnst[3];
+ // float fnst[3];
for (j = 0; j < 3; j++) {
rvalue[j] = rvalue[j] * range / dimen + origin[j];
- //fnst[j] = st[j] * range / dimen + origin[j];
+ // fnst[j] = st[j] * range / dimen + origin[j];
}
int mult = 0, smask = getSignMask(&node->leaf);
@@ -2329,7 +2393,7 @@ void Octree::generateMinimizer(Node *node, int st[3], int len, int height, int &
void Octree::processEdgeWrite(Node *node[4], int /*depth*/[4], int /*maxdep*/, int dir)
{
- //int color = 0;
+ // int color = 0;
int i = 3;
{
diff --git a/intern/dualcon/intern/octree.h b/intern/dualcon/intern/octree.h
index db945e36390..b2d88f0d2b5 100644
--- a/intern/dualcon/intern/octree.h
+++ b/intern/dualcon/intern/octree.h
@@ -987,12 +987,14 @@ class Octree {
const LeafNode *node = locateLeaf(nst);
if (e1) {
- // getEdgeIntersectionByIndex(node, femask[i][0], nstt, 1, pts[fmask[i][0]], norms[fmask[i][0]]);
+ // getEdgeIntersectionByIndex(node, femask[i][0], nstt, 1, pts[fmask[i][0]],
+ // norms[fmask[i][0]]);
getEdgeIntersectionByIndex(
node, femask[i][0], nst, len, pts[fmask[i][0]], norms[fmask[i][0]]);
}
if (e2) {
- // getEdgeIntersectionByIndex(node, femask[i][1], nstt, 1, pts[fmask[i][1]], norms[fmask[i][1]]);
+ // getEdgeIntersectionByIndex(node, femask[i][1], nstt, 1, pts[fmask[i][1]],
+ // norms[fmask[i][1]]);
getEdgeIntersectionByIndex(
node, femask[i][1], nst, len, pts[fmask[i][1]], norms[fmask[i][1]]);
}
@@ -1057,13 +1059,15 @@ class Octree {
int e2 = getStoredEdgesParity(node, femask[i][1]);
if (e1) {
- // getEdgeIntersectionByIndex(node, femask[i][0], nstt, 1, pts[fmask[i][0]], norms[fmask[i][0]]);
+ // getEdgeIntersectionByIndex(node, femask[i][0], nstt, 1, pts[fmask[i][0]],
+ // norms[fmask[i][0]]);
getEdgeIntersectionByIndex(
node, femask[i][0], nst, len, pts[fmask[i][0]], norms[fmask[i][0]]);
parity[fmask[i][0]] = 1;
}
if (e2) {
- // getEdgeIntersectionByIndex(node, femask[i][1], nstt, 1, pts[fmask[i][1]], norms[fmask[i][1]]);
+ // getEdgeIntersectionByIndex(node, femask[i][1], nstt, 1, pts[fmask[i][1]],
+ // norms[fmask[i][1]]);
getEdgeIntersectionByIndex(
node, femask[i][1], nst, len, pts[fmask[i][1]], norms[fmask[i][1]]);
parity[fmask[i][1]] = 1;
diff --git a/intern/ffmpeg/ffmpeg_compat.h b/intern/ffmpeg/ffmpeg_compat.h
index 1eafd409668..863fbd40bb0 100644
--- a/intern/ffmpeg/ffmpeg_compat.h
+++ b/intern/ffmpeg/ffmpeg_compat.h
@@ -1,7 +1,7 @@
/*
* compatibility macros to make every ffmpeg installation appear
* like the most current installation (wrapping some functionality sometimes)
- * it also includes all ffmpeg header files at once, no need to do it
+ * it also includes all ffmpeg header files at once, no need to do it
* separately.
*
* Copyright (c) 2011 Peter Schlaile
@@ -136,8 +136,8 @@ int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
#endif
-/* XXX TODO Probably fix to correct modern flags in code? Not sure how old FFMPEG we want to support though,
- * so for now this will do. */
+/* XXX TODO Probably fix to correct modern flags in code? Not sure how old FFMPEG we want to
+ * support though, so for now this will do. */
#ifndef FF_MIN_BUFFER_SIZE
# ifdef AV_INPUT_BUFFER_MIN_SIZE
@@ -215,8 +215,8 @@ int av_get_cropped_height_from_codec(AVCodecContext *pCodecCtx)
/* really bad hack to remove this dreadfull black bar at the bottom
with Canon footage and old ffmpeg versions.
(to fix this properly in older ffmpeg versions one has to write a new
- demuxer...)
-
+ demuxer...)
+
see the actual fix here for reference:
http://git.libav.org/?p=libav.git;a=commit;h=30f515091c323da59c0f1b533703dedca2f4b95d
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index 8bb6a670754..6c490e51b0d 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -155,7 +155,8 @@ extern void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle,
* The new window is added to the list of windows managed.
* Never explicitly delete the window, use disposeWindow() instead.
* \param systemhandle The handle to the system
- * \param title The name of the window (displayed in the title bar of the window if the OS supports it).
+ * \param title The name of the window
+ * (displayed in the title bar of the window if the OS supports it).
* \param left The coordinate of the left edge of the window.
* \param top The coordinate of the top edge of the window.
* \param width The width the window.
@@ -684,19 +685,14 @@ extern GHOST_TSuccess GHOST_SetSwapInterval(GHOST_WindowHandle windowhandle, int
/**
* Gets the current swap interval for swapBuffers.
- * \param windowhandle The handle to the window
- * \param intervalOut pointer to location to return swap interval (left untouched if there is an error)
+ * \param windowhandle: The handle to the window
+ * \param intervalOut: pointer to location to return swap interval
+ * (left untouched if there is an error)
* \return A boolean success indicator of if swap interval was successfully read.
*/
extern GHOST_TSuccess GHOST_GetSwapInterval(GHOST_WindowHandle windowhandle, int *intervalOut);
/**
- * Gets the current swap interval for swapBuffers.
- * \return Number of AA Samples (0 if there is no multisample buffer)
- */
-extern GHOST_TUns16 GHOST_GetNumOfAASamples(GHOST_WindowHandle windowhandle);
-
-/**
* Activates the drawing context of this window.
* \param windowhandle The handle to the window
* \return A success indicator.
@@ -790,7 +786,8 @@ extern GHOST_TSuccess GHOST_IsEmptyRectangle(GHOST_RectangleHandle rectanglehand
/**
* Returns whether this rectangle is valid.
- * Valid rectangles are rectangles that have m_l <= m_r and m_t <= m_b. Thus, empty rectangles are valid.
+ * Valid rectangles are rectangles that have m_l <= m_r and m_t <= m_b.
+ * Thus, empty rectangles are valid.
* \param rectanglehandle The handle to the rectangle
* \return Success value (true == valid rectangle)
*/
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index 66e37a525c0..3c93d21f30f 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -226,17 +226,18 @@ class GHOST_ISystem {
* Create a new window.
* The new window is added to the list of windows managed.
* Never explicitly delete the window, use disposeWindow() instead.
- * \param title The name of the window (displayed in the title bar of the window if the OS supports it).
- * \param left The coordinate of the left edge of the window.
- * \param top The coordinate of the top edge of the window.
- * \param width The width the window.
- * \param height The height the window.
- * \param state The state of the window when opened.
- * \param type The type of drawing context installed in this window.
+ * \param title: The name of the window
+ * (displayed in the title bar of the window if the OS supports it).
+ * \param left: The coordinate of the left edge of the window.
+ * \param top: The coordinate of the top edge of the window.
+ * \param width: The width the window.
+ * \param height: The height the window.
+ * \param state: The state of the window when opened.
+ * \param type: The type of drawing context installed in this window.
* \param glSettings: Misc OpenGL settings.
* \param exclusive: Use to show the window ontop and ignore others (used fullscreen).
- * \param parentWindow Parent (embedder) window
- * \return The new window (or 0 if creation failed).
+ * \param parentWindow: Parent (embedder) window
+ * \return The new window (or 0 if creation failed).
*/
virtual GHOST_IWindow *createWindow(const STR_String &title,
GHOST_TInt32 left,
@@ -287,8 +288,7 @@ class GHOST_ISystem {
virtual GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting &setting,
GHOST_IWindow **window,
const bool stereoVisual,
- const bool alphaBackground = 0,
- const GHOST_TUns16 numOfAASamples = 0) = 0;
+ const bool alphaBackground = 0) = 0;
/**
* Updates the resolution while in fullscreen mode.
diff --git a/intern/ghost/GHOST_IWindow.h b/intern/ghost/GHOST_IWindow.h
index 0b1b83c36a7..6a9e0b9588a 100644
--- a/intern/ghost/GHOST_IWindow.h
+++ b/intern/ghost/GHOST_IWindow.h
@@ -205,18 +205,13 @@ class GHOST_IWindow {
/**
* Gets the current swap interval for swapBuffers.
- * \param intervalOut pointer to location to return swap interval (left untouched if there is an error)
+ * \param intervalOut pointer to location to return swap interval
+ * (left untouched if there is an error)
* \return A boolean success indicator of if swap interval was successfully read.
*/
virtual GHOST_TSuccess getSwapInterval(int &intervalOut) = 0;
/**
- * Gets the current swap interval for swapBuffers.
- * \return Number of AA Samples (0 if there is no multisample buffer)
- */
- virtual GHOST_TUns16 getNumOfAASamples() = 0;
-
- /**
* Activates the drawing context of this window.
* \return A boolean success indicator.
*/
diff --git a/intern/ghost/GHOST_Rect.h b/intern/ghost/GHOST_Rect.h
index cd4eb936066..d4c05a7b8aa 100644
--- a/intern/ghost/GHOST_Rect.h
+++ b/intern/ghost/GHOST_Rect.h
@@ -77,23 +77,24 @@ class GHOST_Rect {
/**
* Sets all members of the rectangle.
- * \param l requested left coordinate of the rectangle
- * \param t requested top coordinate of the rectangle
- * \param r requested right coordinate of the rectangle
- * \param b requested bottom coordinate of the rectangle
+ * \param l: requested left coordinate of the rectangle.
+ * \param t: requested top coordinate of the rectangle.
+ * \param r: requested right coordinate of the rectangle.
+ * \param b: requested bottom coordinate of the rectangle.
*/
virtual inline void set(GHOST_TInt32 l, GHOST_TInt32 t, GHOST_TInt32 r, GHOST_TInt32 b);
/**
* Returns whether this rectangle is empty.
* Empty rectangles are rectangles that have width==0 and/or height==0.
- * \return boolean value (true==empty rectangle)
+ * \return boolean value (true==empty rectangle)
*/
virtual inline bool isEmpty() const;
/**
* Returns whether this rectangle is valid.
- * Valid rectangles are rectangles that have m_l <= m_r and m_t <= m_b. Thus, empty rectangles are valid.
+ * Valid rectangles are rectangles that have m_l <= m_r and m_t <= m_b.
+ * Thus, empty rectangles are valid.
* \return boolean value (true==valid rectangle)
*/
virtual inline bool isValid() const;
@@ -101,28 +102,28 @@ class GHOST_Rect {
/**
* Grows (or shrinks the rectangle).
* The method avoids negative insets making the rectangle invalid
- * \param i The amount of offset given to each extreme (negative values shrink the rectangle).
+ * \param i: The amount of offset given to each extreme (negative values shrink the rectangle).
*/
virtual void inset(GHOST_TInt32 i);
/**
* Does a union of the rectangle given and this rectangle.
* The result is stored in this rectangle.
- * \param r The rectangle that is input for the union operation.
+ * \param r: The rectangle that is input for the union operation.
*/
virtual inline void unionRect(const GHOST_Rect &r);
/**
* Grows the rectangle to included a point.
- * \param x The x-coordinate of the point.
- * \param y The y-coordinate of the point.
+ * \param x: The x-coordinate of the point.
+ * \param y: The y-coordinate of the point.
*/
virtual inline void unionPoint(GHOST_TInt32 x, GHOST_TInt32 y);
/**
* Grows the rectangle to included a point.
- * \param x The x-coordinate of the point.
- * \param y The y-coordinate of the point.
+ * \param x The x-coordinate of the point.
+ * \param y The y-coordinate of the point.
*/
virtual inline void wrapPoint(GHOST_TInt32 &x, GHOST_TInt32 &y, GHOST_TInt32 ofs);
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index 36678bcc913..faba5bb996a 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -49,7 +49,6 @@ typedef int GHOST_TInt32;
typedef unsigned int GHOST_TUns32;
typedef struct {
- GHOST_TUns16 numOfAASamples;
int flags;
} GHOST_GLSettings;
@@ -368,10 +367,14 @@ typedef enum {
} GHOST_TKey;
typedef enum {
- GHOST_kGrabDisable = 0, /* grab not set */
- GHOST_kGrabNormal, /* no cursor adjustments */
- GHOST_kGrabWrap, /* wrap the mouse location to prevent limiting screen bounds */
- GHOST_kGrabHide, /* hide the mouse while grabbing and restore the original location on release (numbuts) */
+ /** Grab not set. */
+ GHOST_kGrabDisable = 0,
+ /** No cursor adjustments. */
+ GHOST_kGrabNormal,
+ /** Wrap the mouse location to prevent limiting screen bounds. */
+ GHOST_kGrabWrap,
+ /** Hide the mouse while grabbing and restore the original location on release (numbuts). */
+ GHOST_kGrabHide,
} GHOST_TGrabCursorMode;
typedef void *GHOST_TEventDataPtr;
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index 8d9570a39f3..3848c723e5b 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -611,13 +611,6 @@ GHOST_TSuccess GHOST_GetSwapInterval(GHOST_WindowHandle windowhandle, int *inter
return window->getSwapInterval(*intervalOut);
}
-GHOST_TUns16 GHOST_GetNumOfAASamples(GHOST_WindowHandle windowhandle)
-{
- GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
-
- return window->getNumOfAASamples();
-}
-
GHOST_TSuccess GHOST_ActivateWindowDrawingContext(GHOST_WindowHandle windowhandle)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
diff --git a/intern/ghost/intern/GHOST_Context.h b/intern/ghost/intern/GHOST_Context.h
index ed7b63aa436..7937fd1f7c7 100644
--- a/intern/ghost/intern/GHOST_Context.h
+++ b/intern/ghost/intern/GHOST_Context.h
@@ -37,10 +37,8 @@ class GHOST_Context : public GHOST_IContext {
/**
* Constructor.
* \param stereoVisual Stereo visual for quad buffered stereo.
- * \param numOfAASamples Number of samples used for AA (zero if no AA)
*/
- GHOST_Context(bool stereoVisual, GHOST_TUns16 numOfAASamples)
- : m_stereoVisual(stereoVisual), m_numOfAASamples(numOfAASamples)
+ GHOST_Context(bool stereoVisual) : m_stereoVisual(stereoVisual)
{
}
@@ -121,19 +119,11 @@ class GHOST_Context : public GHOST_IContext {
return m_stereoVisual;
}
- /** Number of samples used in anti-aliasing, set to 0 if no AA */
- inline GHOST_TUns16 getNumOfAASamples() const
- {
- return m_numOfAASamples;
- }
-
protected:
void initContextGLEW();
bool m_stereoVisual;
- GHOST_TUns16 m_numOfAASamples;
-
static void initClearGL();
#ifdef WITH_CXX_GUARDEDALLOC
diff --git a/intern/ghost/intern/GHOST_ContextCGL.h b/intern/ghost/intern/GHOST_ContextCGL.h
index 648af1cc9c7..fd760837d45 100644
--- a/intern/ghost/intern/GHOST_ContextCGL.h
+++ b/intern/ghost/intern/GHOST_ContextCGL.h
@@ -44,7 +44,6 @@ class GHOST_ContextCGL : public GHOST_Context {
* Constructor.
*/
GHOST_ContextCGL(bool stereoVisual,
- GHOST_TUns16 numOfAASamples,
NSWindow *window,
NSOpenGLView *openGLView,
int contextProfileMask,
diff --git a/intern/ghost/intern/GHOST_ContextCGL.mm b/intern/ghost/intern/GHOST_ContextCGL.mm
index 9b4e1864adf..5b8bb643751 100644
--- a/intern/ghost/intern/GHOST_ContextCGL.mm
+++ b/intern/ghost/intern/GHOST_ContextCGL.mm
@@ -40,7 +40,6 @@ NSOpenGLContext *GHOST_ContextCGL::s_sharedOpenGLContext = nil;
int GHOST_ContextCGL::s_sharedCount = 0;
GHOST_ContextCGL::GHOST_ContextCGL(bool stereoVisual,
- GHOST_TUns16 numOfAASamples,
NSWindow *window,
NSOpenGLView *openGLView,
int contextProfileMask,
@@ -48,7 +47,7 @@ GHOST_ContextCGL::GHOST_ContextCGL(bool stereoVisual,
int contextMinorVersion,
int contextFlags,
int contextResetNotificationStrategy)
- : GHOST_Context(stereoVisual, numOfAASamples),
+ : GHOST_Context(stereoVisual),
m_openGLView(openGLView),
m_openGLContext(nil),
m_debug(contextFlags)
@@ -183,9 +182,7 @@ GHOST_TSuccess GHOST_ContextCGL::updateDrawingContext()
static void makeAttribList(std::vector<NSOpenGLPixelFormatAttribute> &attribs,
bool coreProfile,
bool stereoVisual,
- int numOfAASamples,
bool needAlpha,
- bool needStencil,
bool softwareGL)
{
attribs.clear();
@@ -207,9 +204,6 @@ static void makeAttribList(std::vector<NSOpenGLPixelFormatAttribute> &attribs,
attribs.push_back(NSOpenGLPFAAllowOfflineRenderers); // for automatic GPU switching
- attribs.push_back(NSOpenGLPFADepthSize);
- attribs.push_back((NSOpenGLPixelFormatAttribute)32);
-
if (stereoVisual)
attribs.push_back(NSOpenGLPFAStereo);
@@ -218,22 +212,6 @@ static void makeAttribList(std::vector<NSOpenGLPixelFormatAttribute> &attribs,
attribs.push_back((NSOpenGLPixelFormatAttribute)8);
}
- if (needStencil) {
- attribs.push_back(NSOpenGLPFAStencilSize);
- attribs.push_back((NSOpenGLPixelFormatAttribute)8);
- }
-
- if (numOfAASamples > 0) {
- // Multisample anti-aliasing
- attribs.push_back(NSOpenGLPFAMultisample);
-
- attribs.push_back(NSOpenGLPFASampleBuffers);
- attribs.push_back((NSOpenGLPixelFormatAttribute)1);
-
- attribs.push_back(NSOpenGLPFASamples);
- attribs.push_back((NSOpenGLPixelFormatAttribute)numOfAASamples);
- }
-
attribs.push_back((NSOpenGLPixelFormatAttribute)0);
}
@@ -263,57 +241,18 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
static const bool needAlpha = false;
#endif
-#ifdef GHOST_OPENGL_STENCIL
- static const bool needStencil = true;
-#else
- static const bool needStencil = false;
-#endif
-
static bool softwareGL = getenv("BLENDER_SOFTWAREGL"); // command-line argument would be better
GLint major = 0, minor = 0;
NSOpenGLPixelFormat *pixelFormat;
// TODO: keep pixel format for subsequent windows/contexts instead of recreating each time
- makeAttribList(attribs,
- m_coreProfile,
- m_stereoVisual,
- m_numOfAASamples,
- needAlpha,
- needStencil,
- softwareGL);
+ makeAttribList(attribs, m_coreProfile, m_stereoVisual, needAlpha, softwareGL);
pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:&attribs[0]];
- // Fall back to no multisampling if Antialiasing init failed
- if (m_numOfAASamples > 0 && pixelFormat == nil) {
- // XXX jwilkins: Does CGL only succeed when it makes an exact match on the number of samples?
- // Does this need to explicitly try for a lesser match before giving up?
- // (Now that I think about it, does WGL really require the code that it has for finding a lesser match?)
-
- attribs.clear();
- makeAttribList(attribs, m_coreProfile, m_stereoVisual, 0, needAlpha, needStencil, softwareGL);
- pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:&attribs[0]];
- }
-
if (pixelFormat == nil)
goto error;
- if (m_numOfAASamples > 0) { //Set m_numOfAASamples to the actual value
- GLint actualSamples;
- [pixelFormat getValues:&actualSamples forAttribute:NSOpenGLPFASamples forVirtualScreen:0];
-
- if (m_numOfAASamples != (GHOST_TUns16)actualSamples) {
- fprintf(
- stderr,
- "Warning! Unable to find a multisample pixel format that supports exactly %d samples. "
- "Substituting one that uses %d samples.\n",
- m_numOfAASamples,
- actualSamples);
-
- m_numOfAASamples = (GHOST_TUns16)actualSamples;
- }
- }
-
m_openGLContext = [[NSOpenGLContext alloc] initWithFormat:pixelFormat
shareContext:s_sharedOpenGLContext];
[pixelFormat release];
@@ -336,13 +275,7 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
[m_openGLContext release];
// create software GL context
- makeAttribList(attribs,
- m_coreProfile,
- m_stereoVisual,
- m_numOfAASamples,
- needAlpha,
- needStencil,
- softwareGL);
+ makeAttribList(attribs, m_coreProfile, m_stereoVisual, needAlpha, softwareGL);
pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:&attribs[0]];
m_openGLContext = [[NSOpenGLContext alloc] initWithFormat:pixelFormat
shareContext:s_sharedOpenGLContext];
@@ -358,7 +291,7 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
}
#ifdef GHOST_MULTITHREADED_OPENGL
- //Switch openGL to multhreaded mode
+ // Switch openGL to multhreaded mode
if (CGLEnable(CGLGetCurrentContext(), kCGLCEMPEngine) == kCGLNoError)
if (m_debug)
fprintf(stderr, "\nSwitched OpenGL to multithreaded mode\n");
diff --git a/intern/ghost/intern/GHOST_ContextEGL.cpp b/intern/ghost/intern/GHOST_ContextEGL.cpp
index 34df5f3119d..d4eeda2a9ef 100644
--- a/intern/ghost/intern/GHOST_ContextEGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextEGL.cpp
@@ -200,7 +200,6 @@ template<typename T> T &choose_api(EGLenum api, T &a, T &b, T &c)
}
GHOST_ContextEGL::GHOST_ContextEGL(bool stereoVisual,
- GHOST_TUns16 numOfAASamples,
EGLNativeWindowType nativeWindow,
EGLNativeDisplayType nativeDisplay,
EGLint contextProfileMask,
@@ -209,7 +208,7 @@ GHOST_ContextEGL::GHOST_ContextEGL(bool stereoVisual,
EGLint contextFlags,
EGLint contextResetNotificationStrategy,
EGLenum api)
- : GHOST_Context(stereoVisual, numOfAASamples),
+ : GHOST_Context(stereoVisual),
m_nativeDisplay(nativeDisplay),
m_nativeWindow(nativeWindow),
m_contextProfileMask(contextProfileMask),
@@ -435,22 +434,6 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
attrib_list.push_back(8);
#endif
- attrib_list.push_back(EGL_DEPTH_SIZE);
- attrib_list.push_back(24);
-
-#ifdef GHOST_OPENGL_STENCIL
- attrib_list.push_back(EGL_STENCIL_SIZE);
- attrib_list.push_back(8);
-#endif
-
- if (m_numOfAASamples > 0) {
- attrib_list.push_back(EGL_SAMPLE_BUFFERS);
- attrib_list.push_back(1);
-
- attrib_list.push_back(EGL_SAMPLES);
- attrib_list.push_back(m_numOfAASamples);
- }
-
attrib_list.push_back(EGL_NONE);
EGLConfig config;
@@ -462,24 +445,6 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
if (num_config != 1) // num_config should be exactly 1
goto error;
- if (m_numOfAASamples > 0) {
- EGLint actualSamples;
-
- if (!EGL_CHK(::eglGetConfigAttrib(m_display, config, EGL_SAMPLE_BUFFERS, &actualSamples)))
- goto error;
-
- if (m_numOfAASamples != actualSamples) {
- fprintf(
- stderr,
- "Warning! Unable to find a multisample pixel format that supports exactly %d samples. "
- "Substituting one that uses %d samples.\n",
- m_numOfAASamples,
- actualSamples);
-
- m_numOfAASamples = (GHOST_TUns16)actualSamples;
- }
- }
-
m_surface = ::eglCreateWindowSurface(m_display, config, m_nativeWindow, NULL);
if (!EGL_CHK(m_surface != EGL_NO_SURFACE))
diff --git a/intern/ghost/intern/GHOST_ContextEGL.h b/intern/ghost/intern/GHOST_ContextEGL.h
index 0a759493e4d..cd6b0c959b7 100644
--- a/intern/ghost/intern/GHOST_ContextEGL.h
+++ b/intern/ghost/intern/GHOST_ContextEGL.h
@@ -42,7 +42,6 @@ class GHOST_ContextEGL : public GHOST_Context {
* Constructor.
*/
GHOST_ContextEGL(bool stereoVisual,
- GHOST_TUns16 numOfAASamples,
EGLNativeWindowType nativeWindow,
EGLNativeDisplayType nativeDisplay,
EGLint contextProfileMask,
diff --git a/intern/ghost/intern/GHOST_ContextGLX.cpp b/intern/ghost/intern/GHOST_ContextGLX.cpp
index 6a5126d59b8..fac75f299fc 100644
--- a/intern/ghost/intern/GHOST_ContextGLX.cpp
+++ b/intern/ghost/intern/GHOST_ContextGLX.cpp
@@ -44,7 +44,6 @@ GLXContext GHOST_ContextGLX::s_sharedContext = None;
int GHOST_ContextGLX::s_sharedCount = 0;
GHOST_ContextGLX::GHOST_ContextGLX(bool stereoVisual,
- GHOST_TUns16 numOfAASamples,
Window window,
Display *display,
GLXFBConfig fbconfig,
@@ -53,7 +52,7 @@ GHOST_ContextGLX::GHOST_ContextGLX(bool stereoVisual,
int contextMinorVersion,
int contextFlags,
int contextResetNotificationStrategy)
- : GHOST_Context(stereoVisual, numOfAASamples),
+ : GHOST_Context(stereoVisual),
m_display(display),
m_fbconfig(fbconfig),
m_window(window),
@@ -260,7 +259,7 @@ GHOST_TSuccess GHOST_ContextGLX::initializeDrawingContext()
int glx_attribs[64];
int fbcount = 0;
- GHOST_X11_GL_GetAttributes(glx_attribs, 64, m_numOfAASamples, m_stereoVisual, false, true);
+ GHOST_X11_GL_GetAttributes(glx_attribs, 64, m_stereoVisual, false, true);
framebuffer_config = glXChooseFBConfig(
m_display, DefaultScreen(m_display), glx_attribs, &fbcount);
@@ -369,21 +368,11 @@ GHOST_TSuccess GHOST_ContextGLX::getSwapInterval(int &intervalOut)
*
* \note Similar to SDL's 'X11_GL_GetAttributes'
*/
-int GHOST_X11_GL_GetAttributes(int *attribs,
- int attribs_max,
- int samples,
- bool is_stereo_visual,
- bool need_alpha,
- bool for_fb_config)
+int GHOST_X11_GL_GetAttributes(
+ int *attribs, int attribs_max, bool is_stereo_visual, bool need_alpha, bool for_fb_config)
{
int i = 0;
-#ifdef GHOST_OPENGL_STENCIL
- const bool need_stencil = true;
-#else
- const bool need_stencil = false;
-#endif
-
if (is_stereo_visual) {
attribs[i++] = GLX_STEREO;
if (for_fb_config) {
@@ -413,27 +402,11 @@ int GHOST_X11_GL_GetAttributes(int *attribs,
attribs[i++] = GLX_GREEN_SIZE;
attribs[i++] = True;
- attribs[i++] = GLX_DEPTH_SIZE;
- attribs[i++] = True;
-
if (need_alpha) {
attribs[i++] = GLX_ALPHA_SIZE;
attribs[i++] = True;
}
- if (need_stencil) {
- attribs[i++] = GLX_STENCIL_SIZE;
- attribs[i++] = True;
- }
-
- if (samples) {
- attribs[i++] = GLX_SAMPLE_BUFFERS_ARB;
- attribs[i++] = True;
-
- attribs[i++] = GLX_SAMPLES_ARB;
- attribs[i++] = samples;
- }
-
attribs[i++] = 0;
GHOST_ASSERT(i <= attribs_max, "attribute size too small");
diff --git a/intern/ghost/intern/GHOST_ContextGLX.h b/intern/ghost/intern/GHOST_ContextGLX.h
index 5b631ea55de..ba8df7dac1b 100644
--- a/intern/ghost/intern/GHOST_ContextGLX.h
+++ b/intern/ghost/intern/GHOST_ContextGLX.h
@@ -43,7 +43,6 @@ class GHOST_ContextGLX : public GHOST_Context {
* Constructor.
*/
GHOST_ContextGLX(bool stereoVisual,
- GHOST_TUns16 numOfAASamples,
Window window,
Display *display,
GLXFBConfig fbconfig,
@@ -124,11 +123,7 @@ class GHOST_ContextGLX : public GHOST_Context {
};
/* used to get GLX info */
-int GHOST_X11_GL_GetAttributes(int *attribs,
- int attribs_max,
- int samples,
- bool is_stereo_visual,
- bool need_alpha,
- bool for_fb_config);
+int GHOST_X11_GL_GetAttributes(
+ int *attribs, int attribs_max, bool is_stereo_visual, bool need_alpha, bool for_fb_config);
#endif // __GHOST_CONTEXTGLX_H__
diff --git a/intern/ghost/intern/GHOST_ContextNone.h b/intern/ghost/intern/GHOST_ContextNone.h
index b7297d2497c..2a3c08701b4 100644
--- a/intern/ghost/intern/GHOST_ContextNone.h
+++ b/intern/ghost/intern/GHOST_ContextNone.h
@@ -30,8 +30,7 @@
class GHOST_ContextNone : public GHOST_Context {
public:
- GHOST_ContextNone(bool stereoVisual, GHOST_TUns16 numOfAASamples)
- : GHOST_Context(stereoVisual, numOfAASamples), m_swapInterval(1)
+ GHOST_ContextNone(bool stereoVisual) : GHOST_Context(stereoVisual), m_swapInterval(1)
{
}
diff --git a/intern/ghost/intern/GHOST_ContextSDL.cpp b/intern/ghost/intern/GHOST_ContextSDL.cpp
index 600cab6f6d5..bf0737e5efa 100644
--- a/intern/ghost/intern/GHOST_ContextSDL.cpp
+++ b/intern/ghost/intern/GHOST_ContextSDL.cpp
@@ -35,14 +35,13 @@ SDL_GLContext GHOST_ContextSDL::s_sharedContext = NULL;
int GHOST_ContextSDL::s_sharedCount = 0;
GHOST_ContextSDL::GHOST_ContextSDL(bool stereoVisual,
- GHOST_TUns16 numOfAASamples,
SDL_Window *window,
int contextProfileMask,
int contextMajorVersion,
int contextMinorVersion,
int contextFlags,
int contextResetNotificationStrategy)
- : GHOST_Context(stereoVisual, numOfAASamples),
+ : GHOST_Context(stereoVisual),
m_window(window),
m_hidden_window(NULL),
m_contextProfileMask(contextProfileMask),
@@ -113,12 +112,6 @@ GHOST_TSuccess GHOST_ContextSDL::initializeDrawingContext()
const bool needAlpha = false;
#endif
-#ifdef GHOST_OPENGL_STENCIL
- const bool needStencil = true;
-#else
- const bool needStencil = false;
-#endif
-
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, m_contextProfileMask);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, m_contextMajorVersion);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, m_contextMinorVersion);
@@ -126,7 +119,6 @@ GHOST_TSuccess GHOST_ContextSDL::initializeDrawingContext()
SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
- SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
@@ -135,19 +127,10 @@ GHOST_TSuccess GHOST_ContextSDL::initializeDrawingContext()
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
}
- if (needStencil) {
- SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 1);
- }
-
if (m_stereoVisual) {
SDL_GL_SetAttribute(SDL_GL_STEREO, 1);
}
- if (m_numOfAASamples) {
- SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
- SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, m_numOfAASamples);
- }
-
if (m_window == NULL) {
m_hidden_window = SDL_CreateWindow("Offscreen Context Windows",
SDL_WINDOWPOS_UNDEFINED,
diff --git a/intern/ghost/intern/GHOST_ContextSDL.h b/intern/ghost/intern/GHOST_ContextSDL.h
index bbd8dd5ad5e..670d930e1e7 100644
--- a/intern/ghost/intern/GHOST_ContextSDL.h
+++ b/intern/ghost/intern/GHOST_ContextSDL.h
@@ -48,7 +48,6 @@ class GHOST_ContextSDL : public GHOST_Context {
* Constructor.
*/
GHOST_ContextSDL(bool stereoVisual,
- GHOST_TUns16 numOfAASamples,
SDL_Window *window,
int contextProfileMask,
int contextMajorVersion,
diff --git a/intern/ghost/intern/GHOST_ContextWGL.cpp b/intern/ghost/intern/GHOST_ContextWGL.cpp
index 96d6e0c1600..d4851450ce8 100644
--- a/intern/ghost/intern/GHOST_ContextWGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextWGL.cpp
@@ -42,7 +42,6 @@ static bool is_crappy_intel_card()
GHOST_ContextWGL::GHOST_ContextWGL(bool stereoVisual,
bool alphaBackground,
- GHOST_TUns16 numOfAASamples,
HWND hWnd,
HDC hDC,
int contextProfileMask,
@@ -50,7 +49,7 @@ GHOST_ContextWGL::GHOST_ContextWGL(bool stereoVisual,
int contextMinorVersion,
int contextFlags,
int contextResetNotificationStrategy)
- : GHOST_Context(stereoVisual, numOfAASamples),
+ : GHOST_Context(stereoVisual),
m_hWnd(hWnd),
m_hDC(hDC),
m_contextProfileMask(contextProfileMask),
@@ -154,7 +153,7 @@ static int weight_pixel_format(PIXELFORMATDESCRIPTOR &pfd, PIXELFORMATDESCRIPTOR
/* if no formats can be found, can we determine why it was rejected? */
if (!(pfd.dwFlags & PFD_SUPPORT_OPENGL) || !(pfd.dwFlags & PFD_DRAW_TO_WINDOW) ||
!(pfd.dwFlags & PFD_DOUBLEBUFFER) || /* Blender _needs_ this */
- !(pfd.iPixelType == PFD_TYPE_RGBA) || (pfd.cDepthBits < 16) ||
+ !(pfd.iPixelType == PFD_TYPE_RGBA) ||
(pfd.cColorBits > 32) || /* 64 bit formats disable aero */
(pfd.dwFlags & PFD_GENERIC_FORMAT)) /* no software renderers */
{
@@ -163,10 +162,6 @@ static int weight_pixel_format(PIXELFORMATDESCRIPTOR &pfd, PIXELFORMATDESCRIPTOR
weight = 1; /* it's usable */
- /* the bigger the depth buffer the better */
- /* give no weight to a 16-bit depth buffer, because those are crap */
- weight += pfd.cDepthBits - 16;
-
weight += pfd.cColorBits - 8;
if (preferredPFD.cAlphaBits > 0 && pfd.cAlphaBits > 0)
@@ -175,10 +170,6 @@ static int weight_pixel_format(PIXELFORMATDESCRIPTOR &pfd, PIXELFORMATDESCRIPTOR
if ((preferredPFD.dwFlags & PFD_SUPPORT_COMPOSITION) && (pfd.dwFlags & PFD_SUPPORT_COMPOSITION))
weight++;
#endif
-#ifdef GHOST_OPENGL_STENCIL
- if (pfd.cStencilBits >= 8)
- weight++;
-#endif
return weight;
}
@@ -235,11 +226,11 @@ static int choose_pixel_format_legacy(HDC hDC, PIXELFORMATDESCRIPTOR &preferredP
return iPixelFormat;
}
-/*
+/**
* Clone a window for the purpose of creating a temporary context to initialize WGL extensions.
- * There is no generic way to clone the lpParam parameter, so the caller is responsible for cloning it themselves.
+ * There is no generic way to clone the lpParam parameter,
+ * so the caller is responsible for cloning it themselves.
*/
-
static HWND clone_window(HWND hWnd, LPVOID lpParam)
{
int count;
@@ -373,12 +364,7 @@ finalize:
}
}
-static void makeAttribList(std::vector<int> &out,
- bool stereoVisual,
- int numOfAASamples,
- bool needAlpha,
- bool needStencil,
- bool sRGB)
+static void makeAttribList(std::vector<int> &out, bool stereoVisual, bool needAlpha)
{
out.clear();
out.reserve(30);
@@ -406,37 +392,15 @@ static void makeAttribList(std::vector<int> &out,
out.push_back(WGL_COLOR_BITS_ARB);
out.push_back(24);
- out.push_back(WGL_DEPTH_BITS_ARB);
- out.push_back(24);
-
if (needAlpha) {
out.push_back(WGL_ALPHA_BITS_ARB);
out.push_back(8);
}
- if (needStencil) {
- out.push_back(WGL_STENCIL_BITS_ARB);
- out.push_back(8);
- }
-
- if (numOfAASamples > 0) {
- out.push_back(WGL_SAMPLES_ARB);
- out.push_back(numOfAASamples);
-
- out.push_back(WGL_SAMPLE_BUFFERS_ARB);
- out.push_back(GL_TRUE);
- }
-
- if (sRGB) {
- out.push_back(WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB);
- out.push_back(GL_TRUE);
- }
-
out.push_back(0);
}
-int GHOST_ContextWGL::_choose_pixel_format_arb_1(
- bool stereoVisual, int numOfAASamples, bool needAlpha, bool needStencil, bool sRGB)
+int GHOST_ContextWGL::_choose_pixel_format_arb_1(bool stereoVisual, bool needAlpha)
{
std::vector<int> iAttributes;
@@ -445,27 +409,17 @@ int GHOST_ContextWGL::_choose_pixel_format_arb_1(
int iPixelFormat = 0;
int iPixelFormats[_MAX_PIXEL_FORMATS];
- int samples;
+ makeAttribList(iAttributes, stereoVisual, needAlpha);
- // guard against some insanely high number of samples
- if (numOfAASamples > 64) {
- fprintf(stderr, "Warning! Clamping number of samples to 64.\n");
- samples = 64;
- }
- else {
- samples = numOfAASamples;
- }
+ UINT nNumFormats;
+ WIN32_CHK(wglChoosePixelFormatARB(
+ m_hDC, &(iAttributes[0]), NULL, _MAX_PIXEL_FORMATS, iPixelFormats, &nNumFormats));
- // request a format with as many samples as possible, but not more than requested
- while (samples >= 0) {
- makeAttribList(iAttributes, stereoVisual, samples, needAlpha, needStencil, sRGB);
-
- UINT nNumFormats;
- WIN32_CHK(wglChoosePixelFormatARB(
- m_hDC, &(iAttributes[0]), NULL, _MAX_PIXEL_FORMATS, iPixelFormats, &nNumFormats));
+ if (nNumFormats > 0) {
+ iPixelFormat = iPixelFormats[0];
#ifdef WIN32_COMPOSITING
- if (needAlpha && nNumFormats) {
+ if (needAlpha) {
// scan through all pixel format to make sure one supports compositing
PIXELFORMATDESCRIPTOR pfd;
int i;
@@ -480,41 +434,16 @@ int GHOST_ContextWGL::_choose_pixel_format_arb_1(
}
if (i == nNumFormats) {
fprintf(stderr, "Warning! Unable to find a pixel format with compositing capability.\n");
- iPixelFormat = iPixelFormats[0];
}
}
- else
#endif
- iPixelFormat = iPixelFormats[0];
- /* total number of formats that match (regardless of size of iPixelFormat array)
- * see: WGL_ARB_pixel_format extension spec */
- if (nNumFormats > 0)
- break;
-
- /* if not reset, then the state of iPixelFormat is undefined after call to wglChoosePixelFormatARB
- * see: WGL_ARB_pixel_format extension spec */
- iPixelFormat = 0;
-
- samples--;
}
- // check how many samples were actually gotten
+ // check pixel format
if (iPixelFormat != 0) {
- int iQuery[] = {WGL_SAMPLES_ARB};
- int actualSamples, alphaBits;
- wglGetPixelFormatAttribivARB(m_hDC, iPixelFormat, 0, 1, iQuery, &actualSamples);
-
- if (actualSamples != numOfAASamples) {
- fprintf(
- stderr,
- "Warning! Unable to find a multisample pixel format that supports exactly %d samples. "
- "Substituting one that uses %d samples.\n",
- numOfAASamples,
- actualSamples);
- }
if (needAlpha) {
- iQuery[0] = WGL_ALPHA_BITS_ARB;
- wglGetPixelFormatAttribivARB(m_hDC, iPixelFormat, 0, 1, iQuery, &alphaBits);
+ int alphaBits, iQuery = WGL_ALPHA_BITS_ARB;
+ wglGetPixelFormatAttribivARB(m_hDC, iPixelFormat, 0, 1, &iQuery, &alphaBits);
if (alphaBits == 0) {
fprintf(stderr, "Warning! Unable to find a frame buffer with alpha channel.\n");
}
@@ -523,18 +452,16 @@ int GHOST_ContextWGL::_choose_pixel_format_arb_1(
return iPixelFormat;
}
-int GHOST_ContextWGL::choose_pixel_format_arb(
- bool stereoVisual, int numOfAASamples, bool needAlpha, bool needStencil, bool sRGB)
+int GHOST_ContextWGL::choose_pixel_format_arb(bool stereoVisual, bool needAlpha)
{
int iPixelFormat;
- iPixelFormat = _choose_pixel_format_arb_1(
- stereoVisual, numOfAASamples, needAlpha, needStencil, sRGB);
+ iPixelFormat = _choose_pixel_format_arb_1(stereoVisual, needAlpha);
if (iPixelFormat == 0 && stereoVisual) {
fprintf(stderr, "Warning! Unable to find a stereo pixel format.\n");
- iPixelFormat = _choose_pixel_format_arb_1(false, numOfAASamples, needAlpha, needStencil, sRGB);
+ iPixelFormat = _choose_pixel_format_arb_1(false, needAlpha);
m_stereoVisual = false; // set context property to actual value
}
@@ -542,8 +469,7 @@ int GHOST_ContextWGL::choose_pixel_format_arb(
return iPixelFormat;
}
-int GHOST_ContextWGL::choose_pixel_format(
- bool stereoVisual, int numOfAASamples, bool needAlpha, bool needStencil, bool sRGB)
+int GHOST_ContextWGL::choose_pixel_format(bool stereoVisual, bool needAlpha)
{
PIXELFORMATDESCRIPTOR preferredPFD = {
sizeof(PIXELFORMATDESCRIPTOR), /* size */
@@ -572,12 +498,12 @@ int GHOST_ContextWGL::choose_pixel_format(
0,
0,
0,
- 0, /* accum bits (ignored) */
- 24, /* depth buffer */
- (BYTE)(needStencil ? 8 : 0), /* stencil buffer */
- 0, /* no auxiliary buffers */
- PFD_MAIN_PLANE, /* main layer */
- 0, /* reserved */
+ 0, /* accum bits (ignored) */
+ 0, /* depth buffer */
+ 0, /* stencil buffer */
+ 0, /* no auxiliary buffers */
+ PFD_MAIN_PLANE, /* main layer */
+ 0, /* reserved */
0,
0,
0 /* layer, visible, and damage masks (ignored) */
@@ -585,21 +511,10 @@ int GHOST_ContextWGL::choose_pixel_format(
initContextWGLEW(preferredPFD);
- if (numOfAASamples > 0 && !WGLEW_ARB_multisample) {
- fprintf(stderr, "Warning! Unable to request a multisample framebuffer.\n");
- numOfAASamples = 0;
- }
-
- if (sRGB && !(WGLEW_ARB_framebuffer_sRGB || WGLEW_EXT_framebuffer_sRGB)) {
- fprintf(stderr, "Warning! Unable to request an sRGB framebuffer.\n");
- sRGB = false;
- }
-
int iPixelFormat = 0;
if (WGLEW_ARB_pixel_format)
- iPixelFormat = choose_pixel_format_arb(
- stereoVisual, numOfAASamples, needAlpha, needStencil, sRGB);
+ iPixelFormat = choose_pixel_format_arb(stereoVisual, needAlpha);
if (iPixelFormat == 0)
iPixelFormat = choose_pixel_format_legacy(m_hDC, preferredPFD);
@@ -629,25 +544,12 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext()
if (!WGLEW_ARB_create_context || ::GetPixelFormat(m_hDC) == 0) {
const bool needAlpha = m_alphaBackground;
-
-#ifdef GHOST_OPENGL_STENCIL
- const bool needStencil = true;
-#else
- const bool needStencil = false;
-#endif
-
-#ifdef GHOST_OPENGL_SRGB
- const bool sRGB = true;
-#else
- const bool sRGB = false;
-#endif
int iPixelFormat;
int lastPFD;
PIXELFORMATDESCRIPTOR chosenPFD;
- iPixelFormat = choose_pixel_format(
- m_stereoVisual, m_numOfAASamples, needAlpha, needStencil, sRGB);
+ iPixelFormat = choose_pixel_format(m_stereoVisual, needAlpha);
if (iPixelFormat == 0) {
goto error;
@@ -663,9 +565,6 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext()
if (needAlpha && chosenPFD.cAlphaBits == 0)
fprintf(stderr, "Warning! Unable to find a pixel format with an alpha channel.\n");
- if (needStencil && chosenPFD.cStencilBits == 0)
- fprintf(stderr, "Warning! Unable to find a pixel format with a stencil buffer.\n");
-
if (!WIN32_CHK(::SetPixelFormat(m_hDC, iPixelFormat, &chosenPFD))) {
goto error;
}
diff --git a/intern/ghost/intern/GHOST_ContextWGL.h b/intern/ghost/intern/GHOST_ContextWGL.h
index a3fd9de74a1..a990e42c4ff 100644
--- a/intern/ghost/intern/GHOST_ContextWGL.h
+++ b/intern/ghost/intern/GHOST_ContextWGL.h
@@ -41,7 +41,6 @@ class GHOST_ContextWGL : public GHOST_Context {
*/
GHOST_ContextWGL(bool stereoVisual,
bool alphaBackground,
- GHOST_TUns16 numOfAASamples,
HWND hWnd,
HDC hDC,
int contextProfileMask,
@@ -101,14 +100,9 @@ class GHOST_ContextWGL : public GHOST_Context {
GHOST_TSuccess getSwapInterval(int &intervalOut);
private:
- int choose_pixel_format(
- bool stereoVisual, int numOfAASamples, bool needAlpha, bool needStencil, bool sRGB);
-
- int choose_pixel_format_arb(
- bool stereoVisual, int numOfAASamples, bool needAlpha, bool needStencil, bool sRGB);
-
- int _choose_pixel_format_arb_1(
- bool stereoVisual, int numOfAASamples, bool needAlpha, bool needStencil, bool sRGB);
+ int choose_pixel_format(bool stereoVisual, bool needAlpha);
+ int choose_pixel_format_arb(bool stereoVisual, bool needAlpha);
+ int _choose_pixel_format_arb_1(bool stereoVisual, bool needAlpha);
void initContextWGLEW(PIXELFORMATDESCRIPTOR &preferredPFD);
diff --git a/intern/ghost/intern/GHOST_DisplayManagerCocoa.h b/intern/ghost/intern/GHOST_DisplayManagerCocoa.h
index cfdc7be357e..c99e93279f7 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerCocoa.h
+++ b/intern/ghost/intern/GHOST_DisplayManagerCocoa.h
@@ -87,11 +87,11 @@ class GHOST_DisplayManagerCocoa : public GHOST_DisplayManager {
const GHOST_DisplaySetting &setting);
protected:
- //Do not cache values as OS X supports screen hot plug
+ // Do not cache values as OS X supports screen hot plug
/** Cached number of displays. */
- //CGDisplayCount m_numDisplays;
+ // CGDisplayCount m_numDisplays;
/** Cached display id's for each display. */
- //CGDirectDisplayID* m_displayIDs;
+ // CGDirectDisplayID* m_displayIDs;
};
#endif // __GHOST_DISPLAYMANAGERCOCOA_H__
diff --git a/intern/ghost/intern/GHOST_DisplayManagerCocoa.mm b/intern/ghost/intern/GHOST_DisplayManagerCocoa.mm
index 7f44a14f49c..f060d45c911 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerCocoa.mm
+++ b/intern/ghost/intern/GHOST_DisplayManagerCocoa.mm
@@ -42,7 +42,7 @@ GHOST_TSuccess GHOST_DisplayManagerCocoa::getNumDisplays(GHOST_TUns8 &numDisplay
GHOST_TSuccess GHOST_DisplayManagerCocoa::getNumDisplaySettings(GHOST_TUns8 display,
GHOST_TInt32 &numSettings) const
{
- numSettings = (GHOST_TInt32)3; //Width, Height, BitsPerPixel
+ numSettings = (GHOST_TInt32)3; // Width, Height, BitsPerPixel
return GHOST_kSuccess;
}
@@ -55,7 +55,7 @@ GHOST_TSuccess GHOST_DisplayManagerCocoa::getDisplaySetting(GHOST_TUns8 display,
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- if (display == kMainDisplay) //Screen #0 may not be the main one
+ if (display == kMainDisplay) // Screen #0 may not be the main one
askedDisplay = [NSScreen mainScreen];
else
askedDisplay = [[NSScreen screens] objectAtIndex:display];
@@ -71,7 +71,7 @@ GHOST_TSuccess GHOST_DisplayManagerCocoa::getDisplaySetting(GHOST_TUns8 display,
setting.bpp = NSBitsPerPixelFromDepth([askedDisplay depth]);
- setting.frequency = 0; //No more CRT display...
+ setting.frequency = 0; // No more CRT display...
#ifdef GHOST_DEBUG
printf("display mode: width=%d, height=%d, bpp=%d, frequency=%d\n",
@@ -96,7 +96,7 @@ GHOST_TSuccess GHOST_DisplayManagerCocoa::getCurrentDisplaySetting(
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- if (display == kMainDisplay) //Screen #0 may not be the main one
+ if (display == kMainDisplay) // Screen #0 may not be the main one
askedDisplay = [NSScreen mainScreen];
else
askedDisplay = [[NSScreen screens] objectAtIndex:display];
@@ -112,7 +112,7 @@ GHOST_TSuccess GHOST_DisplayManagerCocoa::getCurrentDisplaySetting(
setting.bpp = NSBitsPerPixelFromDepth([askedDisplay depth]);
- setting.frequency = 0; //No more CRT display...
+ setting.frequency = 0; // No more CRT display...
#ifdef GHOST_DEBUG
printf("current display mode: width=%d, height=%d, bpp=%d, frequency=%d\n",
@@ -141,7 +141,7 @@ GHOST_TSuccess GHOST_DisplayManagerCocoa::setCurrentDisplaySetting(
printf(" setting.frequency=%d\n", setting.frequency);
#endif // GHOST_DEBUG
- //Display configuration is no more available in 10.6
+ // Display configuration is no more available in 10.6
/* CFDictionaryRef displayModeValues = ::CGDisplayBestModeForParametersAndRefreshRate(
m_displayIDs[display],
@@ -159,7 +159,7 @@ GHOST_TSuccess GHOST_DisplayManagerCocoa::setCurrentDisplaySetting(
printf(" setting.frequency=%d\n", getValue(displayModeValues, kCGDisplayRefreshRate)); */
#endif // GHOST_DEBUG
- //CGDisplayErr err = ::CGDisplaySwitchToMode(m_displayIDs[display], displayModeValues);
+ // CGDisplayErr err = ::CGDisplaySwitchToMode(m_displayIDs[display], displayModeValues);
return /*err == CGDisplayNoErr ?*/ GHOST_kSuccess /*: GHOST_kFailure*/;
}
diff --git a/intern/ghost/intern/GHOST_DropTargetWin32.cpp b/intern/ghost/intern/GHOST_DropTargetWin32.cpp
index b41a133a069..931aca81fb8 100644
--- a/intern/ghost/intern/GHOST_DropTargetWin32.cpp
+++ b/intern/ghost/intern/GHOST_DropTargetWin32.cpp
@@ -119,7 +119,8 @@ HRESULT __stdcall GHOST_DropTargetWin32::DragOver(DWORD grfKeyState, POINTL pt,
}
else {
*pdwEffect = DROPEFFECT_NONE;
- // *pdwEffect = DROPEFFECT_COPY; // XXX Uncomment to test drop. Drop will not be called if pdwEffect == DROPEFFECT_NONE.
+ // XXX Uncomment to test drop. Drop will not be called if pdwEffect == DROPEFFECT_NONE.
+ // *pdwEffect = DROPEFFECT_COPY;
}
m_system->pushDragDropEvent(
GHOST_kEventDraggingUpdated, m_draggedObjectType, m_window, pt.x, pt.y, NULL);
@@ -205,7 +206,7 @@ void *GHOST_DropTargetWin32::getGhostData(IDataObject *pDataObject)
return getDropDataAsString(pDataObject);
break;
case GHOST_kDragnDropTypeBitmap:
- //return getDropDataAsBitmap(pDataObject);
+ // return getDropDataAsBitmap(pDataObject);
break;
default:
#ifdef GHOST_DEBUG
@@ -322,10 +323,10 @@ void *GHOST_DropTargetWin32::getDropDataAsString(IDataObject *pDataObject)
int GHOST_DropTargetWin32::WideCharToANSI(LPCWSTR in, char *&out)
{
int size;
- out = NULL; //caller should free if != NULL
+ out = NULL; // caller should free if != NULL
// Get the required size.
- size = ::WideCharToMultiByte(CP_ACP, //System Default Codepage
+ size = ::WideCharToMultiByte(CP_ACP, // System Default Codepage
0x00000400, // WC_NO_BEST_FIT_CHARS
in,
-1, //-1 null terminated, makes output null terminated too.
@@ -352,7 +353,7 @@ int GHOST_DropTargetWin32::WideCharToANSI(LPCWSTR in, char *&out)
if (!size) {
#ifdef GHOST_DEBUG
::printLastError();
-#endif //GHOST_DEBUG
+#endif // GHOST_DEBUG
::free(out);
out = NULL;
}
diff --git a/intern/ghost/intern/GHOST_EventDragnDrop.h b/intern/ghost/intern/GHOST_EventDragnDrop.h
index 169b0b5d174..8e2a8d806ee 100644
--- a/intern/ghost/intern/GHOST_EventDragnDrop.h
+++ b/intern/ghost/intern/GHOST_EventDragnDrop.h
@@ -35,28 +35,31 @@ extern "C" {
*
* The dragging sequence is performed in four phases:
*
- * <li> Start sequence (GHOST_kEventDraggingEntered) that tells a drag'n'drop operation has started.
- * Already gives the object data type, and the entering mouse location
+ * - Start sequence (GHOST_kEventDraggingEntered) that tells
+ * a drag'n'drop operation has started.
+ * Already gives the object data type, and the entering mouse location
*
- * <li> Update mouse position (GHOST_kEventDraggingUpdated) sent upon each mouse move until the drag'n'drop operation
- * stops, to give the updated mouse position. Useful to highlight a potential destination, and update the status
- * (through GHOST_setAcceptDragOperation) telling if the object can be dropped at
- * the current cursor position.
+ * - Update mouse position (GHOST_kEventDraggingUpdated) sent upon each mouse move until the
+ * drag'n'drop operation stops, to give the updated mouse position.
+ * Useful to highlight a potential destination, and update the status
+ * (through GHOST_setAcceptDragOperation) telling if the object can be dropped at the current
+ * cursor position.
*
- * <li> Abort drag'n'drop sequence (GHOST_kEventDraggingExited) sent when the user moved the mouse outside the window.
+ * - Abort drag'n'drop sequence (GHOST_kEventDraggingExited)
+ * sent when the user moved the mouse outside the window.
*
- * <li> Send the dropped data (GHOST_kEventDraggingDropDone)
+ * - Send the dropped data (GHOST_kEventDraggingDropDone)
*
- * <li> Outside of the normal sequence, dropped data can be sent (GHOST_kEventDraggingDropOnIcon).
- * This can happen when the user drops an object on the application icon.
- * (Also used in OSX to pass the filename of the document the user doubled-clicked in the finder)
+ * - Outside of the normal sequence, dropped data can be sent (GHOST_kEventDraggingDropOnIcon).
+ * This can happen when the user drops an object on the application icon.
+ * (Also used in OSX to pass the filename of the document the user doubled-clicked in the finder)
*
- * <br><br>Note that the mouse positions are given in Blender coordinates (y=0 at bottom)
+ * Note that the mouse positions are given in Blender coordinates (y=0 at bottom)
*
- * <br>Currently supported object types :
- * <li>UTF-8 string
- * <li>array of strings representing filenames (GHOST_TStringArray)
- * <li>bitmap ImBuf
+ * Currently supported object types:
+ * - UTF-8 string.
+ * - array of strings representing filenames (GHOST_TStringArray).
+ * - bitmap #ImBuf.
*/
class GHOST_EventDragnDrop : public GHOST_Event {
public:
@@ -88,7 +91,7 @@ class GHOST_EventDragnDrop : public GHOST_Event {
~GHOST_EventDragnDrop()
{
- //Free the dropped object data
+ // Free the dropped object data
if (m_dragnDropEventData.data == NULL)
return;
diff --git a/intern/ghost/intern/GHOST_ImeWin32.cpp b/intern/ghost/intern/GHOST_ImeWin32.cpp
index 531dbe4b444..06fab47933a 100644
--- a/intern/ghost/intern/GHOST_ImeWin32.cpp
+++ b/intern/ghost/intern/GHOST_ImeWin32.cpp
@@ -271,11 +271,11 @@ void GHOST_ImeWin32::GetCaret(HIMC imm_context, LPARAM lparam, ImeComposition *c
case LANG_JAPANESE:
/**
- * For Japanese IMEs, the robustest way to retrieve the caret
- * is scanning the attribute of the latest composition string and
- * retrieving the begining and the end of the target clause, i.e.
- * a clause being converted.
- */
+ * For Japanese IMEs, the robustest way to retrieve the caret
+ * is scanning the attribute of the latest composition string and
+ * retrieving the begining and the end of the target clause, i.e.
+ * a clause being converted.
+ */
if (lparam & GCS_COMPATTR) {
int attribute_size = ::ImmGetCompositionStringW(imm_context, GCS_COMPATTR, NULL, 0);
if (attribute_size > 0) {
@@ -292,10 +292,10 @@ void GHOST_ImeWin32::GetCaret(HIMC imm_context, LPARAM lparam, ImeComposition *c
}
if (target_start == attribute_size) {
/**
- * This composition clause does not contain any target clauses,
- * i.e. this clauses is an input clause.
- * We treat whole this clause as a target clause.
- */
+ * This composition clause does not contain any target clauses,
+ * i.e. this clauses is an input clause.
+ * We treat whole this clause as a target clause.
+ */
target_end = target_start;
target_start = 0;
}
diff --git a/intern/ghost/intern/GHOST_ImeWin32.h b/intern/ghost/intern/GHOST_ImeWin32.h
index 61fc93a78af..9c1f2473223 100644
--- a/intern/ghost/intern/GHOST_ImeWin32.h
+++ b/intern/ghost/intern/GHOST_ImeWin32.h
@@ -17,7 +17,7 @@
* All rights reserved.
*
* The Original Code is: some of this file.
-*/
+ */
/** \file
* \ingroup GHOST
diff --git a/intern/ghost/intern/GHOST_NDOFManager.cpp b/intern/ghost/intern/GHOST_NDOFManager.cpp
index b407d120a99..9999bfd7ea6 100644
--- a/intern/ghost/intern/GHOST_NDOFManager.cpp
+++ b/intern/ghost/intern/GHOST_NDOFManager.cpp
@@ -96,21 +96,23 @@ static const NDOF_ButtonT Modern3Dx_HID_map[] = {
NDOF_BUTTON_SHIFT, NDOF_BUTTON_CTRL, NDOF_BUTTON_ROTATE, NDOF_BUTTON_PANZOOM,
NDOF_BUTTON_DOMINANT, NDOF_BUTTON_PLUS, NDOF_BUTTON_MINUS};
-static const NDOF_ButtonT SpaceExplorer_HID_map[] = {NDOF_BUTTON_1,
- NDOF_BUTTON_2,
- NDOF_BUTTON_TOP,
- NDOF_BUTTON_LEFT,
- NDOF_BUTTON_RIGHT,
- NDOF_BUTTON_FRONT,
- NDOF_BUTTON_ESC,
- NDOF_BUTTON_ALT,
- NDOF_BUTTON_SHIFT,
- NDOF_BUTTON_CTRL,
- NDOF_BUTTON_FIT,
- NDOF_BUTTON_MENU,
- NDOF_BUTTON_PLUS,
- NDOF_BUTTON_MINUS,
- NDOF_BUTTON_ROTATE};
+static const NDOF_ButtonT SpaceExplorer_HID_map[] = {
+ NDOF_BUTTON_1,
+ NDOF_BUTTON_2,
+ NDOF_BUTTON_TOP,
+ NDOF_BUTTON_LEFT,
+ NDOF_BUTTON_RIGHT,
+ NDOF_BUTTON_FRONT,
+ NDOF_BUTTON_ESC,
+ NDOF_BUTTON_ALT,
+ NDOF_BUTTON_SHIFT,
+ NDOF_BUTTON_CTRL,
+ NDOF_BUTTON_FIT,
+ NDOF_BUTTON_MENU,
+ NDOF_BUTTON_PLUS,
+ NDOF_BUTTON_MINUS,
+ NDOF_BUTTON_ROTATE,
+};
// this is the older SpacePilot (sans Pro)
// thanks to polosson for info about this device
@@ -123,18 +125,20 @@ static const NDOF_ButtonT SpacePilot_HID_map[] = {
NDOF_BUTTON_NONE // the CONFIG button -- what does it do?
};
-static const NDOF_ButtonT Generic_HID_map[] = {NDOF_BUTTON_1,
- NDOF_BUTTON_2,
- NDOF_BUTTON_3,
- NDOF_BUTTON_4,
- NDOF_BUTTON_5,
- NDOF_BUTTON_6,
- NDOF_BUTTON_7,
- NDOF_BUTTON_8,
- NDOF_BUTTON_9,
- NDOF_BUTTON_A,
- NDOF_BUTTON_B,
- NDOF_BUTTON_C};
+static const NDOF_ButtonT Generic_HID_map[] = {
+ NDOF_BUTTON_1,
+ NDOF_BUTTON_2,
+ NDOF_BUTTON_3,
+ NDOF_BUTTON_4,
+ NDOF_BUTTON_5,
+ NDOF_BUTTON_6,
+ NDOF_BUTTON_7,
+ NDOF_BUTTON_8,
+ NDOF_BUTTON_9,
+ NDOF_BUTTON_A,
+ NDOF_BUTTON_B,
+ NDOF_BUTTON_C,
+};
static const int genericButtonCount = sizeof(Generic_HID_map) / sizeof(NDOF_ButtonT);
diff --git a/intern/ghost/intern/GHOST_System.cpp b/intern/ghost/intern/GHOST_System.cpp
index 1530dddd5f1..a696afeae02 100644
--- a/intern/ghost/intern/GHOST_System.cpp
+++ b/intern/ghost/intern/GHOST_System.cpp
@@ -129,8 +129,7 @@ bool GHOST_System::validWindow(GHOST_IWindow *window)
GHOST_TSuccess GHOST_System::beginFullScreen(const GHOST_DisplaySetting &setting,
GHOST_IWindow **window,
const bool stereoVisual,
- const bool alphaBackground,
- const GHOST_TUns16 numOfAASamples)
+ const bool alphaBackground)
{
GHOST_TSuccess success = GHOST_kFailure;
GHOST_ASSERT(m_windowManager, "GHOST_System::beginFullScreen(): invalid window manager");
@@ -139,13 +138,13 @@ GHOST_TSuccess GHOST_System::beginFullScreen(const GHOST_DisplaySetting &setting
m_displayManager->getCurrentDisplaySetting(GHOST_DisplayManager::kMainDisplay,
m_preFullScreenSetting);
- //GHOST_PRINT("GHOST_System::beginFullScreen(): activating new display settings\n");
+ // GHOST_PRINT("GHOST_System::beginFullScreen(): activating new display settings\n");
success = m_displayManager->setCurrentDisplaySetting(GHOST_DisplayManager::kMainDisplay,
setting);
if (success == GHOST_kSuccess) {
- //GHOST_PRINT("GHOST_System::beginFullScreen(): creating full-screen window\n");
+ // GHOST_PRINT("GHOST_System::beginFullScreen(): creating full-screen window\n");
success = createFullScreenWindow(
- (GHOST_Window **)window, setting, stereoVisual, alphaBackground, numOfAASamples);
+ (GHOST_Window **)window, setting, stereoVisual, alphaBackground);
if (success == GHOST_kSuccess) {
m_windowManager->beginFullScreen(*window, stereoVisual);
}
@@ -182,11 +181,11 @@ GHOST_TSuccess GHOST_System::endFullScreen(void)
GHOST_TSuccess success = GHOST_kFailure;
GHOST_ASSERT(m_windowManager, "GHOST_System::endFullScreen(): invalid window manager");
if (m_windowManager->getFullScreen()) {
- //GHOST_IWindow* window = m_windowManager->getFullScreenWindow();
- //GHOST_PRINT("GHOST_System::endFullScreen(): leaving window manager full-screen mode\n");
+ // GHOST_IWindow* window = m_windowManager->getFullScreenWindow();
+ // GHOST_PRINT("GHOST_System::endFullScreen(): leaving window manager full-screen mode\n");
success = m_windowManager->endFullScreen();
GHOST_ASSERT(m_displayManager, "GHOST_System::endFullScreen(): invalid display manager");
- //GHOST_PRINT("GHOST_System::endFullScreen(): leaving full-screen mode\n");
+ // GHOST_PRINT("GHOST_System::endFullScreen(): leaving full-screen mode\n");
success = m_displayManager->setCurrentDisplaySetting(GHOST_DisplayManager::kMainDisplay,
m_preFullScreenSetting);
}
@@ -353,8 +352,7 @@ GHOST_TSuccess GHOST_System::exit()
GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window **window,
const GHOST_DisplaySetting &settings,
const bool stereoVisual,
- const bool alphaBackground,
- const GHOST_TUns16 numOfAASamples)
+ const bool alphaBackground)
{
GHOST_GLSettings glSettings = {0};
@@ -362,13 +360,12 @@ GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window **window,
glSettings.flags |= GHOST_glStereoVisual;
if (alphaBackground)
glSettings.flags |= GHOST_glAlphaBackground;
- glSettings.numOfAASamples = numOfAASamples;
/* note: don't use getCurrentDisplaySetting() because on X11 we may
* be zoomed in and the desktop may be bigger then the viewport. */
GHOST_ASSERT(m_displayManager,
"GHOST_System::createFullScreenWindow(): invalid display manager");
- //GHOST_PRINT("GHOST_System::createFullScreenWindow(): creating full-screen window\n");
+ // GHOST_PRINT("GHOST_System::createFullScreenWindow(): creating full-screen window\n");
*window = (GHOST_Window *)createWindow(STR_String(""),
0,
0,
diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h
index 2c7025b6036..a62641c5cf5 100644
--- a/intern/ghost/intern/GHOST_System.h
+++ b/intern/ghost/intern/GHOST_System.h
@@ -137,8 +137,7 @@ class GHOST_System : public GHOST_ISystem {
GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting &setting,
GHOST_IWindow **window,
const bool stereoVisual,
- const bool alphaBackground,
- const GHOST_TUns16 numOfAASamples = 0);
+ const bool alphaBackground);
/**
* Updates the resolution while in fullscreen mode.
@@ -350,8 +349,7 @@ class GHOST_System : public GHOST_ISystem {
GHOST_TSuccess createFullScreenWindow(GHOST_Window **window,
const GHOST_DisplaySetting &settings,
const bool stereoVisual,
- const bool alphaBackground = 0,
- const GHOST_TUns16 numOfAASamples = 0);
+ const bool alphaBackground = 0);
/** The display manager (platform dependent). */
GHOST_DisplayManager *m_displayManager;
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.h b/intern/ghost/intern/GHOST_SystemCocoa.h
index 9206ef90ee7..749139fee76 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.h
+++ b/intern/ghost/intern/GHOST_SystemCocoa.h
@@ -87,7 +87,8 @@ class GHOST_SystemCocoa : public GHOST_System {
* Create a new window.
* The new window is added to the list of windows managed.
* Never explicitly delete the window, use disposeWindow() instead.
- * \param title The name of the window (displayed in the title bar of the window if the OS supports it).
+ * \param title The name of the window
+ * (displayed in the title bar of the window if the OS supports it).
* \param left The coordinate of the left edge of the window.
* \param top The coordinate of the top edge of the window.
* \param width The width the window.
@@ -150,7 +151,8 @@ class GHOST_SystemCocoa : public GHOST_System {
/**
* Handles a drag'n'drop destination event. Called by GHOST_WindowCocoa window subclass
* \param eventType The type of drag'n'drop event
- * \param draggedObjectType The type object concerned (currently array of file names, string, TIFF image)
+ * \param draggedObjectType The type object concerned
+ * (currently array of file names, string, TIFF image)
* \param mouseX x mouse coordinate (in cocoa base window coordinates)
* \param mouseY y mouse coordinate
* \param window The window on which the event occurred
@@ -291,10 +293,12 @@ class GHOST_SystemCocoa : public GHOST_System {
/** Start time at initialization. */
GHOST_TUns64 m_start_time;
- /** Event has been processed directly by Cocoa (or NDOF manager) and has sent a ghost event to be dispatched */
+ /** Event has been processed directly by Cocoa (or NDOF manager)
+ * and has sent a ghost event to be dispatched */
bool m_outsideLoopEventProcessed;
- /** Raised window is not yet known by the window manager, so delay application become active event handling */
+ /** Raised window is not yet known by the window manager,
+ * so delay application become active event handling */
bool m_needDelayedApplicationBecomeActiveEventProcessing;
/** State of the modifiers. */
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 4c9c7453f43..1fd0914eb73 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -86,7 +86,7 @@ static GHOST_TButtonMask convertButton(int button)
*/
static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction)
{
- //printf("\nrecvchar %c 0x%x",recvChar,recvChar);
+ // printf("\nrecvchar %c 0x%x",recvChar,recvChar);
switch (rawCode) {
/*Physical keycodes not used due to map changes in int'l keyboards
case kVK_ANSI_A: return GHOST_kKeyA;
@@ -341,7 +341,8 @@ static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction)
static bool g_hasFirstFile = false;
static char g_firstFileBuf[512];
-//TODO:Need to investigate this. Function called too early in creator.c to have g_hasFirstFile == true
+// TODO: Need to investigate this.
+// Function called too early in creator.c to have g_hasFirstFile == true
extern "C" int GHOST_HACK_getFirstFile(char buf[FIRSTFILEBUFLG])
{
if (g_hasFirstFile) {
@@ -354,6 +355,7 @@ extern "C" int GHOST_HACK_getFirstFile(char buf[FIRSTFILEBUFLG])
}
}
+/* clang-format off */
#pragma mark Cocoa objects
/**
@@ -422,8 +424,9 @@ extern "C" int GHOST_HACK_getFirstFile(char buf[FIRSTFILEBUFLG])
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
{
- //TODO: implement graceful termination through Cocoa mechanism to avoid session log off to be canceled
- //Note that Cmd+Q is already handled by keyhandler
+ /* TODO: implement graceful termination through Cocoa mechanism
+ * to avoid session log off to be canceled. */
+ /* Note that Cmd+Q is already handled by keyhandler. */
if (systemCocoa->handleQuitRequest() == GHOST_kExitNow)
return NSTerminateCancel; //NSTerminateNow;
else
@@ -497,6 +500,8 @@ extern "C" int GHOST_HACK_getFirstFile(char buf[FIRSTFILEBUFLG])
#pragma mark initialization/finalization
+/* clang-format on */
+
GHOST_SystemCocoa::GHOST_SystemCocoa()
{
int mib[2];
@@ -511,7 +516,7 @@ GHOST_SystemCocoa::GHOST_SystemCocoa()
GHOST_ASSERT(m_displayManager, "GHOST_SystemCocoa::GHOST_SystemCocoa(): m_displayManager==0\n");
m_displayManager->initialize();
- //NSEvent timeStamp is given in system uptime, state start date is boot time
+ // NSEvent timeStamp is given in system uptime, state start date is boot time
mib[0] = CTL_KERN;
mib[1] = KERN_BOOTTIME;
len = sizeof(struct timeval);
@@ -519,7 +524,7 @@ GHOST_SystemCocoa::GHOST_SystemCocoa()
sysctl(mib, 2, &boottime, &len, NULL, 0);
m_start_time = ((boottime.tv_sec * 1000) + (boottime.tv_usec / 1000));
- //Detect multitouch trackpad
+ // Detect multitouch trackpad
mib[0] = CTL_HW;
mib[1] = HW_MODEL;
sysctl(mib, 2, NULL, &len, NULL, 0);
@@ -547,9 +552,9 @@ GHOST_TSuccess GHOST_SystemCocoa::init()
m_ndofManager = new GHOST_NDOFManagerCocoa(*this);
#endif
- //ProcessSerialNumber psn;
+ // ProcessSerialNumber psn;
- //Carbon stuff to move window & menu to foreground
+ // Carbon stuff to move window & menu to foreground
/*if (!GetCurrentProcess(&psn)) {
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
SetFrontProcess(&psn);
@@ -564,7 +569,7 @@ GHOST_TSuccess GHOST_SystemCocoa::init()
NSMenu *windowMenu;
NSMenu *appMenu;
- //Create the application menu
+ // Create the application menu
appMenu = [[NSMenu alloc] initWithTitle:@"Blender"];
[appMenu addItemWithTitle:@"About Blender"
@@ -596,10 +601,10 @@ GHOST_TSuccess GHOST_SystemCocoa::init()
[mainMenubar addItem:menuItem];
[menuItem release];
- [NSApp performSelector:@selector(setAppleMenu:) withObject:appMenu]; //Needed for 10.5
+ [NSApp performSelector:@selector(setAppleMenu:) withObject:appMenu]; // Needed for 10.5
[appMenu release];
- //Create the window menu
+ // Create the window menu
windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
menuItem = [windowMenu addItemWithTitle:@"Minimize"
@@ -647,19 +652,19 @@ GHOST_TSuccess GHOST_SystemCocoa::init()
GHOST_TUns64 GHOST_SystemCocoa::getMilliSeconds() const
{
- //Cocoa equivalent exists in 10.6 ([[NSProcessInfo processInfo] systemUptime])
+ // Cocoa equivalent exists in 10.6 ([[NSProcessInfo processInfo] systemUptime])
struct timeval currentTime;
gettimeofday(&currentTime, NULL);
- //Return timestamp of system uptime
+ // Return timestamp of system uptime
return ((currentTime.tv_sec * 1000) + (currentTime.tv_usec / 1000) - m_start_time);
}
GHOST_TUns8 GHOST_SystemCocoa::getNumDisplays() const
{
- //Note that OS X supports monitor hot plug
+ // Note that OS X supports monitor hot plug
// We do not support multiple monitors at the moment
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@@ -672,10 +677,10 @@ GHOST_TUns8 GHOST_SystemCocoa::getNumDisplays() const
void GHOST_SystemCocoa::getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- //Get visible frame, that is frame excluding dock and top menu bar
+ // Get visible frame, that is frame excluding dock and top menu bar
NSRect frame = [[NSScreen mainScreen] visibleFrame];
- //Returns max window contents (excluding title bar...)
+ // Returns max window contents (excluding title bar...)
NSRect contentRect = [NSWindow
contentRectForFrameRect:frame
styleMask:(NSTitledWindowMask | NSClosableWindowMask |
@@ -707,7 +712,7 @@ GHOST_IWindow *GHOST_SystemCocoa::createWindow(const STR_String &title,
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
GHOST_IWindow *window = NULL;
- //Get the available rect for including window contents
+ // Get the available rect for including window contents
NSRect frame = [[NSScreen mainScreen] visibleFrame];
NSRect contentRect = [NSWindow
contentRectForFrameRect:frame
@@ -716,7 +721,7 @@ GHOST_IWindow *GHOST_SystemCocoa::createWindow(const STR_String &title,
GHOST_TInt32 bottom = (contentRect.size.height - 1) - height - top;
- //Ensures window top left is inside this available rect
+ // Ensures window top left is inside this available rect
left = left > contentRect.origin.x ? left : contentRect.origin.x;
// Add contentRect.origin.y to respect docksize
bottom = bottom > contentRect.origin.y ? bottom + contentRect.origin.y : contentRect.origin.y;
@@ -730,7 +735,6 @@ GHOST_IWindow *GHOST_SystemCocoa::createWindow(const STR_String &title,
state,
type,
glSettings.flags & GHOST_glStereoVisual,
- glSettings.numOfAASamples,
glSettings.flags & GHOST_glDebugContext);
if (window->getValid()) {
@@ -738,7 +742,8 @@ GHOST_IWindow *GHOST_SystemCocoa::createWindow(const STR_String &title,
GHOST_ASSERT(m_windowManager, "m_windowManager not initialized");
m_windowManager->addWindow(window);
m_windowManager->setActiveWindow(window);
- //Need to tell window manager the new window is the active one (Cocoa does not send the event activate upon window creation)
+ /* Need to tell window manager the new window is the active one
+ * (Cocoa does not send the event activate upon window creation). */
pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowActivate, window));
pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window));
}
@@ -760,7 +765,6 @@ GHOST_IWindow *GHOST_SystemCocoa::createWindow(const STR_String &title,
GHOST_IContext *GHOST_SystemCocoa::createOffscreenContext()
{
GHOST_Context *context = new GHOST_ContextCGL(false,
- 0,
NULL,
NULL,
@@ -818,13 +822,13 @@ GHOST_TSuccess GHOST_SystemCocoa::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32
if (!window)
return GHOST_kFailure;
- //Cursor and mouse dissociation placed here not to interfere with continuous grab
+ // Cursor and mouse dissociation placed here not to interfere with continuous grab
// (in cont. grab setMouseCursorPosition is directly called)
CGAssociateMouseAndMouseCursorPosition(false);
setMouseCursorPosition(x, y);
CGAssociateMouseAndMouseCursorPosition(true);
- //Force mouse move event (not pushed by Cocoa)
+ // Force mouse move event (not pushed by Cocoa)
pushEvent(new GHOST_EventCursor(getMilliSeconds(), GHOST_kEventCursorMove, window, x, y));
m_outsideLoopEventProcessed = true;
@@ -842,11 +846,11 @@ GHOST_TSuccess GHOST_SystemCocoa::setMouseCursorPosition(GHOST_TInt32 x, GHOST_T
NSScreen *windowScreen = window->getScreen();
NSRect screenRect = [windowScreen frame];
- //Set position relative to current screen
+ // Set position relative to current screen
xf -= screenRect.origin.x;
yf -= screenRect.origin.y;
- //Quartz Display Services uses the old coordinates (top left origin)
+ // Quartz Display Services uses the old coordinates (top left origin)
yf = screenRect.size.height - yf;
CGDisplayMoveCursorToPoint((CGDirectDisplayID)[[[windowScreen deviceDescription]
@@ -898,7 +902,7 @@ bool GHOST_SystemCocoa::processEvents(bool waitForEvent)
NSEvent *event;
// SetMouseCoalescingEnabled(false, NULL);
- //TODO : implement timer ??
+ // TODO : implement timer ??
#if 0
do {
GHOST_TimerManager* timerMgr = getTimerManager();
@@ -978,11 +982,11 @@ bool GHOST_SystemCocoa::processEvents(bool waitForEvent)
return anyProcessed;
}
-//Note: called from NSApplication delegate
+// Note: called from NSApplication delegate
GHOST_TSuccess GHOST_SystemCocoa::handleApplicationBecomeActiveEvent()
{
- //Update the modifiers key mask, as its status may have changed when the application was not active
- //(that is when update events are sent to another application)
+ // Update the modifiers key mask, as its status may have changed when the application
+ // was not active (that is when update events are sent to another application).
unsigned int modifiers;
GHOST_IWindow *window = m_windowManager->getActiveWindow();
@@ -1035,7 +1039,7 @@ void GHOST_SystemCocoa::notifyExternalEventProcessed()
m_outsideLoopEventProcessed = true;
}
-//Note: called from NSWindow delegate
+// Note: called from NSWindow delegate
GHOST_TSuccess GHOST_SystemCocoa::handleWindowEvent(GHOST_TEventType eventType,
GHOST_WindowCocoa *window)
{
@@ -1076,13 +1080,15 @@ GHOST_TSuccess GHOST_SystemCocoa::handleWindowEvent(GHOST_TEventType eventType,
break;
case GHOST_kEventWindowSize:
if (!m_ignoreWindowSizedMessages) {
- //Enforce only one resize message per event loop (coalescing all the live resize messages)
+ // Enforce only one resize message per event loop
+ // (coalescing all the live resize messages)
window->updateDrawingContext();
pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window));
- //Mouse up event is trapped by the resizing event loop, so send it anyway to the window manager
+ // Mouse up event is trapped by the resizing event loop,
+ // so send it anyway to the window manager.
pushEvent(new GHOST_EventButton(
getMilliSeconds(), GHOST_kEventButtonUp, window, GHOST_kButtonMaskLeft));
- //m_ignoreWindowSizedMessages = true;
+ // m_ignoreWindowSizedMessages = true;
}
break;
case GHOST_kEventNativeResolutionChange:
@@ -1101,7 +1107,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleWindowEvent(GHOST_TEventType eventType,
return GHOST_kSuccess;
}
-//Note: called from NSWindow subclass
+// Note: called from NSWindow subclass
GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType,
GHOST_TDragnDropTypes draggedObjectType,
GHOST_WindowCocoa *window,
@@ -1237,7 +1243,8 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
/* As Core Graphics does not support contextes with non premutliplied alpha,
we need to get alpha key values in a separate batch */
- /* First get RGB values w/o Alpha to avoid pre-multiplication, 32bit but last byte is unused */
+ /* First get RGB values w/o Alpha to avoid pre-multiplication,
+ * 32bit but last byte is unused */
blBitmapFormatImageRGB = [[NSBitmapImageRep alloc]
initWithBitmapDataPlanes:NULL
pixelsWide:imgSize.width
@@ -1339,11 +1346,11 @@ GHOST_TUns8 GHOST_SystemCocoa::handleQuitRequest()
{
GHOST_Window *window = (GHOST_Window *)m_windowManager->getActiveWindow();
- //Discard quit event if we are in cursor grab sequence
+ // Discard quit event if we are in cursor grab sequence
if (window && window->getCursorGrabModeIsWarp())
return GHOST_kExitCancel;
- //Check open windows if some changes are not saved
+ // Check open windows if some changes are not saved
if (m_windowManager->getAnyModifiedState()) {
int shouldQuit = NSRunAlertPanel(
@"Exit Blender",
@@ -1356,14 +1363,14 @@ GHOST_TUns8 GHOST_SystemCocoa::handleQuitRequest()
return GHOST_kExitNow;
}
else {
- //Give back focus to the blender window if user selected cancel quit
+ // Give back focus to the blender window if user selected cancel quit
NSArray *windowsList = [NSApp orderedWindows];
if ([windowsList count]) {
[[windowsList objectAtIndex:0] makeKeyAndOrderFront:nil];
- //Handle the modifiers keyes changed state issue
- //as recovering from the quit dialog is like application
- //gaining focus back.
- //Main issue fixed is Cmd modifier not being cleared
+ // Handle the modifiers keyes changed state issue
+ // as recovering from the quit dialog is like application
+ // gaining focus back.
+ // Main issue fixed is Cmd modifier not being cleared
handleApplicationBecomeActiveEvent();
}
}
@@ -1390,11 +1397,12 @@ bool GHOST_SystemCocoa::handleOpenDocumentRequest(void *filepathStr)
return NO;
}
- //Discard event if we are in cursor grab sequence, it'll lead to "stuck cursor" situation if the alert panel is raised
+ /* Discard event if we are in cursor grab sequence,
+ * it'll lead to "stuck cursor" situation if the alert panel is raised */
if (window && window->getCursorGrabModeIsWarp())
return GHOST_kExitCancel;
- //Check open windows if some changes are not saved
+ // Check open windows if some changes are not saved
if (m_windowManager->getAnyModifiedState()) {
confirmOpen = NSRunAlertPanel(
[NSString stringWithFormat:@"Opening %@", [filepath lastPathComponent]],
@@ -1404,7 +1412,7 @@ bool GHOST_SystemCocoa::handleOpenDocumentRequest(void *filepathStr)
nil);
}
- //Give back focus to the blender window
+ // Give back focus to the blender window
windowsList = [NSApp orderedWindows];
if ([windowsList count]) {
[[windowsList objectAtIndex:0] makeKeyAndOrderFront:nil];
@@ -1439,7 +1447,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleTabletEvent(void *eventPtr, short eventT
window = m_windowManager->getWindowAssociatedWithOSWindow((void *)[event window]);
if (!window) {
- //printf("\nW failure for event 0x%x",[event type]);
+ // printf("\nW failure for event 0x%x",[event type]);
return GHOST_kFailure;
}
@@ -1463,7 +1471,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleTabletEvent(void *eventPtr, short eventT
ct.Xtilt = 0;
ct.Ytilt = 0;
if ([event isEnteringProximity]) {
- //pointer is entering tablet area proximity
+ // pointer is entering tablet area proximity
switch ([event pointingDeviceType]) {
case NSPenPointingDevice:
ct.Active = GHOST_kTabletModeStylus;
@@ -1504,7 +1512,7 @@ bool GHOST_SystemCocoa::handleTabletEvent(void *eventPtr)
handleTabletEvent(eventPtr, NSTabletProximity);
return true;
default:
- //No tablet event included : do nothing
+ // No tablet event included : do nothing
return false;
}
}
@@ -1523,7 +1531,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
if (!window) {
window = (GHOST_WindowCocoa *)m_windowManager->getActiveWindow();
if (!window) {
- //printf("\nW failure for event 0x%x",[event type]);
+ // printf("\nW failure for event 0x%x",[event type]);
return GHOST_kFailure;
}
}
@@ -1534,43 +1542,43 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
case NSLeftMouseDown:
pushEvent(new GHOST_EventButton(
[event timestamp] * 1000, GHOST_kEventButtonDown, window, GHOST_kButtonMaskLeft));
- handleTabletEvent(event); //Handle tablet events combined with mouse events
+ handleTabletEvent(event); // Handle tablet events combined with mouse events
break;
case NSRightMouseDown:
pushEvent(new GHOST_EventButton(
[event timestamp] * 1000, GHOST_kEventButtonDown, window, GHOST_kButtonMaskRight));
- handleTabletEvent(event); //Handle tablet events combined with mouse events
+ handleTabletEvent(event); // Handle tablet events combined with mouse events
break;
case NSOtherMouseDown:
pushEvent(new GHOST_EventButton([event timestamp] * 1000,
GHOST_kEventButtonDown,
window,
convertButton([event buttonNumber])));
- handleTabletEvent(event); //Handle tablet events combined with mouse events
+ handleTabletEvent(event); // Handle tablet events combined with mouse events
break;
case NSLeftMouseUp:
pushEvent(new GHOST_EventButton(
[event timestamp] * 1000, GHOST_kEventButtonUp, window, GHOST_kButtonMaskLeft));
- handleTabletEvent(event); //Handle tablet events combined with mouse events
+ handleTabletEvent(event); // Handle tablet events combined with mouse events
break;
case NSRightMouseUp:
pushEvent(new GHOST_EventButton(
[event timestamp] * 1000, GHOST_kEventButtonUp, window, GHOST_kButtonMaskRight));
- handleTabletEvent(event); //Handle tablet events combined with mouse events
+ handleTabletEvent(event); // Handle tablet events combined with mouse events
break;
case NSOtherMouseUp:
pushEvent(new GHOST_EventButton([event timestamp] * 1000,
GHOST_kEventButtonUp,
window,
convertButton([event buttonNumber])));
- handleTabletEvent(event); //Handle tablet events combined with mouse events
+ handleTabletEvent(event); // Handle tablet events combined with mouse events
break;
case NSLeftMouseDragged:
case NSRightMouseDragged:
case NSOtherMouseDragged:
- //Handle tablet events combined with mouse events
+ // Handle tablet events combined with mouse events
handleTabletEvent(event);
case NSMouseMoved: {
@@ -1584,7 +1592,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
}
switch (grab_mode) {
- case GHOST_kGrabHide: //Cursor hidden grab operation : no cursor move
+ case GHOST_kGrabHide: // Cursor hidden grab operation : no cursor move
{
GHOST_TInt32 x_warp, y_warp, x_accum, y_accum, x, y;
@@ -1594,7 +1602,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
window->getCursorGrabAccum(x_accum, y_accum);
x_accum += [event deltaX];
y_accum += -[event
- deltaY]; //Strange Apple implementation (inverted coordinates for the deltaY) ...
+ deltaY]; // Strange Apple implementation (inverted coordinates for the deltaY) ...
window->setCursorGrabAccum(x_accum, y_accum);
window->clientToScreenIntern(x_warp + x_accum, y_warp + y_accum, x, y);
@@ -1602,7 +1610,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
[event timestamp] * 1000, GHOST_kEventCursorMove, window, x, y));
break;
}
- case GHOST_kGrabWrap: //Wrap cursor at area/window boundaries
+ case GHOST_kGrabWrap: // Wrap cursor at area/window boundaries
{
NSPoint mousePos = [cocoawindow mouseLocationOutsideOfEventStream];
GHOST_TInt32 x_mouse = mousePos.x;
@@ -1613,23 +1621,24 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
if (window->getCursorGrabBounds(bounds) == GHOST_kFailure)
window->getClientBounds(bounds);
- //Switch back to Cocoa coordinates orientation (y=0 at botton,the same as blender internal btw!), and to client coordinates
+ /* Switch back to Cocoa coordinates orientation
+ * (y=0 at botton,the same as blender internal btw!), and to client coordinates. */
window->getClientBounds(windowBounds);
window->screenToClient(bounds.m_l, bounds.m_b, correctedBounds.m_l, correctedBounds.m_t);
window->screenToClient(bounds.m_r, bounds.m_t, correctedBounds.m_r, correctedBounds.m_b);
correctedBounds.m_b = (windowBounds.m_b - windowBounds.m_t) - correctedBounds.m_b;
correctedBounds.m_t = (windowBounds.m_b - windowBounds.m_t) - correctedBounds.m_t;
- //Get accumulation from previous mouse warps
+ // Get accumulation from previous mouse warps
GHOST_TInt32 x_accum, y_accum;
window->getCursorGrabAccum(x_accum, y_accum);
- //Warp mouse cursor if needed
+ // Warp mouse cursor if needed
GHOST_TInt32 warped_x_mouse = x_mouse;
GHOST_TInt32 warped_y_mouse = y_mouse;
correctedBounds.wrapPoint(warped_x_mouse, warped_y_mouse, 4);
- //Set new cursor position
+ // Set new cursor position
if (x_mouse != warped_x_mouse || y_mouse != warped_y_mouse) {
GHOST_TInt32 warped_x, warped_y;
window->clientToScreenIntern(warped_x_mouse, warped_y_mouse, warped_x, warped_y);
@@ -1638,7 +1647,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
y_accum + (y_mouse - warped_y_mouse));
}
- //Generate event
+ // Generate event
GHOST_TInt32 x, y;
window->clientToScreenIntern(x_mouse + x_accum, y_mouse + y_accum, x, y);
pushEvent(new GHOST_EventCursor(
@@ -1646,7 +1655,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
break;
}
default: {
- //Normal cursor operation: send mouse position in window
+ // Normal cursor operation: send mouse position in window
NSPoint mousePos = [cocoawindow mouseLocationOutsideOfEventStream];
GHOST_TInt32 x, y;
@@ -1668,9 +1677,9 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
phase = [event phase];
/* when pressing a key while momentum scrolling continues after
- * lifting fingers off the trackpad, the action can unexpectedly
- * change from e.g. scrolling to zooming. this works around the
- * issue by ignoring momentum scroll after a key press */
+ * lifting fingers off the trackpad, the action can unexpectedly
+ * change from e.g. scrolling to zooming. this works around the
+ * issue by ignoring momentum scroll after a key press */
if (momentumPhase) {
if (m_ignoreMomentumScroll)
break;
@@ -1680,14 +1689,15 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
}
/* we assume phases are only set for gestures from trackpad or magic
- * mouse events. note that using tablet at the same time may not work
- * since this is a static variable */
+ * mouse events. note that using tablet at the same time may not work
+ * since this is a static variable */
if (phase == NSEventPhaseBegan)
m_multiTouchScroll = true;
else if (phase == NSEventPhaseEnded)
m_multiTouchScroll = false;
- /* standard scrollwheel case, if no swiping happened, and no momentum (kinetic scroll) works */
+ /* Standard scrollwheel case, if no swiping happened,
+ * and no momentum (kinetic scroll) works. */
if (!m_multiTouchScroll && momentumPhase == NSEventPhaseNone) {
GHOST_TInt32 delta;
@@ -1696,7 +1706,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
if (deltaF == 0.0)
deltaF = [event deltaX]; // make blender decide if it's horizontal scroll
if (deltaF == 0.0)
- break; //discard trackpad delta=0 events
+ break; // discard trackpad delta=0 events
delta = deltaF > 0.0 ? 1 : -1;
pushEvent(new GHOST_EventWheel([event timestamp] * 1000, window, delta));
@@ -1711,7 +1721,8 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
dx = [event scrollingDeltaX];
dy = [event scrollingDeltaY];
- /* however, wacom tablet (intuos5) needs old deltas, it then has momentum and phase at zero */
+ /* However, wacom tablet (intuos5) needs old deltas,
+ * it then has momentum and phase at zero. */
if (phase == NSEventPhaseNone && momentumPhase == NSEventPhaseNone) {
dx = [event deltaX];
dy = [event deltaY];
@@ -1769,7 +1780,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr)
window = m_windowManager->getWindowAssociatedWithOSWindow((void *)[event window]);
if (!window) {
- //printf("\nW failure for event 0x%x",[event type]);
+ // printf("\nW failure for event 0x%x",[event type]);
return GHOST_kFailure;
}
@@ -1814,7 +1825,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr)
utf8_buf[0] = '\0';
if ((keyCode == GHOST_kKeyQ) && (m_modifierMask & NSCommandKeyMask))
- break; //Cmd-Q is directly handled by Cocoa
+ break; // Cmd-Q is directly handled by Cocoa
/* ascii is a subset of unicode */
if (utf8_buf[0] && !utf8_buf[1]) {
@@ -1824,12 +1835,30 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr)
if ([event type] == NSKeyDown) {
pushEvent(new GHOST_EventKey(
[event timestamp] * 1000, GHOST_kEventKeyDown, window, keyCode, ascii, utf8_buf));
- //printf("Key down rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii, utf8_buf);
+#if 0
+ printf("Key down rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",
+ [event keyCode],
+ [charsIgnoringModifiers length] > 0 ? [charsIgnoringModifiers characterAtIndex:0] :
+ ' ',
+ keyCode,
+ ascii,
+ ascii,
+ utf8_buf);
+#endif
}
else {
pushEvent(new GHOST_EventKey(
[event timestamp] * 1000, GHOST_kEventKeyUp, window, keyCode, 0, NULL));
- //printf("Key up rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii, utf8_buf);
+#if 0
+ printf("Key up rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",
+ [event keyCode],
+ [charsIgnoringModifiers length] > 0 ? [charsIgnoringModifiers characterAtIndex:0] :
+ ' ',
+ keyCode,
+ ascii,
+ ascii,
+ utf8_buf);
+#endif
}
m_ignoreMomentumScroll = true;
break;
diff --git a/intern/ghost/intern/GHOST_SystemSDL.cpp b/intern/ghost/intern/GHOST_SystemSDL.cpp
index 044695c115c..7b0407c6c4c 100644
--- a/intern/ghost/intern/GHOST_SystemSDL.cpp
+++ b/intern/ghost/intern/GHOST_SystemSDL.cpp
@@ -37,10 +37,7 @@ GHOST_SystemSDL::GHOST_SystemSDL() : GHOST_System()
printf("Error initializing SDL: %s\n", SDL_GetError());
}
- /* SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); */
- /* SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4); */
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
- SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
@@ -75,8 +72,7 @@ GHOST_IWindow *GHOST_SystemSDL::createWindow(const STR_String &title,
parentWindow,
type,
((glSettings.flags & GHOST_glStereoVisual) != 0),
- exclusive,
- glSettings.numOfAASamples);
+ exclusive);
if (window) {
if (GHOST_kWindowStateFullScreen == state) {
@@ -145,7 +141,6 @@ GHOST_TUns8 GHOST_SystemSDL::getNumDisplays() const
GHOST_IContext *GHOST_SystemSDL::createOffscreenContext()
{
GHOST_Context *context = new GHOST_ContextSDL(0,
- 0,
NULL,
0, // profile bit
3,
@@ -318,7 +313,7 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
SDL_WindowEvent &sdl_sub_evt = sdl_event->window;
GHOST_WindowSDL *window = findGhostWindow(
SDL_GetWindowFromID_fallback(sdl_sub_evt.windowID));
- //assert(window != NULL); // can be NULL on close window.
+ // assert(window != NULL); // can be NULL on close window.
switch (sdl_sub_evt.event) {
case SDL_WINDOWEVENT_EXPOSED:
@@ -360,8 +355,8 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
GHOST_TInt32 y_root = sdl_sub_evt.y + y_win;
#if 0
- if (window->getCursorGrabMode() != GHOST_kGrabDisable && window->getCursorGrabMode() != GHOST_kGrabNormal)
- {
+ if (window->getCursorGrabMode() != GHOST_kGrabDisable &&
+ window->getCursorGrabMode() != GHOST_kGrabNormal) {
GHOST_TInt32 x_new = x_root;
GHOST_TInt32 y_new = y_root;
GHOST_TInt32 x_accum, y_accum;
@@ -390,10 +385,15 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
SDL_WarpMouseInWindow(sdl_win, x_new - x_win, y_new - y_win);
}
- g_event = new GHOST_EventCursor(getMilliSeconds(), GHOST_kEventCursorMove, window, x_new, y_new);
+ g_event = new GHOST_EventCursor(
+ getMilliSeconds(), GHOST_kEventCursorMove, window, x_new, y_new);
}
else {
- g_event = new GHOST_EventCursor(getMilliSeconds(), GHOST_kEventCursorMove, window, x_root + x_accum, y_root + y_accum);
+ g_event = new GHOST_EventCursor(getMilliSeconds(),
+ GHOST_kEventCursorMove,
+ window,
+ x_root + x_accum,
+ y_root + y_accum);
}
}
else
@@ -453,7 +453,8 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
assert(window != NULL);
GHOST_TKey gkey = convertSDLKey(sdl_sub_evt.keysym.scancode);
- /* note, the sdl_sub_evt.keysym.sym is truncated, for unicode support ghost has to be modified */
+ /* note, the sdl_sub_evt.keysym.sym is truncated,
+ * for unicode support ghost has to be modified */
/* printf("%d\n", sym); */
if (sym > 127) {
switch (sym) {
@@ -631,7 +632,7 @@ bool GHOST_SystemSDL::generateWindowExposeEvents()
(*w_start)->validate();
if (g_event) {
- //printf("Expose events pushed\n");
+ // printf("Expose events pushed\n");
pushEvent(g_event);
anyProcessed = true;
}
@@ -656,7 +657,7 @@ bool GHOST_SystemSDL::processEvents(bool waitForEvent)
if (next == GHOST_kFireTimeNever) {
SDL_WaitEventTimeout(NULL, -1);
- //SleepTillEvent(m_display, -1);
+ // SleepTillEvent(m_display, -1);
}
else {
GHOST_TInt64 maxSleep = next - getMilliSeconds();
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 95f969bcb67..5d882fd6dcb 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -279,7 +279,6 @@ GHOST_IWindow *GHOST_SystemWin32::createWindow(const STR_String &title,
type,
((glSettings.flags & GHOST_glStereoVisual) != 0),
((glSettings.flags & GHOST_glAlphaBackground) != 0),
- glSettings.numOfAASamples,
parentWindow,
((glSettings.flags & GHOST_glDebugContext) != 0));
@@ -327,7 +326,6 @@ GHOST_IContext *GHOST_SystemWin32::createOffscreenContext()
for (int minor = 5; minor >= 0; --minor) {
context = new GHOST_ContextWGL(false,
true,
- 0,
wnd,
mHDC,
WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
@@ -346,7 +344,6 @@ GHOST_IContext *GHOST_SystemWin32::createOffscreenContext()
context = new GHOST_ContextWGL(false,
true,
- 0,
wnd,
mHDC,
WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
@@ -370,11 +367,11 @@ GHOST_IContext *GHOST_SystemWin32::createOffscreenContext()
}
#elif defined(WITH_GL_PROFILE_COMPAT)
- // ask for 2.1 context, driver gives any GL version >= 2.1 (hopefully the latest compatibility profile)
+ // ask for 2.1 context, driver gives any GL version >= 2.1
+ // (hopefully the latest compatibility profile)
// 2.1 ignores the profile bit & is incompatible with core profile
context = new GHOST_ContextWGL(false,
true,
- 0,
NULL,
NULL,
0, // no profile bit
@@ -1003,9 +1000,11 @@ GHOST_EventKey *GHOST_SystemWin32::processKeyEvent(GHOST_WindowWin32 *window, RA
int r;
GetKeyboardState((PBYTE)state);
- // don't call ToUnicodeEx on dead keys as it clears the buffer and so won't allow diacritical composition.
+ // Don't call ToUnicodeEx on dead keys as it clears the buffer and so won't allow diacritical
+ // composition.
if (MapVirtualKeyW(vk, 2) != 0) {
- // todo: ToUnicodeEx can respond with up to 4 utf16 chars (only 2 here). Could be up to 24 utf8 bytes.
+ // todo: ToUnicodeEx can respond with up to 4 utf16 chars (only 2 here).
+ // Could be up to 24 utf8 bytes.
if ((r = ToUnicodeEx(
vk, raw.data.keyboard.MakeCode, state, utf16, 2, 0, system->m_keylayout))) {
if ((r > 0 && r < 3)) {
@@ -1160,13 +1159,14 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
if (hwnd) {
#if 0
// Disabled due to bug in Intel drivers, see T51959
- if(msg == WM_NCCREATE) {
+ if (msg == WM_NCCREATE) {
// Tell Windows to automatically handle scaling of non-client areas
// such as the caption bar. EnableNonClientDpiScaling was introduced in Windows 10
HMODULE m_user32 = ::LoadLibrary("User32.dll");
if (m_user32) {
GHOST_WIN32_EnableNonClientDpiScaling fpEnableNonClientDpiScaling =
- (GHOST_WIN32_EnableNonClientDpiScaling) ::GetProcAddress(m_user32, "EnableNonClientDpiScaling");
+ (GHOST_WIN32_EnableNonClientDpiScaling)::GetProcAddress(m_user32,
+ "EnableNonClientDpiScaling");
if (fpEnableNonClientDpiScaling) {
fpEnableNonClientDpiScaling(hwnd);
@@ -1194,7 +1194,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
if (wParam == RIM_INPUTSINK) {
if (GetFocus() != hwnd) // WM_INPUT message not for this window
return 0;
- } //else wParam == RIM_INPUT
+ } // else wParam == RIM_INPUT
RAWINPUT raw;
RAWINPUT *raw_ptr = &raw;
@@ -1436,8 +1436,8 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
////////////////////////////////////////////////////////////////////////
case WM_NCMOUSEMOVE:
/* The WM_NCMOUSEMOVE message is posted to a window when the cursor is moved
- * within the nonclient area of the window. This message is posted to the window
- * that contains the cursor. If a window has captured the mouse, this message is not posted.
+ * within the nonclient area of the window. This message is posted to the window that
+ * contains the cursor. If a window has captured the mouse, this message is not posted.
*/
case WM_NCHITTEST:
/* The WM_NCHITTEST message is sent to a window when the cursor moves, or
@@ -1451,16 +1451,17 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
// Window events, processed
////////////////////////////////////////////////////////////////////////
case WM_CLOSE:
- /* The WM_CLOSE message is sent as a signal that a window or an application should terminate. */
+ /* The WM_CLOSE message is sent as a signal that a window
+ * or an application should terminate. */
event = processWindowEvent(GHOST_kEventWindowClose, window);
break;
case WM_ACTIVATE:
- /* The WM_ACTIVATE message is sent to both the window being activated and the window being
- * deactivated. If the windows use the same input queue, the message is sent synchronously,
- * first to the window procedure of the top-level window being deactivated, then to the window
- * procedure of the top-level window being activated. If the windows use different input queues,
- * the message is sent asynchronously, so the window is activated immediately.
- */
+ /* The WM_ACTIVATE message is sent to both the window being activated and the window
+ * being deactivated. If the windows use the same input queue, the message is sent
+ * synchronously, first to the window procedure of the top-level window being
+ * deactivated, then to the window procedure of the top-level window being activated.
+ * If the windows use different input queues, the message is sent asynchronously,
+ * so the window is activated immediately. */
{
GHOST_ModifierKeys modifiers;
modifiers.clear();
@@ -1470,7 +1471,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
GHOST_kEventWindowDeactivate,
window);
/* WARNING: Let DefWindowProc handle WM_ACTIVATE, otherwise WM_MOUSEWHEEL
- * will not be dispatched to OUR active window if we minimize one of OUR windows. */
+ * will not be dispatched to OUR active window if we minimize one of OUR windows. */
if (LOWORD(wParam) == WA_INACTIVE)
window->lostMouseCapture();
window->processWin32TabletActivateEvent(GET_WM_ACTIVATE_STATE(wParam, lParam));
@@ -1522,7 +1523,8 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
* to perform any move or size change processing during the WM_WINDOWPOSCHANGED
* message without calling DefWindowProc.
*/
- /* we get first WM_SIZE before we fully init. So, do not dispatch before we continiously resizng */
+ /* we get first WM_SIZE before we fully init.
+ * So, do not dispatch before we continiously resizng */
if (window->m_inLiveResize) {
system->pushEvent(processWindowEvent(GHOST_kEventWindowSize, window));
system->dispatchEvents();
@@ -1556,9 +1558,10 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
case WM_DPICHANGED:
- /* The WM_DPICHANGED message is sent when the effective dots per inch (dpi) for a window has changed.
- * The DPI is the scale factor for a window. There are multiple events that can cause the DPI to
- * change such as when the window is moved to a monitor with a different DPI.
+ /* The WM_DPICHANGED message is sent when the effective dots per inch (dpi) for a
+ * window has changed. The DPI is the scale factor for a window. There are multiple
+ * events that can cause the DPI tochange such as when the window is moved to a monitor
+ * with a different DPI.
*/
{
// The suggested new size and position of the window.
@@ -1597,31 +1600,33 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
* invalidated portion of a window for painting.
*/
case WM_NCPAINT:
- /* An application sends the WM_NCPAINT message to a window when its frame must be painted. */
+ /* An application sends the WM_NCPAINT message to a window
+ * when its frame must be painted. */
case WM_NCACTIVATE:
- /* The WM_NCACTIVATE message is sent to a window when its nonclient area needs to be changed
- * to indicate an active or inactive state.
- */
+ /* The WM_NCACTIVATE message is sent to a window when its nonclient area needs to be
+ * changed to indicate an active or inactive state. */
case WM_DESTROY:
- /* The WM_DESTROY message is sent when a window is being destroyed. It is sent to the window
- * procedure of the window being destroyed after the window is removed from the screen.
- * This message is sent first to the window being destroyed and then to the child windows
- * (if any) as they are destroyed. During the processing of the message, it can be assumed
- * that all child windows still exist.
- */
+ /* The WM_DESTROY message is sent when a window is being destroyed. It is sent to the
+ * window procedure of the window being destroyed after the window is removed from the
+ * screen. This message is sent first to the window being destroyed and then to the child
+ * windows (if any) as they are destroyed. During the processing of the message, it can
+ * be assumed that all child windows still exist. */
case WM_NCDESTROY:
- /* The WM_NCDESTROY message informs a window that its nonclient area is being destroyed. The
- * DestroyWindow function sends the WM_NCDESTROY message to the window following the WM_DESTROY
- * message. WM_DESTROY is used to free the allocated memory object associated with the window.
+ /* The WM_NCDESTROY message informs a window that its nonclient area is being
+ * destroyed. The DestroyWindow function sends the WM_NCDESTROY message to the window
+ * following the WM_DESTROY message. WM_DESTROY is used to free the allocated memory
+ * object associated with the window.
*/
break;
case WM_KILLFOCUS:
- /* The WM_KILLFOCUS message is sent to a window immediately before it loses the keyboard focus.
- * We want to prevent this if a window is still active and it loses focus to nowhere*/
+ /* The WM_KILLFOCUS message is sent to a window immediately before it loses the
+ * keyboard focus. We want to prevent this if a window is still active and it loses
+ * focus to nowhere. */
if (!wParam && hwnd == ::GetActiveWindow())
::SetFocus(hwnd);
case WM_SHOWWINDOW:
- /* The WM_SHOWWINDOW message is sent to a window when the window is about to be hidden or shown. */
+ /* The WM_SHOWWINDOW message is sent to a window when the window is
+ * about to be hidden or shown. */
case WM_WINDOWPOSCHANGING:
/* The WM_WINDOWPOSCHANGING message is sent to a window whose size, position, or place in
* the Z order is about to change as a result of a call to the SetWindowPos function or
diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h
index 0eb91d511b1..98b18d2c00b 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.h
+++ b/intern/ghost/intern/GHOST_SystemWin32.h
@@ -102,7 +102,8 @@ class GHOST_SystemWin32 : public GHOST_System {
* Create a new window.
* The new window is added to the list of windows managed.
* Never explicitly delete the window, use disposeWindow() instead.
- * \param title The name of the window (displayed in the title bar of the window if the OS supports it).
+ * \param title The name of the window
+ * (displayed in the title bar of the window if the OS supports it).
* \param left The coordinate of the left edge of the window.
* \param top The coordinate of the top edge of the window.
* \param width The width the window.
@@ -205,11 +206,12 @@ class GHOST_SystemWin32 : public GHOST_System {
/**
* Creates a drag'n'drop event and pushes it immediately onto the event queue.
* Called by GHOST_DropTargetWin32 class.
- * \param eventType The type of drag'n'drop event
- * \param draggedObjectType The type object concerned (currently array of file names, string, ?bitmap)
- * \param mouseX x mouse coordinate (in window coordinates)
- * \param mouseY y mouse coordinate
- * \param window The window on which the event occurred
+ * \param eventType: The type of drag'n'drop event
+ * \param draggedObjectType: The type object concerned
+ * (currently array of file names, string, ?bitmap)
+ * \param mouseX: x mouse coordinate (in window coordinates)
+ * \param mouseY: y mouse coordinate
+ * \param window: The window on which the event occurred
* \return Indication whether the event was handled.
*/
static GHOST_TSuccess pushDragDropEvent(GHOST_TEventType eventType,
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 4d467f3b913..c688d7713b2 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -88,8 +88,8 @@
/* see [#34039] Fix Alt key glitch on Unity desktop */
#define USE_UNITY_WORKAROUND
-/* Fix 'shortcut' part of keyboard reading code only ever using first defined keymap instead of active one.
- * See T47228 and D1746 */
+/* Fix 'shortcut' part of keyboard reading code only ever using first defined keymap
+ * instead of active one. See T47228 and D1746 */
#define USE_NON_LATIN_KB_WORKAROUND
static GHOST_TKey ghost_key_from_keysym(const KeySym key);
@@ -314,7 +314,8 @@ void GHOST_SystemX11::getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32
* Create a new window.
* The new window is added to the list of windows managed.
* Never explicitly delete the window, use disposeWindow() instead.
- * \param title The name of the window (displayed in the title bar of the window if the OS supports it).
+ * \param title The name of the window
+ * (displayed in the title bar of the window if the OS supports it).
* \param left The coordinate of the left edge of the window.
* \param top The coordinate of the top edge of the window.
* \param width The width the window.
@@ -355,7 +356,6 @@ GHOST_IWindow *GHOST_SystemX11::createWindow(const STR_String &title,
((glSettings.flags & GHOST_glStereoVisual) != 0),
exclusive,
((glSettings.flags & GHOST_glAlphaBackground) != 0),
- glSettings.numOfAASamples,
(glSettings.flags & GHOST_glDebugContext) != 0);
if (window) {
@@ -421,7 +421,6 @@ GHOST_IContext *GHOST_SystemX11::createOffscreenContext()
for (int minor = 5; minor >= 0; --minor) {
context = new GHOST_ContextGLX(false,
- 0,
(Window)NULL,
m_display,
(GLXFBConfig)NULL,
@@ -439,7 +438,6 @@ GHOST_IContext *GHOST_SystemX11::createOffscreenContext()
}
context = new GHOST_ContextGLX(false,
- 0,
(Window)NULL,
m_display,
(GLXFBConfig)NULL,
@@ -692,14 +690,16 @@ bool GHOST_SystemX11::processEvents(bool waitForEvent)
if (xev_next.type == KeyPress || xev_next.type == KeyRelease) {
/* XK_Hyper_L/R currently unused */
- const static KeySym modifiers[8] = {XK_Shift_L,
- XK_Shift_R,
- XK_Control_L,
- XK_Control_R,
- XK_Alt_L,
- XK_Alt_R,
- XK_Super_L,
- XK_Super_R};
+ const static KeySym modifiers[8] = {
+ XK_Shift_L,
+ XK_Shift_R,
+ XK_Control_L,
+ XK_Control_R,
+ XK_Alt_L,
+ XK_Alt_R,
+ XK_Super_L,
+ XK_Super_R,
+ };
for (int i = 0; i < (sizeof(modifiers) / sizeof(*modifiers)); i++) {
KeyCode kc = XKeysymToKeycode(m_display, modifiers[i]);
@@ -945,18 +945,19 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
* - Fallback to XLookupString to get a key_sym from active user-defined keymap.
*
* Note that:
- * - This effectively 'lock' main number keys to always output number events (except when using alt-gr).
- * - This enforces users to use an ascii-compatible keymap with Blender - but at least it gives
- * predictable and consistent results.
+ * - This effectively 'lock' main number keys to always output number events
+ * (except when using alt-gr).
+ * - This enforces users to use an ascii-compatible keymap with Blender -
+ * but at least it gives predictable and consistent results.
*
- * Also, note that nothing in XLib sources [1] makes it obvious why those two functions give different
- * key_sym results...
+ * Also, note that nothing in XLib sources [1] makes it obvious why those two functions give
+ * different key_sym results...
*
* [1] http://cgit.freedesktop.org/xorg/lib/libX11/tree/src/KeyBind.c
*/
KeySym key_sym_str;
- /* Mode_switch 'modifier' is AltGr - when this one or Shift are enabled, we do not want to apply
- * that 'forced number' hack. */
+ /* Mode_switch 'modifier' is AltGr - when this one or Shift are enabled,
+ * we do not want to apply that 'forced number' hack. */
const unsigned int mode_switch_mask = XkbKeysymToModifiers(xke->display, XK_Mode_switch);
const unsigned int number_hack_forbidden_kmods_mask = mode_switch_mask | ShiftMask;
if ((xke->keycode >= 10 && xke->keycode < 20) &&
@@ -974,8 +975,8 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
ascii = '\0';
}
- /* Only allow a limited set of keys from XLookupKeysym, all others we take from XLookupString,
- * unless it gives unknown key... */
+ /* Only allow a limited set of keys from XLookupKeysym,
+ * all others we take from XLookupString, unless it gives unknown key... */
gkey = ghost_key_from_keysym_or_keycode(key_sym, m_xkb_descr, xke->keycode);
switch (gkey) {
case GHOST_kKeyRightAlt:
@@ -1182,7 +1183,8 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
XFocusChangeEvent &xfe = xe->xfocus;
/* TODO: make sure this is the correct place for activate/deactivate */
- // printf("X: focus %s for window %d\n", xfe.type == FocusIn ? "in" : "out", (int) xfe.window);
+ // printf("X: focus %s for window %d\n",
+ // xfe.type == FocusIn ? "in" : "out", (int) xfe.window);
/* May have to look at the type of event and filter some out. */
@@ -1234,7 +1236,8 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
}
else {
#ifdef WITH_XDND
- /* try to handle drag event (if there's no such events, GHOST_HandleClientMessage will return zero) */
+ /* try to handle drag event
+ * (if there's no such events, GHOST_HandleClientMessage will return zero) */
if (window->getDropTarget()->GHOST_HandleClientMessage(xe) == false) {
/* Unknown client message, ignore */
}
@@ -1268,7 +1271,8 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
getMilliSeconds(), GHOST_kEventCursorMove, window, xce.x_root, xce.y_root);
}
- // printf("X: %s window %d\n", xce.type == EnterNotify ? "entering" : "leaving", (int) xce.window);
+ // printf("X: %s window %d\n",
+ // xce.type == EnterNotify ? "entering" : "leaving", (int) xce.window);
if (xce.type == EnterNotify)
m_windowManager->setActiveWindow(window);
@@ -1395,9 +1399,10 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
* around tablet surface */
window->GetTabletData()->Active = xtablet.mode;
- /* Note: This event might be generated with incomplete dataset (don't exactly know why, looks like in
- * some cases, if the value does not change, it is not included in subsequent XDeviceMotionEvent
- * events). So we have to check which values this event actually contains!
+ /* Note: This event might be generated with incomplete dataset
+ * (don't exactly know why, looks like in some cases, if the value does not change,
+ * it is not included in subsequent XDeviceMotionEvent events).
+ * So we have to check which values this event actually contains!
*/
# define AXIS_VALUE_GET(axis, val) \
@@ -1412,8 +1417,9 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
* but I got garbage data without it. Found it in the xidump.c source --matt
*
* The '& 0xffff' just truncates the value to its two lowest bytes, this probably means
- * some drivers do not properly set the whole int value? Since we convert to float afterward,
- * I don't think we need to cast to short here, but do not have a device to check this. --mont29
+ * some drivers do not properly set the whole int value? Since we convert to float
+ * afterward, I don't think we need to cast to short here, but do not have a device to
+ * check this. --mont29
*/
if (AXIS_VALUE_GET(3, axis_value)) {
window->GetTabletData()->Xtilt = (short)(axis_value & 0xffff) /
@@ -2278,7 +2284,7 @@ void GHOST_SystemX11::refreshXInputDevices()
NULL;
GHOST_TTabletMode tablet_mode = tablet_mode_from_name(device_info[i].name, device_type);
- // printf("Tablet type:'%s', name:'%s', index:%d\n", device_type, device_info[i].name, i);
+ // printf("Tablet type:'%s', name:'%s', index:%d\n", device_type, device_info[i].name, i);
if (device_type) {
XFree((void *)device_type);
diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h
index d73582b52fa..f7f33185f9b 100644
--- a/intern/ghost/intern/GHOST_SystemX11.h
+++ b/intern/ghost/intern/GHOST_SystemX11.h
@@ -128,7 +128,8 @@ class GHOST_SystemX11 : public GHOST_System {
* Create a new window.
* The new window is added to the list of windows managed.
* Never explicitly delete the window, use disposeWindow() instead.
- * \param title The name of the window (displayed in the title bar of the window if the OS supports it).
+ * \param title The name of the window
+ * (displayed in the title bar of the window if the OS supports it).
* \param left The coordinate of the left edge of the window.
* \param top The coordinate of the top edge of the window.
* \param width The width the window.
@@ -241,7 +242,8 @@ class GHOST_SystemX11 : public GHOST_System {
* Creates a drag'n'drop event and pushes it immediately onto the event queue.
* Called by GHOST_DropTargetX11 class.
* \param eventType The type of drag'n'drop event
- * \param draggedObjectType The type object concerned (currently array of file names, string, ?bitmap)
+ * \param draggedObjectType The type object concerned
+ * (currently array of file names, string, ?bitmap)
* \param mouseX x mouse coordinate (in window coordinates)
* \param mouseY y mouse coordinate
* \param window The window on which the event occurred
diff --git a/intern/ghost/intern/GHOST_Window.cpp b/intern/ghost/intern/GHOST_Window.cpp
index 06b76aee23d..85283a34d2e 100644
--- a/intern/ghost/intern/GHOST_Window.cpp
+++ b/intern/ghost/intern/GHOST_Window.cpp
@@ -35,15 +35,13 @@ GHOST_Window::GHOST_Window(GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
const bool wantStereoVisual,
- const bool /*exclusive*/,
- const GHOST_TUns16 wantNumOfAASamples)
+ const bool /*exclusive*/)
: m_drawingContextType(GHOST_kDrawingContextTypeNone),
m_cursorVisible(true),
m_cursorGrab(GHOST_kGrabDisable),
m_cursorShape(GHOST_kStandardCursorDefault),
m_wantStereoVisual(wantStereoVisual),
- m_wantNumOfAASamples(wantNumOfAASamples),
- m_context(new GHOST_ContextNone(false, 0))
+ m_context(new GHOST_ContextNone(false))
{
m_isUnsavedChanges = false;
m_canAcceptDragOperation = false;
@@ -85,7 +83,7 @@ GHOST_TSuccess GHOST_Window::setDrawingContextType(GHOST_TDrawingContextType typ
m_drawingContextType = type;
}
else {
- m_context = new GHOST_ContextNone(m_wantStereoVisual, m_wantNumOfAASamples);
+ m_context = new GHOST_ContextNone(m_wantStereoVisual);
m_drawingContextType = GHOST_kDrawingContextTypeNone;
}
@@ -111,11 +109,6 @@ GHOST_TSuccess GHOST_Window::getSwapInterval(int &intervalOut)
return m_context->getSwapInterval(intervalOut);
}
-GHOST_TUns16 GHOST_Window::getNumOfAASamples()
-{
- return m_context->getNumOfAASamples();
-}
-
GHOST_TSuccess GHOST_Window::activateDrawingContext()
{
return m_context->activateDrawingContext();
diff --git a/intern/ghost/intern/GHOST_Window.h b/intern/ghost/intern/GHOST_Window.h
index 8c01d66bbfd..b5399ec803e 100644
--- a/intern/ghost/intern/GHOST_Window.h
+++ b/intern/ghost/intern/GHOST_Window.h
@@ -50,14 +50,12 @@ class GHOST_Window : public GHOST_IWindow {
* \param stereoVisual Stereo visual for quad buffered stereo.
* \param exclusive Use to show the window ontop and ignore others
* (used fullscreen).
- * \param numOfAASamples Number of samples used for AA (zero if no AA)
*/
GHOST_Window(GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
const bool wantStereoVisual = false,
- const bool exclusive = false,
- const GHOST_TUns16 wantNumOfAASamples = 0);
+ const bool exclusive = false);
/**
* \section Interface inherited from GHOST_IWindow left for derived class
@@ -70,8 +68,10 @@ class GHOST_Window : public GHOST_IWindow {
* virtual GHOST_TSuccess setClientWidth(GHOST_TUns32 width) = 0;
* virtual GHOST_TSuccess setClientHeight(GHOST_TUns32 height) = 0;
* virtual GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height) = 0;
- * virtual void screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0;
- * virtual void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0;
+ * virtual void screenToClient(
+ * GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0;
+ * virtual void clientToScreen(
+ * GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0;
* virtual GHOST_TWindowState getState() const = 0;
* virtual GHOST_TSuccess setState(GHOST_TWindowState state) = 0;
* virtual GHOST_TSuccess setOrder(GHOST_TWindowOrder order) = 0;
@@ -202,12 +202,6 @@ class GHOST_Window : public GHOST_IWindow {
GHOST_TSuccess getSwapInterval(int &intervalOut);
/**
- * Gets the current swap interval for swapBuffers.
- * \return Number of AA Samples (0 if there is no multisample buffer)
- */
- GHOST_TUns16 getNumOfAASamples();
-
- /**
* Tells if the ongoing drag'n'drop object can be accepted upon mouse drop
*/
void setAcceptDragOperation(bool canAccept);
@@ -400,9 +394,6 @@ class GHOST_Window : public GHOST_IWindow {
/** Whether to attempt to initialize a context with a stereo framebuffer. */
bool m_wantStereoVisual;
- /** Attempt to initialize a context with this many samples. */
- GHOST_TUns16 m_wantNumOfAASamples;
-
/** Full-screen width */
GHOST_TUns32 m_fullScreenWidth;
/** Full-screen height */
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.h b/intern/ghost/intern/GHOST_WindowCocoa.h
index acda109eb7f..41e7191701e 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.h
+++ b/intern/ghost/intern/GHOST_WindowCocoa.h
@@ -54,7 +54,6 @@ class GHOST_WindowCocoa : public GHOST_Window {
* \param state The state the window is initially opened with.
* \param type The type of drawing context installed in this window.
* \param stereoVisual Stereo visual for quad buffered stereo.
- * \param numOfAASamples Number of samples used for AA (zero if no AA)
*/
GHOST_WindowCocoa(GHOST_SystemCocoa *systemCocoa,
const STR_String &title,
@@ -65,7 +64,6 @@ class GHOST_WindowCocoa : public GHOST_Window {
GHOST_TWindowState state,
GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone,
const bool stereoVisual = false,
- const GHOST_TUns16 numOfAASamples = 0,
bool is_debug = false);
/**
@@ -100,7 +98,8 @@ class GHOST_WindowCocoa : public GHOST_Window {
/**
* Returns the window rectangle dimensions.
- * The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.
+ * The dimensions are given in screen coordinates that are
+ * relative to the upper-left corner of the screen.
* \param bounds The bounding rectangle of the window.
*/
void getWindowBounds(GHOST_Rect &bounds) const;
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm
index 46343e17e46..f257399fc9c 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.mm
+++ b/intern/ghost/intern/GHOST_WindowCocoa.mm
@@ -32,6 +32,8 @@
#include <sys/sysctl.h>
+/* clang-format off */
+
#pragma mark Cocoa window delegate object
@interface CocoaWindowDelegate : NSObject <NSWindowDelegate>
@@ -113,7 +115,8 @@
//Send event only once, at end of resize operation (when user has released mouse button)
systemCocoa->handleWindowEvent(GHOST_kEventWindowSize, associatedWindow);
//}
- /* Live resize, send event, gets handled in wm_window.c. Needed because live resize runs in a modal loop, not letting main loop run */
+ /* Live resize, send event, gets handled in wm_window.c.
+ * Needed because live resize runs in a modal loop, not letting main loop run */
if ([[notification object] inLiveResize]) {
systemCocoa->dispatchEvents();
}
@@ -134,7 +137,8 @@
@end
#pragma mark NSWindow subclass
-//We need to subclass it to tell that even borderless (fullscreen), it can become key (receive user events)
+// We need to subclass it to tell that even borderless (fullscreen),
+// it can become key (receive user events)
@interface CocoaWindow : NSWindow
{
GHOST_SystemCocoa *systemCocoa;
@@ -516,6 +520,8 @@
#pragma mark initialization / finalization
+/* clang-format on */
+
GHOST_WindowCocoa::GHOST_WindowCocoa(GHOST_SystemCocoa *systemCocoa,
const STR_String &title,
GHOST_TInt32 left,
@@ -525,9 +531,8 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(GHOST_SystemCocoa *systemCocoa,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
const bool stereoVisual,
- const GHOST_TUns16 numOfAASamples,
bool is_debug)
- : GHOST_Window(width, height, state, stereoVisual, false, numOfAASamples),
+ : GHOST_Window(width, height, state, stereoVisual, false),
m_customCursor(0),
m_debug_context(is_debug)
{
@@ -537,7 +542,7 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(GHOST_SystemCocoa *systemCocoa,
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- //Creates the window
+ // Creates the window
NSRect rect;
NSSize minSize;
@@ -560,12 +565,12 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(GHOST_SystemCocoa *systemCocoa,
[m_window setSystemAndWindowCocoa:systemCocoa windowCocoa:this];
- //Forbid to resize the window below the blender defined minimum one
+ // Forbid to resize the window below the blender defined minimum one
minSize.width = 320;
minSize.height = 240;
[m_window setContentMinSize:minSize];
- //Creates the OpenGL View inside the window
+ // Creates the OpenGL View inside the window
m_openGLView = [[CocoaOpenGLView alloc] initWithFrame:rect];
if (m_systemCocoa->m_nativePixel) {
@@ -667,7 +672,7 @@ void GHOST_WindowCocoa::setTitle(const STR_String &title)
NSString *windowTitle = [[NSString alloc] initWithCString:title encoding:NSUTF8StringEncoding];
- //Set associated file if applicable
+ // Set associated file if applicable
if (windowTitle && [windowTitle hasPrefix:@"Blender"]) {
NSRange fileStrRange;
NSString *associatedFileName;
@@ -681,7 +686,7 @@ void GHOST_WindowCocoa::setTitle(const STR_String &title)
associatedFileName = [windowTitle substringWithRange:fileStrRange];
[m_window setTitle:[associatedFileName lastPathComponent]];
- //Blender used file open/save functions converte file names into legal URL ones
+ // Blender used file open/save functions converte file names into legal URL ones
associatedFileName = [associatedFileName
stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
@try {
@@ -748,7 +753,7 @@ void GHOST_WindowCocoa::getClientBounds(GHOST_Rect &bounds) const
NSRect screenSize = [[m_window screen] visibleFrame];
- //Max window contents as screen size (excluding title bar...)
+ // Max window contents as screen size (excluding title bar...)
NSRect contentRect = [CocoaWindow
contentRectForFrameRect:screenSize
styleMask:(NSTitledWindowMask | NSClosableWindowMask |
@@ -996,7 +1001,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setOrder(GHOST_TWindowOrder order)
[m_window orderBack:nil];
- //Check for other blender opened windows and make the frontmost key
+ // Check for other blender opened windows and make the frontmost key
windowsList = [NSApp orderedWindows];
if ([windowsList count]) {
[[windowsList objectAtIndex:0] makeKeyAndOrderFront:nil];
@@ -1014,7 +1019,6 @@ GHOST_Context *GHOST_WindowCocoa::newDrawingContext(GHOST_TDrawingContextType ty
if (type == GHOST_kDrawingContextTypeOpenGL) {
GHOST_Context *context = new GHOST_ContextCGL(m_wantStereoVisual,
- m_wantNumOfAASamples,
m_window,
m_openGLView,
@@ -1225,7 +1229,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCursorGrab(GHOST_TGrabCursorMode mode
GHOST_TSuccess err = GHOST_kSuccess;
if (mode != GHOST_kGrabDisable) {
- //No need to perform grab without warp as it is always on in OS X
+ // No need to perform grab without warp as it is always on in OS X
if (mode != GHOST_kGrabNormal) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@@ -1236,7 +1240,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCursorGrab(GHOST_TGrabCursorMode mode
setWindowCursorVisibility(false);
}
- //Make window key if it wasn't to get the mouse move events
+ // Make window key if it wasn't to get the mouse move events
[m_window makeKeyWindow];
[pool drain];
@@ -1248,7 +1252,8 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCursorGrab(GHOST_TGrabCursorMode mode
setWindowCursorVisibility(true);
}
- /* Almost works without but important otherwise the mouse GHOST location can be incorrect on exit */
+ /* Almost works without but important otherwise the mouse GHOST location
+ * can be incorrect on exit. */
setCursorGrabAccum(0, 0);
m_cursorGrabBounds.m_l = m_cursorGrabBounds.m_r = -1; /* disable */
}
@@ -1348,7 +1353,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCustomCursorShape(GHOST_TUns8 *bitmap
hotSpotPoint.x = hotX;
hotSpotPoint.y = hotY;
- //foreground and background color parameter is not handled for now (10.6)
+ // foreground and background color parameter is not handled for now (10.6)
m_customCursor = [[NSCursor alloc] initWithImage:cursorImage hotSpot:hotSpotPoint];
[cursorImageRep release];
diff --git a/intern/ghost/intern/GHOST_WindowManager.cpp b/intern/ghost/intern/GHOST_WindowManager.cpp
index ca557e472f7..52a57edd4e9 100644
--- a/intern/ghost/intern/GHOST_WindowManager.cpp
+++ b/intern/ghost/intern/GHOST_WindowManager.cpp
@@ -121,11 +121,11 @@ GHOST_TSuccess GHOST_WindowManager::endFullScreen(void)
GHOST_TSuccess success = GHOST_kFailure;
if (getFullScreen()) {
if (m_fullScreenWindow != NULL) {
- //GHOST_PRINT("GHOST_WindowManager::endFullScreen(): deleting full-screen window\n");
+ // GHOST_PRINT("GHOST_WindowManager::endFullScreen(): deleting full-screen window\n");
setWindowInactive(m_fullScreenWindow);
m_fullScreenWindow->endFullScreen();
delete m_fullScreenWindow;
- //GHOST_PRINT("GHOST_WindowManager::endFullScreen(): done\n");
+ // GHOST_PRINT("GHOST_WindowManager::endFullScreen(): done\n");
m_fullScreenWindow = NULL;
if (m_activeWindowBeforeFullScreen) {
setActiveWindow(m_activeWindowBeforeFullScreen);
diff --git a/intern/ghost/intern/GHOST_WindowNULL.h b/intern/ghost/intern/GHOST_WindowNULL.h
index 3ac3389291d..0ea33710ef6 100644
--- a/intern/ghost/intern/GHOST_WindowNULL.h
+++ b/intern/ghost/intern/GHOST_WindowNULL.h
@@ -45,9 +45,8 @@ class GHOST_WindowNULL : public GHOST_Window {
GHOST_TWindowState state,
const GHOST_TEmbedderWindowID parentWindow,
GHOST_TDrawingContextType type,
- const bool stereoVisual,
- const GHOST_TUns16 numOfAASamples)
- : GHOST_Window(width, height, state, stereoVisual, false, numOfAASamples), m_system(system)
+ const bool stereoVisual)
+ : GHOST_Window(width, height, state, stereoVisual, false), m_system(system)
{
setTitle(title);
}
diff --git a/intern/ghost/intern/GHOST_WindowSDL.cpp b/intern/ghost/intern/GHOST_WindowSDL.cpp
index d40377acc3a..9c9fffdba50 100644
--- a/intern/ghost/intern/GHOST_WindowSDL.cpp
+++ b/intern/ghost/intern/GHOST_WindowSDL.cpp
@@ -36,9 +36,8 @@ GHOST_WindowSDL::GHOST_WindowSDL(GHOST_SystemSDL *system,
const GHOST_TEmbedderWindowID parentWindow,
GHOST_TDrawingContextType type,
const bool stereoVisual,
- const bool exclusive,
- const GHOST_TUns16 numOfAASamples)
- : GHOST_Window(width, height, state, stereoVisual, exclusive, numOfAASamples),
+ const bool exclusive)
+ : GHOST_Window(width, height, state, stereoVisual, exclusive),
m_system(system),
m_valid_setup(false),
m_invalid_window(false),
@@ -81,7 +80,6 @@ GHOST_Context *GHOST_WindowSDL::newDrawingContext(GHOST_TDrawingContextType type
{
if (type == GHOST_kDrawingContextTypeOpenGL) {
GHOST_Context *context = new GHOST_ContextSDL(m_wantStereoVisual,
- m_wantNumOfAASamples,
m_sdl_win,
0, // profile bit
3,
@@ -349,24 +347,26 @@ static unsigned char sdl_std_cursor_mask_sb_h_double_arrow[] = {
0x18,
0x0c,
};
-static unsigned char sdl_std_cursor_sb_h_double_arrow[] = {0x00,
- 0x00,
- 0x08,
- 0x08,
- 0x0c,
- 0x18,
- 0xfe,
- 0x3f,
- 0x0f,
- 0x78,
- 0xfe,
- 0x3f,
- 0x0c,
- 0x18,
- 0x08,
- 0x08,
- 0x00,
- 0x00};
+static unsigned char sdl_std_cursor_sb_h_double_arrow[] = {
+ 0x00,
+ 0x00,
+ 0x08,
+ 0x08,
+ 0x0c,
+ 0x18,
+ 0xfe,
+ 0x3f,
+ 0x0f,
+ 0x78,
+ 0xfe,
+ 0x3f,
+ 0x0c,
+ 0x18,
+ 0x08,
+ 0x08,
+ 0x00,
+ 0x00,
+};
#define sdl_std_cursor_WIDTH_sb_h_double_arrow 15
#define sdl_std_cursor_HEIGHT_sb_h_double_arrow 9
#define sdl_std_cursor_HOT_X_sb_h_double_arrow -7
@@ -621,7 +621,7 @@ static void sdl_cursor_init(void)
DEF_CURSOR(bottom_right_corner, GHOST_kStandardCursorBottomRightCorner);
DEF_CURSOR(bottom_left_corner, GHOST_kStandardCursorBottomLeftCorner);
DEF_CURSOR(arrow, GHOST_kStandardCursorCopy);
- //DEF_CURSOR(arrow, GHOST_kStandardCursorCustom);
+ // DEF_CURSOR(arrow, GHOST_kStandardCursorCustom);
DEF_CURSOR(arrow, GHOST_kStandardCursorPencil);
#undef DEF_CURSOR
diff --git a/intern/ghost/intern/GHOST_WindowSDL.h b/intern/ghost/intern/GHOST_WindowSDL.h
index 3a9a1ad7df2..7b3cddc5f17 100644
--- a/intern/ghost/intern/GHOST_WindowSDL.h
+++ b/intern/ghost/intern/GHOST_WindowSDL.h
@@ -63,8 +63,7 @@ class GHOST_WindowSDL : public GHOST_Window {
const GHOST_TEmbedderWindowID parentWindow,
GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone,
const bool stereoVisual = false,
- const bool exclusive = false,
- const GHOST_TUns16 numOfAASamples = 0);
+ const bool exclusive = false);
~GHOST_WindowSDL();
diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp
index 2feda927998..def075bd47c 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -66,10 +66,9 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
GHOST_TDrawingContextType type,
bool wantStereoVisual,
bool alphaBackground,
- GHOST_TUns16 wantNumOfAASamples,
GHOST_TEmbedderWindowID parentwindowhwnd,
bool is_debug)
- : GHOST_Window(width, height, state, wantStereoVisual, false, wantNumOfAASamples),
+ : GHOST_Window(width, height, state, wantStereoVisual, false),
m_inLiveResize(false),
m_system(system),
m_hDC(0),
@@ -262,7 +261,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
::UpdateWindow(m_hWnd);
}
else {
- //invalidate the window
+ // invalidate the window
::DestroyWindow(m_hWnd);
m_hWnd = NULL;
}
@@ -657,11 +656,11 @@ GHOST_Context *GHOST_WindowWin32::newDrawingContext(GHOST_TDrawingContextType ty
#if defined(WITH_GL_PROFILE_CORE)
/* - AMD and Intel give us exactly this version
* - NVIDIA gives at least this version <-- desired behavior
- * So we ask for 4.5, 4.4 ... 3.3 in descending order to get the best version on the user's system. */
+ * So we ask for 4.5, 4.4 ... 3.3 in descending order
+ * to get the best version on the user's system. */
for (int minor = 5; minor >= 0; --minor) {
context = new GHOST_ContextWGL(m_wantStereoVisual,
m_wantAlphaBackground,
- m_wantNumOfAASamples,
m_hWnd,
m_hDC,
WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
@@ -679,7 +678,6 @@ GHOST_Context *GHOST_WindowWin32::newDrawingContext(GHOST_TDrawingContextType ty
}
context = new GHOST_ContextWGL(m_wantStereoVisual,
m_wantAlphaBackground,
- m_wantNumOfAASamples,
m_hWnd,
m_hDC,
WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
@@ -703,11 +701,11 @@ GHOST_Context *GHOST_WindowWin32::newDrawingContext(GHOST_TDrawingContextType ty
}
#elif defined(WITH_GL_PROFILE_COMPAT)
- // ask for 2.1 context, driver gives any GL version >= 2.1 (hopefully the latest compatibility profile)
+ // ask for 2.1 context, driver gives any GL version >= 2.1
+ // (hopefully the latest compatibility profile)
// 2.1 ignores the profile bit & is incompatible with core profile
context = new GHOST_ContextWGL(m_wantStereoVisual,
m_wantAlphaBackground,
- m_wantNumOfAASamples,
m_hWnd,
m_hDC,
0, // no profile bit
@@ -898,7 +896,8 @@ GHOST_TSuccess GHOST_WindowWin32::setWindowCursorGrab(GHOST_TGrabCursorMode mode
m_system->setCursorPosition(pos[0], pos[1]);
}
- /* Almost works without but important otherwise the mouse GHOST location can be incorrect on exit */
+ /* Almost works without but important otherwise the mouse GHOST location
+ * can be incorrect on exit. */
setCursorGrabAccum(0, 0);
m_cursorGrabBounds.m_l = m_cursorGrabBounds.m_r = -1; /* disable */
registerMouseClickEvent(3);
diff --git a/intern/ghost/intern/GHOST_WindowWin32.h b/intern/ghost/intern/GHOST_WindowWin32.h
index 73791d3fbbf..2f1f3a53c81 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.h
+++ b/intern/ghost/intern/GHOST_WindowWin32.h
@@ -166,8 +166,8 @@ typedef struct tagPOINTER_TOUCH_INFO {
} POINTER_TOUCH_INFO;
/*
- * Macros to retrieve information from pointer input message parameters
- */
+ * Macros to retrieve information from pointer input message parameters
+ */
#define GET_POINTERID_WPARAM(wParam) (LOWORD(wParam))
#define IS_POINTER_FLAG_SET_WPARAM(wParam, flag) (((DWORD)HIWORD(wParam) & (flag)) == (flag))
#define IS_POINTER_NEW_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM(wParam, POINTER_MESSAGE_FLAG_NEW)
@@ -223,7 +223,6 @@ class GHOST_WindowWin32 : public GHOST_Window {
* \param state The state the window is initially opened with.
* \param type The type of drawing context installed in this window.
* \param wantStereoVisual Stereo visual for quad buffered stereo.
- * \param wantNumOfAASamples Number of samples used for AA (zero if no AA)
* \param parentWindowHwnd
*/
GHOST_WindowWin32(GHOST_SystemWin32 *system,
@@ -236,7 +235,6 @@ class GHOST_WindowWin32 : public GHOST_Window {
GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone,
bool wantStereoVisual = false,
bool alphaBackground = false,
- GHOST_TUns16 wantNumOfAASamples = 0,
GHOST_TEmbedderWindowID parentWindowHwnd = 0,
bool is_debug = false);
@@ -272,7 +270,8 @@ class GHOST_WindowWin32 : public GHOST_Window {
/**
* Returns the window rectangle dimensions.
- * The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.
+ * The dimensions are given in screen coordinates that are
+ * relative to the upper-left corner of the screen.
* \param bounds The bounding rectangle of the window.
*/
void getWindowBounds(GHOST_Rect &bounds) const;
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp
index 21e42e01aea..8c69b9eb65e 100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -49,7 +49,7 @@
# include <X11/extensions/XInput2.h>
#endif
-//For DPI value
+// For DPI value
#include <X11/Xresource.h>
#include <cstring>
@@ -92,14 +92,10 @@ typedef struct {
static XVisualInfo *x11_visualinfo_from_glx(Display *display,
bool stereoVisual,
- GHOST_TUns16 *r_numOfAASamples,
bool needAlpha,
GLXFBConfig *fbconfig)
{
- XVisualInfo *visual = NULL;
- GHOST_TUns16 numOfAASamples = *r_numOfAASamples;
int glx_major, glx_minor, glx_version; /* GLX version: major.minor */
- GHOST_TUns16 actualSamples;
int glx_attribs[64];
*fbconfig = NULL;
@@ -117,14 +113,9 @@ static XVisualInfo *x11_visualinfo_from_glx(Display *display,
return NULL;
}
glx_version = glx_major * 100 + glx_minor;
-
- if (glx_version >= 104) {
- actualSamples = numOfAASamples;
- }
- else {
- numOfAASamples = 0;
- actualSamples = 0;
- }
+#ifndef WITH_X11_ALPHA
+ (void)glx_version;
+#endif
#ifdef WITH_X11_ALPHA
if (needAlpha && glx_version >= 103 &&
@@ -133,106 +124,63 @@ static XVisualInfo *x11_visualinfo_from_glx(Display *display,
(glXGetVisualFromFBConfig ||
(glXGetVisualFromFBConfig = (PFNGLXGETVISUALFROMFBCONFIGPROC)glXGetProcAddressARB(
(const GLubyte *)"glXGetVisualFromFBConfig")) != NULL)) {
- GLXFBConfig *fbconfigs;
- int nbfbconfig;
- int i;
- for (;;) {
+ GHOST_X11_GL_GetAttributes(glx_attribs, 64, stereoVisual, needAlpha, true);
- GHOST_X11_GL_GetAttributes(glx_attribs, 64, actualSamples, stereoVisual, needAlpha, true);
-
- fbconfigs = glXChooseFBConfig(display, DefaultScreen(display), glx_attribs, &nbfbconfig);
-
- /* Any sample level or even zero, which means oversampling disabled, is good
- * but we need a valid visual to continue */
- if (nbfbconfig > 0) {
- /* take a frame buffer config that has alpha cap */
- for (i = 0; i < nbfbconfig; i++) {
- visual = (XVisualInfo *)glXGetVisualFromFBConfig(display, fbconfigs[i]);
- if (!visual)
+ int nbfbconfig;
+ GLXFBConfig *fbconfigs = glXChooseFBConfig(
+ display, DefaultScreen(display), glx_attribs, &nbfbconfig);
+
+ /* Any sample level or even zero, which means oversampling disabled, is good
+ * but we need a valid visual to continue */
+ if (nbfbconfig > 0) {
+ /* take a frame buffer config that has alpha cap */
+ for (int i = 0; i < nbfbconfig; i++) {
+ XVisualInfo *visual = (XVisualInfo *)glXGetVisualFromFBConfig(display, fbconfigs[i]);
+ if (!visual)
+ continue;
+ /* if we don't need a alpha background, the first config will do, otherwise
+ * test the alphaMask as it won't necessarily be present */
+ if (needAlpha) {
+ XRenderPictFormat *pict_format = XRenderFindVisualFormat(display, visual->visual);
+ if (!pict_format)
+ continue;
+ if (pict_format->direct.alphaMask <= 0)
continue;
- /* if we don't need a alpha background, the first config will do, otherwise
- * test the alphaMask as it won't necessarily be present */
- if (needAlpha) {
- XRenderPictFormat *pict_format = XRenderFindVisualFormat(display, visual->visual);
- if (!pict_format)
- continue;
- if (pict_format->direct.alphaMask <= 0)
- continue;
- }
- *fbconfig = fbconfigs[i];
- break;
- }
- XFree(fbconfigs);
- if (i < nbfbconfig) {
- if (actualSamples < numOfAASamples) {
- fprintf(stderr,
- "Warning! Unable to find a multisample pixel format that supports exactly %d "
- "samples. "
- "Substituting one that uses %d samples.\n",
- numOfAASamples,
- actualSamples);
- }
- break;
}
- visual = NULL;
- }
- if (actualSamples == 0) {
- /* All options exhausted, cannot continue */
- fprintf(stderr,
- "%s:%d: X11 glXChooseVisual() failed, "
- "verify working openGL system!\n",
- __FILE__,
- __LINE__);
+ *fbconfig = fbconfigs[i];
+ XFree(fbconfigs);
- return NULL;
- }
- else {
- --actualSamples;
+ return visual;
}
+
+ XFree(fbconfigs);
}
}
else
#endif
{
/* legacy, don't use extension */
- for (;;) {
- GHOST_X11_GL_GetAttributes(glx_attribs, 64, actualSamples, stereoVisual, needAlpha, false);
-
- visual = glXChooseVisual(display, DefaultScreen(display), glx_attribs);
-
- /* Any sample level or even zero, which means oversampling disabled, is good
- * but we need a valid visual to continue */
- if (visual != NULL) {
- if (actualSamples < numOfAASamples) {
- fprintf(stderr,
- "Warning! Unable to find a multisample pixel format that supports exactly %d "
- "samples. "
- "Substituting one that uses %d samples.\n",
- numOfAASamples,
- actualSamples);
- }
- break;
- }
+ GHOST_X11_GL_GetAttributes(glx_attribs, 64, stereoVisual, needAlpha, false);
- if (actualSamples == 0) {
- /* All options exhausted, cannot continue */
- fprintf(stderr,
- "%s:%d: X11 glXChooseVisual() failed, "
- "verify working openGL system!\n",
- __FILE__,
- __LINE__);
+ XVisualInfo *visual = glXChooseVisual(display, DefaultScreen(display), glx_attribs);
- return NULL;
- }
- else {
- --actualSamples;
- }
+ /* Any sample level or even zero, which means oversampling disabled, is good
+ * but we need a valid visual to continue */
+ if (visual != NULL) {
+ return visual;
}
}
- *r_numOfAASamples = actualSamples;
- return visual;
+
+ /* All options exhausted, cannot continue */
+ fprintf(stderr,
+ "%s:%d: X11 glXChooseVisual() failed, "
+ "verify working openGL system!\n",
+ __FILE__,
+ __LINE__);
+
+ return NULL;
}
GHOST_WindowX11::GHOST_WindowX11(GHOST_SystemX11 *system,
@@ -248,9 +196,8 @@ GHOST_WindowX11::GHOST_WindowX11(GHOST_SystemX11 *system,
const bool stereoVisual,
const bool exclusive,
const bool alphaBackground,
- const GHOST_TUns16 numOfAASamples,
const bool is_debug)
- : GHOST_Window(width, height, state, stereoVisual, exclusive, numOfAASamples),
+ : GHOST_Window(width, height, state, stereoVisual, exclusive),
m_display(display),
m_visualInfo(NULL),
m_fbconfig(NULL),
@@ -271,11 +218,8 @@ GHOST_WindowX11::GHOST_WindowX11(GHOST_SystemX11 *system,
m_is_debug_context(is_debug)
{
if (type == GHOST_kDrawingContextTypeOpenGL) {
- m_visualInfo = x11_visualinfo_from_glx(m_display,
- stereoVisual,
- &m_wantNumOfAASamples,
- alphaBackground,
- (GLXFBConfig *)&m_fbconfig);
+ m_visualInfo = x11_visualinfo_from_glx(
+ m_display, stereoVisual, alphaBackground, (GLXFBConfig *)&m_fbconfig);
}
else {
XVisualInfo tmp = {0};
@@ -1298,7 +1242,6 @@ GHOST_Context *GHOST_WindowX11::newDrawingContext(GHOST_TDrawingContextType type
for (int minor = 5; minor >= 0; --minor) {
context = new GHOST_ContextGLX(m_wantStereoVisual,
- m_wantNumOfAASamples,
m_window,
m_display,
(GLXFBConfig)m_fbconfig,
@@ -1316,7 +1259,6 @@ GHOST_Context *GHOST_WindowX11::newDrawingContext(GHOST_TDrawingContextType type
}
context = new GHOST_ContextGLX(m_wantStereoVisual,
- m_wantNumOfAASamples,
m_window,
m_display,
(GLXFBConfig)m_fbconfig,
@@ -1507,7 +1449,8 @@ GHOST_TSuccess GHOST_WindowX11::setWindowCursorGrab(GHOST_TGrabCursorMode mode)
setWindowCursorVisibility(true);
}
- /* Almost works without but important otherwise the mouse GHOST location can be incorrect on exit */
+ /* Almost works without but important
+ * otherwise the mouse GHOST location can be incorrect on exit. */
setCursorGrabAccum(0, 0);
m_cursorGrabBounds.m_l = m_cursorGrabBounds.m_r = -1; /* disable */
#ifdef GHOST_X11_GRAB
diff --git a/intern/ghost/intern/GHOST_WindowX11.h b/intern/ghost/intern/GHOST_WindowX11.h
index 8378a8b5ef8..a39a186406f 100644
--- a/intern/ghost/intern/GHOST_WindowX11.h
+++ b/intern/ghost/intern/GHOST_WindowX11.h
@@ -46,7 +46,8 @@ class GHOST_DropTargetX11;
/**
* X11 implementation of GHOST_IWindow.
- * Dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.
+ * Dimensions are given in screen coordinates that are
+ * relative to the upper-left corner of the screen.
*/
class GHOST_WindowX11 : public GHOST_Window {
@@ -65,7 +66,6 @@ class GHOST_WindowX11 : public GHOST_Window {
* \param type The type of drawing context installed in this window.
* \param stereoVisual Stereo visual for quad buffered stereo.
* \param alphaBackground Enable alpha blending of window with display background
- * \param numOfAASamples Number of samples used for AA (zero if no AA)
*/
GHOST_WindowX11(GHOST_SystemX11 *system,
Display *display,
@@ -80,7 +80,6 @@ class GHOST_WindowX11 : public GHOST_Window {
const bool stereoVisual = false,
const bool exclusive = false,
const bool alphaBackground = false,
- const GHOST_TUns16 numOfAASamples = 0,
const bool is_debug = false);
bool getValid() const;
diff --git a/intern/ghost/test/gears/GHOST_Test.cpp b/intern/ghost/test/gears/GHOST_Test.cpp
index 76386fb114a..47eddbcfb83 100644
--- a/intern/ghost/test/gears/GHOST_Test.cpp
+++ b/intern/ghost/test/gears/GHOST_Test.cpp
@@ -479,12 +479,14 @@ bool Application::processEvent(GHOST_IEvent *event)
switch (event->getType()) {
#if 0
- case GHOST_kEventUnknown:
- break;
- case GHOST_kEventCursorButton:
- std::cout << "GHOST_kEventCursorButton"; break;
- case GHOST_kEventCursorMove:
- std::cout << "GHOST_kEventCursorMove"; break;
+ case GHOST_kEventUnknown:
+ break;
+ case GHOST_kEventCursorButton:
+ std::cout << "GHOST_kEventCursorButton";
+ break;
+ case GHOST_kEventCursorMove:
+ std::cout << "GHOST_kEventCursorMove";
+ break;
#endif
case GHOST_kEventWheel: {
GHOST_TEventWheelData *wheelData = (GHOST_TEventWheelData *)event->getData();
@@ -676,11 +678,12 @@ int main(int /*argc*/, char ** /*argv*/)
LONG lresult;
HKEY hkey = 0;
DWORD dwd = 0;
- //unsigned char buffer[128];
+ // unsigned char buffer[128];
CRegKey regkey;
- //DWORD keyValue;
- // lresult = regkey.Open(HKEY_LOCAL_MACHINE, "SOFTWARE\\NVIDIA Corporation\\Global\\Stereo3D\\StereoEnable");
+ // DWORD keyValue;
+ // lresult = regkey.Open(
+ // HKEY_LOCAL_MACHINE, "SOFTWARE\\NVIDIA Corporation\\Global\\Stereo3D\\StereoEnable");
lresult = regkey.Open(HKEY_LOCAL_MACHINE,
"SOFTWARE\\NVIDIA Corporation\\Global\\Stereo3D\\StereoEnable",
KEY_ALL_ACCESS);
@@ -716,7 +719,7 @@ int main(int /*argc*/, char ** /*argv*/)
// Enter main loop
while (!app.m_exitRequested) {
- //printf("main: loop\n");
+ // printf("main: loop\n");
fSystem->processEvents(true);
fSystem->dispatchEvents();
}
diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h
index 4cefc27bc54..b1a0eda0e22 100644
--- a/intern/guardedalloc/MEM_guardedalloc.h
+++ b/intern/guardedalloc/MEM_guardedalloc.h
@@ -60,40 +60,40 @@ extern "C" {
#endif
/** Returns the length of the allocated memory segment pointed at
- * by vmemh. If the pointer was not previously allocated by this
- * module, the result is undefined.*/
+ * by vmemh. If the pointer was not previously allocated by this
+ * module, the result is undefined.*/
extern size_t (*MEM_allocN_len)(const void *vmemh) ATTR_WARN_UNUSED_RESULT;
/**
- * Release memory previously allocated by this module.
- */
+ * Release memory previously allocated by this module.
+ */
extern void (*MEM_freeN)(void *vmemh);
#if 0 /* UNUSED */
- /**
+/**
* Return zero if memory is not in allocated list
*/
- extern short (*MEM_testN)(void *vmemh);
+extern short (*MEM_testN)(void *vmemh);
#endif
/**
- * Duplicates a block of memory, and returns a pointer to the
- * newly allocated block. */
+ * Duplicates a block of memory, and returns a pointer to the
+ * newly allocated block. */
extern void *(*MEM_dupallocN)(const void *vmemh) /* ATTR_MALLOC */ ATTR_WARN_UNUSED_RESULT;
/**
- * Reallocates a block of memory, and returns pointer to the newly
- * allocated block, the old one is freed. this is not as optimized
- * as a system realloc but just makes a new allocation and copies
- * over from existing memory. */
+ * Reallocates a block of memory, and returns pointer to the newly
+ * allocated block, the old one is freed. this is not as optimized
+ * as a system realloc but just makes a new allocation and copies
+ * over from existing memory. */
extern void *(*MEM_reallocN_id)(void *vmemh,
size_t len,
const char *str) /* ATTR_MALLOC */ ATTR_WARN_UNUSED_RESULT
ATTR_ALLOC_SIZE(2);
/**
- * A variant of realloc which zeros new bytes
- */
+ * A variant of realloc which zeros new bytes
+ */
extern void *(*MEM_recallocN_id)(void *vmemh,
size_t len,
const char *str) /* ATTR_MALLOC */ ATTR_WARN_UNUSED_RESULT
@@ -103,62 +103,62 @@ extern void *(*MEM_recallocN_id)(void *vmemh,
#define MEM_recallocN(vmemh, len) MEM_recallocN_id(vmemh, len, __func__)
/**
- * Allocate a block of memory of size len, with tag name str. The
- * memory is cleared. The name must be static, because only a
- * pointer to it is stored ! */
+ * Allocate a block of memory of size len, with tag name str. The
+ * memory is cleared. The name must be static, because only a
+ * pointer to it is stored ! */
extern void *(*MEM_callocN)(size_t len, const char *str) /* ATTR_MALLOC */ ATTR_WARN_UNUSED_RESULT
ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2);
/**
- * Allocate a block of memory of size (len * size), with tag name
- * str, aborting in case of integer overflows to prevent vulnerabilities.
- * The memory is cleared. The name must be static, because only a
- * pointer to it is stored ! */
+ * Allocate a block of memory of size (len * size), with tag name
+ * str, aborting in case of integer overflows to prevent vulnerabilities.
+ * The memory is cleared. The name must be static, because only a
+ * pointer to it is stored ! */
extern void *(*MEM_calloc_arrayN)(size_t len,
size_t size,
const char *str) /* ATTR_MALLOC */ ATTR_WARN_UNUSED_RESULT
ATTR_ALLOC_SIZE(1, 2) ATTR_NONNULL(3);
/**
- * Allocate a block of memory of size len, with tag name str. The
- * name must be a static, because only a pointer to it is stored !
- * */
+ * Allocate a block of memory of size len, with tag name str. The
+ * name must be a static, because only a pointer to it is stored !
+ * */
extern void *(*MEM_mallocN)(size_t len, const char *str) /* ATTR_MALLOC */ ATTR_WARN_UNUSED_RESULT
ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2);
/**
- * Allocate a block of memory of size (len * size), with tag name str,
- * aborting in case of integer overflow to prevent vulnerabilities. The
- * name must be a static, because only a pointer to it is stored !
- * */
+ * Allocate a block of memory of size (len * size), with tag name str,
+ * aborting in case of integer overflow to prevent vulnerabilities. The
+ * name must be a static, because only a pointer to it is stored !
+ * */
extern void *(*MEM_malloc_arrayN)(size_t len,
size_t size,
const char *str) /* ATTR_MALLOC */ ATTR_WARN_UNUSED_RESULT
ATTR_ALLOC_SIZE(1, 2) ATTR_NONNULL(3);
/**
- * Allocate an aligned block of memory of size len, with tag name str. The
- * name must be a static, because only a pointer to it is stored !
- * */
+ * Allocate an aligned block of memory of size len, with tag name str. The
+ * name must be a static, because only a pointer to it is stored !
+ * */
extern void *(*MEM_mallocN_aligned)(size_t len,
size_t alignment,
const char *str) /* ATTR_MALLOC */ ATTR_WARN_UNUSED_RESULT
ATTR_ALLOC_SIZE(1) ATTR_NONNULL(3);
/**
- * Same as callocN, clears memory and uses mmap (disk cached) if supported.
- * Can be free'd with MEM_freeN as usual.
- * */
+ * Same as callocN, clears memory and uses mmap (disk cached) if supported.
+ * Can be free'd with MEM_freeN as usual.
+ * */
extern void *(*MEM_mapallocN)(size_t len,
const char *str) /* ATTR_MALLOC */ ATTR_WARN_UNUSED_RESULT
ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2);
/** Print a list of the names and sizes of all allocated memory
- * blocks. as a python dict for easy investigation */
+ * blocks. as a python dict for easy investigation */
extern void (*MEM_printmemlist_pydict)(void);
/** Print a list of the names and sizes of all allocated memory
- * blocks. */
+ * blocks. */
extern void (*MEM_printmemlist)(void);
/** calls the function on all allocated memory blocks. */
@@ -171,22 +171,22 @@ extern void (*MEM_printmemlist_stats)(void);
extern void (*MEM_set_error_callback)(void (*func)(const char *));
/**
- * Are the start/end block markers still correct ?
- *
- * @retval true for correct memory, false for corrupted memory. */
+ * Are the start/end block markers still correct ?
+ *
+ * @retval true for correct memory, false for corrupted memory. */
extern bool (*MEM_consistency_check)(void);
/** Set thread locking functions for safe memory allocation from multiple
- * threads, pass NULL pointers to disable thread locking again. */
+ * threads, pass NULL pointers to disable thread locking again. */
extern void (*MEM_set_lock_callback)(void (*lock)(void), void (*unlock)(void));
/** Attempt to enforce OSX (or other OS's) to have malloc and stack nonzero */
extern void (*MEM_set_memory_debug)(void);
/**
- * Memory usage stats
- * - MEM_get_memory_in_use is all memory
- * - MEM_get_mapped_memory_in_use is a subset of all memory */
+ * Memory usage stats
+ * - MEM_get_memory_in_use is all memory
+ * - MEM_get_mapped_memory_in_use is a subset of all memory */
extern size_t (*MEM_get_memory_in_use)(void);
/** Get mapped memory usage. */
extern size_t (*MEM_get_mapped_memory_in_use)(void);
diff --git a/intern/guardedalloc/intern/mallocn_guarded_impl.c b/intern/guardedalloc/intern/mallocn_guarded_impl.c
index b24e1c8c984..8ba14b3887b 100644
--- a/intern/guardedalloc/intern/mallocn_guarded_impl.c
+++ b/intern/guardedalloc/intern/mallocn_guarded_impl.c
@@ -106,8 +106,8 @@ typedef struct MemHead {
int tag2;
short mmap; /* if true, memory was mmapped */
short alignment; /* if non-zero aligned alloc was used
- * and alignment is stored here.
- */
+ * and alignment is stored here.
+ */
#ifdef DEBUG_MEMCOUNTER
int _count;
#endif
@@ -907,7 +907,8 @@ short MEM_guarded_testN(void *vmemh)
mem_lock_thread();
membl = membase->first;
- if (membl) membl = MEMNEXT(membl);
+ if (membl)
+ membl = MEMNEXT(membl);
while (membl) {
if (vmemh == membl + 1) {
@@ -917,7 +918,8 @@ short MEM_guarded_testN(void *vmemh)
if (membl->next)
membl = MEMNEXT(membl->next);
- else break;
+ else
+ break;
}
mem_unlock_thread();
@@ -1013,8 +1015,10 @@ static void addtail(volatile localListBase *listbase, void *vlink)
/* for a generic API error checks here is fine but
* the limited use here they will never be NULL */
#if 0
- if (link == NULL) return;
- if (listbase == NULL) return;
+ if (link == NULL)
+ return;
+ if (listbase == NULL)
+ return;
#endif
link->next = NULL;
@@ -1034,8 +1038,10 @@ static void remlink(volatile localListBase *listbase, void *vlink)
/* for a generic API error checks here is fine but
* the limited use here they will never be NULL */
#if 0
- if (link == NULL) return;
- if (listbase == NULL) return;
+ if (link == NULL)
+ return;
+ if (listbase == NULL)
+ return;
#endif
if (link->next)
diff --git a/intern/guardedalloc/intern/mmap_win.c b/intern/guardedalloc/intern/mmap_win.c
index d5488351700..5b0c4b6614a 100644
--- a/intern/guardedalloc/intern/mmap_win.c
+++ b/intern/guardedalloc/intern/mmap_win.c
@@ -32,7 +32,7 @@
# include "mmap_win.h"
# ifndef FILE_MAP_EXECUTE
-//not defined in earlier versions of the Platform SDK (before February 2003)
+// not defined in earlier versions of the Platform SDK (before February 2003)
# define FILE_MAP_EXECUTE 0x0020
# endif
@@ -98,8 +98,8 @@ void *mmap(void *UNUSED(start), size_t len, int prot, int flags, int fd, off_t o
}
# if 0
- if ( fd == -1 ) {
- _set_errno( EBADF );
+ if (fd == -1) {
+ _set_errno(EBADF);
return MAP_FAILED;
}
# endif
diff --git a/intern/guardedalloc/test/simpletest/memtest.c b/intern/guardedalloc/test/simpletest/memtest.c
index 576e502b72e..8acced088f6 100644
--- a/intern/guardedalloc/test/simpletest/memtest.c
+++ b/intern/guardedalloc/test/simpletest/memtest.c
@@ -23,7 +23,7 @@
*/
/* To compile run:
- * gcc -DWITH_GUARDEDALLOC -I../../ -I../../../atomic/ memtest.c ../../intern/mallocn.c -o simpletest
+ * gcc -DWITH_GUARDEDALLOC -I../../ -I../../../atomic/ memtest.c ../../intern/mallocn.c -o memtest
*/
/* Number of chunks to test with */
diff --git a/intern/iksolver/intern/IK_QJacobianSolver.cpp b/intern/iksolver/intern/IK_QJacobianSolver.cpp
index 90032096d37..6c2c0bacf48 100644
--- a/intern/iksolver/intern/IK_QJacobianSolver.cpp
+++ b/intern/iksolver/intern/IK_QJacobianSolver.cpp
@@ -297,7 +297,7 @@ bool IK_QJacobianSolver::Solve(IK_QSegment *root,
{
float scale = ComputeScale();
bool solved = false;
- //double dt = analyze_time();
+ // double dt = analyze_time();
Scale(scale, tasks);
@@ -359,7 +359,7 @@ bool IK_QJacobianSolver::Solve(IK_QSegment *root,
Scale(1.0f / scale, tasks);
- //analyze_add_run(max_iterations, analyze_time()-dt);
+ // analyze_add_run(max_iterations, analyze_time()-dt);
return solved;
}
diff --git a/intern/iksolver/intern/IK_QSegment.cpp b/intern/iksolver/intern/IK_QSegment.cpp
index 89a1afaafbd..dbbec621acd 100644
--- a/intern/iksolver/intern/IK_QSegment.cpp
+++ b/intern/iksolver/intern/IK_QSegment.cpp
@@ -578,7 +578,7 @@ void IK_QSwingSegment::SetLimit(int axis, double lmin, double lmax)
// put center of ellispe in the middle between min and max
double offset = 0.5 * (lmin + lmax);
- //lmax = lmax - offset;
+ // lmax = lmax - offset;
if (axis == 0) {
m_min[0] = -lmax;
diff --git a/intern/iksolver/intern/IK_QSegment.h b/intern/iksolver/intern/IK_QSegment.h
index 47125db3865..3c8c5033d28 100644
--- a/intern/iksolver/intern/IK_QSegment.h
+++ b/intern/iksolver/intern/IK_QSegment.h
@@ -32,11 +32,11 @@
/**
* An IK_Qsegment encodes information about a segments
* local coordinate system.
- *
+ *
* These segments always point along the y-axis.
- *
+ *
* Here we define the local coordinates of a joint as
- * local_transform =
+ * local_transform =
* translate(tr1) * rotation(A) * rotation(q) * translate(0,length,0)
* You can read this as:
* - first translate by (0,length,0)
diff --git a/intern/iksolver/intern/IK_Solver.cpp b/intern/iksolver/intern/IK_Solver.cpp
index 5205fd6e16c..b274e005990 100644
--- a/intern/iksolver/intern/IK_Solver.cpp
+++ b/intern/iksolver/intern/IK_Solver.cpp
@@ -379,7 +379,10 @@ float IK_SolverGetPoleAngle(IK_Solver *solver)
}
#if 0
-static void IK_SolverAddCenterOfMass(IK_Solver *solver, IK_Segment *root, float goal[3], float weight)
+static void IK_SolverAddCenterOfMass(IK_Solver *solver,
+ IK_Segment *root,
+ float goal[3],
+ float weight)
{
if (solver == NULL || root == NULL)
return;
diff --git a/intern/libmv/.clang-format b/intern/libmv/.clang-format
new file mode 100644
index 00000000000..9d159247d51
--- /dev/null
+++ b/intern/libmv/.clang-format
@@ -0,0 +1,2 @@
+DisableFormat: true
+SortIncludes: false
diff --git a/intern/locale/boost_locale_wrapper.cpp b/intern/locale/boost_locale_wrapper.cpp
index bb46f48a14f..e03f8500a3d 100644
--- a/intern/locale/boost_locale_wrapper.cpp
+++ b/intern/locale/boost_locale_wrapper.cpp
@@ -84,7 +84,7 @@ void bl_locale_set(const char *locale)
// Specify location of dictionaries.
gen.add_messages_path(messages_path);
gen.add_messages_domain(default_domain);
- //gen.set_default_messages_domain(default_domain);
+ // gen.set_default_messages_domain(default_domain);
try {
if (locale && locale[0]) {
@@ -103,7 +103,8 @@ void bl_locale_set(const char *locale)
bl_locale_global_cache();
- // Generate the locale string (useful to know which locale we are actually using in case of "default" one).
+ // Generate the locale string
+ // (useful to know which locale we are actually using in case of "default" one).
#define LOCALE_INFO std::use_facet<boost::locale::info>(_locale)
locale_str = LOCALE_INFO.language();
diff --git a/intern/mikktspace/mikktspace.c b/intern/mikktspace/mikktspace.c
index 1ea17c273ed..ab58c8f48e4 100644
--- a/intern/mikktspace/mikktspace.c
+++ b/intern/mikktspace/mikktspace.c
@@ -99,7 +99,7 @@ MIKK_INLINE float Length(const SVec3 v)
}
#if 0 // UNUSED
-MIKK_INLINE SVec3 Normalize( const SVec3 v )
+MIKK_INLINE SVec3 Normalize(const SVec3 v)
{
return vscale(1.0f / Length(v), v);
}
@@ -306,9 +306,9 @@ tbool genTangSpace(const SMikkTSpaceContext *pContext, const float fAngularThres
iNrTSPaces = GenerateInitialVerticesIndexList(pTriInfos, piTriListIn, pContext, iNrTrianglesIn);
// make a welded index list of identical positions and attributes (pos, norm, texc)
- //printf("gen welded index list begin\n");
+ // printf("gen welded index list begin\n");
GenerateSharedVerticesIndexList(piTriListIn, pContext, iNrTrianglesIn);
- //printf("gen welded index list end\n");
+ // printf("gen welded index list end\n");
// Mark all degenerate triangles
iTotTris = iNrTrianglesIn;
@@ -336,9 +336,9 @@ tbool genTangSpace(const SMikkTSpaceContext *pContext, const float fAngularThres
DegenPrologue(pTriInfos, piTriListIn, iNrTrianglesIn, iTotTris);
// evaluate triangle level attributes and neighbor list
- //printf("gen neighbors list begin\n");
+ // printf("gen neighbors list begin\n");
InitTriInfo(pTriInfos, piTriListIn, pContext, iNrTrianglesIn);
- //printf("gen neighbors list end\n");
+ // printf("gen neighbors list end\n");
// based on the 4 rules, identify groups based on connectivity
iNrMaxGroups = iNrTrianglesIn * 3;
@@ -353,10 +353,10 @@ tbool genTangSpace(const SMikkTSpaceContext *pContext, const float fAngularThres
free(pTriInfos);
return TFALSE;
}
- //printf("gen 4rule groups begin\n");
+ // printf("gen 4rule groups begin\n");
iNrActiveGroups = Build4RuleGroups(
pTriInfos, pGroups, piGroupTrianglesBuffer, piTriListIn, iNrTrianglesIn);
- //printf("gen 4rule groups end\n");
+ // printf("gen 4rule groups end\n");
//
@@ -383,10 +383,10 @@ tbool genTangSpace(const SMikkTSpaceContext *pContext, const float fAngularThres
// make tspaces, each group is split up into subgroups if necessary
// based on fAngularThreshold. Finally a tangent space is made for
// every resulting subgroup
- //printf("gen tspaces begin\n");
+ // printf("gen tspaces begin\n");
bRes = GenerateTSpaces(
psTspace, pTriInfos, pGroups, iNrActiveGroups, piTriListIn, fThresCos, pContext);
- //printf("gen tspaces end\n");
+ // printf("gen tspaces end\n");
// clean up
free(pGroups);
@@ -458,7 +458,7 @@ tbool genTangSpace(const SMikkTSpaceContext *pContext, const float fAngularThres
return TTRUE;
}
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct {
float vert[3];
@@ -512,10 +512,10 @@ static void radixsort_pair(uint *comp, int *data, uint *comp2, int *data2, int n
}
/* Merge identical vertices.
- * To find vertices with identical position, normal and texcoord, we calculate a hash of the 9 values.
- * Then, by sorting based on that hash, identical elements (having identical hashes) will be moved next to each other.
- * Since there might be hash collisions, the elements of each block are then compared with each other and duplicates
- * are merged.
+ * To find vertices with identical position, normal and texcoord, we calculate a hash of the 9
+ * values. Then, by sorting based on that hash, identical elements (having identical hashes) will
+ * be moved next to each other. Since there might be hash collisions, the elements of each block
+ * are then compared with each other and duplicates are merged.
*/
static void GenerateSharedVerticesIndexList(int piTriList_in_and_out[],
const SMikkTSpaceContext *pContext,
@@ -803,8 +803,8 @@ MIKK_INLINE SVec3 GetTexCoord(const SMikkTSpaceContext *pContext, const int inde
return res;
}
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////////
typedef union {
struct {
@@ -844,7 +844,8 @@ static void InitTriInfo(STriInfo pTriInfos[],
const int iNrTrianglesIn)
{
int f = 0, i = 0, t = 0;
- // pTriInfos[f].iFlag is cleared in GenerateInitialVerticesIndexList() which is called before this function.
+ // pTriInfos[f].iFlag is cleared in GenerateInitialVerticesIndexList()
+ // which is called before this function.
// generate neighbor info list
for (f = 0; f < iNrTrianglesIn; f++)
@@ -883,7 +884,7 @@ static void InitTriInfo(STriInfo pTriInfos[],
const SVec3 d2 = vsub(v3, v1);
const float fSignedAreaSTx2 = t21x * t31y - t21y * t31x;
- //assert(fSignedAreaSTx2!=0);
+ // assert(fSignedAreaSTx2!=0);
SVec3 vOs = vsub(vscale(t31y, d1), vscale(t21y, d2)); // eq 18
SVec3 vOt = vadd(vscale(-t31x, d1), vscale(t21x, d2)); // eq 19
@@ -925,7 +926,7 @@ static void InitTriInfo(STriInfo pTriInfos[],
const tbool bOrientB = (pTriInfos[t + 1].iFlag & ORIENT_PRESERVING) != 0 ? TTRUE : TFALSE;
// if this happens the quad has extremely bad mapping!!
if (bOrientA != bOrientB) {
- //printf("found quad with bad mapping\n");
+ // printf("found quad with bad mapping\n");
tbool bChooseOrientFirstTri = TFALSE;
if ((pTriInfos[t + 1].iFlag & GROUP_WITH_ANY) != 0)
bChooseOrientFirstTri = TTRUE;
@@ -961,8 +962,8 @@ static void InitTriInfo(STriInfo pTriInfos[],
}
}
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////////
static tbool AssignRecur(const int piTriListIn[],
STriInfo psTriInfos[],
@@ -1097,8 +1098,8 @@ static tbool AssignRecur(const int piTriListIn[],
return TTRUE;
}
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////////
static tbool CompareSubGroups(const SSubGroup *pg1, const SSubGroup *pg2);
static void QuickSort(int *pSortBuffer, int iLeft, int iRight, unsigned int uSeed);
@@ -1219,7 +1220,7 @@ static tbool GenerateTSpaces(STSpace psTspace[],
// assign tangent space index
assert(bFound || l == iUniqueSubGroups);
- //piTempTangIndices[f*3+index] = iUniqueTspaces+l;
+ // piTempTangIndices[f*3+index] = iUniqueTspaces+l;
// if no match was found we allocate a new subgroup
if (!bFound) {
@@ -1458,7 +1459,7 @@ static void BuildNeighborsFast(STriInfo pTriInfos[],
if (pEdges[iCurStartIndex].i0 != pEdges[i].i0) {
const int iL = iCurStartIndex;
const int iR = i - 1;
- //const int iElems = i-iL;
+ // const int iElems = i-iL;
iCurStartIndex = i;
QuickSortEdges(pEdges, iL, iR, 1, uSeed); // sort channel 1 which is i1
}
@@ -1472,7 +1473,7 @@ static void BuildNeighborsFast(STriInfo pTriInfos[],
if (pEdges[iCurStartIndex].i0 != pEdges[i].i0 || pEdges[iCurStartIndex].i1 != pEdges[i].i1) {
const int iL = iCurStartIndex;
const int iR = i - 1;
- //const int iElems = i-iL;
+ // const int iElems = i-iL;
iCurStartIndex = i;
QuickSortEdges(pEdges, iL, iR, 2, uSeed); // sort channel 2 which is f
}
@@ -1510,7 +1511,7 @@ static void BuildNeighborsFast(STriInfo pTriInfos[],
&piTriListIn[t * 3],
pEdges[j].i0,
pEdges[j].i1); // resolve index ordering and edge_num
- //assert(!(i0_A==i1_B && i1_A==i0_B));
+ // assert(!(i0_A==i1_B && i1_A==i0_B));
bUnassigned_B = pTriInfos[t].FaceNeighbors[edgenum_B] == -1 ? TTRUE : TFALSE;
if (i0_A == i0_B && i1_A == i1_B && bUnassigned_B)
bNotFound = TFALSE;
@@ -1521,7 +1522,7 @@ static void BuildNeighborsFast(STriInfo pTriInfos[],
if (!bNotFound) {
int t = pEdges[j].f;
pTriInfos[f].FaceNeighbors[edgenum_A] = t;
- //assert(pTriInfos[t].FaceNeighbors[edgenum_B]==-1);
+ // assert(pTriInfos[t].FaceNeighbors[edgenum_B]==-1);
pTriInfos[t].FaceNeighbors[edgenum_B] = f;
}
}
@@ -1550,7 +1551,7 @@ static void BuildNeighborsSlow(STriInfo pTriInfos[],
// in rev order
const int i1_B = piTriListIn[t * 3 + j];
const int i0_B = piTriListIn[t * 3 + (j < 2 ? (j + 1) : 0)];
- //assert(!(i0_A==i1_B && i1_A==i0_B));
+ // assert(!(i0_A==i1_B && i1_A==i0_B));
if (i0_A == i0_B && i1_A == i1_B)
bFound = TTRUE;
else
@@ -1565,7 +1566,7 @@ static void BuildNeighborsSlow(STriInfo pTriInfos[],
// assign neighbors
if (bFound) {
pTriInfos[f].FaceNeighbors[i] = t;
- //assert(pTriInfos[t].FaceNeighbors[j]==-1);
+ // assert(pTriInfos[t].FaceNeighbors[j]==-1);
pTriInfos[t].FaceNeighbors[j] = f;
}
}
diff --git a/intern/mikktspace/mikktspace.h b/intern/mikktspace/mikktspace.h
index bc5c0d62f4f..cbd541494a7 100644
--- a/intern/mikktspace/mikktspace.h
+++ b/intern/mikktspace/mikktspace.h
@@ -38,8 +38,8 @@ extern "C" {
* and used as is into any tool, program or plugin.
* The code is designed to consistently generate the same
* tangent spaces, for a given mesh, in any tool in which it is used.
- * This is done by performing an internal welding step and subsequently an order-independent evaluation
- * of tangent space for meshes consisting of triangles and quads.
+ * This is done by performing an internal welding step and subsequently an order-independent
+ * evaluation of tangent space for meshes consisting of triangles and quads.
* This means faces can be received in any order and the same is true for
* the order of vertices of each face. The generated result will not be affected
* by such reordering. Additionally, whether degenerate (vertices or texture coordinates)
@@ -88,10 +88,12 @@ typedef struct {
// This function is used to return the tangent and fSign to the application.
// fvTangent is a unit length vector.
- // For normal maps it is sufficient to use the following simplified version of the bitangent which is generated at pixel/vertex level.
+ // For normal maps it is sufficient to use the following simplified version of the bitangent
+ // which is generated at pixel/vertex level.
// bitangent = fSign * cross(vN, tangent);
// Note that the results are returned unindexed. It is possible to generate a new index list
- // But averaging/overwriting tangent spaces by using an already existing index list WILL produce INCRORRECT results.
+ // But averaging/overwriting tangent spaces by using an already existing index list WILL produce
+ // INCRORRECT results.
// DO NOT! use an already existing index list.
void (*m_setTSpaceBasic)(const SMikkTSpaceContext *pContext,
const float fvTangent[],
@@ -104,12 +106,13 @@ typedef struct {
// true magnitudes which can be used for relief mapping effects.
// fvBiTangent is the "real" bitangent and thus may not be perpendicular to fvTangent.
// However, both are perpendicular to the vertex normal.
- // For normal maps it is sufficient to use the following simplified version of the bitangent which is generated at pixel/vertex level.
+ // For normal maps it is sufficient to use the following simplified version of the bitangent
+ // which is generated at pixel/vertex level.
// fSign = bIsOrientationPreserving ? 1.0f : (-1.0f);
// bitangent = fSign * cross(vN, tangent);
// Note that the results are returned unindexed. It is possible to generate a new index list
- // But averaging/overwriting tangent spaces by using an already existing index list WILL produce INCRORRECT results.
- // DO NOT! use an already existing index list.
+ // But averaging/overwriting tangent spaces by using an already existing index list WILL produce
+ // INCRORRECT results. DO NOT! use an already existing index list.
void (*m_setTSpace)(const SMikkTSpaceContext *pContext,
const float fvTangent[],
const float fvBiTangent[],
@@ -121,26 +124,27 @@ typedef struct {
} SMikkTSpaceInterface;
struct SMikkTSpaceContext {
- SMikkTSpaceInterface *m_pInterface; // initialized with callback functions
- void *
- m_pUserData; // pointer to client side mesh data etc. (passed as the first parameter with every interface call)
+ // initialized with callback functions
+ SMikkTSpaceInterface *m_pInterface;
+ // pointer to client side mesh data etc.
+ // (passed as the first parameter with every interface call)
+ void *m_pUserData;
};
// these are both thread safe!
-tbool genTangSpaceDefault(
- const SMikkTSpaceContext *
- pContext); // Default (recommended) fAngularThreshold is 180 degrees (which means threshold disabled)
+// Default (recommended) fAngularThreshold is 180 degrees (which means threshold disabled)
+tbool genTangSpaceDefault(const SMikkTSpaceContext *pContext);
tbool genTangSpace(const SMikkTSpaceContext *pContext, const float fAngularThreshold);
-// To avoid visual errors (distortions/unwanted hard edges in lighting), when using sampled normal maps, the
-// normal map sampler must use the exact inverse of the pixel shader transformation.
-// The most efficient transformation we can possibly do in the pixel shader is
-// achieved by using, directly, the "unnormalized" interpolated tangent, bitangent and vertex normal: vT, vB and vN.
+// To avoid visual errors (distortions/unwanted hard edges in lighting), when using sampled normal
+// maps, the normal map sampler must use the exact inverse of the pixel shader transformation.
+// The most efficient transformation we can possibly do in the pixel shader is achieved by using,
+// directly, the "unnormalized" interpolated tangent, bitangent and vertex normal: vT, vB and vN.
// pixel shader (fast transform out)
// vNout = normalize( vNt.x * vT + vNt.y * vB + vNt.z * vN );
// where vNt is the tangent space normal. The normal map sampler must likewise use the
-// interpolated and "unnormalized" tangent, bitangent and vertex normal to be compliant with the pixel shader.
-// sampler does (exact inverse of pixel shader):
+// interpolated and "unnormalized" tangent, bitangent and vertex normal to be compliant with the
+// pixel shader. sampler does (exact inverse of pixel shader):
// float3 row0 = cross(vB, vN);
// float3 row1 = cross(vN, vT);
// float3 row2 = cross(vT, vB);
@@ -149,12 +153,13 @@ tbool genTangSpace(const SMikkTSpaceContext *pContext, const float fAngularThres
// where vNout is the sampled normal in some chosen 3D space.
//
// Should you choose to reconstruct the bitangent in the pixel shader instead
-// of the vertex shader, as explained earlier, then be sure to do this in the normal map sampler also.
-// Finally, beware of quad triangulations. If the normal map sampler doesn't use the same triangulation of
-// quads as your renderer then problems will occur since the interpolated tangent spaces will differ
-// eventhough the vertex level tangent spaces match. This can be solved either by triangulating before
-// sampling/exporting or by using the order-independent choice of diagonal for splitting quads suggested earlier.
-// However, this must be used both by the sampler and your tools/rendering pipeline.
+// of the vertex shader, as explained earlier, then be sure to do this in the normal map sampler
+// also. Finally, beware of quad triangulations. If the normal map sampler doesn't use the same
+// triangulation of quads as your renderer then problems will occur since the interpolated tangent
+// spaces will differ eventhough the vertex level tangent spaces match. This can be solved either
+// by triangulating before sampling/exporting or by using the order-independent choice of diagonal
+// for splitting quads suggested earlier. However, this must be used both by the sampler and your
+// tools/rendering pipeline.
#ifdef __cplusplus
}
diff --git a/intern/opencolorio/CMakeLists.txt b/intern/opencolorio/CMakeLists.txt
index da0956cee86..4d95c1b701b 100644
--- a/intern/opencolorio/CMakeLists.txt
+++ b/intern/opencolorio/CMakeLists.txt
@@ -24,6 +24,7 @@ set(INC
../guardedalloc
../../source/blender/blenlib
../../source/blender/gpu
+ ../../source/blender/makesdna
)
set(INC_SYS
diff --git a/intern/opencolorio/ocio_impl.cc b/intern/opencolorio/ocio_impl.cc
index 3917ed234c7..1b2207bfb53 100644
--- a/intern/opencolorio/ocio_impl.cc
+++ b/intern/opencolorio/ocio_impl.cc
@@ -496,9 +496,8 @@ int OCIOImpl::colorSpaceIsInvertible(OCIO_ConstColorSpaceRcPtr *cs_)
const char *family = (*cs)->getFamily();
if (!strcmp(family, "rrt") || !strcmp(family, "display")) {
- /* assume display and rrt transformations are not invertible
- * in fact some of them could be, but it doesn't make much sense to allow use them as invertible
- */
+ /* assume display and rrt transformations are not invertible in fact some of them could be,
+ * but it doesn't make much sense to allow use them as invertible. */
return false;
}
@@ -508,7 +507,8 @@ int OCIOImpl::colorSpaceIsInvertible(OCIO_ConstColorSpaceRcPtr *cs_)
}
if ((*cs)->getTransform(COLORSPACE_DIR_TO_REFERENCE)) {
- /* if there's defined transform to reference space, color space could be converted to scene linear */
+ /* if there's defined transform to reference space,
+ * color space could be converted to scene linear. */
return true;
}
diff --git a/intern/opencolorio/ocio_impl_glsl.cc b/intern/opencolorio/ocio_impl_glsl.cc
index 4d0908eafd5..99d59c8d989 100644
--- a/intern/opencolorio/ocio_impl_glsl.cc
+++ b/intern/opencolorio/ocio_impl_glsl.cc
@@ -70,8 +70,8 @@ typedef struct OCIO_GLSLShader {
/* LUT */
bool lut3d_texture_allocated; /* boolean flag indicating whether
- * lut texture is allocated
- */
+ * lut texture is allocated
+ */
bool lut3d_texture_valid;
GLuint lut3d_texture; /* OGL texture ID for 3D LUT */
diff --git a/intern/opensubdiv/internal/opensubdiv_device_context_opencl.cc b/intern/opensubdiv/internal/opensubdiv_device_context_opencl.cc
index 12f6ced4bbb..72285930889 100644
--- a/intern/opensubdiv/internal/opensubdiv_device_context_opencl.cc
+++ b/intern/opensubdiv/internal/opensubdiv_device_context_opencl.cc
@@ -155,26 +155,30 @@ bool CLDeviceContext::Initialize()
cl_platform_id cp_platform = findPlatform();
# if defined(_WIN32)
- cl_context_properties props[] = {CL_GL_CONTEXT_KHR,
- (cl_context_properties)wglGetCurrentContext(),
- CL_WGL_HDC_KHR,
- (cl_context_properties)wglGetCurrentDC(),
- CL_CONTEXT_PLATFORM,
- (cl_context_properties)cp_platform,
- 0};
+ cl_context_properties props[] = {
+ CL_GL_CONTEXT_KHR,
+ (cl_context_properties)wglGetCurrentContext(),
+ CL_WGL_HDC_KHR,
+ (cl_context_properties)wglGetCurrentDC(),
+ CL_CONTEXT_PLATFORM,
+ (cl_context_properties)cp_platform,
+ 0,
+ };
# elif defined(__APPLE__)
CGLContextObj kCGLContext = CGLGetCurrentContext();
CGLShareGroupObj kCGLShareGroup = CGLGetShareGroup(kCGLContext);
cl_context_properties props[] = {
CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE, (cl_context_properties)kCGLShareGroup, 0};
# else
- cl_context_properties props[] = {CL_GL_CONTEXT_KHR,
- (cl_context_properties)glXGetCurrentContext(),
- CL_GLX_DISPLAY_KHR,
- (cl_context_properties)glXGetCurrentDisplay(),
- CL_CONTEXT_PLATFORM,
- (cl_context_properties)cp_platform,
- 0};
+ cl_context_properties props[] = {
+ CL_GL_CONTEXT_KHR,
+ (cl_context_properties)glXGetCurrentContext(),
+ CL_GLX_DISPLAY_KHR,
+ (cl_context_properties)glXGetCurrentDisplay(),
+ CL_CONTEXT_PLATFORM,
+ (cl_context_properties)cp_platform,
+ 0,
+ };
# endif
# if defined(__APPLE__)
diff --git a/intern/rigidbody/RBI_api.h b/intern/rigidbody/RBI_api.h
index 9a7cbec6879..9546b840419 100644
--- a/intern/rigidbody/RBI_api.h
+++ b/intern/rigidbody/RBI_api.h
@@ -83,7 +83,8 @@ void RB_dworld_set_split_impulse(rbDynamicsWorld *world, int split_impulse);
/* Simulation ----------------------- */
-/* Step the simulation by the desired amount (in seconds) with extra controls on substep sizes and maximum substeps */
+/* Step the simulation by the desired amount (in seconds) with extra controls on substep sizes and
+ * maximum substeps */
void RB_dworld_step_simulation(rbDynamicsWorld *world,
float timeStep,
int maxSubSteps,
diff --git a/intern/rigidbody/rb_bullet_api.cpp b/intern/rigidbody/rb_bullet_api.cpp
index afeddc4d790..1b22080756d 100644
--- a/intern/rigidbody/rb_bullet_api.cpp
+++ b/intern/rigidbody/rb_bullet_api.cpp
@@ -23,26 +23,28 @@
*/
/*
-Bullet Continuous Collision Detection and Physics Library
-Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
-
-This software is provided 'as-is', without any express or implied warranty.
-In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
-subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
+ * Bullet Continuous Collision Detection and Physics Library
+ * Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
+ *
+ * This software is provided 'as-is', without any express or implied warranty. In no event will the
+ * authors be held liable for any damages arising from the use of this software. Permission is
+ * granted to anyone to use this software for any purpose, including commercial applications, and
+ * to alter it and redistribute it freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the
+ * original software. If you use this software in a product, an acknowledgment in the product
+ * documentation would be appreciated but is not required.
+ * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as
+ * being the original software.
+ * 3. This notice may not be removed or altered from any source distribution.
+ */
-/* This file defines the "RigidBody interface" for the
+/* This file defines the "RigidBody interface" for the
* Bullet Physics Engine. This API is designed to be used
* from C-code in Blender as part of the Rigid Body simulation
* system.
*
- * It is based on the Bullet C-API, but is heavily modified to
+ * It is based on the Bullet C-API, but is heavily modified to
* give access to more data types and to offer a nicer interface.
*
* -- Joshua Leung, June 2010
@@ -221,7 +223,7 @@ void RB_dworld_step_simulation(rbDynamicsWorld *world,
*/
void RB_dworld_export(rbDynamicsWorld *world, const char *filename)
{
- //create a large enough buffer. There is no method to pre-calculate the buffer size yet.
+ // create a large enough buffer. There is no method to pre-calculate the buffer size yet.
int maxSerializeBufferSize = 1024 * 1024 * 5;
btDefaultSerializer *serializer = new btDefaultSerializer(maxSerializeBufferSize);
@@ -358,7 +360,8 @@ void RB_body_delete(rbRigidBody *object)
/* body itself */
- /* manually remove constraint refs of the rigid body, normally this happens when removing constraints from the world
+ /* manually remove constraint refs of the rigid body, normally this happens when removing
+ * constraints from the world
* but since we delete everything when the world is rebult, we need to do it manually here */
for (int i = body->getNumConstraintRefs() - 1; i >= 0; i--) {
btTypedConstraint *con = body->getConstraintRef(i);
@@ -388,8 +391,8 @@ float RB_body_get_mass(rbRigidBody *object)
{
btRigidBody *body = object->body;
- /* there isn't really a mass setting, but rather 'inverse mass'
- * which we convert back to mass by taking the reciprocal again
+ /* there isn't really a mass setting, but rather 'inverse mass'
+ * which we convert back to mass by taking the reciprocal again
*/
float value = (float)body->getInvMass();
@@ -572,7 +575,7 @@ void RB_body_deactivate(rbRigidBody *object)
/* Simulation ----------------------- */
-/* The transform matrices Blender uses are OpenGL-style matrices,
+/* The transform matrices Blender uses are OpenGL-style matrices,
* while Bullet uses the Right-Handed coordinate system style instead.
*/
@@ -711,7 +714,8 @@ rbCollisionShape *RB_shape_new_convex_hull(
/* Setup (Triangle Mesh) ---------- */
-/* Need to call RB_trimesh_finish() after creating triangle mesh and adding vertices and triangles */
+/* Need to call RB_trimesh_finish() after creating triangle mesh and adding vertices and triangles
+ */
rbMeshData *RB_trimesh_data_new(int num_tris, int num_verts)
{
diff --git a/intern/string/STR_String.h b/intern/string/STR_String.h
index 5516f14bafa..4e6d04c1c64 100644
--- a/intern/string/STR_String.h
+++ b/intern/string/STR_String.h
@@ -312,7 +312,7 @@ class STR_String {
}
// serializing
- //int Serialize(pCStream stream);
+ // int Serialize(pCStream stream);
protected:
// Implementation
@@ -334,7 +334,7 @@ class STR_String {
}
char *m_data; // -> STR_String data
- int m_len; //z Data length
+ int m_len; // z Data length
int m_max; // Space in data buffer
#ifdef WITH_CXX_GUARDEDALLOC
diff --git a/intern/string/intern/STR_String.cpp b/intern/string/intern/STR_String.cpp
index b2134550ea9..3a4e703ca26 100644
--- a/intern/string/intern/STR_String.cpp
+++ b/intern/string/intern/STR_String.cpp
@@ -336,7 +336,7 @@ int STR_String::FindOneOf(const char *set, int pos) const
//
void STR_String::Replace(int pos, rcSTR_String str)
{
- //bounds(pos, 0, Length()-1);
+ // bounds(pos, 0, Length()-1);
if (str.Length() < 1) {
// Remove one character from the string
@@ -358,8 +358,8 @@ void STR_String::Replace(int pos, rcSTR_String str)
//
void STR_String::Replace(int pos, int num, rcSTR_String str)
{
- //bounds(pos, 0, Length()-1);
- //bounds(pos+num, 0, Length());
+ // bounds(pos, 0, Length()-1);
+ // bounds(pos+num, 0, Length());
assertd(num >= 1);
if (str.Length() < num) {
@@ -385,7 +385,8 @@ void STR_String::Replace(int pos, int num, rcSTR_String str)
-------------------------------------------------------------------------------------------------*/
//
-// Compare two strings and return the result, <0 if *this<rhs, >0 if *this>rhs or 0 if *this==rhs
+// Compare two strings and return the result,
+// <0 if *this<rhs, >0 if *this>rhs or 0 if *this==rhs
//
int STR_String::Compare(rcSTR_String rhs) const
{
@@ -393,7 +394,8 @@ int STR_String::Compare(rcSTR_String rhs) const
}
//
-// Compare two strings without respecting case and return the result, <0 if *this<rhs, >0 if *this>rhs or 0 if *this==rhs
+// Compare two strings without respecting case and return the result,
+// <0 if *this<rhs, >0 if *this>rhs or 0 if *this==rhs
//
int STR_String::CompareNoCase(rcSTR_String rhs) const
{
@@ -608,22 +610,22 @@ std::vector<STR_String> STR_String::Explode(char c) const
}
}
- //uc. -= STR_String("");
+ // uc. -= STR_String("");
return uc;
}
#if 0
-int STR_String::Serialize(pCStream stream)
+int STR_String::Serialize(pCStream stream)
{
if (stream->GetAccess() == CStream::Access_Read) {
int ln;
stream->Read(&ln, sizeof(ln));
AllocBuffer(ln, false);
stream->Read(this->m_data, ln);
- this->m_data[ln] = '\0';
- this->m_len = ln;
+ this->m_data[ln] = '\0';
+ this->m_len = ln;
}
else {
stream->Write(&this->m_len, sizeof(this->m_len));
diff --git a/intern/utfconv/utf_winfunc.h b/intern/utfconv/utf_winfunc.h
index 71fc9835d74..596109cac0e 100644
--- a/intern/utfconv/utf_winfunc.h
+++ b/intern/utfconv/utf_winfunc.h
@@ -2,7 +2,7 @@
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -15,7 +15,7 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
+ *
*/
#ifndef __UTF_WINFUNC_H__
diff --git a/intern/utfconv/utfconv.c b/intern/utfconv/utfconv.c
index 1dd868b8170..10a64448f80 100644
--- a/intern/utfconv/utfconv.c
+++ b/intern/utfconv/utfconv.c
@@ -2,7 +2,7 @@
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -15,7 +15,7 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
+ *
*/
#include "utfconv.h"
@@ -83,22 +83,22 @@ size_t count_utf_16_from_8(const char *string8)
count++;
u32 = 0;
continue;
- } //1 utf-8 char
+ } // 1 utf-8 char
if ((u & 0x07 << 5) == 0xC0) {
type = 1;
u32 = u & 0x1F;
continue;
- } //2 utf-8 char
+ } // 2 utf-8 char
if ((u & 0x0F << 4) == 0xE0) {
type = 2;
u32 = u & 0x0F;
continue;
- } //3 utf-8 char
+ } // 3 utf-8 char
if ((u & 0x1F << 3) == 0xF0) {
type = 3;
u32 = u & 0x07;
continue;
- } //4 utf-8 char
+ } // 4 utf-8 char
continue;
}
else {
@@ -204,22 +204,22 @@ int conv_utf_8_to_16(const char *in8, wchar_t *out16, size_t size16)
out16++;
u32 = 0;
continue;
- } //1 utf-8 char
+ } // 1 utf-8 char
if ((u & 0x07 << 5) == 0xC0) {
type = 1;
u32 = u & 0x1F;
continue;
- } //2 utf-8 char
+ } // 2 utf-8 char
if ((u & 0x0F << 4) == 0xE0) {
type = 2;
u32 = u & 0x0F;
continue;
- } //3 utf-8 char
+ } // 3 utf-8 char
if ((u & 0x1F << 3) == 0xF0) {
type = 3;
u32 = u & 0x07;
continue;
- } //4 utf-8 char
+ } // 4 utf-8 char
err |= UTF_ERROR_ILLCHAR;
continue;
}
@@ -265,7 +265,8 @@ int conv_utf_8_to_16(const char *in8, wchar_t *out16, size_t size16)
static int is_ascii(const char *in8)
{
for (; *in8; in8++)
- if (0x80 & *in8) return 0;
+ if (0x80 & *in8)
+ return 0;
return 1;
}
@@ -274,7 +275,8 @@ static void utf_8_cut_end(char *inout8, size_t maxcutpoint)
{
char *cur = inout8 + maxcutpoint;
char cc;
- if (!inout8) return;
+ if (!inout8)
+ return;
cc = *cur;
}
diff --git a/intern/utfconv/utfconv.h b/intern/utfconv/utfconv.h
index f13afbc0934..befaeae63de 100644
--- a/intern/utfconv/utfconv.h
+++ b/intern/utfconv/utfconv.h
@@ -2,7 +2,7 @@
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -15,7 +15,7 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
+ *
*/
#ifndef __UTFCONV_H__
@@ -81,12 +81,14 @@ char *alloc_utf_8_from_16(const wchar_t *in16, size_t add);
/**
* Allocates and converts the utf-16 string from utf-8
* @param in8 utf-8 string to convert
- * @param add any additional size which will be allocated for new utf-16 string in wchar_t (two bytes)
+ * @param add any additional size which will be allocated for new utf-16 string
+ * in wchar_t (two bytes)
* @return New allocated and converted utf-16 string or NULL if in8 is 0.
*/
wchar_t *alloc_utf16_from_8(const char *in8, size_t add);
-/* Easy allocation and conversion of new utf-16 string. New string has _16 suffix. Must be deallocated with UTF16_UN_ENCODE in right order*/
+/* Easy allocation and conversion of new utf-16 string. New string has _16 suffix.
+ * Must be deallocated with UTF16_UN_ENCODE in right order. */
#define UTF16_ENCODE(in8str) \
if (1) { \
wchar_t *in8str##_16 = alloc_utf16_from_8((const char *)in8str, 0)