Commit Graph

112 Commits

Author SHA1 Message Date
Ethan Lee
cbe4970946 gpu: Add D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN property 2025-09-08 11:19:20 -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
Evan Hemsley
07af4b237b GPU: Fix incorrect block size when D3D12 uniform buffer is rotated (#13469) 2025-07-29 15:34:08 -07:00
Evan Hemsley
bc5c9a686c GPU: Clean up properties in SDL_ReleaseGPUTexture (#13378) 2025-07-17 00:21:34 -07: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
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
Manuel
f85f83ec7c SDL GPU: Implemented opt out Vulkan device features (#13016) 2025-05-13 17:28: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
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
Caleb Cornett
44710a248c gpu: alpha-to-coverage support 2025-04-04 11:39:08 -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
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
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
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
jsoulier
9464aaa8af Change D3D12 GPU backend to respect has_depth_stencil_target 2025-02-26 10:16:50 -08:00
Caleb Cornett
ea77472d75 Document/ignore GPU features without universal support 2025-02-23 12:19:12 -08:00
Edu Garcia
9b18e8438f [GPU] D3D12 backend debug markers were being cut
Code used wcslen that return number of characters, but D3D12 debug layer uses bytes + wide chars
2025-02-11 07:21:44 -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
Ethan Lee
326ce9bb8d gpu: D3D12 buildfix for Xbox 2025-01-16 12:19:59 -05:00
cosmonaut
d590e1f122 GPU: Align D3D12 clear properties to naming convention 2025-01-13 17:38:21 -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
67ea67f191 Fix mip generation for 2x1 textures on D3D12 2025-01-02 13:17:06 -05: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
Caleb Cornett
c080bb8417 GPU: Fix non-triangle D3D12 primitive topology types 2024-12-21 22:38:40 -05:00
Ethan Lee
7e8576fd19 gpu: Xbox fixes for swapchain presentation 2024-12-20 14:56:33 -05:00
Ethan Lee
5d9ccb6296 gpu: Add explicit casts to D3D12 staging descriptor changes 2024-12-20 00:56:48 -05:00
Evan Hemsley
0fbcd0d586 GPU: Optimize usage of D3D12 staging descriptors (#11657) 2024-12-17 22:22:22 -08:00
Sam Lantinga
1944bc7407 Fixed warning C4702: unreachable code 2024-12-12 15:43:42 -08:00
cosmonaut
c5acbef3bf GPU: Fix D3D12_INTERNAL_StrToWStr returning incorrect length 2024-12-11 16:38:28 -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
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