Commit Graph

4269 Commits

Author SHA1 Message Date
Campbell Barton
32fb40fa76 Cleanup: use function style casts for C++ 2023-07-14 12:31:00 +10:00
Brecht Van Lommel
9705f4cc56 Cleanup: rename GPU context in RenderEngine for consistency with other code 2023-07-12 18:14:11 +02:00
Brecht Van Lommel
b29d2c607d Fix #109718: Cycles crash with persistent data and bpy.ops.render
Don't reuse freed context for subsequent render.
2023-07-12 18:14:11 +02:00
Jacques Lucke
3f33e0c6cd Cleanup: clang format in disabled code segments
This formats code that is disabled using `#if 0`. Formatting was achieved
by temporarily changing `#if 0` to `#if 1 /*something*/`, then formatting,
and then changing it back to `#if 0`.
2023-07-12 14:18:59 +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
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
Sergey Sharybin
d579ac2b3f Refactor: Use ImBuf to store passes in RenderResult
Doing so avoids having duplicated logic for working with pixel
data which is being passed throughout the render pipeline.

Notable changes:

- ImBug can now store GPU texture.
  This is not very finished part of the API, which will be
  worked further to support tiling for very-high-res images.

- Implicit sharing is removed from the image buffer, as it is
  no longer needed.

There should be no functional changes on user level with this
change.

Ref #108618

Pull Request: https://projects.blender.org/blender/blender/pulls/109788
2023-07-10 16:33:32 +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
Bastien Montagne
739146bf33 UI Translations and messages fixes. 2023-07-10 14:34:41 +02:00
Bastien Montagne
f07fee0188 UI Translations: Add bunch of nissing error messages from IO C++ code and modifiers.
Also fix some incorrect usages of `N_` macro instead of `TIP_` one
(these error messages typically need to get translated explicitely, not
only marked for extraction).
2023-07-10 12:45:28 +02:00
Ray Molenkamp
f0ee4c3ffe Cleanup: Cmake: use alias target for bf_intern_atomic
This introduces an alias target `bf::intern::atomic` for
`bf_intern_atomic`. This has the following benefits:

- Any target name with `::` in it will be recognized as an actual
target by cmake, rather than a library name it may not know about.
and will be validated by cmake to exist. Which means if you make
a typo in the LIB section, CMake will error out telling you it
doesn't know about this specific target rather than passing it on
to the build system, where you'll either get build or linker errors
because of said typo.

- Given there is quite a cleanup still to do in the build system,
it won't always be obvious which targets have been updated to
modern targets and which still need to be done. Having a namespaced
target name is a good indicator there.

Pull Request: https://projects.blender.org/blender/blender/pulls/109784
2023-07-07 15:37:02 +02:00
Martijn Versteegh
cd4848a574 Cleanup: make format 2023-07-05 19:42:52 +02:00
Martijn Versteegh
5201a55ea0 Fix #109057: Only extend polygons present in the mask.
The Texture margin 'adjacent faces' algorithm always used the
full UV map, even if not all polygons were actually part of the
baking. Remedy this by checking the mask if passed in.

Pull Request: https://projects.blender.org/blender/blender/pulls/109500
2023-07-05 14:20:28 +02:00
Campbell Barton
785bd13b9a Cleanup: spelling in comments 2023-07-05 14:09:33 +10:00
Sergey Sharybin
b441a28ea0 Cleanup: Remove unused z_buffer from render result and view
They are not needed since the #109687

Pull Request: https://projects.blender.org/blender/blender/pulls/109702
2023-07-04 17:24:49 +02:00
Sergey Sharybin
e1b60fdb91 Remove Z Buffer from ImBuf
It was only used by OpenEXR and Iris images, and saving the Z Buffer
in those formats was disabled by default. This option comes from the
times prior to the addition of the Multilayer EXR.

It also worth noting that it was not possible to save Iris with Depth
pass from Blender as internally it is called IRIZ format and it was
not exposed. But even after exposing this format option something still
was missing as saving and loading ITIZ did not show up the Depth pass.

The reason of removal is to make it a more clear match of the ImBuf
with a render pass, and use it instead of a custom type in the render
result and render pass API. This will simplify the API and also avoid
stealing buffers and making shallow copies when showing the render
result.

For the cases when Depth is needed a Multilayer EXR is to be used,
as most likely more than just the Depth will be needed.

On a user level this change:

- Removes the "Z Buffer" option from the interface.

- It preserves existing sockets in compositor nodes, but it will
  output black image. Also changing the image data-block will
  remove the socket unless a Multilayer EXR with Depth pass image
  is selected.

- Removes "Depth" socket of the Viewer and Composite nodes.

Ref #108618

