Commit Graph

9064 Commits

Author SHA1 Message Date
Michael Jones
1a93dfe4fc Cycles: Apple Silicon tidy: Remove non-UMA codepaths
This PR removes a bunch of dead code following #123551 (removal of AMD and Intel GPU support). It is safe to assume that UMA will be available, so a lot of codepaths that dealt with copying between CPU and GPU are now just clutter.

Pull Request: https://projects.blender.org/blender/blender/pulls/136117
2025-03-18 19:09:25 +01:00
Philipp Oeser
d6da557358 Fix #135955: OSL Window texture coordinate wrong for panoramic cameras
There is code that properly handles panoramic cameras in
`camera_world_to_ndc`, the transform matrices (e.g.
`OSLRenderServices::get_inverse_matrix`) in the `transform("NDC", P)`
call dont do the "full work" here (maybe they should though?).

But we can get to `camera_world_to_ndc` by just getting the "NDC"
attribute, so use that for now.

Pull Request: https://projects.blender.org/blender/blender/pulls/136097
2025-03-18 09:11:45 +01:00
Brecht Van Lommel
9984adc7de Merge branch 'blender-v4.4-release' 2025-03-17 16:19:46 +01:00
Brecht Van Lommel
f896f7ffc3 Fix #136047: Cycles OSL gettextureinfo crash with missing image
Missing null pointer check.

Pull Request: https://projects.blender.org/blender/blender/pulls/136075
2025-03-17 16:18:31 +01:00
Lukas Stockner
349306a3bd Cycles: Handle OSL parameter query from Python
Now that we're packaging the Python oslquery module, we can get rid of the C++-side code here and handle this purely in Python.

Pull Request: https://projects.blender.org/blender/blender/pulls/136032
2025-03-16 18:04:38 +01:00
Brecht Van Lommel
a687a02578 Cycles: Enable HIP RT by default
For 4.4 there was not enough time to fully test it and be confident it is
stable, but for 4.5 we enable it.

Ref #135760
2025-03-14 18:44:41 +01:00
Brecht Van Lommel
990f8df7cc Fix: Build error with OpenImageIO 2.x after OSL manager changes
Ref #135050
2025-03-14 18:44:27 +01:00
Sergey Sharybin
f243f13549 Merge branch 'blender-v4.4-release' 2025-03-14 18:36:53 +01:00
salipour
dd3640ef0f Cycles: Move HIP-RT out of experimental flag
The full regression suit passes, so there is no real background towards
considering it experimental.

It is still stays disabled by default for Blender 4.4.

Pull Request: https://projects.blender.org/blender/blender/pulls/135760
2025-03-14 18:35:42 +01:00
Bastien Montagne
dd98cede18 Merge branch 'blender-v4.4-release' 2025-03-14 18:20:26 +01:00
Sahar A. Kashi
9ad3b74867 Fix: SSS and Motion Blur or Curves not working on HIP-RT
This change fixes the remaining failing tests with SSS when using HIP-RT.
This includes crash when SSS is used on curves, and objects with motion
blur and SSS rendering black.

The root cause for both cases was the fact that traversal was always
assuming regular BVH (built for triangles), while curves and motion
triangles are using custom primitives, which requires specialized BVH
traversal.

This change includes:

- Early output from `scene_intersect_local()` for non-triangle and
  non-motion-triangle primitives. This fixes `sss_hair.blend` test,
  and also avoids unnecessary BVH traversal when the local intersection
  is requested from curve object. The same early-output could be added
  to other BVH traversal implementation.

- Use `hiprtGeomCustomTraversalAnyHitCustomStack` for motion triangles
  primitives. This fixes motion blur on objects with SSS render black.

Fixes #135856

Co-authored-by: Sahar A. Kashi <sahar.alipourkashi@amd.com>
Co-authored-by: Sergey Sharybin <sergey@blender.org>

Pull Request: https://projects.blender.org/blender/blender/pulls/135943
2025-03-14 18:17:54 +01:00
Xavier Hallade
0ebce03d41 Cycles: Reorder ShaderData elements to improve cache utilization
Profiling on Arc B580 shown that sd->num_closure queries were often
stalling.
Packing it closer to other often accessed elements within ShaderData
(type, flag..) does speedup rendering by ~5% in most scenes.

Pull Request: https://projects.blender.org/blender/blender/pulls/135980
2025-03-14 16:11:17 +01:00
Sergey Sharybin
b8bd8ba36d Merge branch 'blender-v4.4-release' 2025-03-14 14:52:02 +01:00
Sergey Sharybin
1d4a211d6c Fix: Incorrect check of device pointers in HIP-RT code
The code was checking the same device pointer instead of
checking that both allocations are successful.

