Commit Graph

4752 Commits

Author SHA1 Message Date
Jeroen Bakker
f9aca93a47 Vulkan: Add Support for sRGB Framebuffer Enablement
Allow binding of framebuffers without sRGB to linear transform.
`GPU_framebuffer_bind_no_srgb`. This Patch removes color transform
artifacts in node, image and sequence editor.

When the framebuffer is an srgb framebuffer and it is bound without
the transformation, the SRGB textures are bound as UNORM variants.

As framebuffer, render pass and subpass recreation is ensured by
`VKCommandBuffer` we don't need to mark the framebuffer dirty at
this time. Later on we can optimize this by adding a state changed
detection for framebuffers and render passes.

Pull Request: https://projects.blender.org/blender/blender/pulls/113838
2023-10-19 14:41:18 +02:00
Campbell Barton
e7e4e63313 Cleanup: spelling in comments, white-space in comments 2023-10-19 18:53:16 +11:00
Jeroen Bakker
62f721467b Merge branch 'blender-v4.0-release' 2023-10-19 08:03:51 +02:00
Jason Fielder
62219f8da9 Metal: Re-enable workbench NEXT shadows
With the shift to GPU-driven rendering pipeline,
the SSBO vertex fetch paradigm used to
implement workbench shadows on Metal
instead of utilising the geometry shader
path no longer worked correctly.

This is because the draw submission
required vertex amplification up-front,
based on the expected output geometry
amount for a given input geometry.

This patch aims to resolve this
issue through addition of API to
enable the features within the
GPU driven pipeline.

Co-authored-by: Michael Parkin-White <mparkinwhite@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/113498
2023-10-19 08:01:17 +02:00
Hans Goudey
86bf9b1163 Cleanup: Remove disabled PBVH BMesh code
The large amount of disabled code makes this area trickier to deal with,
and this particular code wasn't helpful to the reader anyway.
2023-10-18 19:40:32 +02:00
Jason Fielder
19765a1f99 GPU: Ensure MTL texture tests are passing and add 1D/3D texture tests
Changes to ensure all supported texture tests are passing with the
Metal backend and add additional tests to cover texture_3d and
texture 1d test cases.

Authored by Apple: Michael Parkin-White

Co-authored-by: Michael Parkin-White <mparkinwhite@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/113889
2023-10-18 18:03:00 +02:00
Clément Foucault
5d1489c61d GL: Allow clearing of 3D texture using the framebuffer workaround
There was no actual issue when binding the whole texture as
layers. Cleanup the implementation and remove the assert.

Pull Request: https://projects.blender.org/blender/blender/pulls/113897
2023-10-18 17:56:38 +02:00
Hans Goudey
b3460a6b2c Merge branch 'blender-v4.0-release' 2023-10-18 11:14:11 +02:00
Hans Goudey
cdae07dccf Fix #113842: Curves Info node length output always zero
Caused by a1cc621e1e. The "is_hair_length" value needs to be
set before `attr_input_name` is called because it uses the value to set
the attribute name with the "l" alias.
2023-10-18 11:13:38 +02:00
Miguel Pozo
6f125661e6 GPU: Add Texture::debug_clear
Clear uninitialized textures to NaN/debug values.
Enabled for `--debug-gpu` only.

Pull Request: https://projects.blender.org/blender/blender/pulls/113781
2023-10-17 15:54:09 +02:00
Jeroen Bakker
79cbeae939 Vulkan: Incorrect Node Socket Drawing
When drawing node sockets an immediate mode buffer is created that can
contain all the node sockets of the node. Only visible node sockets will
then be added. Vulkan assumed that all elements in the buffer needed to
be drawn, resulting using uninitialzed memory for drawing node sockets.

This resulted in very colorful and big artifacts rendered in the node
editor. This was detected during drawing of node sockets, but would have
been visible in other places as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/113830
2023-10-17 13:45:14 +02:00
Campbell Barton
2e0b844b36 Cleanup: spelling in comments 2023-10-14 13:53:00 +11:00
Clément Foucault
44d73f0fa6 GL: Silence null dispatch error
These are false positive. We actually want to
not dispatch in this case.
2023-10-13 19:15:05 +02:00
Clément Foucault
71dfcf4558 EEVEE-Next: Remove common lib usage
Replaces all usage by the the gpu_shader_math
equivalent. This is because the old shader
library was quite tangled.

