Commit Graph

219 Commits

Author SHA1 Message Date
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
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 86b206dadf
GPU: Special case to avoid assert on GenerateMipmaps (#12995) 2025-05-09 21:45:54 -07:00
Evan Hemsley a163257295
GPU: Validate that textures are not bound for both read and write on render passes (#12925) 2025-04-29 16:52:52 -07:00
Evan Hemsley e1a41c1c97
GPU Vulkan: Add locks for layout object lookups (#12924) 2025-04-29 15:43:28 -07:00
Ryan C. Gordon 5f03cb3882
d3d12: Patched to compile with GDK builds.
Fixes #12899.
2025-04-25 20:07:35 -04:00
Ryan C. Gordon faa2e40406 gpu: Warn about Direct3D 12 texture alignment requirements.
Fixes #12835.
2025-04-25 15:09:13 -04:00
Eri the Switch 3343cb2147 gpu: rework alpha-to-coverage validation 2025-04-23 19:28:11 -07:00
Logan Benjamin c81b62293a
GPU D3D12 - Update to use typeless formats for depth buffer (#12701)
For a depth buffer in D3D12 that is also going to be used in a texture sampler, the creation (on an Intel HD 5500 igpu) fails. e.g. SDL_GPUTextureCreateInfo type = TEXTURE_2D, format = D32_FLOAT, usage = DEPTH_STENCIL_TARGET | SAMPLER

The error messages are:

D32_FLOAT
D3D12 ERROR: ID3D12Device::CreateShaderResourceView: The Format (0x29, R32_FLOAT) is invalid when creating a View; the
Resource was already created with a fully qualified Format, which is not castable (0x28, D32_FLOAT).

D24_UNORM
D3D12 ERROR: ID3D12Device::CreateShaderResourceView: For the resource format D24_UNORM_S8_UINT, when making a D3D view, the format name for the view can't be R24_UNORM_X8_TYPELESS.

I found this is because the texture format needs to be created as _TYPELESS, then the views (depth stencil view, shader resource view) should then be created as their respective types - e.g. texture = R32_TYPELESS, dsv = D32_FLOAT, srv = R32_FLOAT

Tested and working on:
NVidia RTX 3050 (D3D12 feature set 12_2)
Intel HD 5500 (D3D12 feature set 11_1)
2025-04-23 16:30:16 -07:00
Lucas Murray d04b28926c GPU: Make D3D12 debug layers optional 2025-04-23 15:57:48 -07:00
Lucas Murray 6e4ace310c GPU: Validate shader bytecode 2025-04-22 13:07:37 -07:00
Sam Lantinga 18fbe6a92f Renamed SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_UINT8 to SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_NUMBER
Typically we will name the property with the function that is used to set it, and document the range of values.
2025-04-22 10:28:20 -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 205c34c62a GPU: The D3D12 blit shaders are DXIL 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
Sam Lantinga 2fbb583290 SDL_ClaimWindowForGPUDevice() should fail for transparent windows
The GPU API doesn't currently support transparent windows (transparent swapchain effects doesn't seem possible on D3D12) so we should explicitly fail so users don't expect transparency and then not get it.

Fixes https://github.com/libsdl-org/SDL/issues/12410
2025-03-21 12:14:20 -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
Caleb Cornett 6d0fb0a2e6 gpu: Fix MTLLibrary dispatch data destructor 2025-03-17 18:53:40 -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
Caleb Cornett 9fcca83512 gpu: Validate that CopyGPUTextureToTexture formats match 2025-03-09 17:29:47 -04:00
Caleb Cornett 113eb6f01d gpu: Add BC2_RGBA_UNORM_SRGB to GetBlockWidth/Height functions 2025-03-03 01:35:16 -05: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
Caleb Cornett b0d2a4f355 gpu: Fix Z offset for D3D12 realigned 3D texture uploads 2025-03-02 00:04:57 -05:00
guitarfreak c682599448 GPU_d3d12: Switched the default swapchain scaling mode to none.
Since there is no option to change it this seems like a much better default value. The stretching behaviour is really off-putting.

The new behavior shows a small black border when resizing the windows. This makes it more in line with the other backends and it's what you would expect to happen as a user.
2025-02-28 11:33:51 -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
jsoulier 9464aaa8af Change D3D12 GPU backend to respect has_depth_stencil_target 2025-02-26 10:16:50 -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