1
1

Compare commits

...

256 Commits

Author SHA1 Message Date
786c8bf5ce Windows: Add support to compile python apid docs from make file 2021-08-05 16:14:47 -04:00
6844f7bedb PyDoc: document how parameter are used for 3D and 2D textures
Improves on rB171433e841379e7efad069bbda9880fb271e2fc4
2021-08-05 13:06:13 -04:00
Eitan
bd44e82b25 Geometry Nodes: Add more warnings for out of bounds parameters
Add warning(info) to nodes that don't work when an input value is
out of range. For example, the grid node doesn't work with Vertices X
or Verices Y less than 2.

These are purposefully added as "Info" warnings, because they don't
show in the modifier and they aren't printed to the terminal.

Differential Revision: https://developer.blender.org/D11923
2021-08-05 10:44:59 -05:00
c15635bd8d BMesh: support laplacian smooth for n-gons
Follow the same logic already used by the modifier.
2021-08-06 01:43:13 +10:00
04c24bec07 Cleanup: replace short with boolean for zero area array
Also remove redundant fabsf on the area of a quad/tri &
reduce indentation using continue in for loop.
2021-08-06 01:42:01 +10:00
ff2265f0a9 Cleanup: comment blocks & spelling 2021-08-06 01:36:43 +10:00
8158211198 Cleanup: quiet array-parameter warning 2021-08-06 01:32:04 +10:00
ca64bd0aac Render: move Cycles visibility, holdout and shadow catcher properties to Blender
The immediate reason for this is that we want to be able to initialize them
to different defaults for light objects, which is hard with Python properties.
But in general it is useful to be able to share these with other renderers.

As a side effect, Eevee now supports a per-object holdout instead of only
per-collection.

Differential Revision: https://developer.blender.org/D12133
2021-08-05 17:22:38 +02:00
6c326ba0a2 Fix T83164: Spline IK joint_bindings parameter is broken.
Code freeing the array would not properly reset its length value to
zero.

Note that this corrupted data could also be saved in .blend files, so
had to bump fileversion and add some doversion code too.

Fix T90166: crash when creating a liboverride.
2021-08-05 17:21:25 +02:00
834523e239 Cleanup/Fix RNA array length accessors returning non-zero values in invalid cases.
This was apparently done in two places only, with a very cryptic comment
(`/* for raw_access, untested */`), and... I cannot see how returning a
non-zero length value for an array that does not exist or is not
accessible at least, would be anything but an obvious source of issues.

Note that both commits adding those lines are from stone ages (2009):
rBcbc2c1886dee and rB50e3bb7f5f34.
2021-08-05 17:21:25 +02:00
27b9cb7a1e GPencil: New Merge Layer keymap: Shift+Ctrl+M
The keymap is available in: Draw, Edit, Sculpt, Weight Paint and Vertex Paint modes.

The keymap is not available in Object mode to avoid any conflict.

Reviewed By: pepeland

Differential Revision: https://developer.blender.org/D12128
2021-08-05 17:12:34 +02:00
03d7561708 Fix build error when WITH_XR_OPENXR not defined 2021-08-06 00:08:56 +09:00
b4f950cbbe GPencil: New Caps icons
These icons are used to define the type of caps.

Designed by: Matias Mendiola
Reviewed by: Pablo Vazquez
2021-08-05 17:07:21 +02:00
Germano Cavalcante
cc4e674e41 DRW: New Select Debug Engine
This is a simple engine used only to debug the texture of select ids.

It is only used when the `WITH_DRAW_DEBUG` option is enabled and the
debug value is 31.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D5490
2021-08-05 11:56:51 -03:00
e844e9e8f3 XR Controller Support Step 2: Action Maps
Addresses the remaining portions of T77137 (Python API for Controller
Interaction), which was partially completed by D10942.

Adds an XR "action maps" system for loading XR action data from a
Python script. Action maps are accessible via the Python API, and are used
to pass default actions to the VR session during the
xr_session_start_pre() callback.

Since action maps are stored only as runtime data, they will be
cleaned up with the rest of the VR runtime data on file read or exit.

Reviewed By: Julian Eisel, Hans Goudey

Differential Revision: https://developer.blender.org/D10943
2021-08-05 23:40:17 +09:00
0cff7c2a22 LibOverride: Make it reasonably impossible for users to create overrides of scenes.
This is not supported currently,doing so through RNA API remains
possible, but from regular UI operations it should not be doable
anymore.

Ref. T90459.
2021-08-05 15:26:08 +02:00
720ea8a67d Fix T89963: crash when library override is applied to an object from a linked scene.
LibOverride of scenes is not really supported currently, there are many
issues with it.

Will disable most user-accessible ways to create such overrides in a
following commit.
2021-08-05 15:26:08 +02:00
be6409a748 Fix fix invalid index use for edit-mesh laplacian smooth
Only vertex indices were ensured to be correct.
2021-08-05 22:39:24 +10:00
fb1822ddeb XR: Controller Data Improvements
Provides two key improvements to runtime controller data.

1. Separates controller poses into two components, "grip" and "aim",
which are both required to accurately represent the controllers
without manual offsets.

Following their OpenXR definitions, the grip pose represents the
user's hand when holding the controller, and the aim pose represents
the controller's aiming source.

2. Runtime controller data is now stored as a dynamic array instead
of a fixed array. This makes the API/functionality more adaptable to
different systems.

Does not bring about any changes for users since only internal
runtime functionality is currently affected.

Reviewed By: Julian Eisel

Differential Revision: http://developer.blender.org/D12073
2021-08-05 21:11:01 +09:00
f45860fba9 Cleanup: Remove unused members in FileSelectParams 2021-08-05 12:52:58 +02:00
ed9759349b Fix T89214: Smooth Vertices (Laplacian) produces NaN coordinates
Vertices with no connected faces would attempt to divide by the combined
face area causing a divide by zero.

Use the same weight for wire vertices as vertices connected
to zero area faces.
2021-08-05 20:49:20 +10:00
02e0c6f42e Fix T90430: Crash when dragging material
Was trying to get asset information even when there was none, i.e. when
the material wasn't an asset or not dragged from the Asset Browser.
2021-08-05 12:14:11 +02:00
317f09ebf9 Fix T90170: RNA_property_pointer_get creating data in non-thread-safe way.
Protect this accessor with a local static mutex when it needs to
create/write data.

Ideally accessors should never create or modify data, but there are some
cases where this bad behavior is currently unavoidable.

This is the case of the Pointer accessor when the actual IDProperty has
not yet been created.

NOTE: this fixes a memory leak in liboverride diffing process when
several different overrides use a same linked reference ID.

Differential Revision: https://developer.blender.org/D12060
2021-08-05 12:12:13 +02:00
03e2f11d48 Fix T89835: Crash after Instancing to Scene after making linked Collection local.
Even though the ID itself remain the same after being made local, from
depsgraph point of view this is a different ID. Hence we need to tag all
of its users for COW update, as well as rebuild depsgraph relationships.

Should be also backported to LTS 2.93 (and 2.83 if possible).
2021-08-05 11:31:49 +02:00
647a8bff06 Fix T90256: faces are flat shaded in edit mode with auto smooth
Regression in 39b2a7bb7e.
2021-08-05 18:21:17 +10:00
f5acfd9c04 Cleanup: remove redundant parenthesis 2021-08-05 16:54:34 +10:00
d8582d966f Fix slicing with negative indices
Negative indices that remained negative after adding the sequence length
caused incorrect slicing.

With the default scene for example:

   bpy.context.scene.objects[-4:2]

Gave a different result to:

   tuple(bpy.context.scene.objects)[-4:2]

Clamp indices above zero so loops that step forward works as intended.
2021-08-05 16:44:03 +10:00
2b51124d6a Fix T89450: Crash slicing BMEditSelSeq
Slicing with indices greater than the length of the sequence would crash.
2021-08-05 16:44:01 +10:00
450593ddf0 Cleanup: Fix Clang braced-scalar-init warning 2021-08-05 11:00:56 +05:30
d3d4be1db3 XR: Action Binding Improvements
Provides several important improvements to the runtime action
bindings operation and internal API.

Moves input-specific action data (input thresholds, input regions,
pose offsets/spaces) from actions to more granular action bindings.
This allows a single action to be mapped to a variety of inputs,
without having to share a single input threshold, region, or space.

Also removes the need for action space creation API, as spaces for
pose actions will be automatically created with the bindings.

The correct action data for the current inputs is set by calling
xrGetCurrentInteractionProfile() to get the current profile and then
retrieving the corresponding mapped data.

Does not bring about any changes for users since only internal
runtime functionality is currently affected.

Reviewed By: Julian Eisel

Differential Revision: http://developer.blender.org/D12077
2021-08-05 13:14:26 +09:00
d1c5e2e050 Cleanup: license headers
These were removed globally in 65ec7ec524.

Some files re-introduced these conventions since.
2021-08-05 12:03:41 +10:00
604ae5f7b6 Cleanup: tab indentation for CMake / GNUmakefile 2021-08-05 12:03:41 +10:00
1def985d78 Windows: Add icons and icons_geom to make.bat
This adds support for building the icons from make.bat
unlike bash there is no passing environment variables
on the command line.

The scripts go out of their way to locate both blender
and inkscape however if they are not found, the user is
given a helpful error message telling them how to set
the variables.

Although some extra help can be given there, if your
normal build is a 2019 full build running

`make 2019 full icons`

will help it find the blender executable as well.

finally if you know the name of your build folder
running

`make builddir build_windows_Lite_x64_vc16_Release icons`

will also work, if all fails you can point directly to
the blender executable by running

`set BLENDER_BIN=c:\where\blender\lives\blender.exe`

before running `make icons` or `make icons_geom`