This avoids dependency hell trying to
mix libraries.

Changes are split into isolated commits until
I had to do mass changes because of inter-
dependencies.

Pull Request: https://projects.blender.org/blender/blender/pulls/113631
2023-10-13 17:59:46 +02:00
Clément Foucault
f4e584b02a BLI: Math Vector: Add reduce_min/max/add and average function
This is a straightforward port from Cycles functions.

They are written to work even with vector of size 1.

Pull Request: https://projects.blender.org/blender/blender/pulls/113678
2023-10-13 16:48:19 +02:00
Jeroen Bakker
751133c40e GPU: Skip Validating Transform Feedback Shaders When Not Supported
Shaders that require transform feedback should not be validated on
backends that don't support transform feedback.

In Vulkan transform feedback is implemented as an extension and
supported by half of the platforms. It isn't decided yet if we want to
support transform feedback as it is currently used as a fallback for
hair compute shader. In vulkan compute is available on all platforms.

During validation the shader printed a not implemented message.
This change hides that message.

Pull Request: https://projects.blender.org/blender/blender/pulls/113655
2023-10-13 12:50:55 +02:00
Jeroen Bakker
db2328436e Vulkan: Reduce Console Flooding
When Vulkan is started with validation layers the console is flooded.
Somewhere in the Vulkan validation layers or mesa driver (or the
combination) there is an issue where maxBufferSize is reported by the
driver to be 4GB, but the validation layers are reporting any buffer
size to be larger than 4GB.

For now we skip this message to be logged.

Pull Request: https://projects.blender.org/blender/blender/pulls/113652
2023-10-13 11:24:59 +02:00
Jeroen Bakker
26adfcdb57 Revert "Metal: Re-enable workbench NEXT shadows"
This reverts commit 95f01288b0.
It fails on non-apple platforms.
2023-10-13 11:05:02 +02:00
Jason Fielder
95f01288b0 Metal: Re-enable workbench NEXT shadows
With the shift to GPU-driven rendering pipeline,
the SSBO vertex fetch paradigm used to
implement workbench shadows on Metal
instead of utilising the geometry shader
path no longer worked correctly.

This is because the draw submission
required vertex amplification up-front,
based on the expected output geometry
amount for a given input geometry.

This WIP patch aims to resolve this
issue through addition of API to
enable the features within the
GPU driven pipeline.

Co-authored-by: Michael Parkin-White <mparkinwhite@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/113498
2023-10-13 11:02:06 +02:00
Jeroen Bakker
28c4abe57c EEVEE: Fix Fallback Shader Shadow Page Tile Store
`eevee_shadow_page_tile_store` shader uses `VIEWPORT_INDEX` and `LAYER`.
Both use an optional extension in OpenGL and Vulkan. When the extension
isn't available a geometry shader is injected to emulate the
extension. The generated geometry shader requires `instance_name` to be
set. This wasn't the case for `eevee_shadow_page_tile_store` shader.

This PR also adds a detection for incompatible shader infos.
- Shaders that use `VIEWPORT_INDEX` or `LAYER` cannot have a geometry stage.
  This check is done in debug and release builds.
- Shaders that use a fallback shader should have instance names set in
  the stage interfaces. This check is only done in debug builds.

Pull Request: https://projects.blender.org/blender/blender/pulls/113649
2023-10-13 10:42:25 +02:00
Jeroen Bakker
159e798cdb Vulkan: Add Viewport Array/Layer Workarounds
This PR adds workarounds for platforms that don't support `shaderOutputLayer`
or `shaderOutputViewportIndex`. Some NVIDIA laptop GPUs and ARM GPUs don't
have those device features.

The workaround uses the same approach as OpenGL. A geometry shader is injected
to emulate the feature.

For testing the workarounds they have also been connected to the
`--debug-gpu-force-workarounds` command line argument.

