Commit Graph

44 Commits

Author SHA1 Message Date
Jeroen Bakker
f75e4f4dea Cleanup: Vulkan: Move comment 2025-05-23 08:27:27 +02:00
Hans Goudey
d094812709 Vulkan: Inline more trivial methods
These functions are trivial and shouldn't add the cost of a call.
They appeared in profiles, which they shouldn't since they mostly
just return access to member variables. Inlining them reduces
the backend's overhead when sculpting.

Also reserve a Vector before repeated appending.

Pull Request: https://projects.blender.org/blender/blender/pulls/138349
2025-05-06 14:27:43 +02:00
Brecht Van Lommel
b8b7f71520 Vulkan: Implement native handles for pixel buffers
* Pixel buffer is always allocated with export and dedicated memory flags.
* Returns an opaque file descriptor (Unix) or handle (Windows).
* Native handle now includes memory size as it may be slightly bigger
  than the requested size.

Pull Request: https://projects.blender.org/blender/blender/pulls/137363
2025-04-28 11:38:56 +02:00
Jeroen Bakker
5102f33ef9 Fix #137081: Vulkan: Memory leak in descriptor pools.
Descriptor pools were never discarded, leading to out of memory issues
when running for a long time. This PR discards used descriptor pool when
the render graph is submitted to the device.

- Detected that to descriptor sets could be uploaded multiple times
  however once was always empty.
- When render graph is flushed all descriptor pools are discarded.
- Improved debugging of discard pools.

Pull Request: https://projects.blender.org/blender/blender/pulls/137521
2025-04-15 12:18:34 +02:00
Jeroen Bakker
15d88e544a GPU: Storage buffer allocation alignment
Since the introduction of storage buffers in Blender, the calling
code has been responsible for ensuring the buffer meets allocation
requirements. All backends require the allocation size to be divisible
by 16 bytes. Until now, this was sufficient, but with GPU subdivision
changes, an external library must also adhere to these requirements.

For OpenSubdiv (OSD), some buffers are not 16-byte aligned, leading
to potential misallocation. Currently, this is mitigated by allocating
a few extra bytes, but this approach has the drawback of potentially
reading unintended bytes beyond the source buffer.

This PR adopts a similar approach to vertex buffers: the backend handles
extra byte allocation while ensuring data uploads and downloads function
correctly without requiring those additional bytes.

No changes were needed for Metal, as its allocation size is already
aligned to 256 bytes.

**Alternative solutions considered**:

- Copying the CPU buffer to a larger buffer when needed (performance impact).
- Modifying OSD buffers to allocate extra space (requires changes to an external library).
- Implementing GPU_storagebuf_update_sub.

Ref #135873

Pull Request: https://projects.blender.org/blender/blender/pulls/135716
2025-03-13 15:05:16 +01:00
Jeroen Bakker
cdc37b2235 GPU: Add support for GPU_vertbuf_update_sub
`GPU_vertbuf_update_sub` is used by GPU based subdivision to integrate
quads, triangles and edges. This is just an implementation to make it
work as we are planning bigger changes to improve performance of
uploading data to the GPU.

Pull Request: https://projects.blender.org/blender/blender/pulls/135774
2025-03-11 10:14:00 +01:00
Jeroen Bakker
0faba244a5 Fix: Vulkan: Async readback of storage buffers
The vulkan backend was implemented with async in mind, however the one place
where Blender uses for async was implemented blocking. This PR splits the
readback into flushing the command and waiting for readback.

**Performance**

Improvement of animation playback performance of shader balls.blend is around 10%.
Shader balls.blend frame: 1-100, 10 x animation playback

| Branch               | Total time | Average time |
| -------------------- | ---------- | ------------ |
| blender-v4.4-release | 26851 ms   | 2685 ms      |
| This PR              | 23675 ms   | 2367 ms      |

Pull Request: https://projects.blender.org/blender/blender/pulls/134227
2025-02-17 08:58:06 +01:00
Jeroen Bakker
e6b3cc8983 Vulkan: Device command builder
This PR implements a new the threading model for building render graphs
based on tests performed last month. For out workload multithreaded
command building will block in the driver or device. So better to use a
single thread for command building.

Details of the internal working is documented at https://developer.blender.org/docs/features/gpu/vulkan/render_graph/

