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/intern/atomic_ops_unix.h6
-rw-r--r--intern/cycles/CMakeLists.txt6
-rw-r--r--intern/cycles/blender/addon/engine.py22
-rw-r--r--intern/cycles/blender/addon/properties.py25
-rw-r--r--intern/cycles/blender/addon/ui.py37
-rw-r--r--intern/cycles/blender/blender_mesh.cpp40
-rw-r--r--intern/cycles/blender/blender_python.cpp8
-rw-r--r--intern/cycles/blender/blender_sync.cpp24
-rw-r--r--intern/cycles/device/cuda/device_cuda_impl.cpp12
-rw-r--r--intern/cycles/device/device_cpu.cpp2
-rw-r--r--intern/cycles/device/device_optix.cpp12
-rw-r--r--intern/cycles/device/opencl/device_opencl_impl.cpp4
-rw-r--r--intern/cycles/kernel/CMakeLists.txt18
-rw-r--r--intern/cycles/kernel/bvh/bvh_traversal.h8
-rw-r--r--intern/cycles/kernel/bvh/bvh_types.h27
-rw-r--r--intern/cycles/kernel/closure/bssrdf.h6
-rw-r--r--intern/cycles/kernel/filter/filter_defines.h17
-rw-r--r--intern/cycles/kernel/kernel_accumulate.h13
-rw-r--r--intern/cycles/kernel/kernel_passes.h29
-rw-r--r--intern/cycles/kernel/kernel_path.h9
-rw-r--r--intern/cycles/kernel/kernel_types.h40
-rw-r--r--intern/cycles/kernel/shaders/node_voronoi_texture.osl10
-rw-r--r--intern/cycles/kernel/svm/svm_voronoi.h9
-rw-r--r--intern/cycles/render/attribute.cpp3
-rw-r--r--intern/cycles/render/buffers.cpp9
-rw-r--r--intern/cycles/render/colorspace.cpp2
-rw-r--r--intern/cycles/render/film.cpp29
-rw-r--r--intern/cycles/render/graph.h2
-rw-r--r--intern/cycles/render/osl.cpp2
-rw-r--r--intern/cycles/render/scene.h2
-rw-r--r--intern/cycles/util/util_avxb.h2
-rw-r--r--intern/cycles/util/util_avxi.h2
-rw-r--r--intern/cycles/util/util_logging.cpp6
-rw-r--r--intern/cycles/util/util_logging.h32
-rw-r--r--intern/cycles/util/util_math_fast.h10
-rw-r--r--intern/cycles/util/util_sseb.h2
-rw-r--r--intern/cycles/util/util_ssei.h2
-rw-r--r--intern/ghost/GHOST_C-api.h6
-rw-r--r--intern/ghost/GHOST_IContext.h4
-rw-r--r--intern/ghost/GHOST_ISystem.h4
-rw-r--r--intern/ghost/GHOST_IWindow.h2
-rw-r--r--intern/ghost/GHOST_Types.h10
-rw-r--r--intern/ghost/intern/GHOST_ContextCGL.mm17
-rw-r--r--intern/ghost/intern/GHOST_ContextEGL.cpp24
-rw-r--r--intern/ghost/intern/GHOST_ContextGLX.cpp4
-rw-r--r--intern/ghost/intern/GHOST_ContextWGL.cpp20
-rw-r--r--intern/ghost/intern/GHOST_DisplayManager.cpp10
-rw-r--r--intern/ghost/intern/GHOST_DropTargetX11.cpp6
-rw-r--r--intern/ghost/intern/GHOST_EventDragnDrop.h2
-rw-r--r--intern/ghost/intern/GHOST_EventManager.cpp8
-rw-r--r--intern/ghost/intern/GHOST_ISystem.cpp2
-rw-r--r--intern/ghost/intern/GHOST_ImeWin32.cpp59
-rw-r--r--intern/ghost/intern/GHOST_ImeWin32.h18
-rw-r--r--intern/ghost/intern/GHOST_NDOFManager.cpp126
-rw-r--r--intern/ghost/intern/GHOST_NDOFManager.h95
-rw-r--r--intern/ghost/intern/GHOST_Rect.cpp12
-rw-r--r--intern/ghost/intern/GHOST_System.cpp16
-rw-r--r--intern/ghost/intern/GHOST_System.h4
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.h4
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm4
-rw-r--r--intern/ghost/intern/GHOST_SystemSDL.cpp31
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp27
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.h12
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp30
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.h4
-rw-r--r--intern/ghost/intern/GHOST_TimerManager.cpp10
-rw-r--r--intern/ghost/intern/GHOST_WindowCocoa.h12
-rw-r--r--intern/ghost/intern/GHOST_WindowManager.cpp2
-rw-r--r--intern/ghost/intern/GHOST_WindowWayland.cpp6
-rw-r--r--intern/ghost/intern/GHOST_WindowWayland.h2
-rw-r--r--intern/ghost/intern/GHOST_WindowWin32.h2
-rw-r--r--intern/ghost/intern/GHOST_XrSession.cpp49
-rw-r--r--intern/ghost/intern/GHOST_XrSession.h1
-rw-r--r--intern/guardedalloc/intern/mallocn.c2
-rw-r--r--intern/libmv/CMakeLists.txt64
-rw-r--r--intern/memutil/MEM_Allocator.h4
-rw-r--r--intern/memutil/MEM_CacheLimiter.h6
-rw-r--r--intern/numaapi/source/build_config.h13
-rw-r--r--intern/opensubdiv/CMakeLists.txt2
-rw-r--r--intern/openvdb/intern/openvdb_level_set.cc19
-rw-r--r--intern/openvdb/intern/openvdb_level_set.h6
-rw-r--r--intern/openvdb/openvdb_capi.cc12
-rw-r--r--intern/openvdb/openvdb_capi.h22
-rw-r--r--intern/quadriflow/quadriflow_capi.cpp10
-rw-r--r--intern/quadriflow/quadriflow_capi.hpp4
-rw-r--r--intern/rigidbody/RBI_api.h2
86 files changed, 647 insertions, 653 deletions
diff --git a/intern/atomic/intern/atomic_ops_unix.h b/intern/atomic/intern/atomic_ops_unix.h
index dc1e71cda76..b08a0e9bc28 100644
--- a/intern/atomic/intern/atomic_ops_unix.h
+++ b/intern/atomic/intern/atomic_ops_unix.h
@@ -49,9 +49,9 @@
#include "atomic_ops_utils.h"
-#if defined(__arm__)
-/* Attempt to fix compilation error on Debian armel kernel.
- * arm7 architecture does have both 32 and 64bit atomics, however
+#if defined(__arm__) || defined(__riscv)
+/* Attempt to fix compilation error on Debian armel and RISC-V kernels.
+ * Both architectures do have both 32 and 64bit atomics, however
* its gcc doesn't have __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n defined.
*/
# define JE_FORCE_SYNC_COMPARE_AND_SWAP_1
diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt
index b01bf1bd1e2..381248e9bf1 100644
--- a/intern/cycles/CMakeLists.txt
+++ b/intern/cycles/CMakeLists.txt
@@ -307,9 +307,9 @@ if(WITH_CYCLES_LOGGING)
)
endif()
-# Debugging capabilities (debug passes etc).
-if(WITH_CYCLES_DEBUG)
- add_definitions(-DWITH_CYCLES_DEBUG)
+# NaN debugging
+if(WITH_CYCLES_DEBUG_NAN)
+ add_definitions(-DWITH_CYCLES_DEBUG_NAN)
endif()
if(NOT OPENIMAGEIO_PUGIXML_FOUND)
diff --git a/intern/cycles/blender/addon/engine.py b/intern/cycles/blender/addon/engine.py
index dc53c4db48f..489a883f098 100644
--- a/intern/cycles/blender/addon/engine.py
+++ b/intern/cycles/blender/addon/engine.py
@@ -235,9 +235,12 @@ def system_info():
def list_render_passes(scene, srl):
- # Builtin Blender passes.
+ crl = srl.cycles
+
+ # Combined pass.
yield ("Combined", "RGBA", 'COLOR')
+ # Data passes.
if srl.use_pass_z: yield ("Depth", "Z", 'VALUE')
if srl.use_pass_mist: yield ("Mist", "Z", 'VALUE')
if srl.use_pass_normal: yield ("Normal", "XYZ", 'VECTOR')
@@ -245,8 +248,8 @@ def list_render_passes(scene, srl):
if srl.use_pass_uv: yield ("UV", "UVA", 'VECTOR')
if srl.use_pass_object_index: yield ("IndexOB", "X", 'VALUE')
if srl.use_pass_material_index: yield ("IndexMA", "X", 'VALUE')
- if srl.use_pass_shadow: yield ("Shadow", "RGB", 'COLOR')
- if srl.use_pass_ambient_occlusion: yield ("AO", "RGB", 'COLOR')
+
+ # Light passes.
if srl.use_pass_diffuse_direct: yield ("DiffDir", "RGB", 'COLOR')
if srl.use_pass_diffuse_indirect: yield ("DiffInd", "RGB", 'COLOR')
if srl.use_pass_diffuse_color: yield ("DiffCol", "RGB", 'COLOR')
@@ -256,19 +259,16 @@ def list_render_passes(scene, srl):
if srl.use_pass_transmission_direct: yield ("TransDir", "RGB", 'COLOR')
if srl.use_pass_transmission_indirect: yield ("TransInd", "RGB", 'COLOR')
if srl.use_pass_transmission_color: yield ("TransCol", "RGB", 'COLOR')
+ if crl.use_pass_volume_direct: yield ("VolumeDir", "RGB", 'COLOR')
+ if crl.use_pass_volume_indirect: yield ("VolumeInd", "RGB", 'COLOR')
if srl.use_pass_emit: yield ("Emit", "RGB", 'COLOR')
if srl.use_pass_environment: yield ("Env", "RGB", 'COLOR')
+ if srl.use_pass_shadow: yield ("Shadow", "RGB", 'COLOR')
+ if srl.use_pass_ambient_occlusion: yield ("AO", "RGB", 'COLOR')
- # Cycles specific passes.
- crl = srl.cycles
+ # Debug passes.
if crl.pass_debug_render_time: yield ("Debug Render Time", "X", 'VALUE')
- if crl.pass_debug_bvh_traversed_nodes: yield ("Debug BVH Traversed Nodes", "X", 'VALUE')
- if crl.pass_debug_bvh_traversed_instances: yield ("Debug BVH Traversed Instances", "X", 'VALUE')
- if crl.pass_debug_bvh_intersections: yield ("Debug BVH Intersections", "X", 'VALUE')
- if crl.pass_debug_ray_bounces: yield ("Debug Ray Bounces", "X", 'VALUE')
if crl.pass_debug_sample_count: yield ("Debug Sample Count", "X", 'VALUE')
- if crl.use_pass_volume_direct: yield ("VolumeDir", "RGB", 'COLOR')
- if crl.use_pass_volume_indirect: yield ("VolumeInd", "RGB", 'COLOR')
# Cryptomatte passes.
crypto_depth = (srl.pass_cryptomatte_depth + 1) // 2
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index 030fa19fa75..5cce696f82d 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -263,6 +263,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
name="Use Denoising",
description="Denoise the rendered image",
default=False,
+ update=update_render_passes,
)
use_preview_denoising: BoolProperty(
name="Use Viewport Denoising",
@@ -1400,30 +1401,6 @@ class CyclesCurveRenderSettings(bpy.types.PropertyGroup):
class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
- pass_debug_bvh_traversed_nodes: BoolProperty(
- name="Debug BVH Traversed Nodes",
- description="Store Debug BVH Traversed Nodes pass",
- default=False,
- update=update_render_passes,
- )
- pass_debug_bvh_traversed_instances: BoolProperty(
- name="Debug BVH Traversed Instances",
- description="Store Debug BVH Traversed Instances pass",
- default=False,
- update=update_render_passes,
- )
- pass_debug_bvh_intersections: BoolProperty(
- name="Debug BVH Intersections",
- description="Store Debug BVH Intersections",
- default=False,
- update=update_render_passes,
- )
- pass_debug_ray_bounces: BoolProperty(
- name="Debug Ray Bounces",
- description="Store Debug Ray Bounces pass",
- default=False,
- update=update_render_passes,
- )
pass_debug_render_time: BoolProperty(
name="Debug Render Time",
description="Render time in milliseconds per sample and pixel",
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index f5c9372e673..b91f5a73dee 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -970,29 +970,6 @@ class CYCLES_RENDER_PT_passes_crypto(CyclesButtonsPanel, ViewLayerCryptomattePan
bl_parent_id = "CYCLES_RENDER_PT_passes"
-class CYCLES_RENDER_PT_passes_debug(CyclesButtonsPanel, Panel):
- bl_label = "Debug"
- bl_context = "view_layer"
- bl_parent_id = "CYCLES_RENDER_PT_passes"
-
- @classmethod
- def poll(cls, context):
- import _cycles
- return _cycles.with_cycles_debug
-
- def draw(self, context):
- layout = self.layout
- layout.use_property_split = True
- layout.use_property_decorate = False
-
- cycles_view_layer = context.view_layer.cycles
-
- layout.prop(cycles_view_layer, "pass_debug_bvh_traversed_nodes")
- layout.prop(cycles_view_layer, "pass_debug_bvh_traversed_instances")
- layout.prop(cycles_view_layer, "pass_debug_bvh_intersections")
- layout.prop(cycles_view_layer, "pass_debug_ray_bounces")
-
-
class CYCLES_RENDER_PT_passes_aov(CyclesButtonsPanel, ViewLayerAOVPanel):
bl_label = "Shader AOV"
bl_context = "view_layer"
@@ -1170,7 +1147,7 @@ class CYCLES_PT_context_material(CyclesButtonsPanel, Panel):
col = row.column(align=True)
col.operator("object.material_slot_add", icon='ADD', text="")
col.operator("object.material_slot_remove", icon='REMOVE', text="")
-
+ col.separator()
col.menu("MATERIAL_MT_context_menu", icon='DOWNARROW_HLT', text="")
if is_sortable:
@@ -1185,16 +1162,15 @@ class CYCLES_PT_context_material(CyclesButtonsPanel, Panel):
row.operator("object.material_slot_select", text="Select")
row.operator("object.material_slot_deselect", text="Deselect")
- split = layout.split(factor=0.65)
+ row = layout.row()
if ob:
- split.template_ID(ob, "active_material", new="material.new")
- row = split.row()
+ row.template_ID(ob, "active_material", new="material.new")
if slot:
- row.prop(slot, "link", text="")
- else:
- row.label()
+ icon_link = 'MESH_DATA' if slot.link == 'DATA' else 'OBJECT_DATA'
+ row.prop(slot, "link", text="", icon=icon_link, icon_only=True)
+
elif mat:
split.template_ID(space, "pin_id")
split.separator()
@@ -2353,7 +2329,6 @@ classes = (
CYCLES_RENDER_PT_passes_data,
CYCLES_RENDER_PT_passes_light,
CYCLES_RENDER_PT_passes_crypto,
- CYCLES_RENDER_PT_passes_debug,
CYCLES_RENDER_PT_passes_aov,
CYCLES_RENDER_PT_filter,
CYCLES_RENDER_PT_override,
diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp
index 11158532738..ecadc78cbbf 100644
--- a/intern/cycles/blender/blender_mesh.cpp
+++ b/intern/cycles/blender/blender_mesh.cpp
@@ -1055,10 +1055,45 @@ static BL::MeshSequenceCacheModifier object_mesh_cache_find(BL::Object &b_ob)
return BL::MeshSequenceCacheModifier(PointerRNA_NULL);
}
+/* Check whether some of "built-in" motion-related attributes are needed to be exported (includes
+ * things like velocity from cache modifier, fluid simulation).
+ *
+ * NOTE: This code is run prior to object motion blur initialization. so can not access properties
+ * set by `sync_object_motion_init()`. */
+static bool mesh_need_motion_attribute(BL::Object &b_ob, Scene *scene)
+{
+ const Scene::MotionType need_motion = scene->need_motion();
+ if (need_motion == Scene::MOTION_NONE) {
+ /* Simple case: neither motion pass nor motion blur is needed, no need in the motion related
+ * attributes. */
+ return false;
+ }
+
+ if (need_motion == Scene::MOTION_BLUR) {
+ /* A bit tricky and implicit case:
+ * - Motion blur is enabled in the scene, which implies specific number of time steps for
+ * objects.
+ * - If the object has motion blur disabled on it, it will have 0 time steps.
+ * - Motion attribute expects non-zero time steps.
+ *
+ * Avoid adding motion attributes if the motion blur will enforce 0 motion steps. */
+ PointerRNA cobject = RNA_pointer_get(&b_ob.ptr, "cycles");
+ const bool use_motion = get_boolean(cobject, "use_motion_blur");
+ if (!use_motion) {
+ return false;
+ }
+ }
+
+ /* Motion pass which implies 3 motion steps, or motion blur which is not disabled on object
+ * level. */
+ return true;
+}
+
static void sync_mesh_cached_velocities(BL::Object &b_ob, Scene *scene, Mesh *mesh)
{
- if (scene->need_motion() == Scene::MOTION_NONE)
+ if (!mesh_need_motion_attribute(b_ob, scene)) {
return;
+ }
BL::MeshSequenceCacheModifier b_mesh_cache = object_mesh_cache_find(b_ob);
@@ -1102,8 +1137,9 @@ static void sync_mesh_cached_velocities(BL::Object &b_ob, Scene *scene, Mesh *me
static void sync_mesh_fluid_motion(BL::Object &b_ob, Scene *scene, Mesh *mesh)
{
- if (scene->need_motion() == Scene::MOTION_NONE)
+ if (!mesh_need_motion_attribute(b_ob, scene)) {
return;
+ }
BL::FluidDomainSettings b_fluid_domain = object_fluid_liquid_domain_find(b_ob);
diff --git a/intern/cycles/blender/blender_python.cpp b/intern/cycles/blender/blender_python.cpp
index 23684b96242..e178a7db338 100644
--- a/intern/cycles/blender/blender_python.cpp
+++ b/intern/cycles/blender/blender_python.cpp
@@ -1116,14 +1116,6 @@ void *CCL_python_module_init()
PyModule_AddStringConstant(mod, "osl_version_string", "unknown");
#endif
-#ifdef WITH_CYCLES_DEBUG
- PyModule_AddObject(mod, "with_cycles_debug", Py_True);
- Py_INCREF(Py_True);
-#else
- PyModule_AddObject(mod, "with_cycles_debug", Py_False);
- Py_INCREF(Py_False);
-#endif
-
#ifdef WITH_NETWORK
PyModule_AddObject(mod, "with_network", Py_True);
Py_INCREF(Py_True);
diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp
index 0fcea2cd544..193bc2c9752 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -538,12 +538,6 @@ PassType BlenderSync::get_pass_type(BL::RenderPass &b_pass)
MAP_PASS("BakePrimitive", PASS_BAKE_PRIMITIVE);
MAP_PASS("BakeDifferential", PASS_BAKE_DIFFERENTIAL);
-#ifdef __KERNEL_DEBUG__
- MAP_PASS("Debug BVH Traversed Nodes", PASS_BVH_TRAVERSED_NODES);
- MAP_PASS("Debug BVH Traversed Instances", PASS_BVH_TRAVERSED_INSTANCES);
- MAP_PASS("Debug BVH Intersections", PASS_BVH_INTERSECTIONS);
- MAP_PASS("Debug Ray Bounces", PASS_RAY_BOUNCES);
-#endif
MAP_PASS("Debug Render Time", PASS_RENDER_TIME);
MAP_PASS("AdaptiveAuxBuffer", PASS_ADAPTIVE_AUX_BUFFER);
MAP_PASS("Debug Sample Count", PASS_SAMPLE_COUNT);
@@ -641,24 +635,6 @@ vector<Pass> BlenderSync::sync_render_passes(BL::Scene &b_scene,
}
}
-#ifdef __KERNEL_DEBUG__
- if (get_boolean(crl, "pass_debug_bvh_traversed_nodes")) {
- b_engine.add_pass("Debug BVH Traversed Nodes", 1, "X", b_view_layer.name().c_str());
- Pass::add(PASS_BVH_TRAVERSED_NODES, passes, "Debug BVH Traversed Nodes");
- }
- if (get_boolean(crl, "pass_debug_bvh_traversed_instances")) {
- b_engine.add_pass("Debug BVH Traversed Instances", 1, "X", b_view_layer.name().c_str());
- Pass::add(PASS_BVH_TRAVERSED_INSTANCES, passes, "Debug BVH Traversed Instances");
- }
- if (get_boolean(crl, "pass_debug_bvh_intersections")) {
- b_engine.add_pass("Debug BVH Intersections", 1, "X", b_view_layer.name().c_str());
- Pass::add(PASS_BVH_INTERSECTIONS, passes, "Debug BVH Intersections");
- }
- if (get_boolean(crl, "pass_debug_ray_bounces")) {
- b_engine.add_pass("Debug Ray Bounces", 1, "X", b_view_layer.name().c_str());
- Pass::add(PASS_RAY_BOUNCES, passes, "Debug Ray Bounces");
- }
-#endif
if (get_boolean(crl, "pass_debug_render_time")) {
b_engine.add_pass("Debug Render Time", 1, "X", b_view_layer.name().c_str());
Pass::add(PASS_RENDER_TIME, passes, "Debug Render Time");
diff --git a/intern/cycles/device/cuda/device_cuda_impl.cpp b/intern/cycles/device/cuda/device_cuda_impl.cpp
index 5b62292ca55..2d2fcb38705 100644
--- a/intern/cycles/device/cuda/device_cuda_impl.cpp
+++ b/intern/cycles/device/cuda/device_cuda_impl.cpp
@@ -351,9 +351,6 @@ string CUDADevice::compile_kernel_get_common_cflags(
if (extra_cflags) {
cflags += string(" ") + string(extra_cflags);
}
-# ifdef WITH_CYCLES_DEBUG
- cflags += " -D__KERNEL_DEBUG__";
-# endif
if (split) {
cflags += " -D__SPLIT__";
@@ -461,18 +458,19 @@ string CUDADevice::compile_kernel(const DeviceRequestedFeatures &requested_featu
const int nvcc_cuda_version = cuewCompilerVersion();
VLOG(1) << "Found nvcc " << nvcc << ", CUDA version " << nvcc_cuda_version << ".";
- if (nvcc_cuda_version < 80) {
+ if (nvcc_cuda_version < 101) {
printf(
"Unsupported CUDA version %d.%d detected, "
- "you need CUDA 8.0 or newer.\n",
+ "you need CUDA 10.1 or newer.\n",
nvcc_cuda_version / 10,
nvcc_cuda_version % 10);
return string();
}
- else if (!(nvcc_cuda_version == 101 || nvcc_cuda_version == 102)) {
+ else if (!(nvcc_cuda_version == 101 || nvcc_cuda_version == 102 || nvcc_cuda_version == 111 ||
+ nvcc_cuda_version == 112 || nvcc_cuda_version == 113 || nvcc_cuda_version == 114)) {
printf(
"CUDA version %d.%d detected, build may succeed but only "
- "CUDA 10.1 and 10.2 are officially supported.\n",
+ "CUDA 10.1 to 11.4 are officially supported.\n",
nvcc_cuda_version / 10,
nvcc_cuda_version % 10);
}
diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp
index c0c0aeb4aa8..be09779bd89 100644
--- a/intern/cycles/device/device_cpu.cpp
+++ b/intern/cycles/device/device_cpu.cpp
@@ -58,8 +58,8 @@
#include "util/util_function.h"
#include "util/util_logging.h"
#include "util/util_map.h"
-#include "util/util_openimagedenoise.h"
#include "util/util_opengl.h"
+#include "util/util_openimagedenoise.h"
#include "util/util_optimization.h"
#include "util/util_progress.h"
#include "util/util_system.h"
diff --git a/intern/cycles/device/device_optix.cpp b/intern/cycles/device/device_optix.cpp
index 392fec4d57b..6f9a7943722 100644
--- a/intern/cycles/device/device_optix.cpp
+++ b/intern/cycles/device/device_optix.cpp
@@ -234,9 +234,6 @@ class OptiXDevice : public CUDADevice {
}
};
# endif
-# if OPTIX_ABI_VERSION >= 41 && defined(WITH_CYCLES_DEBUG)
- options.validationMode = OPTIX_DEVICE_CONTEXT_VALIDATION_MODE_ALL;
-# endif
check_result_optix(optixDeviceContextCreate(cuContext, &options, &context));
# ifdef WITH_CYCLES_LOGGING
check_result_optix(optixDeviceContextSetLogCallback(
@@ -369,13 +366,8 @@ class OptiXDevice : public CUDADevice {
OptixModuleCompileOptions module_options = {};
module_options.maxRegisterCount = 0; // Do not set an explicit register limit
-# ifdef WITH_CYCLES_DEBUG
- module_options.optLevel = OPTIX_COMPILE_OPTIMIZATION_LEVEL_0;
- module_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_FULL;
-# else
module_options.optLevel = OPTIX_COMPILE_OPTIMIZATION_LEVEL_3;
module_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_LINEINFO;
-# endif
# if OPTIX_ABI_VERSION >= 41
module_options.boundValues = nullptr;
@@ -578,11 +570,7 @@ class OptiXDevice : public CUDADevice {
OptixPipelineLinkOptions link_options = {};
link_options.maxTraceDepth = 1;
-# ifdef WITH_CYCLES_DEBUG
- link_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_FULL;
-# else
link_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_LINEINFO;
-# endif
# if OPTIX_ABI_VERSION < 24
link_options.overrideUsesMotionBlur = motion_blur;
# endif
diff --git a/intern/cycles/device/opencl/device_opencl_impl.cpp b/intern/cycles/device/opencl/device_opencl_impl.cpp
index 715213175c9..31a2265700c 100644
--- a/intern/cycles/device/opencl/device_opencl_impl.cpp
+++ b/intern/cycles/device/opencl/device_opencl_impl.cpp
@@ -1968,10 +1968,6 @@ string OpenCLDevice::kernel_build_options(const string *debug_src)
build_options += "-D__KERNEL_OPENCL_DEBUG__ ";
}
-# ifdef WITH_CYCLES_DEBUG
- build_options += "-D__KERNEL_DEBUG__ ";
-# endif
-
# ifdef WITH_NANOVDB
if (info.has_nanovdb) {
build_options += "-DWITH_NANOVDB ";
diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt
index ea0f16c9233..0ce33c51778 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -380,11 +380,16 @@ if(WITH_CYCLES_CUDA_BINARIES)
set(CUDA_VERSION "${CUDA_VERSION_MAJOR}${CUDA_VERSION_MINOR}")
# warn for other versions
- if((CUDA_VERSION MATCHES "101") OR (CUDA_VERSION MATCHES "102") OR (CUDA_VERSION MATCHES "111"))
+ if((CUDA_VERSION MATCHES "101") OR
+ (CUDA_VERSION MATCHES "102") OR
+ (CUDA_VERSION MATCHES "111") OR
+ (CUDA_VERSION MATCHES "112") OR
+ (CUDA_VERSION MATCHES "113") OR
+ (CUDA_VERSION MATCHES "114"))
else()
message(WARNING
"CUDA version ${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR} detected, "
- "build may succeed but only CUDA 10.1, 10.2 and 11.1 are officially supported")
+ "build may succeed but only CUDA 10.1 to 11.4 are officially supported")
endif()
# build for each arch
@@ -439,10 +444,6 @@ if(WITH_CYCLES_CUDA_BINARIES)
set(name ${name}_experimental)
endif()
- if(WITH_CYCLES_DEBUG)
- set(cuda_flags ${cuda_flags} -D __KERNEL_DEBUG__)
- endif()
-
if(WITH_NANOVDB)
set(cuda_flags ${cuda_flags}
-D WITH_NANOVDB
@@ -557,11 +558,6 @@ if(WITH_CYCLES_DEVICE_OPTIX AND WITH_CYCLES_CUDA_BINARIES)
--use_fast_math
-o ${output})
- if(WITH_CYCLES_DEBUG)
- set(cuda_flags ${cuda_flags}
- -D __KERNEL_DEBUG__)
- endif()
-
if(WITH_NANOVDB)
set(cuda_flags ${cuda_flags}
-D WITH_NANOVDB
diff --git a/intern/cycles/kernel/bvh/bvh_traversal.h b/intern/cycles/kernel/bvh/bvh_traversal.h
index 8b2699ab807..89250a8d60a 100644
--- a/intern/cycles/kernel/bvh/bvh_traversal.h
+++ b/intern/cycles/kernel/bvh/bvh_traversal.h
@@ -67,8 +67,6 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
isect->prim = PRIM_NONE;
isect->object = OBJECT_NONE;
- BVH_DEBUG_INIT();
-
/* traversal loop */
do {
do {
@@ -118,7 +116,6 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
--stack_ptr;
}
}
- BVH_DEBUG_NEXT_NODE();
}
/* if node is leaf, fetch triangle list */
@@ -138,7 +135,6 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
switch (type & PRIMITIVE_ALL) {
case PRIMITIVE_TRIANGLE: {
for (; prim_addr < prim_addr2; prim_addr++) {
- BVH_DEBUG_NEXT_INTERSECTION();
kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type);
if (triangle_intersect(kg, isect, P, dir, visibility, object, prim_addr)) {
/* shadow ray early termination */
@@ -151,7 +147,6 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
#if BVH_FEATURE(BVH_MOTION)
case PRIMITIVE_MOTION_TRIANGLE: {
for (; prim_addr < prim_addr2; prim_addr++) {
- BVH_DEBUG_NEXT_INTERSECTION();
kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type);
if (motion_triangle_intersect(
kg, isect, P, dir, ray->time, visibility, object, prim_addr)) {
@@ -169,7 +164,6 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
case PRIMITIVE_CURVE_RIBBON:
case PRIMITIVE_MOTION_CURVE_RIBBON: {
for (; prim_addr < prim_addr2; prim_addr++) {
- BVH_DEBUG_NEXT_INTERSECTION();
const uint curve_type = kernel_tex_fetch(__prim_type, prim_addr);
kernel_assert((curve_type & PRIMITIVE_ALL) == (type & PRIMITIVE_ALL));
const bool hit = curve_intersect(
@@ -201,8 +195,6 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
traversal_stack[stack_ptr] = ENTRYPOINT_SENTINEL;
node_addr = kernel_tex_fetch(__object_node, object);
-
- BVH_DEBUG_NEXT_INSTANCE();
}
}
} while (node_addr != ENTRYPOINT_SENTINEL);
diff --git a/intern/cycles/kernel/bvh/bvh_types.h b/intern/cycles/kernel/bvh/bvh_types.h
index 9f0879a2069..98e6ec25d15 100644
--- a/intern/cycles/kernel/bvh/bvh_types.h
+++ b/intern/cycles/kernel/bvh/bvh_types.h
@@ -42,33 +42,6 @@ CCL_NAMESPACE_BEGIN
#define BVH_FEATURE(f) (((BVH_FUNCTION_FEATURES) & (f)) != 0)
-/* Debugging helpers. */
-#ifdef __KERNEL_DEBUG__
-# define BVH_DEBUG_INIT() \
- do { \
- isect->num_traversed_nodes = 0; \
- isect->num_traversed_instances = 0; \
- isect->num_intersections = 0; \
- } while (0)
-# define BVH_DEBUG_NEXT_NODE() \
- do { \
- ++isect->num_traversed_nodes; \
- } while (0)
-# define BVH_DEBUG_NEXT_INTERSECTION() \
- do { \
- ++isect->num_intersections; \
- } while (0)
-# define BVH_DEBUG_NEXT_INSTANCE() \
- do { \
- ++isect->num_traversed_instances; \
- } while (0)
-#else /* __KERNEL_DEBUG__ */
-# define BVH_DEBUG_INIT()
-# define BVH_DEBUG_NEXT_NODE()
-# define BVH_DEBUG_NEXT_INTERSECTION()
-# define BVH_DEBUG_NEXT_INSTANCE()
-#endif /* __KERNEL_DEBUG__ */
-
CCL_NAMESPACE_END
#endif /* __BVH_TYPES__ */
diff --git a/intern/cycles/kernel/closure/bssrdf.h b/intern/cycles/kernel/closure/bssrdf.h
index de65451d82c..562daf1286d 100644
--- a/intern/cycles/kernel/closure/bssrdf.h
+++ b/intern/cycles/kernel/closure/bssrdf.h
@@ -432,9 +432,9 @@ ccl_device void bssrdf_sample(const ShaderClosure *sc, float xi, float *r, float
xi *= bssrdf->channels;
if (xi < 1.0f) {
- radius = (bssrdf->radius.x > 0.0f) ?
- bssrdf->radius.x :
- (bssrdf->radius.y > 0.0f) ? bssrdf->radius.y : bssrdf->radius.z;
+ radius = (bssrdf->radius.x > 0.0f) ? bssrdf->radius.x :
+ (bssrdf->radius.y > 0.0f) ? bssrdf->radius.y :
+ bssrdf->radius.z;
}
else if (xi < 2.0f) {
xi -= 1.0f;
diff --git a/intern/cycles/kernel/filter/filter_defines.h b/intern/cycles/kernel/filter/filter_defines.h
index 0e51eeef92f..1c0ac5e2cb7 100644
--- a/intern/cycles/kernel/filter/filter_defines.h
+++ b/intern/cycles/kernel/filter/filter_defines.h
@@ -52,15 +52,14 @@ typedef struct TileInfo {
tile_buffer_6, tile_buffer_7, tile_buffer_8, tile_buffer_9
# define ccl_get_tile_buffer(id) \
(id == 0 ? tile_buffer_1 : \
- id == 1 ? \
- tile_buffer_2 : \
- id == 2 ? \
- tile_buffer_3 : \
- id == 3 ? tile_buffer_4 : \
- id == 4 ? tile_buffer_5 : \
- id == 5 ? tile_buffer_6 : \
- id == 6 ? tile_buffer_7 : \
- id == 7 ? tile_buffer_8 : tile_buffer_9)
+ id == 1 ? tile_buffer_2 : \
+ id == 2 ? tile_buffer_3 : \
+ id == 3 ? tile_buffer_4 : \
+ id == 4 ? tile_buffer_5 : \
+ id == 5 ? tile_buffer_6 : \
+ id == 6 ? tile_buffer_7 : \
+ id == 7 ? tile_buffer_8 : \
+ tile_buffer_9)
#else
# ifdef __KERNEL_CUDA__
# define CCL_FILTER_TILE_INFO ccl_global TileInfo *tile_info
diff --git a/intern/cycles/kernel/kernel_accumulate.h b/intern/cycles/kernel/kernel_accumulate.h
index 76e0f2be02c..61653d328f1 100644
--- a/intern/cycles/kernel/kernel_accumulate.h
+++ b/intern/cycles/kernel/kernel_accumulate.h
@@ -225,13 +225,6 @@ ccl_device_inline void path_radiance_init(KernelGlobals *kg, PathRadiance *L)
L->denoising_albedo = zero_float3();
L->denoising_depth = 0.0f;
#endif
-
-#ifdef __KERNEL_DEBUG__
- L->debug_data.num_bvh_traversed_nodes = 0;
- L->debug_data.num_bvh_traversed_instances = 0;
- L->debug_data.num_bvh_intersections = 0;
- L->debug_data.num_ray_bounces = 0;
-#endif
}
ccl_device_inline void path_radiance_bsdf_bounce(KernelGlobals *kg,
@@ -595,7 +588,9 @@ ccl_device_inline void path_radiance_sum_shadowcatcher(KernelGlobals *kg,
float shadow;
if (UNLIKELY(!isfinite_safe(path_total))) {
+# ifdef __KERNEL_DEBUG_NAN__
kernel_assert(!"Non-finite total radiance along the path");
+# endif
shadow = 0.0f;
}
else if (path_total == 0.0f) {
@@ -641,7 +636,9 @@ ccl_device_inline float3 path_radiance_clamp_and_sum(KernelGlobals *kg,
/* Reject invalid value */
if (!isfinite_safe(sum)) {
+# ifdef __KERNEL_DEBUG_NAN__
kernel_assert(!"Non-finite sum in path_radiance_clamp_and_sum!");
+# endif
L_sum = zero_float3();
L->direct_diffuse = zero_float3();
@@ -667,7 +664,9 @@ ccl_device_inline float3 path_radiance_clamp_and_sum(KernelGlobals *kg,
/* Reject invalid value */
float sum = fabsf((L_sum).x) + fabsf((L_sum).y) + fabsf((L_sum).z);
if (!isfinite_safe(sum)) {
+#ifdef __KERNEL_DEBUG_NAN__
kernel_assert(!"Non-finite final sum in path_radiance_clamp_and_sum!");
+#endif
L_sum = zero_float3();
}
}
diff --git a/intern/cycles/kernel/kernel_passes.h b/intern/cycles/kernel/kernel_passes.h
index 52be2ed87b7..8f58b8c3079 100644
--- a/intern/cycles/kernel/kernel_passes.h
+++ b/intern/cycles/kernel/kernel_passes.h
@@ -122,31 +122,6 @@ ccl_device_inline void kernel_update_denoising_features(KernelGlobals *kg,
}
#endif /* __DENOISING_FEATURES__ */
-#ifdef __KERNEL_DEBUG__
-ccl_device_inline void kernel_write_debug_passes(KernelGlobals *kg,
- ccl_global float *buffer,
- PathRadiance *L)
-{
- int flag = kernel_data.film.pass_flag;
- if (flag & PASSMASK(BVH_TRAVERSED_NODES)) {
- kernel_write_pass_float(buffer + kernel_data.film.pass_bvh_traversed_nodes,
- L->debug_data.num_bvh_traversed_nodes);
- }
- if (flag & PASSMASK(BVH_TRAVERSED_INSTANCES)) {
- kernel_write_pass_float(buffer + kernel_data.film.pass_bvh_traversed_instances,
- L->debug_data.num_bvh_traversed_instances);
- }
- if (flag & PASSMASK(BVH_INTERSECTIONS)) {
- kernel_write_pass_float(buffer + kernel_data.film.pass_bvh_intersections,
- L->debug_data.num_bvh_intersections);
- }
- if (flag & PASSMASK(RAY_BOUNCES)) {
- kernel_write_pass_float(buffer + kernel_data.film.pass_ray_bounces,
- L->debug_data.num_ray_bounces);
- }
-}
-#endif /* __KERNEL_DEBUG__ */
-
#ifdef __KERNEL_CPU__
# define WRITE_ID_SLOT(buffer, depth, id, matte_weight, name) \
kernel_write_id_pass_cpu(buffer, depth * 2, id, matte_weight, kg->coverage_##name)
@@ -389,10 +364,6 @@ ccl_device_inline void kernel_write_result(KernelGlobals *kg,
}
#endif /* __DENOISING_FEATURES__ */
-#ifdef __KERNEL_DEBUG__
- kernel_write_debug_passes(kg, buffer, L);
-#endif
-
/* Adaptive Sampling. Fill the additional buffer with the odd samples and calculate our stopping
criteria. This is the heuristic from "A hierarchical automatic stopping condition for Monte
Carlo global illumination" except that here it is applied per pixel and not in hierarchical
diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h
index 8e34ab9af82..a050847cb68 100644
--- a/intern/cycles/kernel/kernel_path.h
+++ b/intern/cycles/kernel/kernel_path.h
@@ -70,15 +70,6 @@ ccl_device_forceinline bool kernel_path_scene_intersect(KernelGlobals *kg,
bool hit = scene_intersect(kg, ray, visibility, isect);
-#ifdef __KERNEL_DEBUG__
- if (state->flag & PATH_RAY_CAMERA) {
- L->debug_data.num_bvh_traversed_nodes += isect->num_traversed_nodes;
- L->debug_data.num_bvh_traversed_instances += isect->num_traversed_instances;
- L->debug_data.num_bvh_intersections += isect->num_intersections;
- }
- L->debug_data.num_ray_bounces++;
-#endif /* __KERNEL_DEBUG__ */
-
return hit;
}
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h
index bc327dd6591..5a79790ca6b 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -184,9 +184,8 @@ CCL_NAMESPACE_BEGIN
# undef __SHADER_RAYTRACE__
#endif
-/* Features that enable others */
-#ifdef WITH_CYCLES_DEBUG
-# define __KERNEL_DEBUG__
+#ifdef WITH_CYCLES_DEBUG_NAN
+# define __KERNEL_DEBUG_NAN__
#endif
#if defined(__SUBSURFACE__) || defined(__SHADER_RAYTRACE__)
@@ -358,12 +357,6 @@ typedef enum PassType {
PASS_MATERIAL_ID,
PASS_MOTION,
PASS_MOTION_WEIGHT,
-#ifdef __KERNEL_DEBUG__
- PASS_BVH_TRAVERSED_NODES,
- PASS_BVH_TRAVERSED_INSTANCES,
- PASS_BVH_INTERSECTIONS,
- PASS_RAY_BOUNCES,
-#endif
PASS_RENDER_TIME,
PASS_CRYPTOMATTE,
PASS_AOV_COLOR,
@@ -467,18 +460,6 @@ typedef enum DenoiseFlag {
DENOISING_CLEAN_ALL_PASSES = (1 << 6) - 1,
} DenoiseFlag;
-#ifdef __KERNEL_DEBUG__
-/* NOTE: This is a runtime-only struct, alignment is not
- * really important here.
- */
-typedef struct DebugData {
- int num_bvh_traversed_nodes;
- int num_bvh_traversed_instances;
- int num_bvh_intersections;
- int num_ray_bounces;
-} DebugData;
-#endif
-
typedef ccl_addr_space struct PathRadianceState {
#ifdef __PASSES__
float3 diffuse;
@@ -554,10 +535,6 @@ typedef ccl_addr_space struct PathRadiance {
float3 denoising_albedo;
float denoising_depth;
#endif /* __DENOISING_FEATURES__ */
-
-#ifdef __KERNEL_DEBUG__
- DebugData debug_data;
-#endif /* __KERNEL_DEBUG__ */
} PathRadiance;
typedef struct BsdfEval {
@@ -673,12 +650,6 @@ typedef struct Intersection {
int prim;
int object;
int type;
-
-#ifdef __KERNEL_DEBUG__
- int num_traversed_nodes;
- int num_traversed_instances;
- int num_intersections;
-#endif
} Intersection;
/* Primitives */
@@ -1272,13 +1243,6 @@ typedef struct KernelFilm {
int pass_bake_differential;
int pad;
-#ifdef __KERNEL_DEBUG__
- int pass_bvh_traversed_nodes;
- int pass_bvh_traversed_instances;
- int pass_bvh_intersections;
- int pass_ray_bounces;
-#endif
-
/* viewport rendering options */
int display_pass_stride;
int display_pass_components;
diff --git a/intern/cycles/kernel/shaders/node_voronoi_texture.osl b/intern/cycles/kernel/shaders/node_voronoi_texture.osl
index e184c26aec8..de6c697fc85 100644
--- a/intern/cycles/kernel/shaders/node_voronoi_texture.osl
+++ b/intern/cycles/kernel/shaders/node_voronoi_texture.osl
@@ -54,14 +54,18 @@ vector4 safe_divide(vector4 a, float b)
}
/*
- * Smooth Voronoi:
+ * Original code is under the MIT License, Copyright (c) 2013 Inigo Quilez.
*
+ * Smooth Voronoi:
* - https://wiki.blender.org/wiki/User:OmarSquircleArt/GSoC2019/Documentation/Smooth_Voronoi
*
- * Distance To Edge:
+ * Distance To Edge based on:
*
- * - https://www.shadertoy.com/view/llG3zy
+ * - https://www.iquilezles.org/www/articles/voronoilines/voronoilines.htm
+ * - https://www.shadertoy.com/view/ldl3W8
*
+ * With optimization to change -2..2 scan window to -1..1 for better performance,
+ * as explained in https://www.shadertoy.com/view/llG3zy.
*/
/* **** 1D Voronoi **** */
diff --git a/intern/cycles/kernel/svm/svm_voronoi.h b/intern/cycles/kernel/svm/svm_voronoi.h
index 10d17403f65..d0e7db35fab 100644
--- a/intern/cycles/kernel/svm/svm_voronoi.h
+++ b/intern/cycles/kernel/svm/svm_voronoi.h
@@ -17,14 +17,19 @@
CCL_NAMESPACE_BEGIN
/*
+ * Original code is under the MIT License, Copyright (c) 2013 Inigo Quilez.
+ *
* Smooth Voronoi:
*
* - https://wiki.blender.org/wiki/User:OmarSquircleArt/GSoC2019/Documentation/Smooth_Voronoi
*
- * Distance To Edge:
+ * Distance To Edge based on:
*
- * - https://www.shadertoy.com/view/llG3zy
+ * - https://www.iquilezles.org/www/articles/voronoilines/voronoilines.htm
+ * - https://www.shadertoy.com/view/ldl3W8
*
+ * With optimization to change -2..2 scan window to -1..1 for better performance,
+ * as explained in https://www.shadertoy.com/view/llG3zy.
*/
/* **** 1D Voronoi **** */
diff --git a/intern/cycles/render/attribute.cpp b/intern/cycles/render/attribute.cpp
index bf9d69cb47e..ea5a5f50f2d 100644
--- a/intern/cycles/render/attribute.cpp
+++ b/intern/cycles/render/attribute.cpp
@@ -20,6 +20,7 @@
#include "render/mesh.h"
#include "util/util_foreach.h"
+#include "util/util_logging.h"
#include "util/util_transform.h"
CCL_NAMESPACE_BEGIN
@@ -208,6 +209,7 @@ size_t Attribute::element_size(Geometry *geom, AttributePrimitive prim) const
case ATTR_ELEMENT_VERTEX_MOTION:
if (geom->geometry_type == Geometry::MESH) {
Mesh *mesh = static_cast<Mesh *>(geom);
+ DCHECK_GT(mesh->get_motion_steps(), 0);
size = (mesh->get_verts().size() + mesh->get_num_ngons()) * (mesh->get_motion_steps() - 1);
if (prim == ATTR_PRIM_SUBD) {
size -= mesh->get_num_subd_verts() * (mesh->get_motion_steps() - 1);
@@ -252,6 +254,7 @@ size_t Attribute::element_size(Geometry *geom, AttributePrimitive prim) const
case ATTR_ELEMENT_CURVE_KEY_MOTION:
if (geom->geometry_type == Geometry::HAIR) {
Hair *hair = static_cast<Hair *>(geom);
+ DCHECK_GT(hair->get_motion_steps(), 0);
size = hair->get_curve_keys().size() * (hair->get_motion_steps() - 1);
}
break;
diff --git a/intern/cycles/render/buffers.cpp b/intern/cycles/render/buffers.cpp
index 0948b20628f..fcfad58995e 100644
--- a/intern/cycles/render/buffers.cpp
+++ b/intern/cycles/render/buffers.cpp
@@ -322,15 +322,6 @@ bool RenderBuffers::get_pass_rect(
pixels[0] = saturate(f * scale_exposure);
}
}
-#ifdef WITH_CYCLES_DEBUG
- else if (type == PASS_BVH_TRAVERSED_NODES || type == PASS_BVH_TRAVERSED_INSTANCES ||
- type == PASS_BVH_INTERSECTIONS || type == PASS_RAY_BOUNCES) {
- for (int i = 0; i < size; i++, in += pass_stride, pixels++) {
- float f = *in;
- pixels[0] = f * scale;
- }
- }
-#endif
else {
for (int i = 0; i < size; i++, in += pass_stride, pixels++) {
float f = *in;
diff --git a/intern/cycles/render/colorspace.cpp b/intern/cycles/render/colorspace.cpp
index 4540793f78d..3842f8e4726 100644
--- a/intern/cycles/render/colorspace.cpp
+++ b/intern/cycles/render/colorspace.cpp
@@ -385,7 +385,7 @@ void ColorSpaceManager::free_memory()
{
#ifdef WITH_OCIO
map_free_memory(cached_colorspaces);
- map_free_memory(cached_colorspaces);
+ map_free_memory(cached_processors);
#endif
}
diff --git a/intern/cycles/render/film.cpp b/intern/cycles/render/film.cpp
index c4ff89fc838..5df396394c4 100644
--- a/intern/cycles/render/film.cpp
+++ b/intern/cycles/render/film.cpp
@@ -51,12 +51,6 @@ static NodeEnum *get_pass_type_enum()
pass_type_enum.insert("material_id", PASS_MATERIAL_ID);
pass_type_enum.insert("motion", PASS_MOTION);
pass_type_enum.insert("motion_weight", PASS_MOTION_WEIGHT);
-#ifdef __KERNEL_DEBUG__
- pass_type_enum.insert("traversed_nodes", PASS_BVH_TRAVERSED_NODES);
- pass_type_enum.insert("traverse_instances", PASS_BVH_TRAVERSED_INSTANCES);
- pass_type_enum.insert("bvh_intersections", PASS_BVH_INTERSECTIONS);
- pass_type_enum.insert("ray_bounces", PASS_RAY_BOUNCES);
-#endif
pass_type_enum.insert("render_time", PASS_RENDER_TIME);
pass_type_enum.insert("cryptomatte", PASS_CRYPTOMATTE);
pass_type_enum.insert("aov_color", PASS_AOV_COLOR);
@@ -200,15 +194,6 @@ void Pass::add(PassType type, vector<Pass> &passes, const char *name)
*/
pass.components = 0;
break;
-#ifdef WITH_CYCLES_DEBUG
- case PASS_BVH_TRAVERSED_NODES:
- case PASS_BVH_TRAVERSED_INSTANCES:
- case PASS_BVH_INTERSECTIONS:
- case PASS_RAY_BOUNCES:
- pass.components = 1;
- pass.exposure = false;
- break;
-#endif
case PASS_RENDER_TIME:
/* This pass is handled entirely on the host side. */
pass.components = 0;
@@ -570,20 +555,6 @@ void Film::device_update(Device *device, DeviceScene *dscene, Scene *scene)
kfilm->pass_bake_differential = kfilm->pass_stride;
break;
-#ifdef WITH_CYCLES_DEBUG
- case PASS_BVH_TRAVERSED_NODES:
- kfilm->pass_bvh_traversed_nodes = kfilm->pass_stride;
- break;
- case PASS_BVH_TRAVERSED_INSTANCES:
- kfilm->pass_bvh_traversed_instances = kfilm->pass_stride;
- break;
- case PASS_BVH_INTERSECTIONS:
- kfilm->pass_bvh_intersections = kfilm->pass_stride;
- break;
- case PASS_RAY_BOUNCES:
- kfilm->pass_ray_bounces = kfilm->pass_stride;
- break;
-#endif
case PASS_RENDER_TIME:
break;
case PASS_CRYPTOMATTE:
diff --git a/intern/cycles/render/graph.h b/intern/cycles/render/graph.h
index 3d884f3009b..b39dc9c8b71 100644
--- a/intern/cycles/render/graph.h
+++ b/intern/cycles/render/graph.h
@@ -356,7 +356,7 @@ class ShaderGraph : public NodeOwner {
/* This function is used to create a node of a specified type instead of
* calling 'new', and sets the graph as the owner of the node.
*/
- template<typename T, typename... Args> T *create_node(Args &&... args)
+ template<typename T, typename... Args> T *create_node(Args &&...args)
{
T *node = new T(args...);
node->set_owner(this);
diff --git a/intern/cycles/render/osl.cpp b/intern/cycles/render/osl.cpp
index 6cd9f1d94ff..84b5cdd4d26 100644
--- a/intern/cycles/render/osl.cpp
+++ b/intern/cycles/render/osl.cpp
@@ -954,7 +954,7 @@ void OSLCompiler::parameter_array(const char *name, const float f[], int arrayle
void OSLCompiler::parameter_color_array(const char *name, const array<float3> &f)
{
- /* NB: cycles float3 type is actually 4 floats! need to use an explicit array */
+ /* NOTE: cycles float3 type is actually 4 floats! need to use an explicit array. */
array<float[3]> table(f.size());
for (int i = 0; i < f.size(); ++i) {
diff --git a/intern/cycles/render/scene.h b/intern/cycles/render/scene.h
index e4d073e1a2f..842a341358a 100644
--- a/intern/cycles/render/scene.h
+++ b/intern/cycles/render/scene.h
@@ -344,7 +344,7 @@ class Scene : public NodeOwner {
* node array (e.g. Scene::geometry for Geometry nodes) and tag the appropriate
* manager for an update.
*/
- template<typename T, typename... Args> T *create_node(Args &&... args)
+ template<typename T, typename... Args> T *create_node(Args &&...args)
{
T *node = new T(args...);
node->set_owner(this);
diff --git a/intern/cycles/util/util_avxb.h b/intern/cycles/util/util_avxb.h
index 17d505c077a..15215d04ca3 100644
--- a/intern/cycles/util/util_avxb.h
+++ b/intern/cycles/util/util_avxb.h
@@ -57,7 +57,7 @@ struct avxb {
: m256(_mm256_insertf128_ps(_mm256_castps128_ps256(a), b, 1))
{
}
- __forceinline operator const __m256 &(void)const
+ __forceinline operator const __m256 &(void) const
{
return m256;
}
diff --git a/intern/cycles/util/util_avxi.h b/intern/cycles/util/util_avxi.h
index 3db646e61f4..0ae4bf271c8 100644
--- a/intern/cycles/util/util_avxi.h
+++ b/intern/cycles/util/util_avxi.h
@@ -54,7 +54,7 @@ struct avxi {
__forceinline avxi(const __m256i a) : m256(a)
{
}
- __forceinline operator const __m256i &(void)const
+ __forceinline operator const __m256i &(void) const
{
return m256;
}
diff --git a/intern/cycles/util/util_logging.cpp b/intern/cycles/util/util_logging.cpp
index 3782187d78c..8272728a7a0 100644
--- a/intern/cycles/util/util_logging.cpp
+++ b/intern/cycles/util/util_logging.cpp
@@ -26,9 +26,9 @@
CCL_NAMESPACE_BEGIN
+#ifdef WITH_CYCLES_LOGGING
static bool is_verbosity_set()
{
-#ifdef WITH_CYCLES_LOGGING
using CYCLES_GFLAGS_NAMESPACE::GetCommandLineOption;
std::string verbosity;
@@ -36,10 +36,8 @@ static bool is_verbosity_set()
return false;
}
return verbosity != "0";
-#else
- return false;
-#endif
}
+#endif
void util_logging_init(const char *argv0)
{
diff --git a/intern/cycles/util/util_logging.h b/intern/cycles/util/util_logging.h
index 3e56f0a0193..c161299acd0 100644
--- a/intern/cycles/util/util_logging.h
+++ b/intern/cycles/util/util_logging.h
@@ -40,7 +40,7 @@ class LogMessageVoidify {
LogMessageVoidify()
{
}
- void operator&(StubStream &)
+ void operator&(const StubStream &)
{
}
};
@@ -49,6 +49,36 @@ class LogMessageVoidify {
# define LOG(severity) LOG_SUPPRESS()
# define VLOG(severity) LOG_SUPPRESS()
# define VLOG_IF(severity, condition) LOG_SUPPRESS()
+
+# define CHECK(expression) LOG_SUPPRESS()
+
+# define CHECK_NOTNULL(expression) LOG_SUPPRESS()
+# define CHECK_NULL(expression) LOG_SUPPRESS()
+
+# define CHECK_NEAR(actual, expected, eps) LOG_SUPPRESS()
+
+# define CHECK_GE(a, b) LOG_SUPPRESS()
+# define CHECK_NE(a, b) LOG_SUPPRESS()
+# define CHECK_EQ(a, b) LOG_SUPPRESS()
+# define CHECK_GT(a, b) LOG_SUPPRESS()
+# define CHECK_LT(a, b) LOG_SUPPRESS()
+# define CHECK_LE(a, b) LOG_SUPPRESS()
+
+# define DCHECK(expression) LOG_SUPPRESS()
+
+# define DCHECK_NOTNULL(expression) LOG_SUPPRESS()
+# define DCHECK_NULL(expression) LOG_SUPPRESS()
+
+# define DCHECK_NEAR(actual, expected, eps) LOG_SUPPRESS()
+
+# define DCHECK_GE(a, b) LOG_SUPPRESS()
+# define DCHECK_NE(a, b) LOG_SUPPRESS()
+# define DCHECK_EQ(a, b) LOG_SUPPRESS()
+# define DCHECK_GT(a, b) LOG_SUPPRESS()
+# define DCHECK_LT(a, b) LOG_SUPPRESS()
+# define DCHECK_LE(a, b) LOG_SUPPRESS()
+
+# define LOG_ASSERT(expression) LOG_SUPPRESS()
#endif
#define VLOG_ONCE(level, flag) \
diff --git a/intern/cycles/util/util_math_fast.h b/intern/cycles/util/util_math_fast.h
index 1113ede0f2d..38afa163db5 100644
--- a/intern/cycles/util/util_math_fast.h
+++ b/intern/cycles/util/util_math_fast.h
@@ -103,7 +103,7 @@ ccl_device float fast_sinf(float x)
* 1.19209e-07 max error
*/
int q = fast_rint(x * M_1_PI_F);
- float qf = q;
+ float qf = (float)q;
x = madd(qf, -0.78515625f * 4, x);
x = madd(qf, -0.00024187564849853515625f * 4, x);
x = madd(qf, -3.7747668102383613586e-08f * 4, x);
@@ -132,7 +132,7 @@ ccl_device float fast_cosf(float x)
{
/* Same argument reduction as fast_sinf(). */
int q = fast_rint(x * M_1_PI_F);
- float qf = q;
+ float qf = (float)q;
x = madd(qf, -0.78515625f * 4, x);
x = madd(qf, -0.00024187564849853515625f * 4, x);
x = madd(qf, -3.7747668102383613586e-08f * 4, x);
@@ -160,7 +160,7 @@ ccl_device void fast_sincosf(float x, float *sine, float *cosine)
{
/* Same argument reduction as fast_sin. */
int q = fast_rint(x * M_1_PI_F);
- float qf = q;
+ float qf = (float)q;
x = madd(qf, -0.78515625f * 4, x);
x = madd(qf, -0.00024187564849853515625f * 4, x);
x = madd(qf, -3.7747668102383613586e-08f * 4, x);
@@ -207,7 +207,7 @@ ccl_device float fast_tanf(float x)
* we sometimes need to take the reciprocal of the polynomial
*/
int q = fast_rint(x * 2.0f * M_1_PI_F);
- float qf = q;
+ float qf = (float)q;
x = madd(qf, -0.78515625f * 2, x);
x = madd(qf, -0.00024187564849853515625f * 2, x);
x = madd(qf, -3.7747668102383613586e-08f * 2, x);
@@ -407,7 +407,7 @@ ccl_device float fast_logb(float x)
x = fabsf(x);
x = clamp(x, FLT_MIN, FLT_MAX);
unsigned bits = __float_as_uint(x);
- return (int)(bits >> 23) - 127;
+ return (float)((int)(bits >> 23) - 127);
}
ccl_device float fast_exp2f(float x)
diff --git a/intern/cycles/util/util_sseb.h b/intern/cycles/util/util_sseb.h
index 4dbd5b8046e..6afce4f8909 100644
--- a/intern/cycles/util/util_sseb.h
+++ b/intern/cycles/util/util_sseb.h
@@ -57,7 +57,7 @@ struct sseb {
__forceinline sseb(const __m128 input) : m128(input)
{
}
- __forceinline operator const __m128 &(void)const
+ __forceinline operator const __m128 &(void) const
{
return m128;
}
diff --git a/intern/cycles/util/util_ssei.h b/intern/cycles/util/util_ssei.h
index cd51dbff2f1..94412fb77e7 100644
--- a/intern/cycles/util/util_ssei.h
+++ b/intern/cycles/util/util_ssei.h
@@ -57,7 +57,7 @@ struct ssei {
__forceinline ssei(const __m128i a) : m128(a)
{
}
- __forceinline operator const __m128i &(void)const
+ __forceinline operator const __m128i &(void) const
{
return m128;
}
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index db3f9bd561e..46e3888a367 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -188,8 +188,8 @@ extern GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
GHOST_GLSettings glSettings);
/**
- * Create a new offscreen context.
- * Never explicitly delete the context, use disposeContext() instead.
+ * Create a new off-screen context.
+ * Never explicitly delete the context, use #disposeContext() instead.
* \param systemhandle: The handle to the system.
* \param platform_support_callback: An optional callback to check platform support.
* \return A handle to the new context ( == NULL if creation failed).
@@ -628,7 +628,7 @@ extern void GHOST_ScreenToClient(
GHOST_WindowHandle windowhandle, int32_t inX, int32_t inY, int32_t *outX, int32_t *outY);
/**
- * Converts a point in screen coordinates to client rectangle coordinates
+ * Converts a point in client rectangle coordinates to screen coordinates.
* \param windowhandle: The handle to the window.
* \param inX: The x-coordinate in the client rectangle.
* \param inY: The y-coordinate in the client rectangle.
diff --git a/intern/ghost/GHOST_IContext.h b/intern/ghost/GHOST_IContext.h
index 278a9a40bd1..1b5f996cb54 100644
--- a/intern/ghost/GHOST_IContext.h
+++ b/intern/ghost/GHOST_IContext.h
@@ -29,8 +29,8 @@
/**
* Interface for GHOST context.
*
- * You can create a offscreen context (windowless) with the system's
- * GHOST_ISystem::createOffscreenContext method.
+ * You can create a off-screen context (windowless) with the system's
+ * #GHOST_ISystem::createOffscreenContext method.
* \see GHOST_ISystem#createOffscreenContext
*/
class GHOST_IContext {
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index 4c395f720df..05c6c9d907f 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -261,8 +261,8 @@ class GHOST_ISystem {
virtual GHOST_TSuccess disposeWindow(GHOST_IWindow *window) = 0;
/**
- * Create a new offscreen context.
- * Never explicitly delete the context, use disposeContext() instead.
+ * Create a new off-screen context.
+ * Never explicitly delete the context, use #disposeContext() instead.
* \return The new context (or 0 if creation failed).
*/
virtual GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings) = 0;
diff --git a/intern/ghost/GHOST_IWindow.h b/intern/ghost/GHOST_IWindow.h
index f870791b345..5f9bd808c8c 100644
--- a/intern/ghost/GHOST_IWindow.h
+++ b/intern/ghost/GHOST_IWindow.h
@@ -133,7 +133,7 @@ class GHOST_IWindow {
virtual void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const = 0;
/**
- * Converts a point in screen coordinates to client rectangle coordinates
+ * Converts a point in client rectangle coordinates to screen coordinates.
* \param inX: The x-coordinate in the client rectangle.
* \param inY: The y-coordinate in the client rectangle.
* \param outX: The x-coordinate on the screen.
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index ff93de4f203..94a3fd86b73 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -611,9 +611,9 @@ typedef void (*GHOST_TimerProcPtr)(struct GHOST_TimerTaskHandle__ *task, uint64_
struct GHOST_XrDrawViewInfo;
struct GHOST_XrError;
/**
- * The XR view (i.e. the OpenXR runtime) may require a different graphics library than OpenGL. An
- * offscreen texture of the viewport will then be drawn into using OpenGL, but the final texture
- * draw call will happen through another lib (say DirectX).
+ * The XR view (i.e. the OpenXR runtime) may require a different graphics library than OpenGL.
+ * An off-screen texture of the viewport will then be drawn into using OpenGL,
+ * but the final texture draw call will happen through another library (say DirectX).
*
* This enum defines the possible graphics bindings to attempt to enable.
*/
@@ -683,6 +683,10 @@ typedef struct GHOST_XrDrawViewInfo {
/** Set if the buffer should be submitted with a SRGB transfer applied. */
char expects_srgb_buffer;
+
+ /** The view that this info represents. Not necessarily the "eye index" (e.g. for quad view
+ * systems, etc). */
+ char view_idx;
} GHOST_XrDrawViewInfo;
typedef struct GHOST_XrError {
diff --git a/intern/ghost/intern/GHOST_ContextCGL.mm b/intern/ghost/intern/GHOST_ContextCGL.mm
index 687173ded09..7af243846c2 100644
--- a/intern/ghost/intern/GHOST_ContextCGL.mm
+++ b/intern/ghost/intern/GHOST_ContextCGL.mm
@@ -217,7 +217,7 @@ static void makeAttribList(std::vector<NSOpenGLPixelFormatAttribute> &attribs,
attribs.push_back(NSOpenGLPFAOpenGLProfile);
attribs.push_back(coreProfile ? NSOpenGLProfileVersion3_2Core : NSOpenGLProfileVersionLegacy);
- // Pixel Format Attributes for the windowed NSOpenGLContext
+ /* Pixel Format Attributes for the windowed NSOpenGLContext. */
attribs.push_back(NSOpenGLPFADoubleBuffer);
if (softwareGL) {
@@ -250,7 +250,8 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
static const bool needAlpha = false;
#endif
- static bool softwareGL = getenv("BLENDER_SOFTWAREGL"); // command-line argument would be better
+ /* Command-line argument would be better. */
+ static bool softwareGL = getenv("BLENDER_SOFTWAREGL");
std::vector<NSOpenGLPixelFormatAttribute> attribs;
attribs.reserve(40);
@@ -287,7 +288,7 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
if (m_metalView) {
if (m_defaultFramebuffer == 0) {
- // Create a virtual framebuffer
+ /* Create a virtual frame-buffer. */
[m_openGLContext makeCurrentContext];
metalInitFramebuffer();
initClearGL();
@@ -342,11 +343,11 @@ void GHOST_ContextCGL::metalInit()
/* clang-format on */
id<MTLDevice> device = m_metalLayer.device;
- // Create a command queue for blit/present operation
+ /* Create a command queue for blit/present operation. */
m_metalCmdQueue = (MTLCommandQueue *)[device newCommandQueue];
[m_metalCmdQueue retain];
- // Create shaders for blit operation
+ /* Create shaders for blit operation. */
NSString *source = @R"msl(
using namespace metal;
@@ -387,7 +388,7 @@ void GHOST_ContextCGL::metalInit()
"GHOST_ContextCGL::metalInit: newLibraryWithSource:options:error: failed!");
}
- // Create a render pipeline for blit operation
+ /* Create a render pipeline for blit operation. */
MTLRenderPipelineDescriptor *desc = [[[MTLRenderPipelineDescriptor alloc] init] autorelease];
desc.fragmentFunction = [library newFunctionWithName:@"fragment_shader"];
@@ -460,7 +461,7 @@ void GHOST_ContextCGL::metalUpdateFramebuffer()
"GHOST_ContextCGL::metalUpdateFramebuffer: CVPixelBufferCreate failed!");
}
- // Create an OpenGL texture
+ /* Create an OpenGL texture. */
CVOpenGLTextureCacheRef cvGLTexCache = nil;
cvret = CVOpenGLTextureCacheCreate(kCFAllocatorDefault,
nil,
@@ -485,7 +486,7 @@ void GHOST_ContextCGL::metalUpdateFramebuffer()
unsigned int glTex;
glTex = CVOpenGLTextureGetName(cvGLTex);
- // Create a Metal texture
+ /* Create a Metal texture. */
CVMetalTextureCacheRef cvMetalTexCache = nil;
cvret = CVMetalTextureCacheCreate(
kCFAllocatorDefault, nil, m_metalLayer.device, nil, &cvMetalTexCache);
diff --git a/intern/ghost/intern/GHOST_ContextEGL.cpp b/intern/ghost/intern/GHOST_ContextEGL.cpp
index 0fee200ea1a..82100e4b3f0 100644
--- a/intern/ghost/intern/GHOST_ContextEGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextEGL.cpp
@@ -283,8 +283,8 @@ GHOST_TSuccess GHOST_ContextEGL::setSwapInterval(int interval)
GHOST_TSuccess GHOST_ContextEGL::getSwapInterval(int &intervalOut)
{
- // This is a bit of a kludge because there does not seem to
- // be a way to query the swap interval with EGL.
+ /* This is a bit of a kludge because there does not seem to
+ * be a way to query the swap interval with EGL. */
intervalOut = m_swap_interval;
return GHOST_kSuccess;
@@ -365,21 +365,21 @@ static const std::string &api_string(EGLenum api)
GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
{
- // objects have to be declared here due to the use of goto
+ /* Objects have to be declared here due to the use of `goto`. */
std::vector<EGLint> attrib_list;
EGLint num_config = 0;
if (m_stereoVisual)
fprintf(stderr, "Warning! Stereo OpenGL ES contexts are not supported.\n");
- m_stereoVisual = false; // It doesn't matter what the Window wants.
+ m_stereoVisual = false; /* It doesn't matter what the Window wants. */
if (!initContextEGLEW()) {
return GHOST_kFailure;
}
#ifdef WITH_GL_ANGLE
- // d3dcompiler_XX.dll needs to be loaded before ANGLE will work
+ /* `d3dcompiler_XX.dll` needs to be loaded before ANGLE will work. */
if (s_d3dcompiler == NULL) {
s_d3dcompiler = LoadLibrary(D3DCOMPILER);
@@ -402,7 +402,9 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
if (!EGL_CHK(::eglInitialize(m_display, &egl_major, &egl_minor)))
goto error;
+#ifdef WITH_GHOST_DEBUG
fprintf(stderr, "EGL Version %d.%d\n", egl_major, egl_minor);
+#endif
if (!EGL_CHK(::eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)))
goto error;
@@ -410,13 +412,13 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
if (!bindAPI(m_api))
goto error;
- // build attribute list
+ /* Build attribute list. */
attrib_list.reserve(20);
if (m_api == EGL_OPENGL_ES_API && EGLEW_VERSION_1_2) {
- // According to the spec it seems that you are required to set EGL_RENDERABLE_TYPE,
- // but some implementations (ANGLE) do not seem to care.
+ /* According to the spec it seems that you are required to set EGL_RENDERABLE_TYPE,
+ * but some implementations (ANGLE) do not seem to care. */
if (m_contextMajorVersion == 1) {
attrib_list.push_back(EGL_RENDERABLE_TYPE);
@@ -469,7 +471,7 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
#endif
if (m_nativeWindow == 0) {
- // off-screen surface
+ /* Off-screen surface. */
attrib_list.push_back(EGL_SURFACE_TYPE);
attrib_list.push_back(EGL_PBUFFER_BIT);
}
@@ -479,8 +481,8 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
if (!EGL_CHK(::eglChooseConfig(m_display, &(attrib_list[0]), &m_config, 1, &num_config)))
goto error;
- // A common error is to assume that ChooseConfig worked because it returned EGL_TRUE
- if (num_config != 1) // num_config should be exactly 1
+ /* A common error is to assume that ChooseConfig worked because it returned EGL_TRUE. */
+ if (num_config != 1) /* `num_config` should be exactly 1. */
goto error;
if (m_nativeWindow != 0) {
diff --git a/intern/ghost/intern/GHOST_ContextGLX.cpp b/intern/ghost/intern/GHOST_ContextGLX.cpp
index da8b1fd4941..eb49dc4f98b 100644
--- a/intern/ghost/intern/GHOST_ContextGLX.cpp
+++ b/intern/ghost/intern/GHOST_ContextGLX.cpp
@@ -32,7 +32,7 @@
#include <cstdio>
#include <cstring>
-/* needed for intel drivers (works w/ mesa-swrast & nvidia) */
+/* Needed for Intel drivers (works with MESA-software-rasterizer (`swrast`) & NVIDIA). */
#define USE_GLXEW_INIT_WORKAROUND
#ifdef USE_GLXEW_INIT_WORKAROUND
@@ -239,7 +239,7 @@ GHOST_TSuccess GHOST_ContextGLX::initializeDrawingContext()
}
attribs[i++] = 0;
- /* Some drivers don't like having a true offscreen context.
+ /* Some drivers don't like having a true off-screen context.
* Create a pixel buffer instead of a window to render to.
* even if it will never be used for drawing. */
int pbuffer_attribs[] = {GLX_PBUFFER_WIDTH, 1, GLX_PBUFFER_HEIGHT, 1, None};
diff --git a/intern/ghost/intern/GHOST_ContextWGL.cpp b/intern/ghost/intern/GHOST_ContextWGL.cpp
index ddb34a8afd9..b412e52a5f7 100644
--- a/intern/ghost/intern/GHOST_ContextWGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextWGL.cpp
@@ -335,10 +335,11 @@ void GHOST_ContextWGL::initContextWGLEW(PIXELFORMATDESCRIPTOR &preferredPFD)
if (!WIN32_CHK(::wglMakeCurrent(dummyHDC, dummyHGLRC)))
goto finalize;
- if (GLEW_CHK(glewInit()) != GLEW_OK)
+ if (GLEW_CHK(glewInit()) != GLEW_OK) {
fprintf(stderr, "Warning! Dummy GLEW/WGLEW failed to initialize properly.\n");
+ }
- // the following are not technially WGLEW, but they also require a context to work
+ /* The following are not technically WGLEW, but they also require a context to work. */
#ifndef NDEBUG
free((void *)m_dummyRenderer);
@@ -474,16 +475,15 @@ int GHOST_ContextWGL::choose_pixel_format(bool stereoVisual, bool needAlpha)
PIXELFORMATDESCRIPTOR preferredPFD = {
sizeof(PIXELFORMATDESCRIPTOR), /* size */
1, /* version */
- (DWORD)(
- PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW |
- PFD_DOUBLEBUFFER | /* support double-buffering */
- (stereoVisual ? PFD_STEREO : 0) | /* support stereo */
- (
+ (DWORD)(PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW |
+ PFD_DOUBLEBUFFER | /* support double-buffering */
+ (stereoVisual ? PFD_STEREO : 0) | /* support stereo */
+ (
#ifdef WIN32_COMPOSITING
- needAlpha ?
- PFD_SUPPORT_COMPOSITION : /* support composition for transparent background */
+ /* Support composition for transparent background. */
+ needAlpha ? PFD_SUPPORT_COMPOSITION :
#endif
- 0)),
+ 0)),
PFD_TYPE_RGBA, /* color type */
(BYTE)(needAlpha ? 32 : 24), /* preferred color depth */
0,
diff --git a/intern/ghost/intern/GHOST_DisplayManager.cpp b/intern/ghost/intern/GHOST_DisplayManager.cpp
index fe12a76753d..9abc652378a 100644
--- a/intern/ghost/intern/GHOST_DisplayManager.cpp
+++ b/intern/ghost/intern/GHOST_DisplayManager.cpp
@@ -51,7 +51,7 @@ GHOST_TSuccess GHOST_DisplayManager::initialize(void)
GHOST_TSuccess GHOST_DisplayManager::getNumDisplays(uint8_t & /*numDisplays*/) const
{
- // Don't know if we have a display...
+ /* Don't know if we have a display. */
return GHOST_kFailure;
}
@@ -120,18 +120,18 @@ GHOST_TSuccess GHOST_DisplayManager::findMatch(uint8_t display,
(int)setting.xPixels, (int)setting.yPixels, (int)setting.bpp, (int)setting.frequency};
int capabilities[4];
double field, score;
- double best = 1e12; // A big number
+ double best = 1e12; /* A big number. */
int found = 0;
- // Look at all the display modes
+ /* Look at all the display modes. */
for (int i = 0; (i < (int)m_settings[display].size()); i++) {
- // Store the capabilities of the display device
+ /* Store the capabilities of the display device. */
capabilities[0] = m_settings[display][i].xPixels;
capabilities[1] = m_settings[display][i].yPixels;
capabilities[2] = m_settings[display][i].bpp;
capabilities[3] = m_settings[display][i].frequency;
- // Match against all the fields of the display settings
+ /* Match against all the fields of the display settings. */
score = 0;
for (int j = 0; j < 4; j++) {
field = capabilities[j] - criteria[j];
diff --git a/intern/ghost/intern/GHOST_DropTargetX11.cpp b/intern/ghost/intern/GHOST_DropTargetX11.cpp
index 8758a27930e..dba1d305144 100644
--- a/intern/ghost/intern/GHOST_DropTargetX11.cpp
+++ b/intern/ghost/intern/GHOST_DropTargetX11.cpp
@@ -115,8 +115,10 @@ GHOST_DropTargetX11::~GHOST_DropTargetX11()
/* Based on: https://stackoverflow.com/a/2766963/432509 */
typedef enum DecodeState_e {
- STATE_SEARCH = 0, ///< searching for an ampersand to convert
- STATE_CONVERTING ///< convert the two proceeding characters from hex
+ /** Searching for an ampersand to convert. */
+ STATE_SEARCH = 0,
+ /** Convert the two proceeding characters from hex. */
+ STATE_CONVERTING
} DecodeState_e;
void GHOST_DropTargetX11::UrlDecode(char *decodedOut, int bufferSize, const char *encodedIn)
diff --git a/intern/ghost/intern/GHOST_EventDragnDrop.h b/intern/ghost/intern/GHOST_EventDragnDrop.h
index 537717b1717..0095cedb8c8 100644
--- a/intern/ghost/intern/GHOST_EventDragnDrop.h
+++ b/intern/ghost/intern/GHOST_EventDragnDrop.h
@@ -90,7 +90,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_EventManager.cpp b/intern/ghost/intern/GHOST_EventManager.cpp
index 15befb9afcb..6ddc362ac77 100644
--- a/intern/ghost/intern/GHOST_EventManager.cpp
+++ b/intern/ghost/intern/GHOST_EventManager.cpp
@@ -108,12 +108,12 @@ GHOST_TSuccess GHOST_EventManager::addConsumer(GHOST_IEventConsumer *consumer)
GHOST_TSuccess success;
GHOST_ASSERT(consumer, "invalid consumer");
- // Check to see whether the consumer is already in our list
+ /* Check to see whether the consumer is already in our list. */
TConsumerVector::const_iterator iter = std::find(
m_consumers.begin(), m_consumers.end(), consumer);
if (iter == m_consumers.end()) {
- // Add the consumer
+ /* Add the consumer. */
m_consumers.push_back(consumer);
success = GHOST_kSuccess;
}
@@ -128,11 +128,11 @@ GHOST_TSuccess GHOST_EventManager::removeConsumer(GHOST_IEventConsumer *consumer
GHOST_TSuccess success;
GHOST_ASSERT(consumer, "invalid consumer");
- // Check to see whether the consumer is in our list
+ /* Check to see whether the consumer is in our list. */
TConsumerVector::iterator iter = std::find(m_consumers.begin(), m_consumers.end(), consumer);
if (iter != m_consumers.end()) {
- // Remove the consumer
+ /* Remove the consumer. */
m_consumers.erase(iter);
success = GHOST_kSuccess;
}
diff --git a/intern/ghost/intern/GHOST_ISystem.cpp b/intern/ghost/intern/GHOST_ISystem.cpp
index 7c12bfe0306..d9fecda22a4 100644
--- a/intern/ghost/intern/GHOST_ISystem.cpp
+++ b/intern/ghost/intern/GHOST_ISystem.cpp
@@ -60,6 +60,8 @@ GHOST_TSuccess GHOST_ISystem::createSystem()
}
catch (const std::runtime_error &) {
/* fallback to X11. */
+ delete m_system;
+ m_system = nullptr;
}
if (!m_system) {
m_system = new GHOST_SystemX11();
diff --git a/intern/ghost/intern/GHOST_ImeWin32.cpp b/intern/ghost/intern/GHOST_ImeWin32.cpp
index 112a266ae28..8daa07b5003 100644
--- a/intern/ghost/intern/GHOST_ImeWin32.cpp
+++ b/intern/ghost/intern/GHOST_ImeWin32.cpp
@@ -34,6 +34,8 @@ GHOST_ImeWin32::GHOST_ImeWin32()
: is_composing_(false),
ime_status_(false),
input_language_id_(LANG_USER_DEFAULT),
+ conversion_modes_(IME_CMODE_ALPHANUMERIC),
+ sentence_mode_(IME_SMODE_NONE),
system_caret_(false),
caret_rect_(-1, -1, 0, 0),
is_first(true),
@@ -59,6 +61,63 @@ bool GHOST_ImeWin32::SetInputLanguage()
return ime_status_;
}
+WORD GHOST_ImeWin32::GetInputLanguage()
+{
+ return input_language_id_;
+}
+
+void GHOST_ImeWin32::UpdateConversionStatus(HWND window_handle)
+{
+ HIMC imm_context = ::ImmGetContext(window_handle);
+ if (imm_context) {
+ if (::ImmGetOpenStatus(imm_context)) {
+ ::ImmGetConversionStatus(imm_context, &conversion_modes_, &sentence_mode_);
+ }
+ else {
+ conversion_modes_ = IME_CMODE_ALPHANUMERIC;
+ sentence_mode_ = IME_SMODE_NONE;
+ }
+ ::ImmReleaseContext(window_handle, imm_context);
+ }
+ else {
+ conversion_modes_ = IME_CMODE_ALPHANUMERIC;
+ sentence_mode_ = IME_SMODE_NONE;
+ }
+}
+
+bool GHOST_ImeWin32::IsEnglishMode()
+{
+ return (conversion_modes_ & IME_CMODE_NOCONVERSION) ||
+ !(conversion_modes_ & (IME_CMODE_NATIVE | IME_CMODE_FULLSHAPE));
+}
+
+bool GHOST_ImeWin32::IsImeKeyEvent(char ascii)
+{
+ if (!(IsEnglishMode())) {
+ /* In Chinese, Japanese, Korean, all alpha keys are processed by IME. */
+ if ((ascii >= 'A' && ascii <= 'Z') || (ascii >= 'a' && ascii <= 'z')) {
+ return true;
+ }
+ switch (PRIMARYLANGID(GetInputLanguage())) {
+ /* In Japanese, all symbolic characters are also processed by IME. */
+ case LANG_JAPANESE: {
+ if (ascii >= ' ' && ascii <= '~') {
+ return true;
+ }
+ break;
+ }
+ /* In Chinese, some symbolic characters are also processed by IME. */
+ case LANG_CHINESE: {
+ if (ascii && strchr("!\"$'(),.:;<>?[\\]^_`", ascii)) {
+ return true;
+ }
+ break;
+ }
+ }
+ }
+ return false;
+}
+
void GHOST_ImeWin32::CreateImeWindow(HWND window_handle)
{
/**
diff --git a/intern/ghost/intern/GHOST_ImeWin32.h b/intern/ghost/intern/GHOST_ImeWin32.h
index 4af988aef6e..bcc4b6eef7c 100644
--- a/intern/ghost/intern/GHOST_ImeWin32.h
+++ b/intern/ghost/intern/GHOST_ImeWin32.h
@@ -156,6 +156,18 @@ class GHOST_ImeWin32 {
*/
bool SetInputLanguage();
+ /* Returns the current input language id. */
+ WORD GetInputLanguage();
+
+ /* Saves the current conversion status. */
+ void UpdateConversionStatus(HWND window_handle);
+
+ /* Is the IME currently in conversion mode? */
+ bool IsEnglishMode();
+
+ /* Checks a key whether IME has to do handling. */
+ bool IsImeKeyEvent(char ascii);
+
/**
* Create the IME windows, and allocate required resources for them.
* Parameters
@@ -371,6 +383,12 @@ class GHOST_ImeWin32 {
*/
LANGID input_language_id_;
+ /* Current Conversion Mode Values. Retrieved with ImmGetConversionStatus. */
+ DWORD conversion_modes_;
+
+ /* Current Sentence Mode. Retrieved with ImmGetConversionStatus. */
+ DWORD sentence_mode_;
+
/**
* Represents whether or not the current input context has created a system
* caret to set the position of its IME candidate window.
diff --git a/intern/ghost/intern/GHOST_NDOFManager.cpp b/intern/ghost/intern/GHOST_NDOFManager.cpp
index 079ad67f737..0317c175273 100644
--- a/intern/ghost/intern/GHOST_NDOFManager.cpp
+++ b/intern/ghost/intern/GHOST_NDOFManager.cpp
@@ -22,51 +22,51 @@
#include <limits.h>
#include <math.h>
-#include <stdio.h> // for error/info reporting
-#include <string.h> // for memory functions
+#include <stdio.h> /* For error/info reporting. */
+#include <string.h> /* For memory functions. */
#ifdef DEBUG_NDOF_MOTION
-// printable version of each GHOST_TProgress value
+/* Printable version of each GHOST_TProgress value. */
static const char *progress_string[] = {
"not started", "starting", "in progress", "finishing", "finished"};
#endif
#ifdef DEBUG_NDOF_BUTTONS
static const char *ndof_button_names[] = {
- // used internally, never sent
+ /* used internally, never sent */
"NDOF_BUTTON_NONE",
- // these two are available from any 3Dconnexion device
+ /* these two are available from any 3Dconnexion device */
"NDOF_BUTTON_MENU",
"NDOF_BUTTON_FIT",
- // standard views
+ /* standard views */
"NDOF_BUTTON_TOP",
"NDOF_BUTTON_BOTTOM",
"NDOF_BUTTON_LEFT",
"NDOF_BUTTON_RIGHT",
"NDOF_BUTTON_FRONT",
"NDOF_BUTTON_BACK",
- // more views
+ /* more views */
"NDOF_BUTTON_ISO1",
"NDOF_BUTTON_ISO2",
- // 90 degree rotations
+ /* 90 degree rotations */
"NDOF_BUTTON_ROLL_CW",
"NDOF_BUTTON_ROLL_CCW",
"NDOF_BUTTON_SPIN_CW",
"NDOF_BUTTON_SPIN_CCW",
"NDOF_BUTTON_TILT_CW",
"NDOF_BUTTON_TILT_CCW",
- // device control
+ /* device control */
"NDOF_BUTTON_ROTATE",
"NDOF_BUTTON_PANZOOM",
"NDOF_BUTTON_DOMINANT",
"NDOF_BUTTON_PLUS",
"NDOF_BUTTON_MINUS",
- // keyboard emulation
+ /* keyboard emulation */
"NDOF_BUTTON_ESC",
"NDOF_BUTTON_ALT",
"NDOF_BUTTON_SHIFT",
"NDOF_BUTTON_CTRL",
- // general-purpose buttons
+ /* general-purpose buttons */
"NDOF_BUTTON_1",
"NDOF_BUTTON_2",
"NDOF_BUTTON_3",
@@ -77,17 +77,17 @@ static const char *ndof_button_names[] = {
"NDOF_BUTTON_8",
"NDOF_BUTTON_9",
"NDOF_BUTTON_10",
- // more general-purpose buttons
+ /* more general-purpose buttons */
"NDOF_BUTTON_A",
"NDOF_BUTTON_B",
"NDOF_BUTTON_C",
- // the end
+ /* the end */
"NDOF_BUTTON_LAST"};
#endif
-// shared by the latest 3Dconnexion hardware
-// SpacePilotPro uses all of these
-// smaller devices use only some, based on button mask
+/* Shared by the latest 3Dconnexion hardware
+ * SpacePilotPro uses all of these
+ * smaller devices use only some, based on button mask. */
static const NDOF_ButtonT Modern3Dx_HID_map[] = {
NDOF_BUTTON_MENU, NDOF_BUTTON_FIT, NDOF_BUTTON_TOP, NDOF_BUTTON_LEFT,
NDOF_BUTTON_RIGHT, NDOF_BUTTON_FRONT, NDOF_BUTTON_BOTTOM, NDOF_BUTTON_BACK,
@@ -116,15 +116,15 @@ static const NDOF_ButtonT SpaceExplorer_HID_map[] = {
NDOF_BUTTON_ROTATE,
};
-// this is the older SpacePilot (sans Pro)
-// thanks to polosson for info about this device
+/* This is the older SpacePilot (sans Pro)
+ * thanks to polosson for info about this device. */
static const NDOF_ButtonT SpacePilot_HID_map[] = {
NDOF_BUTTON_1, NDOF_BUTTON_2, NDOF_BUTTON_3, NDOF_BUTTON_4,
NDOF_BUTTON_5, NDOF_BUTTON_6, 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_DOMINANT, NDOF_BUTTON_ROTATE,
- NDOF_BUTTON_NONE // the CONFIG button -- what does it do?
+ NDOF_BUTTON_NONE /* the CONFIG button -- what does it do? */
};
static const NDOF_ButtonT Generic_HID_map[] = {
@@ -146,7 +146,7 @@ static const int genericButtonCount = sizeof(Generic_HID_map) / sizeof(NDOF_Butt
GHOST_NDOFManager::GHOST_NDOFManager(GHOST_System &sys)
: m_system(sys),
- m_deviceType(NDOF_UnknownDevice), // each platform has its own device detection code
+ m_deviceType(NDOF_UnknownDevice), /* Each platform has its own device detection code. */
m_buttonCount(genericButtonCount),
m_buttonMask(0),
m_hidMap(Generic_HID_map),
@@ -157,37 +157,37 @@ GHOST_NDOFManager::GHOST_NDOFManager(GHOST_System &sys)
m_motionEventPending(false),
m_deadZone(0.0f)
{
- // to avoid the rare situation where one triple is updated and
- // the other is not, initialize them both here:
+ /* To avoid the rare situation where one triple is updated and
+ * the other is not, initialize them both here: */
memset(m_translation, 0, sizeof(m_translation));
memset(m_rotation, 0, sizeof(m_rotation));
}
bool GHOST_NDOFManager::setDevice(unsigned short vendor_id, unsigned short product_id)
{
- // call this function until it returns true
- // it's a good idea to stop calling it after that, as it will "forget"
- // whichever device it already found
+ /* Call this function until it returns true
+ * it's a good idea to stop calling it after that, as it will "forget"
+ * whichever device it already found */
- // default to safe generic behavior for "unknown" devices
- // unidentified devices will emit motion events like normal
- // rogue buttons do nothing by default, but can be customized by the user
+ /* Default to safe generic behavior for "unknown" devices
+ * unidentified devices will emit motion events like normal
+ * rogue buttons do nothing by default, but can be customized by the user. */
m_deviceType = NDOF_UnknownDevice;
m_hidMap = Generic_HID_map;
m_buttonCount = genericButtonCount;
m_buttonMask = 0;
- // "mystery device" owners can help build a HID_map for their hardware
- // A few users have already contributed information about several older devices
- // that I don't have access to. Thanks!
+ /* "mystery device" owners can help build a HID_map for their hardware
+ * A few users have already contributed information about several older devices
+ * that I don't have access to. Thanks! */
switch (vendor_id) {
- case 0x046D: // Logitech (3Dconnexion was a subsidiary)
+ case 0x046D: /* Logitech (3Dconnexion was a subsidiary). */
switch (product_id) {
- // -- current devices --
- case 0xC626: // full-size SpaceNavigator
- case 0xC628: // the "for Notebooks" one
+ /* -- current devices -- */
+ case 0xC626: /* full-size SpaceNavigator */
+ case 0xC628: /* the "for Notebooks" one */
puts("ndof: using SpaceNavigator");
m_deviceType = NDOF_SpaceNavigator;
m_buttonCount = 2;
@@ -209,12 +209,12 @@ bool GHOST_NDOFManager::setDevice(unsigned short vendor_id, unsigned short produ
puts("ndof: using SpaceMouse Pro");
m_deviceType = NDOF_SpaceMousePro;
m_buttonCount = 27;
- // ^^ actually has 15 buttons, but their HID codes range from 0 to 26
+ /* ^^ actually has 15 buttons, but their HID codes range from 0 to 26 */
m_buttonMask = 0x07C0F137;
m_hidMap = Modern3Dx_HID_map;
break;
- // -- older devices --
+ /* -- older devices -- */
case 0xC625:
puts("ndof: using SpacePilot");
m_deviceType = NDOF_SpacePilot;
@@ -236,21 +236,21 @@ bool GHOST_NDOFManager::setDevice(unsigned short vendor_id, unsigned short produ
printf("ndof: unknown Logitech product %04hx\n", product_id);
}
break;
- case 0x256F: // 3Dconnexion
+ case 0x256F: /* 3Dconnexion */
switch (product_id) {
- case 0xC62E: // plugged in
- case 0xC62F: // wireless
+ case 0xC62E: /* Plugged in. */
+ case 0xC62F: /* Wireless. */
puts("ndof: using SpaceMouse Wireless");
m_deviceType = NDOF_SpaceMouseWireless;
m_buttonCount = 2;
m_hidMap = Modern3Dx_HID_map;
break;
- case 0xC631: // plugged in
- case 0xC632: // wireless
+ case 0xC631: /* Plugged in. */
+ case 0xC632: /* Wireless. */
puts("ndof: using SpaceMouse Pro Wireless");
m_deviceType = NDOF_SpaceMouseProWireless;
m_buttonCount = 27;
- // ^^ actually has 15 buttons, but their HID codes range from 0 to 26
+ /* ^^ actually has 15 buttons, but their HID codes range from 0 to 26. */
m_buttonMask = 0x07C0F137;
m_hidMap = Modern3Dx_HID_map;
break;
@@ -364,16 +364,16 @@ void GHOST_NDOFManager::updateButton(int button_number, bool press, uint64_t tim
int mask = 1 << button_number;
if (press) {
- m_buttons |= mask; // set this button's bit
+ m_buttons |= mask; /* Set this button's bit. */
}
else {
- m_buttons &= ~mask; // clear this button's bit
+ m_buttons &= ~mask; /* Clear this button's bit. */
}
}
void GHOST_NDOFManager::updateButtons(int button_bits, uint64_t time)
{
- button_bits &= m_buttonMask; // discard any "garbage" bits
+ button_bits &= m_buttonMask; /* Discard any "garbage" bits. */
int diff = m_buttons ^ button_bits;
@@ -390,11 +390,11 @@ void GHOST_NDOFManager::updateButtons(int button_bits, uint64_t time)
void GHOST_NDOFManager::setDeadZone(float dz)
{
if (dz < 0.0f) {
- // negative values don't make sense, so clamp at zero
+ /* Negative values don't make sense, so clamp at zero. */
dz = 0.0f;
}
else if (dz > 0.5f) {
- // warn the rogue user/developer, but allow it
+ /* Warn the rogue user/developer, but allow it. */
GHOST_PRINTF("ndof: dead zone of %.2f is rather high...\n", dz);
}
m_deadZone = dz;
@@ -426,22 +426,22 @@ bool GHOST_NDOFManager::sendMotionEvent()
if (!m_motionEventPending)
return false;
- m_motionEventPending = false; // any pending motion is handled right now
+ m_motionEventPending = false; /* Any pending motion is handled right now. */
GHOST_IWindow *window = m_system.getWindowManager()->getActiveWindow();
if (window == NULL) {
- m_motionState = GHOST_kNotStarted; // avoid large 'dt' times when changing windows
- return false; // delivery will fail, so don't bother sending
+ m_motionState = GHOST_kNotStarted; /* Avoid large `dt` times when changing windows. */
+ return false; /* Delivery will fail, so don't bother sending. */
}
GHOST_EventNDOFMotion *event = new GHOST_EventNDOFMotion(m_motionTime, window);
GHOST_TEventNDOFMotionData *data = (GHOST_TEventNDOFMotionData *)event->getData();
- // scale axis values here to normalize them to around +/- 1
- // they are scaled again for overall sensitivity in the WM based on user prefs
+ /* Scale axis values here to normalize them to around +/- 1
+ * they are scaled again for overall sensitivity in the WM based on user preferences. */
- const float scale = 1.0f / 350.0f; // 3Dconnexion devices send +/- 350 usually
+ const float scale = 1.0f / 350.0f; /* 3Dconnexion devices send +/- 350 usually */
data->tx = scale * m_translation[0];
data->ty = scale * m_translation[1];
@@ -451,24 +451,24 @@ bool GHOST_NDOFManager::sendMotionEvent()
data->ry = scale * m_rotation[1];
data->rz = scale * m_rotation[2];
- data->dt = 0.001f * (m_motionTime - m_prevMotionTime); // in seconds
+ data->dt = 0.001f * (m_motionTime - m_prevMotionTime); /* In seconds. */
m_prevMotionTime = m_motionTime;
bool weHaveMotion = !nearHomePosition(data, m_deadZone);
- // determine what kind of motion event to send (Starting, InProgress, Finishing)
- // and where that leaves this NDOF manager (NotStarted, InProgress, Finished)
+ /* Determine what kind of motion event to send `(Starting, InProgress, Finishing)`
+ * and where that leaves this NDOF manager `(NotStarted, InProgress, Finished)`. */
switch (m_motionState) {
case GHOST_kNotStarted:
case GHOST_kFinished:
if (weHaveMotion) {
data->progress = GHOST_kStarting;
m_motionState = GHOST_kInProgress;
- // prev motion time will be ancient, so just make up a reasonable time delta
+ /* Previous motion time will be ancient, so just make up a reasonable time delta. */
data->dt = 0.0125f;
}
else {
- // send no event and keep current state
+ /* Send no event and keep current state. */
#ifdef DEBUG_NDOF_MOTION
printf("ndof motion ignored -- %s\n", progress_string[data->progress]);
#endif
@@ -479,20 +479,22 @@ bool GHOST_NDOFManager::sendMotionEvent()
case GHOST_kInProgress:
if (weHaveMotion) {
data->progress = GHOST_kInProgress;
- // remain 'InProgress'
+ /* Remain 'InProgress'. */
}
else {
data->progress = GHOST_kFinishing;
m_motionState = GHOST_kFinished;
}
break;
- default:; // will always be one of the above
+ default:
+ /* Will always be one of the above. */
+ break;
}
#ifdef DEBUG_NDOF_MOTION
printf("ndof motion sent -- %s\n", progress_string[data->progress]);
- // show details about this motion event
+ /* Show details about this motion event. */
printf(" T=(%d,%d,%d) R=(%d,%d,%d) raw\n",
m_translation[0],
m_translation[1],
diff --git a/intern/ghost/intern/GHOST_NDOFManager.h b/intern/ghost/intern/GHOST_NDOFManager.h
index 7be129c327c..31b11a352db 100644
--- a/intern/ghost/intern/GHOST_NDOFManager.h
+++ b/intern/ghost/intern/GHOST_NDOFManager.h
@@ -28,7 +28,7 @@
typedef enum {
NDOF_UnknownDevice,
- // current devices
+ /* Current devices. */
NDOF_SpaceNavigator,
NDOF_SpaceExplorer,
NDOF_SpacePilotPro,
@@ -37,51 +37,51 @@ typedef enum {
NDOF_SpaceMouseProWireless,
NDOF_SpaceMouseEnterprise,
- // older devices
+ /* Older devices. */
NDOF_SpacePilot,
NDOF_Spaceball5000,
NDOF_SpaceTraveler
} NDOF_DeviceT;
-// NDOF device button event types
+/* NDOF device button event types */
typedef enum {
- // used internally, never sent
+ /* Used internally, never sent. */
NDOF_BUTTON_NONE,
- // these two are available from any 3Dconnexion device
+ /* These two are available from any 3Dconnexion device. */
NDOF_BUTTON_MENU,
NDOF_BUTTON_FIT,
- // standard views
+ /* Standard views. */
NDOF_BUTTON_TOP,
NDOF_BUTTON_BOTTOM,
NDOF_BUTTON_LEFT,
NDOF_BUTTON_RIGHT,
NDOF_BUTTON_FRONT,
NDOF_BUTTON_BACK,
- // more views
+ /* More views. */
NDOF_BUTTON_ISO1,
NDOF_BUTTON_ISO2,
- // 90 degree rotations
- // these don't all correspond to physical buttons
+ /* 90 degree rotations.
+ * These don't all correspond to physical buttons. */
NDOF_BUTTON_ROLL_CW,
NDOF_BUTTON_ROLL_CCW,
NDOF_BUTTON_SPIN_CW,
NDOF_BUTTON_SPIN_CCW,
NDOF_BUTTON_TILT_CW,
NDOF_BUTTON_TILT_CCW,
- // device control
+ /* Device control. */
NDOF_BUTTON_ROTATE,
NDOF_BUTTON_PANZOOM,
NDOF_BUTTON_DOMINANT,
NDOF_BUTTON_PLUS,
NDOF_BUTTON_MINUS,
- // keyboard emulation
+ /* Keyboard emulation. */
NDOF_BUTTON_ESC,
NDOF_BUTTON_ALT,
NDOF_BUTTON_SHIFT,
NDOF_BUTTON_CTRL,
- // general-purpose buttons
- // users can assign functions via keymap editor
+ /* General-purpose buttons.
+ * Users can assign functions via keymap editor. */
NDOF_BUTTON_1,
NDOF_BUTTON_2,
NDOF_BUTTON_3,
@@ -92,11 +92,11 @@ typedef enum {
NDOF_BUTTON_8,
NDOF_BUTTON_9,
NDOF_BUTTON_10,
- // more general-purpose buttons
+ /* More general-purpose buttons. */
NDOF_BUTTON_A,
NDOF_BUTTON_B,
NDOF_BUTTON_C,
- // the end
+ /* The end. */
NDOF_BUTTON_LAST
} NDOF_ButtonT;
@@ -107,40 +107,53 @@ class GHOST_NDOFManager {
{
}
- // whether multi-axis functionality is available (via the OS or driver)
- // does not imply that a device is plugged in or being used
+ /**
+ * Whether multi-axis functionality is available (via the OS or driver)
+ * does not imply that a device is plugged in or being used.
+ */
virtual bool available() = 0;
- // each platform's device detection should call this
- // use standard USB/HID identifiers
+ /**
+ * Each platform's device detection should call this
+ * use standard USB/HID identifiers.
+ */
bool setDevice(unsigned short vendor_id, unsigned short product_id);
- // filter out small/accidental/uncalibrated motions by
- // setting up a "dead zone" around home position
- // set to 0 to disable
- // 0.1 is a safe and reasonable value
+ /**
+ * Filter out small/accidental/un-calibrated motions by
+ * setting up a "dead zone" around home position
+ * set to 0 to disable
+ * 0.1 is a safe and reasonable value.
+ */
void setDeadZone(float);
- // the latest raw axis data from the device
- // NOTE: axis data should be in blender view coordinates
- // +X is to the right
- // +Y is up
- // +Z is out of the screen
- // for rotations, look from origin to each +axis
- // rotations are + when CCW, - when CW
- // each platform is responsible for getting axis data into this form
- // these values should not be scaled (just shuffled or flipped)
+ /**
+ * The latest raw axis data from the device.
+ *
+ * \note axis data should be in blender view coordinates
+ * - +X is to the right.
+ * - +Y is up.
+ * - +Z is out of the screen.
+ * - for rotations, look from origin to each +axis.
+ * - rotations are + when CCW, - when CW.
+ * Each platform is responsible for getting axis data into this form
+ * these values should not be scaled (just shuffled or flipped).
+ */
void updateTranslation(const int t[3], uint64_t time);
void updateRotation(const int r[3], uint64_t time);
- // the latest raw button data from the device
- // use HID button encoding (not NDOF_ButtonT)
+ /**
+ * The latest raw button data from the device
+ * use HID button encoding (not #NDOF_ButtonT).
+ */
void updateButton(int button_number, bool press, uint64_t time);
void updateButtons(int button_bits, uint64_t time);
- // NDOFButton events are sent immediately
+ /* #NDOFButton events are sent immediately */
- // processes and sends most recent raw data as an NDOFMotion event
- // returns whether an event was sent
+ /**
+ * Processes and sends most recent raw data as an #NDOFMotion event
+ * returns whether an event was sent.
+ */
bool sendMotionEvent();
protected:
@@ -157,12 +170,12 @@ class GHOST_NDOFManager {
int m_translation[3];
int m_rotation[3];
- int m_buttons; // bit field
+ int m_buttons; /* Bit field. */
- uint64_t m_motionTime; // in milliseconds
- uint64_t m_prevMotionTime; // time of most recent Motion event sent
+ uint64_t m_motionTime; /* In milliseconds. */
+ uint64_t m_prevMotionTime; /* Time of most recent motion event sent. */
GHOST_TProgress m_motionState;
bool m_motionEventPending;
- float m_deadZone; // discard motion with each component < this
+ float m_deadZone; /* Discard motion with each component < this. */
};
diff --git a/intern/ghost/intern/GHOST_Rect.cpp b/intern/ghost/intern/GHOST_Rect.cpp
index 8ef9486f35a..78c88cb0a71 100644
--- a/intern/ghost/intern/GHOST_Rect.cpp
+++ b/intern/ghost/intern/GHOST_Rect.cpp
@@ -26,14 +26,14 @@
void GHOST_Rect::inset(int32_t i)
{
if (i > 0) {
- // Grow the rectangle
+ /* Grow the rectangle. */
m_l -= i;
m_r += i;
m_t -= i;
m_b += i;
}
else if (i < 0) {
- // Shrink the rectangle, check for insets larger than half the size
+ /* Shrink the rectangle, check for insets larger than half the size. */
int32_t i2 = i * 2;
if (getWidth() > i2) {
m_l += i;
@@ -62,12 +62,12 @@ GHOST_TVisibility GHOST_Rect::getVisibility(GHOST_Rect &r) const
bool rb = isInside(r.m_r, r.m_b);
GHOST_TVisibility v;
if (lt && rt && lb && rb) {
- // All points inside, rectangle is inside this
+ /* All points inside, rectangle is inside this. */
v = GHOST_kFullyVisible;
}
else if (!(lt || rt || lb || rb)) {
- // None of the points inside
- // Check to see whether the rectangle is larger than this one
+ /* None of the points inside.
+ * Check to see whether the rectangle is larger than this one. */
if ((r.m_l < m_l) && (r.m_t < m_t) && (r.m_r > m_r) && (r.m_b > m_b)) {
v = GHOST_kPartiallyVisible;
}
@@ -76,7 +76,7 @@ GHOST_TVisibility GHOST_Rect::getVisibility(GHOST_Rect &r) const
}
}
else {
- // Some of the points inside, rectangle is partially inside
+ /* Some of the points inside, rectangle is partially inside. */
v = GHOST_kPartiallyVisible;
}
return v;
diff --git a/intern/ghost/intern/GHOST_System.cpp b/intern/ghost/intern/GHOST_System.cpp
index f6659cf50dc..d09c167cb95 100644
--- a/intern/ghost/intern/GHOST_System.cpp
+++ b/intern/ghost/intern/GHOST_System.cpp
@@ -72,7 +72,7 @@ GHOST_ITimerTask *GHOST_System::installTimer(uint64_t delay,
GHOST_TimerTask *timer = new GHOST_TimerTask(millis + delay, interval, timerProc, userData);
if (timer) {
if (m_timerManager->addTimer(timer) == GHOST_kSuccess) {
- // Check to see whether we need to fire the timer right away
+ /* Check to see whether we need to fire the timer right away. */
m_timerManager->fireTimers(millis);
}
else {
@@ -208,7 +208,7 @@ bool GHOST_System::getFullScreen(void)
void GHOST_System::dispatchEvents()
{
#ifdef WITH_INPUT_NDOF
- // NDOF Motion event is sent only once per dispatch, so do it now:
+ /* NDOF Motion event is sent only once per dispatch, so do it now: */
if (m_ndofManager) {
m_ndofManager->sendMotionEvent();
}
@@ -260,10 +260,10 @@ GHOST_TSuccess GHOST_System::pushEvent(GHOST_IEvent *event)
GHOST_TSuccess GHOST_System::getModifierKeyState(GHOST_TModifierKeyMask mask, bool &isDown) const
{
GHOST_ModifierKeys keys;
- // Get the state of all modifier keys
+ /* Get the state of all modifier keys. */
GHOST_TSuccess success = getModifierKeys(keys);
if (success) {
- // Isolate the state of the key requested
+ /* Isolate the state of the key requested. */
isDown = keys.get(mask);
}
return success;
@@ -272,10 +272,10 @@ GHOST_TSuccess GHOST_System::getModifierKeyState(GHOST_TModifierKeyMask mask, bo
GHOST_TSuccess GHOST_System::getButtonState(GHOST_TButtonMask mask, bool &isDown) const
{
GHOST_Buttons buttons;
- // Get the state of all mouse buttons
+ /* Get the state of all mouse buttons. */
GHOST_TSuccess success = getButtons(buttons);
if (success) {
- // Isolate the state of the mouse button requested
+ /* Isolate the state of the mouse button requested. */
isDown = buttons.get(mask);
}
return success;
@@ -311,7 +311,7 @@ GHOST_TSuccess GHOST_System::init()
m_eventPrinter = new GHOST_EventPrinter();
m_eventManager->addConsumer(m_eventPrinter);
}
-#endif // WITH_GHOST_DEBUG
+#endif /* WITH_GHOST_DEBUG */
if (m_timerManager && m_windowManager && m_eventManager) {
return GHOST_kSuccess;
@@ -359,7 +359,7 @@ GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window **window,
if (alphaBackground)
glSettings.flags |= GHOST_glAlphaBackground;
- /* note: don't use getCurrentDisplaySetting() because on X11 we may
+ /* NOTE: don't use #getCurrentDisplaySetting() because on X11 we may
* be zoomed in and the desktop may be bigger than the viewport. */
GHOST_ASSERT(m_displayManager,
"GHOST_System::createFullScreenWindow(): invalid display manager");
diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h
index 9164687c5b5..16c34ff1a6d 100644
--- a/intern/ghost/intern/GHOST_System.h
+++ b/intern/ghost/intern/GHOST_System.h
@@ -113,8 +113,8 @@ class GHOST_System : public GHOST_ISystem {
GHOST_TSuccess disposeWindow(GHOST_IWindow *window);
/**
- * Create a new offscreen context.
- * Never explicitly delete the context, use disposeContext() instead.
+ * Create a new off-screen context.
+ * Never explicitly delete the context, use #disposeContext() instead.
* \return The new context (or 0 if creation failed).
*/
virtual GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings) = 0;
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.h b/intern/ghost/intern/GHOST_SystemCocoa.h
index 48a64b155fc..5950da6813d 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.h
+++ b/intern/ghost/intern/GHOST_SystemCocoa.h
@@ -112,8 +112,8 @@ class GHOST_SystemCocoa : public GHOST_System {
const GHOST_IWindow *parentWindow = NULL);
/**
- * Create a new offscreen context.
- * Never explicitly delete the context, use disposeContext() instead.
+ * Create a new off-screen context.
+ * Never explicitly delete the context, use #disposeContext() instead.
* \return The new context (or 0 if creation failed).
*/
GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings);
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 0f10d5815f4..2b4c3237c73 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -761,7 +761,7 @@ GHOST_IWindow *GHOST_SystemCocoa::createWindow(const char *title,
}
/**
- * Create a new offscreen context.
+ * Create a new off-screen context.
* Never explicitly delete the context, use #disposeContext() instead.
* \return The new context (or 0 if creation failed).
*/
@@ -1587,7 +1587,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
{
NSTimeInterval timestamp = [event timestamp];
if (timestamp < m_last_warp_timestamp) {
- /* After warping we can still receive older unwarped mouse events,
+ /* After warping we can still receive older unwrapped mouse events,
* ignore those. */
break;
}
diff --git a/intern/ghost/intern/GHOST_SystemSDL.cpp b/intern/ghost/intern/GHOST_SystemSDL.cpp
index f2f1b26b8e5..0309a4f9c52 100644
--- a/intern/ghost/intern/GHOST_SystemSDL.cpp
+++ b/intern/ghost/intern/GHOST_SystemSDL.cpp
@@ -143,7 +143,7 @@ GHOST_IContext *GHOST_SystemSDL::createOffscreenContext(GHOST_GLSettings glSetti
{
GHOST_Context *context = new GHOST_ContextSDL(0,
NULL,
- 0, // profile bit
+ 0, /* Profile bit. */
3,
3,
GHOST_OPENGL_SDL_CONTEXT_FLAGS,
@@ -279,7 +279,7 @@ static GHOST_TKey convertSDLKey(SDL_Scancode key)
GXMAP(type, SDL_SCANCODE_AUDIOPLAY, GHOST_kKeyMediaPlay);
GXMAP(type, SDL_SCANCODE_AUDIOSTOP, GHOST_kKeyMediaStop);
GXMAP(type, SDL_SCANCODE_AUDIOPREV, GHOST_kKeyMediaFirst);
- // GXMAP(type,XF86XK_AudioRewind, GHOST_kKeyMediaFirst);
+ // GXMAP(type, XF86XK_AudioRewind, GHOST_kKeyMediaFirst);
GXMAP(type, SDL_SCANCODE_AUDIONEXT, GHOST_kKeyMediaLast);
default:
@@ -315,7 +315,10 @@ 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.
+ /* Can be NULL on close window. */
+#if 0
+ assert(window != NULL);
+#endif
switch (sdl_sub_evt.event) {
case SDL_WINDOWEVENT_EXPOSED:
@@ -376,14 +379,14 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
bounds.wrapPoint(x_new, y_new, 8, window->getCursorGrabAxis());
window->getCursorGrabAccum(x_accum, y_accum);
- // can't use setCursorPosition because the mouse may have no focus!
+ /* Can't use #setCursorPosition because the mouse may have no focus! */
if (x_new != x_root || y_new != y_root) {
- if (1) { //xme.time > m_last_warp) {
+ if (1 /* `xme.time > m_last_warp` */ ) {
/* when wrapping we don't need to add an event because the
- * setCursorPosition call will cause a new event after */
+ * #setCursorPosition call will cause a new event after */
SDL_WarpMouseInWindow(sdl_win, x_new - x_win, y_new - y_win); /* wrap */
window->setCursorGrabAccum(x_accum + (x_root - x_new), y_accum + (y_root - y_new));
- // m_last_warp= lastEventTime(xme.time);
+ // m_last_warp = lastEventTime(xme.time);
}
else {
// setCursorPosition(x_new, y_new); /* wrap but don't accumulate */
@@ -659,8 +662,8 @@ bool GHOST_SystemSDL::generateWindowExposeEvents()
bool GHOST_SystemSDL::processEvents(bool waitForEvent)
{
- // Get all the current events -- translate them into
- // ghost events and call base class pushEvent() method.
+ /* Get all the current events - translate them into
+ * ghost events and call base class #pushEvent() method. */
bool anyProcessed = false;
@@ -679,7 +682,7 @@ bool GHOST_SystemSDL::processEvents(bool waitForEvent)
if (maxSleep >= 0) {
SDL_WaitEventTimeout(NULL, next - getMilliSeconds());
- // SleepTillEvent(m_display, next - getMilliSeconds()); // X11
+ // SleepTillEvent(m_display, next - getMilliSeconds()); /* X11. */
}
}
}
@@ -707,10 +710,10 @@ GHOST_WindowSDL *GHOST_SystemSDL::findGhostWindow(SDL_Window *sdl_win)
if (sdl_win == NULL)
return NULL;
- // It is not entirely safe to do this as the backptr may point
- // to a window that has recently been removed.
- // We should always check the window manager's list of windows
- // and only process events on these windows.
+ /* It is not entirely safe to do this as the backptr may point
+ * to a window that has recently been removed.
+ * We should always check the window manager's list of windows
+ * and only process events on these windows. */
const std::vector<GHOST_IWindow *> &win_vec = m_windowManager->getWindows();
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 4f5e957077d..60fd175dbf7 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -259,7 +259,7 @@ GHOST_IWindow *GHOST_SystemWin32::createWindow(const char *title,
}
/**
- * Create a new offscreen context.
+ * Create a new off-screen context.
* Never explicitly delete the window, use #disposeContext() instead.
* \return The new context (or 0 if creation failed).
*/
@@ -363,7 +363,7 @@ GHOST_TSuccess GHOST_SystemWin32::disposeContext(GHOST_IContext *context)
}
/**
- * Create a new offscreen DirectX 11 context.
+ * Create a new off-screen DirectX 11 context.
* Never explicitly delete the window, use #disposeContext() instead.
* \return The new context (or 0 if creation failed).
*/
@@ -1219,6 +1219,12 @@ GHOST_EventKey *GHOST_SystemWin32::processKeyEvent(GHOST_WindowWin32 *window, RA
ascii = utf8_char[0] & 0x80 ? '?' : utf8_char[0];
}
+#ifdef WITH_INPUT_IME
+ if (window->getImeInput()->IsImeKeyEvent(ascii)) {
+ return NULL;
+ }
+#endif /* WITH_INPUT_IME */
+
event = new GHOST_EventKey(system->getMilliSeconds(),
keyDown ? GHOST_kEventKeyDown : GHOST_kEventKeyUp,
window,
@@ -1419,6 +1425,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
system->handleKeyboardChange();
#ifdef WITH_INPUT_IME
window->getImeInput()->SetInputLanguage();
+ window->getImeInput()->UpdateConversionStatus(hwnd);
#endif
break;
}
@@ -1455,6 +1462,13 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
////////////////////////////////////////////////////////////////////////
// IME events, processed, read more in GHOST_IME.h
////////////////////////////////////////////////////////////////////////
+ case WM_IME_NOTIFY: {
+ /* Update conversion status when IME is changed or input mode is changed. */
+ if (wParam == IMN_SETOPENSTATUS || wParam == IMN_SETCONVERSIONMODE) {
+ window->getImeInput()->UpdateConversionStatus(hwnd);
+ }
+ break;
+ }
case WM_IME_SETCONTEXT: {
GHOST_ImeWin32 *ime = window->getImeInput();
ime->SetInputLanguage();
@@ -1466,8 +1480,6 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
case WM_IME_STARTCOMPOSITION: {
GHOST_ImeWin32 *ime = window->getImeInput();
eventHandled = true;
- /* remove input event before start comp event, avoid redundant input */
- eventManager->removeTypeEvents(GHOST_kEventKeyDown, window);
ime->CreateImeWindow(hwnd);
ime->ResetComposition(hwnd);
event = processImeEvent(GHOST_kEventImeCompositionStart, window, &ime->eventImeData);
@@ -2111,10 +2123,9 @@ GHOST_TSuccess GHOST_SystemWin32::showMessageBox(const char *title,
config.cbSize = sizeof(config);
config.hInstance = 0;
config.dwCommonButtons = 0;
- config.pszMainIcon = (dialog_options & GHOST_DialogError ?
- TD_ERROR_ICON :
- dialog_options & GHOST_DialogWarning ? TD_WARNING_ICON :
- TD_INFORMATION_ICON);
+ config.pszMainIcon = (dialog_options & GHOST_DialogError ? TD_ERROR_ICON :
+ dialog_options & GHOST_DialogWarning ? TD_WARNING_ICON :
+ TD_INFORMATION_ICON);
config.pszWindowTitle = L"Blender";
config.pszMainInstruction = title_16;
config.pszContent = message_16;
diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h
index 6c786aedfb1..4794982dc65 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.h
+++ b/intern/ghost/intern/GHOST_SystemWin32.h
@@ -138,8 +138,8 @@ class GHOST_SystemWin32 : public GHOST_System {
const GHOST_IWindow *parentWindow = 0);
/**
- * Create a new offscreen context.
- * Never explicitly delete the window, use disposeContext() instead.
+ * Create a new off-screen context.
+ * Never explicitly delete the window, use #disposeContext() instead.
* \return The new context (or 0 if creation failed).
*/
GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings);
@@ -152,8 +152,8 @@ class GHOST_SystemWin32 : public GHOST_System {
GHOST_TSuccess disposeContext(GHOST_IContext *context);
/**
- * Create a new offscreen DirectX context.
- * Never explicitly delete the context, use disposeContext() instead.
+ * Create a new off-screen DirectX context.
+ * Never explicitly delete the context, use #disposeContext() instead.
* This is for GHOST internal, Win32 specific use, so it can be called statically.
*
* \return The new context (or 0 if creation failed).
@@ -360,8 +360,8 @@ class GHOST_SystemWin32 : public GHOST_System {
static GHOST_EventKey *processKeyEvent(GHOST_WindowWin32 *window, RAWINPUT const &raw);
/**
- * Process special keys (VK_OEM_*), to see if current key layout
- * gives us anything special, like ! on french AZERTY.
+ * Process special keys `VK_OEM_*`, to see if current key layout
+ * gives us anything special, like `!` on French AZERTY.
* \param vKey: The virtual key from #hardKey.
* \param scanCode: The ScanCode of pressed key (similar to PS/2 Set 1).
*/
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 172fcbeb3de..9fcad8aabf7 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -390,21 +390,21 @@ GHOST_IWindow *GHOST_SystemX11::createWindow(const char *title,
}
/**
- * Create a new offscreen context.
- * Never explicitly delete the context, use disposeContext() instead.
+ * Create a new off-screen context.
+ * Never explicitly delete the context, use #disposeContext() instead.
* \return The new context (or 0 if creation failed).
*/
GHOST_IContext *GHOST_SystemX11::createOffscreenContext(GHOST_GLSettings glSettings)
{
- // During development:
- // try 4.x compatibility profile
- // try 3.3 compatibility profile
- // fall back to 3.0 if needed
- //
- // Final Blender 2.8:
- // try 4.x core profile
- // try 3.3 core profile
- // no fallbacks
+ /* During development:
+ * try 4.x compatibility profile
+ * try 3.3 compatibility profile
+ * fall back to 3.0 if needed
+ *
+ * Final Blender 2.8:
+ * try 4.x core profile
+ * try 3.3 core profile
+ * no fall-backs. */
const bool debug_context = (glSettings.flags & GHOST_glDebugContext) != 0;
@@ -1189,9 +1189,9 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
else {
printf("Bad keycode lookup. Keysym 0x%x Status: %s\n",
(unsigned int)key_sym,
- (status == XLookupNone ?
- "XLookupNone" :
- status == XLookupKeySym ? "XLookupKeySym" : "Unknown status"));
+ (status == XLookupNone ? "XLookupNone" :
+ status == XLookupKeySym ? "XLookupKeySym" :
+ "Unknown status"));
printf("'%.*s' %p %p\n", len, utf8_buf, xic, m_xim);
}
@@ -2014,7 +2014,7 @@ void GHOST_SystemX11::getClipboard_xcout(const XEvent *evt,
return;
}
- // not using INCR mechanism, just read the property
+ /* Not using INCR mechanism, just read the property. */
XGetWindowProperty(m_display,
win,
m_atom.XCLIP_OUT,
diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h
index 15ccde4a14b..d4803f88fbb 100644
--- a/intern/ghost/intern/GHOST_SystemX11.h
+++ b/intern/ghost/intern/GHOST_SystemX11.h
@@ -148,8 +148,8 @@ class GHOST_SystemX11 : public GHOST_System {
const GHOST_IWindow *parentWindow = 0);
/**
- * Create a new offscreen context.
- * Never explicitly delete the context, use disposeContext() instead.
+ * Create a new off-screen context.
+ * Never explicitly delete the context, use #disposeContext() instead.
* \return The new context (or 0 if creation failed).
*/
GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings);
diff --git a/intern/ghost/intern/GHOST_TimerManager.cpp b/intern/ghost/intern/GHOST_TimerManager.cpp
index 195135f5f85..0c88150381f 100644
--- a/intern/ghost/intern/GHOST_TimerManager.cpp
+++ b/intern/ghost/intern/GHOST_TimerManager.cpp
@@ -55,7 +55,7 @@ GHOST_TSuccess GHOST_TimerManager::addTimer(GHOST_TimerTask *timer)
{
GHOST_TSuccess success;
if (!getTimerFound(timer)) {
- // Add the timer task
+ /* Add the timer task. */
m_timers.push_back(timer);
success = GHOST_kSuccess;
}
@@ -70,7 +70,7 @@ GHOST_TSuccess GHOST_TimerManager::removeTimer(GHOST_TimerTask *timer)
GHOST_TSuccess success;
TTimerVector::iterator iter = std::find(m_timers.begin(), m_timers.end(), timer);
if (iter != m_timers.end()) {
- // Remove the timer task
+ /* Remove the timer task. */
m_timers.erase(iter);
delete timer;
success = GHOST_kSuccess;
@@ -113,14 +113,14 @@ bool GHOST_TimerManager::fireTimer(uint64_t time, GHOST_TimerTask *task)
{
uint64_t next = task->getNext();
- // Check if the timer should be fired
+ /* Check if the timer should be fired. */
if (time > next) {
- // Fire the timer
+ /* Fire the timer. */
GHOST_TimerProcPtr timerProc = task->getTimerProc();
uint64_t start = task->getStart();
timerProc(task, time - start);
- // Update the time at which we will fire it again
+ /* Update the time at which we will fire it again. */
uint64_t interval = task->getInterval();
uint64_t numCalls = (next - start) / interval;
numCalls++;
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.h b/intern/ghost/intern/GHOST_WindowCocoa.h
index 0fd70514ac6..68ac507f0e0 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.h
+++ b/intern/ghost/intern/GHOST_WindowCocoa.h
@@ -157,7 +157,7 @@ class GHOST_WindowCocoa : public GHOST_Window {
void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const;
/**
- * Converts a point in screen coordinates to client rectangle coordinates
+ * Converts a point in client rectangle coordinates to screen coordinates.
* \param inX: The x-coordinate in the client rectangle.
* \param inY: The y-coordinate in the client rectangle.
* \param outX: The x-coordinate on the screen.
@@ -166,7 +166,7 @@ class GHOST_WindowCocoa : public GHOST_Window {
void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const;
/**
- * Converts a point in screen coordinates to client rectangle coordinates
+ * Converts a point in client rectangle coordinates to screen coordinates.
* but without the y coordinate conversion needed for ghost compatibility.
* \param inX: The x-coordinate in the client rectangle.
* \param inY: The y-coordinate in the client rectangle.
@@ -178,10 +178,10 @@ class GHOST_WindowCocoa : public GHOST_Window {
/**
* Converts a point in screen coordinates to client rectangle coordinates,
* but without the y coordinate conversion needed for ghost compatibility.
- * \param inX: The x-coordinate in the client rectangle.
- * \param inY: The y-coordinate in the client rectangle.
- * \param outX: The x-coordinate on the screen.
- * \param outY: The y-coordinate on the screen.
+ * \param inX: The x-coordinate on the screen.
+ * \param inY: The y-coordinate on the screen.
+ * \param outX: The x-coordinate in the client rectangle.
+ * \param outY: The y-coordinate in the client rectangle.
*/
void screenToClientIntern(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const;
diff --git a/intern/ghost/intern/GHOST_WindowManager.cpp b/intern/ghost/intern/GHOST_WindowManager.cpp
index eec4bc5f7d0..4cb80884209 100644
--- a/intern/ghost/intern/GHOST_WindowManager.cpp
+++ b/intern/ghost/intern/GHOST_WindowManager.cpp
@@ -45,7 +45,7 @@ GHOST_TSuccess GHOST_WindowManager::addWindow(GHOST_IWindow *window)
GHOST_TSuccess success = GHOST_kFailure;
if (window) {
if (!getWindowFound(window)) {
- // Store the pointer to the window
+ /* Store the pointer to the window. */
m_windows.push_back(window);
success = GHOST_kSuccess;
}
diff --git a/intern/ghost/intern/GHOST_WindowWayland.cpp b/intern/ghost/intern/GHOST_WindowWayland.cpp
index d0c8cfb9e73..71062a4b6d6 100644
--- a/intern/ghost/intern/GHOST_WindowWayland.cpp
+++ b/intern/ghost/intern/GHOST_WindowWayland.cpp
@@ -34,7 +34,7 @@ static constexpr size_t base_dpi = 96;
struct window_t {
GHOST_WindowWayland *w;
wl_surface *surface;
- // outputs on which the window is currently shown on
+ /* Outputs on which the window is currently shown on. */
std::unordered_set<const output_t *> outputs;
uint16_t dpi = 0;
int scale = 1;
@@ -154,8 +154,8 @@ static bool update_scale(GHOST_WindowWayland *window)
if (scale > 0 && window->scale() != scale) {
window->scale() = scale;
- // using the real DPI will cause wrong scaling of the UI
- // use a multiplier for the default DPI as workaround
+ /* Using the real DPI will cause wrong scaling of the UI
+ * use a multiplier for the default DPI as workaround. */
window->dpi() = scale * base_dpi;
wl_surface_set_buffer_scale(window->surface(), scale);
return true;
diff --git a/intern/ghost/intern/GHOST_WindowWayland.h b/intern/ghost/intern/GHOST_WindowWayland.h
index 6ffcf99b48c..afbdf1268ee 100644
--- a/intern/ghost/intern/GHOST_WindowWayland.h
+++ b/intern/ghost/intern/GHOST_WindowWayland.h
@@ -29,9 +29,9 @@
class GHOST_SystemWayland;
+struct output_t;
struct window_t;
struct wl_surface;
-struct output_t;
class GHOST_WindowWayland : public GHOST_Window {
public:
diff --git a/intern/ghost/intern/GHOST_WindowWin32.h b/intern/ghost/intern/GHOST_WindowWin32.h
index 40a658bf88b..ed5292f1712 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.h
+++ b/intern/ghost/intern/GHOST_WindowWin32.h
@@ -183,7 +183,7 @@ class GHOST_WindowWin32 : public GHOST_Window {
void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const;
/**
- * Converts a point in screen coordinates to client rectangle coordinates
+ * Converts a point in client rectangle coordinates to screen coordinates.
* \param inX: The x-coordinate in the client rectangle.
* \param inY: The y-coordinate in the client rectangle.
* \param outX: The x-coordinate on the screen.
diff --git a/intern/ghost/intern/GHOST_XrSession.cpp b/intern/ghost/intern/GHOST_XrSession.cpp
index 35280e77e22..919d11d22a9 100644
--- a/intern/ghost/intern/GHOST_XrSession.cpp
+++ b/intern/ghost/intern/GHOST_XrSession.cpp
@@ -120,7 +120,7 @@ static void create_reference_spaces(OpenXRSessionData &oxr, const GHOST_XrPose &
XrReferenceSpaceCreateInfo create_info = {XR_TYPE_REFERENCE_SPACE_CREATE_INFO};
create_info.poseInReferenceSpace.orientation.w = 1.0f;
- create_info.referenceSpaceType = XR_REFERENCE_SPACE_TYPE_LOCAL;
+ create_info.referenceSpaceType = XR_REFERENCE_SPACE_TYPE_STAGE;
#if 0
/* TODO
*
@@ -144,8 +144,47 @@ static void create_reference_spaces(OpenXRSessionData &oxr, const GHOST_XrPose &
(void)base_pose;
#endif
- CHECK_XR(xrCreateReferenceSpace(oxr.session, &create_info, &oxr.reference_space),
- "Failed to create reference space.");
+ XrResult result = xrCreateReferenceSpace(oxr.session, &create_info, &oxr.reference_space);
+
+ if (XR_FAILED(result)) {
+ /* One of the rare cases where we don't want to immediately throw an exception on failure,
+ * since run-times are not required to support the stage reference space. Although we need the
+ * stage reference space for absolute tracking, if the runtime doesn't support it then just
+ * fallback to the local space. */
+ if (result == XR_ERROR_REFERENCE_SPACE_UNSUPPORTED) {
+ printf(
+ "Warning: XR runtime does not support stage reference space, disabling absolute "
+ "tracking.\n");
+
+ create_info.referenceSpaceType = XR_REFERENCE_SPACE_TYPE_LOCAL;
+ CHECK_XR(xrCreateReferenceSpace(oxr.session, &create_info, &oxr.reference_space),
+ "Failed to create local reference space.");
+ }
+ else {
+ throw GHOST_XrException("Failed to create stage reference space.", result);
+ }
+ }
+ else {
+ /* Check if tracking bounds are valid. Tracking bounds may be invalid if the user did not
+ * define a tracking space via the XR runtime. */
+ XrExtent2Df extents;
+ CHECK_XR(xrGetReferenceSpaceBoundsRect(oxr.session, XR_REFERENCE_SPACE_TYPE_STAGE, &extents),
+ "Failed to get stage reference space bounds.");
+ if (extents.width == 0.0f || extents.height == 0.0f) {
+ printf(
+ "Warning: Invalid stage reference space bounds, disabling absolute tracking. To enable "
+ "absolute tracking, please define a tracking space via the XR runtime.\n");
+
+ /* Fallback to local space. */
+ if (oxr.reference_space != XR_NULL_HANDLE) {
+ CHECK_XR(xrDestroySpace(oxr.reference_space), "Failed to destroy stage reference space.");
+ }
+
+ create_info.referenceSpaceType = XR_REFERENCE_SPACE_TYPE_LOCAL;
+ CHECK_XR(xrCreateReferenceSpace(oxr.session, &create_info, &oxr.reference_space),
+ "Failed to create local reference space.");
+ }
+ }
create_info.referenceSpaceType = XR_REFERENCE_SPACE_TYPE_VIEW;
CHECK_XR(xrCreateReferenceSpace(oxr.session, &create_info, &oxr.view_space),
@@ -370,6 +409,7 @@ void GHOST_XrSession::drawView(GHOST_XrSwapchain &swapchain,
XrCompositionLayerProjectionView &r_proj_layer_view,
XrSpaceLocation &view_location,
XrView &view,
+ uint32_t view_idx,
void *draw_customdata)
{
XrSwapchainImageBaseHeader *swapchain_image = swapchain.acquireDrawableSwapchainImage();
@@ -380,6 +420,8 @@ void GHOST_XrSession::drawView(GHOST_XrSwapchain &swapchain,
r_proj_layer_view.fov = view.fov;
swapchain.updateCompositionLayerProjectViewSubImage(r_proj_layer_view.subImage);
+ assert(view_idx < 256);
+ draw_view_info.view_idx = (char)view_idx;
draw_view_info.expects_srgb_buffer = swapchain.isBufferSRGB();
draw_view_info.ofsx = r_proj_layer_view.subImage.imageRect.offset.x;
draw_view_info.ofsy = r_proj_layer_view.subImage.imageRect.offset.y;
@@ -429,6 +471,7 @@ XrCompositionLayerProjection GHOST_XrSession::drawLayer(
r_proj_layer_views[view_idx],
view_location,
m_oxr->views[view_idx],
+ view_idx,
draw_customdata);
}
diff --git a/intern/ghost/intern/GHOST_XrSession.h b/intern/ghost/intern/GHOST_XrSession.h
index c871b98da46..d448585d14c 100644
--- a/intern/ghost/intern/GHOST_XrSession.h
+++ b/intern/ghost/intern/GHOST_XrSession.h
@@ -117,6 +117,7 @@ class GHOST_XrSession {
XrCompositionLayerProjectionView &r_proj_layer_view,
XrSpaceLocation &view_location,
XrView &view,
+ uint32_t view_idx,
void *draw_customdata);
void beginFrameDrawing();
void endFrameDrawing(std::vector<XrCompositionLayerBaseHeader *> &layers);
diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c
index 673821546e8..261a23a1196 100644
--- a/intern/guardedalloc/intern/mallocn.c
+++ b/intern/guardedalloc/intern/mallocn.c
@@ -67,7 +67,7 @@ const char *(*MEM_name_ptr)(void *vmemh) = MEM_lockfree_name_ptr;
void *aligned_malloc(size_t size, size_t alignment)
{
- /* posix_memalign requires alignment to be a multiple of sizeof(void *). */
+ /* #posix_memalign requires alignment to be a multiple of `sizeof(void *)`. */
assert(alignment >= ALIGNED_MALLOC_MINIMUM_ALIGNMENT);
#ifdef _WIN32
diff --git a/intern/libmv/CMakeLists.txt b/intern/libmv/CMakeLists.txt
index 6fcf664d1f5..91ef1f4d038 100644
--- a/intern/libmv/CMakeLists.txt
+++ b/intern/libmv/CMakeLists.txt
@@ -217,39 +217,39 @@ if(WITH_LIBMV)
if(WITH_GTESTS)
include(GTestTesting)
- blender_add_lib(libmv_test_dataset "./libmv/multiview/test_data_sets.cc" "" "" "")
+ blender_add_lib(libmv_test_dataset "./libmv/multiview/test_data_sets.cc" "${INC}" "${INC_SYS}" "")
- BLENDER_SRC_GTEST("libmv_predict_tracks" "./libmv/autotrack/predict_tracks_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_tracks" "./libmv/autotrack/tracks_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_scoped_ptr" "./libmv/base/scoped_ptr_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_vector" "./libmv/base/vector_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_array_nd" "./libmv/image/array_nd_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_convolve" "./libmv/image/convolve_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_image" "./libmv/image/image_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_sample" "./libmv/image/sample_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_tuple" "./libmv/image/tuple_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_euclidean_resection" "./libmv/multiview/euclidean_resection_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_fundamental" "./libmv/multiview/fundamental_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_homography" "./libmv/multiview/homography_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_nviewtriangulation" "./libmv/multiview/nviewtriangulation_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_panography" "./libmv/multiview/panography_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_projection" "./libmv/multiview/projection_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_resection" "./libmv/multiview/resection_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_triangulation" "./libmv/multiview/triangulation_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_dogleg" "./libmv/numeric/dogleg_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_function_derivative" "./libmv/numeric/function_derivative_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_levenberg_marquardt" "./libmv/numeric/levenberg_marquardt_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_numeric" "./libmv/numeric/numeric_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_poly" "./libmv/numeric/poly_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_camera_intrinsics" "./libmv/simple_pipeline/camera_intrinsics_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_detect" "./libmv/simple_pipeline/detect_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_intersect" "./libmv/simple_pipeline/intersect_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_keyframe_selection" "./libmv/simple_pipeline/keyframe_selection_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_modal_solver" "./libmv/simple_pipeline/modal_solver_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_resect" "./libmv/simple_pipeline/resect_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_brute_region_tracker" "./libmv/tracking/brute_region_tracker_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_klt_region_tracker" "./libmv/tracking/klt_region_tracker_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
- BLENDER_SRC_GTEST("libmv_pyramid_region_tracker" "./libmv/tracking/pyramid_region_tracker_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_predict_tracks" "./libmv/autotrack/predict_tracks_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_tracks" "./libmv/autotrack/tracks_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_scoped_ptr" "./libmv/base/scoped_ptr_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_vector" "./libmv/base/vector_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_array_nd" "./libmv/image/array_nd_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_convolve" "./libmv/image/convolve_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_image" "./libmv/image/image_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_sample" "./libmv/image/sample_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_tuple" "./libmv/image/tuple_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_euclidean_resection" "./libmv/multiview/euclidean_resection_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_fundamental" "./libmv/multiview/fundamental_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_homography" "./libmv/multiview/homography_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_nviewtriangulation" "./libmv/multiview/nviewtriangulation_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_panography" "./libmv/multiview/panography_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_projection" "./libmv/multiview/projection_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_resection" "./libmv/multiview/resection_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_triangulation" "./libmv/multiview/triangulation_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_dogleg" "./libmv/numeric/dogleg_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_function_derivative" "./libmv/numeric/function_derivative_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_levenberg_marquardt" "./libmv/numeric/levenberg_marquardt_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_numeric" "./libmv/numeric/numeric_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_poly" "./libmv/numeric/poly_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_camera_intrinsics" "./libmv/simple_pipeline/camera_intrinsics_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_detect" "./libmv/simple_pipeline/detect_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_intersect" "./libmv/simple_pipeline/intersect_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_keyframe_selection" "./libmv/simple_pipeline/keyframe_selection_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_modal_solver" "./libmv/simple_pipeline/modal_solver_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_resect" "./libmv/simple_pipeline/resect_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_brute_region_tracker" "./libmv/tracking/brute_region_tracker_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_klt_region_tracker" "./libmv/tracking/klt_region_tracker_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
+ blender_add_test_executable("libmv_pyramid_region_tracker" "./libmv/tracking/pyramid_region_tracker_test.cc" "${INC}" "${INC_SYS}" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
endif()
else()
list(APPEND SRC
diff --git a/intern/memutil/MEM_Allocator.h b/intern/memutil/MEM_Allocator.h
index 50a3e978197..1dbb2d5a9f7 100644
--- a/intern/memutil/MEM_Allocator.h
+++ b/intern/memutil/MEM_Allocator.h
@@ -62,8 +62,8 @@ template<typename _Tp> struct MEM_Allocator {
return &__x;
}
- // NB: __n is permitted to be 0. The C++ standard says nothing
- // about what the return value is when __n == 0.
+ /* NOTE: `__n` is permitted to be 0.
+ * The C++ standard says nothing about what the return value is when `__n == 0`. */
_Tp *allocate(size_type __n, const void * = 0)
{
_Tp *__ret = NULL;
diff --git a/intern/memutil/MEM_CacheLimiter.h b/intern/memutil/MEM_CacheLimiter.h
index 6ca61fbcde1..a8706454de8 100644
--- a/intern/memutil/MEM_CacheLimiter.h
+++ b/intern/memutil/MEM_CacheLimiter.h
@@ -299,9 +299,9 @@ template<class T> class MEM_CacheLimiter {
if (!can_destroy_element(elem))
continue;
- /* by default 0 means highest priority element */
- /* casting a size type to int is questionable,
- but unlikely to cause problems */
+ /* By default 0 means highest priority element. */
+ /* Casting a size type to int is questionable,
+ * but unlikely to cause problems. */
int priority = -((int)(queue.size()) - i - 1);
priority = item_priority_func(elem->get()->get_data(), priority);
diff --git a/intern/numaapi/source/build_config.h b/intern/numaapi/source/build_config.h
index fdd6ff704c3..49d82aa3e87 100644
--- a/intern/numaapi/source/build_config.h
+++ b/intern/numaapi/source/build_config.h
@@ -324,6 +324,16 @@
# define ARCH_CPU_ARM64 1
# define ARCH_CPU_64_BITS 1
# define ARCH_CPU_LITTLE_ENDIAN 1
+#elif defined(__riscv) && __riscv_xlen == 32
+# define ARCH_CPU_RISCV_FAMILY 1
+# define ARCH_CPU_RISCV32 1
+# define ARCH_CPU_64_BITS 0
+# define ARCH_CPU_LITTLE_ENDIAN 1
+#elif defined(__riscv) && __riscv_xlen == 64
+# define ARCH_CPU_RISCV_FAMILY 1
+# define ARCH_CPU_RISCV64 1
+# define ARCH_CPU_64_BITS 1
+# define ARCH_CPU_LITTLE_ENDIAN 1
#elif defined(__pnacl__) || defined(__asmjs__) || defined(__wasm__)
# define ARCH_CPU_32_BITS 1
# define ARCH_CPU_LITTLE_ENDIAN 1
@@ -381,6 +391,9 @@
#if !defined(ARCH_CPU_PPC64_FAMILY)
# define ARCH_CPU_PPC64_FAMILY 0
#endif
+#if !defined(ARCH_CPU_RISCV_FAMILY)
+# define ARCH_CPU_RISCV_FAMILY 0
+#endif
#if !defined(ARCH_CPU_S390_FAMILY)
# define ARCH_CPU_S390_FAMILY 0
#endif
diff --git a/intern/opensubdiv/CMakeLists.txt b/intern/opensubdiv/CMakeLists.txt
index 16334a80761..bce8a8baa84 100644
--- a/intern/opensubdiv/CMakeLists.txt
+++ b/intern/opensubdiv/CMakeLists.txt
@@ -129,5 +129,5 @@ if(WITH_GTESTS AND WITH_OPENSUBDIV)
add_definitions(${GLOG_DEFINES})
add_definitions(-DBLENDER_GFLAGS_NAMESPACE=${GFLAGS_NAMESPACE})
- BLENDER_SRC_GTEST(opensubdiv_mesh_topology_test "internal/topology/mesh_topology_test.cc" "${LIB};bf_intern_opensubdiv")
+ blender_add_test_executable(opensubdiv_mesh_topology_test "internal/topology/mesh_topology_test.cc" "${INC}" "${INC_SYS}" "${LIB};bf_intern_opensubdiv")
endif()
diff --git a/intern/openvdb/intern/openvdb_level_set.cc b/intern/openvdb/intern/openvdb_level_set.cc
index ed0020a66ce..5b01c3b0cb7 100644
--- a/intern/openvdb/intern/openvdb_level_set.cc
+++ b/intern/openvdb/intern/openvdb_level_set.cc
@@ -33,20 +33,20 @@ OpenVDBLevelSet::~OpenVDBLevelSet()
}
void OpenVDBLevelSet::mesh_to_level_set(const float *vertices,
- const unsigned int *faces,
- const unsigned int totvertices,
- const unsigned int totfaces,
+ const int *faces,
+ const int totvertices,
+ const int totfaces,
const openvdb::math::Transform::Ptr &xform)
{
std::vector<openvdb::Vec3s> points(totvertices);
std::vector<openvdb::Vec3I> triangles(totfaces);
std::vector<openvdb::Vec4I> quads;
- for (unsigned int i = 0; i < totvertices; i++) {
+ for (int i = 0; i < totvertices; i++) {
points[i] = openvdb::Vec3s(vertices[i * 3], vertices[i * 3 + 1], vertices[i * 3 + 2]);
}
- for (unsigned int i = 0; i < totfaces; i++) {
+ for (int i = 0; i < totfaces; i++) {
triangles[i] = openvdb::Vec3I(faces[i * 3], faces[i * 3 + 1], faces[i * 3 + 2]);
}
@@ -69,14 +69,11 @@ void OpenVDBLevelSet::volume_to_mesh(OpenVDBVolumeToMeshData *mesh,
isovalue,
adaptivity,
relax_disoriented_triangles);
- mesh->vertices = (float *)MEM_malloc_arrayN(
- out_points.size(), 3 * sizeof(float), "openvdb remesher out verts");
- mesh->quads = (unsigned int *)MEM_malloc_arrayN(
- out_quads.size(), 4 * sizeof(unsigned int), "openvdb remesh out quads");
+ mesh->vertices = (float *)MEM_malloc_arrayN(out_points.size(), sizeof(float[3]), __func__);
+ mesh->quads = (int *)MEM_malloc_arrayN(out_quads.size(), sizeof(int[4]), __func__);
mesh->triangles = NULL;
if (out_tris.size() > 0) {
- mesh->triangles = (unsigned int *)MEM_malloc_arrayN(
- out_tris.size(), 3 * sizeof(unsigned int), "openvdb remesh out tris");
+ mesh->triangles = (int *)MEM_malloc_arrayN(out_tris.size(), sizeof(int[3]), __func__);
}
mesh->totvertices = out_points.size();
diff --git a/intern/openvdb/intern/openvdb_level_set.h b/intern/openvdb/intern/openvdb_level_set.h
index 882958513fd..2c8f140c012 100644
--- a/intern/openvdb/intern/openvdb_level_set.h
+++ b/intern/openvdb/intern/openvdb_level_set.h
@@ -39,9 +39,9 @@ struct OpenVDBLevelSet {
void set_grid(const openvdb::FloatGrid::Ptr &grid);
void mesh_to_level_set(const float *vertices,
- const unsigned int *faces,
- const unsigned int totvertices,
- const unsigned int totfaces,
+ const int *faces,
+ const int totvertices,
+ const int totfaces,
const openvdb::math::Transform::Ptr &transform);
void volume_to_mesh(struct OpenVDBVolumeToMeshData *mesh,
diff --git a/intern/openvdb/openvdb_capi.cc b/intern/openvdb/openvdb_capi.cc
index e7a4bf335fc..674b394fa46 100644
--- a/intern/openvdb/openvdb_capi.cc
+++ b/intern/openvdb/openvdb_capi.cc
@@ -63,9 +63,9 @@ void OpenVDBLevelSet_free(OpenVDBLevelSet *level_set)
void OpenVDBLevelSet_mesh_to_level_set(struct OpenVDBLevelSet *level_set,
const float *vertices,
- const unsigned int *faces,
- const unsigned int totvertices,
- const unsigned int totfaces,
+ const int *faces,
+ const int totvertices,
+ const int totfaces,
OpenVDBTransform *xform)
{
level_set->mesh_to_level_set(vertices, faces, totvertices, totfaces, xform->get_transform());
@@ -73,9 +73,9 @@ void OpenVDBLevelSet_mesh_to_level_set(struct OpenVDBLevelSet *level_set,
void OpenVDBLevelSet_mesh_to_level_set_transform(struct OpenVDBLevelSet *level_set,
const float *vertices,
- const unsigned int *faces,
- const unsigned int totvertices,
- const unsigned int totfaces,
+ const int *faces,
+ const int totvertices,
+ const int totfaces,
OpenVDBTransform *transform)
{
level_set->mesh_to_level_set(vertices, faces, totvertices, totfaces, transform->get_transform());
diff --git a/intern/openvdb/openvdb_capi.h b/intern/openvdb/openvdb_capi.h
index 98d89c340bf..9333413c2fe 100644
--- a/intern/openvdb/openvdb_capi.h
+++ b/intern/openvdb/openvdb_capi.h
@@ -67,19 +67,19 @@ struct OpenVDBVolumeToMeshData {
int totvertices;
float *vertices;
- unsigned int *quads;
- unsigned int *triangles;
+ int *quads;
+ int *triangles;
};
struct OpenVDBRemeshData {
float *verts;
- unsigned int *faces;
+ int *faces;
int totfaces;
int totverts;
float *out_verts;
- unsigned int *out_faces;
- unsigned int *out_tris;
+ int *out_faces;
+ int *out_tris;
int out_totverts;
int out_totfaces;
int out_tottris;
@@ -112,15 +112,15 @@ struct OpenVDBLevelSet *OpenVDBLevelSet_create(bool initGrid, struct OpenVDBTran
void OpenVDBLevelSet_free(struct OpenVDBLevelSet *level_set);
void OpenVDBLevelSet_mesh_to_level_set(struct OpenVDBLevelSet *level_set,
const float *vertices,
- const unsigned int *faces,
- const unsigned int totvertices,
- const unsigned int totfaces,
+ const int *faces,
+ const int totvertices,
+ const int totfaces,
struct OpenVDBTransform *xform);
void OpenVDBLevelSet_mesh_to_level_set_transform(struct OpenVDBLevelSet *level_set,
const float *vertices,
- const unsigned int *faces,
- const unsigned int totvertices,
- const unsigned int totfaces,
+ const int *faces,
+ const int totvertices,
+ const int totfaces,
struct OpenVDBTransform *transform);
void OpenVDBLevelSet_volume_to_mesh(struct OpenVDBLevelSet *level_set,
struct OpenVDBVolumeToMeshData *mesh,
diff --git a/intern/quadriflow/quadriflow_capi.cpp b/intern/quadriflow/quadriflow_capi.cpp
index 53237289874..086d5f7d296 100644
--- a/intern/quadriflow/quadriflow_capi.cpp
+++ b/intern/quadriflow/quadriflow_capi.cpp
@@ -20,12 +20,12 @@
#include "MEM_guardedalloc.h"
-#include "quadriflow_capi.hpp"
#include "config.hpp"
#include "field-math.hpp"
+#include "loader.hpp"
#include "optimizer.hpp"
#include "parametrizer.hpp"
-#include "loader.hpp"
+#include "quadriflow_capi.hpp"
using namespace qflow;
@@ -217,10 +217,8 @@ void QFLOW_quadriflow_remesh(QuadriflowRemeshData *qrd,
qrd->out_totverts = field.O_compact.size();
qrd->out_totfaces = field.F_compact.size();
- qrd->out_verts = (float *)MEM_malloc_arrayN(
- qrd->out_totverts, 3 * sizeof(float), "quadriflow remesher out verts");
- qrd->out_faces = (unsigned int *)MEM_malloc_arrayN(
- qrd->out_totfaces, 4 * sizeof(unsigned int), "quadriflow remesh out quads");
+ qrd->out_verts = (float *)MEM_malloc_arrayN(qrd->out_totverts, sizeof(float[3]), __func__);
+ qrd->out_faces = (int *)MEM_malloc_arrayN(qrd->out_totfaces, sizeof(int[4]), __func__);
for (int i = 0; i < qrd->out_totverts; i++) {
auto t = field.O_compact[i] * field.normalize_scale + field.normalize_offset;
diff --git a/intern/quadriflow/quadriflow_capi.hpp b/intern/quadriflow/quadriflow_capi.hpp
index c31fd6eff95..59af2826e15 100644
--- a/intern/quadriflow/quadriflow_capi.hpp
+++ b/intern/quadriflow/quadriflow_capi.hpp
@@ -25,12 +25,12 @@ extern "C" {
typedef struct QuadriflowRemeshData {
float *verts;
- unsigned int *faces;
+ int *faces;
int totfaces;
int totverts;
float *out_verts;
- unsigned int *out_faces;
+ int *out_faces;
int out_totverts;
int out_totfaces;
diff --git a/intern/rigidbody/RBI_api.h b/intern/rigidbody/RBI_api.h
index 2e09f8952cb..f13f321a2c6 100644
--- a/intern/rigidbody/RBI_api.h
+++ b/intern/rigidbody/RBI_api.h
@@ -64,7 +64,7 @@ typedef struct rbConstraint rbConstraint;
/* Setup ---------------------------- */
/* Create a new dynamics world instance */
-// TODO: add args to set the type of constraint solvers, etc.
+/* TODO: add args to set the type of constraint solvers, etc. */
rbDynamicsWorld *RB_dworld_new(const float gravity[3]);
/* Delete the given dynamics world, and free any extra data it may require */