Commit Graph

4512 Commits

Author SHA1 Message Date
Campbell Barton
f9316e4079 Cleanup: spelling in comments 2023-07-12 12:45:35 +10:00
Ray Molenkamp
9547e7a317 Fix: shader_builder build issue
The blenkernel cleanup commit from this morning
forgot to update the shader builder.
2023-07-11 14:20:31 -06: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
Clément Foucault
b5749f8e8a GPU: Fix shader builder
Breakage caused by 1978b4fc92
2023-07-11 11:09:30 +02:00
Clément Foucault
1978b4fc92 GHOST: Replace WITH_OPENGL build option
Replaces it by WITH_OPENGL_BACKEND and cleanup its usage.
Limits visibility of opengl enums and cases.

Pull Request: https://projects.blender.org/blender/blender/pulls/109947
2023-07-11 09:17:31 +02:00
Jason Fielder
232d763af4 Fix #109389: Resolve Z-fighting artifacts in Metal
Resolves z-fighting artifact on Apple Silicon.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/109922
2023-07-11 09:07:21 +02:00
Jason Fielder
ac708cb33a Fix #106905: Increase OS version requirement for Metal on Intel
Certain feature requirements unsupported by older OS builds
caused failures when running Intel GPUs on older OS's.

This patch increases the minimum required OS version
to one which covers devices supporting all required features.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/109921
2023-07-11 09:03:47 +02:00
Ray Molenkamp
3046b0a19e CMake: Fix shader_builder build error
Problem introduced in 57ad866d81
as I didn't build with this option on.
2023-07-10 17:08:13 -06: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
Hoshinova
41335edf22 Fix #109254: Voronoi distance output is clamped at 8
The Voronoi distance output is clamped at 8, which is apparent for distance
metrics like Minkowski with low exponents.

This patch fixes that by setting the initial distance of the search loop to
FLT_MAX instead of 8. And for the Smooth variant of F1, the "h" parameter is set
to 1 for the first iteration using a signal value, effectively ignoring the
initial distance and using the computed distance at the first iteration instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/109286
2023-07-10 17:42:24 +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
Brecht Van Lommel
f2705dd913 Fix #109683: Cycles and Eevee missing AOVs when no closure connected
No reason to skip these, and this will be useful for faster shader node
preview rendering based on AOVs.

Pull Request: https://projects.blender.org/blender/blender/pulls/109709
2023-07-10 12:41:44 +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
Hoshinova
c9fbbea261 Cleanup: Assign corresponding expressions to variable params.max_distance
Pull Request: https://projects.blender.org/blender/blender/pulls/109328
2023-07-06 18:13:22 +02:00
Miguel Pozo
3d62888ed6 Workbench Next: Fix Overlay composition
Set "In Front" objects depth to 0,
so overlays are not drawn on top of them.
2023-07-05 18:11:50 +02:00
Sergey Sharybin
bad41885db Cleanup: Mark unused function arguments as such
A lot of such cases got discovered since recent change to CLang's
compiler flags for C++.

Pull Request: https://projects.blender.org/blender/blender/pulls/109732
2023-07-05 12:02:06 +02:00
Campbell Barton
785bd13b9a Cleanup: spelling in comments 2023-07-05 14:09:33 +10:00
Clément Foucault
90448b8b5a GPU: Replace std::cout by std::cerr for dependency errors
This allow seeing them during the build process
2023-07-04 12:45:28 +02:00
Clément Foucault
3d76a75d9f GPU: Metal: Make 32bit depth promotion backend side
Doing the promotion on the internal GPU texture format
created a bug in `draw::Texture::ensure_impl` where
the texture would be constantly being recreated.
2023-07-04 12:18:28 +02:00
Jeroen Bakker
bfda24cae3 Fix: Update Stubs for Shader Builder
Issue introduced by recent changes where `BKE_pbvh_count_grid_quads`
required C++ linkage.
2023-07-04 08:09:38 +02:00
Joseph Eagar
7e2659e4ab Cleanup: Split BKE_pbvh.h into BKE_pbvh_api.hh
Split much of BKE_pbvh.h into BKE_pbvh_api.hh.
BKE_pbvh.h is included by BKE_paint.h, which in
turn is included by large amounts of code including
RNA.