- When a context is activated on a thread the context asks for a
  render graph it can use by calling `VKDevice::render_graph_new`.
- Parts of the GPU backend that requires GPU commands will add a
  specific render graph node to the render graph. The nodes also
  contains a reference to all resources it needs including the
  access it needs and the image layout.
- When the context is flushed the render graph is submitted to the
  device by calling `VKDevice::render_graph_submit`.
- The device puts the render graph in `VKDevice::submission_pool`.
- There is a single background thread that gets the next render
  graph to send to the GPU (`VKDevice::submission_runner`).
  - Reorder the commands of the render graph to comply with Vulkan
    specific command order rules and reducing possible bottlenecks.
    (`VKScheduler`)
  - Generate the required barriers `VKCommandBuilder::groups_extract_barriers`.
    This is a separate step to reduce resource locking giving other
    threads access to the resource states when they are building
    the render graph nodes.
  - GPU commands and pipeline barriers are recorded to a VkCommandBuffer.
    (`VKCommandBuilder::record_commands`)
  - When completed the command buffer can be submitted to the device
    queue. `vkQueueSubmit`
  - Render graphs that have been submitted can be reused by a next
    thread. This is done by pushing the render graph to the
    `VKDevice::unused_render_graphs` queue.

Pull Request: https://projects.blender.org/blender/blender/pulls/132681
2025-01-27 08:55:23 +01:00
Jeroen Bakker
2feb435780 Fix: Vulkan: Memory allocation on no-rebar capable platforms
Memory areas was requested to be preferable host visible. On some
platforms this would fail to allocate. Best is to not add preferable
host visible for typically large allocations.

This PR also gives the caller the responsibility to set the allocation flags.

Pull Request: https://projects.blender.org/blender/blender/pulls/133528
2025-01-24 11:54:59 +01:00
Jeroen Bakker
264681344f Vulkan: Provide more control on memory allocation
This change give access to preferred and required allocation flags
allowing better control over where memory is allocated.

Pull Request: https://projects.blender.org/blender/blender/pulls/133059
2025-01-14 17:41:35 +01:00
Jeroen Bakker
fbe05ac60b Cleanup: Vulkan: Remove unused code/parameters
Initial design had a more complex use case for render graphs.
They are not really used and will not in the near term. This PR
removes some code that doesn't do a thing

Pull Request: https://projects.blender.org/blender/blender/pulls/133047
2025-01-14 14:09:50 +01:00
Jeroen Bakker
7de4e6d2ee Vulkan: Add support for ReBAR
This adds initial support for ReBAR capable platforms.

It ensures that when allocating buffers that should not be host visible, still
tries to allocate in host visible memory. When there is space in this memory
heap the buffer will be automatically mapped to host memory.

When mapped staging buffers can be skipped when the buffer was newly
created. In order to make better usage of ReBAR the `VKBuffer::create`
function will need to be revisit. It currently hides to much options to allocate
in the correct memory heap. This change isn't part of this PR.

Using shader_balls.blend rendering the first 50 frames in main takes 1516ms.
When using ReBAR it takes 1416ms.
```
Operating system: Linux-6.8.0-49-generic-x86_64-with-glibc2.39 64 Bits, X11 UI
Graphics card: AMD Radeon Pro W7700 (RADV NAVI32) Advanced Micro Devices radv Mesa 24.3.1 - kisak-mesa PPA Vulkan Backend
```

Pull Request: https://projects.blender.org/blender/blender/pulls/131856
2024-12-16 10:09:33 +01:00
Campbell Barton
4df285ccd5 Cleanup: move function comments into headers or implementation notes
For C/C++ doc-strings should be located in headers,
move function comments into the headers, in some cases merging
with existing doc-strings, in other cases, moving implementation
notes into the function body.
2024-11-02 17:27:09 +11:00
Jeroen Bakker
3b7dd61e01 Fix: Vulkan: Incorrect Host Visibility Allocation
When allocating a host visible buffer it could be that the returned
buffer was not host visible and access to the buffer would write to
unallocated memory.

Detected when researching #128608

Pull Request: https://projects.blender.org/blender/blender/pulls/128977
2024-10-14 15:39:27 +02:00
Jeroen Bakker
4d8581c7ee Vulkan: Add node to update buffers
This change adds the option to update a buffer via the render
graph via `vkCmdUpdateBuffer`. This is only enabled for
uniform buffers as they are small and aligned/sized correctly.

