Commit Graph

5697 Commits

Author SHA1 Message Date
Clément Foucault
52463a5f0b GPU: Remove unused GPUDrawList API
This was only used by the legacy draw manager.
This one has already been removed.
2024-12-05 23:26:29 +01:00
Clément Foucault
3e9a2fbf23 Cleanup: Formating 2024-12-05 23:17:44 +01:00
Clément Foucault
994c43413a Metal: Remove SSBO Vertex Fetch
This API was used as a workaround to the lack of
geometry shader. It has been rendered redundant
since the introduction of #125782.
2024-12-05 22:58:52 +01:00
Jeroen Bakker
55495b6224 Vulkan: Hide devices of failing drivers
Devices reported by failing drivers were still part of the device
selection list. When selected they would never be picked.

This change hides these devices from the UI

Pull Request: https://projects.blender.org/blender/blender/pulls/131431
2024-12-05 13:29:55 +01:00
Jeroen Bakker
475a038fde Fix #131376: Vulkan: Paint cursor nearest vertex incorrect
There were two issues.
- Rendering scope wasn't updated when changed between draw calls.
- GPU matrices were not bound when changed in immediate drawing.

Pull Request: https://projects.blender.org/blender/blender/pulls/131418
2024-12-05 11:36:27 +01:00
Jeroen Bakker
dc6bd96eeb Fix #131315: Vulkan: Provoking vertex incorrect
In OpenGL the last vertex is the provoking vertex. In Vulkan the first
vertex is the provoking vertex. This PR uses `VK_EXT_provoking_vertex`
to use the last vertex as the provoking vertex.

Pull Request: https://projects.blender.org/blender/blender/pulls/131412
2024-12-05 11:03:29 +01:00
Clément Foucault
fb84b21ec4 Cleanup: Selection: Assert legacy selection mode are not used 2024-12-04 19:18:14 +01:00
Miguel Pozo
bd1f4ec23c Fix: GPU: CPP shader errors in VS2019
Continuation of #131332.

Including built-in headers in VS2019 ends up including `corecrt_math.h`
as a side effect, which has many functions that overlap in name with
our stubs.
This puts the conflicting functions inside its own namespace (`glsl`)
and declares macros for them.
(Note this has the side effect of not allowing us to use those as
variable names)

This also removes the `<cassert>` and `<cstdio>` includes.

Pull Request: https://projects.blender.org/blender/blender/pulls/131386
2024-12-04 18:03:42 +01:00
Miguel Pozo
72aaaa0c24 Fix: GPU: Errors and warnings for CPP shaders in MSVC
Pull Request: https://projects.blender.org/blender/blender/pulls/131332
2024-12-04 17:33:12 +01:00
Clément Foucault
a0078b79ff Cleanup: GPU: Remove include of removed directory 2024-12-04 10:06:15 +01:00
Clément Foucault
62897317bd DRW: Remove Basic engine
All remaining shaders were moved to overlay.

The basic engine is not used anymore since
all selection and depth picking happens inside
overlay engine.
2024-12-03 16:11:31 +01:00
Jeroen Bakker
52d3cf8568 Fix #131227: OpenGL: Sequence editor crash on legacy Intel platforms
There seems to be an issue inside Intel OpenGL driver of legacy
platforms that fails to link `gpu_shader_sequencer_strips`.
Uniform locations are used to fix an specialization constants issue.

This PR only adds the uniform location when the shader can be
specialized. It is unclear what is actually failing inside the driver
but there are other issues with the driver.

Pull Request: https://projects.blender.org/blender/blender/pulls/131293
2024-12-03 15:31:10 +01:00
Jeroen Bakker
60d918c297 Fix #131269: Vulkan: Add support for GPU_DATA_UINT_24_8 read back
Add support for GPU_DATA_UINT_24_8 readback. Note that stencil reading/writing
are not supported.

Pull Request: https://projects.blender.org/blender/blender/pulls/131302
2024-12-03 14:56:43 +01:00
Jeroen Bakker
c480b7ffd3 Vulkan: Incorrect image aspect when transferring depth textures
When copying from/to depth stencil images the aspect of the image was
set incorrectly. It pointed to only one aspect of the full image when
building resource links, which could lead to incorrect decisions in the
driver.

Found when researching #131269

Pull Request: https://projects.blender.org/blender/blender/pulls/131298
2024-12-03 12:36:39 +01:00
Clément Foucault
18f3a11955 GPU: Remove remaining metal geometry shader workarounds
_No response_

Pull Request: https://projects.blender.org/blender/blender/pulls/131267
2024-12-03 10:18:50 +01:00
Clément Foucault
c770b940ae GPU: GLSL C++ Stubs: Use extern variables for buffers and uniforms
Avoid false positive warning about division by zero.
2024-12-02 23:01:12 +01:00
Clément Foucault
e0989d5bd6 Cleanup: GPU: Address unused GLSL variables throughout the codebase 2024-12-02 23:01:12 +01:00
Clément Foucault
01f1e9a2c4 GPU: Silence most GLSL C++ compilation warnings 2024-12-02 23:01:12 +01:00
Clément Foucault
2c3ccdf77a GPU: GLSL compilation as C++ for eevee static shaders
Rel #127983

