Commit Graph

291 Commits

Author SHA1 Message Date
Jakub Wasilewski
f5ea8805e1 Change how WinPixEventRuntime.dll is used under D3D12/Windows. (#14600)
* GPU: D3D12: Missing WinPixEventRuntime.dll now logs warning at device creation time.
* GPU: D3D12: Debug label functions are now a no-op when WinPixEventRuntime.dll is missing.
* Docs: GPU: Debug function documentation now notes WinPixEventRuntime.dll is required under D3D12.
2025-12-05 09:40:57 -08:00
cosmonaut
aae2f74ae6 GPU: Remove erroneous buffer usage flag from defrag process 2025-12-03 15:03:25 -08:00
Jakub Wasilewski
0c5ad99ec1 GPU: D3D12: Use WinPixEventRuntime.dll for debug events when available.
This prevents validation errors on D3D12 caused by the previous solution
that utilized internal D3D12 functions. This is still the fallback
solution if WinPixEventRuntime.dll is not present in PATH, but a warning
is printed to let you know how to fix these errors.
2025-12-03 12:00:17 -08:00
Evan Hemsley
2b1904a849 GPU: Prefer D3D12 over Vulkan when available 2025-12-01 17:50:23 -05:00
Antti Ala-Fossi
29f3844b01 Fix assert in SDL_BeginGPURenderPass 2025-11-25 10:46:53 -08:00
Sam Lantinga
1fc093491a vulkan gpu: set the sample count for depth prepass
Fixes https://github.com/libsdl-org/SDL/issues/14500
2025-11-22 07:53:16 -08:00
Ethan Lee
9dbde4542c gpu: Windows 11 guarantees a D3D12 minimum, skip checks accordingly 2025-11-12 16:22:35 -05:00
Ethan Lee
04a62cba1f gpu: Set up D3D12 device checks to avoid unnecessary queries 2025-11-12 11:19:07 -05:00
Ethan Lee
b2585ac236 gpu: Vulkan feature/extension lists do not need to be stored in the renderer 2025-11-11 21:24:45 -05:00
Ethan Lee
536507101d gpu: De-duplicate property enumeration for Vulkan features 2025-11-11 20:58:14 -05:00
TheSniperFan
ac0f77b7e6 Allow SDL GPU to opt into additional Vulkan features (#14204) 2025-11-11 15:53:06 -08:00
Maia
5ec6147acb Add missing type suffix to SDL_PROP_GPU_DEVICE_CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION prop 2025-11-11 10:37:27 -05:00
Ethan Lee
b5624e14ff gpu: Add SDL_PROP_GPU_DEVICE_CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION property 2025-11-10 20:20:05 -05:00
Ethan Lee
0b2073d143 gpu: Remove dead code in the Vulkan device ranking system.
This block was a sloppy way of trying to avoid prioritizing lavapipe over another device, but truthfully the only way to guarantee avoiding CPU drivers is to add a property to allow apps to require hardware acceleration.
2025-11-10 18:16:54 -05:00
Ethan Lee
1b79ba9ab6 gpu: Separate device suitability from device rank when enumerating Vulkan devices.
This makes it a bit clearer what the "minimum" is vs. the "best", which should be two separate queries.
2025-11-10 18:16:54 -05:00
Ethan Lee
6976b57988 gpu: Move device ranking to the bottom of IsDeviceSuitable.
This prevents devices without presentation/graphics support from getting ranked.
2025-11-10 18:16:54 -05:00
Ethan Lee
799c6aa629 gpu: Move device ranking to a standalone function.
This allows us to treat Dozen as an "other" driver, rather than blacklisting it outright.
2025-11-10 18:16:54 -05:00
Ethan Lee
0cc2b026e7 gpu: Check for MSFT_layered_driver, skip layered drivers during enumeration 2025-11-10 18:16:54 -05:00
Chris Genova
6a01d6e7d3 D3D12 GPU: Prevent reading out of bounds when uploading textures.
When the upload needs realignment, a new buffer is created to do the
upload, and the source data is copied to the new buffer. This commit
fixes the issue where the memcopy can read off the end of the source
buffer since it is reading based on destination pitch instead of source
pitch.
2025-11-07 17:47:51 -08:00
Sam Lantinga
4db63e323e Save a copy of the D3D12 semantic string
Fixes https://github.com/libsdl-org/SDL/issues/14383
2025-11-02 16:16:20 -08:00
Katelyn Gadd
9479ac039c If VULKAN_Submit fails during VULKAN_INTERNAL_CreateTexture, destroy the texture and return NULL 2025-10-20 16:24:20 -07:00
Eddy Jansson
aaee09d6ed Don't do NULL-checks before SDL_free()
Replaces the pattern

  if (ptr) {
    SDL_free(ptr);
  }

with

  SDL_free(ptr);
2025-10-20 00:13:09 -07:00
TheSniperFan
cbcb145eb4 Fix debug mode being set too late
-Early error messages were always being skipped
2025-10-18 08:04:11 -07:00
Ethan Lee
2135ecdfcc gpu: Vulkan on private platforms cannot make use of oldSwapchain, destroy the full swapchain on resize 2025-10-16 15:18:07 -04:00
Evan Hemsley
20206b8e66 GPU: Correctly recycle D3D12 descriptor heaps (#14234) 2025-10-13 13:00:00 -07:00
cosmonaut
b067dfa345 GPU: Validate that buffer size is at least 4 bytes 2025-10-13 11:04:59 -07:00
Edu Garcia
c74b406a4c Fix SDL GPU D3D12 Descriptor Heap leak
When descriptor leaks overflow, the D3D12 SDL GPU renderer fetches more from the pool, but never returns them, which eventually causes an "out of memory" crash.
2025-10-09 08:45:18 -07:00
Sam Lantinga
2a92a3c9c5 Recreate the Vulkan GPU swap chain when resuming on Android
Fixes https://github.com/libsdl-org/SDL/issues/12957
2025-10-08 21:06:17 -07:00
Sam Lantinga
00ffddece8 Ignore VK_SUBOPTIMAL_KHR on the Android platform
This is returned whenever the device has been rotated, and can be safely ignored.

Fixes https://github.com/libsdl-org/SDL/issues/12950
2025-10-08 20:02:31 -07:00
Sam Lantinga
a2a60f75c7 Temporarily disabled texture binding validation
There are some advanced use cases that trip over this, so temporarily disabling the validation pending further review.

Reference: https://github.com/libsdl-org/SDL/issues/13871
2025-10-08 19:50:48 -07:00
HTuanPhong
2638537f92 Fix vulkan gpu resize lag on windows 2025-10-04 15:22:28 -07:00
Mathieu Eyraud
86da08b0be Zero-initialize SDL_GPUDevice 2025-10-01 07:22:17 -07:00
Sam Lantinga
8a5f9a3837 Removed validate_feature_indirect_draw_first_instance_disabled (thanks @rabbit-ecl!)
It was incorrectly checking the direct draw functions instead of checking indirect draw buffers.
2025-09-30 11:36:29 -07:00
Sam Lantinga
15f1cb4c98 Added GPU API support on visionOS
You must set SDL_PROP_GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN to false on this platform, since setDepthClipMode is not supported on Apple headsets (as of visionOS 2.3) and clipping is the default.
2025-09-29 13:28:00 -07:00
Sam Lantinga
2809ce9389 Set enable_depth_clip to true by default if SDL_PROP_GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN is false 2025-09-29 13:28:00 -07:00
Sam Lantinga
f61e271e11 Generalize and validate optional GPU feature properties
Fixes https://github.com/libsdl-org/SDL/issues/13139
Fixes https://github.com/libsdl-org/SDL/issues/13138
2025-09-29 12:42:47 -07:00
Sam Lantinga
595f7b7ed9 Revert "Fixed Vulkan validation error"
This reverts commit b82b1f416f.

The renderer should not be enabling depth clamping.
2025-09-29 06:08:27 -07:00
Sam Lantinga
b82b1f416f Fixed Vulkan validation error
VUID-VkPipelineRasterizationStateCreateInfo-depthClampEnable-00782(ERROR / SPEC): msgNum: -316906200 - Validation Error: [ VUID-VkPipelineRasterizationStateCreateInfo-depthClampEnable-00782 ] | MessageID = 0xed1c6528 | vkCreateGraphicsPipelines(): pCreateInfos[0].pRasterizationState->depthClampEnable is VK_TRUE, but the depthClamp feature was not enabled. The Vulkan spec states: If the depthClamp feature is not enabled, depthClampEnable must be VK_FALSE (https://vulkan.lunarg.com/doc/view/1.3.268.0/windows/1.3-extensions/vkspec.html#VUID-VkPipelineRasterizationStateCreateInfo-depthClampEnable-00782)
2025-09-28 22:10:06 -07:00
Victor Ilyushchenko
a34d31322c Fix Metal 3D texture upload stride calculation
Signed-off-by: Victor Ilyushchenko <alt13ri@gmail.com>
2025-09-28 07:32:17 -07:00
Sam Lantinga
25b2d2c821 Use new parameter validation macro 2025-09-18 20:58:32 -07:00
ManifoldFR
8bc4e029bd gpu/vulkan : fix clear value indexing 2025-09-16 08:45:35 -07:00
cosmonaut
9603360b7e GPU: Allow rendering into depth texture layers and levels 2025-09-13 07:11:43 -07:00
Evan Hemsley
fe314a1b8a GPU: Bump MAX_COLOR_TARGET_BINDINGS to 8 (#13937) 2025-09-12 13:04:18 -07:00
Sam Lantinga
035eed351c Added SDL_GetPixelFormatFromGPUTextureFormat() and SDL_GetGPUTextureFormatFromPixelFormat()
Fixes https://github.com/libsdl-org/SDL/issues/13899
2025-09-10 12:08:04 -07:00
nightmareci
2f5bc17ea6 Fix support for Windows XP and up (#13904) 2025-09-08 13:00:26 -07:00
Ethan Lee
cbe4970946 gpu: Add D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN property 2025-09-08 11:19:20 -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