SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
SDL3pp_gpu.h
1#ifndef SDL3PP_GPU_H_
2#define SDL3PP_GPU_H_
3
4#include <SDL3/SDL_gpu.h>
5#include "SDL3pp_pixels.h"
6#include "SDL3pp_properties.h"
7#include "SDL3pp_rect.h"
8#include "SDL3pp_stdinc.h"
9#include "SDL3pp_surface.h"
10#include "SDL3pp_video.h"
11
12namespace SDL {
13
374
375// Forward decl
376struct GPUDevice;
377
379using GPUDeviceRaw = SDL_GPUDevice*;
380
387
389using GPUBufferRaw = SDL_GPUBuffer*;
390
391// Forward decl
392struct GPUBuffer;
393
395using GPUTransferBufferRaw = SDL_GPUTransferBuffer*;
396
397// Forward decl
398struct GPUTransferBuffer;
399
401using GPUTextureRaw = SDL_GPUTexture*;
402
403// Forward decl
404struct GPUTexture;
405
407using GPUSamplerRaw = SDL_GPUSampler*;
408
409// Forward decl
410struct GPUSampler;
411
413using GPUShaderRaw = SDL_GPUShader*;
414
415// Forward decl
416struct GPUShader;
417
419using GPUComputePipelineRaw = SDL_GPUComputePipeline*;
420
421// Forward decl
422struct GPUComputePipeline;
423
425using GPUGraphicsPipelineRaw = SDL_GPUGraphicsPipeline*;
426
427// Forward decl
429
431using GPUCommandBufferRaw = SDL_GPUCommandBuffer*;
432
433// Forward decl
434struct GPUCommandBuffer;
435
437using GPURenderPassRaw = SDL_GPURenderPass*;
438
439// Forward decl
440struct GPURenderPass;
441
443using GPUComputePassRaw = SDL_GPUComputePass*;
444
445// Forward decl
446struct GPUComputePass;
447
449using GPUCopyPassRaw = SDL_GPUCopyPass*;
450
451// Forward decl
452struct GPUCopyPass;
453
465using GPUBufferCreateInfo = SDL_GPUBufferCreateInfo;
466
489{
490 GPUBufferRaw m_gPUBuffer;
491
492public:
498 constexpr GPUBuffer(GPUBufferRaw gPUBuffer = {}) noexcept
499 : m_gPUBuffer(gPUBuffer)
500 {
501 }
502
546 GPUBuffer(GPUDeviceRef device, const GPUBufferCreateInfo& createinfo);
547
553 constexpr operator GPUBufferRaw() const noexcept { return m_gPUBuffer; }
554};
555
563using GPUTransferBufferCreateInfo = SDL_GPUTransferBufferCreateInfo;
564
582{
583 GPUTransferBufferRaw m_gPUTransferBuffer;
584
585public:
592 GPUTransferBufferRaw gPUTransferBuffer = {}) noexcept
593 : m_gPUTransferBuffer(gPUTransferBuffer)
594 {
595 }
596
625 const GPUTransferBufferCreateInfo& createinfo);
626
632 constexpr operator GPUTransferBufferRaw() const noexcept
633 {
634 return m_gPUTransferBuffer;
635 }
636};
637
653using GPUTextureCreateInfo = SDL_GPUTextureCreateInfo;
654
674{
675 GPUTextureRaw m_gPUTexture;
676
677public:
683 constexpr GPUTexture(GPUTextureRaw gPUTexture = {}) noexcept
684 : m_gPUTexture(gPUTexture)
685 {
686 }
687
746 GPUTexture(GPUDeviceRef device, const GPUTextureCreateInfo& createinfo);
747
753 constexpr operator GPUTextureRaw() const noexcept { return m_gPUTexture; }
754};
755
770using GPUSamplerCreateInfo = SDL_GPUSamplerCreateInfo;
771
783{
784 GPUSamplerRaw m_gPUSampler;
785
786public:
792 constexpr GPUSampler(GPUSamplerRaw gPUSampler = {}) noexcept
793 : m_gPUSampler(gPUSampler)
794 {
795 }
796
818 GPUSampler(GPUDeviceRef device, const GPUSamplerCreateInfo& createinfo);
819
825 constexpr operator GPUSamplerRaw() const noexcept { return m_gPUSampler; }
826};
827
837using GPUShaderCreateInfo = SDL_GPUShaderCreateInfo;
838
849{
850 GPUShaderRaw m_gPUShader;
851
852public:
858 constexpr GPUShader(GPUShaderRaw gPUShader = {}) noexcept
859 : m_gPUShader(gPUShader)
860 {
861 }
862
936 GPUShader(GPUDeviceRef device, const GPUShaderCreateInfo& createinfo);
937
943 constexpr operator GPUShaderRaw() const noexcept { return m_gPUShader; }
944};
945
954using GPUComputePipelineCreateInfo = SDL_GPUComputePipelineCreateInfo;
955
968{
969 GPUComputePipelineRaw m_gPUComputePipeline;
970
971public:
978 GPUComputePipelineRaw gPUComputePipeline = {}) noexcept
979 : m_gPUComputePipeline(gPUComputePipeline)
980 {
981 }
982
1029 const GPUComputePipelineCreateInfo& createinfo);
1030
1036 constexpr operator GPUComputePipelineRaw() const noexcept
1037 {
1038 return m_gPUComputePipeline;
1039 }
1040};
1041
1056using GPUGraphicsPipelineCreateInfo = SDL_GPUGraphicsPipelineCreateInfo;
1057
1070{
1071 GPUGraphicsPipelineRaw m_gPUGraphicsPipeline;
1072
1073public:
1080 GPUGraphicsPipelineRaw gPUGraphicsPipeline = {}) noexcept
1081 : m_gPUGraphicsPipeline(gPUGraphicsPipeline)
1082 {
1083 }
1084
1107 const GPUGraphicsPipelineCreateInfo& createinfo);
1108
1114 constexpr operator GPUGraphicsPipelineRaw() const noexcept
1115 {
1116 return m_gPUGraphicsPipeline;
1117 }
1118};
1119
1127using GPUViewport = SDL_GPUViewport;
1128
1137using GPUBufferBinding = SDL_GPUBufferBinding;
1138
1146using GPUIndexElementSize = SDL_GPUIndexElementSize;
1147
1149 SDL_GPU_INDEXELEMENTSIZE_16BIT;
1150
1152 SDL_GPU_INDEXELEMENTSIZE_32BIT;
1153
1164using GPUTextureSamplerBinding = SDL_GPUTextureSamplerBinding;
1165
1178{
1179 GPURenderPassRaw m_gPURenderPass;
1180
1181public:
1187 constexpr GPURenderPass(GPURenderPassRaw gPURenderPass = {}) noexcept
1188 : m_gPURenderPass(gPURenderPass)
1189 {
1190 }
1191
1197 constexpr operator GPURenderPassRaw() const noexcept
1198 {
1199 return m_gPURenderPass;
1200 }
1201
1211 void BindPipeline(GPUGraphicsPipeline graphics_pipeline);
1212
1220 void SetViewport(const GPUViewport& viewport);
1221
1229 void SetScissor(const RectRaw& scissor);
1230
1241 void SetBlendConstants(FColorRaw blend_constants);
1242
1250 void SetStencilReference(Uint8 reference);
1251
1262 void BindVertexBuffers(Uint32 first_slot,
1263 std::span<const GPUBufferBinding> bindings);
1264
1275 void BindIndexBuffer(const GPUBufferBinding& binding,
1276 GPUIndexElementSize index_element_size);
1277
1294 void BindVertexSamplers(
1295 Uint32 first_slot,
1296 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings);
1297
1314 void BindVertexStorageTextures(Uint32 first_slot,
1315 SpanRef<const GPUTextureRaw> storage_textures);
1316
1333 void BindVertexStorageBuffers(Uint32 first_slot,
1334 SpanRef<const GPUBufferRaw> storage_buffers);
1335
1353 Uint32 first_slot,
1354 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings);
1355
1373 Uint32 first_slot,
1374 SpanRef<const GPUTextureRaw> storage_textures);
1375
1392 void BindFragmentStorageBuffers(Uint32 first_slot,
1393 SpanRef<const GPUBufferRaw> storage_buffers);
1394
1417 void DrawIndexedPrimitives(Uint32 num_indices,
1418 Uint32 num_instances,
1419 Uint32 first_index,
1420 Sint32 vertex_offset,
1421 Uint32 first_instance);
1422
1442 void DrawPrimitives(Uint32 num_vertices,
1443 Uint32 num_instances,
1444 Uint32 first_vertex,
1445 Uint32 first_instance);
1446
1463 Uint32 offset,
1464 Uint32 draw_count);
1465
1482 Uint32 offset,
1483 Uint32 draw_count);
1484
1493 void End();
1494};
1495
1508{
1509 GPUComputePassRaw m_gPUComputePass;
1510
1511public:
1517 constexpr GPUComputePass(GPUComputePassRaw gPUComputePass = {}) noexcept
1518 : m_gPUComputePass(gPUComputePass)
1519 {
1520 }
1521
1527 constexpr operator GPUComputePassRaw() const noexcept
1528 {
1529 return m_gPUComputePass;
1530 }
1531
1539 void BindPipeline(GPUComputePipeline compute_pipeline);
1540
1557 void BindSamplers(
1558 Uint32 first_slot,
1559 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings);
1560
1577 void BindStorageTextures(Uint32 first_slot,
1578 SpanRef<const GPUTextureRaw> storage_textures);
1579
1596 void BindStorageBuffers(Uint32 first_slot,
1597 SpanRef<const GPUBufferRaw> storage_buffers);
1598
1618 void Dispatch(Uint32 groupcount_x, Uint32 groupcount_y, Uint32 groupcount_z);
1619
1636 void DispatchIndirect(GPUBuffer buffer, Uint32 offset);
1637
1646 void End();
1647};
1648
1659using GPUBufferRegion = SDL_GPUBufferRegion;
1660
1670using GPUTextureLocation = SDL_GPUTextureLocation;
1671
1681using GPUBufferLocation = SDL_GPUBufferLocation;
1682
1694using GPUTextureRegion = SDL_GPUTextureRegion;
1695
1717using GPUTextureTransferInfo = SDL_GPUTextureTransferInfo;
1718
1729using GPUTransferBufferLocation = SDL_GPUTransferBufferLocation;
1730
1743{
1744 GPUCopyPassRaw m_gPUCopyPass;
1745
1746public:
1752 constexpr GPUCopyPass(GPUCopyPassRaw gPUCopyPass = {}) noexcept
1753 : m_gPUCopyPass(gPUCopyPass)
1754 {
1755 }
1756
1762 constexpr operator GPUCopyPassRaw() const noexcept { return m_gPUCopyPass; }
1763
1780 void UploadToTexture(const GPUTextureTransferInfo& source,
1781 const GPUTextureRegion& destination,
1782 bool cycle);
1783
1797 void UploadToBuffer(const GPUTransferBufferLocation& source,
1798 const GPUBufferRegion& destination,
1799 bool cycle);
1800
1821 void CopyTextureToTexture(const GPUTextureLocation& source,
1822 const GPUTextureLocation& destination,
1823 Uint32 w,
1824 Uint32 h,
1825 Uint32 d,
1826 bool cycle);
1827
1842 void CopyBufferToBuffer(const GPUBufferLocation& source,
1843 const GPUBufferLocation& destination,
1844 Uint32 size,
1845 bool cycle);
1846
1859 void DownloadFromTexture(const GPUTextureRegion& source,
1860 const GPUTextureTransferInfo& destination);
1861
1873 void DownloadFromBuffer(const GPUBufferRegion& source,
1874 const GPUTransferBufferLocation& destination);
1875
1881 void End();
1882};
1883
1920using GPUColorTargetInfo = SDL_GPUColorTargetInfo;
1921
1969using GPUDepthStencilTargetInfo = SDL_GPUDepthStencilTargetInfo;
1970
1979using GPUStorageTextureReadWriteBinding = SDL_GPUStorageTextureReadWriteBinding;
1980
1989using GPUStorageBufferReadWriteBinding = SDL_GPUStorageBufferReadWriteBinding;
1990
1998using GPUBlitInfo = SDL_GPUBlitInfo;
1999
2010using GPUFence = SDL_GPUFence;
2011
2036{
2037 GPUCommandBufferRaw m_gPUCommandBuffer;
2038
2039public:
2045 constexpr GPUCommandBuffer(GPUCommandBufferRaw gPUCommandBuffer = {}) noexcept
2046 : m_gPUCommandBuffer(gPUCommandBuffer)
2047 {
2048 }
2049
2055 constexpr operator GPUCommandBufferRaw() const noexcept
2056 {
2057 return m_gPUCommandBuffer;
2058 }
2059
2075 void InsertDebugLabel(StringParam text);
2076
2103 void PushDebugGroup(StringParam name);
2104
2118 void PopDebugGroup();
2119
2137 void PushVertexUniformData(Uint32 slot_index, SourceBytes data);
2138
2153 void PushFragmentUniformData(Uint32 slot_index, SourceBytes data);
2154
2169 void PushComputeUniformData(Uint32 slot_index, SourceBytes data);
2170
2202 std::span<const GPUColorTargetInfo> color_target_infos,
2203 OptionalRef<const GPUDepthStencilTargetInfo> depth_stencil_target_info);
2204
2238 std::span<const GPUStorageTextureReadWriteBinding> storage_texture_bindings,
2239 std::span<const GPUStorageBufferReadWriteBinding> storage_buffer_bindings);
2240
2255
2266
2276 void BlitTexture(const GPUBlitInfo& info);
2277
2324 WindowRef window,
2325 Uint32* swapchain_texture_width = nullptr,
2326 Uint32* swapchain_texture_height = nullptr);
2327
2368 WindowRef window,
2369 Uint32* swapchain_texture_width = nullptr,
2370 Uint32* swapchain_texture_height = nullptr);
2371
2391 void Submit();
2392
2417
2438 void Cancel();
2439};
2440
2451
2453 SDL_GPU_SHADERFORMAT_INVALID;
2454
2456 SDL_GPU_SHADERFORMAT_PRIVATE;
2457
2459 SDL_GPU_SHADERFORMAT_SPIRV;
2460
2462 SDL_GPU_SHADERFORMAT_DXBC;
2463
2465 SDL_GPU_SHADERFORMAT_DXIL;
2466
2468 SDL_GPU_SHADERFORMAT_MSL;
2469
2471 SDL_GPU_SHADERFORMAT_METALLIB;
2472
2498using GPUSwapchainComposition = SDL_GPUSwapchainComposition;
2499
2501 SDL_GPU_SWAPCHAINCOMPOSITION_SDR;
2502
2504 SDL_GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR;
2505
2507 SDL_GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR;
2508
2510 SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2084;
2511
2537using GPUPresentMode = SDL_GPUPresentMode;
2538
2540 SDL_GPU_PRESENTMODE_VSYNC;
2541
2543 SDL_GPU_PRESENTMODE_IMMEDIATE;
2544
2546 SDL_GPU_PRESENTMODE_MAILBOX;
2547
2630using GPUTextureFormat = SDL_GPUTextureFormat;
2631
2633 SDL_GPU_TEXTUREFORMAT_INVALID;
2634
2636 SDL_GPU_TEXTUREFORMAT_A8_UNORM;
2637
2639 SDL_GPU_TEXTUREFORMAT_R8_UNORM;
2640
2642 SDL_GPU_TEXTUREFORMAT_R8G8_UNORM;
2643
2645 SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM;
2646
2648 SDL_GPU_TEXTUREFORMAT_R16_UNORM;
2649
2651 SDL_GPU_TEXTUREFORMAT_R16G16_UNORM;
2652
2654 SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UNORM;
2655
2657 SDL_GPU_TEXTUREFORMAT_R10G10B10A2_UNORM;
2658
2660 SDL_GPU_TEXTUREFORMAT_B5G6R5_UNORM;
2661
2663 SDL_GPU_TEXTUREFORMAT_B5G5R5A1_UNORM;
2664
2666 SDL_GPU_TEXTUREFORMAT_B4G4R4A4_UNORM;
2667
2669 SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM;
2670
2672 SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM;
2673
2675 SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM;
2676
2678 SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM;
2679
2681 SDL_GPU_TEXTUREFORMAT_BC4_R_UNORM;
2682
2684 SDL_GPU_TEXTUREFORMAT_BC5_RG_UNORM;
2685
2687 SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM;
2688
2690 SDL_GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT;
2691
2693 SDL_GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT;
2694
2696 SDL_GPU_TEXTUREFORMAT_R8_SNORM;
2697
2699 SDL_GPU_TEXTUREFORMAT_R8G8_SNORM;
2700
2702 SDL_GPU_TEXTUREFORMAT_R8G8B8A8_SNORM;
2703
2705 SDL_GPU_TEXTUREFORMAT_R16_SNORM;
2706
2708 SDL_GPU_TEXTUREFORMAT_R16G16_SNORM;
2709
2711 SDL_GPU_TEXTUREFORMAT_R16G16B16A16_SNORM;
2712
2714 SDL_GPU_TEXTUREFORMAT_R16_FLOAT;
2715
2717 SDL_GPU_TEXTUREFORMAT_R16G16_FLOAT;
2718
2720 SDL_GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT;
2721
2723 SDL_GPU_TEXTUREFORMAT_R32_FLOAT;
2724
2726 SDL_GPU_TEXTUREFORMAT_R32G32_FLOAT;
2727
2729 SDL_GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT;
2730
2732 SDL_GPU_TEXTUREFORMAT_R11G11B10_UFLOAT;
2733
2735 SDL_GPU_TEXTUREFORMAT_R8_UINT;
2736
2738 SDL_GPU_TEXTUREFORMAT_R8G8_UINT;
2739
2741 SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UINT;
2742
2744 SDL_GPU_TEXTUREFORMAT_R16_UINT;
2745
2747 SDL_GPU_TEXTUREFORMAT_R16G16_UINT;
2748
2750 SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UINT;
2751
2753 SDL_GPU_TEXTUREFORMAT_R32_UINT;
2754
2756 SDL_GPU_TEXTUREFORMAT_R32G32_UINT;
2757
2759 SDL_GPU_TEXTUREFORMAT_R32G32B32A32_UINT;
2760
2762 SDL_GPU_TEXTUREFORMAT_R8_INT;
2763
2765 SDL_GPU_TEXTUREFORMAT_R8G8_INT;
2766
2768 SDL_GPU_TEXTUREFORMAT_R8G8B8A8_INT;
2769
2771 SDL_GPU_TEXTUREFORMAT_R16_INT;
2772
2774 SDL_GPU_TEXTUREFORMAT_R16G16_INT;
2775
2777 SDL_GPU_TEXTUREFORMAT_R16G16B16A16_INT;
2778
2780 SDL_GPU_TEXTUREFORMAT_R32_INT;
2781
2783 SDL_GPU_TEXTUREFORMAT_R32G32_INT;
2784
2786 SDL_GPU_TEXTUREFORMAT_R32G32B32A32_INT;
2787
2789 SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB;
2790
2792 SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB;
2793
2795 SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB;
2796
2798 SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB;
2799
2801 SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB;
2802
2804 SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB;
2805
2807 SDL_GPU_TEXTUREFORMAT_D16_UNORM;
2808
2810 SDL_GPU_TEXTUREFORMAT_D24_UNORM;
2811
2813 SDL_GPU_TEXTUREFORMAT_D32_FLOAT;
2814
2816 SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT;
2817
2819 SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT;
2820
2822 SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM;
2823
2825 SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM;
2826
2828 SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM;
2829
2831 SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM;
2832
2834 SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM;
2835
2837 SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM;
2838
2840 SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM;
2841
2843 SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM;
2844
2846 SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM;
2847
2849 SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM;
2850
2852 SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM;
2853
2855 SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM;
2856
2858 SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM;
2859
2861 SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM;
2862
2864 SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM_SRGB;
2865
2867 SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM_SRGB;
2868
2870 SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM_SRGB;
2871
2873 SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM_SRGB;
2874
2876 SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM_SRGB;
2877
2879 SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM_SRGB;
2880
2882 SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM_SRGB;
2883
2885 SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM_SRGB;
2886
2888 SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM_SRGB;
2889
2891 SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM_SRGB;
2892
2894 SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM_SRGB;
2895
2897 SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM_SRGB;
2898
2900 SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM_SRGB;
2901
2903 SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM_SRGB;
2904
2906 SDL_GPU_TEXTUREFORMAT_ASTC_4x4_FLOAT;
2907
2909 SDL_GPU_TEXTUREFORMAT_ASTC_5x4_FLOAT;
2910
2912 SDL_GPU_TEXTUREFORMAT_ASTC_5x5_FLOAT;
2913
2915 SDL_GPU_TEXTUREFORMAT_ASTC_6x5_FLOAT;
2916
2918 SDL_GPU_TEXTUREFORMAT_ASTC_6x6_FLOAT;
2919
2921 SDL_GPU_TEXTUREFORMAT_ASTC_8x5_FLOAT;
2922
2924 SDL_GPU_TEXTUREFORMAT_ASTC_8x6_FLOAT;
2925
2927 SDL_GPU_TEXTUREFORMAT_ASTC_8x8_FLOAT;
2928
2930 SDL_GPU_TEXTUREFORMAT_ASTC_10x5_FLOAT;
2931
2933 SDL_GPU_TEXTUREFORMAT_ASTC_10x6_FLOAT;
2934
2936 SDL_GPU_TEXTUREFORMAT_ASTC_10x8_FLOAT;
2937
2939 SDL_GPU_TEXTUREFORMAT_ASTC_10x10_FLOAT;
2940
2942 SDL_GPU_TEXTUREFORMAT_ASTC_12x10_FLOAT;
2943
2945 SDL_GPU_TEXTUREFORMAT_ASTC_12x12_FLOAT;
2946
2954using GPUTextureType = SDL_GPUTextureType;
2955
2957 SDL_GPU_TEXTURETYPE_2D;
2958
2960 SDL_GPU_TEXTURETYPE_2D_ARRAY;
2961
2963 SDL_GPU_TEXTURETYPE_3D;
2964
2966 SDL_GPU_TEXTURETYPE_CUBE;
2967
2969 SDL_GPU_TEXTURETYPE_CUBE_ARRAY;
2970
2992
2994 SDL_GPU_TEXTUREUSAGE_SAMPLER;
2995
2997 SDL_GPU_TEXTUREUSAGE_COLOR_TARGET;
2998
3000 SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET;
3002
3004 SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ;
3006
3009 SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ;
3010
3013 SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE;
3014
3019constexpr GPUTextureUsageFlags
3021 SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE;
3022
3034using GPUSampleCount = SDL_GPUSampleCount;
3035
3037 SDL_GPU_SAMPLECOUNT_1;
3038
3039constexpr GPUSampleCount GPU_SAMPLECOUNT_2 = SDL_GPU_SAMPLECOUNT_2;
3040
3041constexpr GPUSampleCount GPU_SAMPLECOUNT_4 = SDL_GPU_SAMPLECOUNT_4;
3042
3043constexpr GPUSampleCount GPU_SAMPLECOUNT_8 = SDL_GPU_SAMPLECOUNT_8;
3044
3052struct GPUDevice : ResourceBase<GPUDeviceRaw>
3053{
3055
3063 constexpr explicit GPUDevice(GPUDeviceRaw resource) noexcept
3064 : ResourceBase(resource)
3065 {
3066 }
3067
3069 constexpr GPUDevice(const GPUDevice& other) = delete;
3070
3072 constexpr GPUDevice(GPUDevice&& other) noexcept
3073 : GPUDevice(other.release())
3074 {
3075 }
3076
3077 constexpr GPUDevice(const GPUDeviceRef& other) = delete;
3078
3079 constexpr GPUDevice(GPUDeviceRef&& other) = delete;
3080
3107 GPUDevice(GPUShaderFormat format_flags, bool debug_mode, StringParam name);
3108
3220 GPUDevice(PropertiesRef props);
3221
3223 ~GPUDevice() { SDL_DestroyGPUDevice(get()); }
3224
3226 constexpr GPUDevice& operator=(GPUDevice&& other) noexcept
3227 {
3228 swap(*this, other);
3229 return *this;
3230 }
3231
3233 GPUDevice& operator=(const GPUDevice& other) = delete;
3234
3242 void Destroy();
3243
3251 const char* GetDriver();
3252
3262
3263#if SDL_VERSION_ATLEAST(3, 4, 0)
3264
3367
3368#endif // SDL_VERSION_ATLEAST(3, 4, 0)
3369
3415 const GPUComputePipelineCreateInfo& createinfo);
3416
3438 const GPUGraphicsPipelineCreateInfo& createinfo);
3439
3461
3534 GPUShader CreateShader(const GPUShaderCreateInfo& createinfo);
3535
3594
3637 GPUBuffer CreateBuffer(const GPUBufferCreateInfo& createinfo);
3638
3666 const GPUTransferBufferCreateInfo& createinfo);
3667
3685 void SetBufferName(GPUBuffer buffer, StringParam text);
3686
3704 void SetTextureName(GPUTexture texture, StringParam text);
3705
3715 void ReleaseTexture(GPUTexture texture);
3716
3726 void ReleaseSampler(GPUSampler sampler);
3727
3737 void ReleaseBuffer(GPUBuffer buffer);
3738
3748 void ReleaseTransferBuffer(GPUTransferBuffer transfer_buffer);
3749
3759 void ReleaseComputePipeline(GPUComputePipeline compute_pipeline);
3760
3770 void ReleaseShader(GPUShader shader);
3771
3781 void ReleaseGraphicsPipeline(GPUGraphicsPipeline graphics_pipeline);
3782
3807
3822 void* MapTransferBuffer(GPUTransferBuffer transfer_buffer, bool cycle);
3823
3831 void UnmapTransferBuffer(GPUTransferBuffer transfer_buffer);
3832
3847 WindowRef window,
3848 GPUSwapchainComposition swapchain_composition);
3849
3863 bool WindowSupportsPresentMode(WindowRef window, GPUPresentMode present_mode);
3864
3889 void ClaimWindow(WindowRef window);
3890
3900 void ReleaseWindow(WindowRef window);
3901
3926 GPUSwapchainComposition swapchain_composition,
3927 GPUPresentMode present_mode);
3928
3953 bool SetAllowedFramesInFlight(Uint32 allowed_frames_in_flight);
3954
3966
3982 void WaitForSwapchain(WindowRef window);
3983
3993 void WaitForIdle();
3994
4008 void WaitForFences(bool wait_all, std::span<GPUFence* const> fences);
4009
4020 bool QueryFence(GPUFence* fence);
4021
4033 void ReleaseFence(GPUFence* fence);
4034
4047 GPUTextureType type,
4048 GPUTextureUsageFlags usage);
4049
4060 GPUSampleCount sample_count);
4061
4062#ifdef SDL_PLATFORM_GDK
4063
4075 void GDKSuspendGPU();
4076
4088 void GDKResumeGPU();
4089
4090#endif /* SDL_PLATFORM_GDK */
4091};
4092
4113using GPUPrimitiveType = SDL_GPUPrimitiveType;
4114
4116 SDL_GPU_PRIMITIVETYPE_TRIANGLELIST;
4117
4119 SDL_GPU_PRIMITIVETYPE_TRIANGLESTRIP;
4120
4122 SDL_GPU_PRIMITIVETYPE_LINELIST;
4123
4125 SDL_GPU_PRIMITIVETYPE_LINESTRIP;
4126
4128 SDL_GPU_PRIMITIVETYPE_POINTLIST;
4129
4138using GPULoadOp = SDL_GPULoadOp;
4139
4141constexpr GPULoadOp GPU_LOADOP_LOAD = SDL_GPU_LOADOP_LOAD;
4142
4144constexpr GPULoadOp GPU_LOADOP_CLEAR = SDL_GPU_LOADOP_CLEAR;
4145
4150constexpr GPULoadOp GPU_LOADOP_DONT_CARE = SDL_GPU_LOADOP_DONT_CARE;
4151
4160using GPUStoreOp = SDL_GPUStoreOp;
4161
4163constexpr GPUStoreOp GPU_STOREOP_STORE = SDL_GPU_STOREOP_STORE;
4164
4169constexpr GPUStoreOp GPU_STOREOP_DONT_CARE = SDL_GPU_STOREOP_DONT_CARE;
4170
4176constexpr GPUStoreOp GPU_STOREOP_RESOLVE = SDL_GPU_STOREOP_RESOLVE;
4177
4184 SDL_GPU_STOREOP_RESOLVE_AND_STORE;
4185
4193using GPUCubeMapFace = SDL_GPUCubeMapFace;
4194
4196 SDL_GPU_CUBEMAPFACE_POSITIVEX;
4197
4199 SDL_GPU_CUBEMAPFACE_NEGATIVEX;
4200
4202 SDL_GPU_CUBEMAPFACE_POSITIVEY;
4203
4205 SDL_GPU_CUBEMAPFACE_NEGATIVEY;
4206
4208 SDL_GPU_CUBEMAPFACE_POSITIVEZ;
4209
4211 SDL_GPU_CUBEMAPFACE_NEGATIVEZ;
4212
4231
4233 SDL_GPU_BUFFERUSAGE_VERTEX;
4234
4236 SDL_GPU_BUFFERUSAGE_INDEX;
4237
4239 SDL_GPU_BUFFERUSAGE_INDIRECT;
4240
4242 SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ;
4244
4247 SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ;
4248
4251 SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE;
4252
4263using GPUTransferBufferUsage = SDL_GPUTransferBufferUsage;
4264
4266 SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD;
4267
4269 SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD;
4270
4278using GPUShaderStage = SDL_GPUShaderStage;
4279
4281 SDL_GPU_SHADERSTAGE_VERTEX;
4282
4284 SDL_GPU_SHADERSTAGE_FRAGMENT;
4285
4293using GPUVertexElementFormat = SDL_GPUVertexElementFormat;
4294
4296 SDL_GPU_VERTEXELEMENTFORMAT_INVALID;
4297
4299 SDL_GPU_VERTEXELEMENTFORMAT_INT;
4300
4302 SDL_GPU_VERTEXELEMENTFORMAT_INT2;
4303
4305 SDL_GPU_VERTEXELEMENTFORMAT_INT3;
4306
4308 SDL_GPU_VERTEXELEMENTFORMAT_INT4;
4309
4311 SDL_GPU_VERTEXELEMENTFORMAT_UINT;
4312
4314 SDL_GPU_VERTEXELEMENTFORMAT_UINT2;
4315
4317 SDL_GPU_VERTEXELEMENTFORMAT_UINT3;
4318
4320 SDL_GPU_VERTEXELEMENTFORMAT_UINT4;
4321
4323 SDL_GPU_VERTEXELEMENTFORMAT_FLOAT;
4324
4326 SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2;
4327
4329 SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3;
4330
4332 SDL_GPU_VERTEXELEMENTFORMAT_FLOAT4;
4333
4335 SDL_GPU_VERTEXELEMENTFORMAT_BYTE2;
4336
4338 SDL_GPU_VERTEXELEMENTFORMAT_BYTE4;
4339
4341 SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2;
4342
4344 SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4;
4345
4347 SDL_GPU_VERTEXELEMENTFORMAT_BYTE2_NORM;
4348
4350 SDL_GPU_VERTEXELEMENTFORMAT_BYTE4_NORM;
4351
4353 SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM;
4354
4356 SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM;
4357
4359 SDL_GPU_VERTEXELEMENTFORMAT_SHORT2;
4360
4362 SDL_GPU_VERTEXELEMENTFORMAT_SHORT4;
4363
4365 SDL_GPU_VERTEXELEMENTFORMAT_USHORT2;
4366
4368 SDL_GPU_VERTEXELEMENTFORMAT_USHORT4;
4369
4371 SDL_GPU_VERTEXELEMENTFORMAT_SHORT2_NORM;
4372
4374 SDL_GPU_VERTEXELEMENTFORMAT_SHORT4_NORM;
4375
4377 SDL_GPU_VERTEXELEMENTFORMAT_USHORT2_NORM;
4378
4380 SDL_GPU_VERTEXELEMENTFORMAT_USHORT4_NORM;
4381
4383 SDL_GPU_VERTEXELEMENTFORMAT_HALF2;
4384
4386 SDL_GPU_VERTEXELEMENTFORMAT_HALF4;
4387
4395using GPUVertexInputRate = SDL_GPUVertexInputRate;
4396
4399 SDL_GPU_VERTEXINPUTRATE_VERTEX;
4400
4403 SDL_GPU_VERTEXINPUTRATE_INSTANCE;
4404
4412using GPUFillMode = SDL_GPUFillMode;
4413
4415 SDL_GPU_FILLMODE_FILL;
4416
4418 SDL_GPU_FILLMODE_LINE;
4419
4427using GPUCullMode = SDL_GPUCullMode;
4428
4430 SDL_GPU_CULLMODE_NONE;
4431
4433 SDL_GPU_CULLMODE_FRONT;
4434
4436 SDL_GPU_CULLMODE_BACK;
4437
4446using GPUFrontFace = SDL_GPUFrontFace;
4447
4453 SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE;
4454
4456constexpr GPUFrontFace GPU_FRONTFACE_CLOCKWISE = SDL_GPU_FRONTFACE_CLOCKWISE;
4457
4465using GPUCompareOp = SDL_GPUCompareOp;
4466
4468 SDL_GPU_COMPAREOP_INVALID;
4469
4471 SDL_GPU_COMPAREOP_NEVER;
4472
4474 SDL_GPU_COMPAREOP_LESS;
4475
4477 SDL_GPU_COMPAREOP_EQUAL;
4478
4480 SDL_GPU_COMPAREOP_LESS_OR_EQUAL;
4482
4484 SDL_GPU_COMPAREOP_GREATER;
4485
4487 SDL_GPU_COMPAREOP_NOT_EQUAL;
4488
4490 SDL_GPU_COMPAREOP_GREATER_OR_EQUAL;
4492
4494 SDL_GPU_COMPAREOP_ALWAYS;
4495
4504using GPUStencilOp = SDL_GPUStencilOp;
4505
4507 SDL_GPU_STENCILOP_INVALID;
4508
4510 SDL_GPU_STENCILOP_KEEP;
4511
4513 SDL_GPU_STENCILOP_ZERO;
4514
4516 SDL_GPU_STENCILOP_REPLACE;
4517
4520 SDL_GPU_STENCILOP_INCREMENT_AND_CLAMP;
4521
4523 SDL_GPU_STENCILOP_DECREMENT_AND_CLAMP;
4525
4527 SDL_GPU_STENCILOP_INVERT;
4528
4530 SDL_GPU_STENCILOP_INCREMENT_AND_WRAP;
4532
4535 SDL_GPU_STENCILOP_DECREMENT_AND_WRAP;
4536
4548using GPUBlendOp = SDL_GPUBlendOp;
4549
4551 SDL_GPU_BLENDOP_INVALID;
4552
4554constexpr GPUBlendOp GPU_BLENDOP_ADD = SDL_GPU_BLENDOP_ADD;
4555
4557constexpr GPUBlendOp GPU_BLENDOP_SUBTRACT = SDL_GPU_BLENDOP_SUBTRACT;
4558
4561 SDL_GPU_BLENDOP_REVERSE_SUBTRACT;
4562
4564 SDL_GPU_BLENDOP_MIN;
4565
4567 SDL_GPU_BLENDOP_MAX;
4568
4580using GPUBlendFactor = SDL_GPUBlendFactor;
4581
4583 SDL_GPU_BLENDFACTOR_INVALID;
4584
4585constexpr GPUBlendFactor GPU_BLENDFACTOR_ZERO = SDL_GPU_BLENDFACTOR_ZERO;
4586
4587constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE = SDL_GPU_BLENDFACTOR_ONE;
4588
4590 SDL_GPU_BLENDFACTOR_SRC_COLOR;
4591
4593 SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR;
4594
4596 SDL_GPU_BLENDFACTOR_DST_COLOR;
4597
4599 SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR;
4600
4602 SDL_GPU_BLENDFACTOR_SRC_ALPHA;
4603
4605 SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA;
4606
4608 SDL_GPU_BLENDFACTOR_DST_ALPHA;
4609
4611 SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA;
4612
4614 SDL_GPU_BLENDFACTOR_CONSTANT_COLOR;
4615
4617 SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR;
4618
4620 SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE;
4622
4631
4633 SDL_GPU_COLORCOMPONENT_R;
4634
4636 SDL_GPU_COLORCOMPONENT_G;
4637
4639 SDL_GPU_COLORCOMPONENT_B;
4640
4642 SDL_GPU_COLORCOMPONENT_A;
4643
4651using GPUFilter = SDL_GPUFilter;
4652
4654 SDL_GPU_FILTER_NEAREST;
4655
4657 SDL_GPU_FILTER_LINEAR;
4658
4666using GPUSamplerMipmapMode = SDL_GPUSamplerMipmapMode;
4667
4669 SDL_GPU_SAMPLERMIPMAPMODE_NEAREST;
4670
4672 SDL_GPU_SAMPLERMIPMAPMODE_LINEAR;
4673
4682using GPUSamplerAddressMode = SDL_GPUSamplerAddressMode;
4683
4685 SDL_GPU_SAMPLERADDRESSMODE_REPEAT;
4687
4690 SDL_GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT;
4691
4694 SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE;
4695
4703using GPUBlitRegion = SDL_GPUBlitRegion;
4704
4719using GPUIndirectDrawCommand = SDL_GPUIndirectDrawCommand;
4720
4735using GPUIndexedIndirectDrawCommand = SDL_GPUIndexedIndirectDrawCommand;
4736
4744using GPUIndirectDispatchCommand = SDL_GPUIndirectDispatchCommand;
4745
4764using GPUVertexBufferDescription = SDL_GPUVertexBufferDescription;
4765
4778using GPUVertexAttribute = SDL_GPUVertexAttribute;
4779
4790using GPUVertexInputState = SDL_GPUVertexInputState;
4791
4799using GPUStencilOpState = SDL_GPUStencilOpState;
4800
4811using GPUColorTargetBlendState = SDL_GPUColorTargetBlendState;
4812
4829using GPURasterizerState = SDL_GPURasterizerState;
4830
4839using GPUMultisampleState = SDL_GPUMultisampleState;
4840
4849using GPUDepthStencilState = SDL_GPUDepthStencilState;
4850
4859using GPUColorTargetDescription = SDL_GPUColorTargetDescription;
4860
4871using GPUGraphicsPipelineTargetInfo = SDL_GPUGraphicsPipelineTargetInfo;
4872
4887 StringParam name)
4888{
4889 return SDL_GPUSupportsShaderFormats(format_flags, name);
4890}
4891
4903{
4904 return SDL_GPUSupportsProperties(props);
4905}
4906
4934 bool debug_mode,
4935 StringParam name)
4936{
4937 return GPUDevice(format_flags, debug_mode, std::move(name));
4938}
4939
4941 bool debug_mode,
4942 StringParam name)
4943 : GPUDevice(CheckError(SDL_CreateGPUDevice(format_flags, debug_mode, name)))
4944{
4945}
4946
4948 : GPUDevice(CheckError(SDL_CreateGPUDeviceWithProperties(props)))
4949{
4950}
4951
5062{
5063 return GPUDevice(props);
5064}
5065
5078
5079constexpr auto CREATE_DEBUGMODE_BOOLEAN =
5080 SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN;
5081
5082constexpr auto CREATE_PREFERLOWPOWER_BOOLEAN =
5083 SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN;
5084
5085#if SDL_VERSION_ATLEAST(3, 4, 0)
5086
5087constexpr auto CREATE_VERBOSE_BOOLEAN =
5088 SDL_PROP_GPU_DEVICE_CREATE_VERBOSE_BOOLEAN;
5089
5090#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5091
5092constexpr auto CREATE_NAME_STRING = SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING;
5093
5094#if SDL_VERSION_ATLEAST(3, 4, 0)
5095
5096constexpr auto CREATE_FEATURE_CLIP_DISTANCE_BOOLEAN =
5097 SDL_PROP_GPU_DEVICE_CREATE_FEATURE_CLIP_DISTANCE_BOOLEAN;
5098
5099constexpr auto CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN =
5100 SDL_PROP_GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN;
5101
5102constexpr auto CREATE_FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN =
5103 SDL_PROP_GPU_DEVICE_CREATE_FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN;
5104
5105constexpr auto CREATE_FEATURE_ANISOTROPY_BOOLEAN =
5106 SDL_PROP_GPU_DEVICE_CREATE_FEATURE_ANISOTROPY_BOOLEAN;
5107
5108#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5109
5110constexpr auto CREATE_SHADERS_PRIVATE_BOOLEAN =
5111 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN;
5112
5113constexpr auto CREATE_SHADERS_SPIRV_BOOLEAN =
5114 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOLEAN;
5115
5116constexpr auto CREATE_SHADERS_DXBC_BOOLEAN =
5117 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOLEAN;
5118
5119constexpr auto CREATE_SHADERS_DXIL_BOOLEAN =
5120 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN;
5121
5122constexpr auto CREATE_SHADERS_MSL_BOOLEAN =
5123 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN;
5124
5125constexpr auto CREATE_SHADERS_METALLIB_BOOLEAN =
5126 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN;
5127
5128#if SDL_VERSION_ATLEAST(3, 4, 0)
5129
5130constexpr auto CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN =
5131 SDL_PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN;
5132
5133#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5134
5135constexpr auto CREATE_D3D12_SEMANTIC_NAME_STRING =
5136 SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING;
5137
5138#if SDL_VERSION_ATLEAST(3, 4, 2)
5139
5140constexpr auto CREATE_D3D12_AGILITY_SDK_VERSION_NUMBER =
5141 SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_VERSION_NUMBER;
5142
5143constexpr auto CREATE_D3D12_AGILITY_SDK_PATH_STRING =
5144 SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_PATH_STRING;
5145
5146#endif // SDL_VERSION_ATLEAST(3, 4, 2)
5147
5148#if SDL_VERSION_ATLEAST(3, 4, 0)
5149
5150constexpr auto CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN =
5151 SDL_PROP_GPU_DEVICE_CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN;
5152
5153constexpr auto CREATE_VULKAN_OPTIONS_POINTER =
5154 SDL_PROP_GPU_DEVICE_CREATE_VULKAN_OPTIONS_POINTER;
5155
5156#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5157
5158#if SDL_VERSION_ATLEAST(3, 4, 2)
5159
5160constexpr auto CREATE_METAL_ALLOW_MACFAMILY1_BOOLEAN =
5161 SDL_PROP_GPU_DEVICE_CREATE_METAL_ALLOW_MACFAMILY1_BOOLEAN;
5162
5163#endif // SDL_VERSION_ATLEAST(3, 4, 2)
5164
5165#if SDL_VERSION_ATLEAST(3, 4, 0)
5166
5167constexpr auto NAME_STRING = SDL_PROP_GPU_DEVICE_NAME_STRING;
5168
5169constexpr auto DRIVER_NAME_STRING = SDL_PROP_GPU_DEVICE_DRIVER_NAME_STRING;
5170
5171constexpr auto DRIVER_VERSION_STRING =
5172 SDL_PROP_GPU_DEVICE_DRIVER_VERSION_STRING;
5173
5174constexpr auto DRIVER_INFO_STRING = SDL_PROP_GPU_DEVICE_DRIVER_INFO_STRING;
5175
5176#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5177
5178} // namespace prop::GPUDevice
5179
5180#if SDL_VERSION_ATLEAST(3, 4, 0)
5181
5198using GPUVulkanOptions = SDL_GPUVulkanOptions;
5199
5200#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5201
5212{
5213 SDL_DestroyGPUDevice(device);
5214}
5215
5217
5227inline int GetNumGPUDrivers() { return SDL_GetNumGPUDrivers(); }
5228
5246inline const char* GetGPUDriver(int index) { return SDL_GetGPUDriver(index); }
5247
5256inline const char* GetGPUDeviceDriver(GPUDeviceRef device)
5257{
5258 return SDL_GetGPUDeviceDriver(device);
5259}
5260
5261inline const char* GPUDevice::GetDriver()
5262{
5263 return SDL::GetGPUDeviceDriver(get());
5264}
5265
5276{
5277 return SDL_GetGPUShaderFormats(device);
5278}
5279
5284
5285#if SDL_VERSION_ATLEAST(3, 4, 0)
5286
5389{
5390 return CheckError(SDL_GetGPUDeviceProperties(device));
5391}
5392
5397
5398#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5399
5446 GPUDeviceRef device,
5447 const GPUComputePipelineCreateInfo& createinfo)
5448{
5449 return GPUComputePipeline(device, createinfo);
5450}
5451
5453 const GPUComputePipelineCreateInfo& createinfo)
5454{
5455 return GPUComputePipeline(get(), createinfo);
5456}
5457
5459 GPUDeviceRef device,
5460 const GPUComputePipelineCreateInfo& createinfo)
5461 : m_gPUComputePipeline(
5462 CheckError(SDL_CreateGPUComputePipeline(device, &createinfo)))
5463{
5464}
5465
5472
5473constexpr auto CREATE_NAME_STRING =
5474 SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING;
5475
5476} // namespace prop::GPUComputePipeline
5477
5500 GPUDeviceRef device,
5501 const GPUGraphicsPipelineCreateInfo& createinfo)
5502{
5503 return GPUGraphicsPipeline(device, createinfo);
5504}
5505
5507 const GPUGraphicsPipelineCreateInfo& createinfo)
5508{
5509 return GPUGraphicsPipeline(get(), createinfo);
5510}
5511
5513 GPUDeviceRef device,
5514 const GPUGraphicsPipelineCreateInfo& createinfo)
5515 : m_gPUGraphicsPipeline(
5516 CheckError(SDL_CreateGPUGraphicsPipeline(device, &createinfo)))
5517{
5518}
5519
5526
5527constexpr auto CREATE_NAME_STRING =
5528 SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING;
5529
5530} // namespace prop::GPUGraphicsPipeline
5531
5554 const GPUSamplerCreateInfo& createinfo)
5555{
5556 return GPUSampler(device, createinfo);
5557}
5558
5560 const GPUSamplerCreateInfo& createinfo)
5561{
5562 return GPUSampler(get(), createinfo);
5563}
5564
5566 const GPUSamplerCreateInfo& createinfo)
5567 : m_gPUSampler(CheckError(SDL_CreateGPUSampler(device, &createinfo)))
5568{
5569}
5570
5577
5578constexpr auto CREATE_NAME_STRING = SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING;
5579
5580} // namespace prop::GPUSampler
5581
5654 const GPUShaderCreateInfo& createinfo)
5655{
5656 return GPUShader(device, createinfo);
5657}
5658
5660{
5661 return GPUShader(get(), createinfo);
5662}
5663
5665 const GPUShaderCreateInfo& createinfo)
5666 : m_gPUShader(CheckError(SDL_CreateGPUShader(device, &createinfo)))
5667{
5668}
5669
5676
5677constexpr auto CREATE_NAME_STRING = SDL_PROP_GPU_SHADER_CREATE_NAME_STRING;
5678
5679} // namespace prop::GPUShader
5680
5740 const GPUTextureCreateInfo& createinfo)
5741{
5742 return GPUTexture(device, createinfo);
5743}
5744
5746 const GPUTextureCreateInfo& createinfo)
5747{
5748 return GPUTexture(get(), createinfo);
5749}
5750
5752 const GPUTextureCreateInfo& createinfo)
5753 : m_gPUTexture(CheckError(SDL_CreateGPUTexture(device, &createinfo)))
5754{
5755}
5756
5763
5764constexpr auto CREATE_D3D12_CLEAR_R_FLOAT =
5765 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT;
5766
5767constexpr auto CREATE_D3D12_CLEAR_G_FLOAT =
5768 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT;
5769
5770constexpr auto CREATE_D3D12_CLEAR_B_FLOAT =
5771 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT;
5772
5773constexpr auto CREATE_D3D12_CLEAR_A_FLOAT =
5774 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT;
5775
5776constexpr auto CREATE_D3D12_CLEAR_DEPTH_FLOAT =
5777 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT;
5778
5779#if SDL_VERSION_ATLEAST(3, 2, 12)
5780
5781constexpr auto CREATE_D3D12_CLEAR_STENCIL_NUMBER =
5782 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_NUMBER;
5783
5784#endif // SDL_VERSION_ATLEAST(3, 2, 12)
5785
5786constexpr auto CREATE_NAME_STRING = SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING;
5787
5788} // namespace prop::GPUTexture
5789
5834 const GPUBufferCreateInfo& createinfo)
5835{
5836 return GPUBuffer(device, createinfo);
5837}
5838
5840{
5841 return GPUBuffer(get(), createinfo);
5842}
5843
5845 const GPUBufferCreateInfo& createinfo)
5846 : m_gPUBuffer(CheckError(SDL_CreateGPUBuffer(device, &createinfo)))
5847{
5848}
5849
5856
5857constexpr auto CREATE_NAME_STRING = SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING;
5858
5859} // namespace prop::GPUBuffer
5860
5889 GPUDeviceRef device,
5890 const GPUTransferBufferCreateInfo& createinfo)
5891{
5892 return GPUTransferBuffer(device, createinfo);
5893}
5894
5896 const GPUTransferBufferCreateInfo& createinfo)
5897{
5898 return GPUTransferBuffer(get(), createinfo);
5899}
5900
5902 GPUDeviceRef device,
5903 const GPUTransferBufferCreateInfo& createinfo)
5904 : m_gPUTransferBuffer(
5905 CheckError(SDL_CreateGPUTransferBuffer(device, &createinfo)))
5906{
5907}
5908
5915
5916constexpr auto CREATE_NAME_STRING =
5917 SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING;
5918
5919} // namespace prop::GPUTransferBuffer
5920
5939 GPUBuffer buffer,
5940 StringParam text)
5941{
5942 SDL_SetGPUBufferName(device, buffer, text);
5943}
5944
5946{
5947 SDL::SetGPUBufferName(get(), buffer, std::move(text));
5948}
5949
5969 GPUTexture texture,
5970 StringParam text)
5971{
5972 SDL_SetGPUTextureName(device, texture, text);
5973}
5974
5976{
5977 SDL::SetGPUTextureName(get(), texture, std::move(text));
5978}
5979
5996inline void InsertGPUDebugLabel(GPUCommandBuffer command_buffer,
5997 StringParam text)
5998{
5999 SDL_InsertGPUDebugLabel(command_buffer, text);
6000}
6001
6003{
6004 SDL::InsertGPUDebugLabel(m_gPUCommandBuffer, std::move(text));
6005}
6006
6034inline void PushGPUDebugGroup(GPUCommandBuffer command_buffer, StringParam name)
6035{
6036 SDL_PushGPUDebugGroup(command_buffer, name);
6037}
6038
6040{
6041 SDL::PushGPUDebugGroup(m_gPUCommandBuffer, std::move(name));
6042}
6043
6059inline void PopGPUDebugGroup(GPUCommandBuffer command_buffer)
6060{
6061 SDL_PopGPUDebugGroup(command_buffer);
6062}
6063
6065{
6066 SDL::PopGPUDebugGroup(m_gPUCommandBuffer);
6067}
6068
6079inline void ReleaseGPUTexture(GPUDeviceRef device, GPUTexture texture)
6080{
6081 SDL_ReleaseGPUTexture(device, texture);
6082}
6083
6085{
6086 SDL::ReleaseGPUTexture(get(), texture);
6087}
6088
6099inline void ReleaseGPUSampler(GPUDeviceRef device, GPUSampler sampler)
6100{
6101 SDL_ReleaseGPUSampler(device, sampler);
6102}
6103
6105{
6106 SDL::ReleaseGPUSampler(get(), sampler);
6107}
6108
6119inline void ReleaseGPUBuffer(GPUDeviceRef device, GPUBuffer buffer)
6120{
6121 SDL_ReleaseGPUBuffer(device, buffer);
6122}
6123
6125{
6126 SDL::ReleaseGPUBuffer(get(), buffer);
6127}
6128
6140 GPUTransferBuffer transfer_buffer)
6141{
6142 SDL_ReleaseGPUTransferBuffer(device, transfer_buffer);
6143}
6144
6146{
6147 SDL::ReleaseGPUTransferBuffer(get(), transfer_buffer);
6148}
6149
6161 GPUComputePipeline compute_pipeline)
6162{
6163 SDL_ReleaseGPUComputePipeline(device, compute_pipeline);
6164}
6165
6167 GPUComputePipeline compute_pipeline)
6168{
6169 SDL::ReleaseGPUComputePipeline(get(), compute_pipeline);
6170}
6171
6182inline void ReleaseGPUShader(GPUDeviceRef device, GPUShader shader)
6183{
6184 SDL_ReleaseGPUShader(device, shader);
6185}
6186
6188{
6189 SDL::ReleaseGPUShader(get(), shader);
6190}
6191
6203 GPUGraphicsPipeline graphics_pipeline)
6204{
6205 SDL_ReleaseGPUGraphicsPipeline(device, graphics_pipeline);
6206}
6207
6209 GPUGraphicsPipeline graphics_pipeline)
6210{
6211 SDL::ReleaseGPUGraphicsPipeline(get(), graphics_pipeline);
6212}
6213
6239{
6240 return CheckError(SDL_AcquireGPUCommandBuffer(device));
6241}
6242
6247
6267 Uint32 slot_index,
6268 SourceBytes data)
6269{
6270 SDL_PushGPUVertexUniformData(
6271 command_buffer, slot_index, data.data(), narrowU32(data.size_bytes()));
6272}
6273
6275 SourceBytes data)
6276{
6278 m_gPUCommandBuffer, slot_index, std::move(data));
6279}
6280
6297 Uint32 slot_index,
6298 SourceBytes data)
6299{
6300 SDL_PushGPUFragmentUniformData(
6301 command_buffer, slot_index, data.data(), narrowU32(data.size_bytes()));
6302}
6303
6305 SourceBytes data)
6306{
6308 m_gPUCommandBuffer, slot_index, std::move(data));
6309}
6310
6327 Uint32 slot_index,
6328 SourceBytes data)
6329{
6330 SDL_PushGPUComputeUniformData(
6331 command_buffer, slot_index, data.data(), narrowU32(data.size_bytes()));
6332}
6333
6335 SourceBytes data)
6336{
6338 m_gPUCommandBuffer, slot_index, std::move(data));
6339}
6340
6373 GPUCommandBuffer command_buffer,
6374 std::span<const GPUColorTargetInfo> color_target_infos,
6375 OptionalRef<const GPUDepthStencilTargetInfo> depth_stencil_target_info)
6376{
6377 return SDL_BeginGPURenderPass(command_buffer,
6378 color_target_infos.data(),
6379 narrowU32(color_target_infos.size()),
6380 depth_stencil_target_info);
6381}
6382
6384 std::span<const GPUColorTargetInfo> color_target_infos,
6385 OptionalRef<const GPUDepthStencilTargetInfo> depth_stencil_target_info)
6386{
6388 m_gPUCommandBuffer, color_target_infos, depth_stencil_target_info);
6389}
6390
6402 GPUGraphicsPipeline graphics_pipeline)
6403{
6404 SDL_BindGPUGraphicsPipeline(render_pass, graphics_pipeline);
6405}
6406
6408{
6409 SDL::BindGPUGraphicsPipeline(m_gPURenderPass, graphics_pipeline);
6410}
6411
6420inline void SetGPUViewport(GPURenderPass render_pass,
6421 const GPUViewport& viewport)
6422{
6423 SDL_SetGPUViewport(render_pass, &viewport);
6424}
6425
6426inline void GPURenderPass::SetViewport(const GPUViewport& viewport)
6427{
6428 SDL::SetGPUViewport(m_gPURenderPass, viewport);
6429}
6430
6439inline void SetGPUScissor(GPURenderPass render_pass, const RectRaw& scissor)
6440{
6441 SDL_SetGPUScissor(render_pass, &scissor);
6442}
6443
6444inline void GPURenderPass::SetScissor(const RectRaw& scissor)
6445{
6446 SDL::SetGPUScissor(m_gPURenderPass, scissor);
6447}
6448
6460inline void SetGPUBlendConstants(GPURenderPass render_pass,
6461 FColorRaw blend_constants)
6462{
6463 SDL_SetGPUBlendConstants(render_pass, blend_constants);
6464}
6465
6467{
6468 SDL::SetGPUBlendConstants(m_gPURenderPass, blend_constants);
6469}
6470
6479inline void SetGPUStencilReference(GPURenderPass render_pass, Uint8 reference)
6480{
6481 SDL_SetGPUStencilReference(render_pass, reference);
6482}
6483
6485{
6486 SDL::SetGPUStencilReference(m_gPURenderPass, reference);
6487}
6488
6499inline void BindGPUVertexBuffers(GPURenderPass render_pass,
6500 Uint32 first_slot,
6501 std::span<const GPUBufferBinding> bindings)
6502{
6503 SDL_BindGPUVertexBuffers(
6504 render_pass, first_slot, bindings.data(), narrowU32(bindings.size()));
6505}
6506
6508 Uint32 first_slot,
6509 std::span<const GPUBufferBinding> bindings)
6510{
6511 SDL::BindGPUVertexBuffers(m_gPURenderPass, first_slot, bindings);
6512}
6513
6524inline void BindGPUIndexBuffer(GPURenderPass render_pass,
6525 const GPUBufferBinding& binding,
6526 GPUIndexElementSize index_element_size)
6527{
6528 SDL_BindGPUIndexBuffer(render_pass, &binding, index_element_size);
6529}
6530
6532 const GPUBufferBinding& binding,
6533 GPUIndexElementSize index_element_size)
6534{
6535 SDL::BindGPUIndexBuffer(m_gPURenderPass, binding, index_element_size);
6536}
6537
6555 GPURenderPass render_pass,
6556 Uint32 first_slot,
6557 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
6558{
6559 SDL_BindGPUVertexSamplers(render_pass,
6560 first_slot,
6561 texture_sampler_bindings.data(),
6562 narrowU32(texture_sampler_bindings.size()));
6563}
6564
6566 Uint32 first_slot,
6567 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
6568{
6570 m_gPURenderPass, first_slot, texture_sampler_bindings);
6571}
6572
6591 GPURenderPass render_pass,
6592 Uint32 first_slot,
6593 SpanRef<const GPUTextureRaw> storage_textures)
6594{
6595 SDL_BindGPUVertexStorageTextures(render_pass,
6596 first_slot,
6597 storage_textures.data(),
6598 narrowU32(storage_textures.size()));
6599}
6600
6602 Uint32 first_slot,
6603 SpanRef<const GPUTextureRaw> storage_textures)
6604{
6606 m_gPURenderPass, first_slot, storage_textures);
6607}
6608
6627 GPURenderPass render_pass,
6628 Uint32 first_slot,
6629 SpanRef<const GPUBufferRaw> storage_buffers)
6630{
6631 SDL_BindGPUVertexStorageBuffers(render_pass,
6632 first_slot,
6633 storage_buffers.data(),
6634 narrowU32(storage_buffers.size()));
6635}
6636
6638 Uint32 first_slot,
6639 SpanRef<const GPUBufferRaw> storage_buffers)
6640{
6642 m_gPURenderPass, first_slot, storage_buffers);
6643}
6644
6662 GPURenderPass render_pass,
6663 Uint32 first_slot,
6664 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
6665{
6666 SDL_BindGPUFragmentSamplers(render_pass,
6667 first_slot,
6668 texture_sampler_bindings.data(),
6669 narrowU32(texture_sampler_bindings.size()));
6670}
6671
6673 Uint32 first_slot,
6674 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
6675{
6677 m_gPURenderPass, first_slot, texture_sampler_bindings);
6678}
6679
6698 GPURenderPass render_pass,
6699 Uint32 first_slot,
6700 SpanRef<const GPUTextureRaw> storage_textures)
6701{
6702 SDL_BindGPUFragmentStorageTextures(render_pass,
6703 first_slot,
6704 storage_textures.data(),
6705 narrowU32(storage_textures.size()));
6706}
6707
6709 Uint32 first_slot,
6710 SpanRef<const GPUTextureRaw> storage_textures)
6711{
6713 m_gPURenderPass, first_slot, storage_textures);
6714}
6715
6734 GPURenderPass render_pass,
6735 Uint32 first_slot,
6736 SpanRef<const GPUBufferRaw> storage_buffers)
6737{
6738 SDL_BindGPUFragmentStorageBuffers(render_pass,
6739 first_slot,
6740 storage_buffers.data(),
6741 narrowU32(storage_buffers.size()));
6742}
6743
6745 Uint32 first_slot,
6746 SpanRef<const GPUBufferRaw> storage_buffers)
6747{
6749 m_gPURenderPass, first_slot, storage_buffers);
6750}
6751
6776 Uint32 num_indices,
6777 Uint32 num_instances,
6778 Uint32 first_index,
6779 Sint32 vertex_offset,
6780 Uint32 first_instance)
6781{
6782 SDL_DrawGPUIndexedPrimitives(render_pass,
6783 num_indices,
6784 num_instances,
6785 first_index,
6786 vertex_offset,
6787 first_instance);
6788}
6789
6791 Uint32 num_instances,
6792 Uint32 first_index,
6793 Sint32 vertex_offset,
6794 Uint32 first_instance)
6795{
6796 SDL::DrawGPUIndexedPrimitives(m_gPURenderPass,
6797 num_indices,
6798 num_instances,
6799 first_index,
6800 vertex_offset,
6801 first_instance);
6802}
6803
6824inline void DrawGPUPrimitives(GPURenderPass render_pass,
6825 Uint32 num_vertices,
6826 Uint32 num_instances,
6827 Uint32 first_vertex,
6828 Uint32 first_instance)
6829{
6830 SDL_DrawGPUPrimitives(
6831 render_pass, num_vertices, num_instances, first_vertex, first_instance);
6832}
6833
6834inline void GPURenderPass::DrawPrimitives(Uint32 num_vertices,
6835 Uint32 num_instances,
6836 Uint32 first_vertex,
6837 Uint32 first_instance)
6838{
6840 m_gPURenderPass, num_vertices, num_instances, first_vertex, first_instance);
6841}
6842
6860 GPUBuffer buffer,
6861 Uint32 offset,
6862 Uint32 draw_count)
6863{
6864 SDL_DrawGPUPrimitivesIndirect(render_pass, buffer, offset, draw_count);
6865}
6866
6868 Uint32 offset,
6869 Uint32 draw_count)
6870{
6871 SDL::DrawGPUPrimitivesIndirect(m_gPURenderPass, buffer, offset, draw_count);
6872}
6873
6891 GPUBuffer buffer,
6892 Uint32 offset,
6893 Uint32 draw_count)
6894{
6895 SDL_DrawGPUIndexedPrimitivesIndirect(render_pass, buffer, offset, draw_count);
6896}
6897
6899 Uint32 offset,
6900 Uint32 draw_count)
6901{
6903 m_gPURenderPass, buffer, offset, draw_count);
6904}
6905
6916inline void EndGPURenderPass(GPURenderPass render_pass)
6917{
6918 SDL_EndGPURenderPass(render_pass);
6919}
6920
6921inline void GPURenderPass::End() { SDL::EndGPURenderPass(m_gPURenderPass); }
6922
6957 GPUCommandBuffer command_buffer,
6958 std::span<const GPUStorageTextureReadWriteBinding> storage_texture_bindings,
6959 std::span<const GPUStorageBufferReadWriteBinding> storage_buffer_bindings)
6960{
6961 return SDL_BeginGPUComputePass(command_buffer,
6962 storage_texture_bindings.data(),
6963 narrowU32(storage_texture_bindings.size()),
6964 storage_buffer_bindings.data(),
6965 narrowU32(storage_buffer_bindings.size()));
6966}
6967
6969 std::span<const GPUStorageTextureReadWriteBinding> storage_texture_bindings,
6970 std::span<const GPUStorageBufferReadWriteBinding> storage_buffer_bindings)
6971{
6973 m_gPUCommandBuffer, storage_texture_bindings, storage_buffer_bindings);
6974}
6975
6985 GPUComputePipeline compute_pipeline)
6986{
6987 SDL_BindGPUComputePipeline(compute_pass, compute_pipeline);
6988}
6989
6991{
6992 SDL::BindGPUComputePipeline(m_gPUComputePass, compute_pipeline);
6993}
6994
7012 GPUComputePass compute_pass,
7013 Uint32 first_slot,
7014 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
7015{
7016 SDL_BindGPUComputeSamplers(compute_pass,
7017 first_slot,
7018 texture_sampler_bindings.data(),
7019 narrowU32(texture_sampler_bindings.size()));
7020}
7021
7023 Uint32 first_slot,
7024 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
7025{
7027 m_gPUComputePass, first_slot, texture_sampler_bindings);
7028}
7029
7048 GPUComputePass compute_pass,
7049 Uint32 first_slot,
7050 SpanRef<const GPUTextureRaw> storage_textures)
7051{
7052 SDL_BindGPUComputeStorageTextures(compute_pass,
7053 first_slot,
7054 storage_textures.data(),
7055 narrowU32(storage_textures.size()));
7056}
7057
7059 Uint32 first_slot,
7060 SpanRef<const GPUTextureRaw> storage_textures)
7061{
7063 m_gPUComputePass, first_slot, storage_textures);
7064}
7065
7084 GPUComputePass compute_pass,
7085 Uint32 first_slot,
7086 SpanRef<const GPUBufferRaw> storage_buffers)
7087{
7088 SDL_BindGPUComputeStorageBuffers(compute_pass,
7089 first_slot,
7090 storage_buffers.data(),
7091 narrowU32(storage_buffers.size()));
7092}
7093
7095 Uint32 first_slot,
7096 SpanRef<const GPUBufferRaw> storage_buffers)
7097{
7099 m_gPUComputePass, first_slot, storage_buffers);
7100}
7101
7122inline void DispatchGPUCompute(GPUComputePass compute_pass,
7123 Uint32 groupcount_x,
7124 Uint32 groupcount_y,
7125 Uint32 groupcount_z)
7126{
7127 SDL_DispatchGPUCompute(
7128 compute_pass, groupcount_x, groupcount_y, groupcount_z);
7129}
7130
7131inline void GPUComputePass::Dispatch(Uint32 groupcount_x,
7132 Uint32 groupcount_y,
7133 Uint32 groupcount_z)
7134{
7136 m_gPUComputePass, groupcount_x, groupcount_y, groupcount_z);
7137}
7138
7157 GPUBuffer buffer,
7158 Uint32 offset)
7159{
7160 SDL_DispatchGPUComputeIndirect(compute_pass, buffer, offset);
7161}
7162
7164{
7165 SDL::DispatchGPUComputeIndirect(m_gPUComputePass, buffer, offset);
7166}
7167
7178inline void EndGPUComputePass(GPUComputePass compute_pass)
7179{
7180 SDL_EndGPUComputePass(compute_pass);
7181}
7182
7183inline void GPUComputePass::End() { SDL::EndGPUComputePass(m_gPUComputePass); }
7184
7201 GPUTransferBuffer transfer_buffer,
7202 bool cycle)
7203{
7204 return CheckError(SDL_MapGPUTransferBuffer(device, transfer_buffer, cycle));
7205}
7206
7208 bool cycle)
7209{
7210 return SDL::MapGPUTransferBuffer(get(), transfer_buffer, cycle);
7211}
7212
7222 GPUTransferBuffer transfer_buffer)
7223{
7224 SDL_UnmapGPUTransferBuffer(device, transfer_buffer);
7225}
7226
7228{
7229 SDL::UnmapGPUTransferBuffer(get(), transfer_buffer);
7230}
7231
7247{
7248 return SDL_BeginGPUCopyPass(command_buffer);
7249}
7250
7252{
7253 return SDL::BeginGPUCopyPass(m_gPUCommandBuffer);
7254}
7255
7273inline void UploadToGPUTexture(GPUCopyPass copy_pass,
7274 const GPUTextureTransferInfo& source,
7275 const GPUTextureRegion& destination,
7276 bool cycle)
7277{
7278 SDL_UploadToGPUTexture(copy_pass, &source, &destination, cycle);
7279}
7280
7282 const GPUTextureRegion& destination,
7283 bool cycle)
7284{
7285 SDL::UploadToGPUTexture(m_gPUCopyPass, source, destination, cycle);
7286}
7287
7302inline void UploadToGPUBuffer(GPUCopyPass copy_pass,
7303 const GPUTransferBufferLocation& source,
7304 const GPUBufferRegion& destination,
7305 bool cycle)
7306{
7307 SDL_UploadToGPUBuffer(copy_pass, &source, &destination, cycle);
7308}
7309
7311 const GPUBufferRegion& destination,
7312 bool cycle)
7313{
7314 SDL::UploadToGPUBuffer(m_gPUCopyPass, source, destination, cycle);
7315}
7316
7338 const GPUTextureLocation& source,
7339 const GPUTextureLocation& destination,
7340 Uint32 w,
7341 Uint32 h,
7342 Uint32 d,
7343 bool cycle)
7344{
7345 SDL_CopyGPUTextureToTexture(copy_pass, &source, &destination, w, h, d, cycle);
7346}
7347
7349 const GPUTextureLocation& source,
7350 const GPUTextureLocation& destination,
7351 Uint32 w,
7352 Uint32 h,
7353 Uint32 d,
7354 bool cycle)
7355{
7357 m_gPUCopyPass, source, destination, w, h, d, cycle);
7358}
7359
7376 const GPUBufferLocation& source,
7377 const GPUBufferLocation& destination,
7378 Uint32 size,
7379 bool cycle)
7380{
7381 SDL_CopyGPUBufferToBuffer(copy_pass, &source, &destination, size, cycle);
7382}
7383
7385 const GPUBufferLocation& source,
7386 const GPUBufferLocation& destination,
7387 Uint32 size,
7388 bool cycle)
7389{
7390 SDL::CopyGPUBufferToBuffer(m_gPUCopyPass, source, destination, size, cycle);
7391}
7392
7407 const GPUTextureRegion& source,
7408 const GPUTextureTransferInfo& destination)
7409{
7410 SDL_DownloadFromGPUTexture(copy_pass, &source, &destination);
7411}
7412
7414 const GPUTextureRegion& source,
7415 const GPUTextureTransferInfo& destination)
7416{
7417 SDL::DownloadFromGPUTexture(m_gPUCopyPass, source, destination);
7418}
7419
7433 const GPUBufferRegion& source,
7434 const GPUTransferBufferLocation& destination)
7435{
7436 SDL_DownloadFromGPUBuffer(copy_pass, &source, &destination);
7437}
7438
7440 const GPUBufferRegion& source,
7441 const GPUTransferBufferLocation& destination)
7442{
7443 SDL::DownloadFromGPUBuffer(m_gPUCopyPass, source, destination);
7444}
7445
7453inline void EndGPUCopyPass(GPUCopyPass copy_pass)
7454{
7455 SDL_EndGPUCopyPass(copy_pass);
7456}
7457
7458inline void GPUCopyPass::End() { SDL::EndGPUCopyPass(m_gPUCopyPass); }
7459
7471 GPUTexture texture)
7472{
7473 SDL_GenerateMipmapsForGPUTexture(command_buffer, texture);
7474}
7475
7477{
7478 SDL::GenerateMipmapsForGPUTexture(m_gPUCommandBuffer, texture);
7479}
7480
7491inline void BlitGPUTexture(GPUCommandBuffer command_buffer,
7492 const GPUBlitInfo& info)
7493{
7494 SDL_BlitGPUTexture(command_buffer, &info);
7495}
7496
7498{
7499 SDL::BlitGPUTexture(m_gPUCommandBuffer, info);
7500}
7501
7517 GPUDeviceRef device,
7518 WindowRef window,
7519 GPUSwapchainComposition swapchain_composition)
7520{
7521 return SDL_WindowSupportsGPUSwapchainComposition(
7522 device, window, swapchain_composition);
7523}
7524
7526 WindowRef window,
7527 GPUSwapchainComposition swapchain_composition)
7528{
7530 get(), window, swapchain_composition);
7531}
7532
7548 WindowRef window,
7549 GPUPresentMode present_mode)
7550{
7551 return SDL_WindowSupportsGPUPresentMode(device, window, present_mode);
7552}
7553
7555 GPUPresentMode present_mode)
7556{
7557 return SDL::WindowSupportsGPUPresentMode(get(), window, present_mode);
7558}
7559
7586{
7587 CheckError(SDL_ClaimWindowForGPUDevice(device, window));
7588}
7589
7591{
7593}
7594
7606{
7607 SDL_ReleaseWindowFromGPUDevice(device, window);
7608}
7609
7611{
7613}
7614
7638 GPUDeviceRef device,
7639 WindowRef window,
7640 GPUSwapchainComposition swapchain_composition,
7641 GPUPresentMode present_mode)
7642{
7643 return SDL_SetGPUSwapchainParameters(
7644 device, window, swapchain_composition, present_mode);
7645}
7646
7648 WindowRef window,
7649 GPUSwapchainComposition swapchain_composition,
7650 GPUPresentMode present_mode)
7651{
7653 get(), window, swapchain_composition, present_mode);
7654}
7655
7682 Uint32 allowed_frames_in_flight)
7683{
7684 return SDL_SetGPUAllowedFramesInFlight(device, allowed_frames_in_flight);
7685}
7686
7687inline bool GPUDevice::SetAllowedFramesInFlight(Uint32 allowed_frames_in_flight)
7688{
7689 return SDL::SetGPUAllowedFramesInFlight(get(), allowed_frames_in_flight);
7690}
7691
7704 WindowRef window)
7705{
7706 return SDL_GetGPUSwapchainTextureFormat(device, window);
7707}
7708
7713
7761 GPUCommandBuffer command_buffer,
7762 WindowRef window,
7763 Uint32* swapchain_texture_width = nullptr,
7764 Uint32* swapchain_texture_height = nullptr)
7765{
7766 GPUTextureRaw texture;
7767 CheckError(SDL_AcquireGPUSwapchainTexture(command_buffer,
7768 window,
7769 &texture,
7770 swapchain_texture_width,
7771 swapchain_texture_height));
7772 return texture;
7773}
7774
7776 WindowRef window,
7777 Uint32* swapchain_texture_width,
7778 Uint32* swapchain_texture_height)
7779{
7780 return SDL::AcquireGPUSwapchainTexture(m_gPUCommandBuffer,
7781 window,
7782 swapchain_texture_width,
7783 swapchain_texture_height);
7784}
7785
7802inline void WaitForGPUSwapchain(GPUDeviceRef device, WindowRef window)
7803{
7804 CheckError(SDL_WaitForGPUSwapchain(device, window));
7805}
7806
7808{
7809 SDL::WaitForGPUSwapchain(get(), window);
7810}
7811
7853 GPUCommandBuffer command_buffer,
7854 WindowRef window,
7855 Uint32* swapchain_texture_width = nullptr,
7856 Uint32* swapchain_texture_height = nullptr)
7857{
7858 GPUTextureRaw texture;
7859 CheckError(SDL_WaitAndAcquireGPUSwapchainTexture(command_buffer,
7860 window,
7861 &texture,
7862 swapchain_texture_width,
7863 swapchain_texture_height));
7864 return texture;
7865}
7866
7868 WindowRef window,
7869 Uint32* swapchain_texture_width,
7870 Uint32* swapchain_texture_height)
7871{
7872 return SDL::WaitAndAcquireGPUSwapchainTexture(m_gPUCommandBuffer,
7873 window,
7874 swapchain_texture_width,
7875 swapchain_texture_height);
7876}
7877
7898inline void SubmitGPUCommandBuffer(GPUCommandBuffer command_buffer)
7899{
7900 CheckError(SDL_SubmitGPUCommandBuffer(command_buffer));
7901}
7902
7904{
7905 SDL::SubmitGPUCommandBuffer(m_gPUCommandBuffer);
7906}
7907
7933 GPUCommandBuffer command_buffer)
7934{
7935 return CheckError(SDL_SubmitGPUCommandBufferAndAcquireFence(command_buffer));
7936}
7937
7942
7964inline void CancelGPUCommandBuffer(GPUCommandBuffer command_buffer)
7965{
7966 CheckError(SDL_CancelGPUCommandBuffer(command_buffer));
7967}
7968
7970{
7971 SDL::CancelGPUCommandBuffer(m_gPUCommandBuffer);
7972}
7973
7984inline void WaitForGPUIdle(GPUDeviceRef device)
7985{
7986 CheckError(SDL_WaitForGPUIdle(device));
7987}
7988
7990
8006 bool wait_all,
8007 std::span<GPUFence* const> fences)
8008{
8009 CheckError(SDL_WaitForGPUFences(
8010 device, wait_all, fences.data(), narrowU32(fences.size())));
8011}
8012
8013inline void GPUDevice::WaitForFences(bool wait_all,
8014 std::span<GPUFence* const> fences)
8015{
8016 SDL::WaitForGPUFences(get(), wait_all, fences);
8017}
8018
8030inline bool QueryGPUFence(GPUDeviceRef device, GPUFence* fence)
8031{
8032 return SDL_QueryGPUFence(device, fence);
8033}
8034
8036{
8037 return SDL::QueryGPUFence(get(), fence);
8038}
8039
8052inline void ReleaseGPUFence(GPUDeviceRef device, GPUFence* fence)
8053{
8054 SDL_ReleaseGPUFence(device, fence);
8055}
8056
8058{
8059 SDL::ReleaseGPUFence(get(), fence);
8060}
8061
8073{
8074 return SDL_GPUTextureFormatTexelBlockSize(format);
8075}
8076
8089 GPUTextureFormat format,
8090 GPUTextureType type,
8092{
8093 return SDL_GPUTextureSupportsFormat(device, format, type, usage);
8094}
8095
8097 GPUTextureType type,
8099{
8100 return SDL::GPUTextureSupportsFormat(get(), format, type, usage);
8101}
8102
8114 GPUTextureFormat format,
8115 GPUSampleCount sample_count)
8116{
8117 return SDL_GPUTextureSupportsSampleCount(device, format, sample_count);
8118}
8119
8121 GPUSampleCount sample_count)
8122{
8123 return SDL::GPUTextureSupportsSampleCount(get(), format, sample_count);
8124}
8125
8138 Uint32 width,
8139 Uint32 height,
8140 Uint32 depth_or_layer_count)
8141{
8142 return SDL_CalculateGPUTextureFormatSize(
8143 format, width, height, depth_or_layer_count);
8144}
8145
8146#if SDL_VERSION_ATLEAST(3, 4, 0)
8147
8158{
8159 return SDL_GetPixelFormatFromGPUTextureFormat(format);
8160}
8161
8172{
8173 return SDL_GetGPUTextureFormatFromPixelFormat(format);
8174}
8175
8176#endif // SDL_VERSION_ATLEAST(3, 4, 0)
8177
8178#ifdef SDL_PLATFORM_GDK
8179
8193inline void GDKSuspendGPU(GPUDeviceRef device) { SDL_GDKSuspendGPU(device); }
8194
8196
8210inline void GDKResumeGPU(GPUDeviceRef device) { SDL_GDKResumeGPU(device); }
8211
8213
8214#endif /* SDL_PLATFORM_GDK */
8215
8217
8218} // namespace SDL
8219
8220#endif /* SDL3PP_GPU_H_ */
An opaque handle representing a buffer.
Definition SDL3pp_gpu.h:489
constexpr GPUBuffer(GPUBufferRaw gPUBuffer={}) noexcept
Wraps GPUBuffer.
Definition SDL3pp_gpu.h:498
An opaque handle representing a command buffer.
Definition SDL3pp_gpu.h:2036
constexpr GPUCommandBuffer(GPUCommandBufferRaw gPUCommandBuffer={}) noexcept
Wraps GPUCommandBuffer.
Definition SDL3pp_gpu.h:2045
An opaque handle representing a compute pass.
Definition SDL3pp_gpu.h:1508
constexpr GPUComputePass(GPUComputePassRaw gPUComputePass={}) noexcept
Wraps GPUComputePass.
Definition SDL3pp_gpu.h:1517
An opaque handle representing a compute pipeline.
Definition SDL3pp_gpu.h:968
constexpr GPUComputePipeline(GPUComputePipelineRaw gPUComputePipeline={}) noexcept
Wraps GPUComputePipeline.
Definition SDL3pp_gpu.h:977
An opaque handle representing a copy pass.
Definition SDL3pp_gpu.h:1743
constexpr GPUCopyPass(GPUCopyPassRaw gPUCopyPass={}) noexcept
Wraps GPUCopyPass.
Definition SDL3pp_gpu.h:1752
An opaque handle representing a graphics pipeline.
Definition SDL3pp_gpu.h:1070
constexpr GPUGraphicsPipeline(GPUGraphicsPipelineRaw gPUGraphicsPipeline={}) noexcept
Wraps GPUGraphicsPipeline.
Definition SDL3pp_gpu.h:1079
An opaque handle representing a render pass.
Definition SDL3pp_gpu.h:1178
constexpr GPURenderPass(GPURenderPassRaw gPURenderPass={}) noexcept
Wraps GPURenderPass.
Definition SDL3pp_gpu.h:1187
An opaque handle representing a sampler.
Definition SDL3pp_gpu.h:783
constexpr GPUSampler(GPUSamplerRaw gPUSampler={}) noexcept
Wraps GPUSampler.
Definition SDL3pp_gpu.h:792
An opaque handle representing a compiled shader object.
Definition SDL3pp_gpu.h:849
constexpr GPUShader(GPUShaderRaw gPUShader={}) noexcept
Wraps GPUShader.
Definition SDL3pp_gpu.h:858
An opaque handle representing a texture.
Definition SDL3pp_gpu.h:674
constexpr GPUTexture(GPUTextureRaw gPUTexture={}) noexcept
Wraps GPUTexture.
Definition SDL3pp_gpu.h:683
An opaque handle representing a transfer buffer.
Definition SDL3pp_gpu.h:582
constexpr GPUTransferBuffer(GPUTransferBufferRaw gPUTransferBuffer={}) noexcept
Wraps GPUTransferBuffer.
Definition SDL3pp_gpu.h:591
Optional-like shim for references.
Definition SDL3pp_optionalRef.h:20
Pixel format.
Definition SDL3pp_pixels.h:358
constexpr RawPointer get() const noexcept
Definition SDL3pp_resource.h:53
constexpr RawPointer release() noexcept
Definition SDL3pp_resource.h:56
constexpr ResourceBase(RawPointer resource)
Constructs from resource pointer.
Definition SDL3pp_resource.h:29
Source byte stream.
Definition SDL3pp_strings.h:237
constexpr size_t size_bytes() const
Retrieves contained size in bytes.
Definition SDL3pp_strings.h:301
constexpr const char * data() const
Retrieves contained data.
Definition SDL3pp_strings.h:304
span-like for empty-derived structs
Definition SDL3pp_spanRef.h:24
constexpr T * data() const
Retrieves contained data.
Definition SDL3pp_spanRef.h:75
constexpr size_t size() const
Retrieves contained size.
Definition SDL3pp_spanRef.h:69
Helpers to use C++ strings parameters.
Definition SDL3pp_strings.h:43
constexpr void CheckError(bool result)
Check and throw if returned value from SDL is an error.
Definition SDL3pp_error.h:199
void Destroy()
Destroys a GPU context previously returned by CreateGPUDevice.
Definition SDL3pp_gpu.h:5216
GPUGraphicsPipeline CreateGPUGraphicsPipeline(GPUDeviceRef device, const GPUGraphicsPipelineCreateInfo &createinfo)
Creates a pipeline object to be used in a graphics workflow.
Definition SDL3pp_gpu.h:5499
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UINT
GPU_VERTEXELEMENTFORMAT_UINT.
Definition SDL3pp_gpu.h:4310
SDL_GPUPresentMode GPUPresentMode
Specifies the timing that will be used to present swapchain textures to the OS.
Definition SDL3pp_gpu.h:2537
constexpr GPUShaderFormat GPU_SHADERFORMAT_DXIL
DXIL SM6_0 shaders for D3D12.
Definition SDL3pp_gpu.h:2464
void Dispatch(Uint32 groupcount_x, Uint32 groupcount_y, Uint32 groupcount_z)
Dispatches compute work.
Definition SDL3pp_gpu.h:7131
void PushComputeUniformData(Uint32 slot_index, SourceBytes data)
Pushes data to a uniform slot on the command buffer.
Definition SDL3pp_gpu.h:6334
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_12x12_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_12x12_UNORM_SRGB.
Definition SDL3pp_gpu.h:2902
constexpr GPUFillMode GPU_FILLMODE_FILL
Polygons will be rendered via rasterization.
Definition SDL3pp_gpu.h:4414
SDL_GPUTransferBufferUsage GPUTransferBufferUsage
Specifies how a transfer buffer is intended to be used by the client.
Definition SDL3pp_gpu.h:4263
constexpr GPUShaderFormat GPU_SHADERFORMAT_PRIVATE
Shaders for NDA'd platforms.
Definition SDL3pp_gpu.h:2455
constexpr GPUCompareOp GPU_COMPAREOP_LESS_OR_EQUAL
The comparison evaluates reference <= test.
Definition SDL3pp_gpu.h:4479
constexpr GPUSwapchainComposition GPU_SWAPCHAINCOMPOSITION_HDR10_ST2084
GPU_SWAPCHAINCOMPOSITION_HDR10_ST2084.
Definition SDL3pp_gpu.h:2509
const char * GetDriver()
Returns the name of the backend used to create this GPU context.
Definition SDL3pp_gpu.h:5261
int GetNumGPUDrivers()
Get the number of GPU drivers compiled into SDL.
Definition SDL3pp_gpu.h:5227
void PushGPUFragmentUniformData(GPUCommandBuffer command_buffer, Uint32 slot_index, SourceBytes data)
Pushes data to a fragment uniform slot on the command buffer.
Definition SDL3pp_gpu.h:6296
constexpr GPUIndexElementSize GPU_INDEXELEMENTSIZE_32BIT
The index elements are 32-bit.
Definition SDL3pp_gpu.h:1151
GPUDevice CreateGPUDeviceWithProperties(PropertiesRef props)
Creates a GPU context.
Definition SDL3pp_gpu.h:5061
void BindGPUFragmentStorageTextures(GPURenderPass render_pass, Uint32 first_slot, SpanRef< const GPUTextureRaw > storage_textures)
Binds storage textures for use on the fragment shader.
Definition SDL3pp_gpu.h:6697
SDL_GPUCompareOp GPUCompareOp
Specifies a comparison operator for depth, stencil and sampler operations.
Definition SDL3pp_gpu.h:4465
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_6x6_FLOAT
GPU_TEXTUREFORMAT_ASTC_6x6_FLOAT.
Definition SDL3pp_gpu.h:2917
constexpr GPUStencilOp GPU_STENCILOP_ZERO
Sets the value to 0.
Definition SDL3pp_gpu.h:4512
constexpr GPUCompareOp GPU_COMPAREOP_ALWAYS
The comparison always evaluates true.
Definition SDL3pp_gpu.h:4493
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8_UNORM
GPU_TEXTUREFORMAT_R8_UNORM.
Definition SDL3pp_gpu.h:2638
SDL_GPUCullMode GPUCullMode
Specifies the facing direction in which triangle faces will be culled.
Definition SDL3pp_gpu.h:4427
constexpr GPUBlendOp GPU_BLENDOP_MIN
min(source, destination)
Definition SDL3pp_gpu.h:4563
void DrawGPUIndexedPrimitivesIndirect(GPURenderPass render_pass, GPUBuffer buffer, Uint32 offset, Uint32 draw_count)
Draws data using bound graphics state with an index buffer enabled and with draw parameters set from ...
Definition SDL3pp_gpu.h:6890
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_FLOAT2
GPU_VERTEXELEMENTFORMAT_FLOAT2.
Definition SDL3pp_gpu.h:4325
void WaitForFences(bool wait_all, std::span< GPUFence *const > fences)
Blocks the thread until the given fences are signaled.
Definition SDL3pp_gpu.h:8013
void CopyGPUTextureToTexture(GPUCopyPass copy_pass, const GPUTextureLocation &source, const GPUTextureLocation &destination, Uint32 w, Uint32 h, Uint32 d, bool cycle)
Performs a texture-to-texture copy.
Definition SDL3pp_gpu.h:7337
SDL_GPUTransferBufferCreateInfo GPUTransferBufferCreateInfo
A structure specifying the parameters of a transfer buffer.
Definition SDL3pp_gpu.h:563
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32G32_FLOAT
GPU_TEXTUREFORMAT_R32G32_FLOAT.
Definition SDL3pp_gpu.h:2725
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE
Texture supports reads and writes in the same compute shader.
Definition SDL3pp_gpu.h:3020
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_USHORT2_NORM
GPU_VERTEXELEMENTFORMAT_USHORT2_NORM.
Definition SDL3pp_gpu.h:4376
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8_INT
GPU_TEXTUREFORMAT_R8G8_INT.
Definition SDL3pp_gpu.h:2764
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_6x6_UNORM
GPU_TEXTUREFORMAT_ASTC_6x6_UNORM.
Definition SDL3pp_gpu.h:2833
Uint32 GPUShaderFormat
Specifies the format of shader code.
Definition SDL3pp_gpu.h:2450
void ReleaseGPUShader(GPUDeviceRef device, GPUShader shader)
Frees the given shader as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6182
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16B16A16_INT
GPU_TEXTUREFORMAT_R16G16B16A16_INT.
Definition SDL3pp_gpu.h:2776
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_12x12_UNORM
GPU_TEXTUREFORMAT_ASTC_12x12_UNORM.
Definition SDL3pp_gpu.h:2860
void BlitGPUTexture(GPUCommandBuffer command_buffer, const GPUBlitInfo &info)
Blits from a source texture region to a destination texture region.
Definition SDL3pp_gpu.h:7491
GPUFence * SubmitGPUCommandBufferAndAcquireFence(GPUCommandBuffer command_buffer)
Submits a command buffer so its commands can be processed on the GPU, and acquires a fence associated...
Definition SDL3pp_gpu.h:7932
SDL_GPUCubeMapFace GPUCubeMapFace
Specifies the face of a cube map.
Definition SDL3pp_gpu.h:4193
SDL_GPUFence GPUFence
An opaque handle representing a fence.
Definition SDL3pp_gpu.h:2010
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_4x4_FLOAT
GPU_TEXTUREFORMAT_ASTC_4x4_FLOAT.
Definition SDL3pp_gpu.h:2905
constexpr GPUStencilOp GPU_STENCILOP_INVERT
Bitwise-inverts the current value.
Definition SDL3pp_gpu.h:4526
PixelFormat GetPixelFormatFromGPUTextureFormat(GPUTextureFormat format)
Get the SDL pixel format corresponding to a GPU texture format.
Definition SDL3pp_gpu.h:8157
constexpr GPUFrontFace GPU_FRONTFACE_CLOCKWISE
A triangle with clockwise vertex winding will be considered front-facing.
Definition SDL3pp_gpu.h:4456
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_D32_FLOAT
GPU_TEXTUREFORMAT_D32_FLOAT.
Definition SDL3pp_gpu.h:2812
SDL_GPUTexture * GPUTextureRaw
Alias to raw representation for GPUTexture.
Definition SDL3pp_gpu.h:401
SDL_GPUShaderStage GPUShaderStage
Specifies which stage a shader program corresponds to.
Definition SDL3pp_gpu.h:4278
bool SetAllowedFramesInFlight(Uint32 allowed_frames_in_flight)
Configures the maximum allowed number of frames in flight.
Definition SDL3pp_gpu.h:7687
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_FLOAT3
GPU_VERTEXELEMENTFORMAT_FLOAT3.
Definition SDL3pp_gpu.h:4328
constexpr GPUCompareOp GPU_COMPAREOP_GREATER_OR_EQUAL
The comparison evaluates reference >= test.
Definition SDL3pp_gpu.h:4489
void ReleaseShader(GPUShader shader)
Frees the given shader as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6187
SDL_GPUVertexAttribute GPUVertexAttribute
A structure specifying a vertex attribute.
Definition SDL3pp_gpu.h:4778
bool WindowSupportsPresentMode(WindowRef window, GPUPresentMode present_mode)
Determines whether a presentation mode is supported by the window.
Definition SDL3pp_gpu.h:7554
void ReleaseTransferBuffer(GPUTransferBuffer transfer_buffer)
Frees the given transfer buffer as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6145
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x6_FLOAT
GPU_TEXTUREFORMAT_ASTC_8x6_FLOAT.
Definition SDL3pp_gpu.h:2923
void DrawIndexedPrimitives(Uint32 num_indices, Uint32 num_instances, Uint32 first_index, Sint32 vertex_offset, Uint32 first_instance)
Draws data using bound graphics state with an index buffer and instancing enabled.
Definition SDL3pp_gpu.h:6790
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UBYTE2
GPU_VERTEXELEMENTFORMAT_UBYTE2.
Definition SDL3pp_gpu.h:4340
SDL_GPUTextureFormat GPUTextureFormat
Specifies the pixel format of a texture.
Definition SDL3pp_gpu.h:2630
void BindGPUVertexStorageTextures(GPURenderPass render_pass, Uint32 first_slot, SpanRef< const GPUTextureRaw > storage_textures)
Binds storage textures for use on the vertex shader.
Definition SDL3pp_gpu.h:6590
constexpr GPUPrimitiveType GPU_PRIMITIVETYPE_LINELIST
A series of separate lines.
Definition SDL3pp_gpu.h:4121
GPUSampler CreateSampler(const GPUSamplerCreateInfo &createinfo)
Creates a sampler object to be used when binding textures in a graphics workflow.
Definition SDL3pp_gpu.h:5559
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_USHORT4_NORM
GPU_VERTEXELEMENTFORMAT_USHORT4_NORM.
Definition SDL3pp_gpu.h:4379
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32_UINT
GPU_TEXTUREFORMAT_R32_UINT.
Definition SDL3pp_gpu.h:2752
void PushGPUDebugGroup(GPUCommandBuffer command_buffer, StringParam name)
Begins a debug group with an arbitrary name.
Definition SDL3pp_gpu.h:6034
void * MapTransferBuffer(GPUTransferBuffer transfer_buffer, bool cycle)
Maps a transfer buffer into application address space.
Definition SDL3pp_gpu.h:7207
void ReleaseWindow(WindowRef window)
Unclaims a window, destroying its swapchain structure.
Definition SDL3pp_gpu.h:7610
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x6_UNORM
GPU_TEXTUREFORMAT_ASTC_8x6_UNORM.
Definition SDL3pp_gpu.h:2839
SDL_GPUFillMode GPUFillMode
Specifies the fill mode of the graphics pipeline.
Definition SDL3pp_gpu.h:4412
void SetGPUViewport(GPURenderPass render_pass, const GPUViewport &viewport)
Sets the current viewport state on a command buffer.
Definition SDL3pp_gpu.h:6420
constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR
1 - blend constant
Definition SDL3pp_gpu.h:4616
GPUComputePipeline CreateComputePipeline(const GPUComputePipelineCreateInfo &createinfo)
Creates a pipeline object to be used in a compute workflow.
Definition SDL3pp_gpu.h:5452
void SetScissor(const RectRaw &scissor)
Sets the current scissor state on a command buffer.
Definition SDL3pp_gpu.h:6444
bool TextureSupportsFormat(GPUTextureFormat format, GPUTextureType type, GPUTextureUsageFlags usage)
Determines whether a texture format is supported for a given type and usage.
Definition SDL3pp_gpu.h:8096
constexpr GPUCompareOp GPU_COMPAREOP_NOT_EQUAL
The comparison evaluates reference != test.
Definition SDL3pp_gpu.h:4486
SDL_GPUGraphicsPipelineTargetInfo GPUGraphicsPipelineTargetInfo
A structure specifying the descriptions of render targets used in a graphics pipeline.
Definition SDL3pp_gpu.h:4871
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_USHORT2
GPU_VERTEXELEMENTFORMAT_USHORT2.
Definition SDL3pp_gpu.h:4364
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16B16A16_UNORM
GPU_TEXTUREFORMAT_R16G16B16A16_UNORM.
Definition SDL3pp_gpu.h:2653
SDL_GPUViewport GPUViewport
A structure specifying a viewport.
Definition SDL3pp_gpu.h:1127
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16_UINT
GPU_TEXTUREFORMAT_R16G16_UINT.
Definition SDL3pp_gpu.h:2746
SDL_GPUColorTargetInfo GPUColorTargetInfo
A structure specifying the parameters of a color target used by a render pass.
Definition SDL3pp_gpu.h:1920
void CancelGPUCommandBuffer(GPUCommandBuffer command_buffer)
Cancels a command buffer.
Definition SDL3pp_gpu.h:7964
SDL_GPUIndexElementSize GPUIndexElementSize
Specifies the size of elements in an index buffer.
Definition SDL3pp_gpu.h:1146
SDL_GPUSamplerCreateInfo GPUSamplerCreateInfo
A structure specifying the parameters of a sampler.
Definition SDL3pp_gpu.h:770
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x8_UNORM
GPU_TEXTUREFORMAT_ASTC_10x8_UNORM.
Definition SDL3pp_gpu.h:2851
constexpr GPUPrimitiveType GPU_PRIMITIVETYPE_TRIANGLELIST
A series of separate triangles.
Definition SDL3pp_gpu.h:4115
bool QueryGPUFence(GPUDeviceRef device, GPUFence *fence)
Checks the status of a fence.
Definition SDL3pp_gpu.h:8030
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_A8_UNORM
GPU_TEXTUREFORMAT_A8_UNORM.
Definition SDL3pp_gpu.h:2635
bool SetSwapchainParameters(WindowRef window, GPUSwapchainComposition swapchain_composition, GPUPresentMode present_mode)
Changes the swapchain parameters for the given claimed window.
Definition SDL3pp_gpu.h:7647
PropertiesRef GetProperties()
Get the properties associated with a GPU device.
Definition SDL3pp_gpu.h:5393
void ReleaseGPUTransferBuffer(GPUDeviceRef device, GPUTransferBuffer transfer_buffer)
Frees the given transfer buffer as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6139
void * MapGPUTransferBuffer(GPUDeviceRef device, GPUTransferBuffer transfer_buffer, bool cycle)
Maps a transfer buffer into application address space.
Definition SDL3pp_gpu.h:7200
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_INT4
GPU_VERTEXELEMENTFORMAT_INT4.
Definition SDL3pp_gpu.h:4307
SDL_GPUGraphicsPipelineCreateInfo GPUGraphicsPipelineCreateInfo
A structure specifying the parameters of a graphics pipeline state.
Definition SDL3pp_gpu.h:1056
GPUTexture WaitAndAcquireGPUSwapchainTexture(GPUCommandBuffer command_buffer, WindowRef window, Uint32 *swapchain_texture_width=nullptr, Uint32 *swapchain_texture_height=nullptr)
Blocks the thread until a swapchain texture is available to be acquired, and then acquires it.
Definition SDL3pp_gpu.h:7852
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_5x5_FLOAT
GPU_TEXTUREFORMAT_ASTC_5x5_FLOAT.
Definition SDL3pp_gpu.h:2911
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32_FLOAT
GPU_TEXTUREFORMAT_R32_FLOAT.
Definition SDL3pp_gpu.h:2722
constexpr GPUStoreOp GPU_STOREOP_RESOLVE
The multisample contents generated during the render pass will be resolved to a non-multisample textu...
Definition SDL3pp_gpu.h:4176
void WaitForSwapchain(WindowRef window)
Blocks the thread until a swapchain texture is available to be acquired.
Definition SDL3pp_gpu.h:7807
constexpr GPUSamplerAddressMode GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE
Specifies that the coordinates will clamp to the 0-1 range.
Definition SDL3pp_gpu.h:4693
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16_UNORM
GPU_TEXTUREFORMAT_R16G16_UNORM.
Definition SDL3pp_gpu.h:2650
bool SetGPUAllowedFramesInFlight(GPUDeviceRef device, Uint32 allowed_frames_in_flight)
Configures the maximum allowed number of frames in flight.
Definition SDL3pp_gpu.h:7681
void DrawGPUPrimitives(GPURenderPass render_pass, Uint32 num_vertices, Uint32 num_instances, Uint32 first_vertex, Uint32 first_instance)
Draws data using bound graphics state.
Definition SDL3pp_gpu.h:6824
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x6_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_8x6_UNORM_SRGB.
Definition SDL3pp_gpu.h:2881
void BindSamplers(Uint32 first_slot, std::span< const GPUTextureSamplerBinding > texture_sampler_bindings)
Binds texture-sampler pairs for use on the compute shader.
Definition SDL3pp_gpu.h:7022
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_6x5_FLOAT
GPU_TEXTUREFORMAT_ASTC_6x5_FLOAT.
Definition SDL3pp_gpu.h:2914
SDL_GPUTextureLocation GPUTextureLocation
A structure specifying a location in a texture.
Definition SDL3pp_gpu.h:1670
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC1_RGBA_UNORM
GPU_TEXTUREFORMAT_BC1_RGBA_UNORM.
Definition SDL3pp_gpu.h:2671
void BlitTexture(const GPUBlitInfo &info)
Blits from a source texture region to a destination texture region.
Definition SDL3pp_gpu.h:7497
void DownloadFromTexture(const GPUTextureRegion &source, const GPUTextureTransferInfo &destination)
Copies data from a texture to a transfer buffer on the GPU timeline.
Definition SDL3pp_gpu.h:7413
void BindFragmentSamplers(Uint32 first_slot, std::span< const GPUTextureSamplerBinding > texture_sampler_bindings)
Binds texture-sampler pairs for use on the fragment shader.
Definition SDL3pp_gpu.h:6672
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32G32_UINT
GPU_TEXTUREFORMAT_R32G32_UINT.
Definition SDL3pp_gpu.h:2755
void BindGPUIndexBuffer(GPURenderPass render_pass, const GPUBufferBinding &binding, GPUIndexElementSize index_element_size)
Binds an index buffer on a command buffer for use with subsequent draw calls.
Definition SDL3pp_gpu.h:6524
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC3_RGBA_UNORM
GPU_TEXTUREFORMAT_BC3_RGBA_UNORM.
Definition SDL3pp_gpu.h:2677
Uint32 GPUTextureFormatTexelBlockSize(GPUTextureFormat format)
Obtains the texel block size for a texture format.
Definition SDL3pp_gpu.h:8072
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ
Texture supports storage reads in graphics stages.
Definition SDL3pp_gpu.h:3003
void BindStorageBuffers(Uint32 first_slot, SpanRef< const GPUBufferRaw > storage_buffers)
Binds storage buffers as readonly for use on the compute pipeline.
Definition SDL3pp_gpu.h:7094
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_SHORT2
GPU_VERTEXELEMENTFORMAT_SHORT2.
Definition SDL3pp_gpu.h:4358
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8_SNORM
GPU_TEXTUREFORMAT_R8_SNORM.
Definition SDL3pp_gpu.h:2695
SDL_GPUBlendOp GPUBlendOp
Specifies the operator to be used when pixels in a render target are blended with existing pixels in ...
Definition SDL3pp_gpu.h:4548
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_SAMPLER
Texture supports sampling.
Definition SDL3pp_gpu.h:2993
GPUCommandBuffer AcquireCommandBuffer()
Acquire a command buffer.
Definition SDL3pp_gpu.h:6243
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x8_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_10x8_UNORM_SRGB.
Definition SDL3pp_gpu.h:2893
void Cancel()
Cancels a command buffer.
Definition SDL3pp_gpu.h:7969
SDL_GPUStorageTextureReadWriteBinding GPUStorageTextureReadWriteBinding
A structure specifying parameters related to binding textures in a compute pass.
Definition SDL3pp_gpu.h:1979
GPUTexture AcquireGPUSwapchainTexture(GPUCommandBuffer command_buffer, WindowRef window, Uint32 *swapchain_texture_width=nullptr, Uint32 *swapchain_texture_height=nullptr)
Acquire a texture to use in presentation.
Definition SDL3pp_gpu.h:7760
SDL_GPUColorTargetDescription GPUColorTargetDescription
A structure specifying the parameters of color targets used in a graphics pipeline.
Definition SDL3pp_gpu.h:4859
constexpr GPUColorComponentFlags GPU_COLORCOMPONENT_A
the alpha component
Definition SDL3pp_gpu.h:4641
constexpr GPUBufferUsageFlags GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE
Buffer supports storage writes in the compute stage.
Definition SDL3pp_gpu.h:4250
constexpr GPUSamplerMipmapMode GPU_SAMPLERMIPMAPMODE_LINEAR
Linear filtering.
Definition SDL3pp_gpu.h:4671
bool GPUTextureSupportsSampleCount(GPUDeviceRef device, GPUTextureFormat format, GPUSampleCount sample_count)
Determines if a sample count for a texture format is supported.
Definition SDL3pp_gpu.h:8113
constexpr GPUShaderFormat GPU_SHADERFORMAT_DXBC
DXBC SM5_1 shaders for D3D12.
Definition SDL3pp_gpu.h:2461
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x6_FLOAT
GPU_TEXTUREFORMAT_ASTC_10x6_FLOAT.
Definition SDL3pp_gpu.h:2932
void SetStencilReference(Uint8 reference)
Sets the current stencil reference value on a command buffer.
Definition SDL3pp_gpu.h:6484
bool WindowSupportsGPUSwapchainComposition(GPUDeviceRef device, WindowRef window, GPUSwapchainComposition swapchain_composition)
Determines whether a swapchain composition is supported by the window.
Definition SDL3pp_gpu.h:7516
GPUShaderFormat GetGPUShaderFormats(GPUDeviceRef device)
Returns the supported shader formats for this GPU context.
Definition SDL3pp_gpu.h:5275
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R11G11B10_UFLOAT
GPU_TEXTUREFORMAT_R11G11B10_UFLOAT.
Definition SDL3pp_gpu.h:2731
GPUBuffer CreateGPUBuffer(GPUDeviceRef device, const GPUBufferCreateInfo &createinfo)
Creates a buffer object to be used in graphics or compute workflows.
Definition SDL3pp_gpu.h:5833
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_COLOR_TARGET
Texture is a color render target.
Definition SDL3pp_gpu.h:2996
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_INT
GPU_VERTEXELEMENTFORMAT_INT.
Definition SDL3pp_gpu.h:4298
GPUTextureFormat GetGPUTextureFormatFromPixelFormat(PixelFormat format)
Get the GPU texture format corresponding to an SDL pixel format.
Definition SDL3pp_gpu.h:8171
GPUTexture AcquireSwapchainTexture(WindowRef window, Uint32 *swapchain_texture_width=nullptr, Uint32 *swapchain_texture_height=nullptr)
Acquire a texture to use in presentation.
Definition SDL3pp_gpu.h:7775
constexpr GPUStencilOp GPU_STENCILOP_REPLACE
Sets the value to reference.
Definition SDL3pp_gpu.h:4515
SDL_GPUDepthStencilTargetInfo GPUDepthStencilTargetInfo
A structure specifying the parameters of a depth-stencil target used by a render pass.
Definition SDL3pp_gpu.h:1969
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16_INT
GPU_TEXTUREFORMAT_R16_INT.
Definition SDL3pp_gpu.h:2770
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT
GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT.
Definition SDL3pp_gpu.h:2815
void BindFragmentStorageTextures(Uint32 first_slot, SpanRef< const GPUTextureRaw > storage_textures)
Binds storage textures for use on the fragment shader.
Definition SDL3pp_gpu.h:6708
SDL_GPUTextureRegion GPUTextureRegion
A structure specifying a region of a texture.
Definition SDL3pp_gpu.h:1694
bool QueryFence(GPUFence *fence)
Checks the status of a fence.
Definition SDL3pp_gpu.h:8035
void UploadToBuffer(const GPUTransferBufferLocation &source, const GPUBufferRegion &destination, bool cycle)
Uploads data from a transfer buffer to a buffer.
Definition SDL3pp_gpu.h:7310
constexpr GPUBlendFactor GPU_BLENDFACTOR_DST_COLOR
destination color
Definition SDL3pp_gpu.h:4595
SDL_GPUTextureTransferInfo GPUTextureTransferInfo
A structure specifying parameters related to transferring data to or from a texture.
Definition SDL3pp_gpu.h:1717
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT
GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT.
Definition SDL3pp_gpu.h:2719
void ReleaseComputePipeline(GPUComputePipeline compute_pipeline)
Frees the given compute pipeline as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6166
void BindVertexSamplers(Uint32 first_slot, std::span< const GPUTextureSamplerBinding > texture_sampler_bindings)
Binds texture-sampler pairs for use on the vertex shader.
Definition SDL3pp_gpu.h:6565
void DrawPrimitivesIndirect(GPUBuffer buffer, Uint32 offset, Uint32 draw_count)
Draws data using bound graphics state and with draw parameters set from a buffer.
Definition SDL3pp_gpu.h:6867
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_FLOAT4
GPU_VERTEXELEMENTFORMAT_FLOAT4.
Definition SDL3pp_gpu.h:4331
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x10_FLOAT
GPU_TEXTUREFORMAT_ASTC_10x10_FLOAT.
Definition SDL3pp_gpu.h:2938
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_6x5_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_6x5_UNORM_SRGB.
Definition SDL3pp_gpu.h:2872
GPUBuffer CreateBuffer(const GPUBufferCreateInfo &createinfo)
Creates a buffer object to be used in graphics or compute workflows.
Definition SDL3pp_gpu.h:5839
SDL_GPUGraphicsPipeline * GPUGraphicsPipelineRaw
Alias to raw representation for GPUGraphicsPipeline.
Definition SDL3pp_gpu.h:425
GPUCopyPass BeginCopyPass()
Begins a copy pass on a command buffer.
Definition SDL3pp_gpu.h:7251
SDL_GPUBufferRegion GPUBufferRegion
A structure specifying a region of a buffer.
Definition SDL3pp_gpu.h:1659
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x8_FLOAT
GPU_TEXTUREFORMAT_ASTC_10x8_FLOAT.
Definition SDL3pp_gpu.h:2935
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32G32_INT
GPU_TEXTUREFORMAT_R32G32_INT.
Definition SDL3pp_gpu.h:2782
void ReleaseGPUTexture(GPUDeviceRef device, GPUTexture texture)
Frees the given texture as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6079
constexpr GPUBlendOp GPU_BLENDOP_INVALID
GPU_BLENDOP_INVALID.
Definition SDL3pp_gpu.h:4550
constexpr GPUSwapchainComposition GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR
GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR.
Definition SDL3pp_gpu.h:2506
GPURenderPass BeginGPURenderPass(GPUCommandBuffer command_buffer, std::span< const GPUColorTargetInfo > color_target_infos, OptionalRef< const GPUDepthStencilTargetInfo > depth_stencil_target_info)
Begins a render pass on a command buffer.
Definition SDL3pp_gpu.h:6372
void BindVertexStorageTextures(Uint32 first_slot, SpanRef< const GPUTextureRaw > storage_textures)
Binds storage textures for use on the vertex shader.
Definition SDL3pp_gpu.h:6601
void DrawGPUIndexedPrimitives(GPURenderPass render_pass, Uint32 num_indices, Uint32 num_instances, Uint32 first_index, Sint32 vertex_offset, Uint32 first_instance)
Draws data using bound graphics state with an index buffer and instancing enabled.
Definition SDL3pp_gpu.h:6775
SDL_GPUTransferBuffer * GPUTransferBufferRaw
Alias to raw representation for GPUTransferBuffer.
Definition SDL3pp_gpu.h:395
constexpr GPUPresentMode GPU_PRESENTMODE_IMMEDIATE
GPU_PRESENTMODE_IMMEDIATE.
Definition SDL3pp_gpu.h:2542
constexpr GPUBufferUsageFlags GPU_BUFFERUSAGE_VERTEX
Buffer is a vertex buffer.
Definition SDL3pp_gpu.h:4232
GPUCommandBuffer AcquireGPUCommandBuffer(GPUDeviceRef device)
Acquire a command buffer.
Definition SDL3pp_gpu.h:6238
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8B8A8_UINT
GPU_TEXTUREFORMAT_R8G8B8A8_UINT.
Definition SDL3pp_gpu.h:2740
bool GPUTextureSupportsFormat(GPUDeviceRef device, GPUTextureFormat format, GPUTextureType type, GPUTextureUsageFlags usage)
Determines whether a texture format is supported for a given type and usage.
Definition SDL3pp_gpu.h:8088
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC4_R_UNORM
GPU_TEXTUREFORMAT_BC4_R_UNORM.
Definition SDL3pp_gpu.h:2680
void BindGPUVertexSamplers(GPURenderPass render_pass, Uint32 first_slot, std::span< const GPUTextureSamplerBinding > texture_sampler_bindings)
Binds texture-sampler pairs for use on the vertex shader.
Definition SDL3pp_gpu.h:6554
void WaitForGPUSwapchain(GPUDeviceRef device, WindowRef window)
Blocks the thread until a swapchain texture is available to be acquired.
Definition SDL3pp_gpu.h:7802
constexpr GPUBufferUsageFlags GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ
Buffer supports storage reads in graphics stages.
Definition SDL3pp_gpu.h:4241
constexpr GPUCubeMapFace GPU_CUBEMAPFACE_POSITIVEZ
GPU_CUBEMAPFACE_POSITIVEZ.
Definition SDL3pp_gpu.h:4207
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_4x4_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_4x4_UNORM_SRGB.
Definition SDL3pp_gpu.h:2863
Uint32 GPUBufferUsageFlags
Specifies how a buffer is intended to be used by the client.
Definition SDL3pp_gpu.h:4230
void DispatchIndirect(GPUBuffer buffer, Uint32 offset)
Dispatches compute work with parameters set from a buffer.
Definition SDL3pp_gpu.h:7163
SDL_GPUStorageBufferReadWriteBinding GPUStorageBufferReadWriteBinding
A structure specifying parameters related to binding buffers in a compute pass.
Definition SDL3pp_gpu.h:1989
constexpr GPUCompareOp GPU_COMPAREOP_EQUAL
The comparison evaluates reference == test.
Definition SDL3pp_gpu.h:4476
SDL_GPUIndexedIndirectDrawCommand GPUIndexedIndirectDrawCommand
A structure specifying the parameters of an indexed indirect draw command.
Definition SDL3pp_gpu.h:4735
void ReleaseGPUGraphicsPipeline(GPUDeviceRef device, GPUGraphicsPipeline graphics_pipeline)
Frees the given graphics pipeline as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6202
void SetViewport(const GPUViewport &viewport)
Sets the current viewport state on a command buffer.
Definition SDL3pp_gpu.h:6426
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_SHORT2_NORM
GPU_VERTEXELEMENTFORMAT_SHORT2_NORM.
Definition SDL3pp_gpu.h:4370
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_BYTE4
GPU_VERTEXELEMENTFORMAT_BYTE4.
Definition SDL3pp_gpu.h:4337
constexpr GPUSwapchainComposition GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR
GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR.
Definition SDL3pp_gpu.h:2503
SDL_GPUComputePipeline * GPUComputePipelineRaw
Alias to raw representation for GPUComputePipeline.
Definition SDL3pp_gpu.h:419
constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR
1 - source color
Definition SDL3pp_gpu.h:4592
void ReleaseFence(GPUFence *fence)
Releases a fence obtained from GPUCommandBuffer.SubmitAndAcquireFence.
Definition SDL3pp_gpu.h:8057
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_B5G5R5A1_UNORM
GPU_TEXTUREFORMAT_B5G5R5A1_UNORM.
Definition SDL3pp_gpu.h:2662
GPUGraphicsPipeline CreateGraphicsPipeline(const GPUGraphicsPipelineCreateInfo &createinfo)
Creates a pipeline object to be used in a graphics workflow.
Definition SDL3pp_gpu.h:5506
void Submit()
Submits a command buffer so its commands can be processed on the GPU.
Definition SDL3pp_gpu.h:7903
void ReleaseWindowFromGPUDevice(GPUDeviceRef device, WindowRef window)
Unclaims a window, destroying its swapchain structure.
Definition SDL3pp_gpu.h:7605
constexpr GPUFilter GPU_FILTER_LINEAR
Linear filtering.
Definition SDL3pp_gpu.h:4656
void BindGPUComputePipeline(GPUComputePass compute_pass, GPUComputePipeline compute_pipeline)
Binds a compute pipeline on a command buffer for use in compute dispatch.
Definition SDL3pp_gpu.h:6984
void ReleaseGPUSampler(GPUDeviceRef device, GPUSampler sampler)
Frees the given sampler as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6099
void BindFragmentStorageBuffers(Uint32 first_slot, SpanRef< const GPUBufferRaw > storage_buffers)
Binds storage buffers for use on the fragment shader.
Definition SDL3pp_gpu.h:6744
constexpr GPUBlendFactor GPU_BLENDFACTOR_CONSTANT_COLOR
blend constant
Definition SDL3pp_gpu.h:4613
constexpr GPUVertexInputRate GPU_VERTEXINPUTRATE_VERTEX
Attribute addressing is a function of the vertex index.
Definition SDL3pp_gpu.h:4398
SDL_GPULoadOp GPULoadOp
Specifies how the contents of a texture attached to a render pass are treated at the beginning of the...
Definition SDL3pp_gpu.h:4138
void UnmapTransferBuffer(GPUTransferBuffer transfer_buffer)
Unmaps a previously mapped transfer buffer.
Definition SDL3pp_gpu.h:7227
void ReleaseSampler(GPUSampler sampler)
Frees the given sampler as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6104
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8B8A8_UNORM
GPU_TEXTUREFORMAT_R8G8B8A8_UNORM.
Definition SDL3pp_gpu.h:2644
SDL_GPUCommandBuffer * GPUCommandBufferRaw
Alias to raw representation for GPUCommandBuffer.
Definition SDL3pp_gpu.h:431
void GDKSuspendGPU()
Call this to suspend GPU operation on Xbox when you receive the EVENT_DID_ENTER_BACKGROUND event.
Definition SDL3pp_gpu.h:8195
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8B8A8_INT
GPU_TEXTUREFORMAT_R8G8B8A8_INT.
Definition SDL3pp_gpu.h:2767
void CopyTextureToTexture(const GPUTextureLocation &source, const GPUTextureLocation &destination, Uint32 w, Uint32 h, Uint32 d, bool cycle)
Performs a texture-to-texture copy.
Definition SDL3pp_gpu.h:7348
constexpr GPUTransferBufferUsage GPU_TRANSFERBUFFERUSAGE_UPLOAD
GPU_TRANSFERBUFFERUSAGE_UPLOAD.
Definition SDL3pp_gpu.h:4265
SDL_GPUShaderCreateInfo GPUShaderCreateInfo
A structure specifying code and metadata for creating a shader object.
Definition SDL3pp_gpu.h:837
GPUSampler CreateGPUSampler(GPUDeviceRef device, const GPUSamplerCreateInfo &createinfo)
Creates a sampler object to be used when binding textures in a graphics workflow.
Definition SDL3pp_gpu.h:5553
SDL_GPUPrimitiveType GPUPrimitiveType
Specifies the primitive topology of a graphics pipeline.
Definition SDL3pp_gpu.h:4113
SDL_GPUBufferCreateInfo GPUBufferCreateInfo
A structure specifying the parameters of a buffer.
Definition SDL3pp_gpu.h:465
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT
GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT.
Definition SDL3pp_gpu.h:2728
constexpr GPUStoreOp GPU_STOREOP_RESOLVE_AND_STORE
The multisample contents generated during the render pass will be resolved to a non-multisample textu...
Definition SDL3pp_gpu.h:4183
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16_SNORM
GPU_TEXTUREFORMAT_R16_SNORM.
Definition SDL3pp_gpu.h:2704
SDL_GPUStencilOp GPUStencilOp
Specifies what happens to a stored stencil value if stencil tests fail or pass.
Definition SDL3pp_gpu.h:4504
constexpr GPUPresentMode GPU_PRESENTMODE_VSYNC
GPU_PRESENTMODE_VSYNC.
Definition SDL3pp_gpu.h:2539
constexpr GPUSamplerAddressMode GPU_SAMPLERADDRESSMODE_REPEAT
Specifies that the coordinates will wrap around.
Definition SDL3pp_gpu.h:4684
Uint32 GPUTextureUsageFlags
Specifies how a texture is intended to be used by the client.
Definition SDL3pp_gpu.h:2991
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_HALF4
GPU_VERTEXELEMENTFORMAT_HALF4.
Definition SDL3pp_gpu.h:4385
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UINT3
GPU_VERTEXELEMENTFORMAT_UINT3.
Definition SDL3pp_gpu.h:4316
constexpr GPUCubeMapFace GPU_CUBEMAPFACE_NEGATIVEX
GPU_CUBEMAPFACE_NEGATIVEX.
Definition SDL3pp_gpu.h:4198
void End()
Ends the current compute pass.
Definition SDL3pp_gpu.h:7183
SDL_GPUVertexInputState GPUVertexInputState
A structure specifying the parameters of a graphics pipeline vertex input state.
Definition SDL3pp_gpu.h:4790
constexpr GPUShaderStage GPU_SHADERSTAGE_VERTEX
GPU_SHADERSTAGE_VERTEX.
Definition SDL3pp_gpu.h:4280
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_D24_UNORM
GPU_TEXTUREFORMAT_D24_UNORM.
Definition SDL3pp_gpu.h:2809
void SetGPUStencilReference(GPURenderPass render_pass, Uint8 reference)
Sets the current stencil reference value on a command buffer.
Definition SDL3pp_gpu.h:6479
void BindGPUFragmentStorageBuffers(GPURenderPass render_pass, Uint32 first_slot, SpanRef< const GPUBufferRaw > storage_buffers)
Binds storage buffers for use on the fragment shader.
Definition SDL3pp_gpu.h:6733
constexpr GPUCompareOp GPU_COMPAREOP_LESS
The comparison evaluates reference < test.
Definition SDL3pp_gpu.h:4473
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET
Texture is a depth stencil target.
Definition SDL3pp_gpu.h:2999
void DispatchGPUCompute(GPUComputePass compute_pass, Uint32 groupcount_x, Uint32 groupcount_y, Uint32 groupcount_z)
Dispatches compute work.
Definition SDL3pp_gpu.h:7122
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_INT2
GPU_VERTEXELEMENTFORMAT_INT2.
Definition SDL3pp_gpu.h:4301
GPUComputePipeline CreateGPUComputePipeline(GPUDeviceRef device, const GPUComputePipelineCreateInfo &createinfo)
Creates a pipeline object to be used in a compute workflow.
Definition SDL3pp_gpu.h:5445
constexpr GPUPrimitiveType GPU_PRIMITIVETYPE_POINTLIST
A series of separate points.
Definition SDL3pp_gpu.h:4127
constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR
1 - destination color
Definition SDL3pp_gpu.h:4598
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC7_RGBA_UNORM
GPU_TEXTUREFORMAT_BC7_RGBA_UNORM.
Definition SDL3pp_gpu.h:2686
GPUComputePass BeginGPUComputePass(GPUCommandBuffer command_buffer, std::span< const GPUStorageTextureReadWriteBinding > storage_texture_bindings, std::span< const GPUStorageBufferReadWriteBinding > storage_buffer_bindings)
Begins a compute pass on a command buffer.
Definition SDL3pp_gpu.h:6956
bool SetGPUSwapchainParameters(GPUDeviceRef device, WindowRef window, GPUSwapchainComposition swapchain_composition, GPUPresentMode present_mode)
Changes the swapchain parameters for the given claimed window.
Definition SDL3pp_gpu.h:7637
void BindGPUFragmentSamplers(GPURenderPass render_pass, Uint32 first_slot, std::span< const GPUTextureSamplerBinding > texture_sampler_bindings)
Binds texture-sampler pairs for use on the fragment shader.
Definition SDL3pp_gpu.h:6661
SDL_GPUStoreOp GPUStoreOp
Specifies how the contents of a texture attached to a render pass are treated at the end of the rende...
Definition SDL3pp_gpu.h:4160
constexpr GPUVertexInputRate GPU_VERTEXINPUTRATE_INSTANCE
Attribute addressing is a function of the instance index.
Definition SDL3pp_gpu.h:4402
void GDKSuspendGPU(GPUDeviceRef device)
Call this to suspend GPU operation on Xbox when you receive the EVENT_DID_ENTER_BACKGROUND event.
Definition SDL3pp_gpu.h:8193
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT
GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT.
Definition SDL3pp_gpu.h:2689
constexpr GPUShaderStage GPU_SHADERSTAGE_FRAGMENT
GPU_SHADERSTAGE_FRAGMENT.
Definition SDL3pp_gpu.h:4283
constexpr GPUCompareOp GPU_COMPAREOP_INVALID
GPU_COMPAREOP_INVALID.
Definition SDL3pp_gpu.h:4467
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC5_RG_UNORM
GPU_TEXTUREFORMAT_BC5_RG_UNORM.
Definition SDL3pp_gpu.h:2683
void BindIndexBuffer(const GPUBufferBinding &binding, GPUIndexElementSize index_element_size)
Binds an index buffer on a command buffer for use with subsequent draw calls.
Definition SDL3pp_gpu.h:6531
void BindGPUVertexStorageBuffers(GPURenderPass render_pass, Uint32 first_slot, SpanRef< const GPUBufferRaw > storage_buffers)
Binds storage buffers for use on the vertex shader.
Definition SDL3pp_gpu.h:6626
constexpr GPUCubeMapFace GPU_CUBEMAPFACE_NEGATIVEZ
GPU_CUBEMAPFACE_NEGATIVEZ.
Definition SDL3pp_gpu.h:4210
void UnmapGPUTransferBuffer(GPUDeviceRef device, GPUTransferBuffer transfer_buffer)
Unmaps a previously mapped transfer buffer.
Definition SDL3pp_gpu.h:7221
constexpr GPUPrimitiveType GPU_PRIMITIVETYPE_LINESTRIP
A series of connected lines.
Definition SDL3pp_gpu.h:4124
constexpr GPUStencilOp GPU_STENCILOP_DECREMENT_AND_WRAP
Decrements the current value and wraps to the maximum value.
Definition SDL3pp_gpu.h:4534
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8_UINT
GPU_TEXTUREFORMAT_R8_UINT.
Definition SDL3pp_gpu.h:2734
constexpr GPUSampleCount GPU_SAMPLECOUNT_4
MSAA 4x.
Definition SDL3pp_gpu.h:3041
constexpr GPUTransferBufferUsage GPU_TRANSFERBUFFERUSAGE_DOWNLOAD
GPU_TRANSFERBUFFERUSAGE_DOWNLOAD.
Definition SDL3pp_gpu.h:4268
constexpr GPUStencilOp GPU_STENCILOP_INVALID
GPU_STENCILOP_INVALID.
Definition SDL3pp_gpu.h:4506
constexpr GPUTextureType GPU_TEXTURETYPE_CUBE_ARRAY
The texture is a cube array image.
Definition SDL3pp_gpu.h:2968
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32_INT
GPU_TEXTUREFORMAT_R32_INT.
Definition SDL3pp_gpu.h:2779
GPUTextureFormat GetSwapchainTextureFormat(WindowRef window)
Obtains the texture format of the swapchain for the given window.
Definition SDL3pp_gpu.h:7709
bool WindowSupportsGPUPresentMode(GPUDeviceRef device, WindowRef window, GPUPresentMode present_mode)
Determines whether a presentation mode is supported by the window.
Definition SDL3pp_gpu.h:7547
void UploadToGPUTexture(GPUCopyPass copy_pass, const GPUTextureTransferInfo &source, const GPUTextureRegion &destination, bool cycle)
Uploads data from a transfer buffer to a texture.
Definition SDL3pp_gpu.h:7273
void DownloadFromGPUBuffer(GPUCopyPass copy_pass, const GPUBufferRegion &source, const GPUTransferBufferLocation &destination)
Copies data from a buffer to a transfer buffer on the GPU timeline.
Definition SDL3pp_gpu.h:7432
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_5x4_FLOAT
GPU_TEXTUREFORMAT_ASTC_5x4_FLOAT.
Definition SDL3pp_gpu.h:2908
SDL_GPUDepthStencilState GPUDepthStencilState
A structure specifying the parameters of the graphics pipeline depth stencil state.
Definition SDL3pp_gpu.h:4849
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB
GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB.
Definition SDL3pp_gpu.h:2794
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_12x10_FLOAT
GPU_TEXTUREFORMAT_ASTC_12x10_FLOAT.
Definition SDL3pp_gpu.h:2941
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB
GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB.
Definition SDL3pp_gpu.h:2791
constexpr GPUColorComponentFlags GPU_COLORCOMPONENT_B
the blue component
Definition SDL3pp_gpu.h:4638
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x8_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_8x8_UNORM_SRGB.
Definition SDL3pp_gpu.h:2884
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16B16A16_SNORM
GPU_TEXTUREFORMAT_R16G16B16A16_SNORM.
Definition SDL3pp_gpu.h:2710
constexpr GPUSampleCount GPU_SAMPLECOUNT_8
MSAA 8x.
Definition SDL3pp_gpu.h:3043
constexpr GPUTextureType GPU_TEXTURETYPE_3D
The texture is a 3-dimensional image.
Definition SDL3pp_gpu.h:2962
SDL_GPURenderPass * GPURenderPassRaw
Alias to raw representation for GPURenderPass.
Definition SDL3pp_gpu.h:437
constexpr GPUBufferUsageFlags GPU_BUFFERUSAGE_INDEX
Buffer is an index buffer.
Definition SDL3pp_gpu.h:4235
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT
GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT.
Definition SDL3pp_gpu.h:2692
SDL_GPUVertexBufferDescription GPUVertexBufferDescription
A structure specifying the parameters of vertex buffers used in a graphics pipeline.
Definition SDL3pp_gpu.h:4764
constexpr GPUIndexElementSize GPU_INDEXELEMENTSIZE_16BIT
The index elements are 16-bit.
Definition SDL3pp_gpu.h:1148
SDL_GPUFrontFace GPUFrontFace
Specifies the vertex winding that will cause a triangle to be determined to be front-facing.
Definition SDL3pp_gpu.h:4446
constexpr GPUStencilOp GPU_STENCILOP_DECREMENT_AND_CLAMP
Decrements the current value and clamps to 0.
Definition SDL3pp_gpu.h:4522
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UINT4
GPU_VERTEXELEMENTFORMAT_UINT4.
Definition SDL3pp_gpu.h:4319
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16_UINT
GPU_TEXTUREFORMAT_R16_UINT.
Definition SDL3pp_gpu.h:2743
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16_FLOAT
GPU_TEXTUREFORMAT_R16G16_FLOAT.
Definition SDL3pp_gpu.h:2716
void BindVertexBuffers(Uint32 first_slot, std::span< const GPUBufferBinding > bindings)
Binds vertex buffers on a command buffer for use with subsequent draw calls.
Definition SDL3pp_gpu.h:6507
constexpr GPUSampleCount GPU_SAMPLECOUNT_2
MSAA 2x.
Definition SDL3pp_gpu.h:3039
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE
Texture supports storage writes in the compute stage.
Definition SDL3pp_gpu.h:3012
void End()
Ends the given render pass.
Definition SDL3pp_gpu.h:6921
SDL_GPUBufferBinding GPUBufferBinding
A structure specifying parameters in a buffer binding call.
Definition SDL3pp_gpu.h:1137
void BindVertexStorageBuffers(Uint32 first_slot, SpanRef< const GPUBufferRaw > storage_buffers)
Binds storage buffers for use on the vertex shader.
Definition SDL3pp_gpu.h:6637
void WaitForGPUIdle(GPUDeviceRef device)
Blocks the thread until the GPU is completely idle.
Definition SDL3pp_gpu.h:7984
GPUComputePass BeginComputePass(std::span< const GPUStorageTextureReadWriteBinding > storage_texture_bindings, std::span< const GPUStorageBufferReadWriteBinding > storage_buffer_bindings)
Begins a compute pass on a command buffer.
Definition SDL3pp_gpu.h:6968
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x5_UNORM
GPU_TEXTUREFORMAT_ASTC_8x5_UNORM.
Definition SDL3pp_gpu.h:2836
void ReleaseTexture(GPUTexture texture)
Frees the given texture as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6084
SDL_GPURasterizerState GPURasterizerState
A structure specifying the parameters of the graphics pipeline rasterizer state.
Definition SDL3pp_gpu.h:4829
GPUTransferBuffer CreateGPUTransferBuffer(GPUDeviceRef device, const GPUTransferBufferCreateInfo &createinfo)
Creates a transfer buffer to be used when uploading to or downloading from graphics resources.
Definition SDL3pp_gpu.h:5888
constexpr GPUCullMode GPU_CULLMODE_FRONT
Front-facing triangles are culled.
Definition SDL3pp_gpu.h:4432
constexpr GPUCubeMapFace GPU_CUBEMAPFACE_POSITIVEY
GPU_CUBEMAPFACE_POSITIVEY.
Definition SDL3pp_gpu.h:4201
constexpr GPUCompareOp GPU_COMPAREOP_GREATER
The comparison evaluates reference > test.
Definition SDL3pp_gpu.h:4483
SDL_GPUComputePipelineCreateInfo GPUComputePipelineCreateInfo
A structure specifying the parameters of a compute pipeline state.
Definition SDL3pp_gpu.h:954
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16_FLOAT
GPU_TEXTUREFORMAT_R16_FLOAT.
Definition SDL3pp_gpu.h:2713
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_12x12_FLOAT
GPU_TEXTUREFORMAT_ASTC_12x12_FLOAT.
Definition SDL3pp_gpu.h:2944
void GenerateMipmapsForTexture(GPUTexture texture)
Generates mipmaps for the given texture.
Definition SDL3pp_gpu.h:7476
constexpr GPUFrontFace GPU_FRONTFACE_COUNTER_CLOCKWISE
A triangle with counter-clockwise vertex winding will be considered front-facing.
Definition SDL3pp_gpu.h:4452
SDL_GPUMultisampleState GPUMultisampleState
A structure specifying the parameters of the graphics pipeline multisample state.
Definition SDL3pp_gpu.h:4839
void PushGPUVertexUniformData(GPUCommandBuffer command_buffer, Uint32 slot_index, SourceBytes data)
Pushes data to a vertex uniform slot on the command buffer.
Definition SDL3pp_gpu.h:6266
constexpr GPUColorComponentFlags GPU_COLORCOMPONENT_R
the red component
Definition SDL3pp_gpu.h:4632
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x5_FLOAT
GPU_TEXTUREFORMAT_ASTC_10x5_FLOAT.
Definition SDL3pp_gpu.h:2929
constexpr GPUSamplerMipmapMode GPU_SAMPLERMIPMAPMODE_NEAREST
Point filtering.
Definition SDL3pp_gpu.h:4668
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_BYTE2_NORM
GPU_VERTEXELEMENTFORMAT_BYTE2_NORM.
Definition SDL3pp_gpu.h:4346
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_HALF2
GPU_VERTEXELEMENTFORMAT_HALF2.
Definition SDL3pp_gpu.h:4382
SDL_GPUSampler * GPUSamplerRaw
Alias to raw representation for GPUSampler.
Definition SDL3pp_gpu.h:407
void ClaimWindowForGPUDevice(GPUDeviceRef device, WindowRef window)
Claims a window, creating a swapchain structure for it.
Definition SDL3pp_gpu.h:7585
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_6x5_UNORM
GPU_TEXTUREFORMAT_ASTC_6x5_UNORM.
Definition SDL3pp_gpu.h:2830
constexpr GPUCullMode GPU_CULLMODE_BACK
Back-facing triangles are culled.
Definition SDL3pp_gpu.h:4435
SDL_GPUIndirectDrawCommand GPUIndirectDrawCommand
A structure specifying the parameters of an indirect draw command.
Definition SDL3pp_gpu.h:4719
GPUTransferBuffer CreateTransferBuffer(const GPUTransferBufferCreateInfo &createinfo)
Creates a transfer buffer to be used when uploading to or downloading from graphics resources.
Definition SDL3pp_gpu.h:5895
void SetBufferName(GPUBuffer buffer, StringParam text)
Sets an arbitrary string constant to label a buffer.
Definition SDL3pp_gpu.h:5945
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UINT2
GPU_VERTEXELEMENTFORMAT_UINT2.
Definition SDL3pp_gpu.h:4313
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x6_UNORM
GPU_TEXTUREFORMAT_ASTC_10x6_UNORM.
Definition SDL3pp_gpu.h:2848
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8B8A8_SNORM
GPU_TEXTUREFORMAT_R8G8B8A8_SNORM.
Definition SDL3pp_gpu.h:2701
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UBYTE4
GPU_VERTEXELEMENTFORMAT_UBYTE4.
Definition SDL3pp_gpu.h:4343
void PushFragmentUniformData(Uint32 slot_index, SourceBytes data)
Pushes data to a fragment uniform slot on the command buffer.
Definition SDL3pp_gpu.h:6304
void UploadToGPUBuffer(GPUCopyPass copy_pass, const GPUTransferBufferLocation &source, const GPUBufferRegion &destination, bool cycle)
Uploads data from a transfer buffer to a buffer.
Definition SDL3pp_gpu.h:7302
void PushGPUComputeUniformData(GPUCommandBuffer command_buffer, Uint32 slot_index, SourceBytes data)
Pushes data to a uniform slot on the command buffer.
Definition SDL3pp_gpu.h:6326
constexpr GPUBlendFactor GPU_BLENDFACTOR_INVALID
GPU_BLENDFACTOR_INVALID.
Definition SDL3pp_gpu.h:4582
Uint32 CalculateGPUTextureFormatSize(GPUTextureFormat format, Uint32 width, Uint32 height, Uint32 depth_or_layer_count)
Calculate the size in bytes of a texture format with dimensions.
Definition SDL3pp_gpu.h:8137
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_INVALID
GPU_VERTEXELEMENTFORMAT_INVALID.
Definition SDL3pp_gpu.h:4295
void PushVertexUniformData(Uint32 slot_index, SourceBytes data)
Pushes data to a vertex uniform slot on the command buffer.
Definition SDL3pp_gpu.h:6274
SDL_GPUCopyPass * GPUCopyPassRaw
Alias to raw representation for GPUCopyPass.
Definition SDL3pp_gpu.h:449
GPUShader CreateGPUShader(GPUDeviceRef device, const GPUShaderCreateInfo &createinfo)
Creates a shader to be used when creating a graphics pipeline.
Definition SDL3pp_gpu.h:5653
constexpr GPUStencilOp GPU_STENCILOP_INCREMENT_AND_CLAMP
Increments the current value and clamps to the maximum value.
Definition SDL3pp_gpu.h:4519
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_SHORT4_NORM
GPU_VERTEXELEMENTFORMAT_SHORT4_NORM.
Definition SDL3pp_gpu.h:4373
SDL_GPUVertexElementFormat GPUVertexElementFormat
Specifies the format of a vertex attribute.
Definition SDL3pp_gpu.h:4293
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT
GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT.
Definition SDL3pp_gpu.h:2818
void GenerateMipmapsForGPUTexture(GPUCommandBuffer command_buffer, GPUTexture texture)
Generates mipmaps for the given texture.
Definition SDL3pp_gpu.h:7470
constexpr GPUTextureType GPU_TEXTURETYPE_2D
The texture is a 2-dimensional image.
Definition SDL3pp_gpu.h:2956
void CopyBufferToBuffer(const GPUBufferLocation &source, const GPUBufferLocation &destination, Uint32 size, bool cycle)
Performs a buffer-to-buffer copy.
Definition SDL3pp_gpu.h:7384
constexpr GPUBlendFactor GPU_BLENDFACTOR_SRC_COLOR
source color
Definition SDL3pp_gpu.h:4589
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC2_RGBA_UNORM
GPU_TEXTUREFORMAT_BC2_RGBA_UNORM.
Definition SDL3pp_gpu.h:2674
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB
GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB.
Definition SDL3pp_gpu.h:2788
void ReleaseGPUComputePipeline(GPUDeviceRef device, GPUComputePipeline compute_pipeline)
Frees the given compute pipeline as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6160
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_B4G4R4A4_UNORM
GPU_TEXTUREFORMAT_B4G4R4A4_UNORM.
Definition SDL3pp_gpu.h:2665
GPUTexture CreateGPUTexture(GPUDeviceRef device, const GPUTextureCreateInfo &createinfo)
Creates a texture object to be used in graphics or compute workflows.
Definition SDL3pp_gpu.h:5739
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_12x10_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_12x10_UNORM_SRGB.
Definition SDL3pp_gpu.h:2899
void DestroyGPUDevice(GPUDeviceRaw device)
Destroys a GPU context previously returned by CreateGPUDevice.
Definition SDL3pp_gpu.h:5211
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x10_UNORM
GPU_TEXTUREFORMAT_ASTC_10x10_UNORM.
Definition SDL3pp_gpu.h:2854
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_5x4_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_5x4_UNORM_SRGB.
Definition SDL3pp_gpu.h:2866
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_12x10_UNORM
GPU_TEXTUREFORMAT_ASTC_12x10_UNORM.
Definition SDL3pp_gpu.h:2857
void BindGPUGraphicsPipeline(GPURenderPass render_pass, GPUGraphicsPipeline graphics_pipeline)
Binds a graphics pipeline on a render pass to be used in rendering.
Definition SDL3pp_gpu.h:6401
SDL_GPUTextureType GPUTextureType
Specifies the type of a texture.
Definition SDL3pp_gpu.h:2954
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_5x5_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_5x5_UNORM_SRGB.
Definition SDL3pp_gpu.h:2869
constexpr GPUShaderFormat GPU_SHADERFORMAT_METALLIB
Precompiled metallib shaders for Metal.
Definition SDL3pp_gpu.h:2470
constexpr GPUFillMode GPU_FILLMODE_LINE
Polygon edges will be drawn as line segments.
Definition SDL3pp_gpu.h:4417
void CopyGPUBufferToBuffer(GPUCopyPass copy_pass, const GPUBufferLocation &source, const GPUBufferLocation &destination, Uint32 size, bool cycle)
Performs a buffer-to-buffer copy.
Definition SDL3pp_gpu.h:7375
SDL_GPUIndirectDispatchCommand GPUIndirectDispatchCommand
A structure specifying the parameters of an indexed dispatch command.
Definition SDL3pp_gpu.h:4744
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_4x4_UNORM
GPU_TEXTUREFORMAT_ASTC_4x4_UNORM.
Definition SDL3pp_gpu.h:2821
constexpr GPUPrimitiveType GPU_PRIMITIVETYPE_TRIANGLESTRIP
A series of connected triangles.
Definition SDL3pp_gpu.h:4118
SDL_GPUColorTargetBlendState GPUColorTargetBlendState
A structure specifying the blend state of a color target.
Definition SDL3pp_gpu.h:4811
SDL_GPUTransferBufferLocation GPUTransferBufferLocation
A structure specifying a location in a transfer buffer.
Definition SDL3pp_gpu.h:1729
constexpr GPUShaderFormat GPU_SHADERFORMAT_MSL
MSL shaders for Metal.
Definition SDL3pp_gpu.h:2467
PropertiesRef GetGPUDeviceProperties(GPUDeviceRef device)
Get the properties associated with a GPU device.
Definition SDL3pp_gpu.h:5388
SDL_GPUBuffer * GPUBufferRaw
Alias to raw representation for GPUBuffer.
Definition SDL3pp_gpu.h:389
void PopDebugGroup()
Ends the most-recently pushed debug group.
Definition SDL3pp_gpu.h:6064
void UploadToTexture(const GPUTextureTransferInfo &source, const GPUTextureRegion &destination, bool cycle)
Uploads data from a transfer buffer to a texture.
Definition SDL3pp_gpu.h:7281
void ReleaseBuffer(GPUBuffer buffer)
Frees the given buffer as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6124
SDL_GPUSamplerMipmapMode GPUSamplerMipmapMode
Specifies a mipmap mode used by a sampler.
Definition SDL3pp_gpu.h:4666
Uint8 GPUColorComponentFlags
Specifies which color components are written in a graphics pipeline.
Definition SDL3pp_gpu.h:4630
const char * GetGPUDeviceDriver(GPUDeviceRef device)
Returns the name of the backend used to create this GPU context.
Definition SDL3pp_gpu.h:5256
bool WindowSupportsSwapchainComposition(WindowRef window, GPUSwapchainComposition swapchain_composition)
Determines whether a swapchain composition is supported by the window.
Definition SDL3pp_gpu.h:7525
constexpr GPUCompareOp GPU_COMPAREOP_NEVER
The comparison always evaluates false.
Definition SDL3pp_gpu.h:4470
SDL_GPUVulkanOptions GPUVulkanOptions
A structure specifying additional options when using Vulkan.
Definition SDL3pp_gpu.h:5198
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16_SNORM
GPU_TEXTUREFORMAT_R16G16_SNORM.
Definition SDL3pp_gpu.h:2707
void SetBlendConstants(FColorRaw blend_constants)
Sets the current blend constants on a command buffer.
Definition SDL3pp_gpu.h:6466
constexpr GPUBlendFactor GPU_BLENDFACTOR_SRC_ALPHA
source alpha
Definition SDL3pp_gpu.h:4601
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x5_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_8x5_UNORM_SRGB.
Definition SDL3pp_gpu.h:2878
SDL_GPUSamplerAddressMode GPUSamplerAddressMode
Specifies behavior of texture sampling when the coordinates exceed the 0-1 range.
Definition SDL3pp_gpu.h:4682
void SetTextureName(GPUTexture texture, StringParam text)
Sets an arbitrary string constant to label a texture.
Definition SDL3pp_gpu.h:5975
GPUDevice CreateGPUDevice(GPUShaderFormat format_flags, bool debug_mode, StringParam name)
Creates a GPU context.
Definition SDL3pp_gpu.h:4933
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_6x6_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_6x6_UNORM_SRGB.
Definition SDL3pp_gpu.h:2875
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R10G10B10A2_UNORM
GPU_TEXTUREFORMAT_R10G10B10A2_UNORM.
Definition SDL3pp_gpu.h:2656
void BindPipeline(GPUGraphicsPipeline graphics_pipeline)
Binds a graphics pipeline on a render pass to be used in rendering.
Definition SDL3pp_gpu.h:6407
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_B8G8R8A8_UNORM
GPU_TEXTUREFORMAT_B8G8R8A8_UNORM.
Definition SDL3pp_gpu.h:2668
void DrawGPUPrimitivesIndirect(GPURenderPass render_pass, GPUBuffer buffer, Uint32 offset, Uint32 draw_count)
Draws data using bound graphics state and with draw parameters set from a buffer.
Definition SDL3pp_gpu.h:6859
constexpr GPULoadOp GPU_LOADOP_DONT_CARE
The previous contents of the texture need not be preserved.
Definition SDL3pp_gpu.h:4150
constexpr GPUBlendFactor GPU_BLENDFACTOR_ZERO
0
Definition SDL3pp_gpu.h:4585
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8_SNORM
GPU_TEXTUREFORMAT_R8G8_SNORM.
Definition SDL3pp_gpu.h:2698
SDL_GPUSwapchainComposition GPUSwapchainComposition
Specifies the texture format and colorspace of the swapchain textures.
Definition SDL3pp_gpu.h:2498
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32G32B32A32_INT
GPU_TEXTUREFORMAT_R32G32B32A32_INT.
Definition SDL3pp_gpu.h:2785
constexpr GPUBlendOp GPU_BLENDOP_MAX
max(source, destination)
Definition SDL3pp_gpu.h:4566
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16_INT
GPU_TEXTUREFORMAT_R16G16_INT.
Definition SDL3pp_gpu.h:2773
GPUShader CreateShader(const GPUShaderCreateInfo &createinfo)
Creates a shader to be used when creating a graphics pipeline.
Definition SDL3pp_gpu.h:5659
const char * GetGPUDriver(int index)
Get the name of a built in GPU driver.
Definition SDL3pp_gpu.h:5246
constexpr GPUStoreOp GPU_STOREOP_STORE
The contents generated during the render pass will be written to memory.
Definition SDL3pp_gpu.h:4163
SDL_GPUSampleCount GPUSampleCount
Specifies the sample count of a texture.
Definition SDL3pp_gpu.h:3034
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB
GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB.
Definition SDL3pp_gpu.h:2797
void InsertDebugLabel(StringParam text)
Inserts an arbitrary string label into the command buffer callstream.
Definition SDL3pp_gpu.h:6002
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB
GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB.
Definition SDL3pp_gpu.h:2803
GPUTexture CreateTexture(const GPUTextureCreateInfo &createinfo)
Creates a texture object to be used in graphics or compute workflows.
Definition SDL3pp_gpu.h:5745
constexpr GPUBlendFactor GPU_BLENDFACTOR_SRC_ALPHA_SATURATE
min(source alpha, 1 - destination alpha)
Definition SDL3pp_gpu.h:4619
constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA
1 - destination alpha
Definition SDL3pp_gpu.h:4610
GPUTextureFormat GetGPUSwapchainTextureFormat(GPUDeviceRef device, WindowRef window)
Obtains the texture format of the swapchain for the given window.
Definition SDL3pp_gpu.h:7703
void BindPipeline(GPUComputePipeline compute_pipeline)
Binds a compute pipeline on a command buffer for use in compute dispatch.
Definition SDL3pp_gpu.h:6990
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_BYTE2
GPU_VERTEXELEMENTFORMAT_BYTE2.
Definition SDL3pp_gpu.h:4334
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x8_UNORM
GPU_TEXTUREFORMAT_ASTC_8x8_UNORM.
Definition SDL3pp_gpu.h:2842
bool TextureSupportsSampleCount(GPUTextureFormat format, GPUSampleCount sample_count)
Determines if a sample count for a texture format is supported.
Definition SDL3pp_gpu.h:8120
constexpr GPUStencilOp GPU_STENCILOP_KEEP
Keeps the current value.
Definition SDL3pp_gpu.h:4509
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_INT3
GPU_VERTEXELEMENTFORMAT_INT3.
Definition SDL3pp_gpu.h:4304
void SetGPUBufferName(GPUDeviceRef device, GPUBuffer buffer, StringParam text)
Sets an arbitrary string constant to label a buffer.
Definition SDL3pp_gpu.h:5938
constexpr GPUBufferUsageFlags GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ
Buffer supports storage reads in the compute stage.
Definition SDL3pp_gpu.h:4246
void DownloadFromBuffer(const GPUBufferRegion &source, const GPUTransferBufferLocation &destination)
Copies data from a buffer to a transfer buffer on the GPU timeline.
Definition SDL3pp_gpu.h:7439
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x5_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_10x5_UNORM_SRGB.
Definition SDL3pp_gpu.h:2887
void SetGPUBlendConstants(GPURenderPass render_pass, FColorRaw blend_constants)
Sets the current blend constants on a command buffer.
Definition SDL3pp_gpu.h:6460
SDL_GPUTextureCreateInfo GPUTextureCreateInfo
A structure specifying the parameters of a texture.
Definition SDL3pp_gpu.h:653
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16B16A16_UINT
GPU_TEXTUREFORMAT_R16G16B16A16_UINT.
Definition SDL3pp_gpu.h:2749
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x8_FLOAT
GPU_TEXTUREFORMAT_ASTC_8x8_FLOAT.
Definition SDL3pp_gpu.h:2926
SDL_GPUFilter GPUFilter
Specifies a filter operation used by a sampler.
Definition SDL3pp_gpu.h:4651
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_5x4_UNORM
GPU_TEXTUREFORMAT_ASTC_5x4_UNORM.
Definition SDL3pp_gpu.h:2824
void End()
Ends the current copy pass.
Definition SDL3pp_gpu.h:7458
void ReleaseGraphicsPipeline(GPUGraphicsPipeline graphics_pipeline)
Frees the given graphics pipeline as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6208
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_USHORT4
GPU_VERTEXELEMENTFORMAT_USHORT4.
Definition SDL3pp_gpu.h:4367
GPUFence * SubmitAndAcquireFence()
Submits a command buffer so its commands can be processed on the GPU, and acquires a fence associated...
Definition SDL3pp_gpu.h:7938
bool GPUSupportsProperties(PropertiesRef props)
Checks for GPU runtime support.
Definition SDL3pp_gpu.h:4902
constexpr GPUShaderFormat GPU_SHADERFORMAT_INVALID
INVALID.
Definition SDL3pp_gpu.h:2452
void WaitForIdle()
Blocks the thread until the GPU is completely idle.
Definition SDL3pp_gpu.h:7989
void WaitForGPUFences(GPUDeviceRef device, bool wait_all, std::span< GPUFence *const > fences)
Blocks the thread until the given fences are signaled.
Definition SDL3pp_gpu.h:8005
void BindGPUComputeStorageBuffers(GPUComputePass compute_pass, Uint32 first_slot, SpanRef< const GPUBufferRaw > storage_buffers)
Binds storage buffers as readonly for use on the compute pipeline.
Definition SDL3pp_gpu.h:7083
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_B5G6R5_UNORM
GPU_TEXTUREFORMAT_B5G6R5_UNORM.
Definition SDL3pp_gpu.h:2659
void DownloadFromGPUTexture(GPUCopyPass copy_pass, const GPUTextureRegion &source, const GPUTextureTransferInfo &destination)
Copies data from a texture to a transfer buffer on the GPU timeline.
Definition SDL3pp_gpu.h:7406
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8_UNORM
GPU_TEXTUREFORMAT_R8G8_UNORM.
Definition SDL3pp_gpu.h:2641
void EndGPURenderPass(GPURenderPass render_pass)
Ends the given render pass.
Definition SDL3pp_gpu.h:6916
constexpr GPUBlendOp GPU_BLENDOP_REVERSE_SUBTRACT
(destination * destination_factor) - (source * source_factor)
Definition SDL3pp_gpu.h:4560
constexpr GPUColorComponentFlags GPU_COLORCOMPONENT_G
the green component
Definition SDL3pp_gpu.h:4635
constexpr GPUSwapchainComposition GPU_SWAPCHAINCOMPOSITION_SDR
GPU_SWAPCHAINCOMPOSITION_SDR.
Definition SDL3pp_gpu.h:2500
constexpr GPUBufferUsageFlags GPU_BUFFERUSAGE_INDIRECT
Buffer is an indirect buffer.
Definition SDL3pp_gpu.h:4238
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ
Texture supports storage reads in the compute stage.
Definition SDL3pp_gpu.h:3008
constexpr GPUBlendOp GPU_BLENDOP_SUBTRACT
(source * source_factor) - (destination * destination_factor)
Definition SDL3pp_gpu.h:4557
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8_INT
GPU_TEXTUREFORMAT_R8_INT.
Definition SDL3pp_gpu.h:2761
void InsertGPUDebugLabel(GPUCommandBuffer command_buffer, StringParam text)
Inserts an arbitrary string label into the command buffer callstream.
Definition SDL3pp_gpu.h:5996
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16_UNORM
GPU_TEXTUREFORMAT_R16_UNORM.
Definition SDL3pp_gpu.h:2647
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x10_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_10x10_UNORM_SRGB.
Definition SDL3pp_gpu.h:2896
SDL_GPUDevice * GPUDeviceRaw
Alias to raw representation for GPUDevice.
Definition SDL3pp_gpu.h:379
SDL_GPUBlitRegion GPUBlitRegion
A structure specifying a region of a texture used in the blit operation.
Definition SDL3pp_gpu.h:4703
SDL_GPUTextureSamplerBinding GPUTextureSamplerBinding
A structure specifying parameters in a sampler binding call.
Definition SDL3pp_gpu.h:1164
void EndGPUCopyPass(GPUCopyPass copy_pass)
Ends the current copy pass.
Definition SDL3pp_gpu.h:7453
void ClaimWindow(WindowRef window)
Claims a window, creating a swapchain structure for it.
Definition SDL3pp_gpu.h:7590
void DispatchGPUComputeIndirect(GPUComputePass compute_pass, GPUBuffer buffer, Uint32 offset)
Dispatches compute work with parameters set from a buffer.
Definition SDL3pp_gpu.h:7156
GPUTexture WaitAndAcquireSwapchainTexture(WindowRef window, Uint32 *swapchain_texture_width=nullptr, Uint32 *swapchain_texture_height=nullptr)
Blocks the thread until a swapchain texture is available to be acquired, and then acquires it.
Definition SDL3pp_gpu.h:7867
constexpr GPUStoreOp GPU_STOREOP_DONT_CARE
The contents generated during the render pass are not needed and may be discarded.
Definition SDL3pp_gpu.h:4169
constexpr GPULoadOp GPU_LOADOP_CLEAR
The contents of the texture will be cleared to a color.
Definition SDL3pp_gpu.h:4144
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM
GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM.
Definition SDL3pp_gpu.h:4355
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32G32B32A32_UINT
GPU_TEXTUREFORMAT_R32G32B32A32_UINT.
Definition SDL3pp_gpu.h:2758
void GDKResumeGPU()
Call this to resume GPU operation on Xbox when you receive the EVENT_WILL_ENTER_FOREGROUND event.
Definition SDL3pp_gpu.h:8212
SDL_GPUShader * GPUShaderRaw
Alias to raw representation for GPUShader.
Definition SDL3pp_gpu.h:413
constexpr GPUTextureType GPU_TEXTURETYPE_2D_ARRAY
The texture is a 2-dimensional array image.
Definition SDL3pp_gpu.h:2959
constexpr GPUPresentMode GPU_PRESENTMODE_MAILBOX
GPU_PRESENTMODE_MAILBOX.
Definition SDL3pp_gpu.h:2545
constexpr GPUCubeMapFace GPU_CUBEMAPFACE_NEGATIVEY
GPU_CUBEMAPFACE_NEGATIVEY.
Definition SDL3pp_gpu.h:4204
SDL_GPUBlendFactor GPUBlendFactor
Specifies a blending factor to be used when pixels in a render target are blended with existing pixel...
Definition SDL3pp_gpu.h:4580
void PushDebugGroup(StringParam name)
Begins a debug group with an arbitrary name.
Definition SDL3pp_gpu.h:6039
bool GPUSupportsShaderFormats(GPUShaderFormat format_flags, StringParam name)
Checks for GPU runtime support.
Definition SDL3pp_gpu.h:4886
void ReleaseGPUFence(GPUDeviceRef device, GPUFence *fence)
Releases a fence obtained from GPUCommandBuffer.SubmitAndAcquireFence.
Definition SDL3pp_gpu.h:8052
constexpr GPUShaderFormat GPU_SHADERFORMAT_SPIRV
SPIR-V shaders for Vulkan.
Definition SDL3pp_gpu.h:2458
constexpr GPUSamplerAddressMode GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT
Specifies that the coordinates will wrap around mirrored.
Definition SDL3pp_gpu.h:4689
void BindGPUVertexBuffers(GPURenderPass render_pass, Uint32 first_slot, std::span< const GPUBufferBinding > bindings)
Binds vertex buffers on a command buffer for use with subsequent draw calls.
Definition SDL3pp_gpu.h:6499
void BindStorageTextures(Uint32 first_slot, SpanRef< const GPUTextureRaw > storage_textures)
Binds storage textures as readonly for use on the compute pipeline.
Definition SDL3pp_gpu.h:7058
void DrawPrimitives(Uint32 num_vertices, Uint32 num_instances, Uint32 first_vertex, Uint32 first_instance)
Draws data using bound graphics state.
Definition SDL3pp_gpu.h:6834
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x5_FLOAT
GPU_TEXTUREFORMAT_ASTC_8x5_FLOAT.
Definition SDL3pp_gpu.h:2920
void SetGPUScissor(GPURenderPass render_pass, const RectRaw &scissor)
Sets the current scissor state on a command buffer.
Definition SDL3pp_gpu.h:6439
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_D16_UNORM
GPU_TEXTUREFORMAT_D16_UNORM.
Definition SDL3pp_gpu.h:2806
void SubmitGPUCommandBuffer(GPUCommandBuffer command_buffer)
Submits a command buffer so its commands can be processed on the GPU.
Definition SDL3pp_gpu.h:7898
constexpr GPUFilter GPU_FILTER_NEAREST
Point filtering.
Definition SDL3pp_gpu.h:4653
void SetGPUTextureName(GPUDeviceRef device, GPUTexture texture, StringParam text)
Sets an arbitrary string constant to label a texture.
Definition SDL3pp_gpu.h:5968
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x6_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_10x6_UNORM_SRGB.
Definition SDL3pp_gpu.h:2890
SDL_GPUStencilOpState GPUStencilOpState
A structure specifying the stencil operation state of a graphics pipeline.
Definition SDL3pp_gpu.h:4799
constexpr GPUCubeMapFace GPU_CUBEMAPFACE_POSITIVEX
GPU_CUBEMAPFACE_POSITIVEX.
Definition SDL3pp_gpu.h:4195
void BindGPUComputeSamplers(GPUComputePass compute_pass, Uint32 first_slot, std::span< const GPUTextureSamplerBinding > texture_sampler_bindings)
Binds texture-sampler pairs for use on the compute shader.
Definition SDL3pp_gpu.h:7011
void BindGPUComputeStorageTextures(GPUComputePass compute_pass, Uint32 first_slot, SpanRef< const GPUTextureRaw > storage_textures)
Binds storage textures as readonly for use on the compute pipeline.
Definition SDL3pp_gpu.h:7047
SDL_GPUBufferLocation GPUBufferLocation
A structure specifying a location in a buffer.
Definition SDL3pp_gpu.h:1681
GPUCopyPass BeginGPUCopyPass(GPUCommandBuffer command_buffer)
Begins a copy pass on a command buffer.
Definition SDL3pp_gpu.h:7246
constexpr GPUBlendOp GPU_BLENDOP_ADD
(source * source_factor) + (destination * destination_factor)
Definition SDL3pp_gpu.h:4554
constexpr GPUTextureType GPU_TEXTURETYPE_CUBE
The texture is a cube image.
Definition SDL3pp_gpu.h:2965
constexpr GPUStencilOp GPU_STENCILOP_INCREMENT_AND_WRAP
Increments the current value and wraps back to 0.
Definition SDL3pp_gpu.h:4529
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB
GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB.
Definition SDL3pp_gpu.h:2800
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_INVALID
GPU_TEXTUREFORMAT_INVALID.
Definition SDL3pp_gpu.h:2632
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_5x5_UNORM
GPU_TEXTUREFORMAT_ASTC_5x5_UNORM.
Definition SDL3pp_gpu.h:2827
ResourceRef< GPUDevice > GPUDeviceRef
Reference for GPUDevice.
Definition SDL3pp_gpu.h:386
GPUShaderFormat GetShaderFormats()
Returns the supported shader formats for this GPU context.
Definition SDL3pp_gpu.h:5280
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_BYTE4_NORM
GPU_VERTEXELEMENTFORMAT_BYTE4_NORM.
Definition SDL3pp_gpu.h:4349
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_FLOAT
GPU_VERTEXELEMENTFORMAT_FLOAT.
Definition SDL3pp_gpu.h:4322
constexpr GPUSampleCount GPU_SAMPLECOUNT_1
No multisampling.
Definition SDL3pp_gpu.h:3036
GPURenderPass BeginRenderPass(std::span< const GPUColorTargetInfo > color_target_infos, OptionalRef< const GPUDepthStencilTargetInfo > depth_stencil_target_info)
Begins a render pass on a command buffer.
Definition SDL3pp_gpu.h:6383
constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA
1 - source alpha
Definition SDL3pp_gpu.h:4604
constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE
1
Definition SDL3pp_gpu.h:4587
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM
GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM.
Definition SDL3pp_gpu.h:4352
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_SHORT4
GPU_VERTEXELEMENTFORMAT_SHORT4.
Definition SDL3pp_gpu.h:4361
void PopGPUDebugGroup(GPUCommandBuffer command_buffer)
Ends the most-recently pushed debug group.
Definition SDL3pp_gpu.h:6059
SDL_GPUComputePass * GPUComputePassRaw
Alias to raw representation for GPUComputePass.
Definition SDL3pp_gpu.h:443
void ReleaseGPUBuffer(GPUDeviceRef device, GPUBuffer buffer)
Frees the given buffer as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6119
void GDKResumeGPU(GPUDeviceRef device)
Call this to resume GPU operation on Xbox when you receive the EVENT_WILL_ENTER_FOREGROUND event.
Definition SDL3pp_gpu.h:8210
constexpr GPULoadOp GPU_LOADOP_LOAD
The previous contents of the texture will be preserved.
Definition SDL3pp_gpu.h:4141
constexpr GPUCullMode GPU_CULLMODE_NONE
No triangles are culled.
Definition SDL3pp_gpu.h:4429
constexpr GPUBlendFactor GPU_BLENDFACTOR_DST_ALPHA
destination alpha
Definition SDL3pp_gpu.h:4607
void DrawIndexedPrimitivesIndirect(GPUBuffer buffer, Uint32 offset, Uint32 draw_count)
Draws data using bound graphics state with an index buffer enabled and with draw parameters set from ...
Definition SDL3pp_gpu.h:6898
void EndGPUComputePass(GPUComputePass compute_pass)
Ends the current compute pass.
Definition SDL3pp_gpu.h:7178
SDL_GPUVertexInputRate GPUVertexInputRate
Specifies the rate at which vertex attributes are pulled from buffers.
Definition SDL3pp_gpu.h:4395
SDL_GPUBlitInfo GPUBlitInfo
A structure containing parameters for a blit command.
Definition SDL3pp_gpu.h:1998
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x5_UNORM
GPU_TEXTUREFORMAT_ASTC_10x5_UNORM.
Definition SDL3pp_gpu.h:2845
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8_UINT
GPU_TEXTUREFORMAT_R8G8_UINT.
Definition SDL3pp_gpu.h:2737
SDL_FColor FColorRaw
Alias to raw representation for FColor.
Definition SDL3pp_pixels.h:89
ResourceRef< Properties > PropertiesRef
Reference for Properties.
Definition SDL3pp_properties.h:54
SDL_Rect RectRaw
Alias to raw representation for Rect.
Definition SDL3pp_rect.h:34
::Sint32 Sint32
A signed 32-bit integer type.
Definition SDL3pp_stdinc.h:277
::Uint32 Uint32
An unsigned 32-bit integer type.
Definition SDL3pp_stdinc.h:290
::Uint8 Uint8
An unsigned 8-bit integer type.
Definition SDL3pp_stdinc.h:238
ResourceRef< Window > WindowRef
Reference for Window.
Definition SDL3pp_video.h:54
Properties for GPUBuffer creation.
Definition SDL3pp_gpu.h:5855
Properties for GPUComputePipeline creation.
Definition SDL3pp_gpu.h:5471
Properties for GPUDevice creation and information.
Definition SDL3pp_gpu.h:5077
Properties for GPUGraphicsPipeline creation.
Definition SDL3pp_gpu.h:5525
Properties for GPUSampler creation.
Definition SDL3pp_gpu.h:5576
Properties for GPUShader creation.
Definition SDL3pp_gpu.h:5675
Properties for GPUTexture creation.
Definition SDL3pp_gpu.h:5762
Properties for GPUTransferBuffer creation.
Definition SDL3pp_gpu.h:5914
Main include header for the SDL3pp library.
Uint32 narrowU32(T value)
Narrows to Uint32.
Definition SDL3pp_stdinc.h:6270
An opaque handle representing the SDL_GPU context.
Definition SDL3pp_gpu.h:3053
constexpr GPUDevice & operator=(GPUDevice &&other) noexcept
Assignment operator.
Definition SDL3pp_gpu.h:3226
~GPUDevice()
Destructor.
Definition SDL3pp_gpu.h:3223
constexpr GPUDevice(const GPUDevice &other)=delete
Copy constructor.
constexpr ResourceBase(RawPointer resource)
Constructs from resource pointer.
Definition SDL3pp_resource.h:29
GPUDevice & operator=(const GPUDevice &other)=delete
Assignment operator.
constexpr GPUDevice(GPUDeviceRaw resource) noexcept
Constructs from raw GPUDevice.
Definition SDL3pp_gpu.h:3063
constexpr GPUDevice(GPUDevice &&other) noexcept
Move constructor.
Definition SDL3pp_gpu.h:3072
A non-owning reference wrapper for a given resource.
Definition SDL3pp_resource.h:156