Pull Request: https://projects.blender.org/blender/blender/pulls/130298
2024-12-02 21:26:15 +01:00
Clément Foucault
3d9ffa5085 Overlay: Remove legacy option and legacy code
This simply removes the old overlay engine.

Rel #102179

Pull Request: https://projects.blender.org/blender/blender/pulls/131155
2024-12-02 19:47:55 +01:00
Clément Foucault
4bfaecc340 Fix #131212: Metal: Non-aligned circular buffer allocation logic
The new buffer size could have been non aligned when using the
fractional growing heuristic. This non aligned allocation
would then trigger an assert at the SSBO constructor.

Aligning the alocation size fixes the issue.
2024-12-02 17:34:35 +01:00
Jeroen Bakker
108a0f2ec0 Vulkan: Share driver check between GPU and GHOST
GPU and GHOST require to have identical checks to remove faulty drivers.
When not done GHOST can still select a device that isn't supported and
lead to freezing interfaces.

Pull Request: https://projects.blender.org/blender/blender/pulls/131241
2024-12-02 14:50:32 +01:00
Jeroen Bakker
33fd027dc5 Cleanup: Remove unused attribute 2024-12-02 08:29:46 +01:00
Clément Foucault
e44ae763bc GPU: GLSL C++ Stubs: Add minor missing features 2024-11-30 10:20:37 +01:00
Clément Foucault
7371bde40b Cleanup: Selection: Adress warning 2024-11-29 21:36:41 +01:00
Clément Foucault
bda911bcaa GPU: GLSL C++ Stub: Add packed type and small types 2024-11-29 21:33:06 +01:00
Clément Foucault
54be7ed322 Fix: Overlay-Next: Broken selection on first click
This was caused by querying on the selection state
before it is setup. It is only setup just before
the draw function.

To fix this, we sync the `info_buf` just before
drawing the overlays.

Also add some safety to avoid uninitialized memory.
2024-11-29 18:46:17 +01:00
Miguel Pozo
8504c12fa9 Fix #130776: OpenGL: Use explicit uniform locations
Ensure uniform locations are the same across specialization constants
shader variations.

Pull Request: https://projects.blender.org/blender/blender/pulls/131116
2024-11-29 15:47:51 +01:00
Clément Foucault
7a73741157 Fix #131133: GPU: Navigation Gizmo sometimes doesn't display the axis lines
Alignment was incorrect if vertex format stride was bigger than
SSBO required alignment.
2024-11-29 12:50:52 +01:00
Guillermo Venegas
7f7f9e987f Fix #130817: Make resource pool to cycle when swapchain images are presented
Its not standard how `Present Engines` return images for presentation, and
currently is expected that they cycle between swap-chain images with each
`vkAcquireNextImageKHR` call.

However present engines could return any available image, that can mean
to reuse the last presented one if available. (This seem to be the behavior
using `Layered on DXGI Swapchain` the default `Present Method` used
with latest NVIDIA drivers on Windows).

Since resource pools expects to images to cycle in a sequential order, if any
present engine always return the same image for presentation only a single
resource pool would be used for each rendered frame, and since resources
are only released by cycling between resource pools, this resource pool would
overflow since it never releases any resource.

This changes makes resource pools to cycle each time a image is presented.

Pull Request: https://projects.blender.org/blender/blender/pulls/131129
2024-11-29 12:35:44 +01:00
Clément Foucault
6332be9700 GPU: C++ GLSL Stubs: Use unions instead of inheritance for swizzle
This avoid stack overflow on GCC because types were getting too
large (70 bytes for a float4) and created a lot of static
memory for UBOs declarations.
2024-11-29 12:00:01 +01:00
Clément Foucault
95233986cb GPU: C++ GLSL Stubs: Add atomic sampler 2024-11-29 10:19:23 +01:00
Jeroen Bakker
71ec30fce9 Fix #131135: Vulkan: Crash closing window
When a main window contains a child window and the main window is closed
it can crash as the context isn't available when destructing the
VKFramebuffer of the child window.

Pull Request: https://projects.blender.org/blender/blender/pulls/131137
2024-11-29 09:11:13 +01:00
Jeroen Bakker
61d4f7359b Fix: Vulkan: Compiling issue
PR for colored debug groups didn't had the latest changes of main
2024-11-29 08:16:13 +01:00
Jiarui-Yan
b356c2bec1 Vulkan: Colored debug groups
This PR adds color to debug group so that RenderDoc can give color to different
debug groups and sub-groups in the parent debug group.

Ref: #124099

