Commit Graph

139 Commits

Author SHA1 Message Date
cosmonaut
9603360b7e GPU: Allow rendering into depth texture layers and levels 2025-09-13 07:11:43 -07:00
Luis Caceres
03d0c2ad74 gpu/vulkan: Move dereference after null check 2025-09-08 12:19:53 -04:00
Ethan Lee
689049f8ec gpu: VK_KHR_get_physical_device_properties2 can be optional 2025-09-02 09:53:01 -07:00
Jordan Saunders
265236d952 Fix two uninitialized variables
Found when running in valgrind looking at another issue.

- RenderPass' depth_stencil_target
    Tripped in SDL_BindGPUFragmentSamplers when not binding a DS target

- VulkanCommandBuffer's swapchainRequested
    Tripped in VULKAN_Submit for the end transition barrier when
    creating an image. The field is only reset when reused, not on first
    use
2025-08-30 06:05:22 -07:00
Jaan Soulier
0bbdd86b86 Fix device suitability checks in Vulkan GPU backend to always adhere to priority arrays 2025-08-27 05:15:24 -07:00
Wilson Jallet
03b14f5211 GPU: Fix Vulkan indexing error for resolve attachment refs (#13768) 2025-08-19 12:10:55 -07:00
suleyth
bad7075de8 Only add VRAM to deviceRank if asking for a high performance device, and if the device already meets all the requirements. 2025-08-17 23:17:37 -04:00
suleyth
618f85fafe Make deviceRank an Uint64 to avoid potential overflow issues in case of future GPUs with huge VRAM 2025-08-17 23:17:37 -04:00
suleyth
c5b79e5f1b Pick dedicated GPU with highest VRAM 2025-08-17 23:17:37 -04:00
Beyley Cardellio
e699f3dca1 GPU: Hold submit lock before waiting for device idle 2025-08-10 07:21:55 -07:00
cosmonaut
fe6b2161bf GPU: Fix uninitialized value in Vulkan command buffer structure 2025-08-07 13:42:03 -07:00
Frank Praznik
42463569d5 GPU: Vulkan backend flags command buffer for cleanup when swapchain is requested
When skipping presentation due to the window being hidden, presentDataCount is not incremented on the command buffer, and subsequently the submitted command buffers will not be cleaned up as long as the window is hidden. This results in a lag spike when showing the window due to all previously submitted command buffers suddenly being cleaned up at once, and lag at shutdown due to an equivalent number of fences needing to be destroyed.

Instead of relying on presentDataCount to determine whether a command buffer should be cleaned up, use a flag, which is set under the appropriate circumstances.
2025-08-02 09:24:02 -07:00
cosmonaut
c5edf4bd5b GPU: Bail out of aquiring Vulkan swapchain if window is hidden 2025-07-31 16:02:58 -07:00
Cheney Wang
d8ac51859e GPU: Fix wrong Vulkan swapchain size when retrying acquire 2025-07-30 15:34:56 -07:00
Petar Popovic
f27dbb22f0 Fix two use-after-free warnings 2025-07-29 12:29:19 -07:00
Acclution
8bd29f7ca3 GPU: Fix Vulkan compute uniform descriptor not being marked as set (#13389) 2025-07-18 15:27:31 -07:00
Evan Hemsley
bc5c9a686c GPU: Clean up properties in SDL_ReleaseGPUTexture (#13378) 2025-07-17 00:21:34 -07:00
WillyJL
4eff36ef53 SDL3 GPU: Fix -Wbool-conversion warnings 2025-06-29 13:32:21 -04:00
Sam Lantinga
d7939abf42 Use consistent style for pointer declarations and casts 2025-06-18 10:03:44 -07:00
Evan Hemsley
fbba5b272a GPU: Binding validation and prevent null dereference if expected binding is missing (#13164) 2025-06-02 13:39:58 -07:00
Ethan Lee
510126ee63 gpu: Check shader format support in PrepareDriver 2025-05-19 08:20:33 -07:00
Logan
8289656a4e GPU: Update to set supported shader formats inside CreateDevice 2025-05-18 18:32:50 -07:00
Manuel
f85f83ec7c SDL GPU: Implemented opt out Vulkan device features (#13016) 2025-05-13 17:28:28 -07:00
Sam Lantinga
cd95152b2c Fixed crash if out of memory in the Vulkan GPU driver 2025-05-13 09:07:15 -07:00
Dominic Bolin
2ae3418260 GPU Vulkan: set correct destination usage mode for storage buffer read/write bindings (#13009) 2025-05-11 16:11:45 -07:00
dbolin
6344712b04 GPU Vulkan: fix for Swapchain Semaphore Reuse 2025-05-10 07:54:50 -07:00
Evan Hemsley
e1a41c1c97 GPU Vulkan: Add locks for layout object lookups (#12924) 2025-04-29 15:43:28 -07:00
Lucas Murray
6e4ace310c GPU: Validate shader bytecode 2025-04-22 13:07:37 -07:00
Evan Hemsley
33f90f2e41 GPU Vulkan: Clean up in Submit in headless mode (#12744) 2025-04-04 14:27:18 -07:00
Caleb Cornett
44710a248c gpu: alpha-to-coverage support 2025-04-04 11:39:08 -07:00
Lucas Murray
906c6c7516 GPU: Add missing error code to VkErrorMessages() 2025-04-04 07:34:52 -07:00
Lucas Murray
300013cea7 GPU: Don't pass null properties to SDL_CopyProperties() 2025-04-04 07:34:52 -07:00
Evan Hemsley
b53e7b4478 GPU Vulkan: Fix recursive Submit calls causing defrag to fail (#12718)
---------

Co-authored-by: Sam Lantinga <slouken@libsdl.org>
2025-04-03 15:00:22 -07:00
Sam Lantinga
39a3b14dfe Renamed SDL_GetGPUDeviceDebugProperties() to SDL_GetGPUDeviceProperties()
We may want to extend this with additional properties in the future.

Also removed SDL_PROP_GPU_DEVICE_DEBUG_VULKAN_CONFORMANCE_STRING. If we need feature level queries we can add them in the future.
2025-04-03 14:59:11 -07:00
Lucas Murray
f78aa4d8ea GPU: Expose debug information from devices
Co-authored-by: Nikita Kogut <glinka1202@gmail.com>
2025-04-03 08:52:51 -07:00
blukai
512485869c fix vulkan vertex buffer indexing
this was causing problems when i was specifying non-zero buffer slots in
`SDL_BindGPUVertexBuffers`, `SDL_GPUVertexAttribute` and
`SDL_GPUVertexBufferDescription`.

`firstSlot + 1` is simply copied over from metal and d3d12 backends.
2025-03-31 18:41:34 -07:00
Frank Praznik
bde49abdb7 GPU: Support swapchain buffer transparency in Vulkan
If the window is flagged with SDL_WINDOW_TRANSPARENT, create the associated swapchain with a composite alpha value that supports blending, if available.

Fixes transparent windows on the Vulkan backend, and prevents possible validation errors by ensuring that the composite alpha value is always a valid bit in VkSurfaceCapabilitiesKHR::supportedCompositeAlpha.
2025-03-21 11:53:32 -07:00
Eri the Switch
6f456da63f GPU: Request sampleRateShading feature on Vulkan 2025-03-20 09:31:34 -07:00
Evan Hemsley
c696e93180 GPU Vulkan: Fix render pass race (#12587) 2025-03-19 13:32:14 -07:00
Arnoldo Adonaí Barón Robles
a551c2a6d7 Fix Vulkan error check 2025-03-17 22:10:54 -07:00
Evan Hemsley
0bd70684b3 GPU: Fix Vulkan backend never checking deallocations (#12567)
---------

Co-authored-by: Sam Lantinga <slouken@libsdl.org>
2025-03-17 13:19:41 -07:00
Sam Lantinga
dcb97a5f49 Set a default shader entry point
The default should be the entrypoint generated by SDL_shadercross. That way it doesn't need to be hand-specified in the common workflow.
2025-03-14 11:38:13 -07:00
Caleb Cornett
0e29c6295c gpu: Clean up unused code in Vulkan and D3D12 drivers 2025-03-13 09:30:36 -04:00
Sam Lantinga
2c7c3d4d7b Only use VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR on Android
This fixes Nintendo Switch where the identity bit isn't available. We only needed this on Android to automatically handle device user orientation.
2025-03-02 09:12:48 -08:00
guitarfreak
ea513fd47c Fixed vulkan gpu backend android orientation behaviour to just work like on iOS.
I changed it so that the OS does the orientation change itself with a potential performance penalty.
This makes it automatically do the right thing, just like on iOS which would make the orientation change behaviour more consistent across different platforms.

But without adding an option to the user, this would disallow the user solving the problem in his in the app/shaders and saving some performance.

It's up to you to decide what to do. But I changed this in my local copy of the source for my use case.
But this also
2025-02-28 07:34:16 -08:00
cosmonaut
2f77558bad fix comment 2025-02-25 09:44:10 -08:00
cosmonaut
44f1ec35c4 GPU: Make Vulkan transfer buffers dedicated allocs 2025-02-25 09:44:10 -08:00
zopsicle
a7bc6c5e08 gpu: initialize VkDebugUtilsLabelEXT::color
Fixes #12383.
2025-02-24 11:51:13 -08:00
Caleb Cornett
0815637cf0 vulkan build fix 2025-02-23 12:19:12 -08:00
Caleb Cornett
ea77472d75 Document/ignore GPU features without universal support 2025-02-23 12:19:12 -08:00