Pull Request: https://projects.blender.org/blender/blender/pulls/109687
2023-07-04 17:03:02 +02:00
Campbell Barton
69aee8ba6b Cleanup: remove redundant (void) for functions with no args in C++ 2023-07-02 19:54:27 +10:00
Campbell Barton
35389e8b35 Cleanup: use const qualifier for arguments & variables 2023-06-29 10:56:33 +10:00
Ray molenkamp
2dac20e35f CMake/Cleanup: Use bf_intern_atomic target
Use the bf_intern_atomic target rather than adding a relative path
to it in the INC section.

Pull Request: https://projects.blender.org/blender/blender/pulls/109424
2023-06-28 19:12:55 +02:00
Philipp Oeser
128c95438f Fix #109302: baking UDIM displacement normalization wrong
Since UDIM baking support in 6787cc13d4, the normalization of
diplacement heights was always based on the min/max height detected in
the _last_ tile, which could lead to clipping if the last tile had very
subtle (or no) displacement.

Now getting the min/max is spread across all images.
This also takes the first thread into account for getting the min/max (which for some reason was skipped).

Pull Request: https://projects.blender.org/blender/blender/pulls/109409
2023-06-28 14:58:52 +02:00
Campbell Barton
d1e6c8f5a6 Cleanup: spelling in comments 2023-06-28 12:27:48 +10:00
Campbell Barton
3c6239969e Cleanup: add size suffix to IMA_MAX_RENDER_TEXT
This read like a flag, when it's a string buffer size.
2023-06-27 14:51:03 +10:00
Brecht Van Lommel
16739b92ca Realtime Compositor: cache GPU context for repeated executions
Pull Request: https://projects.blender.org/blender/blender/pulls/108909
2023-06-23 20:13:25 +02:00
Brecht Van Lommel
711fb3e386 Realtime Compositor: cache render compositor for repeated executions
This is cached in Render, and gets cleared along with render pass GPU
textures when there is no editor open using it, or a new final render is
started.

The context and texture pool are cached. But the evaluator is re-created
every time as this only runs on compositing node changes, which require
recreating it anyway (unlike the viewport where e.g. camera navigation
does not need a new evaluator).

Pull Request: https://projects.blender.org/blender/blender/pulls/108909
2023-06-23 20:13:21 +02:00
Brecht Van Lommel
7a3a4b58e6 Fix realtime compositor not correctly handling multiple scene render layers
Pull Request: https://projects.blender.org/blender/blender/pulls/108909
2023-06-23 20:00:28 +02:00
Sergey Sharybin
d8cc8fcf7f Refactor: Move color space information to ImBuf buffers
Before this change the ImBuf struct had dedicated fields for the
buffer data. Now the color space is stored inside of the struct
which wraps around the buffer information.

This only changes the field placement, without changing the way
it is handled. In the future one might imagine that operations
like stealing buffer data should null-ify the buffer colorspace
pointer. Such changes would need to have more accurate thinking
before implementation.

Should be no functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/109291
2023-06-23 15:55:42 +02:00
Omar Emara
b450101000 Realtime Compositor: Add support for node previews
This patch adds support for node previews in the realtime compositor.
Only node operations have previews for now. Shader nodes likes the
MixRGB node does not have previews implemented yet due to required
sizable changes in the node compiler.

Depends on: #108900.

Pull Request: https://projects.blender.org/blender/blender/pulls/108904
2023-06-21 05:41:49 +02:00
Campbell Barton
b46b1c02a0 Cleanup: use enum for texture types
- move POINT_DATA_* to texture_pointdensity.c.
- remove MTEX_NSPACE_*.
- replace magic numbers with defines for Tex::vn_coltype comparisons.
- use doxy sections.
2023-06-21 11:29:00 +10:00
Campbell Barton
472c461816 Cleanup: spelling in comments 2023-06-21 11:28:58 +10:00
Brecht Van Lommel
7fe735ac99 Merge branch 'blender-v3.6-release' into main 2023-06-16 18:57:26 +02:00
Brecht Van Lommel
d5781c2a61 Fix #109048: RenderLayer.load_from_file does not support multilayer EXR
This was never implemented, only for the entire RenderResult.
2023-06-16 18:53:08 +02:00
Brecht Van Lommel
770616446b Fix #108966: multires UDIM bake progress bar exceeds 100% 2023-06-16 18:42:48 +02:00
Brecht Van Lommel
04c5736064 Fix preview renders not immediately updating with color management changes
Draw with a GPU shader every time, instead of doing CPU side cached color
management.

