Commit Graph

13023 Commits

Author SHA1 Message Date
Xavier Hallade
716f909a4f Cycles: add /jumptablerdata to MSVC compiler flags
Starting with MSVC 17.7 preview 3, /jumptablerdata is available and
allows to ensure switch tables don't get mixed with the code, helping on
performance when there is contention in a large switch statement, such
as in svm.h.

Pull Request: https://projects.blender.org/blender/blender/pulls/110470
2023-07-25 19:19:35 +02:00
Ray molenkamp
4ea2baf4ae CMake: revert last weeks modernizations
The cleanup of blenkernel last weeks , caused the house of cards to
collapse on  top of bf_gpu's shader_builder, which is off by default
but used on a daily basis by the rendering team.

Given the fixes forward in #110394 ran into a ODR violation in OSL that
was hiding there for years, I don't see another way forward without
impeding the rendering teams productivity for "quite a while" as there
is no guarantee the OSL issue would be the end of it.

the only way forward appears to be back.

this reverts :

19422044edbd8e8d524db3d02768c4a52f5274be
a670b53abe82f7a36d2caa0d8ae2c67c2bc8c39a
0f541db97c47e5fcd1c71160d71642235d9ea743
be516e8c814dbf7bc43ea91c6913be9f7f96e006
3e88a2f44c413fa7f671f638409a975d59f8c1fb
4e64b772f5ed8f352c2744baece802f70e2430e7
9547e7a317d6f86ab8fbfb3d440f127c2ab75df2
07fe6c5a57d7bcf89318204c0319db1f4a2f5cbd

The problematic commit was 07fe6c5a57d7bcf89318204c0319db1f4a2f5cbd
as blenkernel links most of blender, it's a bit of a link order issue
magnet. Given all these commits stack, it's near impossible to revert
just that one without spending a significant amount of time resolving
merge conflicts. 99% of that work was automated, so easier to just
revert all of them, and re-do the work, than it is to deal with the
merge conflicts.

Pull Request: https://projects.blender.org/blender/blender/pulls/110438
2023-07-25 16:43:21 +02:00
Xavier Hallade
aefc9835f8 Cycles: oneAPI: fix kernel host-side compilation with MSVC 17.7
<algorithm> header include is missing from some sycl headers, this will
be fixed upstream with https://github.com/intel/llvm/pull/10424,
meanwhile, we work around it by including it directly.
2023-07-25 12:01:09 +02:00
Campbell Barton
530ee6e7fa Cleanup: make class doc-strings directly above classes
In some cases it wasn't clear if a comment before a class was meant
to be it's doc-string. Remove blank lines between the class & it's
doc-string.
2023-07-25 14:11:42 +10:00
Campbell Barton
ac5be3efde Cleanup: use SPDX copyright in header 2023-07-25 13:59:53 +10:00
Hans Goudey
5e9ea9243b Mesh: Rename "polys" to "faces"
Implements part of #101689.

The "poly" name was chosen to distinguish the `MLoop` + `MPoly`
combination from the `MFace` struct it replaced. Those two structures
persisted together for a long time, but nowadays `MPoly` is gone, and
`MFace` is only used in some legacy code like the particle system.

To avoid unnecessarily using a different term, increase consistency
with the UI and with BMesh, and generally make code a bit easier to
read, this commit replaces the `poly` term with `poly`. Most variables
that use the term are renamed too. `Mesh.totface` and `Mesh.fdata` now
have a `_legacy` suffix to reduce confusion. In a next step, `pdata`
can be renamed to `face_data` as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/109819
2023-07-24 22:06:55 +02:00
Lukas Stockner
b19011e2db Cycles: Fix build error due to missing svm_closure_weight 2023-07-24 16:56:52 +02:00
Lukas Stockner
2c3b095995 Cycles: Don't store SVM closure weight in ShaderData
This is only used as temporary state while evaluating SVM nodes,
there's no point in storing it in the ShaderData for later.
Since ShaderData size is relevant for GPU performance, we should
save the space and only keep it where needed.