Pull Request: https://projects.blender.org/blender/blender/pulls/128416
2024-10-01 14:22:56 +02:00
Jeroen Bakker
481c8fd5a7 Vulkan: Memory leak in immediate mode during exit
When exiting the immediate buffers are discarded, but where not
destroyed making the buffers still leak.
Detected when looking into descriptor set freeze issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/128249
2024-09-27 15:01:10 +02:00
Jeroen Bakker
88b5467e0e Vulkan: Batch Upload Descriptor Sets
Descriptor sets will be uploaded in batch. This allows drivers to
do additional optimizations or at least push some looping to the
driver side.

Pull Request: https://projects.blender.org/blender/blender/pulls/128167
2024-09-26 12:04:09 +02:00
Jeroen Bakker
e82ba8d495 Vulkan: Incorrect buffer size when allocating large buffers
When 'really' large buffers are allocated the incorrect clamping
function was used and the actual buffer allocated was smaller than
expected.

This was detected during investigation of #126863.

Pull Request: https://projects.blender.org/blender/blender/pulls/126915
2024-08-29 08:55:02 +02:00
Jeroen Bakker
d48986eec9 Fix: Vulkan: EEVEE irradiance baking
Fix crash when using EEVEE irradiance baking. When reading back the
intermediate result the active rendering was not ended, resulting
in an assert as the rendergraph is cleared and assumed to be in an
initial state (not rendering).

Pull Request: https://projects.blender.org/blender/blender/pulls/126688
2024-08-23 14:45:40 +02:00
Jeroen Bakker
ef3ceb3629 Vulkan: Resource Pools
This PR implements #126353; In short: keep discard list as part of swap chain images. This allows
better determination when resources are actually not in use anymore.

## Resource pool

Resource pools keep track of the resources for a swap chain image.

In Blender this is a bit more complicated due to the way GPUContext work. A single thread can have
multiple contexts. Some of them have a swap chain (GHOST Window) other don't (draw manager). The
resource pool should be shared between the contexts running on the same thread.

When opening multiple windows there are also multiple swap chains to consider.

### Discard pile

Resource handles that are deleted and stored in the discard pile. When we are sure that these
resources are not used on the GPU anymore these are destroyed.

### Reusable resources

There are other resources as well like:
- Descriptor sets
- Descriptor pools

## Open issues

There are some limitations that require future PRs to fix including:
- Background rendering
- Handling multiple windows
- Improve CPU/GPU synchronization
- Reuse staging buffers

Pull Request: https://projects.blender.org/blender/blender/pulls/126353
2024-08-19 15:37:48 +02:00
Jeroen Bakker
4353b7ffba Vulkan: Remove unused code
Vulkan backend has recently switched to a render graph approach. Many
code was left so we could develop the render graph beside the previous
implementation. Last week we removed the switch. This PR will remove
most of the unused code. There might be some left and will be removed
when detected.

Pull Request: https://projects.blender.org/blender/blender/pulls/123422
2024-06-20 11:34:19 +02:00
Jacques Lucke
8b7cde3efc Merge branch 'blender-v4.2-release' 2024-06-14 20:19:03 +02:00
Miguel Pozo
a22a4810c7 GPU: Use size_t for GPU buffer sizes
Update all GPU buffer size-related functions to use `size_t` for
consistency.

Pull Request: https://projects.blender.org/blender/blender/pulls/123240
2024-06-14 19:27:33 +02:00
Jeroen Bakker
58ecfb869d Vulkan: Remove render graph switch
As render graph is now the default, we can remove the
render graph switch. This allows us to cleanup unused
functions and classes.

Pull Request: https://projects.blender.org/blender/blender/pulls/123219
2024-06-14 09:44:59 +02:00
Jeroen Bakker
ed9dea08b2 Vulkan: Render graph storage buffers
A developer can switch `vk_common.hh#use_render_graph` to enable render graph.
When enabled the buffers and images are tracked by the device resource state
tracker. The storage buffer commands are recorded to the context render graph.

The next unit tests will pass:
- GPUVulkanTest.storage_buffer_create_update_read
- GPUVulkanTest.storage_buffer_clear_zero
- GPUVulkanTest.storage_buffer_clear
- GPUVulkanTest.storage_buffer_copy_from_vertex_buffer