The python scripts needed some small modifications since
without the PATHEXT, SystemRoot and SystemDrive
environment variables python will not initialize properly
on windows. (Not blender related, even mainline python
won't start without those)
2021-08-04 19:32:24 -06:00
438d645a36 PyDoc: Update GPU Example of draw_view3d
This function was changed in rBc8004ab4078c98c54a70113c12bbb186403e90cf but didnt update the example.

Part of T84227
2021-08-04 20:25:50 -04:00
171433e841 PyDoc: Improve description of texture.evaluate
Inspired by the old 2.49 docs: https://docs.blender.org/api/249PythonDoc/Texture.Texture-class.html#evaluate
2021-08-04 19:26:01 -04:00
d6ca7ab20e Cleanup: make format 2021-08-04 19:24:19 -04:00
07b702f828 Win32 IME: Rename SetInputLanguage()
GHOST_ImeWin32::SetInputLanguage() has a confusing name because it does
not set the input language. It actually retrieves the current input
locale from the OS and caches the value of the current input language
ID. Therefore this patch renames it to "UpdateInputLanguage"

Differential Revision: https://developer.blender.org/D12134

Reviewed by Ray Molenkamp
2021-08-04 14:30:16 -07:00
1d1020b79f Win32 IME: Remove ime_status_
This removes one member of GHOST_ImeWin32 that is not used and cannot
be used in the future. It is holding the result of ImmIsIME, which is
whether an input language supports IME. It does not indicate that one
is in use, turned on, composing, in English mode, etc.

see D12131 for more information.

Differential Revision: https://developer.blender.org/D12131

Reviewed by Ray Molenkamp
2021-08-04 13:20:45 -07:00
49acc52e02 Cycles: make object Fast GI Approximation panel a subpanel of Shading 2021-08-04 20:52:29 +02:00
8abf6efcf6 Cleanup: rename restrict to hide/visibility in Object, Collection, MaskLayer
This makes the internal naming consistent with the public API. And also gives
us a visibility_flag rather than restrictflag that can be extended with more
flags.
2021-08-04 19:18:34 +02:00
Romain Toumi
10b9621079 Fix Cycles material slots list being too short
Bring it in line with Eevee.

Differential Revision: https://developer.blender.org/D11982
2021-08-04 18:43:39 +02:00
ae920d789e VSE: Allow Wingdings and Symbol Fonts
This patch makes us less restrictive on the allowed types of FreeType
font character maps we allow, rather than primarily unicode-only. This
allows us to use some legacy, symbol, specialty, and proprietary fonts
like Wingdings. Note we were a little less restrictive with vfonts,
used for 3D Text Objects, so this patch primarily helps VSE.

See D12124 for details and examples.

Differential Revision: https://developer.blender.org/D12124

Reviewed by Brecht Van Lommel
2021-08-04 09:31:01 -07:00
b5bfb5f34c UI: VFont Display Names
When displaying the names of fonts for 3D Text objects, use the same
format as shown in File Browser: Family name + Style name. They are
currently shown with Postscript Name, which doesn't match well.

see D12069 for more details.

Differential Revision: https://developer.blender.org/D12069

Reviewed by Campbell Barton
2021-08-04 08:34:28 -07:00
c18d91918f Cycles: More flexible GI Approximation AO distance control
The goal: allow to easily use AO approximation in scenes which combines
both small and large scale objects.

The idea: use per-object AO distance which will allow to override world
settings. Instancer object will "propagate" its AO distance to all its
instances unless the instance defines own distance (this allows to
modify AO distance in the shot files, without requiring to modify props
used in the shots.

Available from the new Fats GI Approximation panel in object properties.

Differential Revision: https://developer.blender.org/D12112
2021-08-04 17:26:24 +02:00
58ba75f9e3 LibOverride RNA API: add removal of properties and operations.
This should complete the basics of RNA API for library overrides.

Ref. T86656.
2021-08-04 16:57:08 +02:00
a8185d2d74 LibOverride: Add RNA API to reset/delete overrides.
Ref. T86656.
2021-08-04 16:57:08 +02:00
2af789d1f3 Added some TODO remarks. 2021-08-04 16:05:49 +02:00
c1730ed165 GPencil: New Brush option to define Caps type
This is used to set the default caps type for the stroke. Before always was rounded and only could be changed later in Edit mode

Two new buttons has been added to topbar.

NOTE: New icons are been designed (T90414)

The buttons are expanded to list in Properties panel.

Reviewed By: mendio, HooglyBoogly

Differential Revision: https://developer.blender.org/D11999
2021-08-04 15:54:54 +02:00
145270d8d7 Fix T90427: Center View to Mouse broken
rBfb87d236edb7 made the values returned by `projmat_dimensions` more
standardized following the documentations. But the functions in Blender
that called `projmat_dimensions` followed a proposal that these values
corresponded to a distance of 1m of clip.

Adjust these functions to follow the new algorithm.
2021-08-04 10:46:54 -03:00
e5d4a0c559 BLI: add double version of 'scaleform'
No functional changes. New utility.
2021-08-04 10:46:54 -03:00
26c2c617b4 Fix T90421: edit-mode auto-smooth crash when angle set to 180degrees
Error in 39b2a7bb7e
which failed to set edge flags with single threaded calculation,
used for low poly models.
2021-08-04 22:40:25 +10:00
Gavin Li
76dcf70dac Fix transparent faces on certain AMD cards
This patch fixes an issue with missing faces when assigning a material slot other than the first to faces on AMD TAHITI cards. Refer to T78390 and T74024 for a description of this issue.

This patch also incorporates fix from T78390 for KAVERI.

{F9029258}

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D9305
2021-08-04 13:22:44 +02:00
d2130c5327 Cleanup: remove *.rej from cb67bfdba2 2021-08-04 21:09:21 +10:00
add719e31a Tweak to recent liboverride API addition: naming.
Rename new API function introduced in recent rB3b0fab6dfaa0 to match our
convention to put the action (verb) at the end of names:
`operations_update`.

Sorry for not catching that during review.
2021-08-04 12:38:13 +02:00
ac6b263906 Cleanup: inconsistent parameter name 2021-08-04 12:32:25 +02:00
557e7f135e Cleanup: initialize variable to quiet warning 2021-08-04 12:31:48 +02:00
051141acde Outliner/LibOverrides: Fix logic of checks for drag'n'drop of Collections.
Previous check was too blunt, preventing e.g. re-organization of
collection overrides inside a local parent collection, which is
perfectly valid operation.

Reported by @hjalti from the studio, thanks!
2021-08-04 11:42:13 +02:00
d9a530c55e Fix compile error without WITH_OCEANSIM enabled
Was changed in 218df99410.
2021-08-04 11:30:24 +02:00
Pratik Borhade
8c21076add Fix T87635: Rename shader node "Specular" to "Specular BSDF"
Node name edited in Specular node definition

Reviewed By: fclem

Maniphest Tasks: T87635

Differential Revision: https://developer.blender.org/D11022
2021-08-04 11:21:44 +02:00
Gottfried Hofmann
c8004ab407 Expose Color Management as argument for gpu.types.GPUOffScreen.draw_view3d()
Fix for https://developer.blender.org/T84227

The problem was that https://developer.blender.org/rBe0ffb911a22bb03755687f45fc1a996870e059a8 turned color management for offscreen rendering off by default, which makes it non-color-managed in some cases. So the idea here is that script authors get the choice wether they want color managed non-color-managed output. Thus this patch introduces a new argument do_color_management as a bool to gpu.types.GPUOffScreen.draw_view3d().

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11645
2021-08-04 11:20:22 +02:00
Anthony Edlin
b867df903f Make loopcut drawing consistent between gizmo and operator.
Loopcut drawing from gizmo had thicker lines because
it was using line smoothing without alpha blend, compared
to thin jagged lines from operator.

Make the drawing anti aliased and consistent by using
3D_POLYLINE/3D_POINT shaders, and making sure alpha
blending is on.

Reviewed By: #eevee_viewport, fclem

Differential Revision: https://developer.blender.org/D11333
2021-08-04 11:19:24 +02:00
cb67bfdba2 Viewport normal drawing with constant length
Patch for: T37878

{F10169694}

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D11487
2021-08-04 10:55:05 +02:00
218df99410 Modifier: warn if the ocean simulation fails to allocate memory
While most modifies don't handle out of memory cases, ocean simulation
could attempt huge allocations: 2048 gb at the maximum resolution.

Resolves T83952.
2021-08-04 18:29:43 +10:00
3b0fab6dfa Override: API update_operations.
The update_operations function will update the override structure of the
local object. When working with overrides the override structure is only
updated when the work-file is stored. When using scripts you might want
to enforce the update of override properties and operations.

This function removes a hack on the test cases.

Reviewed By: mont29

Maniphest Tasks: T86656

Differential Revision: https://developer.blender.org/D10848
2021-08-04 09:28:18 +02:00
effc048710 T90371: Asset: Drop Material Tooltip.
This patch changes the drop named material tooltip to give feedback to
the user what is going to happen when they invoke the change.

There are 3 states:
* "": Operator will be canceled as not all data is present (dropping on
  background.)
* "Drop <named material> on <object name> (slot <slot number>, replacing
  <current material in slot>).
* "Drop <named material> on <object name> (slot <slot number).

Reviewed By: Severin

Maniphest Tasks: T90371

Differential Revision: https://developer.blender.org/D12106
2021-08-04 08:58:39 +02:00
cd92b2350f Cleanup: use C comments for descriptive text 2021-08-04 13:34:02 +10:00
10464843dd Cleanup: add comment to fix for T90417 2021-08-04 13:34:02 +10:00
Johnny Matthews
0f45576590 Geometry Nodes: Curve Set Spline Type
This node sets the selected (or all) splines in curve to a chosen target
spline type. Poly, Bezier, and NURB splines can be converted to any of
the other types. This is meant to be a building block node, useful in
many procedural situations.

In the future the node could be optimized with multi-threading, or by
avoiding copying in many cases, either by retrieving the curve for write
access or by passing the raw vectors to the new splines where possible.

With edits from Hans Goudey (@HooglyBoogly)

Differential Revision: https://developer.blender.org/D12013
2021-08-03 23:14:03 -04:00
26f1a5e2c8 Fix T90417: font loading creates duplicate ID names
Also repair any errors in existing files.

Error from e0dd3fe587.
2021-08-04 13:02:59 +10:00
5950b3ab73 Cleanup: de-duplicate ID renaming utility for versioning 2021-08-04 12:43:07 +10:00
71dc134f89 Icons: add license headers to utilities 2021-08-04 11:45:43 +10:00
7389fd9a35 Icons: resolve various issues for generating icons
- INKSCAPE_BIN environment variable was ignored by
  alert_icons_update & prvicons_update.
- `make icons` wasn't regenerating alert icons.
- Updating SVG icons failed using blender built with ASAN.
2021-08-04 11:35:05 +10:00
8a1c1279b3 Icons: update alert icon script
Missed from c549d736cf.
2021-08-04 11:03:23 +10:00
0d2589d08c Cleanup: spelling 2021-08-04 10:03:07 +10:00
fb87d236ed Fix calculation of 'projmat_dimensions'
`r_left`, `r_right`, `r_bottom` and `r_top` were ignoring `clip_near` value
when in perspective view.

Also rename `projmat` to `winmat` in these cases.
2021-08-03 17:35:35 -03:00
18d900caca macOS: Fix OpenMP dynamic loader error. 2021-08-04 01:22:27 +05:30
41357d556f Fix broken logic in Windows directory query function
Mistake in a5bbdd6998
2021-08-03 19:37:34 +02:00
39e914cee7 Fix select engine buffer having wrong vertex size
The theme used was wrong and the vertex size is twice as set in the theme.
2021-08-03 13:37:55 -03:00
57281b73c4 Install_deps: Always re-create shortcuts to installed lib paths.
For some reasons looks like those shortcuts could get out of sync, which
created weird hard to understand building errors.

So for sake of simplicity and security, just re-create them all the
time, just like we update ld paths.
2021-08-03 17:22:48 +02:00
652fbc2005 macOS: Portable builds with dynamic libraries.
For Blender.app: dropping libomp.dylib next to Blender executable is
enough for it getting picked up since `@executable_path` is an rpath.

For non-distributed binaries datatoc, makesdna, tests etc, code for
copying libomp.dylib to build folder is removed and replaced by
CMake's rpath option for *build* tree.

For bpy.so, the post build rpath change has also been replaced by CMake
rpath option for *install* tree.

Since -id has been changed in D11748, remove the
`install_name_tool -change ...` command.

Any dylib can just be dropped at `MAC_BLENDER_TARGET_DYLIBS_DIR`
hereafter. Appending dylib path to `CMAKE_BUILD_RPATH` will be needed
for datatoc etc if linked against one (instead of copying the
dylibs around).

Reviewed By: #platform_macos, brecht
Differential Revision: https://developer.blender.org/D11997
2021-08-03 20:49:40 +05:30
a25a1f39aa Cleanup: interface, reduce indentation of copy_to_selected_button()
Reduce cognitive complexity of `copy_to_selected_button()` by flipping
conditions, returning early, and using `continue`.

No functional changes.
2021-08-03 17:12:08 +02:00
4e1a1821e0 Fix T90313: Align to Transform Orientation Axis Property Doesn't Work
`Orientation Axis` is a property incompatible with `Align` mode and
should not be visible.
2021-08-03 11:29:36 -03:00
391af6bea2 Cleanup: Replace int with bool for pointcache function
Was using an int for boolean return value.
2021-08-03 15:51:25 +02:00
7724251af8 WM: don't store selection properties typically set in the key-map
While this was already the case for the most part
some selection operators stored common settings for reuse such as
"toggle", "extend" & "deselect".

Disabling storing these settings for later execution
as it means failure to set these options in the key-map re-uses
the value of the shortcut that was last called.

Skip saving these settings since this is a case where reusing them
isn't helpful.

Resolves T90275.
2021-08-03 23:33:40 +10:00
d3dd735fea UI: building without Python again
Also quiet some warnings.
2021-08-03 22:45:37 +10:00
cec103d5a9 Silenced clang-tidy warnings. 2021-08-03 13:56:46 +02:00
0342fb5d20 Fix T90387: division by zero when trying to invert scale
Fix division by zero when `BKE_bone_parent_transform_invert()` inverts a
scale vector with zero components.

Zero values in the to-be-inverted vector are now simply skipped, i.e.
remain zero after inversion. This at least ensures that
`invert_v3_safe(invert_v3_safe(vector))` results in the same vector.

This commit does NOT fix the conceptual problem that an inversion of a
potentially non-invertible vector is relied upon. It just avoids the
division by zero.
2021-08-03 13:43:42 +02:00
dbd34a5acb Fix T90364: buttons (partially) behind animchannel search block search
When channels are scrolled to be (partially) behind the search bar,
their widget buttons would still be interactive, preventing the seach
buttons to be usable.

We have to make sure the events are consumed from the search and dont
reach other UI blocks.
We can do so by flagging the block `UI_BLOCK_CLIP_EVENTS` -- but also
have to make sure the bounds are calculated correctly (otherwise the
check relating `UI_BLOCK_CLIP_EVENTS` in `ui_but_find_mouse_over_ex` wont
trigger properly.

Maniphest Tasks: T90364

Differential Revision: https://developer.blender.org/D12103
2021-08-03 13:20:50 +02:00
b35a96e195 Fix T90346: particle force field self effect amount off by one
When calculating the particle step in `get_effector_tot`, we have to
round up (otherwise we might get an extra round in the for-loop in
`BKE_effectors_apply` for certain cases).

Example from the report:
- 10.000 particles, Effector Amount 3
- was rounding the step down to 3333
- going into the for-loop for 0, 3333, 6666 and 9999 (4 times)
- now rounding the step up to 3334
- going into the for-loop for 0, 3334 and 6668 (3 times as desired)

Maniphest Tasks: T90346

Differential Revision: https://developer.blender.org/D12113
2021-08-03 13:07:46 +02:00
20d5d7b8ec Blender Readfile: Fix annoying useless Object reading error messages.
Extend the 'reading error' container to produce the generic short
message in the popup directly visible by the user, and move all detailed
info the `INFO` reports that only show up in the console and Info
editor.
2021-08-03 12:54:05 +02:00
c6f64d46ed Cleanup: USD importer, consistent naming of function parameter
Rename function parameter `flags` to `read_flag` in the declaration, to
be consistent with the definition.

No functional changes.
2021-08-03 12:44:16 +02:00
Michael Kowalski
ea54cbe1b4 USD: add USD importer
This is an initial implementation of a USD importer.

This work is comprised of Tangent Animation's open source USD importer,
combined with features @makowalski had implemented.

The design is very similar to the approach taken in the Alembic
importer. The core functionality resides in a collection of "reader"
classes, each of which is responsible for converting an instance of a
USD prim to the corresponding Blender Object representation.

The flow of control for the conversion can be followed in the
`import_startjob()` and `import_endjob()` functions in `usd_capi.cc`.
The `USDStageReader` class is responsible for traversing the USD stage
and instantiating the appropriate readers.

Reviewed By: sybren, HooglyBoogly

Differential Revision: https://developer.blender.org/D10700
2021-08-03 12:33:36 +02:00
28b9dd7b1f Cleanup: Remove redundant checks in File Browser UI script
Was already checking these preconditions in the poll method.
2021-08-03 12:25:38 +02:00
c0900a64ce Fix T90341: Crash opening 2.4 file with File Browser editor open
The file selection parameters (e.g. `context.space_data.params`) are
expected to be unset in certain cases. Reading 2.4 files seems to be one
of them. Hence, code using it should check it's set first. Also added an
assert to a File Browser UI template printing a message when the
parameters are unset, to help debugging the issue.
2021-08-03 12:25:38 +02:00
b1a607ce04 Cleanup: deduplicate type conversion logic 2021-08-03 10:38:37 +02:00
f8abc3fb2f Fix T85436: Separate by loose parts doesn't show new objects
Only the "changed" state from the last edit-object was used,
this meant the operator would not perform the necessary update
with multi-object edit-mode.

Use "changed" & "changed_multi" naming convention.
2021-08-03 18:13:06 +10:00
d6e97a53ab Correct task ID in 00b57136e4 2021-08-03 18:13:06 +10:00
b54e741a8b UI: Add light count to viewport statistics
Even though lights were part of `SceneStats`, they were not used when
rBfd10ac9acaa0 was committed.

This patch adds the light count back into the statistics. When a light is
the active object, it will display the total number of lights in the
scene, as well as how many lights are currently selected.

{F10141354}

Reviewed By: #user_interface, Severin, Blendify, harley

Maniphest Tasks: T88512

Differential Revision: https://developer.blender.org/D11387
2021-08-03 09:42:53 +02:00
00b57136e4 Revert "Fix spin-gizmo not allowing click events to select vertices"
This reverts commit 0b903755a9.

This caused T86030, left-mouse selection override clicking,
which is used for creating a full revolution.
2021-08-03 16:34:26 +10:00
Jeroen Bakker
6f50969406 Cleanup: Hide implementation details for ED_keyframe_keylist.
For T78995 we want to change the data structure of keylists to
improve performance. (Probably a Vector with bin-search capabilities).

This patch hides the internal structure of the keylists behind `AnimKeylist`
structure. This allows us to change the internals without 'breaking' where it is
being used.

The change adds functions to create, free, find and walk over the
keylist.

Reviewed By: sybren

Maniphest Tasks: T78995

Differential Revision: https://developer.blender.org/D11974
2021-08-03 08:10:21 +02:00
Jeroen Bakker
ebd55b4acd T90372: Assets: When dropping material use active material slot.
Currently when dropping an asset the first material slot is always updated.
This patch changes that logic to update the active material slot.

In future the behavior will be updated to use the material slot of the face under the cursor.
That requires better feedback tot he user.

Reviewed By: Severin

Maniphest Tasks: T90372

Differential Revision: https://developer.blender.org/D12056
2021-08-03 08:08:20 +02:00
Miguel G
a53feb0aff Fix T89691: Solidify modifier simple/complex inconsistency
Maintain the sign when clamping non zero offset.

Reviewed By: campbellbarton, weasel

Ref D11832
2021-08-03 16:00:32 +10:00
c1a477b497 Cleanup: use C++ comments or 'if 0' for commented code 2021-08-03 15:27:20 +10:00
1973fd89df Fix crash adding custom normals
Caused by error converting this file to C++
eccdced972.
2021-08-03 15:01:39 +10:00
04c75c5ce7 Edit Mesh: Correct normal calculation for "Set From Faces"
Setting normals from faces wasn't weighting the faces contribution
by the corner angle, giving lop-sided results in some cases.

This removes the epsilon check for CLNORS_VALID_VEC_LEN,
in favor of matching the behavior of vertex normals exactly.
2021-08-03 12:22:11 +10:00
223f048138 Fix annotations placement option in the Movie Clip editor
In rB6ee14c966d05362228511756c4906e043b87e346 the enum items were renamed/removed, this change was not propagated to this setting
2021-08-02 20:15:11 -04:00
efd7c95bb2 Cleanup: Remove duplicate special case check 2021-08-02 15:45:25 -04:00
a4813379f9 Fix T90042: Spline tangent calculation assert with coincident points 2021-08-02 15:43:37 -04:00
4f6f445120 Cleanup: Make spline settings copy function public
It will be useful in the spline type conversion node. Theoretically it
could become protected again if that conversion moves out of a node,
which might be a nice improvement after an initial version.
2021-08-02 14:21:19 -04:00
8b93265c19 Mesh: Tag normals dirty instead of calculating
Because mesh vertex and face normals are just derived data, they can
be calculated lazily instead of eagerly. Often normal calculation is
a relatively expensive task, and the calculation is often redundant
if the mesh is deformed afterwards anyway.

Instead, normals should be calculated only when they are needed. This
commit moves in that direction by adding a new function to tag a mesh's
normals dirty and replacing normal calculation with it in some places.

Differential Revision: https://developer.blender.org/D12107
2021-08-02 13:47:32 -04:00
a2203a27d9 Fix T90356: Frame selected includes active strip
Don't include active strip in this operator.

This was confusing due to name of operator and inconsistent with other
editors.
2021-08-02 18:51:00 +02:00
67d56eb71e Cleanup: Remove unused/unecessary OpenVDB C API
This commit uses OpenVDB more directly for the voxel remesher, without
the extra indirection of copying to a Blender API. This makes the code
simpler, shorter, and easier to understand (though I didn't observe any
performance improvement).

This also removes the rest of the unused and undocumented OpenVDB C API,
which was written when Blender's code didn't really use C++, and doesn't
serve a purpose anymore. Those features will be implemented as nodes in
the future anyway (see D12100).

Differential Revision: https://developer.blender.org/D12097
2021-08-02 12:26:28 -04:00
77187718e4 Fix T78469: Output Metadata: Strip Name no longer accessible
Caused by rB7fc60bff14a6.

This has actually been reported and closed, but that was clearly a
misunderstanding (above commit changed a checkbox to be an enum, but a
second checkbox was simply removed)

Maniphest Tasks: T78469

Differential Revision: https://developer.blender.org/D12084
2021-08-02 17:26:50 +02:00
eccd8af828 Revert "GHOST/X11: enable EGL"
This is causing issues for some users launching Blender, because EGL indirectly
requires GLVND, which is not installed by default on e.g. Ubuntu.

This reverts commit 0b18a618b8.

Fixes T90374

Ref D12034
2021-08-02 17:19:17 +02:00
1062649b5e Fix T87041: Driver Editor not updated in realtime
Caused by {rBbbb2e0614fc3}

Since above commit only the playhead is updated as an overlay in
animation playback (was moved out of drawing of the main region for
perfomance reasons).
The driver value "debug" visualization is very useful to have during
playback though but was left in main region drawing as part of
`draw_fcurve` (thus does not update in realtime anymore).

Moving `graph_draw_driver_debug` into the overlay is not feasible
because it requires animation filtering which has significant overhead
which needs to be avoided in the overlay which is redrawn on every UI
interaction.

Now tag the whole main region for updates in the Driver Editor during
playback instead (which will make the Drivers Editor as slow during
playback as before rBbbb2e0614fc3 -- but with realtime updates of the
debug visualization).

Maniphest Tasks: T87041

Differential Revision: https://developer.blender.org/D12003
2021-08-02 17:11:58 +02:00
3ff5d8f719 Asset Browser: Proper context menu for assets
Add a context menu dedicated to asset operations to the Asset Browser.
There are two separate context menus to keep things separated well and
avoid confusing if-else logic (similar to D12057 & D12059). Their polls
make sure they are displayed for the right contexts only.

Also (to be committed as followup cleanup): Remove now unused special
handling for assets in file delete operator.

Differential Revision: https://developer.blender.org/D12062
2021-08-02 17:00:20 +02:00
ceb049133c Asset Browser: Don't show inapplicable filter and display settings
So far the Asset Browser just showed the same popups and settings as the
File Browser. Not all of them made sense for the Asset Browser though.

* Don't show inapplicable recursion toggle.
* Don't show sorting options, which don't work with assets anyway.
* Don't show the Filter popover, there are currently no applicable items
  in there.

Just like in D12057, I decided to add separate classes for the Asset
Browser case.

Differential Revision: https://developer.blender.org/D12059
2021-08-02 17:00:20 +02:00
d8bf332f86 Asset Browser: Adjust header pulldowns to be Asset Browser specific
So far the Asset Browser just showed the same menus as the File Browser.
Not all of their entries made sense for the Asset Browser though. I
decided to just give them entirely different classes to avoid confusing
if-else checks everywhere. I think the code duplication this adds is a
minor issue, it's better to keep things seperated clearly IMO.

* View menu: Add "Asset Details" toggle for the sidebar region.
* View menu: Remove recursion sub-menu
* View menu: Remove "File Path" region toggle, which doesn't apply for
  the Asset Browser.

Differential Revision: https://developer.blender.org/D12057
2021-08-02 17:00:20 +02:00
James Monteath
0e4f7b4a4b Delete pipeline_config.json file. The yaml file is now used.
Update README.md.
2021-08-02 16:57:29 +02:00
11cfa6c718 Fix T90332: Auto-smooth crashes in edit-mode
Regression in 39b2a7bb7e
that meant non-manifold edges were not being tagged
when they should have been.
2021-08-02 23:58:55 +10:00
d60a7a8744 WindowManager: Support Dynamic tooltips when dragging.
Originally the operator name was drawn next to the dragging content.
After that there was an option to add custom, static text with the
dragging content. This patch allows dynamic text to be drawn.

The custom text was implemented as out parameter of the poll function
what made the code unclear. This patch introduces a tooltip function
that separates tooltip generation from the poll function.

NOTE: the text should always be returned in its own memory block. This
block will be freed after it is copied in the drag struct.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D12104
2021-08-02 15:13:21 +02:00
8edb2222ae Cleanup: simplify subclassing CPPType
`CPPType` can wrap any C++ type so that code can work
with the wrapped type in a generic way. The goal of subclassing
`CPPType` is to provide additional methods for some types.
For example, the `CPPType` for `Array<int>` could have a `.element_type()`
method that returns the `CPPType` for `int`.
2021-08-02 12:44:17 +02:00
aa60416361 Revert "Asset Catalogs: loading a catalog definition file"
This reverts commit 1f0d6f7635 and the
cleanup 06cb48e1b2. Committed too early on
Monday morning, still has issues that should be resolved first.
2021-08-02 12:07:55 +02:00
06cb48e1b2 Cleanup: Asset catalogs, C++ to C-style comments
No functional changes.
2021-08-02 11:15:50 +02:00
1f0d6f7635 Asset Catalogs: loading a catalog definition file
Initial, limited implementation of loading a single asset catalog
definition file. These files are structured as follows:

  CATALOG_ID virtual/path/of/catalog
  SUBCATALOG_ID virtual/path/of/catalog/child
  SOMETHING_ELSE some/unrelated/hierarchy

These virtual paths will be used to show the catalog in a tree
structure; the tree structure itself is not part of this commit. Each
asset will have one catalog ID that determines where in that tree the
asset shows up.

Currently only a single catalog definition file can be read; merging
data from multiple such files, and writing them out again after changes
are made, is for future commits.

This commit only contains the code to load a single file, and unittests
to check that this actually works. No UI, no user-facing functionality
yet.
2021-08-02 11:08:02 +02:00
3fd5c93f9c Geometry Nodes: increase threshold to make regression tests pass
The real fix here is to use some kind of relative error in `customdata_compare`
instead of the absolute error used now. If vertex coordinates get larger in magnitude,
the allowed error should increase as well.
2021-08-02 10:38:11 +02:00
de91cdd930 Cleanup: separate base and geometry nodes specific socket cpp type
This simplifies changing how geometry nodes handles different socket types
without affecting other systems.
2021-08-02 10:34:50 +02:00
48722e8971 LineArt: Prevent depsgraph warning when camera is NULL. 2021-08-02 13:45:30 +08:00
1cf45fe10f Cleanup: spelling 2021-08-02 15:22:54 +10:00
Takahiro Shizuki
836aeebf70 IME Win32: Fix Duplicated Initial Character
When entering characters using IME on Windows, Japanese and Chinese
will both usually result in the first keystroke being duplicated. The
problem is that we are informed too late, after the first key is
pressed, that we are IME composing. This patch ensures we are entering
non-English characters using ImmGetConversionStatus() and then deals
with editing keys (like arrows and backspace) on a per-language basis.

see D11929 for more details.

Differential Revision: https://developer.blender.org/D11929

Reviewed by Brecht Van Lommel
2021-08-01 11:52:22 -07:00
79277986c2 Cleanup: Sort node types alphabetically 2021-07-31 23:22:36 -04:00
17243337d7 Cleanup: Remove unecessary helper function
Retrieving a mesh's looptris now take's a const mesh after
rB5f8969bb4b4, which removes the need for this function.
Since it's only two lines, avoiding the use of a separate function
in this case is simpler.
2021-07-31 14:26:01 -04:00
2f63303e25 Cleanup: Use const mesh arguments
These functions do not change their source or input mesh,  so it can
be passed with const, which means in one case that a function doesn't
have to be responsible for freeing its argument mesh, which is a clearly
better separation of concerns.
2021-07-30 23:26:35 -04:00
8063f10166 Cleanup: Remove unused includes 2021-07-30 22:28:25 -04:00
37e2fec090 Cleanup: Voxel remesh function naming
- Remove BKE prefix for static functions
- Make specific intermediate functions static
- Avoid unecessary "_to_mesh_nomain" suffix
2021-07-30 22:18:44 -04:00
7c961e716d LineArt: Fix(unreported): Child object respect collection visibility. 2021-07-31 10:02:47 +08:00
524908146c Cleanup: Reorder functions
The Quadriflow remeshing was in the middle of the voxel remesh code.
2021-07-30 21:51:47 -04:00
d91c266986 LineArt: Material flag versioning correction.
By the patch made it in master the version value already advanced (see https://developer.blender.org/D11839), so this versioning code needs to be moved down to that point.
2021-07-31 09:29:39 +08:00
e9dc6a0e09 UI: Show a notification when saving preferences
So far the only way to know if they were saved properly was
to check the terminal.

Also notify when preferences fail to save.
2021-07-31 03:15:10 +02:00
35894dc700 Cleanup: Simplify logic, follow style guide for integer types
- Use `int` instead of `unsigned int` for mesh indices
- Use C++ types (Array, float3, IndexRange)
- Use range based for loops
2021-07-30 15:08:43 -04:00
54bd5efa68 Fix build error in debug builds and uninitialized structs
This BMesh iterator hadn't been used in C++ code yet, and needed
a macro for a proper cast. The parameter structs need to be initialized
when declared without designated initializers.
2021-07-30 14:28:55 -04:00
549e2b7539 Compositor: Buffer iterators tests
See D11882 for a description of the iterators.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12001
2021-07-30 20:20:27 +02:00
d2675c3c5d Cleanup: unneeded default constructor definitions 2021-07-30 20:20:27 +02:00
5762e7a679 Compositor: Fix wrong number of threads during constant folding
The variable was uninitialized at that point of execution.
2021-07-30 20:20:27 +02:00
4dbf4eb100 Assets: Rename "Mark Asset" operator to "Mark as Asset"
This naming change was agreed on during the asset workshop. See
https://code.blender.org/2021/06/asset-browser-workshop-outcomes/#terms-definitions.
2021-07-30 20:18:22 +02:00
96fb21f3af UI: Move Mark/Clear asset out of ID Data in Outliner context menu
They are now always shown in the top-level of the Outliner context menu.
Having them in the ID Data submenu was just a hassle to work with, and
often confusing to users - even if technically correct (the asset status
is part of the ID data).

Part of T82680.
2021-07-30 19:41:19 +02:00
a9ea310d30 Cleanup: Move remesh files to C++
This will be helpful for some cleanups I'd like to do, including
removing the unecessary C API for OpenVDB and unifying some
attribute transfer code.
2021-07-30 13:15:01 -04:00
0b10a96474 Assets: Disable File Browser only operators for asset browsing
These operators shouldn't be available in the Asset Browser.

https://developer.blender.org/T83556

Added a comment to each operator poll assignment to explicitly mention
the intention. That should also remind devs to decide if the operator
should apply for both file & asset browsing when copy & pasting operator
definition code.
2021-07-30 19:07:51 +02:00
f7836019b3 Fix incorrect poll function used for file path dropping
The operator to drop file paths into the File Browser was just checking
if there's an active window. This wasn't really an issue since the
operator was only used as drop-operator for the File Browser. But the
operator would show up in the operator search. Plus, for asset browsing,
we'll also have to check the file browsing mode, so the more specific
poll function will be needed.
2021-07-30 19:07:51 +02:00
9ac782b823 Fix EGL version being printed on every startup
After the switch to enable EGL over GLX. No need to print this debugging
information always.
2021-07-30 18:44:26 +02:00
c1ec2e9d5f Cleanup: compiler warnings 2021-07-30 18:44:26 +02:00
3848507511 Cleanup: clarify license and origin of voronoi and dithering code 2021-07-30 18:44:26 +02:00
b90887da5a Cleanup: Refactor logic of file deletion poll callback
* Early exit instead of complex if-else blocks.
* Avoid iterating over entire file list.
* Use `true`/`false` for boolean values.
* Declare variables in smaller scopes.
2021-07-30 18:42:38 +02:00
3b2a6bf8e8 UI: Don't show Windows file association operator in search on other OSes
The Windows-specific "Register File Association" operator would show in
the search menu of other platforms. Decided to not disable it at
compile-time, like we do it with "Toggle System Console" (another
Windows-only operator), because that would require workarounds for the
translation tools. Instead the operator poll function always returns
false on unsupported platforms now.
2021-07-30 16:43:05 +02:00
3316e28418 Preferences: Move "Register File Association" to preferences level
The operator was register as a "file" operator, which are by convention
used for File Browser operators only. Move it to the "preferences"
operators, where it's displayed in the UI too.
2021-07-30 16:25:34 +02:00
e7e9364d23 Cleanup: remove disabled code from property lookup
This allowed custom ID-properties to share a name-space
with regular properties which won't work well as the names may collide.
2021-07-31 00:23:23 +10:00
4c3d4ebefc Cleanup: remove redundant ifdef check
The define that was tested no longer exists.
2021-07-31 00:15:23 +10:00
eb2a6f454b Fix T90318: Dragging asset while Asset Browser is still loading crashes
This partially reverts cb0b017d8f: We can't store the asset handle in
the drag data, because the file pointer it wraps may be freed as the
Asset Browser generates its file list.
2021-07-30 15:54:54 +02:00
4647ffd918 Cleanup: Remove unused file description storage
This isn't used at all in the current File and Asset Browser design.
2021-07-30 14:34:33 +02:00
c8b7745172 Cleanup: headers, use 'pragma once', remove argument to '\file' 2021-07-30 22:29:30 +10:00
5aa45c43f2 Cleanup: missing leading '*' from comment blocks 2021-07-30 22:20:31 +10:00
88e774aa34 Cleanup: workaround for unstable formatting in clang-format
Running multiple times would re-indent differently.
2021-07-30 21:56:14 +10:00
Flix
a787bcbf5c Fix: script.reload() operator reloads current app template
Ref D12040
2021-07-30 21:43:22 +10:00
James Monteath
8796a2827f Update REAME.md file 2021-07-30 13:40:48 +02:00
b98735ec29 Kernel: include header file in BKE_appdir.h defining size_t
In `BKE_appdir.h`, include `<stddef.h>` as that defines `size_t`. This
follows the "include what you use" principle, and makes it possible to
use `BKE_appdir.h` without having to bother with its dependencies.

No functional changes.
2021-07-30 13:16:14 +02:00
020431408f Cleanup: limit scope of temporary variables
Also remove early return as it duplicates cleanup calls.
2021-07-30 16:44:39 +10:00
93eb460dd0 Cleanup: clang-format (re-run after v12 version bump) 2021-07-30 16:19:19 +10:00
f81a6a2ff1 Cleanup: spelling in comments 2021-07-30 16:16:38 +10:00
63f7eceb53 PyAPI: defer freeing existing properties on registration
Registering a property could remove the existing property,
then fail to parse one of the arguments of the new property -
leaving the struct without a property.

Now freeing the existing property is deferred until immediately
before the new property is registered.
2021-07-30 16:04:08 +10:00
d06b03f80d PyAPI: include the property name & type in registration errors
This gives useful context in errors,
also remove newline endings from exceptions.
2021-07-30 16:04:00 +10:00
9764d90fda Cleanup: use pyrna_enum_value_parse_string parser for enum args 2021-07-30 16:03:56 +10:00
228edcaedd Cleanup: bpy.props variable names
- Use `default` instead of `def` abbreviation.
- Rename `BPYPropArrayLength` to `BPyPropArrayLength`
  in keeping with other local structs.
- Remove _PyArg_Parser.fname value accidentally left in
  (harmless as it's not used).
2021-07-30 16:03:52 +10:00
a2b8dad469 PyAPI: support accessing the original value for RNA enum parsing
Needed in siturations when the input argument is needed for exception messages.
2021-07-30 16:03:47 +10:00
ddcb6b1023 Cleanup: replace macros with converter callbacks for bpy.props
Macros were used for expanding shared logic for some properties.

Replace this with Python converters & a funciton that handles
deferred registration.

Add generic converter functions for RNA enums:

- pyrna_enum_value_parse_string
- pyrna_enum_bitfield_parse_set
2021-07-30 11:57:43 +10:00
5280d4bf0b GPencil: Fix unreported problems painting after import SVG
After doing an import, the bounding box of the stroke was not calculated and any operation related to brushes (Sculpt, Weight Paint and Vertex Paint) was not working as expected because the bounding box of the stroke was wrong.

This problem was solved automatically after any edit operation, but must be solved in the import process.
2021-07-29 22:30:48 +02:00
8f05520083 Fix T89213: Some modifier properties have wrong subtype
This commit resolves these RNA warnings:
```
offset: "", WARN (bpy.rna): ...\source\blender\python\intern\bpy_rna.c:1505 pyrna_enum_to_py: current value '65536' matches no enum in 'FloatProperty', 'offset', 'subtype'
project_limit: "", WARN (bpy.rna): ...\source\blender\python\intern\bpy_rna.c:1505 pyrna_enum_to_py: current value '65536' matches no enum in 'FloatProperty', 'project_limit', 'subtype'
falloff_radius: "", WARN (bpy.rna): ...\source\blender\python\intern\bpy_rna.c:1505 pyrna_enum_to_py: current value '65567' matches no enum in 'FloatProperty', 'falloff_radius', 'subtype'
```
2021-07-29 17:16:08 -03:00
0b18a618b8 GHOST/X11: enable EGL
This will replace GLX with EGL for X11. GLEW does not support GLX and EGL
at the same time. Most distributions build GLEW with GLX support, so we
have to use the externally provided GLEW and build with EGL support.
This effectively sets WITH_SYSTEM_GLEW to OFF for all Linux configurations.

Differential Revision: https://developer.blender.org/D12034
2021-07-29 17:39:55 +01:00
c7b12e31e6 Fix T89976: Mirror Keys By Value performs wrong scale conversion
In the graph editor, Mirror Keys by Value would convert the value to mirror
over, to account for different units for linear & rotational properties.
The conversion was done in the different direction, though, resulting in
values that were too large by a factor of (180/pi)^2.
2021-07-29 18:34:10 +02:00
cae18abef4 deps/win: Remove media foundation dep for ffmpeg
This caused a blender load error on windows N,
given we do not use these codecs they can safely
be disabled.

This will fix T90200 once the new libraries are
in SVN
2021-07-29 10:21:43 -06:00
8f12457c25 Fix T90295: inconsistent render pass order between Cycles and Eevee 2021-07-29 17:59:03 +02:00
0b0c2901f6 Render: remove unused Blender Internal view layer settings
These should have been removed earlier but were forgotten.
2021-07-29 17:59:03 +02:00
646f7ef73c Render: disable Z pass by default, leave only Combined
It was somewhat arbitrary to have this one pass enabled that adds a bit of
additional memory and render time overhead, even though it's not necessarily
more important than others.
2021-07-29 17:59:03 +02:00
2d3e5eda3f Assets/UI: Resolve major asset view UI template limitation
Before this, all asset view templates showing the same asset library
would show the same assets, even if they should show different ID types.
That was a major limitation since the design did forsee that this
template can be put anywhere in the UI to display various sub-sets of
assets.

Initially I did the ID type filtering close to the asset-list reading,
because I wanted to optimize reading so that we would only actually read
asset information from disk of the ID type to be shown. But this will be
quite complex and I'm not sure if I'll get to work on this anytime soon.
So this commit moves the filtering to the template display level solving
this limitation.

Note: This also adds the code to filter by tags, together with the ID
type. But it's not actually used anywhere yet.
2021-07-29 17:35:06 +02:00
8cb4e3d046 Cleanup: Remove unnecessary code for asset view UI template
From what I can tell there is no reason anymore to do this. The design
has changed since this was added.
2021-07-29 17:35:06 +02:00
49c0b9ec43 Assets/UI: Sanity check argument for UILayout.template_asset_view()
Was already doing some sanity checks, but wasn't checking if the passed
property actually is a collection property, which is important.
2021-07-29 17:35:06 +02:00
5be54cce36 Cleanup: Pass asset handle to asset iterator, rather than wrapped file
This iterator was introduced before `AssetHandle` existed, so it was
dealing with the file data directly. Now we want as little code as
possible to deal with the file data, all access should happen via the
`AssetHandle`.
2021-07-29 17:35:06 +02:00
b361b2f214 Cleanup: Consistent indent style for asset CMakeLists file
Was mixing 4 and 2 space indent in a single file.
2021-07-29 17:35:06 +02:00
33322086f6 install_deps: update OIDN to 1.4.1, and ISPC to 1.16.0.
Ref. T88438.
2021-07-29 17:00:49 +02:00
ceec7cabf5 install_deps: Update OSL to 1.11.14.1.
This has been a huge pain to get working, for several reasons (new flags
needed, patching is now mandatory, etc.).

Further more, discovered that debian OIIO package is now silently
relying on OpenCV, without even proper handling of this dependency (at
least in the `-dev` package), so had to revert to force-build own OIIO
again on that distro for the time being.

Ref. T88438.
2021-07-29 17:00:48 +02:00
b60e72100b Cleanup: OSL buildlib patch: Remove .rej part.
This patch contained changes for an `.rej` rejection file generated by
failed patch apply... Definitly nothing to do here.
2021-07-29 17:00:48 +02:00
21b4799793 install_deps: Update OIIO to 1.1.15.1.
Ref. T88438.
2021-07-29 17:00:48 +02:00
bd2bfa469f install_deps: Update llvm to 12.0 (with minimal now being 11.0).
Ref T88438.
2021-07-29 17:00:48 +02:00
12d93e44d0 Install_deps: add flex dependency.
Was already installed on Debian-like and Fedore/Suse actually, now also
explicitely required on Arch and listed in docs.

Ref. T88438.
2021-07-29 17:00:48 +02:00
4d28703277 Install_deps: Add zstd dependency.
Ref T88438.
2021-07-29 17:00:48 +02:00
Germano Cavalcante
1775c39986 Fix 'BLI_task_parallel_mempool' keeping 'user_chunk' unchanged
When `BLI_task_parallel_mempool` does not use threading, the
`userdata_chunk` is allocated locally simulating a TLS.

However `func_reduce` is not called so the original chunk is ignored.

`task_parallel_iterator_no_threads` is another function that doesn't call
`func_reduce`. It also ignores `userdata_chunk_local` in the main iterator.

The solution in these cases is not to create a `userdata_chunk_local`.

This fixes T90131

Differential Revision: https://developer.blender.org/D12067
2021-07-29 11:37:10 -03:00
0f1c84f171 deps: Reduce llvm/clang footprint for windows
We shipped the whole bin folder for llvm/clang
while we only needed clang-format, by shipping
just the bits we need we save about 700 megabytes
off our svn lib download.
2021-07-29 07:45:38 -06:00
cafb1bc47f Data-block Preview: Create preview using current frame
The preview was always using frame 1, but maybe the object has changed and it's better create preview using the current frame.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D12018
2021-07-29 15:08:12 +02:00
24ba931f40 Cleanup: Remove debug-only code 2021-07-29 14:46:54 +02:00
810c88b5f1 Fix building without Cycles logging
Ideally can use assert() checks instead of suppressing the check entirely,
but for now just fix compilation error quickly.
2021-07-29 14:32:10 +02:00
3f84f0123e Cleanup: Fix build warning
Introduced in 3964785a14
2021-07-29 13:11:55 +02:00
jim man
9cc8d50a04 cleanup: editor_image : Remove unused draw functions
These functions are unused currently..

Reviewed By: deadpin, jbakker

Differential Revision: https://developer.blender.org/D11968
2021-07-29 12:46:24 +02:00
5116b7a4c2 Fix Cycles crash with fluid object motion blur disabled
Motion attributes expects mesh to have non-zero number of motion steps,
which was violated in the case when fluid mesh had motion blur disabled.

This is a bit of annoying fix, because of the order of updates. More
ideal solution would be to handle cached and fluid velocities in the
sync_mesh_motion() which ensures all the dependencies between settings.
2021-07-29 12:28:46 +02:00
0491052a96 VSE: Change grid line drawing
Add overlay option to disable grid drawing.
Reuse drawing code from other editors (timeline editor)
Add argument `display_minor_lines` to function
`UI_view2d_draw_lines_x__discrete_frames_or_seconds`
This way minor line drawing can be disabled and so it doesn't cause
too much visual noise. Also spacing seems to be too fine, so VSE uses 3x
what is defined in preferences.

Reviewed By: fsiddi, Severin

Differential Revision: https://developer.blender.org/D11790
2021-07-29 11:38:43 +02:00
5c9979ff03 VSE: don't snap by default
Snapping by default goes against convention, so this setting was
re-evaluated. Also snapping by default can conflict with new image
transform system, see T90156

There wasn't consensus, so disable snapping by default to follow
established convention.

ref T89665

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12054
2021-07-29 11:38:43 +02:00
3964785a14 UI: Fix time labels drawing
Calculate frequency of time/frame label drawing, such that labels have
at least 10px margin and don't overlap.

Change timecode format:
- Use at least `mm:ss` format
- Don't display frames if all labels would end with +00

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D11792
2021-07-29 11:38:43 +02:00
a70f37bd8a Fix T89952: GPencil channel box selection offset
The channel box selection was offset for grease pencil layers.

This is a proposed fix by @yann-lty

Before:
{F10227973}

After:
{F10227974}

Reviewed By: #grease_pencil, antoniov

Maniphest Tasks: T89952

Differential Revision: https://developer.blender.org/D11962
2021-07-29 10:42:05 +02:00
d5fd09ab58 Fix memory leaks in Python gizmo get/set handlers 2021-07-29 14:32:25 +10:00
3c50687073 Fix gpu.types.GPUTexture crash when the size argument was too big
Missing length check on the size argument before copying it
into a fixed size buffer.
2021-07-29 14:11:37 +10:00
fd0b2b8dfd Cleanup: use PyC_AsArray_FAST function where possible
Oversight in 2453dc1b0e.
2021-07-29 13:41:48 +10:00
bc0a7d3fae PyAPI: support multi-dimensional arrays for bpy.props vector types
- Multi-dimensional boolean, int and float vector types are supported.
- A sequence of int's for the "size" is used to declare dimensions.
- Nested sequences are required for default arguments.

Now it's possible to define matrix properties, for e.g:

  bpy.props.FloatVectorProperty(size=(4, 4), subtype='MATRIX')
2021-07-29 11:09:21 +10:00
2453dc1b0e PyAPI: add multi-dimensional array conversion utility functions
Add array conversion functions that take dimension arguments.

- PyC_AsArray_Multi (version of PyC_AsArray).
- PyC_Tuple_PackArray_Multi_* (version of PyC_Tuple_Pack_*).
2021-07-29 11:04:33 +10:00
0358951b9e Cleanup: spelling 2021-07-29 10:52:08 +10:00
8aa1c0a326 Fix T75028: Improved Font Names in File Manager
When viewing font files in the File Manager, this patch uses the font's
family and style names to show the same type of string shown to users
in operating system lists. For example "Book Antiqua Regular" instead
of "BKANT.ttf"

see D12020 for details and examples.

Differential Revision: https://developer.blender.org/D12020

Reviewed by Campbell Barton and Julian Eisel
2021-07-28 11:16:04 -07:00
073bf8bf52 Cycles: remove WITH_CYCLES_DEBUG, add WITH_CYCLES_DEBUG_NAN
WITH_CYCLES_DEBUG was used for rendering BVH debugging passes. But since we
mainly use Embree an OptiX now, this information is no longer important.

WITH_CYCLES_DEBUG_NAN will enable additional checks for NaNs and invalid values
in the kernel, for Cycles developers. Previously these asserts where enabled in
all debug builds, but this is too likely to crash Blender in scenes that render
fine regardless of the NaNs. So this is behind a CMake option now.

Fixes T90240
2021-07-28 19:27:57 +02:00
3bf9675849 Cleanup: Remove unnecesary undefs
Macros `SEQ_ALL_END` and `SEQ_ALL_BEGIN` no longer use `seq->tmp`.
Therefore they are safe to use regardless from where they are called.
2021-07-28 18:16:48 +02:00
40ef71f465 Assets: Improve error message when "Clear Asset" fails
When using "Clear Asset" from the Asset Browser but with an asset
selected that is not stored in the current file, we can show a more
informative error message.
2021-07-28 18:05:25 +02:00
0088b412ff VSE: Fix audio not recalculated
Changing strip offsets with RNA properties didn't tag depsgraph to
update for new strip start/end points.
2021-07-28 17:45:22 +02:00
08154d237f Cleanup: VSE cache invalidated twice
Multiple RNA update function invalidated cache twice.
2021-07-28 17:20:23 +02:00
Wannes Malfait
b304616f2a Fix T90221: geometry viewer node links to other socket types
The viewer node in geometry node trees only supports geometry nodes.
This patch ensures that when ctrl shift clicking on a node, it will only
link to geometry sockets.

Differential Revision: https://developer.blender.org/D12055
2021-07-28 15:54:17 +02:00
3db37075f6 Remove the code in BKE_collection_move to preserve LayerCollection flags.
This code was actually buggy (forcefully re-enabling excluded layers in some
cases).

Further more, it should not be needed now that layerCollection resync code
reuses as much as possible existing layers instead of deleting and
re-creating them all the time.

Differential Revision: https://developer.blender.org/D12016
2021-07-28 15:51:06 +02:00
b18d0244fc LayerCollection: Refactor of resync-with-Collection-hierarchy process.
The goal of this refactor is to improve resync of LayerCollections
hierarchy to match again Collection one.

Current code would destroy and re-create valid layers whenever a parent
collection would be removed, which leads to losing way too often
layer-related settings when editing collection hierarchies.

While this could be partially addressed from operators side, there was
no way to fix those issues from lower level, more generic ID management
code like ID remapping or library override resync processes.

The new code builds a shallow wrapper around existing (aka old) layers
hierarchy, does a set of checks to define the status of all existing
layers, and try to find the closest matching unused layer in cases where
layers and collections hierarchies do not match anymore.

The intent is to both re-use as much as possible existing layers, and
to pick the 'best' possible layer to re-use, following those heuristics:
 * Prefer layers children of current one first (in old hierarchy), and only
   use those from other higher-level hierarchies if no (grand-)child is found.
 * Prefer to use closest layers available in the old hierarchy.

NOTE: The new code is about 12%-15% slower than the previous one, which is
expected given the increased complexity. Note that this would not be an
issue in practice if this code was not called way too often (needs to
be converted to lazy update instead, which is a long known TODO).

NOTE: The LayerCollectionResync code uses its own built-in version of
FIFO queue, as performances in this code is currently a critical point
(it can get called tens of thousands of times during a single (heavy)
ID management operation currently, in a production file e.g.).

Differential Revision: https://developer.blender.org/D12016
2021-07-28 15:51:06 +02:00
Wannes Malfait
31fcb934a4 Fix T89415: update multi input indices after deleting a node
When deleting a node, links attached to that node are deleted, but if one
of those links was connected to a multi input socket, the indices of the
other links connected to it were not updated. This adds updates both in
the case of a normal delete as well as after a delete with reconnect.

Differential Revision: https://developer.blender.org/D11716
2021-07-28 15:43:24 +02:00
f9308a585e Fix particle system duplication duplicates all systems
Followup to rB3834dc2f7b38 (where getting the proper particle system was
fixed for the Adjust Last Operation panel in the Properties Editor). But
since this operator can also be called from the 3DView, get a current
particle system there as well.

Without this, _all_ particle systems would be copied when executing from
the 3DView (which was never really intended [operator description uses
singular] -- it just happens to use `copy_particle_systems_to_object`
internally as well -- same as the `Copy Active/All to Selected Objects`
operators)).

ref. T83317

Maniphest Tasks: T83317

Differential Revision: https://developer.blender.org/D12033
2021-07-28 15:06:35 +02:00
dfc597202f Fix T90154, T90213: curve issues since recent cleanup commit
Caused by {rB8cbff7093d65}.

Since above commit only one modifier would get calculated and the
displaylist boundingbox was calculated wrong.

Maniphest Tasks: T90154

Differential Revision: https://developer.blender.org/D12037
2021-07-28 14:59:50 +02:00
7d0765cbdc Fix menu poll function being ignored for UILayout.menu
Using `UILayout.menu()` [1] or `UILayout.menu_contents() [2], the menu
would just always be added, the `poll()` check not being executed. As
API user I would expect the `poll()` to deterimine visiblity of the
menu.

[1] https://docs.blender.org/api/current/bpy.types.UILayout.html#bpy.types.UILayout.menu
[2] https://docs.blender.org/api/current/bpy.types.UILayout.html#bpy.types.UILayout.menu_contents

Differential Revision: https://developer.blender.org/D12053

Reviewed by: Campbell Barton
2021-07-28 14:44:45 +02:00
8e9d06f5a0 LineArt: Camera Overscan
Expand camera effective region to a portion beyond image frame so strokes won't end right at the border.

Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D12049
2021-07-28 19:55:29 +08:00
544ddcdaac Fix (studio-reported) liboverride resync crash after recent changes.
Recent own rBabf3ce811f6e prevented any LayerCollection update during
the whole liboverride resync process, for both performances and feature
reasons.

However that means that the various runtime caches like the Base GHash
are not cleared anymore during ID remapping process, so we need to call
`BKE_main_collection_sync_remap` instead of `BKE_main_collection_sync`
when we finally are ready for this update.

Reported by @eyecandy (Andy Goralczyk) from Blender studio, thanks!
2021-07-28 12:33:16 +02:00
91dd1a1ba3 VSE: Add tooltips for add_effect_strips operator
This patch adds propper tooltips to the effect strips in the "Add" menu.
Note that not all effect strips are actually in the "Effect Strips"
submenu like color strips, text strips or transitions. For these types
of effect strips, a dediacted tooltip is especially useful.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D11714
2021-07-28 10:16:43 +02:00
ce68888d1b Cleanup: reduce indentation in bpy.props
Remove unnecessary NULL checks.
2021-07-28 13:38:35 +10:00
f5cc348610 VSE: Draw strips transparent during transform overlap
While transforming a strip, draw the background semi-transparent
if it overlaps with another strip. It's convenient to see what's
underneath, especially with the upcoming Overwrite feature.

Thanks to @iss for the help and review.
2021-07-27 20:14:22 +02:00
ae034d27d2 Deps: ensure osl/bin/oslc is using static libpng
Pass `-DLINKSTATIC=ON` to the OSL CMake, to ensure it statically links to
our libpng. Previously this was only applied on Windows, it's now on all
platforms.
2021-07-27 19:49:29 +02:00
7e91a60be6 Add StringRef::trim() functions
Add three functions that trim characters from the front & end of a
`StringRef`. All functions return a new `StringRef` that references a
sub-string of the original `StringRef`.

- `trim(chars_to_remove)`: strips all characters from the start and end
  that occur in `chars_to_remove`.
- `trim(char_to_remove)`: same, but with a single character to remove.
- `trim()`: remove leading & trailing whitespace, so same as
  `trim(" \r\n\t")`

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12031
2021-07-27 19:49:29 +02:00
c6ba7359ae Fix LLVM 12 symbol conflict with Mesa drivers, after recent Linux libs update 2021-07-27 17:45:17 +02:00
f4abd3cfc4 Fix LibOverride crashing in some cases where reference linked data gets MIA.
When the root of an override hierarchy disapears, there is no way to do
a proper resync, just abort.

Reported by studio, thx.
2021-07-27 17:41:15 +02:00
Himanshi Kalra
4a02b9ffeb Regression Testing: Running tests based on blend files
Runs tests based on blend files with minimum python interaction.
Developed as part of GSoC 2021 - Regression Testing of Geometry Nodes.
Earlier, tests were built from scratch by adding a modifier/operation
from the Python API.
Now, tests can also be created inside blender and are compared using
Python script.

Features: Automatically adding expected object if it doesn't exist.
This patch adds tests for the following Geometry Nodes category:
* Curves
* Geometry
* Mesh
* Points

The implemented UML diagram for refactoring of mesh test framework.
{F10225906}

Technical Changes:
SpecMeshTest: It adds the modifier/operation based on the Spec provided.
BlendFileTest: It applies already existing modifier/operation from the blend file.

Test folders hierarchy with tests. This folder should be extracted to `lib\tests\modeling`
{F10240651}
Note: The `geometry_nodes` folder might lie under another `geometry_nodes` folder while extracting, please double check. Use the inner-most one.
The hierarchy should be:
-`lib\tests\modeling\geometry_nodes\mesh`
-`lib\tests\modeling\geometry_nodes\points`
and so on.

* From `ctest` the tests should be run as `ctest -R geo_node -C [Configuration]` on Windows.
* Each single test can be run with its entire name e..g `ctest -R geo_node_geometry_join_geometry`.(just an example). Run `ctest -N -R geo_node` to see all tests.
* From blender, the tests can be run `blender -b path\to\blend\file --python path\to\geo_node_test.py`

Reviewed By: zazizizou, JacquesLucke

Differential Revision: https://developer.blender.org/D11611
2021-07-27 21:01:15 +05:30
d6d44faff0 Fix memory leak with Python RNA property get callback errors
Failure to return a list of the expected size & type wasn't
decrementing the value, leaking a reference.

Caused by 127b5423d6 a workaround for the
real error that was fixed f5e020a7a6.
2021-07-28 01:12:26 +10:00
Charlie Jolly
766e67e55d Geometry Nodes: Add node labels to Attribute maths nodes
This adds the operator name to the node label which is consistent with the shading nodes.
The vector node has `Vector` as a prefix.

The Attribute nodes already have a different coloured header.

The same label is used when collapsing nodes, this helps readability.

Reviewed By: pablovazquez

Differential Revision: https://developer.blender.org/D10749
2021-07-27 14:34:08 +01:00
07688ca2d2 Added YAML builtbot config file.
Builtbot is switching over from json to yaml. Both
configuration files should be kept in sync for now.

The json file will be removed when everything works as expected.
2021-07-27 15:06:43 +02:00
db4fe8e322 BlenRead: Add GHash-based search for already read linked IDs.
Ths commit adds a new `IDNameLibMap` to `Main`, used during file reading
to quickly find already read linked IDs.

Without that, search would use string-based search over list of linked
data, which becomes extremely slow and inneficient in cases where a lot
of IDs are linked from a same library. See also {T89194}.

Extrem-usecase reported in T89194 is now about 4 times faster in linked
data reading (about 2 times faster for the whole .blend file loading).

More normal cases (like Sprites studio production files) have barely
measurable speed improvements, a few percents at best.

NOTE: `main_idmap` API was extended to support insertion and removal of
IDs from the mapping, avoids having to re-create the whole thing several
time during libraries expansion in readcode.

Differential Revision: https://developer.blender.org/D11757
2021-07-27 14:53:49 +02:00
e37c876cd7 PyAPI: support different int sizes for PyC_AsArray 2021-07-27 22:38:50 +10:00
58eacb8e7c Cleanup: pass sizeof array element to PyC_AsArray
Replace the is_double argument which was only used for single/double
precision floats.

This allows supporting different sized int types more easily.
2021-07-27 22:36:01 +10:00
b1a2abd6b2 Fix missing passes update on Use Denoising change
Makes it so Render Layers node in the compositor is updated as soon
as Use Denoising is changed for the final render.

Differential Revision: https://developer.blender.org/D12010
2021-07-27 11:48:14 +02:00
c5e5ac4a17 Deps builder: OIIO/OSL/ISPC/OIDN/LLVM/Flex updates
This diff somewhat snowballed out of updating OIDN to 1.4.1 it had some
changes that allowed us to remove the arm hacks we had in place and
revert to using identical versions for a whole bunch of deps. But that
required an update to ISPC which needed a newer LLVM and if we're
updating LLVM we may as well update OSL, and when we update OSL, OIIO
may as well be dragged in soo......anyhow...

This diff updates:

LLVM 9.0.0 (11.0.1 for mac/arm) -> 12.0.0
OIIO 2.1.15.0 -> 2.2.15.1
OSL 1.11.10.0 -> 1.11.14.1
winflex_bison 2.5.5-> 2.5.24 (ispc needed newer bison, windows only dep)
OIDN 1.4.0 -> 1.4.1
ISPC v1.14.1(random hash for mac/arm) -> v1.16.0
Flex 2.6.4 (ISPC needed newer Flex than available on CentOS 7)

and removes most of the "special arm/mac" versions. I think just ssl and
embree are left with special versions.

notable changes:
@LazyDodo included some clang headers in the linux/mac harvest which are
needed to start writing custom clang based tooling like D9465 these were
already shipping on windows, but not the other platforms.

[macOS] Change the `LC_ID_DYLIB` of OpenMP  for {D11997}. This changes
where the executables look for dylibs.

Reviewed By: sebbas, LazyDodo

Differential Revision: https://developer.blender.org/D11748
2021-07-27 10:15:31 +02:00
5a07174ce3 Cleanup: add note from T85517 fix 2021-07-27 18:14:08 +10:00
b331acf477 Cleanup: comment spelling & punctuation 2021-07-27 18:06:29 +10:00
675d8a9c43 LineArt: Occlusion accuracy fix.
This patch fixes occlusion function to handle one specific case (when an edge shares a point with triangle) better,especially when there's overlapping edges in this case.
2021-07-27 14:02:34 +08:00
Aaron Carlisle
6ee14c966d Anotations: Fix a several issues with stroke placement
Previously, this option was not exposed in the UI, only for the clip editor.
There were also multiple rna properties that did the same thing for each of the 2D editors.

There was also an issue where the property enum items were the same as the 3d view which didnt make much sense.

Reviewed By: antoniov

Differential Revision: https://developer.blender.org/D12027
2021-07-26 18:53:30 -04:00
05315af81d Fix compile error on macos introduced in last commit
std::optional::value() is not available on macos.
2021-07-26 22:44:56 +02:00
Christoph Lendenfeld
6a903d9088 Fix: Instantly hide bones after hitting H key in pose sliding
When using a pose slider it is possible to hide bones with the 'H' key.
Before this patch the screen didn't update, so you had to move the mouse 1 pixel to update.
This patch makes it so it updates right away

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D12024
Ref: D12024
2021-07-26 21:42:04 +01:00
a4a72bffd3 Compositor: Full frame Box Mask node
Adds full frame implementation to this node operation.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11627
2021-07-26 21:43:30 +02:00
e33814ef6b Compositor: Full frame Levels node
Adds full frame implementation to this node operations.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11749
2021-07-26 20:13:55 +02:00
883fb49d4f Compositor: Fix memory leak when exporting operations on debug 2021-07-26 20:13:03 +02:00
a117794f8c Compositor: Full frame Scale node
Adds full frame implementation to this node operations.
No functional changes.

Includes a new operation method `init_data` used to initialize any data
needed after operations are linked and resolutions determined.
Once tiled implementation is removed `initExecution` may be renamed
to `init_rendering` and `init_data` to `init_execution`.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11944
2021-07-26 20:13:03 +02:00
cf74cd9367 Cycles: upgrade CUDA to 11.4
This fixes a performance regression on Ampere cards, on specific scenes like
classroom. For cycles-x there is little difference, but this is still helpful
for LTS releases, and we need to upgrade at some point anyway.
2021-07-26 19:46:51 +02:00
Nikhil Shringarpurey
6eb94d8df2 Cleanup: fix compiler warnings due to implicit cast
Differential Revision: https://developer.blender.org/D11950
2021-07-26 18:04:40 +02:00
22b03e1c68 Fix Python error in benchmark executable detection after recent changes 2021-07-26 18:04:40 +02:00
644 changed files with 19026 additions and 8121 deletions

View File

@@ -110,6 +110,10 @@ if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW) cmake_policy(SET CMP0074 NEW)
endif() endif()
# Install CODE|SCRIPT allow the use of generator expressions.
if(POLICY CMP0087)
cmake_policy(SET CMP0087 NEW)
endif()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Load some macros. # Load some macros.
include(build_files/cmake/macros.cmake) include(build_files/cmake/macros.cmake)
@@ -403,14 +407,14 @@ set(CYCLES_TEST_DEVICES CPU CACHE STRING "Run regression tests on the specified
set(CYCLES_CUDA_BINARIES_ARCH sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 sm_70 sm_75 sm_86 compute_75 CACHE STRING "CUDA architectures to build binaries for") set(CYCLES_CUDA_BINARIES_ARCH sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 sm_70 sm_75 sm_86 compute_75 CACHE STRING "CUDA architectures to build binaries for")
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH) mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
unset(PLATFORM_DEFAULT) unset(PLATFORM_DEFAULT)
option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON) option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON)
option(WITH_CYCLES_DEBUG "Build Cycles with extra debug capabilities" OFF) option(WITH_CYCLES_DEBUG_NAN "Build Cycles with additional asserts for detecting NaNs and invalid values" OFF)
option(WITH_CYCLES_NATIVE_ONLY "Build Cycles with native kernel only (which fits current CPU, use for development only)" OFF) option(WITH_CYCLES_NATIVE_ONLY "Build Cycles with native kernel only (which fits current CPU, use for development only)" OFF)
option(WITH_CYCLES_KERNEL_ASAN "Build Cycles kernels with address sanitizer when WITH_COMPILER_ASAN is on, even if it's very slow" OFF) option(WITH_CYCLES_KERNEL_ASAN "Build Cycles kernels with address sanitizer when WITH_COMPILER_ASAN is on, even if it's very slow" OFF)
mark_as_advanced(WITH_CYCLES_KERNEL_ASAN) mark_as_advanced(WITH_CYCLES_KERNEL_ASAN)
mark_as_advanced(WITH_CYCLES_CUBIN_COMPILER) mark_as_advanced(WITH_CYCLES_CUBIN_COMPILER)
mark_as_advanced(WITH_CYCLES_LOGGING) mark_as_advanced(WITH_CYCLES_LOGGING)
mark_as_advanced(WITH_CYCLES_DEBUG) mark_as_advanced(WITH_CYCLES_DEBUG_NAN)
mark_as_advanced(WITH_CYCLES_NATIVE_ONLY) mark_as_advanced(WITH_CYCLES_NATIVE_ONLY)
option(WITH_CYCLES_DEVICE_CUDA "Enable Cycles CUDA compute support" ON) option(WITH_CYCLES_DEVICE_CUDA "Enable Cycles CUDA compute support" ON)
@@ -424,6 +428,10 @@ mark_as_advanced(WITH_CYCLES_NETWORK)
option(WITH_CUDA_DYNLOAD "Dynamically load CUDA libraries at runtime" ON) option(WITH_CUDA_DYNLOAD "Dynamically load CUDA libraries at runtime" ON)
mark_as_advanced(WITH_CUDA_DYNLOAD) mark_as_advanced(WITH_CUDA_DYNLOAD)
# Draw Manager
option(WITH_DRAW_DEBUG "Add extra debug capabilities to Draw Manager" OFF)
mark_as_advanced(WITH_DRAW_DEBUG)
# LLVM # LLVM
option(WITH_LLVM "Use LLVM" OFF) option(WITH_LLVM "Use LLVM" OFF)
if(APPLE) if(APPLE)

View File

@@ -63,7 +63,7 @@ Package Targets
* package_debian: Build a debian package. * package_debian: Build a debian package.
* package_pacman: Build an arch linux pacman package. * package_pacman: Build an arch linux pacman package.
* package_archive: Build an archive package. * package_archive: Build an archive package.
Testing Targets Testing Targets
Not associated with building Blender. Not associated with building Blender.
@@ -167,7 +167,7 @@ endef
# This makefile is not meant for Windows # This makefile is not meant for Windows
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
$(error On Windows, use "cmd //c make.bat" instead of "make") $(error On Windows, use "cmd //c make.bat" instead of "make")
endif endif
# System Vars # System Vars
@@ -379,7 +379,7 @@ deps: .FORCE
@cmake -H"$(DEPS_SOURCE_DIR)" \ @cmake -H"$(DEPS_SOURCE_DIR)" \
-B"$(DEPS_BUILD_DIR)" \ -B"$(DEPS_BUILD_DIR)" \
-DHARVEST_TARGET=$(DEPS_INSTALL_DIR) -DHARVEST_TARGET=$(DEPS_INSTALL_DIR)
@echo @echo
@echo Building dependencies ... @echo Building dependencies ...
@@ -456,7 +456,8 @@ project_eclipse: .FORCE
check_cppcheck: .FORCE check_cppcheck: .FORCE
$(CMAKE_CONFIG) $(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \ cd "$(BUILD_DIR)" ; \
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py" 2> \ $(PYTHON) \
"$(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py" 2> \
"$(BLENDER_DIR)/check_cppcheck.txt" "$(BLENDER_DIR)/check_cppcheck.txt"
@echo "written: check_cppcheck.txt" @echo "written: check_cppcheck.txt"
@@ -518,8 +519,9 @@ source_archive: .FORCE
python3 ./build_files/utils/make_source_archive.py python3 ./build_files/utils/make_source_archive.py
source_archive_complete: .FORCE source_archive_complete: .FORCE
cmake -S "$(BLENDER_DIR)/build_files/build_environment" -B"$(BUILD_DIR)/source_archive" \ cmake \
-DCMAKE_BUILD_TYPE_INIT:STRING=$(BUILD_TYPE) -DPACKAGE_USE_UPSTREAM_SOURCES=OFF -S "$(BLENDER_DIR)/build_files/build_environment" -B"$(BUILD_DIR)/source_archive" \
-DCMAKE_BUILD_TYPE_INIT:STRING=$(BUILD_TYPE) -DPACKAGE_USE_UPSTREAM_SOURCES=OFF
# This assumes CMake is still using a default `PACKAGE_DIR` variable: # This assumes CMake is still using a default `PACKAGE_DIR` variable:
python3 ./build_files/utils/make_source_archive.py --include-packages "$(BUILD_DIR)/source_archive/packages" python3 ./build_files/utils/make_source_archive.py --include-packages "$(BUILD_DIR)/source_archive/packages"
@@ -527,9 +529,11 @@ source_archive_complete: .FORCE
INKSCAPE_BIN?="inkscape" INKSCAPE_BIN?="inkscape"
icons: .FORCE icons: .FORCE
BLENDER_BIN=$(BLENDER_BIN) INKSCAPE_BIN=$(INKSCAPE_BIN) \ BLENDER_BIN=$(BLENDER_BIN) INKSCAPE_BIN=$(INKSCAPE_BIN) \
"$(BLENDER_DIR)/release/datafiles/blender_icons_update.py" "$(BLENDER_DIR)/release/datafiles/blender_icons_update.py"
BLENDER_BIN=$(BLENDER_BIN) INKSCAPE_BIN=$(INKSCAPE_BIN) \ INKSCAPE_BIN=$(INKSCAPE_BIN) \
"$(BLENDER_DIR)/release/datafiles/prvicons_update.py" "$(BLENDER_DIR)/release/datafiles/prvicons_update.py"
INKSCAPE_BIN=$(INKSCAPE_BIN) \
"$(BLENDER_DIR)/release/datafiles/alert_icons_update.py"
icons_geom: .FORCE icons_geom: .FORCE
BLENDER_BIN=$(BLENDER_BIN) \ BLENDER_BIN=$(BLENDER_BIN) \
@@ -543,7 +547,7 @@ update_code: .FORCE
format: .FORCE format: .FORCE
PATH="../lib/${OS_NCASE}_${CPU}/llvm/bin/:../lib/${OS_NCASE}_centos7_${CPU}/llvm/bin/:../lib/${OS_NCASE}/llvm/bin/:$(PATH)" \ PATH="../lib/${OS_NCASE}_${CPU}/llvm/bin/:../lib/${OS_NCASE}_centos7_${CPU}/llvm/bin/:../lib/${OS_NCASE}/llvm/bin/:$(PATH)" \
$(PYTHON) source/tools/utils_maintenance/clang_format_paths.py $(PATHS) $(PYTHON) source/tools/utils_maintenance/clang_format_paths.py $(PATHS)
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -553,8 +557,9 @@ format: .FORCE
# Simple version of ./doc/python_api/sphinx_doc_gen.sh with no PDF generation. # Simple version of ./doc/python_api/sphinx_doc_gen.sh with no PDF generation.
doc_py: .FORCE doc_py: .FORCE
ASAN_OPTIONS=halt_on_error=0:${ASAN_OPTIONS} \ ASAN_OPTIONS=halt_on_error=0:${ASAN_OPTIONS} \
$(BLENDER_BIN) --background -noaudio --factory-startup \ $(BLENDER_BIN) \
--python doc/python_api/sphinx_doc_gen.py --background -noaudio --factory-startup \
--python doc/python_api/sphinx_doc_gen.py
sphinx-build -b html -j $(NPROCS) doc/python_api/sphinx-in doc/python_api/sphinx-out sphinx-build -b html -j $(NPROCS) doc/python_api/sphinx-in doc/python_api/sphinx-out
@echo "docs written into: '$(BLENDER_DIR)/doc/python_api/sphinx-out/index.html'" @echo "docs written into: '$(BLENDER_DIR)/doc/python_api/sphinx-out/index.html'"
@@ -563,8 +568,9 @@ doc_doxy: .FORCE
@echo "docs written into: '$(BLENDER_DIR)/doc/doxygen/html/index.html'" @echo "docs written into: '$(BLENDER_DIR)/doc/doxygen/html/index.html'"
doc_dna: .FORCE doc_dna: .FORCE
$(BLENDER_BIN) --background -noaudio --factory-startup \ $(BLENDER_BIN) \
--python doc/blender_file_format/BlendFileDnaExporter_25.py --background -noaudio --factory-startup \
--python doc/blender_file_format/BlendFileDnaExporter_25.py
@echo "docs written into: '$(BLENDER_DIR)/doc/blender_file_format/dna.html'" @echo "docs written into: '$(BLENDER_DIR)/doc/blender_file_format/dna.html'"
doc_man: .FORCE doc_man: .FORCE

View File

@@ -82,7 +82,11 @@ if(UNIX)
endif() endif()
include(cmake/openimageio.cmake) include(cmake/openimageio.cmake)
include(cmake/tiff.cmake) include(cmake/tiff.cmake)
include(cmake/flexbison.cmake) if(WIN32)
include(cmake/flexbison.cmake)
else()
include(cmake/flex.cmake)
endif()
include(cmake/osl.cmake) include(cmake/osl.cmake)
include(cmake/tbb.cmake) include(cmake/tbb.cmake)
include(cmake/openvdb.cmake) include(cmake/openvdb.cmake)

View File

@@ -93,3 +93,4 @@ download_source(GMP)
download_source(POTRACE) download_source(POTRACE)
download_source(HARU) download_source(HARU)
download_source(ZSTD) download_source(ZSTD)
download_source(FLEX)

View File

@@ -30,6 +30,7 @@ if(WIN32)
--enable-w32threads --enable-w32threads
--disable-pthreads --disable-pthreads
--enable-libopenjpeg --enable-libopenjpeg
--disable-mediafoundation
) )
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "4") if("${CMAKE_SIZEOF_VOID_P}" EQUAL "4")
set(FFMPEG_EXTRA_FLAGS set(FFMPEG_EXTRA_FLAGS

View File

@@ -0,0 +1,28 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
ExternalProject_Add(external_flex
URL file://${PACKAGE_DIR}/${FLEX_FILE}
URL_HASH ${FLEX_HASH_TYPE}=${FLEX_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/flex
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/flex/src/external_flex/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/flex
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/flex/src/external_flex/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/flex/src/external_flex/ && make install
INSTALL_DIR ${LIBDIR}/flex
)

View File

@@ -106,6 +106,7 @@ harvest(llvm/include llvm/include "*")
harvest(llvm/bin llvm/bin "llvm-config") harvest(llvm/bin llvm/bin "llvm-config")
harvest(llvm/lib llvm/lib "libLLVM*.a") harvest(llvm/lib llvm/lib "libLLVM*.a")
harvest(llvm/lib llvm/lib "libclang*.a") harvest(llvm/lib llvm/lib "libclang*.a")
harvest(llvm/lib/clang llvm/lib/clang "*.h")
if(APPLE) if(APPLE)
harvest(openmp/lib openmp/lib "*") harvest(openmp/lib openmp/lib "*")
harvest(openmp/include openmp/include "*.h") harvest(openmp/include openmp/include "*.h")

View File

@@ -29,12 +29,13 @@ elseif(APPLE)
if("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64") if("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64")
set(ISPC_EXTRA_ARGS_APPLE set(ISPC_EXTRA_ARGS_APPLE
-DBISON_EXECUTABLE=/opt/homebrew/opt/bison/bin/bison -DBISON_EXECUTABLE=/opt/homebrew/opt/bison/bin/bison
-DFLEX_EXECUTABLE=/opt/homebrew/opt/flex/bin/flex -DFLEX_EXECUTABLE=${LIBDIR}/flex/bin/flex
-DARM_ENABLED=On -DARM_ENABLED=On
) )
else() else()
set(ISPC_EXTRA_ARGS_APPLE set(ISPC_EXTRA_ARGS_APPLE
-DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison -DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison
-DFLEX_EXECUTABLE=${LIBDIR}/flex/bin/flex
-DARM_ENABLED=Off -DARM_ENABLED=Off
) )
endif() endif()
@@ -43,6 +44,7 @@ elseif(UNIX)
-DCMAKE_C_COMPILER=${LIBDIR}/llvm/bin/clang -DCMAKE_C_COMPILER=${LIBDIR}/llvm/bin/clang
-DCMAKE_CXX_COMPILER=${LIBDIR}/llvm/bin/clang++ -DCMAKE_CXX_COMPILER=${LIBDIR}/llvm/bin/clang++
-DARM_ENABLED=Off -DARM_ENABLED=Off
-DFLEX_EXECUTABLE=${LIBDIR}/flex/bin/flex
) )
endif() endif()
@@ -82,4 +84,9 @@ if(WIN32)
external_ispc external_ispc
external_flexbison external_flexbison
) )
else()
add_dependencies(
external_ispc
external_flex
)
endif() endif()

View File

@@ -66,7 +66,11 @@ ExternalProject_Add(ll
if(MSVC) if(MSVC)
if(BUILD_MODE STREQUAL Release) if(BUILD_MODE STREQUAL Release)
set(LLVM_HARVEST_COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/ ${HARVEST_TARGET}/llvm/ ) set(LLVM_HARVEST_COMMAND
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/lib ${HARVEST_TARGET}/llvm/lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/include ${HARVEST_TARGET}/llvm/include &&
${CMAKE_COMMAND} -E copy ${LIBDIR}/llvm/bin/clang-format.exe ${HARVEST_TARGET}/llvm/bin/clang-format.exe
)
else() else()
set(LLVM_HARVEST_COMMAND set(LLVM_HARVEST_COMMAND
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/lib/ ${HARVEST_TARGET}/llvm/debug/lib/ && ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/lib/ ${HARVEST_TARGET}/llvm/debug/lib/ &&

View File

@@ -45,7 +45,6 @@ ExternalProject_Add(external_openimagedenoise
DOWNLOAD_DIR ${DOWNLOAD_DIR} DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${OIDN_HASH_TYPE}=${OIDN_HASH} URL_HASH ${OIDN_HASH_TYPE}=${OIDN_HASH}
PREFIX ${BUILD_DIR}/openimagedenoise PREFIX ${BUILD_DIR}/openimagedenoise
PATCH_COMMAND ${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/openimagedenoise/src/external_openimagedenoise < ${PATCH_DIR}/oidn.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openimagedenoise ${DEFAULT_CMAKE_FLAGS} ${OIDN_EXTRA_ARGS} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openimagedenoise ${DEFAULT_CMAKE_FLAGS} ${OIDN_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/openimagedenoise INSTALL_DIR ${LIBDIR}/openimagedenoise
) )

View File

@@ -22,9 +22,8 @@ ExternalProject_Add(external_openmp
DOWNLOAD_DIR ${DOWNLOAD_DIR} DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${OPENMP_HASH_TYPE}=${OPENMP_HASH} URL_HASH ${OPENMP_HASH_TYPE}=${OPENMP_HASH}
PREFIX ${BUILD_DIR}/openmp PREFIX ${BUILD_DIR}/openmp
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openmp/src/external_openmp < ${PATCH_DIR}/openmp.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openmp ${DEFAULT_CMAKE_FLAGS} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openmp ${DEFAULT_CMAKE_FLAGS}
INSTALL_COMMAND cd ${BUILD_DIR}/openmp/src/external_openmp-build && install_name_tool -id @executable_path/../Resources/lib/libomp.dylib runtime/src/libomp.dylib && make install INSTALL_COMMAND cd ${BUILD_DIR}/openmp/src/external_openmp-build && install_name_tool -id @rpath/libomp.dylib runtime/src/libomp.dylib && make install
INSTALL_DIR ${LIBDIR}/openmp INSTALL_DIR ${LIBDIR}/openmp
) )

View File

@@ -20,12 +20,10 @@ if(WIN32)
set(OSL_CMAKE_CXX_STANDARD_LIBRARIES "kernel32${LIBEXT} user32${LIBEXT} gdi32${LIBEXT} winspool${LIBEXT} shell32${LIBEXT} ole32${LIBEXT} oleaut32${LIBEXT} uuid${LIBEXT} comdlg32${LIBEXT} advapi32${LIBEXT} psapi${LIBEXT}") set(OSL_CMAKE_CXX_STANDARD_LIBRARIES "kernel32${LIBEXT} user32${LIBEXT} gdi32${LIBEXT} winspool${LIBEXT} shell32${LIBEXT} ole32${LIBEXT} oleaut32${LIBEXT} uuid${LIBEXT} comdlg32${LIBEXT} advapi32${LIBEXT} psapi${LIBEXT}")
set(OSL_FLEX_BISON -DFLEX_EXECUTABLE=${LIBDIR}/flexbison/win_flex.exe -DBISON_EXECUTABLE=${LIBDIR}/flexbison/win_bison.exe) set(OSL_FLEX_BISON -DFLEX_EXECUTABLE=${LIBDIR}/flexbison/win_flex.exe -DBISON_EXECUTABLE=${LIBDIR}/flexbison/win_bison.exe)
set(OSL_SIMD_FLAGS -DOIIO_NOSIMD=1 -DOIIO_SIMD=sse2) set(OSL_SIMD_FLAGS -DOIIO_NOSIMD=1 -DOIIO_SIMD=sse2)
SET(OSL_PLATFORM_FLAGS -DLINKSTATIC=ON)
else() else()
set(OSL_CMAKE_CXX_STANDARD_LIBRARIES) set(OSL_CMAKE_CXX_STANDARD_LIBRARIES)
set(OSL_FLEX_BISON) set(OSL_FLEX_BISON)
set(OSL_OPENIMAGEIO_LIBRARY "${LIBDIR}/openimageio/lib/${LIBPREFIX}OpenImageIO${LIBEXT};${LIBDIR}/openimageio/lib/${LIBPREFIX}OpenImageIO_Util${LIBEXT};${LIBDIR}/png/lib/${LIBPREFIX}png16${LIBEXT};${LIBDIR}/jpg/lib/${LIBPREFIX}jpeg${LIBEXT};${LIBDIR}/tiff/lib/${LIBPREFIX}tiff${LIBEXT};${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf${OPENEXR_VERSION_POSTFIX}${LIBEXT}") set(OSL_OPENIMAGEIO_LIBRARY "${LIBDIR}/openimageio/lib/${LIBPREFIX}OpenImageIO${LIBEXT};${LIBDIR}/openimageio/lib/${LIBPREFIX}OpenImageIO_Util${LIBEXT};${LIBDIR}/png/lib/${LIBPREFIX}png16${LIBEXT};${LIBDIR}/jpg/lib/${LIBPREFIX}jpeg${LIBEXT};${LIBDIR}/tiff/lib/${LIBPREFIX}tiff${LIBEXT};${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf${OPENEXR_VERSION_POSTFIX}${LIBEXT}")
SET(OSL_PLATFORM_FLAGS)
endif() endif()
set(OSL_ILMBASE_CUSTOM_LIBRARIES "${LIBDIR}/openexr/lib/Imath${OPENEXR_VERSION_POSTFIX}.lib^^${LIBDIR}/openexr/lib/Half{OPENEXR_VERSION_POSTFIX}.lib^^${LIBDIR}/openexr/lib/IlmThread${OPENEXR_VERSION_POSTFIX}.lib^^${LIBDIR}/openexr/lib/Iex${OPENEXR_VERSION_POSTFIX}.lib") set(OSL_ILMBASE_CUSTOM_LIBRARIES "${LIBDIR}/openexr/lib/Imath${OPENEXR_VERSION_POSTFIX}.lib^^${LIBDIR}/openexr/lib/Half{OPENEXR_VERSION_POSTFIX}.lib^^${LIBDIR}/openexr/lib/IlmThread${OPENEXR_VERSION_POSTFIX}.lib^^${LIBDIR}/openexr/lib/Iex${OPENEXR_VERSION_POSTFIX}.lib")
@@ -51,12 +49,13 @@ set(OSL_EXTRA_ARGS
-DOpenImageIO_ROOT=${LIBDIR}/openimageio/ -DOpenImageIO_ROOT=${LIBDIR}/openimageio/
-DOSL_BUILD_TESTS=OFF -DOSL_BUILD_TESTS=OFF
-DOSL_BUILD_MATERIALX=OFF -DOSL_BUILD_MATERIALX=OFF
-DPNG_ROOT=${LIBDIR}/png
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY} -DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/ -DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
${OSL_FLEX_BISON} ${OSL_FLEX_BISON}
-DCMAKE_CXX_STANDARD_LIBRARIES=${OSL_CMAKE_CXX_STANDARD_LIBRARIES} -DCMAKE_CXX_STANDARD_LIBRARIES=${OSL_CMAKE_CXX_STANDARD_LIBRARIES}
-DBUILD_SHARED_LIBS=OFF -DBUILD_SHARED_LIBS=OFF
${OSL_PLATFORM_FLAGS} -DLINKSTATIC=ON
-DOSL_BUILD_PLUGINS=OFF -DOSL_BUILD_PLUGINS=OFF
-DSTOP_ON_WARNING=OFF -DSTOP_ON_WARNING=OFF
-DUSE_LLVM_BITCODE=OFF -DUSE_LLVM_BITCODE=OFF
@@ -69,13 +68,9 @@ set(OSL_EXTRA_ARGS
${OSL_SIMD_FLAGS} ${OSL_SIMD_FLAGS}
-Dpugixml_ROOT=${LIBDIR}/pugixml -Dpugixml_ROOT=${LIBDIR}/pugixml
-DUSE_PYTHON=OFF -DUSE_PYTHON=OFF
-DCMAKE_CXX_STANDARD=14
) )
# Apple arm64 uses LLVM 11, LLVM 10+ requires C++14
if (APPLE AND "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
list(APPEND OSL_EXTRA_ARGS -DCMAKE_CXX_STANDARD=14)
endif()
ExternalProject_Add(external_osl ExternalProject_Add(external_osl
URL file://${PACKAGE_DIR}/${OSL_FILE} URL file://${PACKAGE_DIR}/${OSL_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR} DOWNLOAD_DIR ${DOWNLOAD_DIR}
@@ -93,10 +88,20 @@ add_dependencies(
ll ll
external_openexr external_openexr
external_zlib external_zlib
external_flexbison
external_openimageio external_openimageio
external_pugixml external_pugixml
) )
if(WIN32)
add_dependencies(
external_osl
external_flexbison
)
else()
add_dependencies(
external_osl
external_flex
)
endif()
if(WIN32) if(WIN32)
if(BUILD_MODE STREQUAL Release) if(BUILD_MODE STREQUAL Release)

View File

@@ -152,35 +152,20 @@ set(OPENCOLORIO_HASH 1a2e3478b6cd9a1549f24e1b2205e3f0)
set(OPENCOLORIO_HASH_TYPE MD5) set(OPENCOLORIO_HASH_TYPE MD5)
set(OPENCOLORIO_FILE OpenColorIO-${OPENCOLORIO_VERSION}.tar.gz) set(OPENCOLORIO_FILE OpenColorIO-${OPENCOLORIO_VERSION}.tar.gz)
if(BLENDER_PLATFORM_ARM) set(LLVM_VERSION 12.0.0)
# Newer version required by ISPC with arm support. set(LLVM_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.src.tar.xz)
set(LLVM_VERSION 11.0.1) set(LLVM_HASH 5a4fab4d7fc84aefffb118ac2c8a4fc0)
set(LLVM_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.src.tar.xz) set(LLVM_HASH_TYPE MD5)
set(LLVM_HASH e700af40ab83463e4e9ab0ba3708312e) set(LLVM_FILE llvm-project-${LLVM_VERSION}.src.tar.xz)
set(LLVM_HASH_TYPE MD5)
set(LLVM_FILE llvm-project-${LLVM_VERSION}.src.tar.xz)
set(OPENMP_VERSION 9.0.1) set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/openmp-${LLVM_VERSION}.src.tar.xz)
set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${OPENMP_VERSION}/openmp-${OPENMP_VERSION}.src.tar.xz) set(OPENMP_HASH ac48ce3e4582ccb82f81ab59eb3fc9dc)
set(OPENMP_HASH 6eade16057edbdecb3c4eef9daa2bfcf) set(OPENMP_HASH_TYPE MD5)
set(OPENMP_HASH_TYPE MD5) set(OPENMP_FILE openmp-${LLVM_VERSION}.src.tar.xz)
set(OPENMP_FILE openmp-${OPENMP_VERSION}.src.tar.xz)
else()
set(LLVM_VERSION 9.0.1)
set(LLVM_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.tar.xz)
set(LLVM_HASH b4268e733dfe352960140dc07ef2efcb)
set(LLVM_HASH_TYPE MD5)
set(LLVM_FILE llvm-project-${LLVM_VERSION}.tar.xz)
set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/openmp-${LLVM_VERSION}.src.tar.xz) set(OPENIMAGEIO_VERSION 2.2.15.1)
set(OPENMP_HASH 6eade16057edbdecb3c4eef9daa2bfcf)
set(OPENMP_HASH_TYPE MD5)
set(OPENMP_FILE openmp-${LLVM_VERSION}.src.tar.xz)
endif()
set(OPENIMAGEIO_VERSION 2.1.15.0)
set(OPENIMAGEIO_URI https://github.com/OpenImageIO/oiio/archive/Release-${OPENIMAGEIO_VERSION}.tar.gz) set(OPENIMAGEIO_URI https://github.com/OpenImageIO/oiio/archive/Release-${OPENIMAGEIO_VERSION}.tar.gz)
set(OPENIMAGEIO_HASH f03aa5e3ac4795af04771ee4146e9832) set(OPENIMAGEIO_HASH 3db5c5f0b3dc91597c75e5df09eb9072)
set(OPENIMAGEIO_HASH_TYPE MD5) set(OPENIMAGEIO_HASH_TYPE MD5)
set(OPENIMAGEIO_FILE OpenImageIO-${OPENIMAGEIO_VERSION}.tar.gz) set(OPENIMAGEIO_FILE OpenImageIO-${OPENIMAGEIO_VERSION}.tar.gz)
@@ -190,9 +175,9 @@ set(TIFF_HASH 2165e7aba557463acc0664e71a3ed424)
set(TIFF_HASH_TYPE MD5) set(TIFF_HASH_TYPE MD5)
set(TIFF_FILE tiff-${TIFF_VERSION}.tar.gz) set(TIFF_FILE tiff-${TIFF_VERSION}.tar.gz)
set(OSL_VERSION 1.11.10.0) set(OSL_VERSION 1.11.14.1)
set(OSL_URI https://github.com/imageworks/OpenShadingLanguage/archive/Release-${OSL_VERSION}.tar.gz) set(OSL_URI https://github.com/imageworks/OpenShadingLanguage/archive/Release-${OSL_VERSION}.tar.gz)
set(OSL_HASH dfdc23597aeef083832cbada62211756) set(OSL_HASH 1abd7ce40481771a9fa937f19595d2f2)
set(OSL_HASH_TYPE MD5) set(OSL_HASH_TYPE MD5)
set(OSL_FILE OpenShadingLanguage-${OSL_VERSION}.tar.gz) set(OSL_FILE OpenShadingLanguage-${OSL_VERSION}.tar.gz)
@@ -370,12 +355,18 @@ set(PUGIXML_HASH 0c208b0664c7fb822bf1b49ad035e8fd)
set(PUGIXML_HASH_TYPE MD5) set(PUGIXML_HASH_TYPE MD5)
set(PUGIXML_FILE pugixml-${PUGIXML_VERSION}.tar.gz) set(PUGIXML_FILE pugixml-${PUGIXML_VERSION}.tar.gz)
set(FLEXBISON_VERSION 2.5.5) set(FLEXBISON_VERSION 2.5.24)
set(FLEXBISON_URI http://prdownloads.sourceforge.net/winflexbison/win_flex_bison-${FLEXBISON_VERSION}.zip) set(FLEXBISON_URI http://prdownloads.sourceforge.net/winflexbison/win_flex_bison-${FLEXBISON_VERSION}.zip)
set(FLEXBISON_HASH d87a3938194520d904013abef3df10ce) set(FLEXBISON_HASH 6b549d43e34ece0e8ed05af92daa31c4)
set(FLEXBISON_HASH_TYPE MD5) set(FLEXBISON_HASH_TYPE MD5)
set(FLEXBISON_FILE win_flex_bison-${FLEXBISON_VERSION}.zip) set(FLEXBISON_FILE win_flex_bison-${FLEXBISON_VERSION}.zip)
set(FLEX_VERSION 2.6.4)
set(FLEX_URI https://github.com/westes/flex/releases/download/v${FLEX_VERSION}/flex-${FLEX_VERSION}.tar.gz)
set(FLEX_HASH 2882e3179748cc9f9c23ec593d6adc8d)
set(FLEX_HASH_TYPE MD5)
set(FLEX_FILE flex-${FLEX_VERSION}.tar.gz)
# Libraries to keep Python modules static on Linux. # Libraries to keep Python modules static on Linux.
# NOTE: bzip.org domain does no longer belong to BZip 2 project, so we download # NOTE: bzip.org domain does no longer belong to BZip 2 project, so we download
@@ -432,9 +423,9 @@ set(USD_HASH 1dd1e2092d085ed393c1f7c450a4155a)
set(USD_HASH_TYPE MD5) set(USD_HASH_TYPE MD5)
set(USD_FILE usd-v${USD_VERSION}.tar.gz) set(USD_FILE usd-v${USD_VERSION}.tar.gz)
set(OIDN_VERSION 1.4.0) set(OIDN_VERSION 1.4.1)
set(OIDN_URI https://github.com/OpenImageDenoise/oidn/releases/download/v${OIDN_VERSION}/oidn-${OIDN_VERSION}.src.tar.gz) set(OIDN_URI https://github.com/OpenImageDenoise/oidn/releases/download/v${OIDN_VERSION}/oidn-${OIDN_VERSION}.src.tar.gz)
set(OIDN_HASH 421824019becc5b664a22a2b98332bc5) set(OIDN_HASH df4007b0ab93b1c41cdf223b075d01c0)
set(OIDN_HASH_TYPE MD5) set(OIDN_HASH_TYPE MD5)
set(OIDN_FILE oidn-${OIDN_VERSION}.src.tar.gz) set(OIDN_FILE oidn-${OIDN_VERSION}.src.tar.gz)
@@ -444,10 +435,10 @@ set(LIBGLU_HASH 151aef599b8259efe9acd599c96ea2a3)
set(LIBGLU_HASH_TYPE MD5) set(LIBGLU_HASH_TYPE MD5)
set(LIBGLU_FILE glu-${LIBGLU_VERSION}.tar.xz) set(LIBGLU_FILE glu-${LIBGLU_VERSION}.tar.xz)
set(MESA_VERSION 20.3.4) set(MESA_VERSION 21.1.5)
set(MESA_URI ftp://ftp.freedesktop.org/pub/mesa/mesa-${MESA_VERSION}.tar.xz) set(MESA_URI ftp://ftp.freedesktop.org/pub/mesa/mesa-${MESA_VERSION}.tar.xz)
set(MESA_HASH 556338446aef8ae947a789b3e0b5e056) set(MESA_HASH 022c7293074aeeced2278c872db4fa693147c70f8595b076cf3f1ef81520766d)
set(MESA_HASH_TYPE MD5) set(MESA_HASH_TYPE SHA256)
set(MESA_FILE mesa-${MESA_VERSION}.tar.xz) set(MESA_FILE mesa-${MESA_VERSION}.tar.xz)
set(NASM_VERSION 2.15.02) set(NASM_VERSION 2.15.02)
@@ -468,19 +459,11 @@ set(WL_PROTOCOLS_URI https://gitlab.freedesktop.org/wayland/wayland-protocols/-/
set(WL_PROTOCOLS_HASH af5ca07e13517cdbab33504492cef54a) set(WL_PROTOCOLS_HASH af5ca07e13517cdbab33504492cef54a)
set(WL_PROTOCOLS_HASH_TYPE MD5) set(WL_PROTOCOLS_HASH_TYPE MD5)
if(BLENDER_PLATFORM_ARM) set(ISPC_VERSION v1.16.0)
# Unreleased version with macOS arm support. set(ISPC_URI https://github.com/ispc/ispc/archive/${ISPC_VERSION}.tar.gz)
set(ISPC_URI https://github.com/ispc/ispc/archive/f5949c055eb9eeb93696978a3da4bfb3a6a30b35.zip) set(ISPC_HASH 2e3abedbc0ea9aaec17d6562c632454d)
set(ISPC_HASH d382fea18d01dbd0cd05d9e1ede36d7d) set(ISPC_HASH_TYPE MD5)
set(ISPC_HASH_TYPE MD5) set(ISPC_FILE ispc-${ISPC_VERSION}.tar.gz)
set(ISPC_FILE f5949c055eb9eeb93696978a3da4bfb3a6a30b35.zip)
else()
set(ISPC_VERSION v1.14.1)
set(ISPC_URI https://github.com/ispc/ispc/archive/${ISPC_VERSION}.tar.gz)
set(ISPC_HASH 968fbc8dfd16a60ba4e32d2e0e03ea7a)
set(ISPC_HASH_TYPE MD5)
set(ISPC_FILE ispc-${ISPC_VERSION}.tar.gz)
endif()
set(GMP_VERSION 6.2.0) set(GMP_VERSION 6.2.0)
set(GMP_URI https://gmplib.org/download/gmp/gmp-${GMP_VERSION}.tar.xz) set(GMP_URI https://gmplib.org/download/gmp/gmp-${GMP_VERSION}.tar.xz)

View File

@@ -474,25 +474,25 @@ OPENEXR_FORCE_REBUILD=false
OPENEXR_SKIP=false OPENEXR_SKIP=false
_with_built_openexr=false _with_built_openexr=false
OIIO_VERSION="2.1.15.0" OIIO_VERSION="2.2.15.1"
OIIO_VERSION_SHORT="2.1" OIIO_VERSION_SHORT="2.2"
OIIO_VERSION_MIN="2.1.12" OIIO_VERSION_MIN="2.1.12"
OIIO_VERSION_MAX="2.2.10" OIIO_VERSION_MAX="2.3.0"
OIIO_FORCE_BUILD=false OIIO_FORCE_BUILD=false
OIIO_FORCE_REBUILD=false OIIO_FORCE_REBUILD=false
OIIO_SKIP=false OIIO_SKIP=false
LLVM_VERSION="9.0.1" LLVM_VERSION="12.0.0"
LLVM_VERSION_SHORT="9.0" LLVM_VERSION_SHORT="12.0"
LLVM_VERSION_MIN="6.0" LLVM_VERSION_MIN="11.0"
LLVM_VERSION_MAX="12.0" LLVM_VERSION_MAX="13.0"
LLVM_VERSION_FOUND="" LLVM_VERSION_FOUND=""
LLVM_FORCE_BUILD=false LLVM_FORCE_BUILD=false
LLVM_FORCE_REBUILD=false LLVM_FORCE_REBUILD=false
LLVM_SKIP=false LLVM_SKIP=false
# OSL needs to be compiled for now! # OSL needs to be compiled for now!
OSL_VERSION="1.11.10.0" OSL_VERSION="1.11.14.1"
OSL_VERSION_SHORT="1.11" OSL_VERSION_SHORT="1.11"
OSL_VERSION_MIN="1.11" OSL_VERSION_MIN="1.11"
OSL_VERSION_MAX="2.0" OSL_VERSION_MAX="2.0"
@@ -553,7 +553,7 @@ EMBREE_FORCE_BUILD=false
EMBREE_FORCE_REBUILD=false EMBREE_FORCE_REBUILD=false
EMBREE_SKIP=false EMBREE_SKIP=false
OIDN_VERSION="1.4.0" OIDN_VERSION="1.4.1"
OIDN_VERSION_SHORT="1.4" OIDN_VERSION_SHORT="1.4"
OIDN_VERSION_MIN="1.4.0" OIDN_VERSION_MIN="1.4.0"
OIDN_VERSION_MAX="1.5" OIDN_VERSION_MAX="1.5"
@@ -561,7 +561,7 @@ OIDN_FORCE_BUILD=false
OIDN_FORCE_REBUILD=false OIDN_FORCE_REBUILD=false
OIDN_SKIP=false OIDN_SKIP=false
ISPC_VERSION="1.14.1" ISPC_VERSION="1.16.0"
FFMPEG_VERSION="4.4" FFMPEG_VERSION="4.4"
FFMPEG_VERSION_SHORT="4.4" FFMPEG_VERSION_SHORT="4.4"
@@ -1129,7 +1129,7 @@ Those libraries should be available as packages in all recent distributions (opt
* libjpeg, libpng, libtiff, [openjpeg2], [libopenal]. * libjpeg, libpng, libtiff, [openjpeg2], [libopenal].
* libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed). * libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed).
* libwayland-client0, libwayland-cursor0, libwayland-egl1, libxkbcommon0, libdbus-1-3, libegl1 (Wayland) * libwayland-client0, libwayland-cursor0, libwayland-egl1, libxkbcommon0, libdbus-1-3, libegl1 (Wayland)
* libsqlite3, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp. * libsqlite3, libzstd, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp, flex.
* libsdl2, libglew, libpugixml, libpotrace, [libgmp], [libglewmx], fontconfig, [libharu/libhpdf].\"" * libsdl2, libglew, libpugixml, libpotrace, [libgmp], [libglewmx], fontconfig, [libharu/libhpdf].\""
DEPS_SPECIFIC_INFO="\"BUILDABLE DEPENDENCIES: DEPS_SPECIFIC_INFO="\"BUILDABLE DEPENDENCIES:
@@ -1447,9 +1447,7 @@ compile_Python() {
make -j$THREADS && make install make -j$THREADS && make install
make clean make clean
if [ -d $_inst ]; then if [ ! -d $_inst ]; then
_create_inst_shortcut
else
ERROR "Python--$PYTHON_VERSION failed to compile, exiting" ERROR "Python--$PYTHON_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -1465,6 +1463,9 @@ compile_Python() {
INFO "If you want to force rebuild of this lib, use the --force-python option." INFO "If you want to force rebuild of this lib, use the --force-python option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "python-$PYTHON_VERSION_SHORT" run_ldconfig "python-$PYTHON_VERSION_SHORT"
# Extra step: install required modules with pip. # Extra step: install required modules with pip.
@@ -1558,9 +1559,7 @@ compile_Boost() {
--prefix=$_inst --disable-icu boost.locale.icu=off install --prefix=$_inst --disable-icu boost.locale.icu=off install
./b2 --clean ./b2 --clean
if [ -d $_inst ]; then if [ ! -d $_inst ]; then
_create_inst_shortcut
else
ERROR "Boost-$BOOST_VERSION failed to compile, exiting" ERROR "Boost-$BOOST_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -1574,7 +1573,9 @@ compile_Boost() {
INFO "If you want to force rebuild of this lib, use the --force-boost option." INFO "If you want to force rebuild of this lib, use the --force-boost option."
fi fi
# Just always run it, much simpler this way! if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "boost" run_ldconfig "boost"
} }
@@ -1687,9 +1688,7 @@ compile_TBB() {
make clean make clean
if [ -d $_inst ]; then if [ ! -d $_inst ]; then
_create_inst_shortcut
else
ERROR "TBB-$TBB_VERSION$TBB_VERSION_UPDATE failed to compile, exiting" ERROR "TBB-$TBB_VERSION$TBB_VERSION_UPDATE failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -1703,6 +1702,9 @@ compile_TBB() {
INFO "If you want to force rebuild of this lib, use the --force-tbb option." INFO "If you want to force rebuild of this lib, use the --force-tbb option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "tbb" run_ldconfig "tbb"
} }
@@ -1822,9 +1824,7 @@ compile_OCIO() {
make clean make clean
if [ -d $_inst ]; then if [ ! -d $_inst ]; then
_create_inst_shortcut
else
ERROR "OpenColorIO-$OCIO_VERSION failed to compile, exiting" ERROR "OpenColorIO-$OCIO_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -1838,6 +1838,9 @@ compile_OCIO() {
INFO "If you want to force rebuild of this lib, use the --force-ocio option." INFO "If you want to force rebuild of this lib, use the --force-ocio option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "ocio" run_ldconfig "ocio"
} }
@@ -1953,9 +1956,7 @@ compile_OPENEXR() {
make clean make clean
if [ -d $_inst ]; then if [ ! -d $_inst ]; then
_create_inst_shortcut
else
ERROR "OpenEXR-$OPENEXR_VERSION failed to compile, exiting" ERROR "OpenEXR-$OPENEXR_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -1971,7 +1972,9 @@ compile_OPENEXR() {
_with_built_openexr=true _with_built_openexr=true
# Just always run it, much simpler this way! if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "openexr" run_ldconfig "openexr"
} }
@@ -2112,9 +2115,7 @@ compile_OIIO() {
make -j$THREADS && make install make -j$THREADS && make install
make clean make clean
if [ -d $_inst ]; then if [ ! -d $_inst ]; then
_create_inst_shortcut
else
ERROR "OpenImageIO-$OIIO_VERSION failed to compile, exiting" ERROR "OpenImageIO-$OIIO_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -2128,7 +2129,9 @@ compile_OIIO() {
INFO "If you want to force rebuild of this lib, use the --force-oiio option." INFO "If you want to force rebuild of this lib, use the --force-oiio option."
fi fi
# Just always run it, much simpler this way! if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "oiio" run_ldconfig "oiio"
} }
@@ -2237,9 +2240,7 @@ compile_LLVM() {
make -j$THREADS && make install make -j$THREADS && make install
make clean make clean
if [ -d $_inst ]; then if [ ! -d $_inst ]; then
_create_inst_shortcut
else
ERROR "LLVM-$LLVM_VERSION failed to compile, exiting" ERROR "LLVM-$LLVM_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -2252,6 +2253,10 @@ compile_LLVM() {
INFO "Own LLVM-$LLVM_VERSION (CLANG included) is up to date, nothing to do!" INFO "Own LLVM-$LLVM_VERSION (CLANG included) is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-llvm option." INFO "If you want to force rebuild of this lib, use the --force-llvm option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
} }
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
@@ -2316,6 +2321,7 @@ compile_OSL() {
tar -C $SRC --transform "s,(.*/?)OpenShadingLanguage-[^/]*(.*),\1OpenShadingLanguage-$OSL_VERSION\2,x" \ tar -C $SRC --transform "s,(.*/?)OpenShadingLanguage-[^/]*(.*),\1OpenShadingLanguage-$OSL_VERSION\2,x" \
-xf $_src.tar.gz -xf $_src.tar.gz
fi fi
patch -d $_src -p1 < $SCRIPT_DIR/patches/osl.diff
fi fi
cd $_src cd $_src
@@ -2338,7 +2344,6 @@ compile_OSL() {
cmake_d="-D CMAKE_BUILD_TYPE=Release" cmake_d="-D CMAKE_BUILD_TYPE=Release"
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst" cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
cmake_d="$cmake_d -D BUILD_TESTING=OFF"
cmake_d="$cmake_d -D STOP_ON_WARNING=OFF" cmake_d="$cmake_d -D STOP_ON_WARNING=OFF"
cmake_d="$cmake_d -D OSL_BUILD_PLUGINS=OFF" cmake_d="$cmake_d -D OSL_BUILD_PLUGINS=OFF"
cmake_d="$cmake_d -D OSL_BUILD_TESTS=OFF" cmake_d="$cmake_d -D OSL_BUILD_TESTS=OFF"
@@ -2346,7 +2351,10 @@ compile_OSL() {
cmake_d="$cmake_d -D USE_PARTIO=OFF" cmake_d="$cmake_d -D USE_PARTIO=OFF"
cmake_d="$cmake_d -D OSL_BUILD_MATERIALX=OFF" cmake_d="$cmake_d -D OSL_BUILD_MATERIALX=OFF"
cmake_d="$cmake_d -D USE_QT=OFF" cmake_d="$cmake_d -D USE_QT=OFF"
cmake_d="$cmake_d -D USE_Qt5=OFF"
cmake_d="$cmake_d -D USE_PYTHON=OFF" cmake_d="$cmake_d -D USE_PYTHON=OFF"
cmake_d="$cmake_d -D USE_PARTIO=OFF"
cmake_d="$cmake_d -D INSTALL_DOCS=OFF"
if [ $(uname -m) != "aarch64" ]; then if [ $(uname -m) != "aarch64" ]; then
cmake_d="$cmake_d -D USE_SIMD=sse2" cmake_d="$cmake_d -D USE_SIMD=sse2"
@@ -2368,10 +2376,7 @@ compile_OSL() {
fi fi
if [ -d $INST/oiio ]; then if [ -d $INST/oiio ]; then
cmake_d="$cmake_d -D OPENIMAGEIO_ROOT_DIR=$INST/oiio" cmake_d="$cmake_d -D OpenImageIO_ROOT=$INST/oiio"
# HACK! SIC!!!!
# Quiet incredible, but if root dir is given, path to lib is found, but not path to include...
cmake_d="$cmake_d -D OPENIMAGEIO_INCLUDE_DIR=$INST/oiio/include"
fi fi
if [ ! -z $LLVM_VERSION_FOUND ]; then if [ ! -z $LLVM_VERSION_FOUND ]; then
@@ -2390,9 +2395,7 @@ compile_OSL() {
make -j$THREADS && make install make -j$THREADS && make install
make clean make clean
if [ -d $_inst ]; then if [ ! -d $_inst ]; then
_create_inst_shortcut
else
ERROR "OpenShadingLanguage-$OSL_VERSION failed to compile, exiting" ERROR "OpenShadingLanguage-$OSL_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -2406,6 +2409,9 @@ compile_OSL() {
INFO "If you want to force rebuild of this lib, use the --force-osl option." INFO "If you want to force rebuild of this lib, use the --force-osl option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "osl" run_ldconfig "osl"
} }
@@ -2506,9 +2512,7 @@ compile_OSD() {
make -j$THREADS && make install make -j$THREADS && make install
make clean make clean
if [ -d $_inst ]; then if [ ! -d $_inst ]; then
_create_inst_shortcut
else
ERROR "OpenSubdiv-$OSD_VERSION failed to compile, exiting" ERROR "OpenSubdiv-$OSD_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -2522,6 +2526,9 @@ compile_OSD() {
INFO "If you want to force rebuild of this lib, use the --force-osd option." INFO "If you want to force rebuild of this lib, use the --force-osd option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "osd" run_ldconfig "osd"
} }
@@ -2611,9 +2618,7 @@ compile_BLOSC() {
make clean make clean
if [ -d $_inst ]; then if [ ! -d $_inst ]; then
_create_inst_shortcut
else
ERROR "Blosc-$OPENVDB_BLOSC_VERSION failed to compile, exiting" ERROR "Blosc-$OPENVDB_BLOSC_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -2626,6 +2631,9 @@ compile_BLOSC() {
magic_compile_set blosc-$OPENVDB_BLOSC_VERSION $blosc_magic magic_compile_set blosc-$OPENVDB_BLOSC_VERSION $blosc_magic
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "blosc" run_ldconfig "blosc"
} }
@@ -2716,9 +2724,7 @@ install_NanoVDB() {
#~ mkdir -p $_inst #~ mkdir -p $_inst
#~ cp -r $_src/include $_inst/include #~ cp -r $_src/include $_inst/include
if [ -d $_inst ]; then if [ ! -d $_inst ]; then
_create_inst_shortcut
else
ERROR "NanoVDB-v$OPENVDB_VERSION failed to install, exiting" ERROR "NanoVDB-v$OPENVDB_VERSION failed to install, exiting"
exit 1 exit 1
fi fi
@@ -2730,6 +2736,10 @@ install_NanoVDB() {
else else
INFO "Own NanoVDB-v$OPENVDB_VERSION is up to date, nothing to do!" INFO "Own NanoVDB-v$OPENVDB_VERSION is up to date, nothing to do!"
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
} }
@@ -2849,9 +2859,7 @@ compile_OPENVDB() {
make -j$THREADS install make -j$THREADS install
make clean make clean
if [ -d $_inst ]; then if [ ! -d $_inst ]; then
_create_inst_shortcut
else
ERROR "OpenVDB-$OPENVDB_VERSION failed to compile, exiting" ERROR "OpenVDB-$OPENVDB_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -2865,6 +2873,9 @@ compile_OPENVDB() {
INFO "If you want to force rebuild of this lib, use the --force-openvdb option." INFO "If you want to force rebuild of this lib, use the --force-openvdb option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "openvdb" run_ldconfig "openvdb"
if [ "$WITH_NANOVDB" = true ]; then if [ "$WITH_NANOVDB" = true ]; then
@@ -2962,9 +2973,7 @@ compile_ALEMBIC() {
make -j$THREADS install make -j$THREADS install
make clean make clean
if [ -d $_inst ]; then if [ ! -d $_inst ]; then
_create_inst_shortcut
else
ERROR "Alembic-$ALEMBIC_VERSION failed to compile, exiting" ERROR "Alembic-$ALEMBIC_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -2978,6 +2987,9 @@ compile_ALEMBIC() {
INFO "If you want to force rebuild of this lib, use the --force-alembic option." INFO "If you want to force rebuild of this lib, use the --force-alembic option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "alembic" run_ldconfig "alembic"
} }
@@ -3062,9 +3074,7 @@ compile_USD() {
make -j$THREADS install make -j$THREADS install
make clean make clean
if [ -d $_inst ]; then if [ ! -d $_inst ]; then
_create_inst_shortcut
else
ERROR "USD-$USD_VERSION failed to compile, exiting" ERROR "USD-$USD_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -3078,6 +3088,9 @@ compile_USD() {
INFO "If you want to force rebuild of this lib, use the --force-usd option." INFO "If you want to force rebuild of this lib, use the --force-usd option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "usd" run_ldconfig "usd"
} }
@@ -3171,9 +3184,7 @@ compile_OpenCOLLADA() {
make -j$THREADS && make install make -j$THREADS && make install
make clean make clean
if [ -d $_inst ]; then if [ ! -d $_inst ]; then
_create_inst_shortcut
else
ERROR "OpenCOLLADA-$OPENCOLLADA_VERSION failed to compile, exiting" ERROR "OpenCOLLADA-$OPENCOLLADA_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -3186,6 +3197,10 @@ compile_OpenCOLLADA() {
INFO "Own OpenCOLLADA-$OPENCOLLADA_VERSION is up to date, nothing to do!" INFO "Own OpenCOLLADA-$OPENCOLLADA_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-opencollada option." INFO "If you want to force rebuild of this lib, use the --force-opencollada option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
} }
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
@@ -3286,9 +3301,7 @@ compile_Embree() {
make -j$THREADS && make install make -j$THREADS && make install
make clean make clean
if [ -d $_inst ]; then if [ ! -d $_inst ]; then
_create_inst_shortcut
else
ERROR "Embree-$EMBREE_VERSION failed to compile, exiting" ERROR "Embree-$EMBREE_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -3301,6 +3314,10 @@ compile_Embree() {
INFO "Own Embree-$EMBREE_VERSION is up to date, nothing to do!" INFO "Own Embree-$EMBREE_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-embree option." INFO "If you want to force rebuild of this lib, use the --force-embree option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
} }
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
@@ -3363,9 +3380,7 @@ install_ISPC() {
mkdir -p $_inst mkdir -p $_inst
cp -r $_src/bin $_inst/bin cp -r $_src/bin $_inst/bin
if [ -d $_inst ]; then if [ ! -d $_inst ]; then
_create_inst_shortcut
else
ERROR "ISPC-v$ISPC_VERSION failed to install, exiting" ERROR "ISPC-v$ISPC_VERSION failed to install, exiting"
exit 1 exit 1
fi fi
@@ -3378,6 +3393,10 @@ install_ISPC() {
INFO "Own ISPC-v$ISPC_VERSION is up to date, nothing to do!" INFO "Own ISPC-v$ISPC_VERSION is up to date, nothing to do!"
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
_ispc_path_bin=$_inst/bin _ispc_path_bin=$_inst/bin
run_ldconfig "ispc" run_ldconfig "ispc"
} }
@@ -3477,9 +3496,7 @@ compile_OIDN() {
make -j$THREADS && make install make -j$THREADS && make install
make clean make clean
if [ -d $_inst ]; then if [ ! -d $_inst ]; then
_create_inst_shortcut
else
ERROR "OpenImageDenoise-$OIDN_VERSION failed to compile, exiting" ERROR "OpenImageDenoise-$OIDN_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -3493,6 +3510,9 @@ compile_OIDN() {
INFO "If you want to force rebuild of this lib, use the --force-oidn option." INFO "If you want to force rebuild of this lib, use the --force-oidn option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "oidn" run_ldconfig "oidn"
} }
@@ -3609,9 +3629,7 @@ compile_FFmpeg() {
make -j$THREADS && make install make -j$THREADS && make install
make clean make clean
if [ -d $_inst ]; then if [ ! -d $_inst ]; then
_create_inst_shortcut
else
ERROR "FFmpeg-$FFMPEG_VERSION failed to compile, exiting" ERROR "FFmpeg-$FFMPEG_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -3624,6 +3642,10 @@ compile_FFmpeg() {
INFO "Own ffmpeg-$FFMPEG_VERSION is up to date, nothing to do!" INFO "Own ffmpeg-$FFMPEG_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-ffmpeg option." INFO "If you want to force rebuild of this lib, use the --force-ffmpeg option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
} }
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
@@ -3722,9 +3744,7 @@ compile_XR_OpenXR_SDK() {
make -j$THREADS && make install make -j$THREADS && make install
make clean make clean
if [ -d $_inst ]; then if [ ! -d $_inst ]; then
_create_inst_shortcut
else
ERROR "XR-OpenXR-SDK-$XR_OPENXR_VERSION failed to compile, exiting" ERROR "XR-OpenXR-SDK-$XR_OPENXR_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -3738,6 +3758,9 @@ compile_XR_OpenXR_SDK() {
INFO "If you want to force rebuild of this lib, use the --force-xr-openxr option." INFO "If you want to force rebuild of this lib, use the --force-xr-openxr option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "xr-openxr-sdk" run_ldconfig "xr-openxr-sdk"
} }
@@ -3844,7 +3867,7 @@ install_DEB() {
libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev \ libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev \
libopenal-dev libglew-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \ libopenal-dev libglew-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \
libsdl2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libjemalloc-dev \ libsdl2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libjemalloc-dev \
libgmp-dev libpugixml-dev libpotrace-dev libhpdf-dev" libgmp-dev libpugixml-dev libpotrace-dev libhpdf-dev libzstd-dev"
# libglewmx-dev (broken in deb testing currently...) # libglewmx-dev (broken in deb testing currently...)
VORBIS_USE=true VORBIS_USE=true
@@ -4112,6 +4135,8 @@ install_DEB() {
PRINT "" PRINT ""
# Debian OIIO includes again libopencv, without even properly dealing with this dependency...
OIIO_FORCE_BUILD=true
if [ "$OIIO_SKIP" = true ]; then if [ "$OIIO_SKIP" = true ]; then
WARNING "Skipping OpenImageIO installation, as requested..." WARNING "Skipping OpenImageIO installation, as requested..."
elif [ "$OIIO_FORCE_BUILD" = true ]; then elif [ "$OIIO_FORCE_BUILD" = true ]; then
@@ -4514,7 +4539,7 @@ install_RPM() {
wget ncurses-devel readline-devel $OPENJPEG_DEV openal-soft-devel \ wget ncurses-devel readline-devel $OPENJPEG_DEV openal-soft-devel \
glew-devel yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV patch \ glew-devel yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV patch \
libxml2-devel yaml-cpp-devel tinyxml-devel jemalloc-devel \ libxml2-devel yaml-cpp-devel tinyxml-devel jemalloc-devel \
gmp-devel pugixml-devel potrace-devel libharu-devel" gmp-devel pugixml-devel potrace-devel libharu-devel libzstd-devel"
OPENJPEG_USE=true OPENJPEG_USE=true
VORBIS_USE=true VORBIS_USE=true
@@ -5092,10 +5117,11 @@ install_ARCH() {
BASE_DEVEL=`pacman -Sgq base-devel | sed -e 's/^gcc$/gcc-multilib/g' | paste -s -d' '` BASE_DEVEL=`pacman -Sgq base-devel | sed -e 's/^gcc$/gcc-multilib/g' | paste -s -d' '`
fi fi
_packages="$BASE_DEVEL git cmake fontconfig \ _packages="$BASE_DEVEL git cmake fontconfig flex \
libxi libxcursor libxrandr libxinerama glew libpng libtiff wget openal \ libxi libxcursor libxrandr libxinerama glew libpng libtiff wget openal \
$OPENJPEG_DEV $VORBIS_DEV $OGG_DEV $THEORA_DEV yasm sdl2 fftw \ $OPENJPEG_DEV $VORBIS_DEV $OGG_DEV $THEORA_DEV yasm sdl2 fftw \
libxml2 yaml-cpp tinyxml python-requests jemalloc gmp potrace pugixml libharu" libxml2 yaml-cpp tinyxml python-requests jemalloc gmp potrace pugixml libharu \
zstd"
OPENJPEG_USE=true OPENJPEG_USE=true
VORBIS_USE=true VORBIS_USE=true

View File

@@ -1,10 +0,0 @@
--- external_openimagedenoise/cmake/oidn_ispc.cmake 2021-02-15 17:29:34.000000000 +0100
+++ external_openimagedenoise/cmake/oidn_ispc.cmake2 2021-02-15 17:29:28.000000000 +0100
@@ -98,7 +98,7 @@
elseif(OIDN_ARCH STREQUAL "ARM64")
set(ISPC_ARCHITECTURE "aarch64")
if(APPLE)
- set(ISPC_TARGET_OS "--target-os=ios")
+ set(ISPC_TARGET_OS "--target-os=macos")
endif()
endif()

View File

@@ -34,24 +34,3 @@ diff -Naur orig/src/include/OpenImageIO/platform.h external_openimageio/src/incl
# include <windows.h> # include <windows.h>
#endif #endif
diff -Naur orig/src/libutil/ustring.cpp external_openimageio/src/libutil/ustring.cpp
--- orig/src/libutil/ustring.cpp 2020-05-11 05:43:52.000000000 +0200
+++ external_openimageio/src/libutil/ustring.cpp 2020-11-26 12:06:08.000000000 +0100
@@ -337,6 +337,8 @@
// the std::string to make it point to our chars! In such a case, the
// destructor will be careful not to allow a deallocation.
+ // Disable internal std::string for Apple silicon based Macs
+#if !(defined(__APPLE__) && defined(__arm64__))
#if defined(__GNUC__) && !defined(_LIBCPP_VERSION) \
&& defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI
// NEW gcc ABI
@@ -382,7 +384,7 @@
return;
}
#endif
-
+#endif
// Remaining cases - just assign the internal string. This may result
// in double allocation for the chars. If you care about that, do
// something special for your platform, much like we did for gcc and

View File

@@ -1,23 +0,0 @@
diff --git a/runtime/src/z_Linux_asm.S b/runtime/src/z_Linux_asm.S
index 0d8885e..42aa5ad 100644
--- a/runtime/src/z_Linux_asm.S
+++ b/runtime/src/z_Linux_asm.S
@@ -1540,10 +1540,12 @@ __kmp_unnamed_critical_addr:
.comm .gomp_critical_user_,32,8
.data
.align 8
- .global __kmp_unnamed_critical_addr
-__kmp_unnamed_critical_addr:
+ .global ___kmp_unnamed_critical_addr
+___kmp_unnamed_critical_addr:
.8byte .gomp_critical_user_
- .size __kmp_unnamed_critical_addr,8
+# if !(KMP_OS_DARWIN)
+ .size ___kmp_unnamed_critical_addr,8
+# endif
#endif /* KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 */
#if KMP_OS_LINUX

View File

@@ -1,18 +1,3 @@
diff -Naur OpenShadingLanguage-Release-1.9.9/src/cmake/flexbison.cmake.rej external_osl/src/cmake/flexbison.cmake.rej
--- OpenShadingLanguage-Release-1.9.9/src/cmake/flexbison.cmake.rej 1969-12-31 17:00:00 -0700
+++ external_osl/src/cmake/flexbison.cmake.rej 2018-08-24 17:42:11 -0600
@@ -0,0 +1,11 @@
+--- src/cmake/flexbison.cmake 2018-05-01 16:39:02 -0600
++++ src/cmake/flexbison.cmake 2018-08-24 10:24:03 -0600
+@@ -77,7 +77,7 @@
+ DEPENDS ${${compiler_headers}}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
+ ADD_CUSTOM_COMMAND ( OUTPUT ${flexoutputcxx}
+- COMMAND ${FLEX_EXECUTABLE} -o ${flexoutputcxx} "${CMAKE_CURRENT_SOURCE_DIR}/${flexsrc}"
++ COMMAND ${FLEX_EXECUTABLE} ${FLEX_EXTRA_OPTIONS} -o ${flexoutputcxx} "${CMAKE_CURRENT_SOURCE_DIR}/${flexsrc}"
+ MAIN_DEPENDENCY ${flexsrc}
+ DEPENDS ${${compiler_headers}}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
diff -Naur OpenShadingLanguage-Release-1.9.9/src/include/OSL/llvm_util.h external_osl/src/include/OSL/llvm_util.h diff -Naur OpenShadingLanguage-Release-1.9.9/src/include/OSL/llvm_util.h external_osl/src/include/OSL/llvm_util.h
--- OpenShadingLanguage-Release-1.9.9/src/include/OSL/llvm_util.h 2018-05-01 16:39:02 -0600 --- OpenShadingLanguage-Release-1.9.9/src/include/OSL/llvm_util.h 2018-05-01 16:39:02 -0600
+++ external_osl/src/include/OSL/llvm_util.h 2018-08-25 14:05:00 -0600 +++ external_osl/src/include/OSL/llvm_util.h 2018-08-25 14:05:00 -0600
@@ -63,19 +48,50 @@ diff -Naur org/CMakeLists.txt external_osl/CMakeLists.txt
set (OSL_NO_DEFAULT_TEXTURESYSTEM OFF CACHE BOOL "Do not use create a raw OIIO::TextureSystem") set (OSL_NO_DEFAULT_TEXTURESYSTEM OFF CACHE BOOL "Do not use create a raw OIIO::TextureSystem")
if (OSL_NO_DEFAULT_TEXTURESYSTEM) if (OSL_NO_DEFAULT_TEXTURESYSTEM)
diff --git a/src/liboslexec/llvm_util.cpp b/src/liboslexec/llvm_util.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt
index 445f6400..3d468de2 100644 index 990f50d69..46ef7351d 100644
--- a/src/liboslexec/llvm_util.cpp --- a/CMakeLists.txt
+++ b/src/liboslexec/llvm_util.cpp +++ b/CMakeLists.txt
@@ -3430,8 +3430,9 @@ LLVM_Util::call_function (llvm::Value *func, cspan<llvm::Value *> args) @@ -252,11 +252,9 @@ install (EXPORT OSL_EXPORTED_TARGETS
#endif FILE ${OSL_TARGETS_EXPORT_NAME}
//llvm_gen_debug_printf (std::string("start ") + std::string(name)); NAMESPACE ${PROJECT_NAME}::)
#if OSL_LLVM_VERSION >= 110
- OSL_DASSERT(llvm::isa<llvm::Function>(func)); -
- llvm::Value *r = builder().CreateCall(llvm::cast<llvm::Function>(func), llvm::ArrayRef<llvm::Value *>(args.data(), args.size())); -
+ llvm::Value* r = builder().CreateCall( -
+ llvm::cast<llvm::FunctionType>(func->getType()->getPointerElementType()), func, -osl_add_all_tests()
+ llvm::ArrayRef<llvm::Value*>(args.data(), args.size())); -
#else +if (${PROJECT_NAME}_BUILD_TESTS AND NOT ${PROJECT_NAME}_IS_SUBPROJECT)
llvm::Value *r = builder().CreateCall (func, llvm::ArrayRef<llvm::Value *>(args.data(), args.size())); + osl_add_all_tests()
+endif ()
if (NOT ${PROJECT_NAME}_IS_SUBPROJECT)
include (packaging)
diff -Naur external_osl_orig/src/cmake/externalpackages.cmake external_osl/src/cmake/externalpackages.cmake
--- external_osl_orig/src/cmake/externalpackages.cmake 2021-06-01 13:44:18 -0600
+++ external_osl/src/cmake/externalpackages.cmake 2021-06-28 07:44:32 -0600
@@ -80,6 +80,7 @@
checked_find_package (ZLIB REQUIRED) # Needed by several packages
+checked_find_package (PNG REQUIRED) # Needed since OIIO needs it
# IlmBase & OpenEXR
checked_find_package (OpenEXR REQUIRED
diff -Naur external_osl_orig/src/liboslcomp/oslcomp.cpp external_osl/src/liboslcomp/oslcomp.cpp
--- external_osl_orig/src/liboslcomp/oslcomp.cpp 2021-06-01 13:44:18 -0600
+++ external_osl/src/liboslcomp/oslcomp.cpp 2021-06-28 09:11:06 -0600
@@ -21,6 +21,13 @@
#if !defined(__STDC_CONSTANT_MACROS)
# define __STDC_CONSTANT_MACROS 1
#endif #endif
+
+// clang uses CALLBACK in its templates which causes issues if it is already defined
+#ifdef _WIN32 && defined(CALLBACK)
+# undef CALLBACK
+#endif
+
+//
#include <clang/Basic/TargetInfo.h>
#include <clang/Frontend/CompilerInstance.h>
#include <clang/Frontend/TextDiagnosticPrinter.h>

View File

@@ -7,7 +7,6 @@
set(WITH_ASSERT_ABORT ON CACHE BOOL "" FORCE) set(WITH_ASSERT_ABORT ON CACHE BOOL "" FORCE)
set(WITH_BUILDINFO OFF CACHE BOOL "" FORCE) set(WITH_BUILDINFO OFF CACHE BOOL "" FORCE)
set(WITH_COMPILER_ASAN ON CACHE BOOL "" FORCE) set(WITH_COMPILER_ASAN ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_DEBUG ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_NATIVE_ONLY ON CACHE BOOL "" FORCE) set(WITH_CYCLES_NATIVE_ONLY ON CACHE BOOL "" FORCE)
set(WITH_DOC_MANPAGE OFF CACHE BOOL "" FORCE) set(WITH_DOC_MANPAGE OFF CACHE BOOL "" FORCE)
set(WITH_GTESTS ON CACHE BOOL "" FORCE) set(WITH_GTESTS ON CACHE BOOL "" FORCE)

View File

@@ -411,25 +411,9 @@ if(WITH_OPENMP)
set(OPENMP_FOUND ON) set(OPENMP_FOUND ON)
set(OpenMP_C_FLAGS "-Xclang -fopenmp -I'${LIBDIR}/openmp/include'") set(OpenMP_C_FLAGS "-Xclang -fopenmp -I'${LIBDIR}/openmp/include'")
set(OpenMP_CXX_FLAGS "-Xclang -fopenmp -I'${LIBDIR}/openmp/include'") set(OpenMP_CXX_FLAGS "-Xclang -fopenmp -I'${LIBDIR}/openmp/include'")
set(OpenMP_LINKER_FLAGS "-L'${LIBDIR}/openmp/lib' -lomp") set(OpenMP_LIBRARY_DIR "${LIBDIR}/openmp/lib/")
set(OpenMP_LINKER_FLAGS "-L'${OpenMP_LIBRARY_DIR}' -lomp")
# Copy libomp.dylib to allow executables like datatoc and tests to work. set(OpenMP_LIBRARY "${OpenMP_LIBRARY_DIR}/libomp.dylib")
# `@executable_path/../Resources/lib/` `LC_ID_DYLIB` is added by the deps builder.
# For single config generator datatoc, tests etc.
execute_process(
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/Resources/lib
COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/Resources/lib/libomp.dylib
)
# For multi-config generator datatoc, etc.
execute_process(
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin/Resources/lib
COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/bin/Resources/lib/libomp.dylib
)
# For multi-config generator tests.
execute_process(
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin/tests/Resources/lib
COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/bin/tests/Resources/lib/libomp.dylib
)
endif() endif()
endif() endif()
@@ -511,3 +495,22 @@ if(WITH_COMPILER_CCACHE)
endif() endif()
endif() endif()
endif() endif()
# For binaries that are built but not installed (also not distributed) (datatoc,
# makesdna, tests, etc.), we add an rpath to the OpenMP library dir through
# CMAKE_BUILD_RPATH. This avoids having to make many copies of the dylib next to each binary.
#
# For the installed Blender executable, CMAKE_INSTALL_RPATH will be used
# to locate the dylibs at @executable_path, next to the Blender executable.
#
# For the installed Python module, CMAKE_INSTALL_RPATH is modified to find the
# dylib in an adjacent folder.
set(CMAKE_SKIP_BUILD_RPATH FALSE)
list(APPEND CMAKE_BUILD_RPATH "${OpenMP_LIBRARY_DIR}")
set(CMAKE_SKIP_INSTALL_RPATH FALSE)
list(APPEND CMAKE_INSTALL_RPATH "@executable_path")
if(WITH_PYTHON_MODULE)
list(APPEND CMAKE_INSTALL_RPATH "@loader_path/../Resources/${BLENDER_VERSION}/lib")
endif()

View File

@@ -217,8 +217,8 @@ else()
endif() endif()
if(WITH_WINDOWS_PDB) if(WITH_WINDOWS_PDB)
set(PDB_INFO_OVERRIDE_FLAGS "${SYMBOL_FORMAT_RELEASE}") set(PDB_INFO_OVERRIDE_FLAGS "${SYMBOL_FORMAT_RELEASE}")
set(PDB_INFO_OVERRIDE_LINKER_FLAGS "/DEBUG /OPT:REF /OPT:ICF /INCREMENTAL:NO") set(PDB_INFO_OVERRIDE_LINKER_FLAGS "/DEBUG /OPT:REF /OPT:ICF /INCREMENTAL:NO")
endif() endif()
string(APPEND CMAKE_CXX_FLAGS_DEBUG " /MDd ${SYMBOL_FORMAT}") string(APPEND CMAKE_CXX_FLAGS_DEBUG " /MDd ${SYMBOL_FORMAT}")

View File

@@ -1,8 +1,10 @@
Pipeline Config Pipeline Config
=============== ===============
This configuration file is used by buildbot new pipeline for the `update-code` step. The `yaml` configuration file is used by buildbot build pipeline `update-code` step.
It will soon be used by the ../utils/make_update.py script. The file allows to set branches or specific commits for both git submodules and svn artifacts. Can also define various build package versions for use by build workers. Especially useful in experimental and release branches.
Both buildbot and developers will eventually use the same configuration file. NOTE:
* The configuration file is ```NOT``` used by the `../utils/make_update.py` script.
* That will implemented in the future.

View File

@@ -1,87 +0,0 @@
{
"update-code":
{
"git" :
{
"submodules":
[
{ "path": "release/scripts/addons", "branch": "master", "commit_id": "HEAD" },
{ "path": "release/scripts/addons_contrib", "branch": "master", "commit_id": "HEAD" },
{ "path": "release/datafiles/locale", "branch": "master", "commit_id": "HEAD" },
{ "path": "source/tools", "branch": "master", "commit_id": "HEAD" }
]
},
"svn":
{
"tests": { "path": "lib/tests", "branch": "trunk", "commit_id": "HEAD" },
"libraries":
{
"darwin-x86_64": { "path": "lib/darwin", "branch": "trunk", "commit_id": "HEAD" },
"darwin-arm64": { "path": "lib/darwin_arm64", "branch": "trunk", "commit_id": "HEAD" },
"linux-x86_64": { "path": "lib/linux_centos7_x86_64", "branch": "trunk", "commit_id": "HEAD" },
"windows-amd64": { "path": "lib/win64_vc15", "branch": "trunk", "commit_id": "HEAD" }
}
}
},
"buildbot":
{
"gcc":
{
"version": "9.0"
},
"sdks":
{
"optix":
{
"version": "7.1.0"
},
"cuda10":
{
"version": "10.1"
},
"cuda11":
{
"version": "11.3"
}
},
"cmake":
{
"default":
{
"version": "any",
"overrides":
{
}
},
"darwin-x86_64":
{
"overrides":
{
}
},
"darwin-arm64":
{
"overrides":
{
}
},
"linux-x86_64":
{
"overrides":
{
}
},
"windows-amd64":
{
"overrides":
{
}
}
}
}
}

View File

@@ -0,0 +1,70 @@
#
# Used by Buildbot build pipeline make_update.py script only for now
# We intended to update the make_update.py in the branches to use this file eventually
#
update-code:
git:
submodules:
- branch: master
commit_id: HEAD
path: release/scripts/addons
- branch: master
commit_id: HEAD
path: release/scripts/addons_contrib
- branch: master
commit_id: HEAD
path: release/datafiles/locale
- branch: master
commit_id: HEAD
path: source/tools
svn:
libraries:
darwin-arm64:
branch: trunk
commit_id: HEAD
path: lib/darwin_arm64
darwin-x86_64:
branch: trunk
commit_id: HEAD
path: lib/darwin
linux-x86_64:
branch: trunk
commit_id: HEAD
path: lib/linux_centos7_x86_64
windows-amd64:
branch: trunk
commit_id: HEAD
path: lib/win64_vc15
tests:
branch: trunk
commit_id: HEAD
path: lib/tests
benchmarks:
branch: trunk
commit_id: HEAD
path: lib/benchmarks
#
# Buildbot only configs
#
buildbot:
gcc:
version: '9.0.0'
cuda10:
version: '10.1.0'
cuda11:
version: '11.4.0'
optix:
version: '7.1.0'
cmake:
default:
version: any
overrides: {}
darwin-arm64:
overrides: {}
darwin-x86_64:
overrides: {}
linux-x86_64:
overrides: {}
windows-amd64:
overrides: {}

View File

@@ -0,0 +1,34 @@
set SOURCEDIR=%BLENDER_DIR%/doc/python_api/sphinx-in
set BUILDDIR=%BLENDER_DIR%/doc/python_api/sphinx-out
if "%BF_LANG%" == "" set BF_LANG=en
set SPHINXOPTS=-j auto -D language=%BF_LANG%
call "%~dp0\find_sphinx.cmd"
if EXIST "%SPHINX_BIN%" (
goto detect_sphinx_done
)
echo unable to locate sphinx-build, run "set sphinx_BIN=full_path_to_sphinx-build.exe"
exit /b 1
:detect_sphinx_done
call "%~dp0\find_blender.cmd"
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
echo unable to locate blender, run "set BLENDER_BIN=full_path_to_blender.exe"
exit /b 1
:detect_blender_done
%BLENDER_BIN% ^
--background -noaudio --factory-startup ^
--python %BLENDER_DIR%/doc/python_api/sphinx_doc_gen.py
%SPHINX_BIN% -b html %SPHINXOPTS% %O% %SOURCEDIR% %BUILDDIR%
:EOF

View File

@@ -0,0 +1,28 @@
REM First see if there is an environment variable set
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
REM Check the build folder next, if ninja was used there will be no
REM debug/release folder
set BLENDER_BIN=%BUILD_DIR%\bin\blender.exe
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
REM Check the release folder next
set BLENDER_BIN=%BUILD_DIR%\bin\release\blender.exe
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
REM Check the debug folder next
set BLENDER_BIN=%BUILD_DIR%\bin\debug\blender.exe
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
REM at this point, we don't know where blender is, clear the variable
set BLENDER_BIN=
:detect_blender_done

View File

@@ -0,0 +1,21 @@
REM First see if there is an environment variable set
if EXIST "%INKSCAPE_BIN%" (
goto detect_inkscape_done
)
REM Then see if inkscape is available in the path
for %%X in (inkscape.exe) do (set INKSCAPE_BIN=%%~$PATH:X)
if EXIST "%INKSCAPE_BIN%" (
goto detect_inkscape_done
)
REM Finally see if it is perhaps installed at the default location
set INKSCAPE_BIN=%ProgramFiles%\Inkscape\bin\inkscape.exe
if EXIST "%INKSCAPE_BIN%" (
goto detect_inkscape_done
)
REM If still not found clear the variable
set INKSCAPE_BIN=
:detect_inkscape_done

View File

@@ -0,0 +1,29 @@
REM First see if there is an environment variable set
if EXIST "%SPHINX_BIN%" (
goto detect_sphinx_done
)
REM Then see if inkscape is available in the path
for %%X in (sphinx-build.exe) do (set SPHINX_BIN=%%~$PATH:X)
if EXIST "%SPHINX_BIN%" (
goto detect_sphinx_done
)
REM Finally see if it is perhaps installed at the default location
set SPHINX_BIN=%ProgramFiles%\Inkscape\bin\inkscape.exe
if EXIST "%SPHINX_BIN%" (
goto detect_sphinx_done
)
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
REM If still not found clear the variable
set SPHINX_BIN=
:detect_sphinx_done

View File

@@ -0,0 +1,42 @@
if EXIST %PYTHON% (
goto detect_python_done
)
set PYTHON=%BLENDER_DIR%\..\lib\win64_vc15\python\39\bin\python.exe
if EXIST %PYTHON% (
goto detect_python_done
)
echo python not found at %PYTHON%
exit /b 1
:detect_python_done
echo found python (%PYTHON%)
call "%~dp0\find_inkscape.cmd"
if EXIST "%INKSCAPE_BIN%" (
goto detect_inkscape_done
)
echo unable to locate inkscape, run "set inkscape_BIN=full_path_to_inkscape.exe"
exit /b 1
:detect_inkscape_done
call "%~dp0\find_blender.cmd"
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
echo unable to locate blender, run "set BLENDER_BIN=full_path_to_blender.exe"
exit /b 1
:detect_blender_done
%PYTHON% -B %BLENDER_DIR%\release\datafiles\blender_icons_update.py
%PYTHON% -B %BLENDER_DIR%\release\datafiles\prvicons_update.py
%PYTHON% -B %BLENDER_DIR%\release\datafiles\alert_icons_update.py
:EOF

View File

@@ -0,0 +1,29 @@
if EXIST %PYTHON% (
goto detect_python_done
)
set PYTHON=%BLENDER_DIR%\..\lib\win64_vc15\python\39\bin\python.exe
if EXIST %PYTHON% (
goto detect_python_done
)
echo python not found at %PYTHON%
exit /b 1
:detect_python_done
echo found python (%PYTHON%)
call "%~dp0\find_blender.cmd"
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
echo unable to locate blender, run "set BLENDER_BIN=full_path_to_blender.exe"
exit /b 1
:detect_blender_done
%PYTHON% -B %BLENDER_DIR%\release\datafiles\blender_icons_geom_update.py
:EOF

View File

@@ -107,6 +107,15 @@ if NOT "%1" == "" (
set FORMAT=1 set FORMAT=1
set FORMAT_ARGS=%2 %3 %4 %5 %6 %7 %8 %9 set FORMAT_ARGS=%2 %3 %4 %5 %6 %7 %8 %9
goto EOF goto EOF
) else if "%1" == "icons" (
set ICONS=1
goto EOF
) else if "%1" == "icons_geom" (
set ICONS_GEOM=1
goto EOF
) else if "%1" == "doc_py" (
set DOC_PY=1
goto EOF
) else ( ) else (
echo Command "%1" unknown, aborting! echo Command "%1" unknown, aborting!
goto ERR goto ERR

View File

@@ -31,3 +31,6 @@ set PYDEBUG_CMAKE_ARGS=
set FORMAT= set FORMAT=
set TEST= set TEST=
set BUILD_WITH_SCCACHE= set BUILD_WITH_SCCACHE=
set ICONS=
set ICONS_GEOM=
set DOC_PY=

View File

@@ -31,6 +31,10 @@ echo - 2019 ^(build with visual studio 2019^)
echo - 2019pre ^(build with visual studio 2019 pre-release^) echo - 2019pre ^(build with visual studio 2019 pre-release^)
echo - 2019b ^(build with visual studio 2019 Build Tools^) echo - 2019b ^(build with visual studio 2019 Build Tools^)
echo.
echo Documentation Targets ^(Not associated with building^)
echo -doc_py ^(Generate sphinx python api docs^)
echo. echo.
echo Experimental options echo Experimental options
echo - with_opengl_tests ^(enable both the render and draw opengl test suites^) echo - with_opengl_tests ^(enable both the render and draw opengl test suites^)

View File

@@ -31,7 +31,8 @@ def draw():
context.space_data, context.space_data,
context.region, context.region,
view_matrix, view_matrix,
projection_matrix) projection_matrix,
True)
gpu.state.depth_mask_set(False) gpu.state.depth_mask_set(False)
draw_texture_2d(offscreen.texture_color, (10, 10), WIDTH, HEIGHT) draw_texture_2d(offscreen.texture_color, (10, 10), WIDTH, HEIGHT)

View File

@@ -111,5 +111,5 @@ if(WITH_MOD_FLUID)
endif() endif()
if (WITH_COMPOSITOR) if (WITH_COMPOSITOR)
add_subdirectory(smaa_areatex) add_subdirectory(smaa_areatex)
endif() endif()

View File

@@ -307,9 +307,9 @@ if(WITH_CYCLES_LOGGING)
) )
endif() endif()
# Debugging capabilities (debug passes etc). # NaN debugging
if(WITH_CYCLES_DEBUG) if(WITH_CYCLES_DEBUG_NAN)
add_definitions(-DWITH_CYCLES_DEBUG) add_definitions(-DWITH_CYCLES_DEBUG_NAN)
endif() endif()
if(NOT OPENIMAGEIO_PUGIXML_FOUND) if(NOT OPENIMAGEIO_PUGIXML_FOUND)

View File

@@ -235,9 +235,12 @@ def system_info():
def list_render_passes(scene, srl): def list_render_passes(scene, srl):
# Builtin Blender passes. crl = srl.cycles
# Combined pass.
yield ("Combined", "RGBA", 'COLOR') yield ("Combined", "RGBA", 'COLOR')
# Data passes.
if srl.use_pass_z: yield ("Depth", "Z", 'VALUE') if srl.use_pass_z: yield ("Depth", "Z", 'VALUE')
if srl.use_pass_mist: yield ("Mist", "Z", 'VALUE') if srl.use_pass_mist: yield ("Mist", "Z", 'VALUE')
if srl.use_pass_normal: yield ("Normal", "XYZ", 'VECTOR') 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_uv: yield ("UV", "UVA", 'VECTOR')
if srl.use_pass_object_index: yield ("IndexOB", "X", 'VALUE') if srl.use_pass_object_index: yield ("IndexOB", "X", 'VALUE')
if srl.use_pass_material_index: yield ("IndexMA", "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_direct: yield ("DiffDir", "RGB", 'COLOR')
if srl.use_pass_diffuse_indirect: yield ("DiffInd", "RGB", 'COLOR') if srl.use_pass_diffuse_indirect: yield ("DiffInd", "RGB", 'COLOR')
if srl.use_pass_diffuse_color: yield ("DiffCol", "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_direct: yield ("TransDir", "RGB", 'COLOR')
if srl.use_pass_transmission_indirect: yield ("TransInd", "RGB", 'COLOR') if srl.use_pass_transmission_indirect: yield ("TransInd", "RGB", 'COLOR')
if srl.use_pass_transmission_color: yield ("TransCol", "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_emit: yield ("Emit", "RGB", 'COLOR')
if srl.use_pass_environment: yield ("Env", "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. # Debug passes.
crl = srl.cycles
if crl.pass_debug_render_time: yield ("Debug Render Time", "X", 'VALUE') 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.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. # Cryptomatte passes.
crypto_depth = (srl.pass_cryptomatte_depth + 1) // 2 crypto_depth = (srl.pass_cryptomatte_depth + 1) // 2

View File

@@ -263,6 +263,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
name="Use Denoising", name="Use Denoising",
description="Denoise the rendered image", description="Denoise the rendered image",
default=False, default=False,
update=update_render_passes,
) )
use_preview_denoising: BoolProperty( use_preview_denoising: BoolProperty(
name="Use Viewport Denoising", name="Use Viewport Denoising",
@@ -1163,12 +1164,6 @@ class CyclesVisibilitySettings(bpy.types.PropertyGroup):
@classmethod @classmethod
def register(cls): def register(cls):
bpy.types.Object.cycles_visibility = PointerProperty(
name="Cycles Visibility Settings",
description="Cycles visibility settings",
type=cls,
)
bpy.types.World.cycles_visibility = PointerProperty( bpy.types.World.cycles_visibility = PointerProperty(
name="Cycles Visibility Settings", name="Cycles Visibility Settings",
description="Cycles visibility settings", description="Cycles visibility settings",
@@ -1177,7 +1172,6 @@ class CyclesVisibilitySettings(bpy.types.PropertyGroup):
@classmethod @classmethod
def unregister(cls): def unregister(cls):
del bpy.types.Object.cycles_visibility
del bpy.types.World.cycles_visibility del bpy.types.World.cycles_visibility
@@ -1267,18 +1261,12 @@ class CyclesObjectSettings(bpy.types.PropertyGroup):
default=0.1, default=0.1,
) )
is_shadow_catcher: BoolProperty( ao_distance: FloatProperty(
name="Shadow Catcher", name="AO Distance",
description="Only render shadows on this object, for compositing renders into real footage", description="AO distance used for approximate global illumination (0 means use world setting)",
default=False, min=0.0,
) default=0.0,
subtype='DISTANCE',
is_holdout: BoolProperty(
name="Holdout",
description="Render objects as a holdout or matte, creating a "
"hole in the image with zero alpha, to fill out in "
"compositing with real footage or another render",
default=False,
) )
@classmethod @classmethod
@@ -1324,30 +1312,6 @@ class CyclesCurveRenderSettings(bpy.types.PropertyGroup):
class CyclesRenderLayerSettings(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( pass_debug_render_time: BoolProperty(
name="Debug Render Time", name="Debug Render Time",
description="Render time in milliseconds per sample and pixel", description="Render time in milliseconds per sample and pixel",

View File

@@ -936,29 +936,6 @@ class CYCLES_RENDER_PT_passes_crypto(CyclesButtonsPanel, ViewLayerCryptomattePan
bl_parent_id = "CYCLES_RENDER_PT_passes" 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): class CYCLES_RENDER_PT_passes_aov(CyclesButtonsPanel, ViewLayerAOVPanel):
bl_label = "Shader AOV" bl_label = "Shader AOV"
bl_context = "view_layer" bl_context = "view_layer"
@@ -1125,7 +1102,7 @@ class CYCLES_PT_context_material(CyclesButtonsPanel, Panel):
if ob: if ob:
is_sortable = len(ob.material_slots) > 1 is_sortable = len(ob.material_slots) > 1
rows = 1 rows = 3
if (is_sortable): if (is_sortable):
rows = 4 rows = 4
@@ -1251,6 +1228,26 @@ class CYCLES_OBJECT_PT_shading_shadow_terminator(CyclesButtonsPanel, Panel):
flow.prop(cob, "shadow_terminator_offset", text="Shading Offset") flow.prop(cob, "shadow_terminator_offset", text="Shading Offset")
class CYCLES_OBJECT_PT_shading_gi_approximation(CyclesButtonsPanel, Panel):
bl_label = "Fast GI Approximation"
bl_parent_id = "CYCLES_OBJECT_PT_shading"
bl_context = "object"
def draw(self, context):
layout = self.layout
layout.use_property_split = True
scene = context.scene
ob = context.object
cob = ob.cycles
cscene = scene.cycles
col = layout.column()
col.active = cscene.use_fast_gi
col.prop(cob, "ao_distance")
class CYCLES_OBJECT_PT_visibility(CyclesButtonsPanel, Panel): class CYCLES_OBJECT_PT_visibility(CyclesButtonsPanel, Panel):
bl_label = "Visibility" bl_label = "Visibility"
bl_context = "object" bl_context = "object"
@@ -1273,10 +1270,9 @@ class CYCLES_OBJECT_PT_visibility(CyclesButtonsPanel, Panel):
col.prop(ob, "hide_render", text="Renders", invert_checkbox=True, toggle=False) col.prop(ob, "hide_render", text="Renders", invert_checkbox=True, toggle=False)
if has_geometry_visibility(ob): if has_geometry_visibility(ob):
cob = ob.cycles
col = layout.column(heading="Mask") col = layout.column(heading="Mask")
col.prop(cob, "is_shadow_catcher") col.prop(ob, "is_shadow_catcher")
col.prop(cob, "is_holdout") col.prop(ob, "is_holdout")
class CYCLES_OBJECT_PT_visibility_ray_visibility(CyclesButtonsPanel, Panel): class CYCLES_OBJECT_PT_visibility_ray_visibility(CyclesButtonsPanel, Panel):
@@ -1296,19 +1292,17 @@ class CYCLES_OBJECT_PT_visibility_ray_visibility(CyclesButtonsPanel, Panel):
scene = context.scene scene = context.scene
ob = context.object ob = context.object
cob = ob.cycles
visibility = ob.cycles_visibility
col = layout.column() col = layout.column()
col.prop(visibility, "camera") col.prop(ob, "visible_camera", text="Camera")
col.prop(visibility, "diffuse") col.prop(ob, "visible_diffuse", text="Diffuse")
col.prop(visibility, "glossy") col.prop(ob, "visible_glossy", text="Glossy")
col.prop(visibility, "transmission") col.prop(ob, "visible_transmission", text="Transmission")
col.prop(visibility, "scatter") col.prop(ob, "visible_volume_scatter", text="Volume Scatter")
if ob.type != 'LIGHT': if ob.type != 'LIGHT':
sub = col.column() sub = col.column()
sub.prop(visibility, "shadow") sub.prop(ob, "visible_shadow", text="Shadow")
class CYCLES_OBJECT_PT_visibility_culling(CyclesButtonsPanel, Panel): class CYCLES_OBJECT_PT_visibility_culling(CyclesButtonsPanel, Panel):
@@ -2317,7 +2311,6 @@ classes = (
CYCLES_RENDER_PT_passes_data, CYCLES_RENDER_PT_passes_data,
CYCLES_RENDER_PT_passes_light, CYCLES_RENDER_PT_passes_light,
CYCLES_RENDER_PT_passes_crypto, CYCLES_RENDER_PT_passes_crypto,
CYCLES_RENDER_PT_passes_debug,
CYCLES_RENDER_PT_passes_aov, CYCLES_RENDER_PT_passes_aov,
CYCLES_RENDER_PT_filter, CYCLES_RENDER_PT_filter,
CYCLES_RENDER_PT_override, CYCLES_RENDER_PT_override,
@@ -2329,6 +2322,7 @@ classes = (
CYCLES_OBJECT_PT_motion_blur, CYCLES_OBJECT_PT_motion_blur,
CYCLES_OBJECT_PT_shading, CYCLES_OBJECT_PT_shading,
CYCLES_OBJECT_PT_shading_shadow_terminator, CYCLES_OBJECT_PT_shading_shadow_terminator,
CYCLES_OBJECT_PT_shading_gi_approximation,
CYCLES_OBJECT_PT_visibility, CYCLES_OBJECT_PT_visibility,
CYCLES_OBJECT_PT_visibility_ray_visibility, CYCLES_OBJECT_PT_visibility_ray_visibility,
CYCLES_OBJECT_PT_visibility_culling, CYCLES_OBJECT_PT_visibility_culling,

View File

@@ -1055,10 +1055,45 @@ static BL::MeshSequenceCacheModifier object_mesh_cache_find(BL::Object &b_ob)
return BL::MeshSequenceCacheModifier(PointerRNA_NULL); 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) 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; return;
}
BL::MeshSequenceCacheModifier b_mesh_cache = object_mesh_cache_find(b_ob); 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) 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; return;
}
BL::FluidDomainSettings b_fluid_domain = object_fluid_liquid_domain_find(b_ob); BL::FluidDomainSettings b_fluid_domain = object_fluid_liquid_domain_find(b_ob);

View File

@@ -199,8 +199,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
/* Visibility flags for both parent and child. */ /* Visibility flags for both parent and child. */
PointerRNA cobject = RNA_pointer_get(&b_ob.ptr, "cycles"); PointerRNA cobject = RNA_pointer_get(&b_ob.ptr, "cycles");
bool use_holdout = get_boolean(cobject, "is_holdout") || bool use_holdout = b_parent.holdout_get(PointerRNA_NULL, b_view_layer);
b_parent.holdout_get(PointerRNA_NULL, b_view_layer);
uint visibility = object_ray_visibility(b_ob) & PATH_RAY_ALL_VISIBILITY; uint visibility = object_ray_visibility(b_ob) & PATH_RAY_ALL_VISIBILITY;
if (b_parent.ptr.data != b_ob.ptr.data) { if (b_parent.ptr.data != b_ob.ptr.data) {
@@ -287,8 +286,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
object->set_visibility(visibility); object->set_visibility(visibility);
bool is_shadow_catcher = get_boolean(cobject, "is_shadow_catcher"); object->set_is_shadow_catcher(b_ob.is_shadow_catcher());
object->set_is_shadow_catcher(is_shadow_catcher);
float shadow_terminator_shading_offset = get_float(cobject, "shadow_terminator_offset"); float shadow_terminator_shading_offset = get_float(cobject, "shadow_terminator_offset");
object->set_shadow_terminator_shading_offset(shadow_terminator_shading_offset); object->set_shadow_terminator_shading_offset(shadow_terminator_shading_offset);
@@ -297,6 +295,13 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
"shadow_terminator_geometry_offset"); "shadow_terminator_geometry_offset");
object->set_shadow_terminator_geometry_offset(shadow_terminator_geometry_offset); object->set_shadow_terminator_geometry_offset(shadow_terminator_geometry_offset);
float ao_distance = get_float(cobject, "ao_distance");
if (ao_distance == 0.0f && b_parent.ptr.data != b_ob.ptr.data) {
PointerRNA cparent = RNA_pointer_get(&b_parent.ptr, "cycles");
ao_distance = get_float(cparent, "ao_distance");
}
object->set_ao_distance(ao_distance);
/* sync the asset name for Cryptomatte */ /* sync the asset name for Cryptomatte */
BL::Object parent = b_ob.parent(); BL::Object parent = b_ob.parent();
ustring parent_name; ustring parent_name;

View File

@@ -1098,14 +1098,6 @@ void *CCL_python_module_init()
PyModule_AddStringConstant(mod, "osl_version_string", "unknown"); PyModule_AddStringConstant(mod, "osl_version_string", "unknown");
#endif #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 #ifdef WITH_NETWORK
PyModule_AddObject(mod, "with_network", Py_True); PyModule_AddObject(mod, "with_network", Py_True);
Py_INCREF(Py_True); Py_INCREF(Py_True);

View File

@@ -538,12 +538,6 @@ PassType BlenderSync::get_pass_type(BL::RenderPass &b_pass)
MAP_PASS("BakePrimitive", PASS_BAKE_PRIMITIVE); MAP_PASS("BakePrimitive", PASS_BAKE_PRIMITIVE);
MAP_PASS("BakeDifferential", PASS_BAKE_DIFFERENTIAL); 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("Debug Render Time", PASS_RENDER_TIME);
MAP_PASS("AdaptiveAuxBuffer", PASS_ADAPTIVE_AUX_BUFFER); MAP_PASS("AdaptiveAuxBuffer", PASS_ADAPTIVE_AUX_BUFFER);
MAP_PASS("Debug Sample Count", PASS_SAMPLE_COUNT); 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")) { if (get_boolean(crl, "pass_debug_render_time")) {
b_engine.add_pass("Debug Render Time", 1, "X", b_view_layer.name().c_str()); b_engine.add_pass("Debug Render Time", 1, "X", b_view_layer.name().c_str());
Pass::add(PASS_RENDER_TIME, passes, "Debug Render Time"); Pass::add(PASS_RENDER_TIME, passes, "Debug Render Time");

View File

@@ -596,15 +596,14 @@ static inline Mesh::SubdivisionType object_subdivision_type(BL::Object &b_ob,
static inline uint object_ray_visibility(BL::Object &b_ob) static inline uint object_ray_visibility(BL::Object &b_ob)
{ {
PointerRNA cvisibility = RNA_pointer_get(&b_ob.ptr, "cycles_visibility");
uint flag = 0; uint flag = 0;
flag |= get_boolean(cvisibility, "camera") ? PATH_RAY_CAMERA : 0; flag |= b_ob.visible_camera() ? PATH_RAY_CAMERA : 0;
flag |= get_boolean(cvisibility, "diffuse") ? PATH_RAY_DIFFUSE : 0; flag |= b_ob.visible_diffuse() ? PATH_RAY_DIFFUSE : 0;
flag |= get_boolean(cvisibility, "glossy") ? PATH_RAY_GLOSSY : 0; flag |= b_ob.visible_glossy() ? PATH_RAY_GLOSSY : 0;
flag |= get_boolean(cvisibility, "transmission") ? PATH_RAY_TRANSMIT : 0; flag |= b_ob.visible_transmission() ? PATH_RAY_TRANSMIT : 0;
flag |= get_boolean(cvisibility, "shadow") ? PATH_RAY_SHADOW : 0; flag |= b_ob.visible_shadow() ? PATH_RAY_SHADOW : 0;
flag |= get_boolean(cvisibility, "scatter") ? PATH_RAY_VOLUME_SCATTER : 0; flag |= b_ob.visible_volume_scatter() ? PATH_RAY_VOLUME_SCATTER : 0;
return flag; return flag;
} }

View File

@@ -351,9 +351,6 @@ string CUDADevice::compile_kernel_get_common_cflags(
if (extra_cflags) { if (extra_cflags) {
cflags += string(" ") + string(extra_cflags); cflags += string(" ") + string(extra_cflags);
} }
# ifdef WITH_CYCLES_DEBUG
cflags += " -D__KERNEL_DEBUG__";
# endif
if (split) { if (split) {
cflags += " -D__SPLIT__"; cflags += " -D__SPLIT__";
@@ -461,18 +458,19 @@ string CUDADevice::compile_kernel(const DeviceRequestedFeatures &requested_featu
const int nvcc_cuda_version = cuewCompilerVersion(); const int nvcc_cuda_version = cuewCompilerVersion();
VLOG(1) << "Found nvcc " << nvcc << ", CUDA version " << nvcc_cuda_version << "."; VLOG(1) << "Found nvcc " << nvcc << ", CUDA version " << nvcc_cuda_version << ".";
if (nvcc_cuda_version < 80) { if (nvcc_cuda_version < 101) {
printf( printf(
"Unsupported CUDA version %d.%d detected, " "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,
nvcc_cuda_version % 10); nvcc_cuda_version % 10);
return string(); 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( printf(
"CUDA version %d.%d detected, build may succeed but only " "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,
nvcc_cuda_version % 10); nvcc_cuda_version % 10);
} }

View File

@@ -57,8 +57,8 @@
#include "util/util_function.h" #include "util/util_function.h"
#include "util/util_logging.h" #include "util/util_logging.h"
#include "util/util_map.h" #include "util/util_map.h"
#include "util/util_openimagedenoise.h"
#include "util/util_opengl.h" #include "util/util_opengl.h"
#include "util/util_openimagedenoise.h"
#include "util/util_optimization.h" #include "util/util_optimization.h"
#include "util/util_progress.h" #include "util/util_progress.h"
#include "util/util_system.h" #include "util/util_system.h"

View File

@@ -233,9 +233,6 @@ class OptiXDevice : public CUDADevice {
break; break;
} }
}; };
# endif
# if OPTIX_ABI_VERSION >= 41 && defined(WITH_CYCLES_DEBUG)
options.validationMode = OPTIX_DEVICE_CONTEXT_VALIDATION_MODE_ALL;
# endif # endif
check_result_optix(optixDeviceContextCreate(cuContext, &options, &context)); check_result_optix(optixDeviceContextCreate(cuContext, &options, &context));
# ifdef WITH_CYCLES_LOGGING # ifdef WITH_CYCLES_LOGGING
@@ -369,13 +366,8 @@ class OptiXDevice : public CUDADevice {
OptixModuleCompileOptions module_options = {}; OptixModuleCompileOptions module_options = {};
module_options.maxRegisterCount = 0; // Do not set an explicit register limit 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.optLevel = OPTIX_COMPILE_OPTIMIZATION_LEVEL_3;
module_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_LINEINFO; module_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_LINEINFO;
# endif
# if OPTIX_ABI_VERSION >= 41 # if OPTIX_ABI_VERSION >= 41
module_options.boundValues = nullptr; module_options.boundValues = nullptr;
@@ -578,11 +570,7 @@ class OptiXDevice : public CUDADevice {
OptixPipelineLinkOptions link_options = {}; OptixPipelineLinkOptions link_options = {};
link_options.maxTraceDepth = 1; 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; link_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_LINEINFO;
# endif
# if OPTIX_ABI_VERSION < 24 # if OPTIX_ABI_VERSION < 24
link_options.overrideUsesMotionBlur = motion_blur; link_options.overrideUsesMotionBlur = motion_blur;
# endif # endif

View File

@@ -1968,10 +1968,6 @@ string OpenCLDevice::kernel_build_options(const string *debug_src)
build_options += "-D__KERNEL_OPENCL_DEBUG__ "; build_options += "-D__KERNEL_OPENCL_DEBUG__ ";
} }
# ifdef WITH_CYCLES_DEBUG
build_options += "-D__KERNEL_DEBUG__ ";
# endif
# ifdef WITH_NANOVDB # ifdef WITH_NANOVDB
if (info.has_nanovdb) { if (info.has_nanovdb) {
build_options += "-DWITH_NANOVDB "; build_options += "-DWITH_NANOVDB ";

View File

@@ -380,11 +380,16 @@ if(WITH_CYCLES_CUDA_BINARIES)
set(CUDA_VERSION "${CUDA_VERSION_MAJOR}${CUDA_VERSION_MINOR}") set(CUDA_VERSION "${CUDA_VERSION_MAJOR}${CUDA_VERSION_MINOR}")
# warn for other versions # 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() else()
message(WARNING message(WARNING
"CUDA version ${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR} detected, " "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() endif()
# build for each arch # build for each arch
@@ -439,10 +444,6 @@ if(WITH_CYCLES_CUDA_BINARIES)
set(name ${name}_experimental) set(name ${name}_experimental)
endif() endif()
if(WITH_CYCLES_DEBUG)
set(cuda_flags ${cuda_flags} -D __KERNEL_DEBUG__)
endif()
if(WITH_NANOVDB) if(WITH_NANOVDB)
set(cuda_flags ${cuda_flags} set(cuda_flags ${cuda_flags}
-D WITH_NANOVDB -D WITH_NANOVDB
@@ -557,11 +558,6 @@ if(WITH_CYCLES_DEVICE_OPTIX AND WITH_CYCLES_CUDA_BINARIES)
--use_fast_math --use_fast_math
-o ${output}) -o ${output})
if(WITH_CYCLES_DEBUG)
set(cuda_flags ${cuda_flags}
-D __KERNEL_DEBUG__)
endif()
if(WITH_NANOVDB) if(WITH_NANOVDB)
set(cuda_flags ${cuda_flags} set(cuda_flags ${cuda_flags}
-D WITH_NANOVDB -D WITH_NANOVDB

View File

@@ -67,8 +67,6 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
isect->prim = PRIM_NONE; isect->prim = PRIM_NONE;
isect->object = OBJECT_NONE; isect->object = OBJECT_NONE;
BVH_DEBUG_INIT();
/* traversal loop */ /* traversal loop */
do { do {
do { do {
@@ -118,7 +116,6 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
--stack_ptr; --stack_ptr;
} }
} }
BVH_DEBUG_NEXT_NODE();
} }
/* if node is leaf, fetch triangle list */ /* 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) { switch (type & PRIMITIVE_ALL) {
case PRIMITIVE_TRIANGLE: { case PRIMITIVE_TRIANGLE: {
for (; prim_addr < prim_addr2; prim_addr++) { for (; prim_addr < prim_addr2; prim_addr++) {
BVH_DEBUG_NEXT_INTERSECTION();
kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type); kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type);
if (triangle_intersect(kg, isect, P, dir, visibility, object, prim_addr)) { if (triangle_intersect(kg, isect, P, dir, visibility, object, prim_addr)) {
/* shadow ray early termination */ /* shadow ray early termination */
@@ -151,7 +147,6 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
#if BVH_FEATURE(BVH_MOTION) #if BVH_FEATURE(BVH_MOTION)
case PRIMITIVE_MOTION_TRIANGLE: { case PRIMITIVE_MOTION_TRIANGLE: {
for (; prim_addr < prim_addr2; prim_addr++) { for (; prim_addr < prim_addr2; prim_addr++) {
BVH_DEBUG_NEXT_INTERSECTION();
kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type); kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type);
if (motion_triangle_intersect( if (motion_triangle_intersect(
kg, isect, P, dir, ray->time, visibility, object, prim_addr)) { 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_CURVE_RIBBON:
case PRIMITIVE_MOTION_CURVE_RIBBON: { case PRIMITIVE_MOTION_CURVE_RIBBON: {
for (; prim_addr < prim_addr2; prim_addr++) { for (; prim_addr < prim_addr2; prim_addr++) {
BVH_DEBUG_NEXT_INTERSECTION();
const uint curve_type = kernel_tex_fetch(__prim_type, prim_addr); const uint curve_type = kernel_tex_fetch(__prim_type, prim_addr);
kernel_assert((curve_type & PRIMITIVE_ALL) == (type & PRIMITIVE_ALL)); kernel_assert((curve_type & PRIMITIVE_ALL) == (type & PRIMITIVE_ALL));
const bool hit = curve_intersect( 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; traversal_stack[stack_ptr] = ENTRYPOINT_SENTINEL;
node_addr = kernel_tex_fetch(__object_node, object); node_addr = kernel_tex_fetch(__object_node, object);
BVH_DEBUG_NEXT_INSTANCE();
} }
} }
} while (node_addr != ENTRYPOINT_SENTINEL); } while (node_addr != ENTRYPOINT_SENTINEL);

View File

@@ -42,33 +42,6 @@ CCL_NAMESPACE_BEGIN
#define BVH_FEATURE(f) (((BVH_FUNCTION_FEATURES) & (f)) != 0) #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 CCL_NAMESPACE_END
#endif /* __BVH_TYPES__ */ #endif /* __BVH_TYPES__ */

View File

@@ -239,4 +239,14 @@ ccl_device_forceinline int intersection_get_shader(KernelGlobals *ccl_restrict k
return shader & SHADER_MASK; return shader & SHADER_MASK;
} }
ccl_device_forceinline int intersection_get_object(KernelGlobals *ccl_restrict kg,
const Intersection *ccl_restrict isect)
{
if (isect->object != OBJECT_NONE) {
return isect->object;
}
return kernel_tex_fetch(__prim_object, isect->prim);
}
CCL_NAMESPACE_END CCL_NAMESPACE_END

View File

@@ -432,9 +432,9 @@ ccl_device void bssrdf_sample(const ShaderClosure *sc, float xi, float *r, float
xi *= bssrdf->channels; xi *= bssrdf->channels;
if (xi < 1.0f) { if (xi < 1.0f) {
radius = (bssrdf->radius.x > 0.0f) ? radius = (bssrdf->radius.x > 0.0f) ? bssrdf->radius.x :
bssrdf->radius.x : (bssrdf->radius.y > 0.0f) ? bssrdf->radius.y :
(bssrdf->radius.y > 0.0f) ? bssrdf->radius.y : bssrdf->radius.z; bssrdf->radius.z;
} }
else if (xi < 2.0f) { else if (xi < 2.0f) {
xi -= 1.0f; xi -= 1.0f;

View File

@@ -52,15 +52,14 @@ typedef struct TileInfo {
tile_buffer_6, tile_buffer_7, tile_buffer_8, tile_buffer_9 tile_buffer_6, tile_buffer_7, tile_buffer_8, tile_buffer_9
# define ccl_get_tile_buffer(id) \ # define ccl_get_tile_buffer(id) \
(id == 0 ? tile_buffer_1 : \ (id == 0 ? tile_buffer_1 : \
id == 1 ? \ id == 1 ? tile_buffer_2 : \
tile_buffer_2 : \ id == 2 ? tile_buffer_3 : \
id == 2 ? \ id == 3 ? tile_buffer_4 : \
tile_buffer_3 : \ id == 4 ? tile_buffer_5 : \
id == 3 ? tile_buffer_4 : \ id == 5 ? tile_buffer_6 : \
id == 4 ? tile_buffer_5 : \ id == 6 ? tile_buffer_7 : \
id == 5 ? tile_buffer_6 : \ id == 7 ? tile_buffer_8 : \
id == 6 ? tile_buffer_7 : \ tile_buffer_9)
id == 7 ? tile_buffer_8 : tile_buffer_9)
#else #else
# ifdef __KERNEL_CUDA__ # ifdef __KERNEL_CUDA__
# define CCL_FILTER_TILE_INFO ccl_global TileInfo *tile_info # define CCL_FILTER_TILE_INFO ccl_global TileInfo *tile_info

View File

@@ -225,13 +225,6 @@ ccl_device_inline void path_radiance_init(KernelGlobals *kg, PathRadiance *L)
L->denoising_albedo = zero_float3(); L->denoising_albedo = zero_float3();
L->denoising_depth = 0.0f; L->denoising_depth = 0.0f;
#endif #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, 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; float shadow;
if (UNLIKELY(!isfinite_safe(path_total))) { if (UNLIKELY(!isfinite_safe(path_total))) {
# ifdef __KERNEL_DEBUG_NAN__
kernel_assert(!"Non-finite total radiance along the path"); kernel_assert(!"Non-finite total radiance along the path");
# endif
shadow = 0.0f; shadow = 0.0f;
} }
else if (path_total == 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 */ /* Reject invalid value */
if (!isfinite_safe(sum)) { if (!isfinite_safe(sum)) {
# ifdef __KERNEL_DEBUG_NAN__
kernel_assert(!"Non-finite sum in path_radiance_clamp_and_sum!"); kernel_assert(!"Non-finite sum in path_radiance_clamp_and_sum!");
# endif
L_sum = zero_float3(); L_sum = zero_float3();
L->direct_diffuse = 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 */ /* Reject invalid value */
float sum = fabsf((L_sum).x) + fabsf((L_sum).y) + fabsf((L_sum).z); float sum = fabsf((L_sum).x) + fabsf((L_sum).y) + fabsf((L_sum).z);
if (!isfinite_safe(sum)) { if (!isfinite_safe(sum)) {
#ifdef __KERNEL_DEBUG_NAN__
kernel_assert(!"Non-finite final sum in path_radiance_clamp_and_sum!"); kernel_assert(!"Non-finite final sum in path_radiance_clamp_and_sum!");
#endif
L_sum = zero_float3(); L_sum = zero_float3();
} }
} }

View File

@@ -81,7 +81,8 @@ ccl_device_noinline void compute_light_pass(
kg, sd, emission_sd, L, &state, &ray, &throughput, &ss_indirect)) { kg, sd, emission_sd, L, &state, &ray, &throughput, &ss_indirect)) {
while (ss_indirect.num_rays) { while (ss_indirect.num_rays) {
kernel_path_subsurface_setup_indirect(kg, &ss_indirect, &state, &ray, L, &throughput); kernel_path_subsurface_setup_indirect(kg, &ss_indirect, &state, &ray, L, &throughput);
kernel_path_indirect(kg, &indirect_sd, emission_sd, &ray, throughput, &state, L); kernel_path_indirect(
kg, &indirect_sd, emission_sd, &ray, throughput, &state, L, sd->object);
} }
is_sss_sample = true; is_sss_sample = true;
} }
@@ -97,7 +98,8 @@ ccl_device_noinline void compute_light_pass(
state.ray_t = 0.0f; state.ray_t = 0.0f;
# endif # endif
/* compute indirect light */ /* compute indirect light */
kernel_path_indirect(kg, &indirect_sd, emission_sd, &ray, throughput, &state, L); kernel_path_indirect(
kg, &indirect_sd, emission_sd, &ray, throughput, &state, L, sd->object);
/* sum and reset indirect light pass variables for the next samples */ /* sum and reset indirect light pass variables for the next samples */
path_radiance_sum_indirect(L); path_radiance_sum_indirect(L);

View File

@@ -122,31 +122,6 @@ ccl_device_inline void kernel_update_denoising_features(KernelGlobals *kg,
} }
#endif /* __DENOISING_FEATURES__ */ #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__ #ifdef __KERNEL_CPU__
# define WRITE_ID_SLOT(buffer, depth, id, matte_weight, name) \ # define WRITE_ID_SLOT(buffer, depth, id, matte_weight, name) \
kernel_write_id_pass_cpu(buffer, depth * 2, id, matte_weight, kg->coverage_##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__ */ #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 /* 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 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 Carlo global illumination" except that here it is applied per pixel and not in hierarchical

View File

@@ -58,7 +58,8 @@ ccl_device_forceinline bool kernel_path_scene_intersect(KernelGlobals *kg,
ccl_addr_space PathState *state, ccl_addr_space PathState *state,
Ray *ray, Ray *ray,
Intersection *isect, Intersection *isect,
PathRadiance *L) PathRadiance *L,
const int last_object)
{ {
PROFILING_INIT(kg, PROFILING_SCENE_INTERSECT); PROFILING_INIT(kg, PROFILING_SCENE_INTERSECT);
@@ -66,19 +67,16 @@ ccl_device_forceinline bool kernel_path_scene_intersect(KernelGlobals *kg,
if (path_state_ao_bounce(kg, state)) { if (path_state_ao_bounce(kg, state)) {
ray->t = kernel_data.background.ao_distance; ray->t = kernel_data.background.ao_distance;
if (last_object != OBJECT_NONE) {
const float object_ao_distance = kernel_tex_fetch(__objects, last_object).ao_distance;
if (object_ao_distance != 0.0f) {
ray->t = object_ao_distance;
}
}
} }
bool hit = scene_intersect(kg, ray, visibility, isect); 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; return hit;
} }
@@ -262,7 +260,7 @@ ccl_device_forceinline bool kernel_path_shader_apply(KernelGlobals *kg,
PROFILING_INIT(kg, PROFILING_SHADER_APPLY); PROFILING_INIT(kg, PROFILING_SHADER_APPLY);
#ifdef __SHADOW_TRICKS__ #ifdef __SHADOW_TRICKS__
if ((sd->object_flag & SD_OBJECT_SHADOW_CATCHER)) { if (sd->object_flag & SD_OBJECT_SHADOW_CATCHER) {
if (state->flag & PATH_RAY_TRANSPARENT_BACKGROUND) { if (state->flag & PATH_RAY_TRANSPARENT_BACKGROUND) {
state->flag |= (PATH_RAY_SHADOW_CATCHER | PATH_RAY_STORE_SHADOW_INFO); state->flag |= (PATH_RAY_SHADOW_CATCHER | PATH_RAY_STORE_SHADOW_INFO);
@@ -378,7 +376,8 @@ ccl_device void kernel_path_indirect(KernelGlobals *kg,
Ray *ray, Ray *ray,
float3 throughput, float3 throughput,
PathState *state, PathState *state,
PathRadiance *L) PathRadiance *L,
const int last_object)
{ {
# ifdef __SUBSURFACE__ # ifdef __SUBSURFACE__
SubsurfaceIndirectRays ss_indirect; SubsurfaceIndirectRays ss_indirect;
@@ -391,7 +390,7 @@ ccl_device void kernel_path_indirect(KernelGlobals *kg,
for (;;) { for (;;) {
/* Find intersection with objects in scene. */ /* Find intersection with objects in scene. */
Intersection isect; Intersection isect;
bool hit = kernel_path_scene_intersect(kg, state, ray, &isect, L); bool hit = kernel_path_scene_intersect(kg, state, ray, &isect, L, last_object);
/* Find intersection with lamps and compute emission for MIS. */ /* Find intersection with lamps and compute emission for MIS. */
kernel_path_lamp_emission(kg, state, ray, throughput, &isect, sd, L); kernel_path_lamp_emission(kg, state, ray, throughput, &isect, sd, L);
@@ -535,7 +534,7 @@ ccl_device_forceinline void kernel_path_integrate(KernelGlobals *kg,
for (;;) { for (;;) {
/* Find intersection with objects in scene. */ /* Find intersection with objects in scene. */
Intersection isect; Intersection isect;
bool hit = kernel_path_scene_intersect(kg, state, ray, &isect, L); bool hit = kernel_path_scene_intersect(kg, state, ray, &isect, L, sd.object);
/* Find intersection with lamps and compute emission for MIS. */ /* Find intersection with lamps and compute emission for MIS. */
kernel_path_lamp_emission(kg, state, ray, throughput, &isect, &sd, L); kernel_path_lamp_emission(kg, state, ray, throughput, &isect, &sd, L);

View File

@@ -92,6 +92,7 @@ ccl_device_forceinline void kernel_branched_path_volume(KernelGlobals *kg,
volume_ray.t = (hit) ? isect->t : FLT_MAX; volume_ray.t = (hit) ? isect->t : FLT_MAX;
float step_size = volume_stack_step_size(kg, state->volume_stack); float step_size = volume_stack_step_size(kg, state->volume_stack);
const int object = sd->object;
# ifdef __VOLUME_DECOUPLED__ # ifdef __VOLUME_DECOUPLED__
/* decoupled ray marching only supported on CPU */ /* decoupled ray marching only supported on CPU */
@@ -134,7 +135,8 @@ ccl_device_forceinline void kernel_branched_path_volume(KernelGlobals *kg,
if (result == VOLUME_PATH_SCATTERED && if (result == VOLUME_PATH_SCATTERED &&
kernel_path_volume_bounce(kg, sd, &tp, &ps, &L->state, &pray)) { kernel_path_volume_bounce(kg, sd, &tp, &ps, &L->state, &pray)) {
kernel_path_indirect(kg, indirect_sd, emission_sd, &pray, tp * num_samples_inv, &ps, L); kernel_path_indirect(
kg, indirect_sd, emission_sd, &pray, tp * num_samples_inv, &ps, L, object);
/* for render passes, sum and reset indirect light pass variables /* for render passes, sum and reset indirect light pass variables
* for the next samples */ * for the next samples */
@@ -180,7 +182,7 @@ ccl_device_forceinline void kernel_branched_path_volume(KernelGlobals *kg,
kernel_path_volume_connect_light(kg, sd, emission_sd, tp, state, L); kernel_path_volume_connect_light(kg, sd, emission_sd, tp, state, L);
if (kernel_path_volume_bounce(kg, sd, &tp, &ps, &L->state, &pray)) { if (kernel_path_volume_bounce(kg, sd, &tp, &ps, &L->state, &pray)) {
kernel_path_indirect(kg, indirect_sd, emission_sd, &pray, tp, &ps, L); kernel_path_indirect(kg, indirect_sd, emission_sd, &pray, tp, &ps, L, object);
/* for render passes, sum and reset indirect light pass variables /* for render passes, sum and reset indirect light pass variables
* for the next samples */ * for the next samples */
@@ -266,7 +268,8 @@ ccl_device_noinline_cpu void kernel_branched_path_surface_indirect_light(KernelG
ps.rng_hash = state->rng_hash; ps.rng_hash = state->rng_hash;
kernel_path_indirect(kg, indirect_sd, emission_sd, &bsdf_ray, tp * num_samples_inv, &ps, L); kernel_path_indirect(
kg, indirect_sd, emission_sd, &bsdf_ray, tp * num_samples_inv, &ps, L, sd->object);
/* for render passes, sum and reset indirect light pass variables /* for render passes, sum and reset indirect light pass variables
* for the next samples */ * for the next samples */
@@ -395,7 +398,7 @@ ccl_device void kernel_branched_path_integrate(KernelGlobals *kg,
for (;;) { for (;;) {
/* Find intersection with objects in scene. */ /* Find intersection with objects in scene. */
Intersection isect; Intersection isect;
bool hit = kernel_path_scene_intersect(kg, &state, &ray, &isect, L); bool hit = kernel_path_scene_intersect(kg, &state, &ray, &isect, L, sd.object);
# ifdef __VOLUME__ # ifdef __VOLUME__
/* Volume integration. */ /* Volume integration. */

View File

@@ -182,9 +182,8 @@ CCL_NAMESPACE_BEGIN
# undef __SHADER_RAYTRACE__ # undef __SHADER_RAYTRACE__
#endif #endif
/* Features that enable others */ #ifdef WITH_CYCLES_DEBUG_NAN
#ifdef WITH_CYCLES_DEBUG # define __KERNEL_DEBUG_NAN__
# define __KERNEL_DEBUG__
#endif #endif
#if defined(__SUBSURFACE__) || defined(__SHADER_RAYTRACE__) #if defined(__SUBSURFACE__) || defined(__SHADER_RAYTRACE__)
@@ -356,12 +355,6 @@ typedef enum PassType {
PASS_MATERIAL_ID, PASS_MATERIAL_ID,
PASS_MOTION, PASS_MOTION,
PASS_MOTION_WEIGHT, 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_RENDER_TIME,
PASS_CRYPTOMATTE, PASS_CRYPTOMATTE,
PASS_AOV_COLOR, PASS_AOV_COLOR,
@@ -465,18 +458,6 @@ typedef enum DenoiseFlag {
DENOISING_CLEAN_ALL_PASSES = (1 << 6) - 1, DENOISING_CLEAN_ALL_PASSES = (1 << 6) - 1,
} DenoiseFlag; } 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 { typedef ccl_addr_space struct PathRadianceState {
#ifdef __PASSES__ #ifdef __PASSES__
float3 diffuse; float3 diffuse;
@@ -552,10 +533,6 @@ typedef ccl_addr_space struct PathRadiance {
float3 denoising_albedo; float3 denoising_albedo;
float denoising_depth; float denoising_depth;
#endif /* __DENOISING_FEATURES__ */ #endif /* __DENOISING_FEATURES__ */
#ifdef __KERNEL_DEBUG__
DebugData debug_data;
#endif /* __KERNEL_DEBUG__ */
} PathRadiance; } PathRadiance;
typedef struct BsdfEval { typedef struct BsdfEval {
@@ -671,12 +648,6 @@ typedef struct Intersection {
int prim; int prim;
int object; int object;
int type; int type;
#ifdef __KERNEL_DEBUG__
int num_traversed_nodes;
int num_traversed_instances;
int num_intersections;
#endif
} Intersection; } Intersection;
/* Primitives */ /* Primitives */
@@ -1265,13 +1236,6 @@ typedef struct KernelFilm {
int pass_bake_differential; int pass_bake_differential;
int pad; 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 */ /* viewport rendering options */
int display_pass_stride; int display_pass_stride;
int display_pass_components; int display_pass_components;
@@ -1483,7 +1447,10 @@ typedef struct KernelObject {
float shadow_terminator_shading_offset; float shadow_terminator_shading_offset;
float shadow_terminator_geometry_offset; float shadow_terminator_geometry_offset;
float pad1, pad2, pad3;
float ao_distance;
float pad1, pad2;
} KernelObject; } KernelObject;
static_assert_align(KernelObject, 16); static_assert_align(KernelObject, 16);

View File

@@ -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 * - 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 **** */ /* **** 1D Voronoi **** */

View File

@@ -65,7 +65,10 @@ ccl_device void kernel_scene_intersect(KernelGlobals *kg)
PathRadiance *L = &kernel_split_state.path_radiance[ray_index]; PathRadiance *L = &kernel_split_state.path_radiance[ray_index];
Intersection isect; Intersection isect;
bool hit = kernel_path_scene_intersect(kg, state, &ray, &isect, L); const int last_object = state->bounce > 0 ?
intersection_get_object(kg, &kernel_split_state.isect[ray_index]) :
OBJECT_NONE;
bool hit = kernel_path_scene_intersect(kg, state, &ray, &isect, L, last_object);
kernel_split_state.isect[ray_index] = isect; kernel_split_state.isect[ray_index] = isect;
if (!hit) { if (!hit) {

View File

@@ -17,14 +17,19 @@
CCL_NAMESPACE_BEGIN CCL_NAMESPACE_BEGIN
/* /*
* Original code is under the MIT License, Copyright (c) 2013 Inigo Quilez.
*
* Smooth Voronoi: * Smooth Voronoi:
* *
* - https://wiki.blender.org/wiki/User:OmarSquircleArt/GSoC2019/Documentation/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 **** */ /* **** 1D Voronoi **** */

View File

@@ -20,6 +20,7 @@
#include "render/mesh.h" #include "render/mesh.h"
#include "util/util_foreach.h" #include "util/util_foreach.h"
#include "util/util_logging.h"
#include "util/util_transform.h" #include "util/util_transform.h"
CCL_NAMESPACE_BEGIN CCL_NAMESPACE_BEGIN
@@ -208,6 +209,7 @@ size_t Attribute::element_size(Geometry *geom, AttributePrimitive prim) const
case ATTR_ELEMENT_VERTEX_MOTION: case ATTR_ELEMENT_VERTEX_MOTION:
if (geom->geometry_type == Geometry::MESH) { if (geom->geometry_type == Geometry::MESH) {
Mesh *mesh = static_cast<Mesh *>(geom); 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); size = (mesh->get_verts().size() + mesh->get_num_ngons()) * (mesh->get_motion_steps() - 1);
if (prim == ATTR_PRIM_SUBD) { if (prim == ATTR_PRIM_SUBD) {
size -= mesh->get_num_subd_verts() * (mesh->get_motion_steps() - 1); 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: case ATTR_ELEMENT_CURVE_KEY_MOTION:
if (geom->geometry_type == Geometry::HAIR) { if (geom->geometry_type == Geometry::HAIR) {
Hair *hair = static_cast<Hair *>(geom); Hair *hair = static_cast<Hair *>(geom);
DCHECK_GT(hair->get_motion_steps(), 0);
size = hair->get_curve_keys().size() * (hair->get_motion_steps() - 1); size = hair->get_curve_keys().size() * (hair->get_motion_steps() - 1);
} }
break; break;

View File

@@ -322,15 +322,6 @@ bool RenderBuffers::get_pass_rect(
pixels[0] = saturate(f * scale_exposure); 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 { else {
for (int i = 0; i < size; i++, in += pass_stride, pixels++) { for (int i = 0; i < size; i++, in += pass_stride, pixels++) {
float f = *in; float f = *in;

View File

@@ -51,12 +51,6 @@ static NodeEnum *get_pass_type_enum()
pass_type_enum.insert("material_id", PASS_MATERIAL_ID); pass_type_enum.insert("material_id", PASS_MATERIAL_ID);
pass_type_enum.insert("motion", PASS_MOTION); pass_type_enum.insert("motion", PASS_MOTION);
pass_type_enum.insert("motion_weight", PASS_MOTION_WEIGHT); 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("render_time", PASS_RENDER_TIME);
pass_type_enum.insert("cryptomatte", PASS_CRYPTOMATTE); pass_type_enum.insert("cryptomatte", PASS_CRYPTOMATTE);
pass_type_enum.insert("aov_color", PASS_AOV_COLOR); 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; pass.components = 0;
break; 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: case PASS_RENDER_TIME:
/* This pass is handled entirely on the host side. */ /* This pass is handled entirely on the host side. */
pass.components = 0; pass.components = 0;
@@ -570,20 +555,6 @@ void Film::device_update(Device *device, DeviceScene *dscene, Scene *scene)
kfilm->pass_bake_differential = kfilm->pass_stride; kfilm->pass_bake_differential = kfilm->pass_stride;
break; 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: case PASS_RENDER_TIME:
break; break;
case PASS_CRYPTOMATTE: case PASS_CRYPTOMATTE:

View File

@@ -356,7 +356,7 @@ class ShaderGraph : public NodeOwner {
/* This function is used to create a node of a specified type instead of /* 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. * 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...); T *node = new T(args...);
node->set_owner(this); node->set_owner(this);

View File

@@ -102,6 +102,8 @@ NODE_DEFINE(Object)
SOCKET_NODE(particle_system, "Particle System", ParticleSystem::get_node_type()); SOCKET_NODE(particle_system, "Particle System", ParticleSystem::get_node_type());
SOCKET_INT(particle_index, "Particle Index", 0); SOCKET_INT(particle_index, "Particle Index", 0);
SOCKET_FLOAT(ao_distance, "AO Distance", 0.0f);
return type; return type;
} }
@@ -428,6 +430,7 @@ void ObjectManager::device_update_object_transform(UpdateObjectTransformState *s
kobject.random_number = random_number; kobject.random_number = random_number;
kobject.particle_index = particle_index; kobject.particle_index = particle_index;
kobject.motion_offset = 0; kobject.motion_offset = 0;
kobject.ao_distance = ob->ao_distance;
if (geom->get_use_motion_blur()) { if (geom->get_use_motion_blur()) {
state->have_motion = true; state->have_motion = true;

View File

@@ -73,6 +73,8 @@ class Object : public Node {
NODE_SOCKET_API(ParticleSystem *, particle_system); NODE_SOCKET_API(ParticleSystem *, particle_system);
NODE_SOCKET_API(int, particle_index); NODE_SOCKET_API(int, particle_index);
NODE_SOCKET_API(float, ao_distance)
Object(); Object();
~Object(); ~Object();

View File

@@ -299,7 +299,7 @@ class Scene : public NodeOwner {
* node array (e.g. Scene::geometry for Geometry nodes) and tag the appropriate * node array (e.g. Scene::geometry for Geometry nodes) and tag the appropriate
* manager for an update. * 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...); T *node = new T(args...);
node->set_owner(this); node->set_owner(this);

View File

@@ -57,7 +57,7 @@ struct avxb {
: m256(_mm256_insertf128_ps(_mm256_castps128_ps256(a), b, 1)) : m256(_mm256_insertf128_ps(_mm256_castps128_ps256(a), b, 1))
{ {
} }
__forceinline operator const __m256 &(void)const __forceinline operator const __m256 &(void) const
{ {
return m256; return m256;
} }

View File

@@ -54,7 +54,7 @@ struct avxi {
__forceinline avxi(const __m256i a) : m256(a) __forceinline avxi(const __m256i a) : m256(a)
{ {
} }
__forceinline operator const __m256i &(void)const __forceinline operator const __m256i &(void) const
{ {
return m256; return m256;
} }

View File

@@ -26,9 +26,9 @@
CCL_NAMESPACE_BEGIN CCL_NAMESPACE_BEGIN
#ifdef WITH_CYCLES_LOGGING
static bool is_verbosity_set() static bool is_verbosity_set()
{ {
#ifdef WITH_CYCLES_LOGGING
using CYCLES_GFLAGS_NAMESPACE::GetCommandLineOption; using CYCLES_GFLAGS_NAMESPACE::GetCommandLineOption;
std::string verbosity; std::string verbosity;
@@ -36,10 +36,8 @@ static bool is_verbosity_set()
return false; return false;
} }
return verbosity != "0"; return verbosity != "0";
#else
return false;
#endif
} }
#endif
void util_logging_init(const char *argv0) void util_logging_init(const char *argv0)
{ {

View File

@@ -40,7 +40,7 @@ class LogMessageVoidify {
LogMessageVoidify() LogMessageVoidify()
{ {
} }
void operator&(StubStream &) void operator&(const StubStream &)
{ {
} }
}; };
@@ -49,6 +49,36 @@ class LogMessageVoidify {
# define LOG(severity) LOG_SUPPRESS() # define LOG(severity) LOG_SUPPRESS()
# define VLOG(severity) LOG_SUPPRESS() # define VLOG(severity) LOG_SUPPRESS()
# define VLOG_IF(severity, condition) 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 #endif
#define VLOG_ONCE(level, flag) \ #define VLOG_ONCE(level, flag) \

View File

@@ -103,7 +103,7 @@ ccl_device float fast_sinf(float x)
* 1.19209e-07 max error * 1.19209e-07 max error
*/ */
int q = fast_rint(x * M_1_PI_F); 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.78515625f * 4, x);
x = madd(qf, -0.00024187564849853515625f * 4, x); x = madd(qf, -0.00024187564849853515625f * 4, x);
x = madd(qf, -3.7747668102383613586e-08f * 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(). */ /* Same argument reduction as fast_sinf(). */
int q = fast_rint(x * M_1_PI_F); 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.78515625f * 4, x);
x = madd(qf, -0.00024187564849853515625f * 4, x); x = madd(qf, -0.00024187564849853515625f * 4, x);
x = madd(qf, -3.7747668102383613586e-08f * 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. */ /* Same argument reduction as fast_sin. */
int q = fast_rint(x * M_1_PI_F); 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.78515625f * 4, x);
x = madd(qf, -0.00024187564849853515625f * 4, x); x = madd(qf, -0.00024187564849853515625f * 4, x);
x = madd(qf, -3.7747668102383613586e-08f * 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 * we sometimes need to take the reciprocal of the polynomial
*/ */
int q = fast_rint(x * 2.0f * M_1_PI_F); 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.78515625f * 2, x);
x = madd(qf, -0.00024187564849853515625f * 2, x); x = madd(qf, -0.00024187564849853515625f * 2, x);
x = madd(qf, -3.7747668102383613586e-08f * 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 = fabsf(x);
x = clamp(x, FLT_MIN, FLT_MAX); x = clamp(x, FLT_MIN, FLT_MAX);
unsigned bits = __float_as_uint(x); unsigned bits = __float_as_uint(x);
return (int)(bits >> 23) - 127; return (float)((int)(bits >> 23) - 127);
} }
ccl_device float fast_exp2f(float x) ccl_device float fast_exp2f(float x)

View File

@@ -57,7 +57,7 @@ struct sseb {
__forceinline sseb(const __m128 input) : m128(input) __forceinline sseb(const __m128 input) : m128(input)
{ {
} }
__forceinline operator const __m128 &(void)const __forceinline operator const __m128 &(void) const
{ {
return m128; return m128;
} }

View File

@@ -57,7 +57,7 @@ struct ssei {
__forceinline ssei(const __m128i a) : m128(a) __forceinline ssei(const __m128i a) : m128(a)
{ {
} }
__forceinline operator const __m128i &(void)const __forceinline operator const __m128i &(void) const
{ {
return m128; return m128;
} }

View File

@@ -1066,22 +1066,6 @@ void GHOST_XrDestroyActions(GHOST_XrContextHandle xr_context,
uint32_t count, uint32_t count,
const char *const *action_names); const char *const *action_names);
/**
* Create spaces for pose-based OpenXR actions.
*/
int GHOST_XrCreateActionSpaces(GHOST_XrContextHandle xr_context,
const char *action_set_name,
uint32_t count,
const GHOST_XrActionSpaceInfo *infos);
/**
* Destroy previously created spaces for OpenXR actions.
*/
void GHOST_XrDestroyActionSpaces(GHOST_XrContextHandle xr_context,
const char *action_set_name,
uint32_t count,
const GHOST_XrActionSpaceInfo *infos);
/** /**
* Create input/output path bindings for OpenXR actions. * Create input/output path bindings for OpenXR actions.
*/ */
@@ -1096,7 +1080,8 @@ int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_context,
void GHOST_XrDestroyActionBindings(GHOST_XrContextHandle xr_context, void GHOST_XrDestroyActionBindings(GHOST_XrContextHandle xr_context,
const char *action_set_name, const char *action_set_name,
uint32_t count, uint32_t count,
const GHOST_XrActionProfileInfo *infos); const char *const *action_names,
const char *const *profile_paths);
/** /**
* Attach all created action sets to the current OpenXR session. * Attach all created action sets to the current OpenXR session.
@@ -1117,6 +1102,7 @@ int GHOST_XrSyncActions(GHOST_XrContextHandle xr_context, const char *action_set
int GHOST_XrApplyHapticAction(GHOST_XrContextHandle xr_context, int GHOST_XrApplyHapticAction(GHOST_XrContextHandle xr_context,
const char *action_set_name, const char *action_set_name,
const char *action_name, const char *action_name,
const char **subaction_path,
const int64_t *duration, const int64_t *duration,
const float *frequency, const float *frequency,
const float *amplitude); const float *amplitude);
@@ -1126,7 +1112,8 @@ int GHOST_XrApplyHapticAction(GHOST_XrContextHandle xr_context,
*/ */
void GHOST_XrStopHapticAction(GHOST_XrContextHandle xr_context, void GHOST_XrStopHapticAction(GHOST_XrContextHandle xr_context,
const char *action_set_name, const char *action_set_name,
const char *action_name); const char *action_name,
const char **subaction_path);
/** /**
* Get action set custom data (owned by Blender, not GHOST). * Get action set custom data (owned by Blender, not GHOST).
@@ -1141,6 +1128,18 @@ void *GHOST_XrGetActionCustomdata(GHOST_XrContextHandle xr_context,
const char *action_set_name, const char *action_set_name,
const char *action_name); const char *action_name);
/**
* Get the number of actions in an action set.
*/
unsigned int GHOST_XrGetActionCount(GHOST_XrContextHandle xr_context, const char *action_set_name);
/**
* Get custom data for all actions in an action set.
*/
void GHOST_XrGetActionCustomdataArray(GHOST_XrContextHandle xr_context,
const char *action_set_name,
void **r_customdata_array);
#endif /* WITH_XR_OPENXR */ #endif /* WITH_XR_OPENXR */
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -719,29 +719,27 @@ typedef struct GHOST_XrActionInfo {
const char **subaction_paths; const char **subaction_paths;
/** States for each subaction path. */ /** States for each subaction path. */
void *states; void *states;
/** Input thresholds/regions for each subaction path. */
float *float_thresholds;
int16_t *axis_flags;
GHOST_XrCustomdataFreeFn customdata_free_fn; GHOST_XrCustomdataFreeFn customdata_free_fn;
void *customdata; /* wmXrAction */ void *customdata; /* wmXrAction */
} GHOST_XrActionInfo; } GHOST_XrActionInfo;
typedef struct GHOST_XrActionSpaceInfo {
const char *action_name;
uint32_t count_subaction_paths;
const char **subaction_paths;
/** Poses for each subaction path. */
const GHOST_XrPose *poses;
} GHOST_XrActionSpaceInfo;
typedef struct GHOST_XrActionBindingInfo { typedef struct GHOST_XrActionBindingInfo {
const char *action_name; const char *component_path;
uint32_t count_interaction_paths; float float_threshold;
/** Interaction path: User (sub-action) path + component path. */ int16_t axis_flag;
const char **interaction_paths; GHOST_XrPose pose;
} GHOST_XrActionBindingInfo; } GHOST_XrActionBindingInfo;
typedef struct GHOST_XrActionProfileInfo { typedef struct GHOST_XrActionProfileInfo {
const char *action_name;
const char *profile_path; const char *profile_path;
uint32_t count_bindings; uint32_t count_subaction_paths;
const char **subaction_paths;
/* Bindings for each subaction path. */
const GHOST_XrActionBindingInfo *bindings; const GHOST_XrActionBindingInfo *bindings;
} GHOST_XrActionProfileInfo; } GHOST_XrActionProfileInfo;

View File

@@ -961,28 +961,6 @@ void GHOST_XrDestroyActions(GHOST_XrContextHandle xr_contexthandle,
GHOST_XR_CAPI_CALL(xr_session->destroyActions(action_set_name, count, action_names), xr_context); GHOST_XR_CAPI_CALL(xr_session->destroyActions(action_set_name, count, action_names), xr_context);
} }
int GHOST_XrCreateActionSpaces(GHOST_XrContextHandle xr_contexthandle,
const char *action_set_name,
uint32_t count,
const GHOST_XrActionSpaceInfo *infos)
{
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
GHOST_XrSession *xr_session = xr_context->getSession();
GHOST_XR_CAPI_CALL_RET(xr_session->createActionSpaces(action_set_name, count, infos),
xr_context);
return 0;
}
void GHOST_XrDestroyActionSpaces(GHOST_XrContextHandle xr_contexthandle,
const char *action_set_name,
uint32_t count,
const GHOST_XrActionSpaceInfo *infos)
{
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
GHOST_XrSession *xr_session = xr_context->getSession();
GHOST_XR_CAPI_CALL(xr_session->destroyActionSpaces(action_set_name, count, infos), xr_context);
}
int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_contexthandle, int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_contexthandle,
const char *action_set_name, const char *action_set_name,
uint32_t count, uint32_t count,
@@ -998,11 +976,14 @@ int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_contexthandle,
void GHOST_XrDestroyActionBindings(GHOST_XrContextHandle xr_contexthandle, void GHOST_XrDestroyActionBindings(GHOST_XrContextHandle xr_contexthandle,
const char *action_set_name, const char *action_set_name,
uint32_t count, uint32_t count,
const GHOST_XrActionProfileInfo *infos) const char *const *action_names,
const char *const *profile_paths)
{ {
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle; GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
GHOST_XrSession *xr_session = xr_context->getSession(); GHOST_XrSession *xr_session = xr_context->getSession();
GHOST_XR_CAPI_CALL(xr_session->destroyActionBindings(action_set_name, count, infos), xr_context); GHOST_XR_CAPI_CALL(
xr_session->destroyActionBindings(action_set_name, count, action_names, profile_paths),
xr_context);
} }
int GHOST_XrAttachActionSets(GHOST_XrContextHandle xr_contexthandle) int GHOST_XrAttachActionSets(GHOST_XrContextHandle xr_contexthandle)
@@ -1024,25 +1005,29 @@ int GHOST_XrSyncActions(GHOST_XrContextHandle xr_contexthandle, const char *acti
int GHOST_XrApplyHapticAction(GHOST_XrContextHandle xr_contexthandle, int GHOST_XrApplyHapticAction(GHOST_XrContextHandle xr_contexthandle,
const char *action_set_name, const char *action_set_name,
const char *action_name, const char *action_name,
const char **subaction_path,
const int64_t *duration, const int64_t *duration,
const float *frequency, const float *frequency,
const float *amplitude) const float *amplitude)
{ {
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle; GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
GHOST_XrSession *xr_session = xr_context->getSession(); GHOST_XrSession *xr_session = xr_context->getSession();
GHOST_XR_CAPI_CALL_RET(xr_session->applyHapticAction( GHOST_XR_CAPI_CALL_RET(
action_set_name, action_name, *duration, *frequency, *amplitude), xr_session->applyHapticAction(
xr_context); action_set_name, action_name, subaction_path, *duration, *frequency, *amplitude),
xr_context);
return 0; return 0;
} }
void GHOST_XrStopHapticAction(GHOST_XrContextHandle xr_contexthandle, void GHOST_XrStopHapticAction(GHOST_XrContextHandle xr_contexthandle,
const char *action_set_name, const char *action_set_name,
const char *action_name) const char *action_name,
const char **subaction_path)
{ {
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle; GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
GHOST_XrSession *xr_session = xr_context->getSession(); GHOST_XrSession *xr_session = xr_context->getSession();
GHOST_XR_CAPI_CALL(xr_session->stopHapticAction(action_set_name, action_name), xr_context); GHOST_XR_CAPI_CALL(xr_session->stopHapticAction(action_set_name, action_name, subaction_path),
xr_context);
} }
void *GHOST_XrGetActionSetCustomdata(GHOST_XrContextHandle xr_contexthandle, void *GHOST_XrGetActionSetCustomdata(GHOST_XrContextHandle xr_contexthandle,
@@ -1065,4 +1050,23 @@ void *GHOST_XrGetActionCustomdata(GHOST_XrContextHandle xr_contexthandle,
return 0; return 0;
} }
unsigned int GHOST_XrGetActionCount(GHOST_XrContextHandle xr_contexthandle,
const char *action_set_name)
{
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
GHOST_XrSession *xr_session = xr_context->getSession();
GHOST_XR_CAPI_CALL_RET(xr_session->getActionCount(action_set_name), xr_context);
return 0;
}
void GHOST_XrGetActionCustomdataArray(GHOST_XrContextHandle xr_contexthandle,
const char *action_set_name,
void **r_customdata_array)
{
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
GHOST_XrSession *xr_session = xr_context->getSession();
GHOST_XR_CAPI_CALL(xr_session->getActionCustomdataArray(action_set_name, r_customdata_array),
xr_context);
}
#endif /* WITH_XR_OPENXR */ #endif /* WITH_XR_OPENXR */

View File

@@ -402,7 +402,9 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
if (!EGL_CHK(::eglInitialize(m_display, &egl_major, &egl_minor))) if (!EGL_CHK(::eglInitialize(m_display, &egl_major, &egl_minor)))
goto error; goto error;
#ifdef WITH_GHOST_DEBUG
fprintf(stderr, "EGL Version %d.%d\n", egl_major, egl_minor); 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))) if (!EGL_CHK(::eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)))
goto error; goto error;

View File

@@ -32,7 +32,7 @@
#include <cstdio> #include <cstdio>
#include <cstring> #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 #define USE_GLXEW_INIT_WORKAROUND
#ifdef USE_GLXEW_INIT_WORKAROUND #ifdef USE_GLXEW_INIT_WORKAROUND
@@ -295,8 +295,8 @@ GHOST_TSuccess GHOST_ContextGLX::initializeDrawingContext()
glXMakeCurrent(m_display, m_window, m_context); glXMakeCurrent(m_display, m_window, m_context);
// Seems that this has to be called after MakeCurrent, /* Seems that this has to be called after #glXMakeCurrent,
// which means we cannot use glX extensions until after we create a context * which means we cannot use `glX` extensions until after we create a context. */
initContextGLXEW(); initContextGLXEW();
if (m_window) { if (m_window) {

View File

@@ -475,16 +475,15 @@ int GHOST_ContextWGL::choose_pixel_format(bool stereoVisual, bool needAlpha)
PIXELFORMATDESCRIPTOR preferredPFD = { PIXELFORMATDESCRIPTOR preferredPFD = {
sizeof(PIXELFORMATDESCRIPTOR), /* size */ sizeof(PIXELFORMATDESCRIPTOR), /* size */
1, /* version */ 1, /* version */
(DWORD)( (DWORD)(PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW |
PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER | /* support double-buffering */
PFD_DOUBLEBUFFER | /* support double-buffering */ (stereoVisual ? PFD_STEREO : 0) | /* support stereo */
(stereoVisual ? PFD_STEREO : 0) | /* support stereo */ (
(
#ifdef WIN32_COMPOSITING #ifdef WIN32_COMPOSITING
needAlpha ? /* Support composition for transparent background. */
PFD_SUPPORT_COMPOSITION : /* support composition for transparent background */ needAlpha ? PFD_SUPPORT_COMPOSITION :
#endif #endif
0)), 0)),
PFD_TYPE_RGBA, /* color type */ PFD_TYPE_RGBA, /* color type */
(BYTE)(needAlpha ? 32 : 24), /* preferred color depth */ (BYTE)(needAlpha ? 32 : 24), /* preferred color depth */
0, 0,

View File

@@ -141,22 +141,26 @@ GHOST_TSuccess GHOST_DisplayManagerCocoa::setCurrentDisplaySetting(
printf(" setting.frequency=%d\n", setting.frequency); printf(" setting.frequency=%d\n", setting.frequency);
#endif // GHOST_DEBUG #endif // GHOST_DEBUG
// Display configuration is no more available in 10.6 /* Display configuration is no more available in 10.6. */
/* CFDictionaryRef displayModeValues = ::CGDisplayBestModeForParametersAndRefreshRate( #if 0
m_displayIDs[display], CFDictionaryRef displayModeValues = ::CGDisplayBestModeForParametersAndRefreshRate(
(size_t)setting.bpp, m_displayIDs[display],
(size_t)setting.xPixels, (size_t)setting.bpp,
(size_t)setting.yPixels, (size_t)setting.xPixels,
(CGRefreshRate)setting.frequency, (size_t)setting.yPixels,
NULL);*/ (CGRefreshRate)setting.frequency,
NULL);
#endif
#ifdef GHOST_DEBUG #ifdef GHOST_DEBUG
/* printf("GHOST_DisplayManagerCocoa::setCurrentDisplaySetting(): switching to:\n"); # if 0
printf("GHOST_DisplayManagerCocoa::setCurrentDisplaySetting(): switching to:\n");
printf(" setting.xPixels=%d\n", getValue(displayModeValues, kCGDisplayWidth)); printf(" setting.xPixels=%d\n", getValue(displayModeValues, kCGDisplayWidth));
printf(" setting.yPixels=%d\n", getValue(displayModeValues, kCGDisplayHeight)); printf(" setting.yPixels=%d\n", getValue(displayModeValues, kCGDisplayHeight));
printf(" setting.bpp=%d\n", getValue(displayModeValues, kCGDisplayBitsPerPixel)); printf(" setting.bpp=%d\n", getValue(displayModeValues, kCGDisplayBitsPerPixel));
printf(" setting.frequency=%d\n", getValue(displayModeValues, kCGDisplayRefreshRate)); */ printf(" setting.frequency=%d\n", getValue(displayModeValues, kCGDisplayRefreshRate));
# endif
#endif // GHOST_DEBUG #endif // GHOST_DEBUG
// CGDisplayErr err = ::CGDisplaySwitchToMode(m_displayIDs[display], displayModeValues); // CGDisplayErr err = ::CGDisplaySwitchToMode(m_displayIDs[display], displayModeValues);

View File

@@ -32,8 +32,9 @@
GHOST_ImeWin32::GHOST_ImeWin32() GHOST_ImeWin32::GHOST_ImeWin32()
: is_composing_(false), : is_composing_(false),
ime_status_(false),
input_language_id_(LANG_USER_DEFAULT), input_language_id_(LANG_USER_DEFAULT),
conversion_modes_(IME_CMODE_ALPHANUMERIC),
sentence_mode_(IME_SMODE_NONE),
system_caret_(false), system_caret_(false),
caret_rect_(-1, -1, 0, 0), caret_rect_(-1, -1, 0, 0),
is_first(true), is_first(true),
@@ -45,18 +46,70 @@ GHOST_ImeWin32::~GHOST_ImeWin32()
{ {
} }
bool GHOST_ImeWin32::SetInputLanguage() void GHOST_ImeWin32::UpdateInputLanguage()
{ {
/** /**
* Retrieve the current keyboard layout from Windows and determine whether * Store the current input language.
* or not the current input context has IMEs.
* Also save its input language for language-specific operations required
* while composing a text.
*/ */
HKL keyboard_layout = ::GetKeyboardLayout(0); HKL input_locale = ::GetKeyboardLayout(0);
input_language_id_ = LOWORD(keyboard_layout); input_language_id_ = LOWORD(input_locale);
ime_status_ = ::ImmIsIME(keyboard_layout); }
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) void GHOST_ImeWin32::CreateImeWindow(HWND window_handle)

View File

@@ -88,7 +88,7 @@ class GHOST_EventIME : public GHOST_Event {
* An application CAN call ::DefWindowProc(). * An application CAN call ::DefWindowProc().
* 2.5. WM_INPUTLANGCHANGE (0x0051) * 2.5. WM_INPUTLANGCHANGE (0x0051)
* Call the functions listed below: * Call the functions listed below:
* - GHOST_ImeWin32::SetInputLanguage(). * - GHOST_ImeWin32::UpdateInputLanguage().
* An application CAN call ::DefWindowProc(). * An application CAN call ::DefWindowProc().
*/ */
@@ -148,13 +148,20 @@ class GHOST_ImeWin32 {
/** /**
* Retrieves the input language from Windows and update it. * Retrieves the input language from Windows and update it.
* Return values
* * true
* The given input language has IMEs.
* * false
* The given input language does not have IMEs.
*/ */
bool SetInputLanguage(); void UpdateInputLanguage();
/* 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. * Create the IME windows, and allocate required resources for them.
@@ -338,15 +345,6 @@ class GHOST_ImeWin32 {
*/ */
bool is_composing_; bool is_composing_;
/**
* This value represents whether or not the current input context has IMEs.
* The following table shows the list of IME status:
* Value Description
* false The current input language does not have IMEs.
* true The current input language has IMEs.
*/
bool ime_status_;
/** /**
* The current input Language ID retrieved from Windows, which consists of: * The current input Language ID retrieved from Windows, which consists of:
* * Primary Language ID (bit 0 to bit 9), which shows a natural language * * Primary Language ID (bit 0 to bit 9), which shows a natural language
@@ -371,6 +369,12 @@ class GHOST_ImeWin32 {
*/ */
LANGID input_language_id_; 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 * Represents whether or not the current input context has created a system
* caret to set the position of its IME candidate window. * caret to set the position of its IME candidate window.

View File

@@ -1587,7 +1587,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
{ {
NSTimeInterval timestamp = [event timestamp]; NSTimeInterval timestamp = [event timestamp];
if (timestamp < m_last_warp_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. */ * ignore those. */
break; break;
} }

View File

@@ -473,7 +473,7 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
GHOST_TKey gkey = convertSDLKey(sdl_sub_evt.keysym.scancode); GHOST_TKey gkey = convertSDLKey(sdl_sub_evt.keysym.scancode);
/* NOTE: the `sdl_sub_evt.keysym.sym` is truncated, /* NOTE: the `sdl_sub_evt.keysym.sym` is truncated,
* for unicode support ghost has to be modified. */ * for unicode support ghost has to be modified. */
/* printf("%d\n", sym); */ // printf("%d\n", sym);
if (sym > 127) { if (sym > 127) {
switch (sym) { switch (sym) {
case SDLK_KP_DIVIDE: case SDLK_KP_DIVIDE:

View File

@@ -1219,6 +1219,12 @@ GHOST_EventKey *GHOST_SystemWin32::processKeyEvent(GHOST_WindowWin32 *window, RA
ascii = utf8_char[0] & 0x80 ? '?' : utf8_char[0]; 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(), event = new GHOST_EventKey(system->getMilliSeconds(),
keyDown ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, keyDown ? GHOST_kEventKeyDown : GHOST_kEventKeyUp,
window, window,
@@ -1418,7 +1424,8 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
case WM_INPUTLANGCHANGE: { case WM_INPUTLANGCHANGE: {
system->handleKeyboardChange(); system->handleKeyboardChange();
#ifdef WITH_INPUT_IME #ifdef WITH_INPUT_IME
window->getImeInput()->SetInputLanguage(); window->getImeInput()->UpdateInputLanguage();
window->getImeInput()->UpdateConversionStatus(hwnd);
#endif #endif
break; break;
} }
@@ -1455,9 +1462,16 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// IME events, processed, read more in GHOST_IME.h // 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: { case WM_IME_SETCONTEXT: {
GHOST_ImeWin32 *ime = window->getImeInput(); GHOST_ImeWin32 *ime = window->getImeInput();
ime->SetInputLanguage(); ime->UpdateInputLanguage();
ime->CreateImeWindow(hwnd); ime->CreateImeWindow(hwnd);
ime->CleanupComposition(hwnd); ime->CleanupComposition(hwnd);
ime->CheckFirst(hwnd); ime->CheckFirst(hwnd);
@@ -1466,8 +1480,6 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
case WM_IME_STARTCOMPOSITION: { case WM_IME_STARTCOMPOSITION: {
GHOST_ImeWin32 *ime = window->getImeInput(); GHOST_ImeWin32 *ime = window->getImeInput();
eventHandled = true; eventHandled = true;
/* remove input event before start comp event, avoid redundant input */
eventManager->removeTypeEvents(GHOST_kEventKeyDown, window);
ime->CreateImeWindow(hwnd); ime->CreateImeWindow(hwnd);
ime->ResetComposition(hwnd); ime->ResetComposition(hwnd);
event = processImeEvent(GHOST_kEventImeCompositionStart, window, &ime->eventImeData); event = processImeEvent(GHOST_kEventImeCompositionStart, window, &ime->eventImeData);
@@ -2111,10 +2123,9 @@ GHOST_TSuccess GHOST_SystemWin32::showMessageBox(const char *title,
config.cbSize = sizeof(config); config.cbSize = sizeof(config);
config.hInstance = 0; config.hInstance = 0;
config.dwCommonButtons = 0; config.dwCommonButtons = 0;
config.pszMainIcon = (dialog_options & GHOST_DialogError ? config.pszMainIcon = (dialog_options & GHOST_DialogError ? TD_ERROR_ICON :
TD_ERROR_ICON : dialog_options & GHOST_DialogWarning ? TD_WARNING_ICON :
dialog_options & GHOST_DialogWarning ? TD_WARNING_ICON : TD_INFORMATION_ICON);
TD_INFORMATION_ICON);
config.pszWindowTitle = L"Blender"; config.pszWindowTitle = L"Blender";
config.pszMainInstruction = title_16; config.pszMainInstruction = title_16;
config.pszContent = message_16; config.pszContent = message_16;

View File

@@ -802,8 +802,7 @@ static bool checkTabletProximity(Display *display, XDevice *device)
if (state) { if (state) {
XInputClass *cls = state->data; XInputClass *cls = state->data;
// printf("%d class%s :\n", state->num_classes, // printf("%d class%s :\n", state->num_classes, (state->num_classes > 1) ? "es" : "");
// (state->num_classes > 1) ? "es" : "");
for (int loop = 0; loop < state->num_classes; loop++) { for (int loop = 0; loop < state->num_classes; loop++) {
switch (cls->c_class) { switch (cls->c_class) {
case ValuatorClass: case ValuatorClass:
@@ -1189,9 +1188,9 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
else { else {
printf("Bad keycode lookup. Keysym 0x%x Status: %s\n", printf("Bad keycode lookup. Keysym 0x%x Status: %s\n",
(unsigned int)key_sym, (unsigned int)key_sym,
(status == XLookupNone ? (status == XLookupNone ? "XLookupNone" :
"XLookupNone" : status == XLookupKeySym ? "XLookupKeySym" :
status == XLookupKeySym ? "XLookupKeySym" : "Unknown status")); "Unknown status"));
printf("'%.*s' %p %p\n", len, utf8_buf, xic, m_xim); printf("'%.*s' %p %p\n", len, utf8_buf, xic, m_xim);
} }

View File

@@ -403,7 +403,7 @@ GHOST_WindowX11::GHOST_WindowX11(GHOST_SystemX11 *system,
} }
if (natom) { if (natom) {
/* printf("Register atoms: %d\n", natom); */ // printf("Register atoms: %d\n", natom);
XSetWMProtocols(m_display, m_window, atoms, natom); XSetWMProtocols(m_display, m_window, atoms, natom);
} }
} }
@@ -1275,15 +1275,15 @@ GHOST_Context *GHOST_WindowX11::newDrawingContext(GHOST_TDrawingContextType type
{ {
if (type == GHOST_kDrawingContextTypeOpenGL) { if (type == GHOST_kDrawingContextTypeOpenGL) {
// During development: /* During development:
// try 4.x compatibility profile * - Try 4.x compatibility profile.
// try 3.3 compatibility profile * - Try 3.3 compatibility profile.
// fall back to 3.0 if needed * - Fall back to 3.0 if needed.
// *
// Final Blender 2.8: * Final Blender 2.8:
// try 4.x core profile * - Try 4.x core profile
// try 3.3 core profile * - Try 3.3 core profile
// no fallbacks * - No fall-backs. */
#if defined(WITH_GL_PROFILE_CORE) #if defined(WITH_GL_PROFILE_CORE)
{ {

View File

@@ -33,24 +33,22 @@
* *
* \{ */ * \{ */
GHOST_XrActionSpace::GHOST_XrActionSpace(XrInstance instance, GHOST_XrActionSpace::GHOST_XrActionSpace(XrSession session,
XrSession session,
XrAction action, XrAction action,
const GHOST_XrActionSpaceInfo &info, const char *action_name,
uint32_t subaction_idx) const char *profile_path,
XrPath subaction_path,
const char *subaction_path_str,
const GHOST_XrPose &pose)
{ {
const char *subaction_path = info.subaction_paths[subaction_idx];
CHECK_XR(xrStringToPath(instance, subaction_path, &m_subaction_path),
(std::string("Failed to get user path \"") + subaction_path + "\".").data());
XrActionSpaceCreateInfo action_space_info{XR_TYPE_ACTION_SPACE_CREATE_INFO}; XrActionSpaceCreateInfo action_space_info{XR_TYPE_ACTION_SPACE_CREATE_INFO};
action_space_info.action = action; action_space_info.action = action;
action_space_info.subactionPath = m_subaction_path; action_space_info.subactionPath = subaction_path;
copy_ghost_pose_to_openxr_pose(info.poses[subaction_idx], action_space_info.poseInActionSpace); copy_ghost_pose_to_openxr_pose(pose, action_space_info.poseInActionSpace);
CHECK_XR(xrCreateActionSpace(session, &action_space_info, &m_space), CHECK_XR(xrCreateActionSpace(session, &action_space_info, &m_space),
(std::string("Failed to create space \"") + subaction_path + "\" for action \"" + (std::string("Failed to create space \"") + subaction_path_str + "\" for action \"" +
info.action_name + "\".") action_name + "\" and profile \"" + profile_path + "\".")
.data()); .data());
} }
@@ -66,11 +64,6 @@ XrSpace GHOST_XrActionSpace::getSpace() const
return m_space; return m_space;
} }
const XrPath &GHOST_XrActionSpace::getSubactionPath() const
{
return m_subaction_path;
}
/** \} */ /** \} */
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */
@@ -79,13 +72,19 @@ const XrPath &GHOST_XrActionSpace::getSubactionPath() const
* \{ */ * \{ */
GHOST_XrActionProfile::GHOST_XrActionProfile(XrInstance instance, GHOST_XrActionProfile::GHOST_XrActionProfile(XrInstance instance,
XrSession session,
XrAction action, XrAction action,
const char *profile_path, GHOST_XrActionType type,
const GHOST_XrActionBindingInfo &info) const GHOST_XrActionProfileInfo &info)
{ {
CHECK_XR( CHECK_XR(xrStringToPath(instance, info.profile_path, &m_profile),
xrStringToPath(instance, profile_path, &m_profile), (std::string("Failed to get interaction profile path \"") + info.profile_path + "\".")
(std::string("Failed to get interaction profile path \"") + profile_path + "\".").data()); .data());
const bool is_float_action = (type == GHOST_kXrActionTypeFloatInput ||
type == GHOST_kXrActionTypeVector2fInput);
const bool is_button_action = (is_float_action || type == GHOST_kXrActionTypeBooleanInput);
const bool is_pose_action = (type == GHOST_kXrActionTypePoseInput);
/* Create bindings. */ /* Create bindings. */
XrInteractionProfileSuggestedBinding bindings_info{ XrInteractionProfileSuggestedBinding bindings_info{
@@ -93,31 +92,80 @@ GHOST_XrActionProfile::GHOST_XrActionProfile(XrInstance instance,
bindings_info.interactionProfile = m_profile; bindings_info.interactionProfile = m_profile;
bindings_info.countSuggestedBindings = 1; bindings_info.countSuggestedBindings = 1;
for (uint32_t interaction_idx = 0; interaction_idx < info.count_interaction_paths; for (uint32_t subaction_idx = 0; subaction_idx < info.count_subaction_paths; ++subaction_idx) {
++interaction_idx) { const char *subaction_path_str = info.subaction_paths[subaction_idx];
const char *interaction_path = info.interaction_paths[interaction_idx]; const GHOST_XrActionBindingInfo &binding_info = info.bindings[subaction_idx];
const std::string interaction_path = std::string(subaction_path_str) +
binding_info.component_path;
if (m_bindings.find(interaction_path) != m_bindings.end()) { if (m_bindings.find(interaction_path) != m_bindings.end()) {
continue; continue;
} }
XrActionSuggestedBinding sbinding; XrActionSuggestedBinding sbinding;
sbinding.action = action; sbinding.action = action;
CHECK_XR(xrStringToPath(instance, interaction_path, &sbinding.binding), CHECK_XR(xrStringToPath(instance, interaction_path.data(), &sbinding.binding),
(std::string("Failed to get interaction path \"") + interaction_path + "\".").data()); (std::string("Failed to get interaction path \"") + interaction_path + "\".").data());
bindings_info.suggestedBindings = &sbinding; bindings_info.suggestedBindings = &sbinding;
/* Although the bindings will be re-suggested in GHOST_XrSession::attachActionSets(), it /* Although the bindings will be re-suggested in GHOST_XrSession::attachActionSets(), it
* greatly improves error checking to suggest them here first. */ * greatly improves error checking to suggest them here first. */
CHECK_XR(xrSuggestInteractionProfileBindings(instance, &bindings_info), CHECK_XR(xrSuggestInteractionProfileBindings(instance, &bindings_info),
(std::string("Failed to create binding for profile \"") + profile_path + (std::string("Failed to create binding for action \"") + info.action_name +
"\" and action \"" + info.action_name + "\" and profile \"" + info.profile_path +
"\". Are the profile and action paths correct?") "\". Are the action and profile paths correct?")
.data()); .data());
m_bindings.insert({interaction_path, sbinding.binding}); m_bindings.insert({interaction_path, sbinding.binding});
if (m_subaction_data.find(subaction_path_str) == m_subaction_data.end()) {
std::map<std::string, GHOST_XrSubactionData>::iterator it =
m_subaction_data
.emplace(
std::piecewise_construct, std::make_tuple(subaction_path_str), std::make_tuple())
.first;
GHOST_XrSubactionData &subaction = it->second;
CHECK_XR(xrStringToPath(instance, subaction_path_str, &subaction.subaction_path),
(std::string("Failed to get user path \"") + subaction_path_str + "\".").data());
if (is_float_action || is_button_action) {
if (is_float_action) {
subaction.float_threshold = binding_info.float_threshold;
}
if (is_button_action) {
subaction.axis_flag = binding_info.axis_flag;
}
}
else if (is_pose_action) {
/* Create action space for pose bindings. */
subaction.space = std::make_unique<GHOST_XrActionSpace>(session,
action,
info.action_name,
info.profile_path,
subaction.subaction_path,
subaction_path_str,
binding_info.pose);
}
}
} }
} }
XrPath GHOST_XrActionProfile::getProfile() const
{
return m_profile;
}
const GHOST_XrSubactionData *GHOST_XrActionProfile::getSubaction(XrPath subaction_path) const
{
for (auto &[subaction_path_str, subaction] : m_subaction_data) {
if (subaction.subaction_path == subaction_path) {
return &subaction;
}
}
return nullptr;
}
void GHOST_XrActionProfile::getBindings( void GHOST_XrActionProfile::getBindings(
XrAction action, std::map<XrPath, std::vector<XrActionSuggestedBinding>> &r_bindings) const XrAction action, std::map<XrPath, std::vector<XrActionSuggestedBinding>> &r_bindings) const
{ {
@@ -152,14 +200,18 @@ GHOST_XrAction::GHOST_XrAction(XrInstance instance,
const GHOST_XrActionInfo &info) const GHOST_XrActionInfo &info)
: m_type(info.type), : m_type(info.type),
m_states(info.states), m_states(info.states),
m_float_thresholds(info.float_thresholds),
m_axis_flags(info.axis_flags),
m_custom_data_( m_custom_data_(
std::make_unique<GHOST_C_CustomDataWrapper>(info.customdata, info.customdata_free_fn)) std::make_unique<GHOST_C_CustomDataWrapper>(info.customdata, info.customdata_free_fn))
{ {
m_subaction_paths.resize(info.count_subaction_paths); m_subaction_paths.resize(info.count_subaction_paths);
for (uint32_t i = 0; i < info.count_subaction_paths; ++i) { for (uint32_t i = 0; i < info.count_subaction_paths; ++i) {
CHECK_XR(xrStringToPath(instance, info.subaction_paths[i], &m_subaction_paths[i]), const char *subaction_path_str = info.subaction_paths[i];
(std::string("Failed to get user path \"") + info.subaction_paths[i] + "\".").data()); CHECK_XR(xrStringToPath(instance, subaction_path_str, &m_subaction_paths[i]),
(std::string("Failed to get user path \"") + subaction_path_str + "\".").data());
m_subaction_indices.insert({subaction_path_str, i});
} }
XrActionCreateInfo action_info{XR_TYPE_ACTION_CREATE_INFO}; XrActionCreateInfo action_info{XR_TYPE_ACTION_CREATE_INFO};
@@ -201,52 +253,25 @@ GHOST_XrAction::~GHOST_XrAction()
} }
} }
bool GHOST_XrAction::createSpace(XrInstance instance,
XrSession session,
const GHOST_XrActionSpaceInfo &info)
{
uint32_t subaction_idx = 0;
for (; subaction_idx < info.count_subaction_paths; ++subaction_idx) {
if (m_spaces.find(info.subaction_paths[subaction_idx]) != m_spaces.end()) {
return false;
}
}
for (subaction_idx = 0; subaction_idx < info.count_subaction_paths; ++subaction_idx) {
m_spaces.emplace(std::piecewise_construct,
std::make_tuple(info.subaction_paths[subaction_idx]),
std::make_tuple(instance, session, m_action, info, subaction_idx));
}
return true;
}
void GHOST_XrAction::destroySpace(const char *subaction_path)
{
if (m_spaces.find(subaction_path) != m_spaces.end()) {
m_spaces.erase(subaction_path);
}
}
bool GHOST_XrAction::createBinding(XrInstance instance, bool GHOST_XrAction::createBinding(XrInstance instance,
const char *profile_path, XrSession session,
const GHOST_XrActionBindingInfo &info) const GHOST_XrActionProfileInfo &info)
{ {
if (m_profiles.find(profile_path) != m_profiles.end()) { if (m_profiles.find(info.profile_path) != m_profiles.end()) {
return false; return false;
} }
m_profiles.emplace(std::piecewise_construct, m_profiles.emplace(std::piecewise_construct,
std::make_tuple(profile_path), std::make_tuple(info.profile_path),
std::make_tuple(instance, m_action, profile_path, info)); std::make_tuple(instance, session, m_action, m_type, info));
return true; return true;
} }
void GHOST_XrAction::destroyBinding(const char *interaction_profile_path) void GHOST_XrAction::destroyBinding(const char *profile_path)
{ {
if (m_profiles.find(interaction_profile_path) != m_profiles.end()) { if (m_profiles.find(profile_path) != m_profiles.end()) {
m_profiles.erase(interaction_profile_path); m_profiles.erase(profile_path);
} }
} }
@@ -255,6 +280,10 @@ void GHOST_XrAction::updateState(XrSession session,
XrSpace reference_space, XrSpace reference_space,
const XrTime &predicted_display_time) const XrTime &predicted_display_time)
{ {
const bool is_float_action = (m_type == GHOST_kXrActionTypeFloatInput ||
m_type == GHOST_kXrActionTypeVector2fInput);
const bool is_button_action = (is_float_action || m_type == GHOST_kXrActionTypeBooleanInput);
XrActionStateGetInfo state_info{XR_TYPE_ACTION_STATE_GET_INFO}; XrActionStateGetInfo state_info{XR_TYPE_ACTION_STATE_GET_INFO};
state_info.action = m_action; state_info.action = m_action;
@@ -262,6 +291,28 @@ void GHOST_XrAction::updateState(XrSession session,
for (size_t subaction_idx = 0; subaction_idx < count_subaction_paths; ++subaction_idx) { for (size_t subaction_idx = 0; subaction_idx < count_subaction_paths; ++subaction_idx) {
state_info.subactionPath = m_subaction_paths[subaction_idx]; state_info.subactionPath = m_subaction_paths[subaction_idx];
/* Set subaction data based on current interaction profile. */
XrInteractionProfileState profile_state{XR_TYPE_INTERACTION_PROFILE_STATE};
CHECK_XR(xrGetCurrentInteractionProfile(session, state_info.subactionPath, &profile_state),
"Failed to get current interaction profile.");
const GHOST_XrSubactionData *subaction = nullptr;
for (auto &[profile_path, profile] : m_profiles) {
if (profile.getProfile() == profile_state.interactionProfile) {
subaction = profile.getSubaction(state_info.subactionPath);
break;
}
}
if (subaction != nullptr) {
if (is_float_action) {
m_float_thresholds[subaction_idx] = subaction->float_threshold;
}
if (is_button_action) {
m_axis_flags[subaction_idx] = subaction->axis_flag;
}
}
switch (m_type) { switch (m_type) {
case GHOST_kXrActionTypeBooleanInput: { case GHOST_kXrActionTypeBooleanInput: {
XrActionStateBoolean state{XR_TYPE_ACTION_STATE_BOOLEAN}; XrActionStateBoolean state{XR_TYPE_ACTION_STATE_BOOLEAN};
@@ -299,14 +350,9 @@ void GHOST_XrAction::updateState(XrSession session,
xrGetActionStatePose(session, &state_info, &state), xrGetActionStatePose(session, &state_info, &state),
(std::string("Failed to get state for pose action \"") + action_name + "\".").data()); (std::string("Failed to get state for pose action \"") + action_name + "\".").data());
if (state.isActive) { if (state.isActive) {
XrSpace pose_space = XR_NULL_HANDLE; XrSpace pose_space = ((subaction != nullptr) && (subaction->space != nullptr)) ?
for (auto &[path, space] : m_spaces) { subaction->space->getSpace() :
if (space.getSubactionPath() == state_info.subactionPath) { XR_NULL_HANDLE;
pose_space = space.getSpace();
break;
}
}
if (pose_space != XR_NULL_HANDLE) { if (pose_space != XR_NULL_HANDLE) {
XrSpaceLocation space_location{XR_TYPE_SPACE_LOCATION}; XrSpaceLocation space_location{XR_TYPE_SPACE_LOCATION};
CHECK_XR( CHECK_XR(
@@ -329,6 +375,7 @@ void GHOST_XrAction::updateState(XrSession session,
void GHOST_XrAction::applyHapticFeedback(XrSession session, void GHOST_XrAction::applyHapticFeedback(XrSession session,
const char *action_name, const char *action_name,
const char **subaction_path_str,
const int64_t &duration, const int64_t &duration,
const float &frequency, const float &frequency,
const float &amplitude) const float &amplitude)
@@ -342,24 +389,46 @@ void GHOST_XrAction::applyHapticFeedback(XrSession session,
XrHapticActionInfo haptic_info{XR_TYPE_HAPTIC_ACTION_INFO}; XrHapticActionInfo haptic_info{XR_TYPE_HAPTIC_ACTION_INFO};
haptic_info.action = m_action; haptic_info.action = m_action;
for (std::vector<XrPath>::iterator it = m_subaction_paths.begin(); it != m_subaction_paths.end(); if (subaction_path_str != nullptr) {
++it) { SubactionIndexMap::iterator it = m_subaction_indices.find(*subaction_path_str);
haptic_info.subactionPath = *it; if (it != m_subaction_indices.end()) {
CHECK_XR(xrApplyHapticFeedback(session, &haptic_info, (const XrHapticBaseHeader *)&vibration), haptic_info.subactionPath = m_subaction_paths[it->second];
(std::string("Failed to apply haptic action \"") + action_name + "\".").data()); CHECK_XR(
xrApplyHapticFeedback(session, &haptic_info, (const XrHapticBaseHeader *)&vibration),
(std::string("Failed to apply haptic action \"") + action_name + "\".").data());
}
}
else {
for (const XrPath &subaction_path : m_subaction_paths) {
haptic_info.subactionPath = subaction_path;
CHECK_XR(
xrApplyHapticFeedback(session, &haptic_info, (const XrHapticBaseHeader *)&vibration),
(std::string("Failed to apply haptic action \"") + action_name + "\".").data());
}
} }
} }
void GHOST_XrAction::stopHapticFeedback(XrSession session, const char *action_name) void GHOST_XrAction::stopHapticFeedback(XrSession session,
const char *action_name,
const char **subaction_path_str)
{ {
XrHapticActionInfo haptic_info{XR_TYPE_HAPTIC_ACTION_INFO}; XrHapticActionInfo haptic_info{XR_TYPE_HAPTIC_ACTION_INFO};
haptic_info.action = m_action; haptic_info.action = m_action;
for (std::vector<XrPath>::iterator it = m_subaction_paths.begin(); it != m_subaction_paths.end(); if (subaction_path_str != nullptr) {
++it) { SubactionIndexMap::iterator it = m_subaction_indices.find(*subaction_path_str);
haptic_info.subactionPath = *it; if (it != m_subaction_indices.end()) {
CHECK_XR(xrStopHapticFeedback(session, &haptic_info), haptic_info.subactionPath = m_subaction_paths[it->second];
(std::string("Failed to stop haptic action \"") + action_name + "\".").data()); CHECK_XR(xrStopHapticFeedback(session, &haptic_info),
(std::string("Failed to stop haptic action \"") + action_name + "\".").data());
}
}
else {
for (const XrPath &subaction_path : m_subaction_paths) {
haptic_info.subactionPath = subaction_path;
CHECK_XR(xrStopHapticFeedback(session, &haptic_info),
(std::string("Failed to stop haptic action \"") + action_name + "\".").data());
}
} }
} }
@@ -467,6 +536,19 @@ void *GHOST_XrActionSet::getCustomdata()
return m_custom_data_->custom_data_; return m_custom_data_->custom_data_;
} }
uint32_t GHOST_XrActionSet::getActionCount() const
{
return (uint32_t)m_actions.size();
}
void GHOST_XrActionSet::getActionCustomdataArray(void **r_customdata_array)
{
uint32_t i = 0;
for (auto &[name, action] : m_actions) {
r_customdata_array[i++] = action.getCustomdata();
}
}
void GHOST_XrActionSet::getBindings( void GHOST_XrActionSet::getBindings(
std::map<XrPath, std::vector<XrActionSuggestedBinding>> &r_bindings) const std::map<XrPath, std::vector<XrActionSuggestedBinding>> &r_bindings) const
{ {

View File

@@ -18,8 +18,8 @@
* \ingroup GHOST * \ingroup GHOST
*/ */
/* Note: Requires OpenXR headers to be included before this one for OpenXR types (XrSpace, XrPath, /* NOTE: Requires OpenXR headers to be included before this one for OpenXR types
* etc.). */ * (XrSpace, XrPath, etc.). */
#pragma once #pragma once
@@ -34,38 +34,53 @@
class GHOST_XrActionSpace { class GHOST_XrActionSpace {
public: public:
GHOST_XrActionSpace() = delete; /* Default constructor for map storage. */ GHOST_XrActionSpace() = delete; /* Default constructor for map storage. */
GHOST_XrActionSpace(XrInstance instance, GHOST_XrActionSpace(XrSession session,
XrSession session,
XrAction action, XrAction action,
const GHOST_XrActionSpaceInfo &info, const char *action_name,
uint32_t subaction_idx); const char *profile_path,
XrPath subaction_path,
const char *subaction_path_str,
const GHOST_XrPose &pose);
~GHOST_XrActionSpace(); ~GHOST_XrActionSpace();
XrSpace getSpace() const; XrSpace getSpace() const;
const XrPath &getSubactionPath() const;
private: private:
XrSpace m_space = XR_NULL_HANDLE; XrSpace m_space = XR_NULL_HANDLE;
XrPath m_subaction_path = XR_NULL_PATH;
}; };
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */
typedef struct GHOST_XrSubactionData {
XrPath subaction_path = XR_NULL_PATH;
float float_threshold;
int16_t axis_flag;
std::unique_ptr<GHOST_XrActionSpace> space = nullptr;
} GHOST_XrSubactionData;
/* -------------------------------------------------------------------- */
class GHOST_XrActionProfile { class GHOST_XrActionProfile {
public: public:
GHOST_XrActionProfile() = delete; /* Default constructor for map storage. */ GHOST_XrActionProfile() = delete; /* Default constructor for map storage. */
GHOST_XrActionProfile(XrInstance instance, GHOST_XrActionProfile(XrInstance instance,
XrSession session,
XrAction action, XrAction action,
const char *profile_path, GHOST_XrActionType type,
const GHOST_XrActionBindingInfo &info); const GHOST_XrActionProfileInfo &info);
~GHOST_XrActionProfile() = default; ~GHOST_XrActionProfile() = default;
XrPath getProfile() const;
const GHOST_XrSubactionData *getSubaction(XrPath subaction_path) const;
void getBindings(XrAction action, void getBindings(XrAction action,
std::map<XrPath, std::vector<XrActionSuggestedBinding>> &r_bindings) const; std::map<XrPath, std::vector<XrActionSuggestedBinding>> &r_bindings) const;
private: private:
XrPath m_profile = XR_NULL_PATH; XrPath m_profile = XR_NULL_PATH;
/* Bindings identified by interaction (user (subaction) + component) path. */
/** Sub-action data identified by user `subaction` path. */
std::map<std::string, GHOST_XrSubactionData> m_subaction_data;
/** Bindings identified by interaction (user `subaction` + component) path. */
std::map<std::string, XrPath> m_bindings; std::map<std::string, XrPath> m_bindings;
}; };
@@ -77,12 +92,9 @@ class GHOST_XrAction {
GHOST_XrAction(XrInstance instance, XrActionSet action_set, const GHOST_XrActionInfo &info); GHOST_XrAction(XrInstance instance, XrActionSet action_set, const GHOST_XrActionInfo &info);
~GHOST_XrAction(); ~GHOST_XrAction();
bool createSpace(XrInstance instance, XrSession session, const GHOST_XrActionSpaceInfo &info);
void destroySpace(const char *subaction_path);
bool createBinding(XrInstance instance, bool createBinding(XrInstance instance,
const char *profile_path, XrSession session,
const GHOST_XrActionBindingInfo &info); const GHOST_XrActionProfileInfo &info);
void destroyBinding(const char *profile_path); void destroyBinding(const char *profile_path);
void updateState(XrSession session, void updateState(XrSession session,
@@ -91,26 +103,31 @@ class GHOST_XrAction {
const XrTime &predicted_display_time); const XrTime &predicted_display_time);
void applyHapticFeedback(XrSession session, void applyHapticFeedback(XrSession session,
const char *action_name, const char *action_name,
const char **subaction_path,
const int64_t &duration, const int64_t &duration,
const float &frequency, const float &frequency,
const float &amplitude); const float &amplitude);
void stopHapticFeedback(XrSession session, const char *action_name); void stopHapticFeedback(XrSession session, const char *action_name, const char **subaction_path);
void *getCustomdata(); void *getCustomdata();
void getBindings(std::map<XrPath, std::vector<XrActionSuggestedBinding>> &r_bindings) const; void getBindings(std::map<XrPath, std::vector<XrActionSuggestedBinding>> &r_bindings) const;
private: private:
using SubactionIndexMap = std::map<std::string, uint32_t>;
XrAction m_action = XR_NULL_HANDLE; XrAction m_action = XR_NULL_HANDLE;
GHOST_XrActionType m_type; GHOST_XrActionType m_type;
SubactionIndexMap m_subaction_indices;
std::vector<XrPath> m_subaction_paths; std::vector<XrPath> m_subaction_paths;
/** States for each subaction path. */ /** States for each subaction path. */
void *m_states; void *m_states;
/** Input thresholds/regions for each subaction path. */
float *m_float_thresholds;
int16_t *m_axis_flags;
std::unique_ptr<GHOST_C_CustomDataWrapper> m_custom_data_ = nullptr; /* wmXrAction */ std::unique_ptr<GHOST_C_CustomDataWrapper> m_custom_data_ = nullptr; /* wmXrAction */
/* Spaces identified by user (subaction) path. */ /** Profiles identified by interaction profile path. */
std::map<std::string, GHOST_XrActionSpace> m_spaces;
/* Profiles identified by interaction profile path. */
std::map<std::string, GHOST_XrActionProfile> m_profiles; std::map<std::string, GHOST_XrActionProfile> m_profiles;
}; };
@@ -132,6 +149,8 @@ class GHOST_XrActionSet {
XrActionSet getActionSet() const; XrActionSet getActionSet() const;
void *getCustomdata(); void *getCustomdata();
uint32_t getActionCount() const;
void getActionCustomdataArray(void **r_customdata_array);
void getBindings(std::map<XrPath, std::vector<XrActionSuggestedBinding>> &r_bindings) const; void getBindings(std::map<XrPath, std::vector<XrActionSuggestedBinding>> &r_bindings) const;
private: private:

View File

@@ -610,57 +610,6 @@ void GHOST_XrSession::destroyActions(const char *action_set_name,
} }
} }
bool GHOST_XrSession::createActionSpaces(const char *action_set_name,
uint32_t count,
const GHOST_XrActionSpaceInfo *infos)
{
GHOST_XrActionSet *action_set = find_action_set(m_oxr.get(), action_set_name);
if (action_set == nullptr) {
return false;
}
XrInstance instance = m_context->getInstance();
XrSession session = m_oxr->session;
for (uint32_t action_idx = 0; action_idx < count; ++action_idx) {
const GHOST_XrActionSpaceInfo &info = infos[action_idx];
GHOST_XrAction *action = action_set->findAction(info.action_name);
if (action == nullptr) {
continue;
}
if (!action->createSpace(instance, session, info)) {
return false;
}
}
return true;
}
void GHOST_XrSession::destroyActionSpaces(const char *action_set_name,
uint32_t count,
const GHOST_XrActionSpaceInfo *infos)
{
GHOST_XrActionSet *action_set = find_action_set(m_oxr.get(), action_set_name);
if (action_set == nullptr) {
return;
}
for (uint32_t action_idx = 0; action_idx < count; ++action_idx) {
const GHOST_XrActionSpaceInfo &info = infos[action_idx];
GHOST_XrAction *action = action_set->findAction(info.action_name);
if (action == nullptr) {
continue;
}
for (uint32_t subaction_idx = 0; subaction_idx < info.count_subaction_paths; ++subaction_idx) {
action->destroySpace(info.subaction_paths[subaction_idx]);
}
}
}
bool GHOST_XrSession::createActionBindings(const char *action_set_name, bool GHOST_XrSession::createActionBindings(const char *action_set_name,
uint32_t count, uint32_t count,
const GHOST_XrActionProfileInfo *infos) const GHOST_XrActionProfileInfo *infos)
@@ -671,21 +620,17 @@ bool GHOST_XrSession::createActionBindings(const char *action_set_name,
} }
XrInstance instance = m_context->getInstance(); XrInstance instance = m_context->getInstance();
XrSession session = m_oxr->session;
for (uint32_t profile_idx = 0; profile_idx < count; ++profile_idx) { for (uint32_t profile_idx = 0; profile_idx < count; ++profile_idx) {
const GHOST_XrActionProfileInfo &info = infos[profile_idx]; const GHOST_XrActionProfileInfo &info = infos[profile_idx];
const char *profile_path = info.profile_path;
for (uint32_t binding_idx = 0; binding_idx < info.count_bindings; ++binding_idx) { GHOST_XrAction *action = action_set->findAction(info.action_name);
const GHOST_XrActionBindingInfo &binding = info.bindings[binding_idx]; if (action == nullptr) {
continue;
GHOST_XrAction *action = action_set->findAction(binding.action_name);
if (action == nullptr) {
continue;
}
action->createBinding(instance, profile_path, binding);
} }
action->createBinding(instance, session, info);
} }
return true; return true;
@@ -693,27 +638,21 @@ bool GHOST_XrSession::createActionBindings(const char *action_set_name,
void GHOST_XrSession::destroyActionBindings(const char *action_set_name, void GHOST_XrSession::destroyActionBindings(const char *action_set_name,
uint32_t count, uint32_t count,
const GHOST_XrActionProfileInfo *infos) const char *const *action_names,
const char *const *profile_paths)
{ {
GHOST_XrActionSet *action_set = find_action_set(m_oxr.get(), action_set_name); GHOST_XrActionSet *action_set = find_action_set(m_oxr.get(), action_set_name);
if (action_set == nullptr) { if (action_set == nullptr) {
return; return;
} }
for (uint32_t profile_idx = 0; profile_idx < count; ++profile_idx) { for (uint32_t i = 0; i < count; ++i) {
const GHOST_XrActionProfileInfo &info = infos[profile_idx]; GHOST_XrAction *action = action_set->findAction(action_names[i]);
const char *profile_path = info.profile_path; if (action == nullptr) {
continue;
for (uint32_t binding_idx = 0; binding_idx < info.count_bindings; ++binding_idx) {
const GHOST_XrActionBindingInfo &binding = info.bindings[binding_idx];
GHOST_XrAction *action = action_set->findAction(binding.action_name);
if (action == nullptr) {
continue;
}
action->destroyBinding(profile_path);
} }
action->destroyBinding(profile_paths[i]);
} }
} }
@@ -815,6 +754,7 @@ bool GHOST_XrSession::syncActions(const char *action_set_name)
bool GHOST_XrSession::applyHapticAction(const char *action_set_name, bool GHOST_XrSession::applyHapticAction(const char *action_set_name,
const char *action_name, const char *action_name,
const char **subaction_path,
const int64_t &duration, const int64_t &duration,
const float &frequency, const float &frequency,
const float &amplitude) const float &amplitude)
@@ -829,12 +769,15 @@ bool GHOST_XrSession::applyHapticAction(const char *action_set_name,
return false; return false;
} }
action->applyHapticFeedback(m_oxr->session, action_name, duration, frequency, amplitude); action->applyHapticFeedback(
m_oxr->session, action_name, subaction_path, duration, frequency, amplitude);
return true; return true;
} }
void GHOST_XrSession::stopHapticAction(const char *action_set_name, const char *action_name) void GHOST_XrSession::stopHapticAction(const char *action_set_name,
const char *action_name,
const char **subaction_path)
{ {
GHOST_XrActionSet *action_set = find_action_set(m_oxr.get(), action_set_name); GHOST_XrActionSet *action_set = find_action_set(m_oxr.get(), action_set_name);
if (action_set == nullptr) { if (action_set == nullptr) {
@@ -846,7 +789,7 @@ void GHOST_XrSession::stopHapticAction(const char *action_set_name, const char *
return; return;
} }
action->stopHapticFeedback(m_oxr->session, action_name); action->stopHapticFeedback(m_oxr->session, action_name, subaction_path);
} }
void *GHOST_XrSession::getActionSetCustomdata(const char *action_set_name) void *GHOST_XrSession::getActionSetCustomdata(const char *action_set_name)
@@ -874,4 +817,25 @@ void *GHOST_XrSession::getActionCustomdata(const char *action_set_name, const ch
return action->getCustomdata(); return action->getCustomdata();
} }
uint32_t GHOST_XrSession::getActionCount(const char *action_set_name)
{
GHOST_XrActionSet *action_set = find_action_set(m_oxr.get(), action_set_name);
if (action_set == nullptr) {
return 0;
}
return action_set->getActionCount();
}
void GHOST_XrSession::getActionCustomdataArray(const char *action_set_name,
void **r_customdata_array)
{
GHOST_XrActionSet *action_set = find_action_set(m_oxr.get(), action_set_name);
if (action_set == nullptr) {
return;
}
action_set->getActionCustomdataArray(r_customdata_array);
}
/** \} */ /* Actions */ /** \} */ /* Actions */

View File

@@ -60,18 +60,13 @@ class GHOST_XrSession {
void destroyActions(const char *action_set_name, void destroyActions(const char *action_set_name,
uint32_t count, uint32_t count,
const char *const *action_names); const char *const *action_names);
bool createActionSpaces(const char *action_set_name,
uint32_t count,
const GHOST_XrActionSpaceInfo *infos);
void destroyActionSpaces(const char *action_set_name,
uint32_t count,
const GHOST_XrActionSpaceInfo *infos);
bool createActionBindings(const char *action_set_name, bool createActionBindings(const char *action_set_name,
uint32_t count, uint32_t count,
const GHOST_XrActionProfileInfo *infos); const GHOST_XrActionProfileInfo *infos);
void destroyActionBindings(const char *action_set_name, void destroyActionBindings(const char *action_set_name,
uint32_t count, uint32_t count,
const GHOST_XrActionProfileInfo *infos); const char *const *action_names,
const char *const *profile_paths);
bool attachActionSets(); bool attachActionSets();
/** /**
@@ -81,14 +76,19 @@ class GHOST_XrSession {
bool syncActions(const char *action_set_name = nullptr); bool syncActions(const char *action_set_name = nullptr);
bool applyHapticAction(const char *action_set_name, bool applyHapticAction(const char *action_set_name,
const char *action_name, const char *action_name,
const char **subaction_path,
const int64_t &duration, const int64_t &duration,
const float &frequency, const float &frequency,
const float &amplitude); const float &amplitude);
void stopHapticAction(const char *action_set_name, const char *action_name); void stopHapticAction(const char *action_set_name,
const char *action_name,
const char **subaction_path);
/* Custom data (owned by Blender, not GHOST) accessors. */ /* Custom data (owned by Blender, not GHOST) accessors. */
void *getActionSetCustomdata(const char *action_set_name); void *getActionSetCustomdata(const char *action_set_name);
void *getActionCustomdata(const char *action_set_name, const char *action_name); void *getActionCustomdata(const char *action_set_name, const char *action_name);
uint32_t getActionCount(const char *action_set_name);
void getActionCustomdataArray(const char *action_set_name, void **r_customdata_array);
private: private:
/** Pointer back to context managing this session. Would be nice to avoid, but needed to access /** Pointer back to context managing this session. Would be nice to avoid, but needed to access

View File

@@ -299,9 +299,9 @@ template<class T> class MEM_CacheLimiter {
if (!can_destroy_element(elem)) if (!can_destroy_element(elem))
continue; continue;
/* by default 0 means highest priority element */ /* By default 0 means highest priority element. */
/* casting a size type to int is questionable, /* Casting a size type to int is questionable,
but unlikely to cause problems */ * but unlikely to cause problems. */
int priority = -((int)(queue.size()) - i - 1); int priority = -((int)(queue.size()) - i - 1);
priority = item_priority_func(elem->get()->get_data(), priority); priority = item_priority_func(elem->get()->get_data(), priority);

View File

@@ -20,7 +20,6 @@
set(INC set(INC
. .
intern
../guardedalloc ../guardedalloc
) )
@@ -42,14 +41,7 @@ if(WITH_OPENVDB)
) )
list(APPEND SRC list(APPEND SRC
intern/openvdb_level_set.cc
intern/openvdb_transform.cc
openvdb_capi.cc openvdb_capi.cc
openvdb_util.cc
intern/openvdb_level_set.h
intern/openvdb_transform.h
openvdb_util.h
) )
list(APPEND LIB list(APPEND LIB

View File

@@ -1,176 +0,0 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
*/
#include "openvdb_level_set.h"
#include "MEM_guardedalloc.h"
#include "openvdb/tools/Composite.h"
#include "openvdb_capi.h"
#include "openvdb_util.h"
OpenVDBLevelSet::OpenVDBLevelSet()
{
openvdb::initialize();
}
OpenVDBLevelSet::~OpenVDBLevelSet()
{
}
void OpenVDBLevelSet::mesh_to_level_set(const float *vertices,
const unsigned int *faces,
const unsigned int totvertices,
const unsigned 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++) {
points[i] = openvdb::Vec3s(vertices[i * 3], vertices[i * 3 + 1], vertices[i * 3 + 2]);
}
for (unsigned int i = 0; i < totfaces; i++) {
triangles[i] = openvdb::Vec3I(faces[i * 3], faces[i * 3 + 1], faces[i * 3 + 2]);
}
this->grid = openvdb::tools::meshToLevelSet<openvdb::FloatGrid>(
*xform, points, triangles, quads, 1);
}
void OpenVDBLevelSet::volume_to_mesh(OpenVDBVolumeToMeshData *mesh,
const double isovalue,
const double adaptivity,
const bool relax_disoriented_triangles)
{
std::vector<openvdb::Vec3s> out_points;
std::vector<openvdb::Vec4I> out_quads;
std::vector<openvdb::Vec3I> out_tris;
openvdb::tools::volumeToMesh<openvdb::FloatGrid>(*this->grid,
out_points,
out_tris,
out_quads,
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->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->totvertices = out_points.size();
mesh->tottriangles = out_tris.size();
mesh->totquads = out_quads.size();
for (size_t i = 0; i < out_points.size(); i++) {
mesh->vertices[i * 3] = out_points[i].x();
mesh->vertices[i * 3 + 1] = out_points[i].y();
mesh->vertices[i * 3 + 2] = out_points[i].z();
}
for (size_t i = 0; i < out_quads.size(); i++) {
mesh->quads[i * 4] = out_quads[i].x();
mesh->quads[i * 4 + 1] = out_quads[i].y();
mesh->quads[i * 4 + 2] = out_quads[i].z();
mesh->quads[i * 4 + 3] = out_quads[i].w();
}
for (size_t i = 0; i < out_tris.size(); i++) {
mesh->triangles[i * 3] = out_tris[i].x();
mesh->triangles[i * 3 + 1] = out_tris[i].y();
mesh->triangles[i * 3 + 2] = out_tris[i].z();
}
}
void OpenVDBLevelSet::filter(OpenVDBLevelSet_FilterType filter_type,
int width,
float distance,
OpenVDBLevelSet_FilterBias filter_bias)
{
if (!this->grid) {
return;
}
if (this->grid->getGridClass() != openvdb::GRID_LEVEL_SET) {
return;
}
openvdb::tools::LevelSetFilter<openvdb::FloatGrid> filter(*this->grid);
filter.setSpatialScheme((openvdb::math::BiasedGradientScheme)filter_bias);
switch (filter_type) {
case OPENVDB_LEVELSET_FILTER_GAUSSIAN:
filter.gaussian(width);
break;
case OPENVDB_LEVELSET_FILTER_MEDIAN:
filter.median(width);
break;
case OPENVDB_LEVELSET_FILTER_MEAN:
filter.mean(width);
break;
case OPENVDB_LEVELSET_FILTER_MEAN_CURVATURE:
filter.meanCurvature();
break;
case OPENVDB_LEVELSET_FILTER_LAPLACIAN:
filter.laplacian();
break;
case OPENVDB_LEVELSET_FILTER_DILATE:
filter.offset(distance);
break;
case OPENVDB_LEVELSET_FILTER_ERODE:
filter.offset(distance);
break;
case OPENVDB_LEVELSET_FILTER_NONE:
break;
}
}
openvdb::FloatGrid::Ptr OpenVDBLevelSet::CSG_operation_apply(
const openvdb::FloatGrid::Ptr &gridA,
const openvdb::FloatGrid::Ptr &gridB,
OpenVDBLevelSet_CSGOperation operation)
{
switch (operation) {
case OPENVDB_LEVELSET_CSG_UNION:
openvdb::tools::csgUnion(*gridA, *gridB);
break;
case OPENVDB_LEVELSET_CSG_DIFFERENCE:
openvdb::tools::csgDifference(*gridA, *gridB);
break;
case OPENVDB_LEVELSET_CSG_INTERSECTION:
openvdb::tools::csgIntersection(*gridA, *gridB);
break;
}
return gridA;
}
const openvdb::FloatGrid::Ptr &OpenVDBLevelSet::get_grid()
{
return this->grid;
}
void OpenVDBLevelSet::set_grid(const openvdb::FloatGrid::Ptr &grid)
{
this->grid = grid;
}

View File

@@ -1,60 +0,0 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
*/
#ifndef __OPENVDB_LEVEL_SET_H__
#define __OPENVDB_LEVEL_SET_H__
#include "openvdb_capi.h"
#include <openvdb/math/FiniteDifference.h>
#include <openvdb/openvdb.h>
#include <openvdb/tools/GridTransformer.h>
#include <openvdb/tools/LevelSetFilter.h>
#include <openvdb/tools/MeshToVolume.h>
#include <openvdb/tools/VolumeToMesh.h>
struct OpenVDBLevelSet {
private:
openvdb::FloatGrid::Ptr grid;
public:
OpenVDBLevelSet();
~OpenVDBLevelSet();
const openvdb::FloatGrid::Ptr &get_grid();
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 openvdb::math::Transform::Ptr &transform);
void volume_to_mesh(struct OpenVDBVolumeToMeshData *mesh,
const double isovalue,
const double adaptivity,
const bool relax_disoriented_triangles);
void filter(OpenVDBLevelSet_FilterType filter_type,
int width,
float distance,
OpenVDBLevelSet_FilterBias filter_bias);
openvdb::FloatGrid::Ptr CSG_operation_apply(const openvdb::FloatGrid::Ptr &gridA,
const openvdb::FloatGrid::Ptr &gridB,
OpenVDBLevelSet_CSGOperation operation);
};
#endif /* __OPENVDB_LEVEL_SET_H__ */

View File

@@ -18,151 +18,9 @@
*/ */
#include "openvdb_capi.h" #include "openvdb_capi.h"
#include "openvdb_level_set.h" #include <openvdb/openvdb.h>
#include "openvdb_transform.h"
#include "openvdb_util.h"
int OpenVDB_getVersionHex() int OpenVDB_getVersionHex()
{ {
return openvdb::OPENVDB_LIBRARY_VERSION; return openvdb::OPENVDB_LIBRARY_VERSION;
} }
OpenVDBLevelSet *OpenVDBLevelSet_create(bool initGrid, OpenVDBTransform *xform)
{
OpenVDBLevelSet *level_set = new OpenVDBLevelSet();
if (initGrid) {
openvdb::FloatGrid::Ptr grid = openvdb::FloatGrid::create();
grid->setGridClass(openvdb::GRID_LEVEL_SET);
if (xform) {
grid->setTransform(xform->get_transform());
}
level_set->set_grid(grid);
}
return level_set;
}
OpenVDBTransform *OpenVDBTransform_create()
{
return new OpenVDBTransform();
}
void OpenVDBTransform_free(OpenVDBTransform *transform)
{
delete transform;
}
void OpenVDBTransform_create_linear_transform(OpenVDBTransform *transform, double voxel_size)
{
transform->create_linear_transform(voxel_size);
}
void OpenVDBLevelSet_free(OpenVDBLevelSet *level_set)
{
delete 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,
OpenVDBTransform *xform)
{
level_set->mesh_to_level_set(vertices, faces, totvertices, totfaces, xform->get_transform());
}
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,
OpenVDBTransform *transform)
{
level_set->mesh_to_level_set(vertices, faces, totvertices, totfaces, transform->get_transform());
}
void OpenVDBLevelSet_volume_to_mesh(struct OpenVDBLevelSet *level_set,
struct OpenVDBVolumeToMeshData *mesh,
const double isovalue,
const double adaptivity,
const bool relax_disoriented_triangles)
{
level_set->volume_to_mesh(mesh, isovalue, adaptivity, relax_disoriented_triangles);
}
void OpenVDBLevelSet_filter(struct OpenVDBLevelSet *level_set,
OpenVDBLevelSet_FilterType filter_type,
int width,
float distance,
OpenVDBLevelSet_FilterBias bias)
{
level_set->filter(filter_type, width, distance, bias);
}
void OpenVDBLevelSet_CSG_operation(struct OpenVDBLevelSet *out,
struct OpenVDBLevelSet *gridA,
struct OpenVDBLevelSet *gridB,
OpenVDBLevelSet_CSGOperation operation)
{
openvdb::FloatGrid::Ptr grid = out->CSG_operation_apply(
gridA->get_grid(), gridB->get_grid(), operation);
out->set_grid(grid);
}
OpenVDBLevelSet *OpenVDBLevelSet_transform_and_resample(struct OpenVDBLevelSet *level_setA,
struct OpenVDBLevelSet *level_setB,
char sampler,
float isolevel)
{
openvdb::FloatGrid::Ptr sourceGrid = level_setA->get_grid();
openvdb::FloatGrid::Ptr targetGrid = level_setB->get_grid()->deepCopy();
const openvdb::math::Transform &sourceXform = sourceGrid->transform(),
&targetXform = targetGrid->transform();
// Compute a source grid to target grid transform.
// (For this example, we assume that both grids' transforms are linear,
// so that they can be represented as 4 x 4 matrices.)
openvdb::Mat4R xform = sourceXform.baseMap()->getAffineMap()->getMat4() *
targetXform.baseMap()->getAffineMap()->getMat4().inverse();
// Create the transformer.
openvdb::tools::GridTransformer transformer(xform);
switch (sampler) {
case OPENVDB_LEVELSET_GRIDSAMPLER_POINT:
// Resample using nearest-neighbor interpolation.
transformer.transformGrid<openvdb::tools::PointSampler, openvdb::FloatGrid>(*sourceGrid,
*targetGrid);
// Prune the target tree for optimal sparsity.
targetGrid->tree().prune();
break;
case OPENVDB_LEVELSET_GRIDSAMPLER_BOX:
// Resample using trilinear interpolation.
transformer.transformGrid<openvdb::tools::BoxSampler, openvdb::FloatGrid>(*sourceGrid,
*targetGrid);
// Prune the target tree for optimal sparsity.
targetGrid->tree().prune();
break;
case OPENVDB_LEVELSET_GRIDSAMPLER_QUADRATIC:
// Resample using triquadratic interpolation.
transformer.transformGrid<openvdb::tools::QuadraticSampler, openvdb::FloatGrid>(*sourceGrid,
*targetGrid);
// Prune the target tree for optimal sparsity.
targetGrid->tree().prune();
break;
case OPENVDB_LEVELSET_GRIDSAMPLER_NONE:
break;
}
targetGrid = openvdb::tools::levelSetRebuild(*targetGrid, isolevel, 1.0f);
openvdb::tools::pruneLevelSet(targetGrid->tree());
OpenVDBLevelSet *level_set = OpenVDBLevelSet_create(false, NULL);
level_set->set_grid(targetGrid);
return level_set;
}

Some files were not shown because too many files have changed in this diff Show More