Pull Request: https://projects.blender.org/blender/blender/pulls/135977
2025-03-14 14:51:49 +01:00
Xavier Hallade
3de1a60c6a Cycles: oneAPI: Force large GRF for shade_surface_* kernels
While auto lets the compiler make the right choice for shade_surface
kernel when compiling for Battlemage and Lunar Lake, that's not the case
for Alchemist and Meteor Lake, so now we force this mode.
2025-03-13 14:22:48 +01:00
Campbell Barton
6ef7dae8ef Cleanup: spelling in comments (make check_spelling_*) 2025-03-13 13:41:17 +11:00
Sergey Sharybin
977a334f6f Merge branch 'blender-v4.4-release' 2025-03-12 19:24:01 +01:00
Sergey Sharybin
a3eb0faa3f Fix: Incorrect ray time used for HIP-RT local intersections
It was always hard-coded to be 0.

It does not seem to result in any extra tests passing, but they are
probably not sophisticated enough.

Noticed while looking into details for the #135856.

Pull Request: https://projects.blender.org/blender/blender/pulls/135878
2025-03-12 19:23:38 +01:00
Brecht Van Lommel
71a4f1ab96 Merge branch 'blender-v4.4-release' 2025-03-12 11:40:08 +01:00
Brecht Van Lommel
73ea95a56a Fix #135644: HIP-RT crash with host memory fallback
Avoid manipulating the host pointer in device memory, this fails when host
mapped memory gets used and the pointers gets re-allocated.

Pull Request: https://projects.blender.org/blender/blender/pulls/135724
2025-03-12 11:38:07 +01:00
Brecht Van Lommel
0ff2635131 Fix #135644: Cycles HIP-RT crash when running out of memory
Tightehn up checks for failed allocations, early out on errors.

Pull Request: https://projects.blender.org/blender/blender/pulls/135724
2025-03-12 11:37:59 +01:00
Brecht Van Lommel
b1559b3ff4 Cycles: Adaptive subdivision patches without inner grid
Means low res patches can have 2 instead of 4 triangles.

Pull Request: https://projects.blender.org/blender/blender/pulls/135681
2025-03-11 20:58:36 +01:00
Brecht Van Lommel
de821416c7 Cycles: Adaptive subdivision dicing and splitting improvements
* Share vertices between patches instead of using stitch map
* Switch to OpenSubdiv compatible counter-clockwise indexing
* Simplify patch edge reverse direction logic
* Add more comments to splitting and dicing

Pull Request: https://projects.blender.org/blender/blender/pulls/135681
2025-03-11 20:58:33 +01:00
Brecht Van Lommel
e84b377eae Refactor: Simplify subd patch code
* Remove unused linear patch normals
* Renaming for consistency and clarity
* Shuffle order of function definitions

Pull Request: https://projects.blender.org/blender/blender/pulls/135681
2025-03-11 20:58:20 +01:00
Brecht Van Lommel
42846caca1 Cycles: Adaptive subdivision support for modifier options
* Use creases
* Boundary interpolation
* UV interpolation

Pull Request: https://projects.blender.org/blender/blender/pulls/135681
2025-03-11 20:58:17 +01:00
Brecht Van Lommel
82751ca10c Cycles: Adaptive subdivision motion blur support
* Smooth interpolation of vertex coordinates and normals of motion steps
* Fix issues with Blender sync and object device update

Pull Request: https://projects.blender.org/blender/blender/pulls/135681
2025-03-11 20:58:14 +01:00
Brecht Van Lommel
62201eb372 Cycles: Adaptive subdivision smooth UV interpolation
Using OpenSubdiv FVar interpolation.

Pull Request: https://projects.blender.org/blender/blender/pulls/135681
2025-03-11 20:58:10 +01:00
Brecht Van Lommel
07b60c189b Cycles: Perform attribute subdivision on the host side
* Add SubdAttributeInterpolation class for linear attribute interpolation.
* Dicing computes ptex UV and face ID for interpolation.
* Simplify mesh storage of subd primitive counts
* Remove kernel code for subd attribute interpolation
* Remove patch table packing and upload

The old optimization adds a fair amount of complexity to the kernel, affecting
performance even when not using the feature. It's also not that useful as it
does not work for UVs that needs special interpolation. With this simpler code
it should be easier to make it feature complete.

Pull Request: https://projects.blender.org/blender/blender/pulls/135681
2025-03-11 20:58:07 +01:00
Brecht Van Lommel
afd139f07e Refactor: Split OsdMesh off from OsdData
Pull Request: https://projects.blender.org/blender/blender/pulls/135681
2025-03-11 20:58:05 +01:00
Brecht Van Lommel
7685b9016a Cycles: Use fixed instead of adaptive subdivision max isolation level
Same as what Blender does by default.

Pull Request: https://projects.blender.org/blender/blender/pulls/135681
2025-03-11 20:58:03 +01:00
Brecht Van Lommel
e9a20b8ce8 Refactor: Better handling of OpenSubdiv namespace
Pull Request: https://projects.blender.org/blender/blender/pulls/135681
2025-03-11 20:58:01 +01:00
Brecht Van Lommel
189efd8eeb Refactor: Move more subdivision code into subd/
No logic or functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/135681
2025-03-11 20:57:59 +01:00
Brecht Van Lommel
6ec541ca4e Refactor: Cycles: Remove face normal attribute
It's already computed on demand in the kernel, no need to have it host side.

