Commit Graph

139 Commits

Author SHA1 Message Date
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
Caleb Cornett
45869d6177 GPU: Vulkan requires drawIndirectFirstInstance feature (#11583) 2024-12-04 15:05:35 -05:00
Andrei Alexeyev
332fd824f0 GPU Vulkan: release submitted command buffer after defrag (#11430) 2024-11-08 09:40:26 -08:00
Maia
5699ba799e Add return to CHECK_VULKAN_ERROR_AND_RETURN macro 2024-10-30 11:52:42 -07:00
Evan Hemsley
b4dff42dcd GPU: Add SDL_CancelGPUCommandBuffer (#11316)
---------

Co-authored-by: Caleb Cornett <caleb.cornett@outlook.com>
2024-10-29 14:43:22 -07:00
Evan Hemsley
423337796c GPU Vulkan: Use dedicated allocation for download buffers (#11298) 2024-10-23 09:37:06 -07:00
cosmonaut
57f2577c65 GPU Vulkan: Fix depth-only framebuffer leak 2024-10-14 10:19:07 -07:00
Evan Hemsley
82598e5ca9 GPU Vulkan: Fix frame counter timing (#11189) 2024-10-12 22:02:22 -07:00
Caleb Cornett
3db10a6b2c GPU: ASTC block size fixes (#11157) 2024-10-10 15:40:21 -07:00
David Gow
9c322386bf gpu: vulkan: Fix an uninitialised structure in SDL_BlitGPUTexture()
The SDL_GPUColorTargetInfo structure needs to be zeroed, as otherwise we
can end up trying to create a resolve_texture which doesn't exist,
causing a rather difficult-to-debug segfault when calling
SDL_BlitGPUTexture() with a load op of SDL_GPU_LOADOP_CLEAR.
2024-10-10 07:16:02 -07:00
Evan Hemsley
da5a1585cd GPU: Avoid calling SDL_GetWindowSizeInPixels when possible (#11139) 2024-10-09 18:59:07 -07:00
Delta
8e6ead2f7b [GPU] Added ASTC texture format support (#11116) 2024-10-08 18:45:04 -04:00
rabbit-ecl
6ae5666acf Check for VK_SUBOPTIMAL_KHR also in vkQueuePresentKHR (#11113)
This is already handled for vkAcquireNextImageKHR.
2024-10-07 13:01:10 -07:00
Ryan C. Gordon
3a6a3ab64f gpu: Fix memory leak in Vulkan backend. 2024-10-04 04:46:28 -04:00
Sam Lantinga
3234a3b902 Simplified internal SDL_Surface structure 2024-10-01 08:10:04 -07:00
cosmonaut
fa14b53273 GPU Vulkan: Clear up some swapchain edge cases 2024-09-30 15:10:27 -07:00
Evan Hemsley
afdf325fb4 GPU: Add swapchain dimension out params (#11003) 2024-09-30 10:23:19 -07:00
Evan Hemsley
fc242abbd2 GPU: recreate swapchain on window pixel size change event (#10985) 2024-09-28 18:09:56 -07:00
Ethan Lee
0852307b58 gpu: Check Vulkan device features for IsDeviceSuitable 2024-09-27 19:58:30 -04:00
cosmonaut
fb165a542b GPU Vulkan: add resolve info to framebuffer and render pass lookups 2024-09-27 15:57:57 -07:00
cosmonaut
eedd2039f9 GPU: 32-bit component texture formats 2024-09-27 16:26:43 -04:00
Evan Hemsley
05d0656bd6 GPU: Simultaneous compute pass read-write (#10965) 2024-09-27 12:49:37 -07:00
Sam Lantinga
d39acc6d1e Fixed warning C4702: unreachable code 2024-09-27 11:19:54 -07:00
Caleb Cornett
5ff6e8d522 GPU: Add enable_depth_clip to RasterizerState (#10964) 2024-09-27 11:18:54 -05:00
Evan Hemsley
be401dd1e3 GPU: More robust error reporting (#10958)
---------

Co-authored-by: Ethan Lee <flibitijibibo@gmail.com>
Co-authored-by: Caleb Cornett <caleb.cornett@outlook.com>
2024-09-27 00:30:18 -07:00
cosmonaut
925e47a077 GPU: Fix backwards LogError and SetError calls 2024-09-25 12:47:40 -07:00
cosmonaut
557c6dfb18 GPU: call SDL_SetError where appropriate 2024-09-25 10:47:14 -07:00