Fixes #113475 by implementing #113529

Pull Request: https://projects.blender.org/blender/blender/pulls/113605
2023-10-13 10:40:11 +02:00
Campbell Barton
9306bb9084 Merge branch 'blender-v4.0-release' 2023-10-13 17:32:51 +11:00
Jeroen Bakker
4cedbb9cb7 Fix #113310: Python gpu.state.scissor_test_set Not Updating State
When using scissor_test_set the framebuffer wasn't marked dirty and
would not always translate the start to actual driver commands.

Pull Request: https://projects.blender.org/blender/blender/pulls/113642
2023-10-13 07:44:11 +02:00
Campbell Barton
e86fbcd4f0 Merge branch 'blender-v4.0-release' 2023-10-13 10:31:44 +11:00
Campbell Barton
fb58aa5900 Cleanup: typos, duplicate words 2023-10-13 10:21:06 +11:00
Jeroen Bakker
7501a686c2 Vulkan: Fix Subpass Transition Compilation Errors
Vulkan backend doesn't support subpass transition yet. Currently
shader_builder fails as when compiling shaders that use subpass
transitions.

This PR adds a dummy global variable to the GLSL so the compilation
continues.

Development of subpass would take some time as the current API doesn't
fit Vulkan.

Pull Request: https://projects.blender.org/blender/blender/pulls/113604
2023-10-12 15:11:26 +02:00
Jeroen Bakker
76a1824c52 GPU: Force Workarounds Viewport Layer Array
The OpenGL extension `GL_ARB_shader_viewport_layer_array` wasn't turned
off when starting blender with `--debug-gpu-force-workarounds`. Although
all known supported platforms support this extension and we haven't seen
any failures with it, it was mentioned to be phased out as we consider
it to be a core extension, which it isn't.

This PR will enable the workaround for this extension and remove the
extension from the phase out list.

Pull Request: https://projects.blender.org/blender/blender/pulls/113572
2023-10-12 07:58:33 +02:00
Campbell Barton
b4504c7840 Cleanup: spelling in comments 2023-10-12 16:03:18 +11:00
Campbell Barton
db093a4608 Merge branch 'blender-v4.0-release' 2023-10-12 09:27:43 +11:00
Campbell Barton
b8ad624006 Cleanup: use doxygen doc-strings, spelling in comments 2023-10-12 09:26:53 +11:00
Miguel Pozo
3f72c62be6 GPU: Add GPU_max_storage_buffer_size
Needed for #113509.

Using a `size_t` since some GPUs should support >4GB buffers,
but Vulkan exposes the value as a `uint` and Metal as an `int`.

Pull Request: https://projects.blender.org/blender/blender/pulls/113516
2023-10-11 19:26:40 +02:00
Campbell Barton
91ec9bc5a7 Cleanup: don't use DOXYGEN blocks for inline comments 2023-10-11 10:49:07 +11:00
Jason Fielder
d5139065f1 Metal: Improve input latency management
This patch improves the heuristic used to
determine maximum frames-in-flight at
different input latency levels.

Previous values adjusted to better encapsulate
workloads in the 10-20 FPS range which can
manifest excessive latency. Changes improve
total performance throughput and improve
the interactive user experience.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/113020
2023-10-10 12:27:56 +02:00
Jeroen Bakker
f361cfa361 Vulkan: Bundle Immediate Mode Calls
When using Immediate mode emulation the data is stored in a ring buffer.
As data isn't overwritten it is safe to call multiple draw commands in
a single command buffer.

This improves drawing performance when immediate mode is being used, it
mostly improves the readability of the GPU traces in renderdoc.

Pull Request: https://projects.blender.org/blender/blender/pulls/113482
2023-10-10 09:54:35 +02:00
Jeroen Bakker
d67ec32747 Vulkan: Support for Framebuffer with Missing Attachments
Wireframe mode wasn't working and viewport had flickering artifacts.
Reason was that the render pass creation failed for its framebuffer as
the input data was filled with garbage for attachments that were unused.

Vulkan requires every attachment to be filled upto the highest used attachment
slot. This PR fills missing attachments with a dummy texture.