Pull Request: https://projects.blender.org/blender/blender/pulls/110366
2023-07-24 16:09:46 +02:00
Lukas Stockner
b220ec27d7 Cycles: Update Velvet BSDF to Sheen BSDF with new Microfiber sheen model
This patch extends the old Velvet BSDF node with a new shading model,
and renames it to Sheen BSDF accordingly.

The old model is still available, but new nodes now default to the
"Microfiber" model, which is an implementation of
https://tizianzeltner.com/projects/Zeltner2022Practical/.

Pull Request: https://projects.blender.org/blender/blender/pulls/108869
2023-07-24 15:36:36 +02:00
Lukas Stockner
56bc24aa9b Cycles: Merge OSL Clearcoat closure into microfacet()
There's no reason why this would need to be its own closure, it was
just a slightly different microfacet distribution with a hardcoded
IOR and intensity multiplier internally.

No functional change, just cleaning up the mess of custom OSL closures.

Pull Request: https://projects.blender.org/blender/blender/pulls/109951
2023-07-22 05:07:11 +02:00
Lukas Stockner
89218b66c2 Cycles: Remove Transmission Roughness from Principled BSDF
This was already unsupported in combination with Multiscattering GGX,
prevented the Principled BSDF from using microfaced-based Fresnel for
Glass materials, and would have made future improvements even trickier.

Pull Request: https://projects.blender.org/blender/blender/pulls/109950
2023-07-22 04:16:49 +02:00
Lukas Stockner
8639bf013c Cycles: Fix MNEE not accounting for closure Fresnel
Previously Glass Fresnel used to get baked into the closure weight,
so the MNEE code could just ignore it.
However, now that it's part of the closure implementation, we need
to account for it in the MNEE throughput calculation as well.
2023-07-22 04:02:14 +02:00
Ray Molenkamp
0f541db97c Cleanup: CMake: Modernize bf_intern_clog dependencies
Pretty straightforward

- Remove any clog paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/110350
2023-07-21 18:37:30 +02:00
Campbell Barton
08f4f1f41e Cleanup: spelling in comments, capitalize tags 2023-07-20 09:42:00 +10:00
Clément Foucault
cdb8a8929c GHOST: Delete Mac OpenGL support
The maximum OpenGL versions supported on mac
doesn't meet the minimum required version (>=4.3) anymore.

This removes all the OpenGL paths in GHOST
Cocoa backend and from the drop down menu in
the user preferences.

Pull Request: https://projects.blender.org/blender/blender/pulls/110185
2023-07-19 14:16:03 +02:00
Jeroen Bakker
567d992a69 Cleanup: Silence Compilation Warnings in GHOST
Pull Request: https://projects.blender.org/blender/blender/pulls/110260
2023-07-19 12:59:49 +02:00
Campbell Barton
29c2e71d1f Cleanup: quiet warnings 2023-07-18 14:18:06 +10:00
–kaspian.jakobssongmail.com
b767a62f32 Fix #109679: Normal Map node strength interpolation artifacts
Previously the normal strength linearly interpolated and extrapolated
the normal in world space. Instead do it in tangent space, in a way
that ensure the normal remains above the surface and valid.

Pull Request: https://projects.blender.org/blender/blender/pulls/109763
2023-07-17 20:06:41 +02:00
Clément Foucault
8191b152ec GHOST: Guard GL context creation behind WITH_OPENGL_BACKEND
Even if not currently needed, it should be possible to compile
without OpenGL.

Also make sure the logic is similar for all GHOST implementations.

Pull Request: https://projects.blender.org/blender/blender/pulls/110165
2023-07-16 19:58:10 +02:00
Campbell Barton
caf0024463 Cleanup: add degrees UTF8 symbol, prefer ascii over unicode in comments 2023-07-16 21:54:58 +10:00
Campbell Barton
d594954bf2 Cleanup: use C++ compatible struct declarations for Python API
Also add m_base & ob_base comments.
2023-07-16 18:13:15 +10:00
Clément Foucault
3478093183 GHOST: Bump OpenGL minimum version to 4.3
This removes the GL 3.3 fallback because default viewport engine
now require some features only present in GL 4.3.
Blender now also check for GL version 4.6 instead of 4.5 in some
cases.