Pull Request: https://projects.blender.org/blender/blender/pulls/129340
2024-11-29 07:52:00 +01:00
Clément Foucault
c1bc1ef3ea GPU: C++ GLSL Stubs: Fix isinf / isnan 2024-11-29 00:37:45 +01:00
Clément Foucault
b39843e7b0 GPU: Use extern for non static expressions and use non zero value for gl_WorkGroupSize
Pull Request: https://projects.blender.org/blender/blender/pulls/131064
2024-11-28 23:23:30 +01:00
Clément Foucault
dd480ab604 GPU: Refactor the GLSL C++ stub swizzle implementation
This removes support for nested swizzling but avoid
warning about static member accesses through class
instance.
2024-11-28 23:23:27 +01:00
Clément Foucault
5954898edf GPU: Add back support for uchar4 color when using widelines
This is still pretty useful as the data savings is not negligeable.

Also supports it for python.
2024-11-28 18:28:08 +01:00
Clément Foucault
ec84fe5fdb Fix #131091: GL: Weird Lines appearing in Gizmo Overlays
This happened because NVidia GPUs require higher alignment
for SSBO binds than for vertex inputs.

This is related to	#131103 which fixed it for vulkan.

Add a common capability option for that.
2024-11-28 17:22:12 +01:00
Jeroen Bakker
8e4502258a Fix: Vulkan: Misalignment sub-buffers immediate drawing
Since recently we bind immediate sub buffers as storage buffers to
extend the geometry for line drawing. We didn't add alignment checks and
that raised warnings. This change will fix those warnings.

Pull Request: https://projects.blender.org/blender/blender/pulls/131103
2024-11-28 16:31:58 +01:00
Jeroen Bakker
c69b107a28 Fix #130121: Vulkan: Lightbaking resources freed to early
When lighting baking is used in a background render the resources are
freed to early. The cause is that light baking does some initialization
within a context, that isn't send to the GPU. The first iteration of
light baking is expecting that it can free resources, what leads to GPU
resources to be deleted that are still used by commands that are
scheduled to be send to the GPU.

This PR fixes this by using multiple resource pools when background
rendering and ensure that contexts are send to the GPU when rendering
ends.

Pull Request: https://projects.blender.org/blender/blender/pulls/131094
2024-11-28 16:05:59 +01:00
Jeroen Bakker
deff994123 Vulkan: Add support for GPU_logic_op_xor_set
Add support for Logic op XOR. This is used in image editors and tracking
editor. Logic ops is required on Linux and Windows, however for macOS it
will be disabled when using MoltenVK. MoltenVK has can be compiled with
support for logic ops, but that isn't the default as it relies on
private APIs.

When the workaround is enabled it will create artifacts when used.

Ref: #130347

Pull Request: https://projects.blender.org/blender/blender/pulls/131089
2024-11-28 15:12:13 +01:00
Jeroen Bakker
faf2c6f0ca Vulkan: Add method to query debug group of node
When debugging render graph the debug group name can narrow down the
place where a node originates from. This PR adds a function to retrieve
the full debug group name of a specific node.

Pull Request: https://projects.blender.org/blender/blender/pulls/131081
2024-11-28 12:00:21 +01:00
Clément Foucault
00a8d006fe GPU: Move Polyline shader to primitive expansion
This port is not so straightforward.

This shader is used in different configurations and is
available to python bindings. So we need to keep
compatibility with different attributes configurations.

This is why attributes are loaded per component and a
uniform sets the length of the component.

Since this shader can be used from both the imm and batch
API, we need to inject some workarounds to bind the buffers
correctly.

The end result is still less versatile than the previous
metal workaround (i.e.: more attribute fetch mode supported),
but it is also way less code.

### Limitations:
The new shader has some limitation:
- Both `color` and `pos` attributes need to be `F32`.
- Each attribute needs to be 4byte aligned.
- Fetch type needs to be `GPU_FETCH_FLOAT`.
- Primitive type needs to be `GPU_PRIM_LINES`, `GPU_PRIM_LINE_STRIP` or `GPU_PRIM_LINE_LOOP`.
- If drawing using an index buffer, it must contain no primitive restart.

Rel #127493

Co-authored-by: Jeroen Bakker <jeroen@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/129315
2024-11-27 17:37:04 +01:00
Campbell Barton
b9f055459a Cleanup: ensure trailing space around comment blocks 2024-11-27 19:01:00 +11:00
Clément Foucault
112b3bae84 Fix: GPU: Asserts when building WITH_GPU_DRAW_TESTS but without WITH_GTEST 2024-11-26 22:39:13 +01:00
Clément Foucault
ebcc3dbc41 Fix: UI: Broken Geometry node socket display on macOS
Fix various warnings (that were errors) referring to
variables used inside their own initialization.
2024-11-26 21:32:27 +01:00
Jeroen Bakker
492830e9ac Fix #130832: Vulkan: Texture painting
When using texture painting Blender could freeze, crash or not showing
any results depending on the platform being used.

There were several issues:
- texture painting could send a layer offset of -1, which would select
  an incorrect layer
- source data wasn't copied correctly in the staging buffer as it
  ignored `texture_unpack_row_length`

Pull Request: https://projects.blender.org/blender/blender/pulls/130973
2024-11-26 15:15:25 +01:00
Clément Foucault
41a54198bb GPU: Assert non-null batch inside drawing functions 2024-11-26 14:19:50 +01:00