The pattern to migrate to render graph is:
- always construct CreateInfo for class.
- based on `use_render_graph` call `context.command_buffers.something`
  or `context.render_graph.add_node`.
- Hide calls to `context.flush` when `use_render_graph` is true.

Pull Request: https://projects.blender.org/blender/blender/pulls/120812
2024-04-19 12:08:57 +02:00
Jeroen Bakker
d09d93febf Vulkan: Store Vertex, Index and Storage Buffers on Device Memory
Currently all buffer types were stored in host memory, which is visible to the GPU as well.
This is typically slow as the data would be transferred over the PCI bus when used.

Most of the time Index and Vertex buffers are written once and read many times so it makes
more sense to locate them on the GPU. Storage buffers typically require quick access as they
are created for shading/compute purposes.

This PR will try to store vertex buffers, index buffers and storage buffers on device memory
to improve the performance.

Uniform buffers are still located on host memory as they can be uploaded during binding process.
This can (will) reset the graphics pipeline triggering draw calls using unattached resources.

In future this could be optimized further as in:
* using different pools for allocating specific buffers, with a fallback when buffers cannot be
  stored on the GPU anymore.
* store uniform buffers in device memory

Pull Request: https://projects.blender.org/blender/blender/pulls/115343
2023-11-24 13:52:48 +01:00
Jeroen Bakker
782e2e5f9a Vulkan: Make Command Pool, Descriptor Sets Context Specific
In Blender a context should not be shared between threads. In Vulkan a
command pool must not be shared between threads. In the current
implementation the command pool are stored on device level and could
therefore be shared between multiple context which made the implementation
not matching these rules.

This PR moves the command pool from device to command buffers where it
would not conflict between other contexts. This PR doesn't make the Vulkan
backend fully multithreaded. The access to the queue is still missing.

Pull Request: https://projects.blender.org/blender/blender/pulls/114977
2023-11-16 15:03:47 +01:00
Jeroen Bakker
f76ceddc98 Vulkan: Workaround for Unsupported R8G8B8 Vertex Buffer Formats
On some platforms `VK_FORMAT_R8G8B8_*` are not supported as vertex buffers. The
obvious workaround for this is to use `VK_FORMAT_R8G8B8A8_*`. Using unsupported
vertex formats would crash Blender as it is not able to compile the graphics
pipelines that use them.

Known platforms are:
- NVIDIA Mobile GPUs (Quadro M1000M)
- AMD Polaris (open source drivers)

This PR adds the initial workings for other unsupported vertex buffer formats we
need to fix in the future.

`VKDevice.workarounds.vertex_formats` contain booleans if the workaround for
a specific format should be turned on (`r8g8b8 = true`). `VertexFormatConverter` can be
used to identify if conversions are needed and perform the conversion.

Pull Request: https://projects.blender.org/blender/blender/pulls/114572
2023-11-08 09:44:22 +01:00
Jeroen Bakker
e77cf08b02 Cleanup: Vulkan: Replace FlagBits with Flags
Vulkan API uses Flags and FlagBits for enumerations. The FlagBits
contains the options that can be hold with the Flags data type.

This wasn't well understood at the beginning of the project and
the FlagBits where used where Flags should have been used. This cleanup
fixes this, improving the readability of the code where bit
manipulations where used.

Pull Request: https://projects.blender.org/blender/blender/pulls/114459
2023-11-03 14:42:12 +01:00
Jeroen Bakker
f35b0373d6 Vulkan: Separate DataTransfer, Compute, Graphics Commands
Goal is to reduce the number of command buffer flushes by tracking what is
happening in the different command queues. This is an initial step towards
advanced queue-ing strategies.

The new (intermediate) strategy records commands to different command
buffers based on what they do. There is a command buffer for data transfers,
compute pipelines and graphics pipelines.

When a compute command is recorded it ensures that all graphic commands
are finished. When a graphic command is recorded it ensures all compute
commands are finished. When a graphic or compute command is scheduled
all recorded data transfer commands are scheduled as well.

Some improvements are expected as multiple compute and data transfers
commands can now be scheduled at the same time and don't need to unbind
and rebind render passes. Especially when using EEVEE-Next which is
compute centric the performance change is visible for the user.

