As __FAST_MATH__ isn't defined anymore since
09df1f4cafb996802af4c89ab8af0630f750d599, sycl::cos uses the precise
implementation, no need to call __spirv_ocl_cos anymore.
Cycles oneAPI kernel library was compiled using -ffast-math. The current
version of Clang makes it link to crtfastmath.o in that case, bringing a
static constructor that does set the FTZ/DAZ bits in MXCSR for the whole
program, leading to unwanted behavior with other components.
Instead of -ffast-math, we switch to a safer subset of compile flags.
Pull Request: https://projects.blender.org/blender/blender/pulls/111708
This is a rewrite of GHOST_ContextVK to align with Metal backend as described
in #111389 - solution 3 with the adaptation that GHOST is still responsible
for presenting the swap chain image and a post callback is still needed in
case the swapchain is recreated.
This PR also includes some smaller improvements in stability.
Technical documentation: https://developer.blender.org/docs/eevee_and_viewport/gpu/vulkan/swap_chain/
* Renderpasses and framebuffers are not owned anymore by GHOST_ContextVK
* VKFramebuffer doesn't contain a swap chain image.
* Swapchain images can only be used as a blit destination or present source.
Not as an attachment.
* GHOST_ContextVK::swapBuffers would call a callback with the image the
GPU module needs to blit the results to.
* Clearing of depth/stencil attachments when no depth write state is set.
* Enable VK_KHR_maintenance4 to relax the stage interface mapping.
* Removes most vulkan validation warnings/errors.
* Detection of frame buffer changes that needs to be applied before
performing a command requiring render pass (draw/clear attachment)
**Benefits**
* Late retrieval of a swap chain image results in better overall performance as
Blender doesn't need to wait until the image is presented on the screen.
* Easier API and clearer state (transitions)
* More control over Image layouts and command buffer states. (Better alignment with
Vulkan API)
Pull Request: https://projects.blender.org/blender/blender/pulls/111473
Implements the GHOST_GetPixelAtCursor for the X11 backend, allowing
the user to sample any color displayed on the screen.
Noted some limitations in the code-comments.
Ref !111493.
When GLSL sources were first included in Blender they were treated as
data (like blend files) and had no license header.
Since then GLSL has been used for more sophisticated features
(EEVEE & real-time compositing)
where it makes sense to include licensing information.
Add SPDX copyright headers to *.glsl files, matching headers used for
C/C++, also include GLSL files in the license checking script.
As leading C-comments are now stripped,
added binary size of comments is no longer a concern.
Ref !111247
based on concentric disk mapping.
Concentric disk mapping was already present, but not used everywhere.
Now `sample_cos_hemisphere()`, `sample_uniform_hemisphere()`, and
`sample_uniform_cone()` use concentric disk mapping.
This changes the noise in many test images.
Pull Request: https://projects.blender.org/blender/blender/pulls/109774
ensure that `sample_reservoir()` chooses index -1 when the weights are invalid,
and returns `false` from `light_tree_sample()`.
Previous attempt: 206ab6437b970421d8fca4ba202a16f9e62cfd42
Pull Request: https://projects.blender.org/blender/blender/pulls/111428
This reverts commit 206ab6437b970421d8fca4ba202a16f9e62cfd42.
Seems that the illegal address error should be covered elsewhere, but it's not directly
clear where. Revert the commit for further investigation.
Discovered during an investigation into #111277
in rare situations (E.G. When normals are NaN), an emitter
won't be selected as part of `light_tree_cluster_select_emitter()`
and as a result of that, an `emitter_index` of `-1` is passed to
`kernel_data_fetch(light_tree_emitters, emitter_index)` resulting in
an "illegal address" error on some devices.
Pull Request: https://projects.blender.org/blender/blender/pulls/111292
This is in prevision of EEVEE panoramic projection support.
EEVEE-Next is planned to add support for these parameters.
Not having these parameters in Blender DNA will make Cycles
and EEVEE not share the same parameters and will be confusing
for the user.
We handle forward compatibility by still writing the parameters
as ID properties as previous cycles versions expect.
Since this change will break the API compatibility it is crucial
to make it for the 4.0 release.
Related Task #109639
Pull Request: https://projects.blender.org/blender/blender/pulls/111310
Fixes NaN in Vector Displacement node caused by the normalization of
0, 0, 0 vectors.
This fixes both visual rendering issues and an "illegal address" error
on the GPU. The "illegal address" error came from the Light Tree
Sampling code not handling the NaN normals well, leading to weird code
paths being taken, eventually leading to a kernel_assert and a
user facing illegal address error.
Pull Request: https://projects.blender.org/blender/blender/pulls/111294
- GHOST_SystemPathsCocoa::getUserSpecialDir
used `strncpy` without ensuring the string was null terminated.
- GHOST_SystemPathsCocoa::getBinaryDir
used `strcpy` without checking the destination buffer size.
Add optional argument `STRIP_LEADING_C_COMMENTS` to CMake macros:
data_to_c_simple & data_to_c.
Strip leading C-style comments that don't bloat binary size.
Comments are replaced with blank lines so line numbers in error messages
match. Reduces Blender's binary size by ~70kb.
Implements the paper [A Microfacet-based Hair Scattering
Model](https://onlinelibrary.wiley.com/doi/full/10.1111/cgf.14588) by
Weizhen Huang, Matthias B. Hullin and Johannes Hanika.
### Features:
- This is a far-field model, as opposed to the previous near-field
Principled Hair BSDF model. The hair is expected to be less noisy, but
lower roughness values takes longer to render due to numerical
integration along the hair width. The hair also appears to be flat when
viewed up-close.
- The longitudinal width of the scattering lobe differs along the
azimuth, providing a higher contrast compared to the evenly spread
scattering in the near-field Principled Hair BSDF model. For a more
detailed comparison, please refer to the original paper.
- Supports elliptical cross-sections, adding more realism as human hairs
are usually elliptical. The orientation of the cross-section is aligned
with the curve normal, which can be adjusted using geometry nodes.
Default is minimal twist. During sampling, light rays that hit outside
the hair width will continue propogating as if the material is
transparent.
- There is non-physical modulation factors for the first three
lobes (Reflection, Transmission, Secondary Reflection).
### Missing:
- A good default for cross-section orientation. There was an
attempt (9039f76928) to default the orientation to align with the curve
normal in the mathematical sense, but the stability (when animated) is
unclear and it would be a hassle to generalise to all curve types. After
the model is in main, we could experiment with the geometry nodes team
to see what works the best as a default.
Co-authored-by: Lukas Stockner <lukas.stockner@freenet.de>
Pull Request: https://projects.blender.org/blender/blender/pulls/105600
This transform generates code `if ( gamma != vec3(1., 1., 1.) )`
which is not compatible with Metal.
This patch adds an extra OCIO code processing which converts syntax
to a portable version. It only handles this specific case for the
processing performance reasons.
To reproduce the issue add the following look at the end of the
config.ocio:
```
- !<Look>
name: Grading
process_space: Filmic Log
description: TEST
transform: !<GroupTransform>
children:
- !<GradingPrimaryTransform>
style: log
contrast: {rgb: [0.7, 0.7, 0.7], master: 1}
saturation: 1.15
pivot: {contrast: -0.2}
```
Ref #110685
Pull Request: https://projects.blender.org/blender/blender/pulls/111231
The `Find*.cmake` modules originally used uppercase commands to match
CMake's own conventions. Since then CMake uses lower-case and even
within our own find modules, using all uppercase wasn't done
consistently. Opt for lowercase everywhere.
The recent change to header copyrights [0] unintentionally changed
"Blender Foundation" to "Blender Authors" for the WIN32 file path
which blender is installed into.
Revert lines changed that aren't related to copyright text.
[0]: e955c94ed38595cb12fa6cf517b6ba8033017141