Note that this does not remove the OpenGL support on Apple
hardware.

Pull Request: https://projects.blender.org/blender/blender/pulls/109390
2023-07-15 15:31:40 +02:00
Campbell Barton
3889baab4f Cleanup: spelling in comments 2023-07-15 15:54:55 +10:00
Weizhen Huang
a86506b741 Cleanup: sort enum KernelFeatureFlag in order
no functional change expected
2023-07-14 12:19:11 +02:00
Brecht Van Lommel
cc1ee96407 Fix Cycles HIP RT kernel not rebuilding on changes
Changes to the kernel source would not update the HIP RT binaries, leading
to render errors due to the kernel being mismatched with Blender.

The code this was copied from was inside a macro that defines the sources
variable, but it's not defined here.

Ref #109418

Pull Request: https://projects.blender.org/blender/blender/pulls/110073
2023-07-13 23:08:14 +02:00
Weizhen Huang
4724147479 Fix #109945: Division by zero in brick texture 2023-07-13 15:44:15 +02:00
Sergey Sharybin
99b962811b Cleanup: Fix typo in Cycles error log
Pull Request: https://projects.blender.org/blender/blender/pulls/110045
2023-07-13 09:37:02 +02:00
Harley Acheson
65e8b21a95 Fix #109525: Improved Win32 Repeat Key Filtering
Allows Win32 key repeat filtering to support multiple simultaneously
repeating keys, as can happen with modifiers. Removes
m_keycode_last_repeat_key and instead checks current down status.

Pull Request: https://projects.blender.org/blender/blender/pulls/109991
2023-07-12 20:55:00 +02:00
Germano Cavalcante
75658109be Fix #109630: Grave and Single Quote keys not being detected on MacOS
The `UCKeyTranslate` function was being used wrong.

The `deadKeyState` param should use `kUCKeyTranslateNoDeadKeysMask`
instead of `kUCKeyTranslateNoDeadKeysBit` (optionally could also use
`(1 << kUCKeyTranslateNoDeadKeysBit`)).

This commit also dispenses with accessing the keyAction, as this is not
crucial for determining the key.

Comments have also been added to better describe the code.

Pull Request: https://projects.blender.org/blender/blender/pulls/109987
2023-07-12 20:06:43 +02:00
Harley Acheson
b7a119c785 Fix #40059: Use Modifier Keys Between Windows on Win32
Use modifier keys that are pressed before activating a new window.
Allows call of `wm_window_update_eventstate_modifiers` on
`GHOST_kEventWindowActivate` by using `GetAsyncKeyState` instead of
`GetKeyState` in GHOST_SystemWin32::getModifierKeys, which retrieves
actual hardware state.

Pull Request: https://projects.blender.org/blender/blender/pulls/110020
2023-07-12 20:01:37 +02:00
Brecht Van Lommel
7f04df62e4 Fix Cycles division by zero in recent distant light texture coordinates 2023-07-12 18:14:11 +02:00
Hans Goudey
9a879b27b3 Cleanup: Fix macOS build error, move set performance test out of header
Fixes, similar to a5a72019a910952ac082e9613e95d0c672cf2964

Pull Request: https://projects.blender.org/blender/blender/pulls/110017
2023-07-12 18:04:13 +02:00
Ray Molenkamp
1058fd1b2b Ghost: Fix build error with MSVC 17.7 preview 3
the initialization of m_pkts with an int threw an error with
17.7P3 since it decided int -> uint64_t required a narrowing
conversion. Not sure why it got picky here all of a sudden
but given it's not wrong, we may as well fix it properly.