Pull Request: https://projects.blender.org/blender/blender/pulls/135681
2025-03-11 20:57:51 +01:00
Brecht Van Lommel
221dd26604 Cleanup: Cycles + lite build compiler warnings 2025-03-11 19:56:04 +01:00
Lukas Stockner
dbe275895e Cleanup: Cycles: Deduplicate OptiX OSL code
Not a big difference for now, but will be nicer for #129495.

Pull Request: https://projects.blender.org/blender/blender/pulls/135049
2025-03-10 13:30:58 +01:00
Brecht Van Lommel
8076fa10e0 Fix: Cycles BVH2 issue causing Metal crashes, after recent cleanup
Ref 48398b223b
2025-03-07 19:20:25 +01:00
Sergey Sharybin
32d49541c0 Fix #135572: Cycles shadow linking through transparency is broken on GPU
Make the ray self primitives store and restore reliable for cases when
the intersect_shadow kernel is called multiple times:

- Light object and primitive are stored in dedicated fields in the
  state. This adds 2 integers per state.

- The self object and primitive are used from the previous intersection
  when the intersect_shadow is called multiple times.

There is more detailed explanation added in the code.

The issue was introduced by the light refactor to be objects in #134846.

Pull Request: https://projects.blender.org/blender/blender/pulls/135573
2025-03-07 17:16:04 +01:00
Brecht Van Lommel
48398b223b Cleanup: Fix various divisions by zero reported by ASAN
Pull Request: https://projects.blender.org/blender/blender/pulls/135326
2025-03-06 22:34:23 +01:00
Brecht Van Lommel
b75b2e883d Cleanup: Always use fullsize ShaderData on the CPU
This avoids compiler and ASAN warnings. This optimization exist for
GPU rendering.
2025-03-06 22:34:22 +01:00
Brecht Van Lommel
5a9d4fd613 Cleanup: Use default member initializers 2025-03-06 22:34:22 +01:00
Brecht Van Lommel
ab394c8e8d Refactor: Use std::bitset to avoid overflow in device queue logging 2025-03-06 22:34:22 +01:00
Brecht Van Lommel
dd20f31302 Cleanup: Fix clang-tidy warnings from recent OSL changes 2025-03-06 22:34:22 +01:00
Xavier Hallade
91f332e7c6 Cycles: oneAPI: Force normal GRF for integrator_intersect_* kernels
With auto mode, integrator_intersect_subsurface still ended up being
compiled in large GRF mode on Intel Arc B580, while normal GRF provides
the best performance for this kernel.
2025-03-06 22:24:45 +01:00
Falk David
e39c83c881 Merge branch 'blender-v4.4-release' 2025-03-06 21:19:31 +01:00
Jesse Yurkovich
4c38380cc6 Fix #134043: Account for frame_offset in Alembic procedurals
There's two places which perform the frame start and end time
calculation and only one of them was respecting the frame_offset.

Pull Request: https://projects.blender.org/blender/blender/pulls/134149
2025-03-06 20:54:22 +01:00
Jesse Yurkovich
3a0e4fe316 Fix #134039: Alembic procedural proxy mesh should be owned by GeometrySet
When using Alembic procedurals, the Mesh Sequence Cache attempts to
replace the original geometry with a plain old cube. However, it never
frees this new cube geometry. Transfer ownership to the underlying
GeometrySet instead.

Investigating the scenario also showed that the `~AlembicProcedural`
dtor was removing an item from the `nodes` vector while iterating over
it, which triggers debug asserts on at least MSVC. I believe the removal
is unnecessary since this is the dtor and ASAN appears clean now.

Pull Request: https://projects.blender.org/blender/blender/pulls/134085
2025-03-06 20:53:52 +01:00
Xavier Hallade
d1120c51db Cycles: oneAPI: Enable automated GRF mode selection
The default was large GRF mode for all kernels and normal GRF for
intersection kernels.
path_array kernels also benefit from normal GRF, being almost 2x faster
in this mode, as measured on my Arc B580. This translates to a much
smaller 1-3% speedup in overall rendering.
Instead of manually adding them to the list of kernels to compile in
normal GRF mode, I've switched to auto that provides the same result.
2025-03-06 17:47:19 +01:00
Sybren A. Stüvel
15758ab854 Merge remote-tracking branch 'origin/blender-v4.4-release' 2025-03-06 14:13:03 +01:00
Sergey Sharybin
7397e6da29 Fix: Cycles HIP-RT crash
The crash has been introduced by the refactor of lights to be
objects in #134846.

We can make such cases easier to catch at compile time in the
future, but for now applying the minimal patch which solves the
problem without going deeper into refactor.

Pull Request: https://projects.blender.org/blender/blender/pulls/135570
2025-03-06 11:58:13 +01:00
Sergey Sharybin
f89728a5e4 Fix: HIP-RT creates copy of vector<Object *> during build
Is harmless from functional perspective, but uses more resources and
potentially slower than it should be. Although, probably something
hard to measure in practice, but still better not follow this anti-
pattern.

Pull Request: https://projects.blender.org/blender/blender/pulls/135529
2025-03-06 11:57:51 +01:00