Texture usage flag `GPU_TEXTURE_USAGE_MIP_SWIZZLE_VIEW`
was originally implemented and used too conservatively for many
cases in which the underlying API flags were not required.
Renaming to `GPU_TEXTURE_USAGE_FORMAT_VIEW` to reflect
the only essential use case for when a texture view is initialized with
a different texture format to the source texture. Texture views can
still be created without this flag when mip range or base level is
adjusted,
This flag is still required by stencil views and internally by the Metal
backend for certain feature support such as SRGB render toggling.
Patch also includes some small changes to the Metal backend to
adapt to this new compatibility and correctly capture all texture view
use-cases.
Related to #115269
Authored by Apple: Michael Parkin-White
Pull Request: https://projects.blender.org/blender/blender/pulls/115300
This restrict the usage of distant light if the world shader
contains absorption phenomenon.
Why this is needed is described in #114062.
At the same time, this removes the parameter for enabling
volume light as this is now an auto-detected optimization.
This also contains a few small cleanups.
Pull Request: https://projects.blender.org/blender/blender/pulls/115284
Code assumed that lookdev shaders could be deferred compiled, but
that is never the case. This PR cleans up some related code and
mechanisms that were introduced because we thought it was the case.
Pull Request: https://projects.blender.org/blender/blender/pulls/114368
This add the displacement option to EEVEE materials.
This unifies the option for Cycles and EEVEE.
The displacement only option is not matching cycles
and not particularly useful. So we decided to not
support it and revert to displacement + bump.
Pull Request: https://projects.blender.org/blender/blender/pulls/113979
This uses the principles outlined in
Screen Space Indirect Lighting with Visibility Bitmask
to compute local and distant diffuse lighting.
This implements it inside the ray-tracing module as a fallback when the
surface is too rough. The threshold for blending between technique is
available to the user.
The implementation first setup a radiance buffer and a view normal
buffer. These buffer are tracing resolution as the lighting quality is
less important for rough surfaces. These buffers are necessary to avoid
re-projection on a per sample basis, and finding and rotating the
surface normal.
The processing phase scans the whole screen in 2 directions and outputs
local incomming lighting from neighbor pixels and the remaining
occlusion for everything that is outside the view.
The final steps filters the result of the previous phase while applying
the occlusion on the probe radiance to have an energy conserving mix.
Related #112979
Pull Request: https://projects.blender.org/blender/blender/pulls/114259
Before #112901, subsurface scattering was skipped if its radius was
less than 1 pixel.
Aside from an optimization, this also avoided divisions by zero in
`burley_eval`.
This just brings back the early return when `pixel_footprint < 1.0`.
Pull Request: https://projects.blender.org/blender/blender/pulls/114928
HiZ dirty flag was previously not cleared upon update
resulting in duplicate updates in several places, without
source depth input having changed.
Authored by Apple: Michael Parkin-White
Co-authored-by: Michael Parkin-White <mparkinwhite@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/115235
Store paint masks as generic float attributes, with the name
`".sculpt_mask"`. This is similar to 060a534141, which made
the same change for face sets. The benefits are general
consistency, nicer code, and more support in newer areas
that deal with attributes like geometry nodes.
The RNA API is replaced with one created in Python. The new
API only presents a single layer as an attribute class, so it
should be simpler to use in general:
- Before: `object.data.vertex_paint_masks[0].data[0].value`
- After: `object.data.vertex_paint_mask.data[0].value`
Pull Request: https://projects.blender.org/blender/blender/pulls/115119
The buffers from the new Draw Manager increase their size as needed,
but they never shrink.
Add `StorageArrayBuffer::trim_to_next_power_of_2` function that can
downsize the buffer following the same heuristic as `get_or_resize`.
Add `StorageVectorBuffer::trim_and_clear`, which calls
`trim_to_next_power_of_2` automatically.
Pull Request: https://projects.blender.org/blender/blender/pulls/114857
Modify `UVStretchAngle` vertex struct alignment to match
4-byte struct alignment for Metal. This includes reordering
array elements to the front and adding additional padding
to the struct in Metal such that the raw-data write size
matches the padded vertex format.
Authored by Apple: Michael Parkin-White
Pull Request: https://projects.blender.org/blender/blender/pulls/114923
This patch allows access to the depth pass in the Viewport Compositor.
Since the depth information require full precision, making use of the
pass requires the full precision option for now. In the future, this
pass will always be stored using full precision regardless of the
precision option.
Move object runtime data to a separate header and allocate it separately
as `blender::bke::ObjectRuntime`. This is how node, mesh, curves, and
point cloud runtime data is stored.
Benefits:
- Allow using C++ types in object runtime data
- Reduce space required for Object struct in files
- Increase conceptual separation between DNA and runtime data
- Remove the need to add manual padding in runtime data
- Include runtime struct definition only in files that require it
Pull Request: https://projects.blender.org/blender/blender/pulls/113957
The GPU buffer type was replaced with `float` in 4151691552,
but the "no mask" case wasn't changed. We still assigned a `uchar` value
to a `float` pointer, which made the drawing look random. Instead do the
same fill we use for other PBVH types.
Pull Request: https://projects.blender.org/blender/blender/pulls/114846
OpenGL uses a depth range between -1 and 1, which is then normalized.
Metal & Vulkan uses a depth range between 0 and 1, which is already normalized.
The final plan would be to default to a depth range between 0 and 1, but
for now the depth ranges are retargetted so they won't be clipped away.
This solves the next issues for users:
- Navigate control will be rendered correctly
- Ortographic view clipping artifacts
- EEVEE light evaluation
Retargetting happens at the end of the vertex stage or when a geometry
stage is present at the end of the geometry stage. Derivatives using
depth would have a different value compared to OpenGL, but would match
Metal backend. OpenGL performs clipping and generates derivatives based
on the original depth value.
`gl_FragCoord` and clipping would have some precision differences as clipping
and normalizing are done in a different order but would match Metal.
Geometry shaders should use `gpu_EmitVertex` to ensure that the retargetting
is done per vertex.
Pull Request: https://projects.blender.org/blender/blender/pulls/114669
Fix#112697: Skip unavaliable UV maps on VBO upload
The list of available UV maps is generated for the evaluated object,
however if any modifier generates UV maps (for example Geometry
Nodes) it is possible the evaluated object contains UV maps which are
not present in the base mesh. So when only the base mesh is uploaded,
for example in the UV editor, UV maps present in the list are not
guaranteed to exist.
Pull Request: https://projects.blender.org/blender/blender/pulls/114558
This patch adds support for full precision compositing for the Realtime
Compositor. A new precision option was added to the compositor to change
between half and full precision compositing, where the Auto option uses
half for the viewport compositor and the interactive render compositor,
while full is used for final renders.
The compositor context now need to implement the get_precision() method
to indicate its preferred precision. Intermediate results will be stored
using the context's precision, with a number of exceptions that can use
a different precision regardless of the context's precision. For
instance, summed area tables are always stored in full float results
even if the context specified half float. Conversely, jump flooding
tables are always stored in half integer results even if the context
specified full. The former requires full float while the latter has no
use for it.
Since shaders are created for a specific precision, we need two variants
of each compositor shader to account for the context's possible
precision. However, to avoid doubling the shader info count and reduce
boilerplate code and development time, an automated mechanism was
employed. A single shader info of whatever precision needs to be added,
then, at runtime, the shader info can be adjusted to change the
precision of the outputs. That shader variant is then cached in the
static cache manager for future processing-free shader retrieval.
Therefore, the shader manager was removed in favor of a cached shader
container in the static cache manager.
A number of utilities were added to make the creation of results as well as
the retrieval of shader with the target precision easier. Further, a
number of precision-specific shaders were removed in favor of more
generic ones that utilizes the aforementioned shader retrieval
mechanism.
Pull Request: https://projects.blender.org/blender/blender/pulls/113476