Pull Request: https://projects.blender.org/blender/blender/pulls/113141
2023-10-10 09:27:07 +02:00
Campbell Barton
137f8dd7bc Cleanup: spelling in comments 2023-10-10 09:44:57 +11:00
Campbell Barton
1bb098bf44 CMake: WITH_OPENGL_BACKEND=OFF excludes EGL/EPOXY includes & libraries
This isn't complete as opensubdiv, hydra & XR still depend on OpenGL.
2023-10-07 18:30:17 +11:00
Campbell Barton
126cf64004 CMake: quiet undefined variable use with MOLTENVK on non-apple systems 2023-10-07 18:25:44 +11:00
Miguel Pozo
026b81ce7c Merge branch 'blender-v4.0-release' 2023-10-06 17:49:15 +02:00
Miguel Pozo
c6194afc41 Fix: Workbench: Missing texture flag
Drawing volumes would trigger an assertion after fe39456ba5.
2023-10-06 17:48:40 +02:00
Jeroen Bakker
4a94e17156 Cleanup: Remove unused attribute in GLShaderInterface 2023-10-06 07:47:08 +02:00
Campbell Barton
71b1712d79 Cleanup: spelling in comments 2023-10-06 12:50:27 +11:00
Brecht Van Lommel
1849e192fa Merge branch 'blender-v4.0-release' into main 2023-10-05 22:03:29 +02:00
coyo_t
b0706a57ac Fix #106760: Cycles OSL boolean socket not working
Pull Request: https://projects.blender.org/blender/blender/pulls/109576
2023-10-05 21:55:10 +02:00
Jason Fielder
57a3ab29cc Metal: EEVEE Next: Optimize Virtual shadow maps for Apple Silicon
Optimization of EEVEE Next's Virtual Shadow Maps for TBDRs.
The core of these optimizations lie in eliminating use of
atomic shadow atlas writes and instead utilise tile memory to
perform depth accumulation as a secondary pass once all
geometry updates for a given shadow view have been updated.

This also allows use of fast on-tile depth testing/sorting, reducing
overdraw and redundant fragment operations, while also allowing
for tile indirection calculations to be offloaded into the vertex
shader to increase fragment storage efficiency and throughput.

Authored by Apple: Michael Parkin-White

Co-authored-by: Michael Parkin-White <mparkinwhite@apple.com>
Co-authored-by: Clément Foucault <foucault.clem@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/111283
2023-10-05 19:02:39 +02:00
Clément Foucault
9d229aee19 Math: Add from_up_axis matrix creation function
This add the possibility to create a
orthogonal basis around a given unit
vector.

The name was chosen to match the naming
convention already in place and match
the other matrix construction functions.
In other places (ex: renderers), this same
function is commonly named `make_orthonormal`
or `make_basis`.

The function is not given to have a fixed
implementation and might change overtime.
That's why the test only covers the
assumptions and not the raw values.

The implementation is borrowed from
Cycles and adapted to our math API.

Pull Request: https://projects.blender.org/blender/blender/pulls/113218
2023-10-04 14:35:47 +02:00
Campbell Barton
9c018def3e Cleanup: spelling in comments 2023-10-03 11:24:48 +11:00
Clément Foucault
7f7e1ab088 GL: Remove Apple platform specific workarounds
We don't ship with OpenGL anymore on Mac platform.
The build option is not even available anymore.

This removes any reference to Apple or Mac in the
Opengl module.

Note that I left the depth_blitting_workaround
even if it originaly meant for Mac because it
might be still useful for other hardware.

Pull Request: https://projects.blender.org/blender/blender/pulls/113126
2023-10-02 10:29:57 +02:00
Sergey Sharybin
732bfba6b8 Cleanup: Strict compiler arning
Unused function argument in the Metal framebuffer.
2023-10-02 09:51:56 +02:00
Clément Foucault
8fe0ffed4e GL: Subpass transition fix with GPU_ATTACHEMENT_IGNORE
GPU_ATTACHEMENT_IGNORE should work on slots that
contain no attachments.
2023-10-01 18:01:15 +02:00