Pull Request: https://projects.blender.org/blender/blender/pulls/114104
2023-10-30 14:21:14 +01:00
Jeroen Bakker
1daecc24d0 Vulkan: Postpone Resource Destruction
Resources can still be in use inside the vulkan command queue, when
they are destroyed. Especially as Vulkan doesn't allow resetting
bindings to nothing.

This PR will collect the resources that needs to be destroyed inside
the VKDevice and actually destroy the resources when on frame end.

The resources currently include:
* VkBuffer
* VkImage
* VkImageView
* VkFramebuffer
* VkRenderPass

Pull Request: https://projects.blender.org/blender/blender/pulls/112514
2023-09-18 13:42:17 +02:00
Jeroen Bakker
bce23aa0f5 Fix: Crash On Exit When Using Vulkan
Vulkan device was deallocated, but when destroying the GHOST context
the GPU context is reactivated and want to allocate buffers lazilly.

This is solved by de-initializing the device on platform exit, resetting
buffer pointers so double free can be detected.

Pull Request: https://projects.blender.org/blender/blender/pulls/111462
2023-08-24 10:23:21 +02:00
Campbell Barton
e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.

While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.

Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.

Some directories in `./intern/` have also been excluded:

- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.

An "AUTHORS" file has been added, using the chromium projects authors
file as a template.

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00
Sergey Sharybin
c1bc70b711 Cleanup: Add a copyright notice to files and use SPDX format
A lot of files were missing copyright field in the header and
the Blender Foundation contributed to them in a sense of bug
fixing and general maintenance.

This change makes it explicit that those files are at least
partially copyrighted by the Blender Foundation.

Note that this does not make it so the Blender Foundation is
the only holder of the copyright in those files, and developers
who do not have a signed contract with the foundation still
hold the copyright as well.

Another aspect of this change is using SPDX format for the
header. We already used it for the license specification,
and now we state it for the copyright as well, following the
FAQ:

    https://reuse.software/faq/
2023-05-31 16:19:06 +02:00
Jeroen Bakker
3f89ec2866 Vulkan: Copy Between Textures
This PR adds support for copying between two textures.

Pull Request: https://projects.blender.org/blender/blender/pulls/108413
2023-05-30 13:50:35 +02:00
Jeroen Bakker
43bee6ea69 Vulkan: Ensure Minimum Size of VKBuffer
In Vulkan it is not allowed to allocate a buffer of zero bytes. This
would generate an error. In Blender it is possible that a buffer is zero
bytes. For example when the draw manager is drawing instances and there
are no instanced in the scene.

This PR ensures that at least a single byte is allocated in order to not
fail later on.

Co-authored-by: Jeroen Bakker <j.bakker@atmind.nl>
Pull Request: https://projects.blender.org/blender/blender/pulls/107731
2023-05-09 10:20:54 +02:00
Jeroen Bakker
f428fd8229 Vulkan: Share Device Between Contexts
Previous GHOST_ContextVK would create a logical device for each
context. Blender uses multiple contexts at the same time and wasn't able
to share resources between them as the logical device where different.

This patch will create a single logical device and share them between
multiple contexts. This allows sharing memory/shaders between contexts
and make sure that all memory allocations are freed from the device it
was allocated from.

Some allocations in Blender are freed when there isn't a context, this
was failing in the previous implementation. We didn't noticed it before
as we didn't test multiple contexts.

This patch also moves device specific data structures from VKContext to
VKDevice like the descriptor pools, debug layers etc.

Pull Request: https://projects.blender.org/blender/blender/pulls/107606
2023-05-04 10:06:48 +02:00
Jeroen Bakker
d5cd51f089 Vulkan: Add streaming buffers.
Add support for streaming buffers.

Pull Request: https://projects.blender.org/blender/blender/pulls/107335
2023-04-25 15:48:52 +02:00
Sergey Sharybin
a12a8a71bb Remove "All Rights Reserved" from Blender Foundation copyright code
The goal is to solve confusion of the "All rights reserved" for licensing
code under an open-source license.

The phrase "All rights reserved" comes from a historical convention that
required this phrase for the copyright protection to apply. This convention
is no longer relevant.

However, even though the phrase has no meaning in establishing the copyright
it has not lost meaning in terms of licensing.

This change makes it so code under the Blender Foundation copyright does
not use "all rights reserved". This is also how the GPL license itself
states how to apply it to the source code:

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software ...