This change changes the queueSize parameter to size_t and
adds a bounds check at the calling site to ensure the value
it gets will be positive before casting.
2023-07-12 09:32:35 -06:00
Weizhen Huang
0b3efc9d8c Cleanup: Cycles: remove SHARP distribution internally
this option was already unselectable in the UI, and is treated as GGX
with zero roughness. Upon building the shader graph, we only convert a
closure to `SHARP` when option Filter Glossy is not used and the
roughness is below certain threshold. The benefit is that we can avoid
calling `bsdf_eval()` or return earlier in some cases, but the thresholds
vary across files.
This patch removes `SHARP` closures altogether, and checks if the
roughness value is below a global threshold `BSDF_ROUGHNESS_THRESH`
after blurring, in which case the flag `SD_BSDF_HAS_EVAL` is not set.
The global threshold is set to be `5e-7f` because threshold smaller than
that seems to have caused problem in the past (c6aa0217ac). Also removes
a bunch of functions, variables and arguments that were only there
because we converted closures under certain conditions.

Pull Request: https://projects.blender.org/blender/blender/pulls/109902
2023-07-12 12:36:31 +02:00
Harley Acheson
30d44548e3 Fix #109886: Win32 AutoFocus Between Main Windows
Allow auto-focusing between multiple parent (main) windows when they
are immediately adjacent.

Pull Request: https://projects.blender.org/blender/blender/pulls/109946
2023-07-11 21:13:50 +02:00
Ray molenkamp
07fe6c5a57 Cleanup: CMake: Modernize bf_blenkernel dependencies
Pretty straightforward

- Remove any blenkernel paths from INC
- Add a dependency though LIB

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/109939
2023-07-11 19:28:01 +02:00
Clément Foucault
40f89d23cb GHOST: Fix OpenGL backend isolation on Linux
This makes sure you can compile without the
WITH_OPENGL_BACKEND option.
2023-07-11 11:32:45 +02:00
Clément Foucault
1978b4fc92 GHOST: Replace WITH_OPENGL build option
Replaces it by WITH_OPENGL_BACKEND and cleanup its usage.
Limits visibility of opengl enums and cases.

Pull Request: https://projects.blender.org/blender/blender/pulls/109947
2023-07-11 09:17:31 +02:00
Ray Molenkamp
04235d0e55 Cleanup: CMake: Modernize bf_blenlib dependencies
Pretty straightforward

- Remove any blenlib paths from INC
- Add a dependency though LIB

Pull Request: https://projects.blender.org/blender/blender/pulls/109934
2023-07-10 22:04:18 +02:00
Ray Molenkamp
57ad866d81 Cleanup: CMake: Modernize bf_guardedalloc dependencies
Pretty straightforward

- Removes any guardedalloc paths from INC
- Adds a dependency though LIB

Pull Request: https://projects.blender.org/blender/blender/pulls/109925
2023-07-10 18:44:19 +02:00
Hoshinova
41335edf22 Fix #109254: Voronoi distance output is clamped at 8
The Voronoi distance output is clamped at 8, which is apparent for distance
metrics like Minkowski with low exponents.

This patch fixes that by setting the initial distance of the search loop to
FLT_MAX instead of 8. And for the Smooth variant of F1, the "h" parameter is set
to 1 for the first iteration using a signal value, effectively ignoring the
initial distance and using the computed distance at the first iteration instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/109286
2023-07-10 17:42:24 +02:00
Ray Molenkamp
7cebb61486 Cleanup: CMake: Modernize bf_dna dependencies
There's quite a few libraries that depend on dna_type_offsets.h
but had gotten to it by just adding the folder that contains it to
their includes INC section without declaring a dependency to
bf_dna in the LIB section.

which occasionally lead to the lib building before bf_dna and the
header being missing, while this generally gets fixed in CMake by
adding bf_dna to the LIB section of the lib, however until last
week all libraries in the LIB section were linked as INTERFACE so
adding it in there did not resolve the build issue.

To make things still build, we sprinkled add_dependencies wherever
we needed it to force a build order.