Pull Request: https://projects.blender.org/blender/blender/pulls/109026
2023-06-16 14:39:30 +02:00
Campbell Barton
24fef21bf8 Cleanup: cmake indentation 2023-06-16 12:20:33 +10:00
Campbell Barton
47b52b39ac Cleanup: use C++ conventions (function style cast, nullptr) 2023-06-14 12:20:07 +10:00
Richard Antalik
dc874b9f24 Fix #108613: Mute Audio for Playback also mutes for rendering
`AUDIO_MUTE` flag of `scene->audio.flag` works as intended and tooltip
for this property is not correct. However muting scene audio for
playback and rendering is not be very useful, since users can render
with no audio explicitly or adjust scene volume.

Only mute audio if `DAG_EVAL_VIEWPORT` mode is used.
2023-06-13 02:29:57 +02:00
Brecht Van Lommel
a88114b35e Realtime Compositor: cache render pass GPU textures
* Store per RenderPass in RenderResult.
* Caches are cleared when starting rendering, to make more memory available
  to GPU rendering.
* Caches are cleared on UI changes, when no compositing node editor and no
  image editor with a render result or viewer node image is visible.
* Store 3 channel RGB passes as such, and set alpha 1 in shader.

This is an intermediate step before implementing GPU backed ImBuf, to
improve performance and figure out cache eviction.

Pull Request: https://projects.blender.org/blender/blender/pulls/108818
2023-06-12 19:49:18 +02:00
Campbell Barton
39516324d2 Cleanup: various minor changes (code_clean.py) 2023-06-10 17:08:08 +10:00
Omar Emara
5400fe941e Realtime Compositor: Support Viewer nodes
This patch adds support for Viewer and File Output nodes to the realtime
compositor. The experimental render GPU compositor was also extended to
support viewers. While support for File Output nodes was added, it
remains unimplemented.

This is just an experimental implementation, the logic for viewers will
probably be changed once #108656 is agreed upon. Furthermore, the recalc
NODE_DO_OUTPUT_RECALC flags need to be taken into account to avoid
superfluous computations.

Pull Request: https://projects.blender.org/blender/blender/pulls/108804
2023-06-09 15:53:08 +02:00
Brecht Van Lommel
a2bd080cf3 Cleanup: renaming of GPU contexts for clarity
* opengl_context -> system_gpu_context. This is the operating system OpenGL,
  Metal or Vulkan context provided by GHOST.
* gpu_context -> blender_gpu_context. This is the GPUContext provided by
  the Blender GPU module, which wraps the GHOST context and adds some state.
* Various functions create/destroy/enable/disable both contexts, these have
  just gpu_context in the name now.

Pull Request: https://projects.blender.org/blender/blender/pulls/108723
2023-06-08 15:46:53 +02:00
Brecht Van Lommel
3ca1e828e2 Cleanp: compiler warnings 2023-06-07 20:09:30 +02:00
Brecht Van Lommel
0c2baf39c2 Cleanup: compiler warnings 2023-06-07 14:33:28 +02:00
Brecht Van Lommel
65fc10bd33 Compositor: first steps to use realtime compositor for renders
* Enable "Experimental Compositors" in preferences, then choose
  Realtime GPU execution mode in node editor sidebar.
* Only supports combined pass input and Render Result combined output.
* No viewer nodes, no file output nodes, and no node previews yet.

Pull Request: https://projects.blender.org/blender/blender/pulls/108629
2023-06-07 14:17:48 +02:00
Campbell Barton
74dd0ed09e Cleanup: remove redundant struct qualifiers 2023-06-03 08:54:37 +10:00
Campbell Barton
9b97123bf9 Cleanup: spelling in comments, odd comment block spacing 2023-06-02 10:16:16 +10:00
Sergey Sharybin
c1bc70b711 Cleanup: Add a copyright notice to files and use SPDX format
A lot of files were missing copyright field in the header and
the Blender Foundation contributed to them in a sense of bug
fixing and general maintenance.

This change makes it explicit that those files are at least
partially copyrighted by the Blender Foundation.

Note that this does not make it so the Blender Foundation is
the only holder of the copyright in those files, and developers
who do not have a signed contract with the foundation still
hold the copyright as well.

Another aspect of this change is using SPDX format for the
header. We already used it for the license specification,
and now we state it for the copyright as well, following the
FAQ:

    https://reuse.software/faq/
2023-05-31 16:19:06 +02:00
Campbell Barton
6f94591432 Cleanup: remove redundant braces around for loop 2023-05-30 10:45:39 +10:00
Brecht Van Lommel
673d066e35 Cleanup: change #define bitflags to enum 2023-05-25 13:49:38 +02:00
Sergey Sharybin
5e2f73df30 Fix crash doing viewport animation render
A user-counter mistake caused by shallow-copy of the render result
during its duplication.

Pull Request: https://projects.blender.org/blender/blender/pulls/108265
2023-05-25 12:16:29 +02:00