This change does not change copyright notice in cases when the copyright
is dual (BF and an author), or just an author of the code. It also does
mot change copyright which is inherited from NaN Holding BV as it needs
some further investigation about what is the proper way to handle it.
2023-03-30 10:51:59 +02:00
Jeroen Bakker
d5df77199b Vulkan: Resource Submission Tracking
In Vulkan multiple commands can be in flight simultaneously.

These commands can share resources like descriptor sets or push
constants. When between commands these resources are updated
a new version of the resources should be created.

When a resource is updated it should check the submission id of the
command buffer. If this is different than last known by the resources,
the previous resources should be freed.
If the submission id is the same than previously it has to create a
new version of the resource to not intervene with other commands that
uses the resource before the update.
When the resource wasn't updated between multiple usages in the same
submission id it could reuse the previous resource.

This PR introduces a `ResourceTracker` and a `SubmissionTracker`.
A submission tracker can check if the command buffer is submitted.
In this case all resources of the resource tracker should be freed.
Unmodified resources in the same submission can be shared.

A resource tracker will keep track of all resources that are in
flight. After the resources are used (submission + execution) have
finished the resources can be cleared.

Pull Request: https://projects.blender.org/blender/blender/pulls/105183
2023-03-24 07:47:50 +01:00
Jeroen Bakker
8ded95c175 Vulkan: Clearing Storage Buffers
This PR adds support for `GPU_storagebuf_clear` and
`GPU_storagebuf_clear_zero` to the Vulkan backend. It also adds test
cases for all backends.

Pull Request: https://projects.blender.org/blender/blender/pulls/105487
2023-03-17 13:48:39 +01:00
Jeroen Bakker
cf2c9fe186 Vulkan: Add initial VkPixelBuffer.
VKPixelBuffer is used by external render engines to allocate buffers
using the same GPU backend that Blender runs in.

In a later stage we should test what exact binding flags are needed. I
expect that it should be able to use as a transfer buffer to copy the
pixels over to a texture using transfer commands.

Pull Request: https://projects.blender.org/blender/blender/pulls/105741
2023-03-13 19:25:18 +01:00
Jeroen Bakker
0ad06cd39d Vulkan: Automap Buffers.
It is recommended to map buffers once and not each time the
mapped memory is needed. This patch will map the buffer when
created and unmap the buffer when the buffer is freed.

This patch will reduce the overhead where the Vulkan driver or
the virtual memory manager needs to be accessed.

Pull Request: https://projects.blender.org/blender/blender/pulls/105588
2023-03-09 09:27:42 +01:00
Jeroen Bakker
7fb1f060ff Vulkan: Initial Compute Shaders support
This patch adds initial support for compute shaders to
the vulkan backend. As the development is oriented to the test-
cases we have the implementation is limited to what is used there.

It has been validated that with this patch that the following test
cases are running as expected
- `GPUVulkanTest.gpu_shader_compute_vbo`
- `GPUVulkanTest.gpu_shader_compute_ibo`
- `GPUVulkanTest.gpu_shader_compute_ssbo`
- `GPUVulkanTest.gpu_storage_buffer_create_update_read`
- `GPUVulkanTest.gpu_shader_compute_2d`

This patch includes:
- Allocating VkBuffer on device.
- Uploading data from CPU to VkBuffer.
- Binding VkBuffer as SSBO to a compute shader.
- Execute compute shader and altering VkBuffer.
- Download the VkBuffer to CPU ram.
- Validate that it worked.
- Use device only vertex buffer as SSBO
- Use device only index buffer as SSBO
- Use device only image buffers

GHOST API has been changed as the original design was created before
we even had support for compute shaders in blender. The function
`GHOST_getVulkanBackbuffer` has been separated to retrieve the command
buffer without a backbuffer (`GHOST_getVulkanCommandBuffer`). In order
to do correct command buffer processing we needed access to the queue
owned by GHOST. This is returned as part of the `GHOST_getVulkanHandles`
function.

Open topics (not considered part of this patch)
- Memory barriers & command buffer encoding
- Indirect compute dispatching
- Rest of the test cases
- Data conversions when requested data format is different than on device.
- GPUVulkanTest.gpu_shader_compute_1d is supported on AMD devices.
  NVIDIA doesn't seem to support 1d textures.

Pull-request: #104518
2023-02-21 15:04:52 +01:00