Commit Graph

115 Commits

Author SHA1 Message Date
Petar Popovic
46ec859bd1 Fix two use-after-free warnings
(cherry picked from commit f27dbb22f0)
2025-07-29 12:29:34 -07:00
Acclution
b8dc9767da GPU: Fix Vulkan compute uniform descriptor not being marked as set (#13389)
(cherry picked from commit 8bd29f7ca3)
2025-07-18 15:30:05 -07:00
Evan Hemsley
ef58dd77ca GPU: Clean up properties in SDL_ReleaseGPUTexture (#13378) 2025-07-17 00:23:52 -07:00
WillyJL
2bff72b4f6 SDL3 GPU: Fix -Wbool-conversion warnings
(cherry picked from commit 4eff36ef53)
2025-06-29 13:33:56 -04:00
Evan Hemsley
25816bea41 GPU: Binding validation and prevent null dereference if expected binding is missing (#13164) 2025-06-02 13:40:40 -07:00
Logan
9571b0ece8 GPU: Update to set supported shader formats inside CreateDevice
(cherry picked from commit 8289656a4e)
2025-05-18 18:33:07 -07:00
Sam Lantinga
ed22220bc6 Fixed crash if out of memory in the Vulkan GPU driver
(cherry picked from commit cd95152b2c)
2025-05-13 09:08:19 -07:00
Dominic Bolin
c18aa99358 GPU Vulkan: set correct destination usage mode for storage buffer read/write bindings (#13009) 2025-05-11 16:12:37 -07:00
dbolin
3b1e3d5176 GPU Vulkan: fix for Swapchain Semaphore Reuse
(cherry picked from commit 6344712b04)
2025-05-10 07:56:07 -07:00
Evan Hemsley
efd812c399 GPU Vulkan: Add locks for layout object lookups (#12924)
(cherry picked from commit e1a41c1c97)
2025-04-29 15:44:37 -07:00
Evan Hemsley
c4fba75a12 GPU Vulkan: Clean up in Submit in headless mode (#12744)
(cherry picked from commit 33f90f2e41)
2025-04-04 14:27:53 -07:00
Lucas Murray
5b052e6f8c GPU: Add missing error code to VkErrorMessages()
(cherry picked from commit 906c6c7516)
2025-04-04 07:39:44 -07:00
Sam Lantinga
a447863e4f 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.

(cherry picked from commit dcb97a5f49)
2025-04-04 07:39:16 -07:00
Lucas Murray
34db21cea8 GPU: Don't pass null properties to SDL_CopyProperties()
(cherry picked from commit 300013cea7)
2025-04-04 07:36:30 -07:00
Evan Hemsley
943226edc1 GPU Vulkan: Fix recursive Submit calls causing defrag to fail (#12718)
---------

Co-authored-by: Sam Lantinga <slouken@libsdl.org>
(cherry picked from commit b53e7b4478)
2025-04-03 15:01:43 -07:00
blukai
9109e05f3f 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.

(cherry picked from commit 512485869c)
2025-03-31 18:42:03 -07:00
Evan Hemsley
ac21e3ef3f GPU Vulkan: Fix render pass race (#12587)
(cherry picked from commit c696e93180)
2025-03-19 13:34:26 -07:00
Arnoldo Adonaí Barón Robles
ae05ab280d Fix Vulkan error check
(cherry picked from commit a551c2a6d7)
2025-03-17 22:11:21 -07:00
Evan Hemsley
daf468e141 GPU: Fix Vulkan backend never checking deallocations (#12567)
---------

Co-authored-by: Sam Lantinga <slouken@libsdl.org>
(cherry picked from commit 0bd70684b3)
2025-03-17 13:59:47 -07:00
Sam Lantinga
18d93d11e1 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.

(cherry picked from commit 2c7c3d4d7b)
2025-03-02 09:14:12 -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
Petar Popovic
b5297de56f Add 'const' to pointer parameters 2025-02-21 15:59:40 -08:00
Petar Popovic
c70f54e28b Remove redundant casts 2025-02-21 10:09:10 -08:00
Ryan C. Gordon
84a236c92e hashtable: Redesign the hashtable API.
This was intended to make the API public, so SDL_hashtable.h got an extreme
documentation makeover, but for now this remains a private header.

This makes several significant interface changes to SDL_HashTable, and
improves code that makes use of it in various ways.

- The ability to make "stackable" tables is removed. Apparently this still
  worked with the current implementation, but I could see a future
  implementation struggle mightily to support this. It'll be better for
  something external to build on top of the table if it needs it, inserting a
  linked list of stacked items as the hash values and managing them separately.
  There was only one place in SDL using this, unnecessarily, and that has also
  been cleaned up to not need it.
- You no longer specify "buckets" when creating a table, but rather an
  estimated number of items the table is meant to hold. The bucket count was
  crucial to our classic hashtable implementation, but meant less once we
  moved to an Open Addressing implementation anyhow, since the bucket count
  isn't static (and they aren't really "buckets" anymore either). Now you
  can just report how many items you think the hash will hold and SDL will
  allocate a reasonable default for you...or 0 to not guess, and SDL will
  start small and grow as necessary, which is often the correct thing to do.
- There's no more SDL_IterateHashTableKey because there's no more "stackable"
  hash tables.
- SDL_IterateHashTable() now uses a callback, which matches other parts of SDL,
  and also lets us hold the read-lock for the entire iteration and get rid of
  the goofy iterator state variable.
- SDL_InsertIntoHashTable() now lets you specify whether to replace existing
  keys or fail if the key already exists.
- Callbacks now use SDL conventions (userdata as the first param).
- Other naming convention fixes.

I discovered we use a lot of hash tables in SDL3 internally. :) So the bulk
of this work is fixing up that code to use the new interfaces, and simplifying
things (like checking for an item to remove it if it already exists before
inserting a replacement...just do the insert atomically, it'll do all that
for you!).
2025-02-15 18:52:56 -05:00
Evan Hemsley
86691d325b GPU: Remove stencil bit from sampler aspect mask on Vulkan (#12196) 2025-02-05 17:52:35 -08:00
Evan Hemsley
70a239210e GPU: Describe "readonly storage" images as sampled images on Vulkan backend (#12149) 2025-01-31 15:07:33 -08:00
Evan Hemsley
8e766c9252 GPU: Resource binding state shadowing (#12138)
---------

Co-authored-by: Caleb Cornett <caleb.cornett@outlook.com>
2025-01-31 08:34:10 -08:00
Ozkan Sezer
e4fcc7b6e7 gpu/vulkan/SDL_gpu_vulkan.c: fix type redefinition error
src/gpu/vulkan/SDL_gpu_vulkan.c:763: error: redefinition of typedef 'VulkanUniformBuffer'
src/gpu/vulkan/SDL_gpu_vulkan.c:482: note: previous declaration of 'VulkanUniformBuffer' was here
2025-01-31 02:50:00 +03:00
Katelyn Gadd
c0a9d220b9 vulkan: Fixes for swapchain resize crash on X11.
Fixes #11075.
2025-01-20 23:17:38 -05:00
Ryan C. Gordon
6d5815db52 vulkan: Deal with VK_ERROR_OUT_OF_DATE_KHR returns from vkAcquireNextImageKHR.
Fixes #11075.
2025-01-20 22:32:23 -05:00
Katelyn Gadd
6b7dad7d82 vulkan: move temporary pointer to its own field to prevent a bad dereference.
Reference Issue #11075.
2025-01-20 22:32:23 -05:00
cosmonaut
355f69ebfe GPU: Ensure thread safety of Vulkan resource creation 2025-01-15 13:45:43 -08:00
Evan Hemsley
fb6df93384 GPU: Add name properties to resources (#11946) 2025-01-13 17:29:08 -08:00
Ethan Lee
90aff306c1 gpu: Show a debug error when pipelines are not given the right shader stages 2025-01-09 20:17:21 -05:00
Katelyn Gadd
a58bc3eaf4 [GPU] Fix crash in nvidia user-mode win32 driver when game window is minimized during swapchain resize (#11848) 2025-01-04 10:25:08 -08:00
Sam Lantinga
f2074d7af3 Updated copyright for 2025 2025-01-01 07:45:52 -08:00
Lucas Murray
b2c2a483e8 GPU: Rename HDR10_ST2048 to HDR10_ST2084 2024-12-26 09:47:13 -08:00
Sam Lantinga
61511c48a4 SDL_HashTable is now optionally thread-safe
Fixes https://github.com/libsdl-org/SDL/issues/11635
2024-12-12 14:39:53 -08:00
Evan Hemsley
3ee39f6c3f GPU: Revise swapchain acquisition (#11633)
---------

Co-authored-by: Lucas Murray <22484+lmurray@users.noreply.github.com>
2024-12-11 11:16:35 -08:00
Anonymous Maarten
e4215a04d9 gpu: make macro's function-like using do-while-0 2024-12-09 00:01:16 +01:00
Anonymous Maarten
fb71b44231 gpu: define EXPAND_ARRAY_IF_NEEDED macro once and make it function-like 2024-12-09 00:01:16 +01:00
Anonymous Maarten
0370b92d80 gpu: SDL_ClaimWindowForGPUDevice must set an error message on failure 2024-12-09 00:01:16 +01:00
cosmonaut
5c020b9930 GPU: Enable VK_ERROR_NATIVE_WINDOW_IN_USE_KHR to print 2024-12-08 11:20:06 -08:00
cosmonaut
279836d259 GPU: Swapchain image count respects number of allowed frames in flight 2024-12-08 09:07:50 -08:00
Evan Hemsley
fa5f84fb6e GPU: Add SetGPUAllowedFramesInFlight (#11599) 2024-12-06 11:56:20 -08:00