This diff :

Declares public include folders for the bf_dna target so there's
no more fudging the INC section required to get to them.

Removes all dna related paths from the INC section for all
libraries.

Adds an alias target bf:dna to signify it has been updated to
modern cmake

Declares a dependency on bf::dna for all libraries that require it

Removes (almost) all calls to add_dependencies for bf_dna

Future work:

Because of the manual dependency management that was done, there is
now some "clutter" with libs depending on bf_dna that realistically
don't. Example bf_intern_opencolorio itself has no dependency on
bf_dna at all, doesn't need it, doesn't use it. However the
dna include folder had been added to it in the past since bf_blenlib
uses dna headers in some of its public headers and
bf_intern_opencolorio does use those blenlib headers.

Given bf_blenlib now correctly declares the dependency on bf_dna
as public bf_intern_opencolorio will get the dna header directory
automatically from CMake, hence some cleanup could be done for
bf_intern_opencolorio

Because 99% of the changes in this diff have been automated, this diff
does not seek to address these issues as there is no easy way to
determine why a certain dependency is in place. A developer will have
to make a pass a this at some later point in time. As I'd rather not
mix automated and manual labour.

There are a few libraries that could not be automatically processed
(ie bf_blendthumb) that also will need this manual look-over.

Pull Request: https://projects.blender.org/blender/blender/pulls/109835
2023-07-10 15:07:37 +02:00
Brecht Van Lommel
f2705dd913 Fix #109683: Cycles and Eevee missing AOVs when no closure connected
No reason to skip these, and this will be useful for faster shader node
preview rendering based on AOVs.

Pull Request: https://projects.blender.org/blender/blender/pulls/109709
2023-07-10 12:41:44 +02:00
Weizhen Huang
ab12d2836b Cycles: add texture to sun light
Using area-preserving mapping from cone to disk. Has somewhat distortion
near 90°.
The texture rotates with the transformation of the light object, can
have negative and non-uniform scaling.

Pull Request: https://projects.blender.org/blender/blender/pulls/109842
2023-07-10 12:20:47 +02:00
Campbell Barton
4da96623ff CMake: use mark_as_advancd for most non WITH_* options
Avoid showing many obscure CMake options by default.
2023-07-10 12:02:15 +10:00
Campbell Barton
6290451712 Cleanup: spelling in comments 2023-07-09 21:22:45 +10:00
Guillermo Venegas
751db88748 Fix #109532: Added missing conversion from wl_fixed to int in Wayland
When blender is not focused and a selection is executed
with the mouse, since there is no conversion from `wl_fixed` to `int`,
the bounds of the selection can cause the selection box to be too large,
causing `draw_select_framebuffer_depth_only_setup` to fail when create
`g_select_buffer.texture_depth`.

Ref !109834
2023-07-09 16:57:37 +10:00
Brecht Van Lommel
7e55dfcf27 Fix #103918: Cycles point cloud motion blur artifacts on the GPU
Change storage to consistently put xyz + radius in the motion blur attribute.

Pull Request: https://projects.blender.org/blender/blender/pulls/109830
2023-07-07 20:15:36 +02:00
Brecht Van Lommel
f36d8eb064 Cycles Hydra: set background color depending if there are lights
So that there is some lighting when there are no lights in the scene,
and black when there are lights. This matches the behavior of other
Hydra renderers.

Ref #96731
2023-07-07 18:20:57 +02:00
Brecht Van Lommel
05c97df2de USD: improve light units conversion
* Use pi factor to convert between radiant flux and intensity
* Mark lights as normalized on export
* Add spot light export support
* Add treatAsPoint support for import and export
* Empirically match normalized distant light
* Fix wrong unnormalized point/sphere/disk light unit in Cycles

Overall it should be much closer now for all light types. Point and distant
light units are inconsistent between renderers, so not possible to match
everything there.

Ref #109404

Pull Request: https://projects.blender.org/blender/blender/pulls/109795
2023-07-07 18:20:39 +02:00