This makes it extremely difficult to change
or clean up the PBVH API, since each modification
of BKE_pbvh.h can take 20-30 minutes to compile,
even on a quad-core system with an SSD. This
commit fixes that by moving most of BKE_pbvh.h
into another file and just having the core,
external-facing interfaces in BKE_pbvh.h.
2023-07-03 20:01:04 -07:00
Campbell Barton
9753e70e37 Cleanup: move BLI_str_replace into BLI_string_utils.h
String search & replace is a higher level function (unlike BLI_string.h)
which handlers lower level replacements for printing and string copying.

Also use BLI_string_* prefix (matching other utilities).

This makes it possible to use BLI_string in Blender's internal utilities
without depending on DynStr, MemArena... etc.
2023-07-04 12:02:25 +10:00
Clément Foucault
91d15a3613 EEVEE-Next: Fix shader compilation on Metal 2023-07-03 23:08:53 +02:00
Clément Foucault
c2d693f431 GPU: Print shader dependency errors to error stream
This avoid loosing these messages during the build process
which is the point of WITH_GPU_BUILDTIME_SHADER_BUILDER.
2023-07-03 10:36:20 +02:00
Campbell Barton
6fbe467021 Cleanup: replace BLI_dynstr with a call to BLI_vsprintfN 2023-07-03 14:15:07 +10: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
345d1a4b44 Cleanup: simplify struct declarations in C++
Replace `typedef struct X {} X;` with `struct X {};`

In some cases the first and last name didn't match although this
is rarely useful, even a typo in some cases, e.g. TrachPathPoint.
2023-07-02 19:54:26 +10:00
Miguel Pozo
221f985129 EEVEE Next: Ambient Occlusion Node and RenderPass
Port Ambient Occlusion to EEVEE Next.

Add support for the AO Node and the AO RenderPass.
AO shading integration is still missing.

This also fixes the Shadow RenderPass.

Pull Request: https://projects.blender.org/blender/blender/pulls/108398
2023-06-30 19:37:30 +02:00
Ray Molenkamp
7ad6b7cba4 Cmake: Fix WITH_GPU_BUILDTIME_SHADER_BUILDER on Windows 2023-06-30 18:32:03 +02:00
Clément Foucault
6f7f105812 GPU: Fix safe_normalize_and_get_length implementation
Return the correct input length of the vector not the
length of the fallback vector.
2023-06-30 13:58:11 +02:00
Jeroen Bakker
c2de379081 GPU: Enable Cubemap Array Extension in Compute Shaders
This PR enables cubemap array extension in compute shaders when
supported by the platform. When used the shader must include
cubemap_lib as it contains a fallback implementation when
cubemap arrays aren't supported by the platform.

NOTE: This extension is available in Core Vulkan and doesn't need to be enabled.
Metal doesn't support cubemap arrays and would use the fallback.

Pull Request: https://projects.blender.org/blender/blender/pulls/109546
2023-06-30 11:16:39 +02:00
Clément Foucault
ff62f402da EEVEE-Next: Fix overlap with nodetree UBO
Reserve the slot 0 for nodetree and bind
directly to it in Next engines.
2023-06-29 21:10:08 +02:00
Jeroen Bakker
fb38bb9806 Eevee-Next: World Reflective Light
This PR adds world probe baking to Eevee-next. The world is baked to a
cubemap and is used for reflective light in the deferred render pass.

The world probe is baked to a resolution of 2048x2048. In the future this
would become a user facing setting, but wasn't considered essential for
the first implementation.

When updating the world cubemap the world surface shader is reused.
Currently the world surface shader clears many render passes. It was
decided to replace the render passes with dummy textures as the effort
and potential slowdown didn't weigh against the benefit of doing this nicely.
Updating the world reflection probe isn't expected to happen often.

A big difference with Eevee(-legacy) is that the roughness GGX reflection
parameter isn't baked into the texture (as mipmap levels), but is calculated
during shading. This improves accuracy as we don't assume that every
object is an infinitive small sphere. The result has more noise and that
will be tackled after SSR will land.

![image](/attachments/12de6025-67ca-40d2-9540-bcc8a8a1605d)

