BLF_buffer was trying to accept "how many colors channels in output
image?" argument and doing math with it, but in the lowest level code
was always writing out full 4 channels for each pixel.
All the call sites would ever call it with argument of 4 however, and
that is why no one noticed the issue.
Pull Request: https://projects.blender.org/blender/blender/pulls/121630
This allows to expose these settings in the Performance panel in the
render buttons. Also moves compositor-specific options away from the
generic node tree structure.
For the backwards-compatibility the options are still present in the
DNA for the bNodeTree. This is to minimize the impact on the Studio
which has used the GPU compositor for a while now. They can be
removed in a future release.
There is no functional changes expected.
Pull Request: https://projects.blender.org/blender/blender/pulls/121583
This should get all of the tests to pass on Windows ARM64 platforms.
Sadly it needs disabling for hydra/USD stuff as currently it doesn't play nicely with the new preprocessor. @LazyDodo suggested a USD version update may fix this, which is something I can investigate in due course - right now, let's get daily builds up and working :)
Pull Request: https://projects.blender.org/blender/blender/pulls/121361
The compositor execute functions have a `rendering` argument to specify
if the compositor is executing as part of the render pipeline. But the
render context argument is null if we are not rendering, so the
`rendering` arguement is redundant and can be removed.
Additionally, we no longer use use_file_output as a hack to detect
rendering.
Pull Request: https://projects.blender.org/blender/blender/pulls/120659
This patch improves the interactivity of the GPU compositor for
interactive node tree edits by waiting on GPU work to finish to support
more granular canceling.
This does have a performance penalty, but it does not affect final
rendering and it seems worth it because even though it is slower it will
feel faster for users.
Pull Request: https://projects.blender.org/blender/blender/pulls/120656
Seems like scene `RenderData` only gets synched once from `Scene` to
`BaseRender` in `RE_InitState` .
Animation on it is only evaluating on the scene, so the the `BaseRender`
`RenderData` is not properly updated here.
However `R_STAMP_DRAW` is part of that and it is the `BaseRender`
`RenderData` that is checked in `do_render_full_pipeline` (not the
`Scene` one) to determine if we want to stamp.
Later calls to `BKE_render_result_stamp_info` / `renderresult_stampinfo`
/ `stampdata` always get passed the scene, so individual animation stamp
details (such as Render Time) work properly.
So to resolve, use the `Scene` `RenderData` (rather than the
`BaseRender` one) for proper animation update.
NOTE: this (not updating animation of members of `RenderData`) might
actually be a problem elsewhere, too -- havent checked on this in detail
though
Pull Request: https://projects.blender.org/blender/blender/pulls/120429
The File Output node produces wrong output when the output is set to BW.
This is because the image saving logic assumes float buffers always have
4 channels and ignores the image buffer channels member. So for single
channel images, the code weighted sum neighbouring pixels and asigned
them as a single pixel, producing bleeding at best and crashes at worst.
To fix this, we skip Color to BW conversion if the image is already BW.
And, we fix the functions that assume 4 channels for float buffers.
Pull Request: https://projects.blender.org/blender/blender/pulls/120206
The issue seems to be caused with the recent NVidia drivers, which will
crash if OptiX context is created prior to the OpenGL context on Linux.
This happens with drivers 545.29.06, 550.54.14, 550.67 and kernel 6.8
on Ubuntu 24.04, and also happens with NVidia driver 550.67 on Gentoo.
While it does seem the issue is likely on the driver side, the timeline
for it being resolved there is unknown. Until then it is possible to
apply workaround on Blender side, which will initialize GPU context
prior to rendering with an external render engine when it is known the
GPU context will be needed later on.
Note this is not a complex fix, because in general it's still possible to
render a frame without and then with grease pencil, in which case OptiX
will still be initialized first. But we don't want to always initialize
OpenGL, and we can't predict future operations.
Pull Request: https://projects.blender.org/blender/blender/pulls/120026
FILE_CACHE_MAX was meant to be larger than FILE_MAX to make room
for additional layers in the path. An error in the define used
`FILE_MAXFILE + FILE_MAXFILE` instead of `FILE_MAXDIR + FILE_MAXFILE`
causing the value to be smaller allowing a buffer overflow when passing
the string into BLI_path_abs.
Correct the define and call on the directory component before
the file is added so it doesn't clamp the string length unnecessarily.
Note that some values weren't correct since the original commit [0],
although [1] moved them to a shared incorrect define.
[0]: 78cdc707ab
[1]: cef1b9c30f
This patch refactors the backdrop offset to be stored as a float instead
of an int and to be stored in the image runtime structure instead of the
image itself.
Pull Request: https://projects.blender.org/blender/blender/pulls/119877
This commit fixes the following assert:
mtl_command_buffer.mm:165, submit(), at 'MTLBackend::get()->is_inside_render_boundary()'
It happens when toggling rendered state of viewport on macOS, and is
caused by incorrect order of setting active GPU context to null and
calling GPU_render_end.
This change makes the flow of GPU_render_{beign, end} and GPU context
activation closer to what it is in the draw manager's functions
DRW_render_context_{enable, disable}.
Pull Request: https://projects.blender.org/blender/blender/pulls/119868
This caused an ASan abort while looking into #101993.
From what I can tell, the issue is that when you click the render button on
the Render Layer node, RENDER_OT_render sets the callback. Then, when you
hit F12 later, it reuses the Render from before, including the callback,
but the corresponding handle has been freed already.
Now that all relevant code is C++, the indirection from the C struct
`GPUVertBuf` to the C++ `blender::gpu::VertBuf` class just adds
complexity and necessitates a wrapper API, making more cleanups like
use of RAII or other C++ types more difficult.
This commit replaces the C wrapper structs with direct use of the
vertex and index buffer base classes. In C++ we can choose which parts
of a class are private, so we don't risk exposing too many
implementation details here.
Pull Request: https://projects.blender.org/blender/blender/pulls/119825
This is a regression since d579ac2b3f
Ensure that the image buffers used by render passes have metadata at the
end of render, similarly to how stamping happens. This solves the reported
issue, and makes the metadata behave consistently, independent on how the
image buffer is accessed.
Thanks Philipp Oeser for investigation and pin-pointing the bad commit!
Pull Request: https://projects.blender.org/blender/blender/pulls/119503
"Own" (the adjective) cannot be used on its own. It should be combined
with something like "its own", "our own", "her own", or "the object's own".
It also isn't used separately to mean something like "separate".
Also, "its own" is correct instead of "it's own" which is a misues of the verb.
* Only works on machines with a Qualcomm Snapdragon 8cx Gen3 or above.
Older generation devices are not and will not be supported due to
some driver issues
* Requires VS2022 for building.
* Uses new MSVC preprocessor for sse2neon compatibility.
* SIMD is not enabled, waiting on conversion of blenlib to C++.
Ref #119126
Pull Request: https://projects.blender.org/blender/blender/pulls/117036
This required to apply a small fix in the Metal texture uploader.
Without synchronization pixels of a wrong pass can be uploaded to
a wrong texture. This is because this code path is heavily reusing
temporary allocations, and at some point the allocation is not
considered as still in use, unless the command buffer used by the
texture uploader is submitted.
Ref #118919
Pull Request: https://projects.blender.org/blender/blender/pulls/118920
Towards #118493: make movie writing functionality take ImBuf instead
of int* to pixel data.
While at it, make other bMovieHandle functions use "bool" return type
when it is strictly a success/failure result.
Pull Request: https://projects.blender.org/blender/blender/pulls/118559
The non-locking context activation expects the render engine to
have its own GPU contexts, which is not necessarily the case when
compositing happens from the command line.
Ensure that the contexts exist prior to attempt of activating them.
Pull Request: https://projects.blender.org/blender/blender/pulls/118496
The GPU compositor does not take the border region into consideration,
which means it reads more than it should, leading to corruption. Fix
this by taking the border region into account when computing render
width and height.
It is not required to hold the lock of DST when performing
compositing on GPU, as the compositor implementation uses the
GPU module directly, bypassing the draw manager.
However, currently this is known to cause issues on macOS,
and is not yet tested on Windows.
On Linux it works correctly, and avoids lock while compositor
is running.
There could still be a small locking hiccup, when the GPU
context is created and disposed. This needs to be looked
into.
Pull Request: https://projects.blender.org/blender/blender/pulls/118286
The `object_to_world` and `world_to_object` matrices are set during
depsgraph evaluation, calculated from the object's animated location,
rotation, scale, parenting, and constraints. It's confusing and
unnecessary to store them with the original data in DNA.
This commit moves them to `ObjectRuntime` and moves the matrices to
use the C++ `float4x4` type, giving the potential for simplified code
using the C++ abstractions. The matrices are accessible with functions
on `Object` directly since they are used so commonly. Though for write
access, directly using the runtime struct is necessary.
The inverse `world_to_object` matrix is often calculated before it's
used, even though it's calculated as part of depsgraph evaluation.
Long term we might not want to store this in `ObjectRuntime` at all,
and just calculate it on demand. Or at least we should remove the
redundant calculations. That should be done separately though.
Pull Request: https://projects.blender.org/blender/blender/pulls/118210
The tiled compositor code is mainly still around, which is only
expected to be a short-lived period. Eventually it will also be
removed.
The OpenCL, Group Buffers, and Chunk size options are already removed.
Pull Request: https://projects.blender.org/blender/blender/pulls/118010