Commit Graph

259 Commits

Author SHA1 Message Date
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
Ethan Lee
0fcaf47658 gpu: D3D12 only requires feature level 11_0 with Resource Binding Tier 2.
We previously thought this wasn't possible because constant buffer offsets and
partial updates were unavailable, but we were reading the wrong table - this is
only the case for D3D11...

https://learn.microsoft.com/en-us/windows/win32/direct3d11/overviews-direct3d-11-devices-downlevel-intro

... while 12 doesn't list this feature at all:

https://learn.microsoft.com/en-us/windows/win32/direct3d12/hardware-feature-levels

We double checked and Jesse Natalie confirmed that this feature is required for
D3D12 even for 11_0 drivers. (Thanks Jesse!)

Additionally, D3D12 requires that UAVs are accessible from all shader stages,
meaning Tier 2 is enough to support the number of UAVs we need. Tier 1 could be
a property to lower the requirements, but that can be done later.
2025-08-22 15:46:05 -04: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
Evan Hemsley
07af4b237b GPU: Fix incorrect block size when D3D12 uniform buffer is rotated (#13469) 2025-07-29 15:34:08 -07:00
Petar Popovic
f27dbb22f0 Fix two use-after-free warnings 2025-07-29 12:29:19 -07:00
Petar Popovic
6a5af95364 SDL_gpu.c: Fixed deref-before-check warning 2025-07-26 12:08:23 -07:00
Ryan C. Gordon
07ef532681 hints: Renamed SDL_HINT_LOG_BACKENDS to SDL_DEBUG_LOGGING.
This still logs backend choices, but we might use it for other things. For
example, what Android device is being used, or all the devices we enumerated,
etc.

Ideally this eventually logs all the stuff we often have to ask followup
questions about.
2025-07-22 13:19:30 -04: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
Ryan C. Gordon
10004ab0ea hints: Added SDL_HINT_LOG_BACKENDS.
Fixes #13354.
2025-07-14 19:49:38 -04:00
Ryan C. Gordon
190afc0f4f gpu: Fixed uninitialized variable in SDL_AcquireGPUCommandBuffer().
Fixes #13191.
2025-07-11 18:18:47 -04:00
Piotr Usewicz
e9535fa026 Update SDL_GpuDevice to SDL_GPUDevice 2025-06-30 10:10:39 -04: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
db972604a8 gpu: Xbox buildfix 2025-05-27 12:41:27 -04:00
Anthony Fisher
c08b1049d3 gpu/d3d12: Acknowledge that we've bound vertex buffers (#13088) 2025-05-20 16:34:04 -04:00
Logan
f4942b3eae GPU: Update D3D12 to create multisample textures with default MSAA alignment 2025-05-20 11:07:24 -07:00
cosmonaut
2dad6534b8 GPU: Add missing compute-writeable texture formats 2025-05-19 18:08:35 -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
Evan Hemsley
b08d79b832 GPU: Check that a texture format is valid for compute writes (#13044) 2025-05-14 16:24:05 -07:00
Evan Hemsley
604c192154 GPU: Always return NULL if beginning a pass fails an assert check 2025-05-14 15:23:23 -07:00
cosmonaut
252129f433 GPU: Debug mode layer and level index checks
Resolves #13033
2025-05-14 12:22:18 -07:00
Manuel
f85f83ec7c SDL GPU: Implemented opt out Vulkan device features (#13016) 2025-05-13 17:28:28 -07:00