Pull Request: https://projects.blender.org/blender/blender/pulls/108149
2023-06-29 15:24:57 +02:00
Jeroen Bakker
a1e9f9665e GPU: Remove unused GPU_TEXTURE_USAGE_MEMORYLESS
Flag was introduced for the metal backend, but isn't used anymore.
No backend has logic attached to it so it is fine to remove it.

Pull Request: https://projects.blender.org/blender/blender/pulls/109492
2023-06-29 15:13:12 +02: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
Hans Goudey
a1cc621e1e Cleanup: Remove unused custom data type
`CD_HAIRLENGTH` is not really a custom data type, it was just used to
specify the hair particle "length" attribute to pass it to EEVEE and
material preview. Because of the "typemap" array in `CustomData`,
it's better not to have this unnecessary type. Instead, use the same
mechanism used to request the active color attribute.

Pull Request: https://projects.blender.org/blender/blender/pulls/109449
2023-06-28 17:17:31 +02:00
Bastien Montagne
21f5c7c45f Merge branch 'blender-v3.6-release' 2023-06-26 12:37:11 +02:00
Clément Foucault
8fd824c4b7 Fix #109314: Metal Debug 'Shaders' Folder appearing in 3.6 &. 4.0
This slipped through a previous Metal PR #107175.

Pull Request: https://projects.blender.org/blender/blender/pulls/109323
2023-06-24 17:40:46 +02:00
Hoshinova
f7589751f1 Cleanup: Use defines in Voronoi GLSL implementation
Use defines in Voronoi GLSL implementation instead of magic numbers.

Pull Request: https://projects.blender.org/blender/blender/pulls/109289
2023-06-23 17:16:53 +02:00
Hoshinova
3efc63b398 Fix #109253: Voronoi Smooth F1 breaks when Smoothness is 0
The Voronoi Smooth F1 mode breaks when the Smoothness is 0 for OSL. This is
due to a zero division in the shader.

To fix this, standard F1 is used when Smoothness is 0.

Pull Request: https://projects.blender.org/blender/blender/pulls/109255
2023-06-23 15:56:09 +02:00
Clément Foucault
ddd88c00b4 EEVEE-Next: Irradiance Cache: Initial Implementation
This is a full rewrite of the irradiance volume baking.
The baking is much faster and doesn't scale linearly with the number
of irradiance samples in the volumes.

Ref #105643

Pull Request: https://projects.blender.org/blender/blender/pulls/108639
2023-06-23 08:39:46 +02:00
Clément Foucault
8d2d2d4620 GPU: Math: Add safe_rcp and safe_normalize to math libs 2023-06-22 22:51:23 +02:00
Campbell Barton
472c461816 Cleanup: spelling in comments 2023-06-21 11:28:58 +10:00
Jeroen Bakker
58b5d38824 Metal: Fix operator precedence bug
Backporting commit 31c986998b to 3.6 release branch

Pull Request: https://projects.blender.org/blender/blender/pulls/109147
2023-06-20 08:09:35 +02:00
Hans Goudey
4bd0676cf1 Merge branch 'blender-v3.6-release' 2023-06-19 21:45:36 -04:00
Jason Fielder
53cb09357e Fix #108792: Ensure Metal buffers correctly freed on exit
Replaces vector of allocations with dynamic linked list.
Bug caused by previously freed buffers still having been in the
list. Linked list enables fast removal of already-released buffers.

Also ensured that the memory manager classes are included in
memory tracking.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/108940
2023-06-19 20:28:51 +02:00
Miguel Pozo
d7dac04193 GPU: Print both resources on ShaderCreateInfo::validate_merge failure
Print both names when two resource slots overlap.

Pull Request: https://projects.blender.org/blender/blender/pulls/109017
2023-06-16 15:13:31 +02:00
Campbell Barton
6a75ff7afa Cleanup: use function style casts, trailing space 2023-06-16 12:20:31 +10:00
Miguel Pozo
4cf644939a EEVEE Next: Subsurface Scattering
Port of subsurface scattering from the eevee-rewrite branch to EEVEE Next.
https://projects.blender.org/fclem/blender/src/branch/eevee-rewrite

Other changes:
* Fix gbuffer normal and ior packing.
* Write the material eClosureBits to the gbuffer stencil.

Known Issues:
* Transmittance profile pre-computation is wrong.

Pull Request: https://projects.blender.org/blender/blender/pulls/107407
2023-06-15 15:49:05 +02:00