Commit Graph

154 Commits

Author SHA1 Message Date
Ethan Lee
0160e9eac6 gpu: Add SDL_QueryGPUSupport 2024-09-13 13:42:07 -04:00
Ethan Lee
96e147b2b9 gpu: Rework driver name queries, add GetGPUShaderFormats 2024-09-13 12:29:40 -04:00
Caleb Cornett
94436a938d GPU: Remove unused and incorrect D16 format checks from Vulkan driver 2024-09-13 10:16:02 -05:00
Caleb Cornett
5771b502f8 GPU: Fix D3D11/D3D12 vertex strides for multiple vertex buffers (#10818) 2024-09-13 09:57:55 -05:00
Ethan Lee
371cfaf8fe gpu: Implement support for SDL_GPU_DISABLED 2024-09-13 10:32:12 -04:00
Caleb Cornett
a45a2caf49 GPU: Rename VertexBinding to VertexBufferDescription (#10811) 2024-09-12 18:02:39 -05:00
Ethan Lee
c36982d45c vulkan: Avoid redundant commands for dynamic states 2024-09-12 16:51:32 -04:00
Evan Hemsley
66489f91bb GPU: Cube Arrays (#10800)
---------

Co-authored-by: Caleb Cornett <caleb.cornett@outlook.com>
2024-09-12 13:41:46 -07:00
Ethan Lee
9ea0a837ae vulkan: Use a spinlock instead of a mutex for descriptor pools 2024-09-12 15:23:37 -04:00
Caleb Cornett
ddd5723e2e GPU: Remove pitch parameters from indirect draw calls (#10803) 2024-09-11 23:30:14 -07:00
Andrei Alexeyev
64f12bea4a GPU: Remove unnecessary texture format swizzles in Vulkan (#10693) 2024-09-11 09:01:06 -07:00
cosmonaut
3166f91282 GPU: Defer setting blend state on D3D11 2024-09-11 00:27:36 -07:00
Evan Hemsley
2b8a349b26 Add SDL_BindGPUComputeSamplers (#10778)
---------

Co-authored-by: Caleb Cornett <caleb.cornett@outlook.com>
2024-09-10 19:20:14 -07:00
Evan Hemsley
0b6f993dea GPU: Zero-init handling (#10786) 2024-09-10 18:17:08 -07:00
Andrei Alexeyev
1e9ff723ad GPU: fix SDL_GetGPUSwapchainTextureFormat error return value 2024-09-10 08:36:57 -07:00
cosmonaut
d3091b9538 Remove SDL_GPUDepthStencilValue struct 2024-09-09 10:55:05 -07:00
Evan Hemsley
668e2f82d2 Add load op and clear color to SDL_BlitGPUTexture (#10767) 2024-09-09 10:19:52 -07:00
Evan Hemsley
68a9991ec9 GPU: Document structs (#10742) 2024-09-07 08:29:14 -07:00
Daniel Ludwig
1849205733 Fix GDK builds after renames done in #10730 2024-09-07 11:50:40 +03:00
Daniel Ludwig
0a44ea1b0b Amend use of non-standard compiler syntax 2024-09-07 11:50:40 +03:00
Caleb Cornett
9730f62e8c GPU: Rename struct members and parameters for SDL3 naming conventions (#10730)
---------

Co-authored-by: Evan Hemsley <2342303+thatcosmonaut@users.noreply.github.com>
2024-09-06 16:38:23 -07:00
Ryan C. Gordon
154452a726 winrt: Removed WinRT/Windows Phone/UWP support.
Fixes #10724.
2024-09-06 13:28:39 -04:00
Sam Lantinga
8edb901724 Fixed crashes in Metal renderer due to ARC releasing references on random memory in newly allocated structs 2024-09-05 19:48:33 -07:00
Caleb Cornett
2d4eb29c37 Add SDL_SetGPUBlendConstants, SDL_SetGPUStencilReference (#10704) 2024-09-05 17:41:23 -05:00
Ozkan Sezer
f494658f9c SDL_gpu.c: remove BOM. 2024-09-05 22:39:02 +03:00
Ozkan Sezer
cb2919ac55 [GPU] MinGW build fixes:
- CreateEventEx() is guarded by _WIN32_WINNT >= 0x0600:
  In SDL_gpu_d3d12.c, include core/windows/SDL_windows.h
  that defines _WIN32_WINNT properly to account for that
- DXGIInfoQueue stuff is not available in all toolchains
  such as mingw-w64 version 8.0.3
- SDL_gpu_d3d11.c: _WIN32 is always defined by MinGW, as
  is the case for all windows-targeting compilers, so it
  doesn't guarantee absence of DXGIInfoQueue stuff:
  rely on __IDXGIInfoQueue_INTERFACE_DEFINED__, as it is
  done elsewhere.

Fixes: https://github.com/libsdl-org/SDL/issues/10705 .
2024-09-05 22:39:02 +03:00
Sam Lantinga
387774ab8a Build config flags are either defined or undefined, never 0
This is for consistency with CMake build configuration

Also added SDL_VIDEO_RENDER_GPU to the non-CMake build configurations
2024-09-05 09:52:40 -07:00
David Gow
e3fd581aca GPU: vulkan: Respect swapchain minImageCount
The default value of MAX_FRAMES_IN_FLIGHT (3) may be less than the
minImageCount returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR() on
some setups. For example, the Intel IVB Vulkan driver on Wayland returns
a minImageCount of 4, resulting in the following validation warning:

VUID-VkSwapchainCreateInfoKHR-presentMode-02839(ERROR / SPEC): msgNum: -76493605 - Validation Error: [ VUID-VkSwapchainCreateInfoKHR-presentMode-02839 ] | MessageID = 0xfb70ccdb | vkCreateSwapchainKHR(): pCreateInfo->minImageCount 3, which is outside the bounds returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR() (i.e. minImageCount = 4, maxImageCount = 0). The Vulkan spec states: If presentMode is not VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR nor VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR, then minImageCount must be greater than or equal to the value returned in the minImageCount member of the VkSurfaceCapabilitiesKHR structure returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR for the surface (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkSwapchainCreateInfoKHR-presentMode-02839)
    Objects: 0

Use the minimum image count in that case, as it's as close as we'll get
to our preferred value. Note also that, unlike maxImageCount,
minImageCount is never 0 (the spec states it is always at least 1), so
we don't need a similar check to see if it applies.

Signed-off-by: David Gow <david@ingeniumdigital.com>
2024-09-05 08:10:18 -07:00
Sylvain
41810c823d Compilation without vulkan: SDL_GPU_VULKAN is always defined for some plateform (at android, macos), test against 0 or 1 2024-09-05 05:36:21 -07:00
Quinn X. J.
f61d4db39a GPU: colorAttachmentDescriptions should be const
The `colorAttachmentDescriptions` field of `SDL_GPUGraphicsPipelineAttachmentInfo` should be marked `const`,
similarly to the `vertexBindings` and `vertexAttributes` fields of `SDL_GPUVertexInputState`.
2024-09-05 05:22:52 -07:00
Evan Hemsley
1788be8547 GPU: Add const to some function parameters (#10694) 2024-09-04 13:53:41 -07:00
Daniel Ludwig
b1b4a9cd1b GDK build: PFN_D3D12_XBOX_CREATE_DEVICE not defined for Xbox One (#10690) 2024-09-03 08:09:00 -05:00
Sam Lantinga
73898a0a64 Renamed NDA platform constants to "PRIVATE" 2024-09-02 21:00:34 -07:00
Sam Lantinga
35dadda327 Fixed build warnings 2024-09-02 17:17:48 -07:00
Andrei Alexeyev
fb7245fb93 GPU: Add support for more texture formats (#10641) 2024-09-02 19:14:48 -05:00
Caleb Cornett
f405def691 Change GPU flag enums to defines (#10681) 2024-09-02 15:19:43 -07:00
Davis Gallinghouse
deb313dd99 GPU: Compile Metal shader source from NSString
Using the @() syntax to construct an NSString assumes the parenthesized
pointer is null-terminated, but the Metal shader source included in
render/sdlgpu/shaders/metal.h is not null-terminated.

Quoting the clang documentation on Objective-C literals:

    When the type of the parenthesized expression is (char *) or (const
    char *), the result of the boxed expression is a pointer to an
    NSString object containing equivalent character data, which is
    assumed to be ‘\0’-terminated and UTF-8 encoded.

Because the @() syntax assumes null-termination, it may read garbage
data after the shader source (up to the next null byte), which can then
cause the Metal shader compiler to fail. To prevent this, instead of
using the @() boxing syntax, we explicitly construct an NSString using
the string length passed by the caller.
2024-09-02 07:20:36 -07:00
Zero
2c0ffdc6d5 GPU: Pass the new window size when resizing the swapchain for d3d12 (#10665) 2024-09-01 08:48:29 -07:00
Andrei Alexeyev
d4b8072614 GPU: Fix and generalize BytesPerRow() and BytesPerImage() (#10663)
These functions had special cases for a few BC formats, but all
block-compressed formats should need the same logic. Furthermore they
weren't handling the sRGB variants of those formats.
2024-08-31 23:07:38 -07:00
Sam Lantinga
b17ca32d8c Changed GPU driver names to match renderer driver names
Fixes https://github.com/libsdl-org/SDL/issues/10650
2024-08-31 10:06:27 -07:00
Sam Lantinga
f827c1322c Renamed SDL_Del* to SDL_Remove* 2024-08-31 07:46:28 -07:00
Jan Sedivy
00708b976a GPU Metal: Fix uninitialized memory 2024-08-31 07:29:32 -07:00
Anonymous Maarten
31a5f3b833 Fix C4090: 'function': different 'const' qualifiers 2024-08-31 06:49:33 -07:00
Andrei Alexeyev
0e08d15cca GPU: Fix unhandled R16G16_UNORM in SDL_GPUTextureFormatTexelBlockSize() (#10638) 2024-08-30 17:05:17 -07:00
Evan Hemsley
12ecdb9dde GPU: Rename some awkwardly named functions (#10642) 2024-08-30 15:31:10 -07:00
cosmonaut
906044569d GPU D3D12: Fix command buffer leak 2024-08-30 10:46:41 -07:00
Evan Hemsley
4bbf0d45fd GPU D3D12: Fix teardown and leaks on device creation failure (#10639) 2024-08-30 10:24:02 -07:00
Andrei Alexeyev
d1a2c57fb9 GPU: Fix memory leak in VULKAN_CreateDevice (#10631) 2024-08-29 22:15:08 -07:00
Sam Lantinga
5518aca054 Use stdbool internally in SDL 2024-08-29 18:54:05 -07:00
Sam Lantinga
683e5b8d52 Removed Unicode BOM 2024-08-29 17:33:52 -07:00