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
372
373// Forward decl
374struct GPUDeviceBase;
375
376// Forward decl
377struct GPUDevice;
378
380using GPUDeviceRaw = SDL_GPUDevice*;
381
388
390using GPUBufferRaw = SDL_GPUBuffer*;
391
392// Forward decl
393struct GPUBuffer;
394
396using GPUTransferBufferRaw = SDL_GPUTransferBuffer*;
397
398// Forward decl
399struct GPUTransferBuffer;
400
402using GPUTextureRaw = SDL_GPUTexture*;
403
404// Forward decl
405struct GPUTexture;
406
408using GPUSamplerRaw = SDL_GPUSampler*;
409
410// Forward decl
411struct GPUSampler;
412
414using GPUShaderRaw = SDL_GPUShader*;
415
416// Forward decl
417struct GPUShader;
418
420using GPUComputePipelineRaw = SDL_GPUComputePipeline*;
421
422// Forward decl
423struct GPUComputePipeline;
424
426using GPUGraphicsPipelineRaw = SDL_GPUGraphicsPipeline*;
427
428// Forward decl
430
432using GPUCommandBufferRaw = SDL_GPUCommandBuffer*;
433
434// Forward decl
435struct GPUCommandBuffer;
436
438using GPURenderPassRaw = SDL_GPURenderPass*;
439
440// Forward decl
441struct GPURenderPass;
442
444using GPUComputePassRaw = SDL_GPUComputePass*;
445
446// Forward decl
447struct GPUComputePass;
448
450using GPUCopyPassRaw = SDL_GPUCopyPass*;
451
452// Forward decl
453struct GPUCopyPass;
454
466using GPUBufferCreateInfo = SDL_GPUBufferCreateInfo;
467
490{
491 GPUBufferRaw m_gPUBuffer;
492
493public:
499 constexpr GPUBuffer(GPUBufferRaw gPUBuffer = {}) noexcept
500 : m_gPUBuffer(gPUBuffer)
501 {
502 }
503
547 GPUBuffer(GPUDeviceRef device, const GPUBufferCreateInfo& createinfo);
548
554 constexpr operator GPUBufferRaw() const noexcept { return m_gPUBuffer; }
555};
556
564using GPUTransferBufferCreateInfo = SDL_GPUTransferBufferCreateInfo;
565
583{
584 GPUTransferBufferRaw m_gPUTransferBuffer;
585
586public:
593 GPUTransferBufferRaw gPUTransferBuffer = {}) noexcept
594 : m_gPUTransferBuffer(gPUTransferBuffer)
595 {
596 }
597
626 const GPUTransferBufferCreateInfo& createinfo);
627
633 constexpr operator GPUTransferBufferRaw() const noexcept
634 {
635 return m_gPUTransferBuffer;
636 }
637};
638
654using GPUTextureCreateInfo = SDL_GPUTextureCreateInfo;
655
675{
676 GPUTextureRaw m_gPUTexture;
677
678public:
684 constexpr GPUTexture(GPUTextureRaw gPUTexture = {}) noexcept
685 : m_gPUTexture(gPUTexture)
686 {
687 }
688
747 GPUTexture(GPUDeviceRef device, const GPUTextureCreateInfo& createinfo);
748
754 constexpr operator GPUTextureRaw() const noexcept { return m_gPUTexture; }
755};
756
771using GPUSamplerCreateInfo = SDL_GPUSamplerCreateInfo;
772
784{
785 GPUSamplerRaw m_gPUSampler;
786
787public:
793 constexpr GPUSampler(GPUSamplerRaw gPUSampler = {}) noexcept
794 : m_gPUSampler(gPUSampler)
795 {
796 }
797
819 GPUSampler(GPUDeviceRef device, const GPUSamplerCreateInfo& createinfo);
820
826 constexpr operator GPUSamplerRaw() const noexcept { return m_gPUSampler; }
827};
828
838using GPUShaderCreateInfo = SDL_GPUShaderCreateInfo;
839
850{
851 GPUShaderRaw m_gPUShader;
852
853public:
859 constexpr GPUShader(GPUShaderRaw gPUShader = {}) noexcept
860 : m_gPUShader(gPUShader)
861 {
862 }
863
937 GPUShader(GPUDeviceRef device, const GPUShaderCreateInfo& createinfo);
938
944 constexpr operator GPUShaderRaw() const noexcept { return m_gPUShader; }
945};
946
955using GPUComputePipelineCreateInfo = SDL_GPUComputePipelineCreateInfo;
956
969{
970 GPUComputePipelineRaw m_gPUComputePipeline;
971
972public:
979 GPUComputePipelineRaw gPUComputePipeline = {}) noexcept
980 : m_gPUComputePipeline(gPUComputePipeline)
981 {
982 }
983
1030 const GPUComputePipelineCreateInfo& createinfo);
1031
1037 constexpr operator GPUComputePipelineRaw() const noexcept
1038 {
1039 return m_gPUComputePipeline;
1040 }
1041};
1042
1057using GPUGraphicsPipelineCreateInfo = SDL_GPUGraphicsPipelineCreateInfo;
1058
1071{
1072 GPUGraphicsPipelineRaw m_gPUGraphicsPipeline;
1073
1074public:
1081 GPUGraphicsPipelineRaw gPUGraphicsPipeline = {}) noexcept
1082 : m_gPUGraphicsPipeline(gPUGraphicsPipeline)
1083 {
1084 }
1085
1108 const GPUGraphicsPipelineCreateInfo& createinfo);
1109
1115 constexpr operator GPUGraphicsPipelineRaw() const noexcept
1116 {
1117 return m_gPUGraphicsPipeline;
1118 }
1119};
1120
1128using GPUViewport = SDL_GPUViewport;
1129
1138using GPUBufferBinding = SDL_GPUBufferBinding;
1139
1147using GPUIndexElementSize = SDL_GPUIndexElementSize;
1148
1150 SDL_GPU_INDEXELEMENTSIZE_16BIT;
1151
1153 SDL_GPU_INDEXELEMENTSIZE_32BIT;
1154
1165using GPUTextureSamplerBinding = SDL_GPUTextureSamplerBinding;
1166
1179{
1180 GPURenderPassRaw m_gPURenderPass;
1181
1182public:
1188 constexpr GPURenderPass(GPURenderPassRaw gPURenderPass = {}) noexcept
1189 : m_gPURenderPass(gPURenderPass)
1190 {
1191 }
1192
1198 constexpr operator GPURenderPassRaw() const noexcept
1199 {
1200 return m_gPURenderPass;
1201 }
1202
1212 void BindPipeline(GPUGraphicsPipeline graphics_pipeline);
1213
1221 void SetViewport(const GPUViewport& viewport);
1222
1230 void SetScissor(const RectRaw& scissor);
1231
1242 void SetBlendConstants(FColorRaw blend_constants);
1243
1251 void SetStencilReference(Uint8 reference);
1252
1263 void BindVertexBuffers(Uint32 first_slot,
1264 std::span<const GPUBufferBinding> bindings);
1265
1276 void BindIndexBuffer(const GPUBufferBinding& binding,
1277 GPUIndexElementSize index_element_size);
1278
1295 void BindVertexSamplers(
1296 Uint32 first_slot,
1297 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings);
1298
1315 void BindVertexStorageTextures(Uint32 first_slot,
1316 SpanRef<const GPUTextureRaw> storage_textures);
1317
1334 void BindVertexStorageBuffers(Uint32 first_slot,
1335 SpanRef<const GPUBufferRaw> storage_buffers);
1336
1354 Uint32 first_slot,
1355 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings);
1356
1374 Uint32 first_slot,
1375 SpanRef<const GPUTextureRaw> storage_textures);
1376
1393 void BindFragmentStorageBuffers(Uint32 first_slot,
1394 SpanRef<const GPUBufferRaw> storage_buffers);
1395
1418 void DrawIndexedPrimitives(Uint32 num_indices,
1419 Uint32 num_instances,
1420 Uint32 first_index,
1421 Sint32 vertex_offset,
1422 Uint32 first_instance);
1423
1443 void DrawPrimitives(Uint32 num_vertices,
1444 Uint32 num_instances,
1445 Uint32 first_vertex,
1446 Uint32 first_instance);
1447
1464 Uint32 offset,
1465 Uint32 draw_count);
1466
1483 Uint32 offset,
1484 Uint32 draw_count);
1485
1494 void End();
1495};
1496
1509{
1510 GPUComputePassRaw m_gPUComputePass;
1511
1512public:
1518 constexpr GPUComputePass(GPUComputePassRaw gPUComputePass = {}) noexcept
1519 : m_gPUComputePass(gPUComputePass)
1520 {
1521 }
1522
1528 constexpr operator GPUComputePassRaw() const noexcept
1529 {
1530 return m_gPUComputePass;
1531 }
1532
1540 void BindPipeline(GPUComputePipeline compute_pipeline);
1541
1558 void BindSamplers(
1559 Uint32 first_slot,
1560 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings);
1561
1578 void BindStorageTextures(Uint32 first_slot,
1579 SpanRef<const GPUTextureRaw> storage_textures);
1580
1597 void BindStorageBuffers(Uint32 first_slot,
1598 SpanRef<const GPUBufferRaw> storage_buffers);
1599
1619 void Dispatch(Uint32 groupcount_x, Uint32 groupcount_y, Uint32 groupcount_z);
1620
1637 void DispatchIndirect(GPUBuffer buffer, Uint32 offset);
1638
1647 void End();
1648};
1649
1660using GPUBufferRegion = SDL_GPUBufferRegion;
1661
1671using GPUTextureLocation = SDL_GPUTextureLocation;
1672
1682using GPUBufferLocation = SDL_GPUBufferLocation;
1683
1695using GPUTextureRegion = SDL_GPUTextureRegion;
1696
1718using GPUTextureTransferInfo = SDL_GPUTextureTransferInfo;
1719
1730using GPUTransferBufferLocation = SDL_GPUTransferBufferLocation;
1731
1744{
1745 GPUCopyPassRaw m_gPUCopyPass;
1746
1747public:
1753 constexpr GPUCopyPass(GPUCopyPassRaw gPUCopyPass = {}) noexcept
1754 : m_gPUCopyPass(gPUCopyPass)
1755 {
1756 }
1757
1763 constexpr operator GPUCopyPassRaw() const noexcept { return m_gPUCopyPass; }
1764
1781 void UploadToTexture(const GPUTextureTransferInfo& source,
1782 const GPUTextureRegion& destination,
1783 bool cycle);
1784
1798 void UploadToBuffer(const GPUTransferBufferLocation& source,
1799 const GPUBufferRegion& destination,
1800 bool cycle);
1801
1822 void CopyTextureToTexture(const GPUTextureLocation& source,
1823 const GPUTextureLocation& destination,
1824 Uint32 w,
1825 Uint32 h,
1826 Uint32 d,
1827 bool cycle);
1828
1843 void CopyBufferToBuffer(const GPUBufferLocation& source,
1844 const GPUBufferLocation& destination,
1845 Uint32 size,
1846 bool cycle);
1847
1860 void DownloadFromTexture(const GPUTextureRegion& source,
1861 const GPUTextureTransferInfo& destination);
1862
1874 void DownloadFromBuffer(const GPUBufferRegion& source,
1875 const GPUTransferBufferLocation& destination);
1876
1882 void End();
1883};
1884
1921using GPUColorTargetInfo = SDL_GPUColorTargetInfo;
1922
1970using GPUDepthStencilTargetInfo = SDL_GPUDepthStencilTargetInfo;
1971
1980using GPUStorageTextureReadWriteBinding = SDL_GPUStorageTextureReadWriteBinding;
1981
1990using GPUStorageBufferReadWriteBinding = SDL_GPUStorageBufferReadWriteBinding;
1991
1999using GPUBlitInfo = SDL_GPUBlitInfo;
2000
2011using GPUFence = SDL_GPUFence;
2012
2037{
2038 GPUCommandBufferRaw m_gPUCommandBuffer;
2039
2040public:
2046 constexpr GPUCommandBuffer(GPUCommandBufferRaw gPUCommandBuffer = {}) noexcept
2047 : m_gPUCommandBuffer(gPUCommandBuffer)
2048 {
2049 }
2050
2056 constexpr operator GPUCommandBufferRaw() const noexcept
2057 {
2058 return m_gPUCommandBuffer;
2059 }
2060
2075 void InsertDebugLabel(StringParam text);
2076
2102 void PushDebugGroup(StringParam name);
2103
2116 void PopDebugGroup();
2117
2135 void PushVertexUniformData(Uint32 slot_index, SourceBytes data);
2136
2151 void PushFragmentUniformData(Uint32 slot_index, SourceBytes data);
2152
2167 void PushComputeUniformData(Uint32 slot_index, SourceBytes data);
2168
2200 std::span<const GPUColorTargetInfo> color_target_infos,
2201 OptionalRef<const GPUDepthStencilTargetInfo> depth_stencil_target_info);
2202
2236 std::span<const GPUStorageTextureReadWriteBinding> storage_texture_bindings,
2237 std::span<const GPUStorageBufferReadWriteBinding> storage_buffer_bindings);
2238
2253
2264
2274 void BlitTexture(const GPUBlitInfo& info);
2275
2322 WindowRef window,
2323 Uint32* swapchain_texture_width = nullptr,
2324 Uint32* swapchain_texture_height = nullptr);
2325
2366 WindowRef window,
2367 Uint32* swapchain_texture_width = nullptr,
2368 Uint32* swapchain_texture_height = nullptr);
2369
2389 void Submit();
2390
2415
2436 void Cancel();
2437};
2438
2449
2451 SDL_GPU_SHADERFORMAT_INVALID;
2452
2454 SDL_GPU_SHADERFORMAT_PRIVATE;
2455
2457 SDL_GPU_SHADERFORMAT_SPIRV;
2458
2460 SDL_GPU_SHADERFORMAT_DXBC;
2461
2463 SDL_GPU_SHADERFORMAT_DXIL;
2464
2466 SDL_GPU_SHADERFORMAT_MSL;
2467
2469 SDL_GPU_SHADERFORMAT_METALLIB;
2470
2496using GPUSwapchainComposition = SDL_GPUSwapchainComposition;
2497
2499 SDL_GPU_SWAPCHAINCOMPOSITION_SDR;
2500
2502 SDL_GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR;
2503
2505 SDL_GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR;
2506
2508 SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2084;
2509
2535using GPUPresentMode = SDL_GPUPresentMode;
2536
2538 SDL_GPU_PRESENTMODE_VSYNC;
2539
2541 SDL_GPU_PRESENTMODE_IMMEDIATE;
2542
2544 SDL_GPU_PRESENTMODE_MAILBOX;
2545
2627using GPUTextureFormat = SDL_GPUTextureFormat;
2628
2630 SDL_GPU_TEXTUREFORMAT_INVALID;
2631
2633 SDL_GPU_TEXTUREFORMAT_A8_UNORM;
2634
2636 SDL_GPU_TEXTUREFORMAT_R8_UNORM;
2637
2639 SDL_GPU_TEXTUREFORMAT_R8G8_UNORM;
2640
2642 SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM;
2643
2645 SDL_GPU_TEXTUREFORMAT_R16_UNORM;
2646
2648 SDL_GPU_TEXTUREFORMAT_R16G16_UNORM;
2649
2651 SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UNORM;
2652
2654 SDL_GPU_TEXTUREFORMAT_R10G10B10A2_UNORM;
2655
2657 SDL_GPU_TEXTUREFORMAT_B5G6R5_UNORM;
2658
2660 SDL_GPU_TEXTUREFORMAT_B5G5R5A1_UNORM;
2661
2663 SDL_GPU_TEXTUREFORMAT_B4G4R4A4_UNORM;
2664
2666 SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM;
2667
2669 SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM;
2670
2672 SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM;
2673
2675 SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM;
2676
2678 SDL_GPU_TEXTUREFORMAT_BC4_R_UNORM;
2679
2681 SDL_GPU_TEXTUREFORMAT_BC5_RG_UNORM;
2682
2684 SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM;
2685
2687 SDL_GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT;
2688
2690 SDL_GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT;
2691
2693 SDL_GPU_TEXTUREFORMAT_R8_SNORM;
2694
2696 SDL_GPU_TEXTUREFORMAT_R8G8_SNORM;
2697
2699 SDL_GPU_TEXTUREFORMAT_R8G8B8A8_SNORM;
2700
2702 SDL_GPU_TEXTUREFORMAT_R16_SNORM;
2703
2705 SDL_GPU_TEXTUREFORMAT_R16G16_SNORM;
2706
2708 SDL_GPU_TEXTUREFORMAT_R16G16B16A16_SNORM;
2709
2711 SDL_GPU_TEXTUREFORMAT_R16_FLOAT;
2712
2714 SDL_GPU_TEXTUREFORMAT_R16G16_FLOAT;
2715
2717 SDL_GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT;
2718
2720 SDL_GPU_TEXTUREFORMAT_R32_FLOAT;
2721
2723 SDL_GPU_TEXTUREFORMAT_R32G32_FLOAT;
2724
2726 SDL_GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT;
2727
2729 SDL_GPU_TEXTUREFORMAT_R11G11B10_UFLOAT;
2730
2732 SDL_GPU_TEXTUREFORMAT_R8_UINT;
2733
2735 SDL_GPU_TEXTUREFORMAT_R8G8_UINT;
2736
2738 SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UINT;
2739
2741 SDL_GPU_TEXTUREFORMAT_R16_UINT;
2742
2744 SDL_GPU_TEXTUREFORMAT_R16G16_UINT;
2745
2747 SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UINT;
2748
2750 SDL_GPU_TEXTUREFORMAT_R32_UINT;
2751
2753 SDL_GPU_TEXTUREFORMAT_R32G32_UINT;
2754
2756 SDL_GPU_TEXTUREFORMAT_R32G32B32A32_UINT;
2757
2759 SDL_GPU_TEXTUREFORMAT_R8_INT;
2760
2762 SDL_GPU_TEXTUREFORMAT_R8G8_INT;
2763
2765 SDL_GPU_TEXTUREFORMAT_R8G8B8A8_INT;
2766
2768 SDL_GPU_TEXTUREFORMAT_R16_INT;
2769
2771 SDL_GPU_TEXTUREFORMAT_R16G16_INT;
2772
2774 SDL_GPU_TEXTUREFORMAT_R16G16B16A16_INT;
2775
2777 SDL_GPU_TEXTUREFORMAT_R32_INT;
2778
2780 SDL_GPU_TEXTUREFORMAT_R32G32_INT;
2781
2783 SDL_GPU_TEXTUREFORMAT_R32G32B32A32_INT;
2784
2786 SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB;
2787
2789 SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB;
2790
2792 SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB;
2793
2795 SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB;
2796
2798 SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB;
2799
2801 SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB;
2802
2804 SDL_GPU_TEXTUREFORMAT_D16_UNORM;
2805
2807 SDL_GPU_TEXTUREFORMAT_D24_UNORM;
2808
2810 SDL_GPU_TEXTUREFORMAT_D32_FLOAT;
2811
2813 SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT;
2814
2816 SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT;
2817
2819 SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM;
2820
2822 SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM;
2823
2825 SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM;
2826
2828 SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM;
2829
2831 SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM;
2832
2834 SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM;
2835
2837 SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM;
2838
2840 SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM;
2841
2843 SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM;
2844
2846 SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM;
2847
2849 SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM;
2850
2852 SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM;
2853
2855 SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM;
2856
2858 SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM;
2859
2861 SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM_SRGB;
2862
2864 SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM_SRGB;
2865
2867 SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM_SRGB;
2868
2870 SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM_SRGB;
2871
2873 SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM_SRGB;
2874
2876 SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM_SRGB;
2877
2879 SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM_SRGB;
2880
2882 SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM_SRGB;
2883
2885 SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM_SRGB;
2886
2888 SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM_SRGB;
2889
2891 SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM_SRGB;
2892
2894 SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM_SRGB;
2895
2897 SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM_SRGB;
2898
2900 SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM_SRGB;
2901
2903 SDL_GPU_TEXTUREFORMAT_ASTC_4x4_FLOAT;
2904
2906 SDL_GPU_TEXTUREFORMAT_ASTC_5x4_FLOAT;
2907
2909 SDL_GPU_TEXTUREFORMAT_ASTC_5x5_FLOAT;
2910
2912 SDL_GPU_TEXTUREFORMAT_ASTC_6x5_FLOAT;
2913
2915 SDL_GPU_TEXTUREFORMAT_ASTC_6x6_FLOAT;
2916
2918 SDL_GPU_TEXTUREFORMAT_ASTC_8x5_FLOAT;
2919
2921 SDL_GPU_TEXTUREFORMAT_ASTC_8x6_FLOAT;
2922
2924 SDL_GPU_TEXTUREFORMAT_ASTC_8x8_FLOAT;
2925
2927 SDL_GPU_TEXTUREFORMAT_ASTC_10x5_FLOAT;
2928
2930 SDL_GPU_TEXTUREFORMAT_ASTC_10x6_FLOAT;
2931
2933 SDL_GPU_TEXTUREFORMAT_ASTC_10x8_FLOAT;
2934
2936 SDL_GPU_TEXTUREFORMAT_ASTC_10x10_FLOAT;
2937
2939 SDL_GPU_TEXTUREFORMAT_ASTC_12x10_FLOAT;
2940
2942 SDL_GPU_TEXTUREFORMAT_ASTC_12x12_FLOAT;
2943
2951using GPUTextureType = SDL_GPUTextureType;
2952
2954 SDL_GPU_TEXTURETYPE_2D;
2955
2957 SDL_GPU_TEXTURETYPE_2D_ARRAY;
2958
2960 SDL_GPU_TEXTURETYPE_3D;
2961
2963 SDL_GPU_TEXTURETYPE_CUBE;
2964
2966 SDL_GPU_TEXTURETYPE_CUBE_ARRAY;
2967
2989
2991 SDL_GPU_TEXTUREUSAGE_SAMPLER;
2992
2994 SDL_GPU_TEXTUREUSAGE_COLOR_TARGET;
2995
2997 SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET;
2999
3001 SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ;
3003
3006 SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ;
3007
3010 SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE;
3011
3016constexpr GPUTextureUsageFlags
3018 SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE;
3019
3031using GPUSampleCount = SDL_GPUSampleCount;
3032
3034 SDL_GPU_SAMPLECOUNT_1;
3035
3036constexpr GPUSampleCount GPU_SAMPLECOUNT_2 = SDL_GPU_SAMPLECOUNT_2;
3037
3038constexpr GPUSampleCount GPU_SAMPLECOUNT_4 = SDL_GPU_SAMPLECOUNT_4;
3039
3040constexpr GPUSampleCount GPU_SAMPLECOUNT_8 = SDL_GPU_SAMPLECOUNT_8;
3041
3047struct GPUDeviceBase : ResourceBaseT<GPUDeviceRaw>
3048{
3050
3058 void Destroy();
3059
3067 const char* GetDriver();
3068
3078
3079#if SDL_VERSION_ATLEAST(3, 4, 0)
3080
3183
3184#endif // SDL_VERSION_ATLEAST(3, 4, 0)
3185
3231 const GPUComputePipelineCreateInfo& createinfo);
3232
3254 const GPUGraphicsPipelineCreateInfo& createinfo);
3255
3277
3350 GPUShader CreateShader(const GPUShaderCreateInfo& createinfo);
3351
3410
3453 GPUBuffer CreateBuffer(const GPUBufferCreateInfo& createinfo);
3454
3482 const GPUTransferBufferCreateInfo& createinfo);
3483
3500 void SetBufferName(GPUBuffer buffer, StringParam text);
3501
3518 void SetTextureName(GPUTexture texture, StringParam text);
3519
3529 void ReleaseTexture(GPUTexture texture);
3530
3540 void ReleaseSampler(GPUSampler sampler);
3541
3551 void ReleaseBuffer(GPUBuffer buffer);
3552
3562 void ReleaseTransferBuffer(GPUTransferBuffer transfer_buffer);
3563
3573 void ReleaseComputePipeline(GPUComputePipeline compute_pipeline);
3574
3584 void ReleaseShader(GPUShader shader);
3585
3595 void ReleaseGraphicsPipeline(GPUGraphicsPipeline graphics_pipeline);
3596
3621
3636 void* MapTransferBuffer(GPUTransferBuffer transfer_buffer, bool cycle);
3637
3645 void UnmapTransferBuffer(GPUTransferBuffer transfer_buffer);
3646
3661 WindowRef window,
3662 GPUSwapchainComposition swapchain_composition);
3663
3677 bool WindowSupportsPresentMode(WindowRef window, GPUPresentMode present_mode);
3678
3703 void ClaimWindow(WindowRef window);
3704
3714 void ReleaseWindow(WindowRef window);
3715
3739 GPUSwapchainComposition swapchain_composition,
3740 GPUPresentMode present_mode);
3741
3766 bool SetAllowedFramesInFlight(Uint32 allowed_frames_in_flight);
3767
3779
3795 void WaitForSwapchain(WindowRef window);
3796
3806 void WaitForIdle();
3807
3821 void WaitForFences(bool wait_all, std::span<GPUFence* const> fences);
3822
3833 bool QueryFence(GPUFence* fence);
3834
3846 void ReleaseFence(GPUFence* fence);
3847
3860 GPUTextureType type,
3861 GPUTextureUsageFlags usage);
3862
3873 GPUSampleCount sample_count);
3874
3875#ifdef SDL_PLATFORM_GDK
3876
3888 void GDKSuspendGPU();
3889
3901 void GDKResumeGPU();
3902
3903#endif /* SDL_PLATFORM_GDK */
3904};
3905
3914{
3915 using GPUDeviceBase::GPUDeviceBase;
3916
3924 constexpr explicit GPUDevice(GPUDeviceRaw resource) noexcept
3925 : GPUDeviceBase(resource)
3926 {
3927 }
3928
3930 constexpr GPUDevice(GPUDevice&& other) noexcept
3931 : GPUDevice(other.release())
3932 {
3933 }
3934
3961 GPUDevice(GPUShaderFormat format_flags, bool debug_mode, StringParam name);
3962
4074 GPUDevice(PropertiesRef props);
4075
4077 ~GPUDevice() { SDL_DestroyGPUDevice(get()); }
4078
4080 constexpr GPUDevice& operator=(GPUDevice&& other) noexcept
4081 {
4082 swap(*this, other);
4083 return *this;
4084 }
4085};
4086
4107using GPUPrimitiveType = SDL_GPUPrimitiveType;
4108
4110 SDL_GPU_PRIMITIVETYPE_TRIANGLELIST;
4111
4113 SDL_GPU_PRIMITIVETYPE_TRIANGLESTRIP;
4114
4116 SDL_GPU_PRIMITIVETYPE_LINELIST;
4117
4119 SDL_GPU_PRIMITIVETYPE_LINESTRIP;
4120
4122 SDL_GPU_PRIMITIVETYPE_POINTLIST;
4123
4132using GPULoadOp = SDL_GPULoadOp;
4133
4135constexpr GPULoadOp GPU_LOADOP_LOAD = SDL_GPU_LOADOP_LOAD;
4136
4138constexpr GPULoadOp GPU_LOADOP_CLEAR = SDL_GPU_LOADOP_CLEAR;
4139
4144constexpr GPULoadOp GPU_LOADOP_DONT_CARE = SDL_GPU_LOADOP_DONT_CARE;
4145
4154using GPUStoreOp = SDL_GPUStoreOp;
4155
4157constexpr GPUStoreOp GPU_STOREOP_STORE = SDL_GPU_STOREOP_STORE;
4158
4163constexpr GPUStoreOp GPU_STOREOP_DONT_CARE = SDL_GPU_STOREOP_DONT_CARE;
4164
4170constexpr GPUStoreOp GPU_STOREOP_RESOLVE = SDL_GPU_STOREOP_RESOLVE;
4171
4178 SDL_GPU_STOREOP_RESOLVE_AND_STORE;
4179
4187using GPUCubeMapFace = SDL_GPUCubeMapFace;
4188
4190 SDL_GPU_CUBEMAPFACE_POSITIVEX;
4191
4193 SDL_GPU_CUBEMAPFACE_NEGATIVEX;
4194
4196 SDL_GPU_CUBEMAPFACE_POSITIVEY;
4197
4199 SDL_GPU_CUBEMAPFACE_NEGATIVEY;
4200
4202 SDL_GPU_CUBEMAPFACE_POSITIVEZ;
4203
4205 SDL_GPU_CUBEMAPFACE_NEGATIVEZ;
4206
4225
4227 SDL_GPU_BUFFERUSAGE_VERTEX;
4228
4230 SDL_GPU_BUFFERUSAGE_INDEX;
4231
4233 SDL_GPU_BUFFERUSAGE_INDIRECT;
4234
4236 SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ;
4238
4241 SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ;
4242
4245 SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE;
4246
4257using GPUTransferBufferUsage = SDL_GPUTransferBufferUsage;
4258
4260 SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD;
4261
4263 SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD;
4264
4272using GPUShaderStage = SDL_GPUShaderStage;
4273
4275 SDL_GPU_SHADERSTAGE_VERTEX;
4276
4278 SDL_GPU_SHADERSTAGE_FRAGMENT;
4279
4287using GPUVertexElementFormat = SDL_GPUVertexElementFormat;
4288
4290 SDL_GPU_VERTEXELEMENTFORMAT_INVALID;
4291
4293 SDL_GPU_VERTEXELEMENTFORMAT_INT;
4294
4296 SDL_GPU_VERTEXELEMENTFORMAT_INT2;
4297
4299 SDL_GPU_VERTEXELEMENTFORMAT_INT3;
4300
4302 SDL_GPU_VERTEXELEMENTFORMAT_INT4;
4303
4305 SDL_GPU_VERTEXELEMENTFORMAT_UINT;
4306
4308 SDL_GPU_VERTEXELEMENTFORMAT_UINT2;
4309
4311 SDL_GPU_VERTEXELEMENTFORMAT_UINT3;
4312
4314 SDL_GPU_VERTEXELEMENTFORMAT_UINT4;
4315
4317 SDL_GPU_VERTEXELEMENTFORMAT_FLOAT;
4318
4320 SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2;
4321
4323 SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3;
4324
4326 SDL_GPU_VERTEXELEMENTFORMAT_FLOAT4;
4327
4329 SDL_GPU_VERTEXELEMENTFORMAT_BYTE2;
4330
4332 SDL_GPU_VERTEXELEMENTFORMAT_BYTE4;
4333
4335 SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2;
4336
4338 SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4;
4339
4341 SDL_GPU_VERTEXELEMENTFORMAT_BYTE2_NORM;
4342
4344 SDL_GPU_VERTEXELEMENTFORMAT_BYTE4_NORM;
4345
4347 SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM;
4348
4350 SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM;
4351
4353 SDL_GPU_VERTEXELEMENTFORMAT_SHORT2;
4354
4356 SDL_GPU_VERTEXELEMENTFORMAT_SHORT4;
4357
4359 SDL_GPU_VERTEXELEMENTFORMAT_USHORT2;
4360
4362 SDL_GPU_VERTEXELEMENTFORMAT_USHORT4;
4363
4365 SDL_GPU_VERTEXELEMENTFORMAT_SHORT2_NORM;
4366
4368 SDL_GPU_VERTEXELEMENTFORMAT_SHORT4_NORM;
4369
4371 SDL_GPU_VERTEXELEMENTFORMAT_USHORT2_NORM;
4372
4374 SDL_GPU_VERTEXELEMENTFORMAT_USHORT4_NORM;
4375
4377 SDL_GPU_VERTEXELEMENTFORMAT_HALF2;
4378
4380 SDL_GPU_VERTEXELEMENTFORMAT_HALF4;
4381
4389using GPUVertexInputRate = SDL_GPUVertexInputRate;
4390
4393 SDL_GPU_VERTEXINPUTRATE_VERTEX;
4394
4397 SDL_GPU_VERTEXINPUTRATE_INSTANCE;
4398
4406using GPUFillMode = SDL_GPUFillMode;
4407
4409 SDL_GPU_FILLMODE_FILL;
4410
4412 SDL_GPU_FILLMODE_LINE;
4413
4421using GPUCullMode = SDL_GPUCullMode;
4422
4424 SDL_GPU_CULLMODE_NONE;
4425
4427 SDL_GPU_CULLMODE_FRONT;
4428
4430 SDL_GPU_CULLMODE_BACK;
4431
4440using GPUFrontFace = SDL_GPUFrontFace;
4441
4447 SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE;
4448
4450constexpr GPUFrontFace GPU_FRONTFACE_CLOCKWISE = SDL_GPU_FRONTFACE_CLOCKWISE;
4451
4459using GPUCompareOp = SDL_GPUCompareOp;
4460
4462 SDL_GPU_COMPAREOP_INVALID;
4463
4465 SDL_GPU_COMPAREOP_NEVER;
4466
4468 SDL_GPU_COMPAREOP_LESS;
4469
4471 SDL_GPU_COMPAREOP_EQUAL;
4472
4474 SDL_GPU_COMPAREOP_LESS_OR_EQUAL;
4476
4478 SDL_GPU_COMPAREOP_GREATER;
4479
4481 SDL_GPU_COMPAREOP_NOT_EQUAL;
4482
4484 SDL_GPU_COMPAREOP_GREATER_OR_EQUAL;
4486
4488 SDL_GPU_COMPAREOP_ALWAYS;
4489
4498using GPUStencilOp = SDL_GPUStencilOp;
4499
4501 SDL_GPU_STENCILOP_INVALID;
4502
4504 SDL_GPU_STENCILOP_KEEP;
4505
4507 SDL_GPU_STENCILOP_ZERO;
4508
4510 SDL_GPU_STENCILOP_REPLACE;
4511
4514 SDL_GPU_STENCILOP_INCREMENT_AND_CLAMP;
4515
4517 SDL_GPU_STENCILOP_DECREMENT_AND_CLAMP;
4519
4521 SDL_GPU_STENCILOP_INVERT;
4522
4524 SDL_GPU_STENCILOP_INCREMENT_AND_WRAP;
4526
4529 SDL_GPU_STENCILOP_DECREMENT_AND_WRAP;
4530
4542using GPUBlendOp = SDL_GPUBlendOp;
4543
4545 SDL_GPU_BLENDOP_INVALID;
4546
4548constexpr GPUBlendOp GPU_BLENDOP_ADD = SDL_GPU_BLENDOP_ADD;
4549
4551constexpr GPUBlendOp GPU_BLENDOP_SUBTRACT = SDL_GPU_BLENDOP_SUBTRACT;
4552
4555 SDL_GPU_BLENDOP_REVERSE_SUBTRACT;
4556
4558 SDL_GPU_BLENDOP_MIN;
4559
4561 SDL_GPU_BLENDOP_MAX;
4562
4574using GPUBlendFactor = SDL_GPUBlendFactor;
4575
4577 SDL_GPU_BLENDFACTOR_INVALID;
4578
4579constexpr GPUBlendFactor GPU_BLENDFACTOR_ZERO = SDL_GPU_BLENDFACTOR_ZERO;
4580
4581constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE = SDL_GPU_BLENDFACTOR_ONE;
4582
4584 SDL_GPU_BLENDFACTOR_SRC_COLOR;
4585
4587 SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR;
4588
4590 SDL_GPU_BLENDFACTOR_DST_COLOR;
4591
4593 SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR;
4594
4596 SDL_GPU_BLENDFACTOR_SRC_ALPHA;
4597
4599 SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA;
4600
4602 SDL_GPU_BLENDFACTOR_DST_ALPHA;
4603
4605 SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA;
4606
4608 SDL_GPU_BLENDFACTOR_CONSTANT_COLOR;
4609
4611 SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR;
4612
4614 SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE;
4616
4625
4627 SDL_GPU_COLORCOMPONENT_R;
4628
4630 SDL_GPU_COLORCOMPONENT_G;
4631
4633 SDL_GPU_COLORCOMPONENT_B;
4634
4636 SDL_GPU_COLORCOMPONENT_A;
4637
4645using GPUFilter = SDL_GPUFilter;
4646
4648 SDL_GPU_FILTER_NEAREST;
4649
4651 SDL_GPU_FILTER_LINEAR;
4652
4660using GPUSamplerMipmapMode = SDL_GPUSamplerMipmapMode;
4661
4663 SDL_GPU_SAMPLERMIPMAPMODE_NEAREST;
4664
4666 SDL_GPU_SAMPLERMIPMAPMODE_LINEAR;
4667
4676using GPUSamplerAddressMode = SDL_GPUSamplerAddressMode;
4677
4679 SDL_GPU_SAMPLERADDRESSMODE_REPEAT;
4681
4684 SDL_GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT;
4685
4688 SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE;
4689
4697using GPUBlitRegion = SDL_GPUBlitRegion;
4698
4713using GPUIndirectDrawCommand = SDL_GPUIndirectDrawCommand;
4714
4729using GPUIndexedIndirectDrawCommand = SDL_GPUIndexedIndirectDrawCommand;
4730
4738using GPUIndirectDispatchCommand = SDL_GPUIndirectDispatchCommand;
4739
4758using GPUVertexBufferDescription = SDL_GPUVertexBufferDescription;
4759
4772using GPUVertexAttribute = SDL_GPUVertexAttribute;
4773
4784using GPUVertexInputState = SDL_GPUVertexInputState;
4785
4793using GPUStencilOpState = SDL_GPUStencilOpState;
4794
4805using GPUColorTargetBlendState = SDL_GPUColorTargetBlendState;
4806
4823using GPURasterizerState = SDL_GPURasterizerState;
4824
4833using GPUMultisampleState = SDL_GPUMultisampleState;
4834
4843using GPUDepthStencilState = SDL_GPUDepthStencilState;
4844
4853using GPUColorTargetDescription = SDL_GPUColorTargetDescription;
4854
4865using GPUGraphicsPipelineTargetInfo = SDL_GPUGraphicsPipelineTargetInfo;
4866
4881 StringParam name)
4882{
4883 return SDL_GPUSupportsShaderFormats(format_flags, name);
4884}
4885
4897{
4898 return SDL_GPUSupportsProperties(props);
4899}
4900
4928 bool debug_mode,
4929 StringParam name)
4930{
4931 return GPUDevice(format_flags, debug_mode, std::move(name));
4932}
4933
4935 bool debug_mode,
4936 StringParam name)
4937 : GPUDevice(CheckError(SDL_CreateGPUDevice(format_flags, debug_mode, name)))
4938{
4939}
4940
4942 : GPUDevice(CheckError(SDL_CreateGPUDeviceWithProperties(props)))
4943{
4944}
4945
5056{
5057 return GPUDevice(props);
5058}
5059
5068
5069constexpr auto DEBUGMODE_BOOLEAN =
5070 SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN;
5071
5073 SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN;
5074
5075#if SDL_VERSION_ATLEAST(3, 4, 0)
5076
5077constexpr auto VERBOSE_BOOLEAN =
5078 SDL_PROP_GPU_DEVICE_CREATE_VERBOSE_BOOLEAN;
5079
5080#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5081
5082constexpr auto NAME_STRING =
5083 SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING;
5084
5085#if SDL_VERSION_ATLEAST(3, 4, 0)
5086
5088 SDL_PROP_GPU_DEVICE_CREATE_FEATURE_CLIP_DISTANCE_BOOLEAN;
5090
5092 SDL_PROP_GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN;
5095
5097 SDL_PROP_GPU_DEVICE_CREATE_FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN;
5098
5100 SDL_PROP_GPU_DEVICE_CREATE_FEATURE_ANISOTROPY_BOOLEAN;
5102
5103#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5104
5106 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN;
5108
5110 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOLEAN;
5111
5112constexpr auto SHADERS_DXBC_BOOLEAN =
5113 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOLEAN;
5114
5115constexpr auto SHADERS_DXIL_BOOLEAN =
5116 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN;
5117
5118constexpr auto SHADERS_MSL_BOOLEAN =
5119 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN;
5120
5122 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN;
5124
5125#if SDL_VERSION_ATLEAST(3, 4, 0)
5126
5128 SDL_PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN;
5134
5135#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5136
5138 SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING;
5140
5141#if SDL_VERSION_ATLEAST(3, 4, 2)
5142
5144 SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_VERSION_NUMBER;
5148
5150 SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_PATH_STRING;
5153
5154#endif // SDL_VERSION_ATLEAST(3, 4, 2)
5155
5156#if SDL_VERSION_ATLEAST(3, 4, 0)
5157
5159 SDL_PROP_GPU_DEVICE_CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN;
5160
5162 SDL_PROP_GPU_DEVICE_CREATE_VULKAN_OPTIONS_POINTER;
5164
5165#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5166
5167#if SDL_VERSION_ATLEAST(3, 4, 2)
5168
5170 SDL_PROP_GPU_DEVICE_CREATE_METAL_ALLOW_MACFAMILY1_BOOLEAN;
5173
5174#endif // SDL_VERSION_ATLEAST(3, 4, 2)
5175
5176} // namespace prop::GPUDevice::Create
5177
5178#if SDL_VERSION_ATLEAST(3, 4, 0)
5179
5196using GPUVulkanOptions = SDL_GPUVulkanOptions;
5197
5198#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5199
5210{
5211 SDL_DestroyGPUDevice(device);
5212}
5213
5215
5225inline int GetNumGPUDrivers() { return SDL_GetNumGPUDrivers(); }
5226
5244inline const char* GetGPUDriver(int index) { return SDL_GetGPUDriver(index); }
5245
5254inline const char* GetGPUDeviceDriver(GPUDeviceRef device)
5255{
5256 return SDL_GetGPUDeviceDriver(device);
5257}
5258
5259inline const char* GPUDeviceBase::GetDriver()
5260{
5261 return SDL::GetGPUDeviceDriver(get());
5262}
5263
5274{
5275 return SDL_GetGPUShaderFormats(device);
5276}
5277
5282
5283#if SDL_VERSION_ATLEAST(3, 4, 0)
5284
5387{
5388 return CheckError(SDL_GetGPUDeviceProperties(device));
5389}
5390
5395
5408namespace prop::GPUDevice {
5409
5410constexpr auto NAME_STRING =
5411 SDL_PROP_GPU_DEVICE_NAME_STRING;
5412
5413constexpr auto DRIVER_NAME_STRING =
5414 SDL_PROP_GPU_DEVICE_DRIVER_NAME_STRING;
5415
5417 SDL_PROP_GPU_DEVICE_DRIVER_VERSION_STRING;
5418
5419constexpr auto DRIVER_INFO_STRING =
5420 SDL_PROP_GPU_DEVICE_DRIVER_INFO_STRING;
5421
5422} // namespace prop::GPUDevice
5423
5424#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5425
5472 GPUDeviceRef device,
5473 const GPUComputePipelineCreateInfo& createinfo)
5474{
5475 return GPUComputePipeline(device, createinfo);
5476}
5477
5479 const GPUComputePipelineCreateInfo& createinfo)
5480{
5481 return GPUComputePipeline(get(), createinfo);
5482}
5483
5485 GPUDeviceRef device,
5486 const GPUComputePipelineCreateInfo& createinfo)
5487 : m_gPUComputePipeline(
5488 CheckError(SDL_CreateGPUComputePipeline(device, &createinfo)))
5489{
5490}
5491
5498
5499constexpr auto NAME_STRING =
5500 SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING;
5501
5502} // namespace prop::GPUComputePipeline::Create
5503
5526 GPUDeviceRef device,
5527 const GPUGraphicsPipelineCreateInfo& createinfo)
5528{
5529 return GPUGraphicsPipeline(device, createinfo);
5530}
5531
5533 const GPUGraphicsPipelineCreateInfo& createinfo)
5534{
5535 return GPUGraphicsPipeline(get(), createinfo);
5536}
5537
5539 GPUDeviceRef device,
5540 const GPUGraphicsPipelineCreateInfo& createinfo)
5541 : m_gPUGraphicsPipeline(
5542 CheckError(SDL_CreateGPUGraphicsPipeline(device, &createinfo)))
5543{
5544}
5545
5552
5553constexpr auto NAME_STRING =
5554 SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING;
5555
5556} // namespace prop::GPUGraphicsPipeline::Create
5557
5580 const GPUSamplerCreateInfo& createinfo)
5581{
5582 return GPUSampler(device, createinfo);
5583}
5584
5586 const GPUSamplerCreateInfo& createinfo)
5587{
5588 return GPUSampler(get(), createinfo);
5589}
5590
5592 const GPUSamplerCreateInfo& createinfo)
5593 : m_gPUSampler(CheckError(SDL_CreateGPUSampler(device, &createinfo)))
5594{
5595}
5596
5603
5604constexpr auto NAME_STRING =
5605 SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING;
5606
5607} // namespace prop::GPUSampler::Create
5608
5681 const GPUShaderCreateInfo& createinfo)
5682{
5683 return GPUShader(device, createinfo);
5684}
5685
5687 const GPUShaderCreateInfo& createinfo)
5688{
5689 return GPUShader(get(), createinfo);
5690}
5691
5693 const GPUShaderCreateInfo& createinfo)
5694 : m_gPUShader(CheckError(SDL_CreateGPUShader(device, &createinfo)))
5695{
5696}
5697
5704
5705constexpr auto NAME_STRING =
5706 SDL_PROP_GPU_SHADER_CREATE_NAME_STRING;
5707
5708} // namespace prop::GPUShader::Create
5709
5769 const GPUTextureCreateInfo& createinfo)
5770{
5771 return GPUTexture(device, createinfo);
5772}
5773
5775 const GPUTextureCreateInfo& createinfo)
5776{
5777 return GPUTexture(get(), createinfo);
5778}
5779
5781 const GPUTextureCreateInfo& createinfo)
5782 : m_gPUTexture(CheckError(SDL_CreateGPUTexture(device, &createinfo)))
5783{
5784}
5785
5792
5793constexpr auto D3D12_CLEAR_R_FLOAT =
5794 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT;
5795
5796constexpr auto D3D12_CLEAR_G_FLOAT =
5797 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT;
5798
5799constexpr auto D3D12_CLEAR_B_FLOAT =
5800 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT;
5801
5802constexpr auto D3D12_CLEAR_A_FLOAT =
5803 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT;
5804
5806 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT;
5808
5809#if SDL_VERSION_ATLEAST(3, 2, 12)
5810
5812 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_NUMBER;
5814
5815#endif // SDL_VERSION_ATLEAST(3, 2, 12)
5816
5817constexpr auto NAME_STRING =
5818 SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING;
5819
5820} // namespace prop::GPUTexture::Create
5821
5866 const GPUBufferCreateInfo& createinfo)
5867{
5868 return GPUBuffer(device, createinfo);
5869}
5870
5872 const GPUBufferCreateInfo& createinfo)
5873{
5874 return GPUBuffer(get(), createinfo);
5875}
5876
5878 const GPUBufferCreateInfo& createinfo)
5879 : m_gPUBuffer(CheckError(SDL_CreateGPUBuffer(device, &createinfo)))
5880{
5881}
5882
5889
5890constexpr auto NAME_STRING =
5891 SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING;
5892
5893} // namespace prop::GPUBuffer::Create
5894
5923 GPUDeviceRef device,
5924 const GPUTransferBufferCreateInfo& createinfo)
5925{
5926 return GPUTransferBuffer(device, createinfo);
5927}
5928
5930 const GPUTransferBufferCreateInfo& createinfo)
5931{
5932 return GPUTransferBuffer(get(), createinfo);
5933}
5934
5936 GPUDeviceRef device,
5937 const GPUTransferBufferCreateInfo& createinfo)
5938 : m_gPUTransferBuffer(
5939 CheckError(SDL_CreateGPUTransferBuffer(device, &createinfo)))
5940{
5941}
5942
5949
5950constexpr auto NAME_STRING =
5951 SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING;
5952
5953} // namespace prop::GPUTransferBuffer::Create
5954
5973 GPUBuffer buffer,
5974 StringParam text)
5975{
5976 SDL_SetGPUBufferName(device, buffer, text);
5977}
5978
5980{
5981 SDL::SetGPUBufferName(get(), buffer, std::move(text));
5982}
5983
6002 GPUTexture texture,
6003 StringParam text)
6004{
6005 SDL_SetGPUTextureName(device, texture, text);
6006}
6007
6009{
6010 SDL::SetGPUTextureName(get(), texture, std::move(text));
6011}
6012
6028inline void InsertGPUDebugLabel(GPUCommandBuffer command_buffer,
6029 StringParam text)
6030{
6031 SDL_InsertGPUDebugLabel(command_buffer, text);
6032}
6033
6035{
6036 SDL::InsertGPUDebugLabel(m_gPUCommandBuffer, std::move(text));
6037}
6038
6065inline void PushGPUDebugGroup(GPUCommandBuffer command_buffer, StringParam name)
6066{
6067 SDL_PushGPUDebugGroup(command_buffer, name);
6068}
6069
6071{
6072 SDL::PushGPUDebugGroup(m_gPUCommandBuffer, std::move(name));
6073}
6074
6089inline void PopGPUDebugGroup(GPUCommandBuffer command_buffer)
6090{
6091 SDL_PopGPUDebugGroup(command_buffer);
6092}
6093
6095{
6096 SDL::PopGPUDebugGroup(m_gPUCommandBuffer);
6097}
6098
6109inline void ReleaseGPUTexture(GPUDeviceRef device, GPUTexture texture)
6110{
6111 SDL_ReleaseGPUTexture(device, texture);
6112}
6113
6115{
6116 SDL::ReleaseGPUTexture(get(), texture);
6117}
6118
6129inline void ReleaseGPUSampler(GPUDeviceRef device, GPUSampler sampler)
6130{
6131 SDL_ReleaseGPUSampler(device, sampler);
6132}
6133
6135{
6136 SDL::ReleaseGPUSampler(get(), sampler);
6137}
6138
6149inline void ReleaseGPUBuffer(GPUDeviceRef device, GPUBuffer buffer)
6150{
6151 SDL_ReleaseGPUBuffer(device, buffer);
6152}
6153
6155{
6156 SDL::ReleaseGPUBuffer(get(), buffer);
6157}
6158
6170 GPUTransferBuffer transfer_buffer)
6171{
6172 SDL_ReleaseGPUTransferBuffer(device, transfer_buffer);
6173}
6174
6176 GPUTransferBuffer transfer_buffer)
6177{
6178 SDL::ReleaseGPUTransferBuffer(get(), transfer_buffer);
6179}
6180
6192 GPUComputePipeline compute_pipeline)
6193{
6194 SDL_ReleaseGPUComputePipeline(device, compute_pipeline);
6195}
6196
6198 GPUComputePipeline compute_pipeline)
6199{
6200 SDL::ReleaseGPUComputePipeline(get(), compute_pipeline);
6201}
6202
6213inline void ReleaseGPUShader(GPUDeviceRef device, GPUShader shader)
6214{
6215 SDL_ReleaseGPUShader(device, shader);
6216}
6217
6219{
6220 SDL::ReleaseGPUShader(get(), shader);
6221}
6222
6234 GPUGraphicsPipeline graphics_pipeline)
6235{
6236 SDL_ReleaseGPUGraphicsPipeline(device, graphics_pipeline);
6237}
6238
6240 GPUGraphicsPipeline graphics_pipeline)
6241{
6242 SDL::ReleaseGPUGraphicsPipeline(get(), graphics_pipeline);
6243}
6244
6270{
6271 return CheckError(SDL_AcquireGPUCommandBuffer(device));
6272}
6273
6278
6298 Uint32 slot_index,
6299 SourceBytes data)
6300{
6301 SDL_PushGPUVertexUniformData(
6302 command_buffer, slot_index, data.data(), narrowU32(data.size_bytes()));
6303}
6304
6306 SourceBytes data)
6307{
6309 m_gPUCommandBuffer, slot_index, std::move(data));
6310}
6311
6328 Uint32 slot_index,
6329 SourceBytes data)
6330{
6331 SDL_PushGPUFragmentUniformData(
6332 command_buffer, slot_index, data.data(), narrowU32(data.size_bytes()));
6333}
6334
6336 SourceBytes data)
6337{
6339 m_gPUCommandBuffer, slot_index, std::move(data));
6340}
6341
6358 Uint32 slot_index,
6359 SourceBytes data)
6360{
6361 SDL_PushGPUComputeUniformData(
6362 command_buffer, slot_index, data.data(), narrowU32(data.size_bytes()));
6363}
6364
6366 SourceBytes data)
6367{
6369 m_gPUCommandBuffer, slot_index, std::move(data));
6370}
6371
6404 GPUCommandBuffer command_buffer,
6405 std::span<const GPUColorTargetInfo> color_target_infos,
6406 OptionalRef<const GPUDepthStencilTargetInfo> depth_stencil_target_info)
6407{
6408 return SDL_BeginGPURenderPass(command_buffer,
6409 color_target_infos.data(),
6410 narrowU32(color_target_infos.size()),
6411 depth_stencil_target_info);
6412}
6413
6415 std::span<const GPUColorTargetInfo> color_target_infos,
6416 OptionalRef<const GPUDepthStencilTargetInfo> depth_stencil_target_info)
6417{
6419 m_gPUCommandBuffer, color_target_infos, depth_stencil_target_info);
6420}
6421
6433 GPUGraphicsPipeline graphics_pipeline)
6434{
6435 SDL_BindGPUGraphicsPipeline(render_pass, graphics_pipeline);
6436}
6437
6439{
6440 SDL::BindGPUGraphicsPipeline(m_gPURenderPass, graphics_pipeline);
6441}
6442
6451inline void SetGPUViewport(GPURenderPass render_pass,
6452 const GPUViewport& viewport)
6453{
6454 SDL_SetGPUViewport(render_pass, &viewport);
6455}
6456
6457inline void GPURenderPass::SetViewport(const GPUViewport& viewport)
6458{
6459 SDL::SetGPUViewport(m_gPURenderPass, viewport);
6460}
6461
6470inline void SetGPUScissor(GPURenderPass render_pass, const RectRaw& scissor)
6471{
6472 SDL_SetGPUScissor(render_pass, &scissor);
6473}
6474
6475inline void GPURenderPass::SetScissor(const RectRaw& scissor)
6476{
6477 SDL::SetGPUScissor(m_gPURenderPass, scissor);
6478}
6479
6491inline void SetGPUBlendConstants(GPURenderPass render_pass,
6492 FColorRaw blend_constants)
6493{
6494 SDL_SetGPUBlendConstants(render_pass, blend_constants);
6495}
6496
6498{
6499 SDL::SetGPUBlendConstants(m_gPURenderPass, blend_constants);
6500}
6501
6510inline void SetGPUStencilReference(GPURenderPass render_pass, Uint8 reference)
6511{
6512 SDL_SetGPUStencilReference(render_pass, reference);
6513}
6514
6516{
6517 SDL::SetGPUStencilReference(m_gPURenderPass, reference);
6518}
6519
6530inline void BindGPUVertexBuffers(GPURenderPass render_pass,
6531 Uint32 first_slot,
6532 std::span<const GPUBufferBinding> bindings)
6533{
6534 SDL_BindGPUVertexBuffers(
6535 render_pass, first_slot, bindings.data(), narrowU32(bindings.size()));
6536}
6537
6539 Uint32 first_slot,
6540 std::span<const GPUBufferBinding> bindings)
6541{
6542 SDL::BindGPUVertexBuffers(m_gPURenderPass, first_slot, bindings);
6543}
6544
6555inline void BindGPUIndexBuffer(GPURenderPass render_pass,
6556 const GPUBufferBinding& binding,
6557 GPUIndexElementSize index_element_size)
6558{
6559 SDL_BindGPUIndexBuffer(render_pass, &binding, index_element_size);
6560}
6561
6563 const GPUBufferBinding& binding,
6564 GPUIndexElementSize index_element_size)
6565{
6566 SDL::BindGPUIndexBuffer(m_gPURenderPass, binding, index_element_size);
6567}
6568
6586 GPURenderPass render_pass,
6587 Uint32 first_slot,
6588 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
6589{
6590 SDL_BindGPUVertexSamplers(render_pass,
6591 first_slot,
6592 texture_sampler_bindings.data(),
6593 narrowU32(texture_sampler_bindings.size()));
6594}
6595
6597 Uint32 first_slot,
6598 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
6599{
6601 m_gPURenderPass, first_slot, texture_sampler_bindings);
6602}
6603
6622 GPURenderPass render_pass,
6623 Uint32 first_slot,
6624 SpanRef<const GPUTextureRaw> storage_textures)
6625{
6626 SDL_BindGPUVertexStorageTextures(render_pass,
6627 first_slot,
6628 storage_textures.data(),
6629 narrowU32(storage_textures.size()));
6630}
6631
6633 Uint32 first_slot,
6634 SpanRef<const GPUTextureRaw> storage_textures)
6635{
6637 m_gPURenderPass, first_slot, storage_textures);
6638}
6639
6658 GPURenderPass render_pass,
6659 Uint32 first_slot,
6660 SpanRef<const GPUBufferRaw> storage_buffers)
6661{
6662 SDL_BindGPUVertexStorageBuffers(render_pass,
6663 first_slot,
6664 storage_buffers.data(),
6665 narrowU32(storage_buffers.size()));
6666}
6667
6669 Uint32 first_slot,
6670 SpanRef<const GPUBufferRaw> storage_buffers)
6671{
6673 m_gPURenderPass, first_slot, storage_buffers);
6674}
6675
6693 GPURenderPass render_pass,
6694 Uint32 first_slot,
6695 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
6696{
6697 SDL_BindGPUFragmentSamplers(render_pass,
6698 first_slot,
6699 texture_sampler_bindings.data(),
6700 narrowU32(texture_sampler_bindings.size()));
6701}
6702
6704 Uint32 first_slot,
6705 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
6706{
6708 m_gPURenderPass, first_slot, texture_sampler_bindings);
6709}
6710
6729 GPURenderPass render_pass,
6730 Uint32 first_slot,
6731 SpanRef<const GPUTextureRaw> storage_textures)
6732{
6733 SDL_BindGPUFragmentStorageTextures(render_pass,
6734 first_slot,
6735 storage_textures.data(),
6736 narrowU32(storage_textures.size()));
6737}
6738
6740 Uint32 first_slot,
6741 SpanRef<const GPUTextureRaw> storage_textures)
6742{
6744 m_gPURenderPass, first_slot, storage_textures);
6745}
6746
6765 GPURenderPass render_pass,
6766 Uint32 first_slot,
6767 SpanRef<const GPUBufferRaw> storage_buffers)
6768{
6769 SDL_BindGPUFragmentStorageBuffers(render_pass,
6770 first_slot,
6771 storage_buffers.data(),
6772 narrowU32(storage_buffers.size()));
6773}
6774
6776 Uint32 first_slot,
6777 SpanRef<const GPUBufferRaw> storage_buffers)
6778{
6780 m_gPURenderPass, first_slot, storage_buffers);
6781}
6782
6807 Uint32 num_indices,
6808 Uint32 num_instances,
6809 Uint32 first_index,
6810 Sint32 vertex_offset,
6811 Uint32 first_instance)
6812{
6813 SDL_DrawGPUIndexedPrimitives(render_pass,
6814 num_indices,
6815 num_instances,
6816 first_index,
6817 vertex_offset,
6818 first_instance);
6819}
6820
6822 Uint32 num_instances,
6823 Uint32 first_index,
6824 Sint32 vertex_offset,
6825 Uint32 first_instance)
6826{
6827 SDL::DrawGPUIndexedPrimitives(m_gPURenderPass,
6828 num_indices,
6829 num_instances,
6830 first_index,
6831 vertex_offset,
6832 first_instance);
6833}
6834
6855inline void DrawGPUPrimitives(GPURenderPass render_pass,
6856 Uint32 num_vertices,
6857 Uint32 num_instances,
6858 Uint32 first_vertex,
6859 Uint32 first_instance)
6860{
6861 SDL_DrawGPUPrimitives(
6862 render_pass, num_vertices, num_instances, first_vertex, first_instance);
6863}
6864
6865inline void GPURenderPass::DrawPrimitives(Uint32 num_vertices,
6866 Uint32 num_instances,
6867 Uint32 first_vertex,
6868 Uint32 first_instance)
6869{
6871 m_gPURenderPass, num_vertices, num_instances, first_vertex, first_instance);
6872}
6873
6891 GPUBuffer buffer,
6892 Uint32 offset,
6893 Uint32 draw_count)
6894{
6895 SDL_DrawGPUPrimitivesIndirect(render_pass, buffer, offset, draw_count);
6896}
6897
6899 Uint32 offset,
6900 Uint32 draw_count)
6901{
6902 SDL::DrawGPUPrimitivesIndirect(m_gPURenderPass, buffer, offset, draw_count);
6903}
6904
6922 GPUBuffer buffer,
6923 Uint32 offset,
6924 Uint32 draw_count)
6925{
6926 SDL_DrawGPUIndexedPrimitivesIndirect(render_pass, buffer, offset, draw_count);
6927}
6928
6930 Uint32 offset,
6931 Uint32 draw_count)
6932{
6934 m_gPURenderPass, buffer, offset, draw_count);
6935}
6936
6947inline void EndGPURenderPass(GPURenderPass render_pass)
6948{
6949 SDL_EndGPURenderPass(render_pass);
6950}
6951
6952inline void GPURenderPass::End() { SDL::EndGPURenderPass(m_gPURenderPass); }
6953
6988 GPUCommandBuffer command_buffer,
6989 std::span<const GPUStorageTextureReadWriteBinding> storage_texture_bindings,
6990 std::span<const GPUStorageBufferReadWriteBinding> storage_buffer_bindings)
6991{
6992 return SDL_BeginGPUComputePass(command_buffer,
6993 storage_texture_bindings.data(),
6994 narrowU32(storage_texture_bindings.size()),
6995 storage_buffer_bindings.data(),
6996 narrowU32(storage_buffer_bindings.size()));
6997}
6998
7000 std::span<const GPUStorageTextureReadWriteBinding> storage_texture_bindings,
7001 std::span<const GPUStorageBufferReadWriteBinding> storage_buffer_bindings)
7002{
7004 m_gPUCommandBuffer, storage_texture_bindings, storage_buffer_bindings);
7005}
7006
7016 GPUComputePipeline compute_pipeline)
7017{
7018 SDL_BindGPUComputePipeline(compute_pass, compute_pipeline);
7019}
7020
7022{
7023 SDL::BindGPUComputePipeline(m_gPUComputePass, compute_pipeline);
7024}
7025
7043 GPUComputePass compute_pass,
7044 Uint32 first_slot,
7045 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
7046{
7047 SDL_BindGPUComputeSamplers(compute_pass,
7048 first_slot,
7049 texture_sampler_bindings.data(),
7050 narrowU32(texture_sampler_bindings.size()));
7051}
7052
7054 Uint32 first_slot,
7055 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
7056{
7058 m_gPUComputePass, first_slot, texture_sampler_bindings);
7059}
7060
7079 GPUComputePass compute_pass,
7080 Uint32 first_slot,
7081 SpanRef<const GPUTextureRaw> storage_textures)
7082{
7083 SDL_BindGPUComputeStorageTextures(compute_pass,
7084 first_slot,
7085 storage_textures.data(),
7086 narrowU32(storage_textures.size()));
7087}
7088
7090 Uint32 first_slot,
7091 SpanRef<const GPUTextureRaw> storage_textures)
7092{
7094 m_gPUComputePass, first_slot, storage_textures);
7095}
7096
7115 GPUComputePass compute_pass,
7116 Uint32 first_slot,
7117 SpanRef<const GPUBufferRaw> storage_buffers)
7118{
7119 SDL_BindGPUComputeStorageBuffers(compute_pass,
7120 first_slot,
7121 storage_buffers.data(),
7122 narrowU32(storage_buffers.size()));
7123}
7124
7126 Uint32 first_slot,
7127 SpanRef<const GPUBufferRaw> storage_buffers)
7128{
7130 m_gPUComputePass, first_slot, storage_buffers);
7131}
7132
7153inline void DispatchGPUCompute(GPUComputePass compute_pass,
7154 Uint32 groupcount_x,
7155 Uint32 groupcount_y,
7156 Uint32 groupcount_z)
7157{
7158 SDL_DispatchGPUCompute(
7159 compute_pass, groupcount_x, groupcount_y, groupcount_z);
7160}
7161
7162inline void GPUComputePass::Dispatch(Uint32 groupcount_x,
7163 Uint32 groupcount_y,
7164 Uint32 groupcount_z)
7165{
7167 m_gPUComputePass, groupcount_x, groupcount_y, groupcount_z);
7168}
7169
7188 GPUBuffer buffer,
7189 Uint32 offset)
7190{
7191 SDL_DispatchGPUComputeIndirect(compute_pass, buffer, offset);
7192}
7193
7195{
7196 SDL::DispatchGPUComputeIndirect(m_gPUComputePass, buffer, offset);
7197}
7198
7209inline void EndGPUComputePass(GPUComputePass compute_pass)
7210{
7211 SDL_EndGPUComputePass(compute_pass);
7212}
7213
7214inline void GPUComputePass::End() { SDL::EndGPUComputePass(m_gPUComputePass); }
7215
7232 GPUTransferBuffer transfer_buffer,
7233 bool cycle)
7234{
7235 return CheckError(SDL_MapGPUTransferBuffer(device, transfer_buffer, cycle));
7236}
7237
7239 bool cycle)
7240{
7241 return SDL::MapGPUTransferBuffer(get(), transfer_buffer, cycle);
7242}
7243
7253 GPUTransferBuffer transfer_buffer)
7254{
7255 SDL_UnmapGPUTransferBuffer(device, transfer_buffer);
7256}
7257
7259 GPUTransferBuffer transfer_buffer)
7260{
7261 SDL::UnmapGPUTransferBuffer(get(), transfer_buffer);
7262}
7263
7279{
7280 return SDL_BeginGPUCopyPass(command_buffer);
7281}
7282
7284{
7285 return SDL::BeginGPUCopyPass(m_gPUCommandBuffer);
7286}
7287
7305inline void UploadToGPUTexture(GPUCopyPass copy_pass,
7306 const GPUTextureTransferInfo& source,
7307 const GPUTextureRegion& destination,
7308 bool cycle)
7309{
7310 SDL_UploadToGPUTexture(copy_pass, &source, &destination, cycle);
7311}
7312
7314 const GPUTextureRegion& destination,
7315 bool cycle)
7316{
7317 SDL::UploadToGPUTexture(m_gPUCopyPass, source, destination, cycle);
7318}
7319
7334inline void UploadToGPUBuffer(GPUCopyPass copy_pass,
7335 const GPUTransferBufferLocation& source,
7336 const GPUBufferRegion& destination,
7337 bool cycle)
7338{
7339 SDL_UploadToGPUBuffer(copy_pass, &source, &destination, cycle);
7340}
7341
7343 const GPUBufferRegion& destination,
7344 bool cycle)
7345{
7346 SDL::UploadToGPUBuffer(m_gPUCopyPass, source, destination, cycle);
7347}
7348
7370 const GPUTextureLocation& source,
7371 const GPUTextureLocation& destination,
7372 Uint32 w,
7373 Uint32 h,
7374 Uint32 d,
7375 bool cycle)
7376{
7377 SDL_CopyGPUTextureToTexture(copy_pass, &source, &destination, w, h, d, cycle);
7378}
7379
7381 const GPUTextureLocation& source,
7382 const GPUTextureLocation& destination,
7383 Uint32 w,
7384 Uint32 h,
7385 Uint32 d,
7386 bool cycle)
7387{
7389 m_gPUCopyPass, source, destination, w, h, d, cycle);
7390}
7391
7408 const GPUBufferLocation& source,
7409 const GPUBufferLocation& destination,
7410 Uint32 size,
7411 bool cycle)
7412{
7413 SDL_CopyGPUBufferToBuffer(copy_pass, &source, &destination, size, cycle);
7414}
7415
7417 const GPUBufferLocation& source,
7418 const GPUBufferLocation& destination,
7419 Uint32 size,
7420 bool cycle)
7421{
7422 SDL::CopyGPUBufferToBuffer(m_gPUCopyPass, source, destination, size, cycle);
7423}
7424
7439 const GPUTextureRegion& source,
7440 const GPUTextureTransferInfo& destination)
7441{
7442 SDL_DownloadFromGPUTexture(copy_pass, &source, &destination);
7443}
7444
7446 const GPUTextureRegion& source,
7447 const GPUTextureTransferInfo& destination)
7448{
7449 SDL::DownloadFromGPUTexture(m_gPUCopyPass, source, destination);
7450}
7451
7465 const GPUBufferRegion& source,
7466 const GPUTransferBufferLocation& destination)
7467{
7468 SDL_DownloadFromGPUBuffer(copy_pass, &source, &destination);
7469}
7470
7472 const GPUBufferRegion& source,
7473 const GPUTransferBufferLocation& destination)
7474{
7475 SDL::DownloadFromGPUBuffer(m_gPUCopyPass, source, destination);
7476}
7477
7485inline void EndGPUCopyPass(GPUCopyPass copy_pass)
7486{
7487 SDL_EndGPUCopyPass(copy_pass);
7488}
7489
7490inline void GPUCopyPass::End() { SDL::EndGPUCopyPass(m_gPUCopyPass); }
7491
7503 GPUTexture texture)
7504{
7505 SDL_GenerateMipmapsForGPUTexture(command_buffer, texture);
7506}
7507
7509{
7510 SDL::GenerateMipmapsForGPUTexture(m_gPUCommandBuffer, texture);
7511}
7512
7523inline void BlitGPUTexture(GPUCommandBuffer command_buffer,
7524 const GPUBlitInfo& info)
7525{
7526 SDL_BlitGPUTexture(command_buffer, &info);
7527}
7528
7530{
7531 SDL::BlitGPUTexture(m_gPUCommandBuffer, info);
7532}
7533
7549 GPUDeviceRef device,
7550 WindowRef window,
7551 GPUSwapchainComposition swapchain_composition)
7552{
7553 return SDL_WindowSupportsGPUSwapchainComposition(
7554 device, window, swapchain_composition);
7555}
7556
7558 WindowRef window,
7559 GPUSwapchainComposition swapchain_composition)
7560{
7562 get(), window, swapchain_composition);
7563}
7564
7580 WindowRef window,
7581 GPUPresentMode present_mode)
7582{
7583 return SDL_WindowSupportsGPUPresentMode(device, window, present_mode);
7584}
7585
7587 WindowRef window,
7588 GPUPresentMode present_mode)
7589{
7590 return SDL::WindowSupportsGPUPresentMode(get(), window, present_mode);
7591}
7592
7619{
7620 CheckError(SDL_ClaimWindowForGPUDevice(device, window));
7621}
7622
7624{
7626}
7627
7639{
7640 SDL_ReleaseWindowFromGPUDevice(device, window);
7641}
7642
7644{
7646}
7647
7671 GPUDeviceRef device,
7672 WindowRef window,
7673 GPUSwapchainComposition swapchain_composition,
7674 GPUPresentMode present_mode)
7675{
7676 return SDL_SetGPUSwapchainParameters(
7677 device, window, swapchain_composition, present_mode);
7678}
7679
7681 WindowRef window,
7682 GPUSwapchainComposition swapchain_composition,
7683 GPUPresentMode present_mode)
7684{
7686 get(), window, swapchain_composition, present_mode);
7687}
7688
7715 Uint32 allowed_frames_in_flight)
7716{
7717 return SDL_SetGPUAllowedFramesInFlight(device, allowed_frames_in_flight);
7718}
7719
7721 Uint32 allowed_frames_in_flight)
7722{
7723 return SDL::SetGPUAllowedFramesInFlight(get(), allowed_frames_in_flight);
7724}
7725
7738 WindowRef window)
7739{
7740 return SDL_GetGPUSwapchainTextureFormat(device, window);
7741}
7742
7748
7796 GPUCommandBuffer command_buffer,
7797 WindowRef window,
7798 Uint32* swapchain_texture_width = nullptr,
7799 Uint32* swapchain_texture_height = nullptr)
7800{
7801 GPUTextureRaw texture;
7802 CheckError(SDL_AcquireGPUSwapchainTexture(command_buffer,
7803 window,
7804 &texture,
7805 swapchain_texture_width,
7806 swapchain_texture_height));
7807 return texture;
7808}
7809
7811 WindowRef window,
7812 Uint32* swapchain_texture_width,
7813 Uint32* swapchain_texture_height)
7814{
7815 return SDL::AcquireGPUSwapchainTexture(m_gPUCommandBuffer,
7816 window,
7817 swapchain_texture_width,
7818 swapchain_texture_height);
7819}
7820
7837inline void WaitForGPUSwapchain(GPUDeviceRef device, WindowRef window)
7838{
7839 CheckError(SDL_WaitForGPUSwapchain(device, window));
7840}
7841
7843{
7844 SDL::WaitForGPUSwapchain(get(), window);
7845}
7846
7888 GPUCommandBuffer command_buffer,
7889 WindowRef window,
7890 Uint32* swapchain_texture_width = nullptr,
7891 Uint32* swapchain_texture_height = nullptr)
7892{
7893 GPUTextureRaw texture;
7894 CheckError(SDL_WaitAndAcquireGPUSwapchainTexture(command_buffer,
7895 window,
7896 &texture,
7897 swapchain_texture_width,
7898 swapchain_texture_height));
7899 return texture;
7900}
7901
7903 WindowRef window,
7904 Uint32* swapchain_texture_width,
7905 Uint32* swapchain_texture_height)
7906{
7907 return SDL::WaitAndAcquireGPUSwapchainTexture(m_gPUCommandBuffer,
7908 window,
7909 swapchain_texture_width,
7910 swapchain_texture_height);
7911}
7912
7933inline void SubmitGPUCommandBuffer(GPUCommandBuffer command_buffer)
7934{
7935 CheckError(SDL_SubmitGPUCommandBuffer(command_buffer));
7936}
7937
7939{
7940 SDL::SubmitGPUCommandBuffer(m_gPUCommandBuffer);
7941}
7942
7968 GPUCommandBuffer command_buffer)
7969{
7970 return CheckError(SDL_SubmitGPUCommandBufferAndAcquireFence(command_buffer));
7971}
7972
7977
7999inline void CancelGPUCommandBuffer(GPUCommandBuffer command_buffer)
8000{
8001 CheckError(SDL_CancelGPUCommandBuffer(command_buffer));
8002}
8003
8005{
8006 SDL::CancelGPUCommandBuffer(m_gPUCommandBuffer);
8007}
8008
8019inline void WaitForGPUIdle(GPUDeviceRef device)
8020{
8021 CheckError(SDL_WaitForGPUIdle(device));
8022}
8023
8025
8041 bool wait_all,
8042 std::span<GPUFence* const> fences)
8043{
8044 CheckError(SDL_WaitForGPUFences(
8045 device, wait_all, fences.data(), narrowU32(fences.size())));
8046}
8047
8048inline void GPUDeviceBase::WaitForFences(bool wait_all,
8049 std::span<GPUFence* const> fences)
8050{
8051 SDL::WaitForGPUFences(get(), wait_all, fences);
8052}
8053
8065inline bool QueryGPUFence(GPUDeviceRef device, GPUFence* fence)
8066{
8067 return SDL_QueryGPUFence(device, fence);
8068}
8069
8071{
8072 return SDL::QueryGPUFence(get(), fence);
8073}
8074
8087inline void ReleaseGPUFence(GPUDeviceRef device, GPUFence* fence)
8088{
8089 SDL_ReleaseGPUFence(device, fence);
8090}
8091
8093{
8094 SDL::ReleaseGPUFence(get(), fence);
8095}
8096
8108{
8109 return SDL_GPUTextureFormatTexelBlockSize(format);
8110}
8111
8124 GPUTextureFormat format,
8125 GPUTextureType type,
8127{
8128 return SDL_GPUTextureSupportsFormat(device, format, type, usage);
8129}
8130
8132 GPUTextureType type,
8134{
8135 return SDL::GPUTextureSupportsFormat(get(), format, type, usage);
8136}
8137
8149 GPUTextureFormat format,
8150 GPUSampleCount sample_count)
8151{
8152 return SDL_GPUTextureSupportsSampleCount(device, format, sample_count);
8153}
8154
8156 GPUTextureFormat format,
8157 GPUSampleCount sample_count)
8158{
8159 return SDL::GPUTextureSupportsSampleCount(get(), format, sample_count);
8160}
8161
8174 Uint32 width,
8175 Uint32 height,
8176 Uint32 depth_or_layer_count)
8177{
8178 return SDL_CalculateGPUTextureFormatSize(
8179 format, width, height, depth_or_layer_count);
8180}
8181
8182#if SDL_VERSION_ATLEAST(3, 4, 0)
8183
8194{
8195 return SDL_GetPixelFormatFromGPUTextureFormat(format);
8196}
8197
8208{
8209 return SDL_GetGPUTextureFormatFromPixelFormat(format);
8210}
8211
8212#endif // SDL_VERSION_ATLEAST(3, 4, 0)
8213
8214#ifdef SDL_PLATFORM_GDK
8215
8229inline void GDKSuspendGPU(GPUDeviceRef device) { SDL_GDKSuspendGPU(device); }
8230
8232
8246inline void GDKResumeGPU(GPUDeviceRef device) { SDL_GDKResumeGPU(device); }
8247
8249
8250#endif /* SDL_PLATFORM_GDK */
8251
8253
8254} // namespace SDL
8255
8256#endif /* SDL3PP_GPU_H_ */
An opaque handle representing a buffer.
Definition SDL3pp_gpu.h:490
constexpr GPUBuffer(GPUBufferRaw gPUBuffer={}) noexcept
Wraps GPUBuffer.
Definition SDL3pp_gpu.h:499
An opaque handle representing a command buffer.
Definition SDL3pp_gpu.h:2037
constexpr GPUCommandBuffer(GPUCommandBufferRaw gPUCommandBuffer={}) noexcept
Wraps GPUCommandBuffer.
Definition SDL3pp_gpu.h:2046
An opaque handle representing a compute pass.
Definition SDL3pp_gpu.h:1509
constexpr GPUComputePass(GPUComputePassRaw gPUComputePass={}) noexcept
Wraps GPUComputePass.
Definition SDL3pp_gpu.h:1518
An opaque handle representing a compute pipeline.
Definition SDL3pp_gpu.h:969
constexpr GPUComputePipeline(GPUComputePipelineRaw gPUComputePipeline={}) noexcept
Wraps GPUComputePipeline.
Definition SDL3pp_gpu.h:978
An opaque handle representing a copy pass.
Definition SDL3pp_gpu.h:1744
constexpr GPUCopyPass(GPUCopyPassRaw gPUCopyPass={}) noexcept
Wraps GPUCopyPass.
Definition SDL3pp_gpu.h:1753
An opaque handle representing a graphics pipeline.
Definition SDL3pp_gpu.h:1071
constexpr GPUGraphicsPipeline(GPUGraphicsPipelineRaw gPUGraphicsPipeline={}) noexcept
Wraps GPUGraphicsPipeline.
Definition SDL3pp_gpu.h:1080
An opaque handle representing a render pass.
Definition SDL3pp_gpu.h:1179
constexpr GPURenderPass(GPURenderPassRaw gPURenderPass={}) noexcept
Wraps GPURenderPass.
Definition SDL3pp_gpu.h:1188
An opaque handle representing a sampler.
Definition SDL3pp_gpu.h:784
constexpr GPUSampler(GPUSamplerRaw gPUSampler={}) noexcept
Wraps GPUSampler.
Definition SDL3pp_gpu.h:793
An opaque handle representing a compiled shader object.
Definition SDL3pp_gpu.h:850
constexpr GPUShader(GPUShaderRaw gPUShader={}) noexcept
Wraps GPUShader.
Definition SDL3pp_gpu.h:859
An opaque handle representing a texture.
Definition SDL3pp_gpu.h:675
constexpr GPUTexture(GPUTextureRaw gPUTexture={}) noexcept
Wraps GPUTexture.
Definition SDL3pp_gpu.h:684
An opaque handle representing a transfer buffer.
Definition SDL3pp_gpu.h:583
constexpr GPUTransferBuffer(GPUTransferBufferRaw gPUTransferBuffer={}) noexcept
Wraps GPUTransferBuffer.
Definition SDL3pp_gpu.h:592
Optional-like shim for references.
Definition SDL3pp_optionalRef.h:20
Pixel format.
Definition SDL3pp_pixels.h:361
constexpr RawPointer release() noexcept
Definition SDL3pp_resource.h:57
friend constexpr void swap(ResourceBaseT &lhs, ResourceBaseT &rhs) noexcept
Definition SDL3pp_resource.h:65
constexpr RawPointer get() const noexcept
Definition SDL3pp_resource.h:54
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
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
GPUGraphicsPipeline CreateGPUGraphicsPipeline(GPUDeviceRef device, const GPUGraphicsPipelineCreateInfo &createinfo)
Creates a pipeline object to be used in a graphics workflow.
Definition SDL3pp_gpu.h:5525
void ReleaseTexture(GPUTexture texture)
Frees the given texture as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6114
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UINT
GPU_VERTEXELEMENTFORMAT_UINT.
Definition SDL3pp_gpu.h:4304
SDL_GPUPresentMode GPUPresentMode
Specifies the timing that will be used to present swapchain textures to the OS.
Definition SDL3pp_gpu.h:2535
constexpr GPUShaderFormat GPU_SHADERFORMAT_DXIL
DXIL SM6_0 shaders for D3D12.
Definition SDL3pp_gpu.h:2462
void Dispatch(Uint32 groupcount_x, Uint32 groupcount_y, Uint32 groupcount_z)
Dispatches compute work.
Definition SDL3pp_gpu.h:7162
void PushComputeUniformData(Uint32 slot_index, SourceBytes data)
Pushes data to a uniform slot on the command buffer.
Definition SDL3pp_gpu.h:6365
void ReleaseComputePipeline(GPUComputePipeline compute_pipeline)
Frees the given compute pipeline as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6197
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_12x12_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_12x12_UNORM_SRGB.
Definition SDL3pp_gpu.h:2899
constexpr GPUFillMode GPU_FILLMODE_FILL
Polygons will be rendered via rasterization.
Definition SDL3pp_gpu.h:4408
SDL_GPUTransferBufferUsage GPUTransferBufferUsage
Specifies how a transfer buffer is intended to be used by the client.
Definition SDL3pp_gpu.h:4257
constexpr GPUShaderFormat GPU_SHADERFORMAT_PRIVATE
Shaders for NDA'd platforms.
Definition SDL3pp_gpu.h:2453
constexpr GPUCompareOp GPU_COMPAREOP_LESS_OR_EQUAL
The comparison evaluates reference <= test.
Definition SDL3pp_gpu.h:4473
constexpr GPUSwapchainComposition GPU_SWAPCHAINCOMPOSITION_HDR10_ST2084
GPU_SWAPCHAINCOMPOSITION_HDR10_ST2084.
Definition SDL3pp_gpu.h:2507
int GetNumGPUDrivers()
Get the number of GPU drivers compiled into SDL.
Definition SDL3pp_gpu.h:5225
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:6327
bool SetAllowedFramesInFlight(Uint32 allowed_frames_in_flight)
Configures the maximum allowed number of frames in flight.
Definition SDL3pp_gpu.h:7720
constexpr GPUIndexElementSize GPU_INDEXELEMENTSIZE_32BIT
The index elements are 32-bit.
Definition SDL3pp_gpu.h:1152
GPUDevice CreateGPUDeviceWithProperties(PropertiesRef props)
Creates a GPU context.
Definition SDL3pp_gpu.h:5055
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:6728
SDL_GPUCompareOp GPUCompareOp
Specifies a comparison operator for depth, stencil and sampler operations.
Definition SDL3pp_gpu.h:4459
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_6x6_FLOAT
GPU_TEXTUREFORMAT_ASTC_6x6_FLOAT.
Definition SDL3pp_gpu.h:2914
constexpr GPUStencilOp GPU_STENCILOP_ZERO
Sets the value to 0.
Definition SDL3pp_gpu.h:4506
void * MapTransferBuffer(GPUTransferBuffer transfer_buffer, bool cycle)
Maps a transfer buffer into application address space.
Definition SDL3pp_gpu.h:7238
constexpr GPUCompareOp GPU_COMPAREOP_ALWAYS
The comparison always evaluates true.
Definition SDL3pp_gpu.h:4487
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8_UNORM
GPU_TEXTUREFORMAT_R8_UNORM.
Definition SDL3pp_gpu.h:2635
SDL_GPUCullMode GPUCullMode
Specifies the facing direction in which triangle faces will be culled.
Definition SDL3pp_gpu.h:4421
constexpr GPUBlendOp GPU_BLENDOP_MIN
min(source, destination)
Definition SDL3pp_gpu.h:4557
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:6921
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_FLOAT2
GPU_VERTEXELEMENTFORMAT_FLOAT2.
Definition SDL3pp_gpu.h:4319
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:7369
SDL_GPUTransferBufferCreateInfo GPUTransferBufferCreateInfo
A structure specifying the parameters of a transfer buffer.
Definition SDL3pp_gpu.h:564
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32G32_FLOAT
GPU_TEXTUREFORMAT_R32G32_FLOAT.
Definition SDL3pp_gpu.h:2722
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE
Texture supports reads and writes in the same compute shader.
Definition SDL3pp_gpu.h:3017
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_USHORT2_NORM
GPU_VERTEXELEMENTFORMAT_USHORT2_NORM.
Definition SDL3pp_gpu.h:4370
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8_INT
GPU_TEXTUREFORMAT_R8G8_INT.
Definition SDL3pp_gpu.h:2761
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_6x6_UNORM
GPU_TEXTUREFORMAT_ASTC_6x6_UNORM.
Definition SDL3pp_gpu.h:2830
Uint32 GPUShaderFormat
Specifies the format of shader code.
Definition SDL3pp_gpu.h:2448
void ReleaseGPUShader(GPUDeviceRef device, GPUShader shader)
Frees the given shader as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6213
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16B16A16_INT
GPU_TEXTUREFORMAT_R16G16B16A16_INT.
Definition SDL3pp_gpu.h:2773
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_12x12_UNORM
GPU_TEXTUREFORMAT_ASTC_12x12_UNORM.
Definition SDL3pp_gpu.h:2857
void BlitGPUTexture(GPUCommandBuffer command_buffer, const GPUBlitInfo &info)
Blits from a source texture region to a destination texture region.
Definition SDL3pp_gpu.h:7523
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:7967
SDL_GPUCubeMapFace GPUCubeMapFace
Specifies the face of a cube map.
Definition SDL3pp_gpu.h:4187
SDL_GPUFence GPUFence
An opaque handle representing a fence.
Definition SDL3pp_gpu.h:2011
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_4x4_FLOAT
GPU_TEXTUREFORMAT_ASTC_4x4_FLOAT.
Definition SDL3pp_gpu.h:2902
constexpr GPUStencilOp GPU_STENCILOP_INVERT
Bitwise-inverts the current value.
Definition SDL3pp_gpu.h:4520
PixelFormat GetPixelFormatFromGPUTextureFormat(GPUTextureFormat format)
Get the SDL pixel format corresponding to a GPU texture format.
Definition SDL3pp_gpu.h:8193
constexpr GPUFrontFace GPU_FRONTFACE_CLOCKWISE
A triangle with clockwise vertex winding will be considered front-facing.
Definition SDL3pp_gpu.h:4450
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_D32_FLOAT
GPU_TEXTUREFORMAT_D32_FLOAT.
Definition SDL3pp_gpu.h:2809
SDL_GPUTexture * GPUTextureRaw
Alias to raw representation for GPUTexture.
Definition SDL3pp_gpu.h:402
SDL_GPUShaderStage GPUShaderStage
Specifies which stage a shader program corresponds to.
Definition SDL3pp_gpu.h:4272
GPUSampler CreateSampler(const GPUSamplerCreateInfo &createinfo)
Creates a sampler object to be used when binding textures in a graphics workflow.
Definition SDL3pp_gpu.h:5585
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_FLOAT3
GPU_VERTEXELEMENTFORMAT_FLOAT3.
Definition SDL3pp_gpu.h:4322
constexpr GPUCompareOp GPU_COMPAREOP_GREATER_OR_EQUAL
The comparison evaluates reference >= test.
Definition SDL3pp_gpu.h:4483
SDL_GPUVertexAttribute GPUVertexAttribute
A structure specifying a vertex attribute.
Definition SDL3pp_gpu.h:4772
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x6_FLOAT
GPU_TEXTUREFORMAT_ASTC_8x6_FLOAT.
Definition SDL3pp_gpu.h:2920
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:6821
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UBYTE2
GPU_VERTEXELEMENTFORMAT_UBYTE2.
Definition SDL3pp_gpu.h:4334
SDL_GPUTextureFormat GPUTextureFormat
Specifies the pixel format of a texture.
Definition SDL3pp_gpu.h:2627
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:6621
constexpr GPUPrimitiveType GPU_PRIMITIVETYPE_LINELIST
A series of separate lines.
Definition SDL3pp_gpu.h:4115
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_USHORT4_NORM
GPU_VERTEXELEMENTFORMAT_USHORT4_NORM.
Definition SDL3pp_gpu.h:4373
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32_UINT
GPU_TEXTUREFORMAT_R32_UINT.
Definition SDL3pp_gpu.h:2749
void PushGPUDebugGroup(GPUCommandBuffer command_buffer, StringParam name)
Begins a debug group with an arbitrary name.
Definition SDL3pp_gpu.h:6065
GPUBuffer CreateBuffer(const GPUBufferCreateInfo &createinfo)
Creates a buffer object to be used in graphics or compute workflows.
Definition SDL3pp_gpu.h:5871
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x6_UNORM
GPU_TEXTUREFORMAT_ASTC_8x6_UNORM.
Definition SDL3pp_gpu.h:2836
SDL_GPUFillMode GPUFillMode
Specifies the fill mode of the graphics pipeline.
Definition SDL3pp_gpu.h:4406
void SetGPUViewport(GPURenderPass render_pass, const GPUViewport &viewport)
Sets the current viewport state on a command buffer.
Definition SDL3pp_gpu.h:6451
constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR
1 - blend constant
Definition SDL3pp_gpu.h:4610
PropertiesRef GetProperties()
Get the properties associated with a GPU device.
Definition SDL3pp_gpu.h:5391
void SetScissor(const RectRaw &scissor)
Sets the current scissor state on a command buffer.
Definition SDL3pp_gpu.h:6475
constexpr GPUCompareOp GPU_COMPAREOP_NOT_EQUAL
The comparison evaluates reference != test.
Definition SDL3pp_gpu.h:4480
SDL_GPUGraphicsPipelineTargetInfo GPUGraphicsPipelineTargetInfo
A structure specifying the descriptions of render targets used in a graphics pipeline.
Definition SDL3pp_gpu.h:4865
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_USHORT2
GPU_VERTEXELEMENTFORMAT_USHORT2.
Definition SDL3pp_gpu.h:4358
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16B16A16_UNORM
GPU_TEXTUREFORMAT_R16G16B16A16_UNORM.
Definition SDL3pp_gpu.h:2650
SDL_GPUViewport GPUViewport
A structure specifying a viewport.
Definition SDL3pp_gpu.h:1128
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16_UINT
GPU_TEXTUREFORMAT_R16G16_UINT.
Definition SDL3pp_gpu.h:2743
SDL_GPUColorTargetInfo GPUColorTargetInfo
A structure specifying the parameters of a color target used by a render pass.
Definition SDL3pp_gpu.h:1921
void CancelGPUCommandBuffer(GPUCommandBuffer command_buffer)
Cancels a command buffer.
Definition SDL3pp_gpu.h:7999
SDL_GPUIndexElementSize GPUIndexElementSize
Specifies the size of elements in an index buffer.
Definition SDL3pp_gpu.h:1147
SDL_GPUSamplerCreateInfo GPUSamplerCreateInfo
A structure specifying the parameters of a sampler.
Definition SDL3pp_gpu.h:771
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x8_UNORM
GPU_TEXTUREFORMAT_ASTC_10x8_UNORM.
Definition SDL3pp_gpu.h:2848
constexpr GPUPrimitiveType GPU_PRIMITIVETYPE_TRIANGLELIST
A series of separate triangles.
Definition SDL3pp_gpu.h:4109
bool QueryGPUFence(GPUDeviceRef device, GPUFence *fence)
Checks the status of a fence.
Definition SDL3pp_gpu.h:8065
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_A8_UNORM
GPU_TEXTUREFORMAT_A8_UNORM.
Definition SDL3pp_gpu.h:2632
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:6169
void * MapGPUTransferBuffer(GPUDeviceRef device, GPUTransferBuffer transfer_buffer, bool cycle)
Maps a transfer buffer into application address space.
Definition SDL3pp_gpu.h:7231
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_INT4
GPU_VERTEXELEMENTFORMAT_INT4.
Definition SDL3pp_gpu.h:4301
SDL_GPUGraphicsPipelineCreateInfo GPUGraphicsPipelineCreateInfo
A structure specifying the parameters of a graphics pipeline state.
Definition SDL3pp_gpu.h:1057
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:7887
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_5x5_FLOAT
GPU_TEXTUREFORMAT_ASTC_5x5_FLOAT.
Definition SDL3pp_gpu.h:2908
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32_FLOAT
GPU_TEXTUREFORMAT_R32_FLOAT.
Definition SDL3pp_gpu.h:2719
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:4170
GPUGraphicsPipeline CreateGraphicsPipeline(const GPUGraphicsPipelineCreateInfo &createinfo)
Creates a pipeline object to be used in a graphics workflow.
Definition SDL3pp_gpu.h:5532
constexpr GPUSamplerAddressMode GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE
Specifies that the coordinates will clamp to the 0-1 range.
Definition SDL3pp_gpu.h:4687
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16_UNORM
GPU_TEXTUREFORMAT_R16G16_UNORM.
Definition SDL3pp_gpu.h:2647
bool SetGPUAllowedFramesInFlight(GPUDeviceRef device, Uint32 allowed_frames_in_flight)
Configures the maximum allowed number of frames in flight.
Definition SDL3pp_gpu.h:7714
void ReleaseWindow(WindowRef window)
Unclaims a window, destroying its swapchain structure.
Definition SDL3pp_gpu.h:7643
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:6855
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x6_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_8x6_UNORM_SRGB.
Definition SDL3pp_gpu.h:2878
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:7053
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_6x5_FLOAT
GPU_TEXTUREFORMAT_ASTC_6x5_FLOAT.
Definition SDL3pp_gpu.h:2911
SDL_GPUTextureLocation GPUTextureLocation
A structure specifying a location in a texture.
Definition SDL3pp_gpu.h:1671
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC1_RGBA_UNORM
GPU_TEXTUREFORMAT_BC1_RGBA_UNORM.
Definition SDL3pp_gpu.h:2668
void BlitTexture(const GPUBlitInfo &info)
Blits from a source texture region to a destination texture region.
Definition SDL3pp_gpu.h:7529
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:7445
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:6703
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32G32_UINT
GPU_TEXTUREFORMAT_R32G32_UINT.
Definition SDL3pp_gpu.h:2752
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:6555
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC3_RGBA_UNORM
GPU_TEXTUREFORMAT_BC3_RGBA_UNORM.
Definition SDL3pp_gpu.h:2674
GPUShader CreateShader(const GPUShaderCreateInfo &createinfo)
Creates a shader to be used when creating a graphics pipeline.
Definition SDL3pp_gpu.h:5686
Uint32 GPUTextureFormatTexelBlockSize(GPUTextureFormat format)
Obtains the texel block size for a texture format.
Definition SDL3pp_gpu.h:8107
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ
Texture supports storage reads in graphics stages.
Definition SDL3pp_gpu.h:3000
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:7125
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_SHORT2
GPU_VERTEXELEMENTFORMAT_SHORT2.
Definition SDL3pp_gpu.h:4352
bool WindowSupportsPresentMode(WindowRef window, GPUPresentMode present_mode)
Determines whether a presentation mode is supported by the window.
Definition SDL3pp_gpu.h:7586
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8_SNORM
GPU_TEXTUREFORMAT_R8_SNORM.
Definition SDL3pp_gpu.h:2692
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:4542
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_SAMPLER
Texture supports sampling.
Definition SDL3pp_gpu.h:2990
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x8_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_10x8_UNORM_SRGB.
Definition SDL3pp_gpu.h:2890
void Cancel()
Cancels a command buffer.
Definition SDL3pp_gpu.h:8004
SDL_GPUStorageTextureReadWriteBinding GPUStorageTextureReadWriteBinding
A structure specifying parameters related to binding textures in a compute pass.
Definition SDL3pp_gpu.h:1980
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:7795
SDL_GPUColorTargetDescription GPUColorTargetDescription
A structure specifying the parameters of color targets used in a graphics pipeline.
Definition SDL3pp_gpu.h:4853
constexpr GPUColorComponentFlags GPU_COLORCOMPONENT_A
the alpha component
Definition SDL3pp_gpu.h:4635
constexpr GPUBufferUsageFlags GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE
Buffer supports storage writes in the compute stage.
Definition SDL3pp_gpu.h:4244
constexpr GPUSamplerMipmapMode GPU_SAMPLERMIPMAPMODE_LINEAR
Linear filtering.
Definition SDL3pp_gpu.h:4665
bool GPUTextureSupportsSampleCount(GPUDeviceRef device, GPUTextureFormat format, GPUSampleCount sample_count)
Determines if a sample count for a texture format is supported.
Definition SDL3pp_gpu.h:8148
constexpr GPUShaderFormat GPU_SHADERFORMAT_DXBC
DXBC SM5_1 shaders for D3D12.
Definition SDL3pp_gpu.h:2459
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x6_FLOAT
GPU_TEXTUREFORMAT_ASTC_10x6_FLOAT.
Definition SDL3pp_gpu.h:2929
void SetStencilReference(Uint8 reference)
Sets the current stencil reference value on a command buffer.
Definition SDL3pp_gpu.h:6515
bool WindowSupportsGPUSwapchainComposition(GPUDeviceRef device, WindowRef window, GPUSwapchainComposition swapchain_composition)
Determines whether a swapchain composition is supported by the window.
Definition SDL3pp_gpu.h:7548
void ReleaseFence(GPUFence *fence)
Releases a fence obtained from SubmitGPUCommandBufferAndAcquireFence.
Definition SDL3pp_gpu.h:8092
GPUShaderFormat GetGPUShaderFormats(GPUDeviceRef device)
Returns the supported shader formats for this GPU context.
Definition SDL3pp_gpu.h:5273
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R11G11B10_UFLOAT
GPU_TEXTUREFORMAT_R11G11B10_UFLOAT.
Definition SDL3pp_gpu.h:2728
GPUBuffer CreateGPUBuffer(GPUDeviceRef device, const GPUBufferCreateInfo &createinfo)
Creates a buffer object to be used in graphics or compute workflows.
Definition SDL3pp_gpu.h:5865
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_COLOR_TARGET
Texture is a color render target.
Definition SDL3pp_gpu.h:2993
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_INT
GPU_VERTEXELEMENTFORMAT_INT.
Definition SDL3pp_gpu.h:4292
GPUTextureFormat GetGPUTextureFormatFromPixelFormat(PixelFormat format)
Get the GPU texture format corresponding to an SDL pixel format.
Definition SDL3pp_gpu.h:8207
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:7810
constexpr GPUStencilOp GPU_STENCILOP_REPLACE
Sets the value to reference.
Definition SDL3pp_gpu.h:4509
SDL_GPUDepthStencilTargetInfo GPUDepthStencilTargetInfo
A structure specifying the parameters of a depth-stencil target used by a render pass.
Definition SDL3pp_gpu.h:1970
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16_INT
GPU_TEXTUREFORMAT_R16_INT.
Definition SDL3pp_gpu.h:2767
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT
GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT.
Definition SDL3pp_gpu.h:2812
void BindFragmentStorageTextures(Uint32 first_slot, SpanRef< const GPUTextureRaw > storage_textures)
Binds storage textures for use on the fragment shader.
Definition SDL3pp_gpu.h:6739
SDL_GPUTextureRegion GPUTextureRegion
A structure specifying a region of a texture.
Definition SDL3pp_gpu.h:1695
void UploadToBuffer(const GPUTransferBufferLocation &source, const GPUBufferRegion &destination, bool cycle)
Uploads data from a transfer buffer to a buffer.
Definition SDL3pp_gpu.h:7342
constexpr GPUBlendFactor GPU_BLENDFACTOR_DST_COLOR
destination color
Definition SDL3pp_gpu.h:4589
SDL_GPUTextureTransferInfo GPUTextureTransferInfo
A structure specifying parameters related to transferring data to or from a texture.
Definition SDL3pp_gpu.h:1718
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT
GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT.
Definition SDL3pp_gpu.h:2716
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:6596
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:6898
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_FLOAT4
GPU_VERTEXELEMENTFORMAT_FLOAT4.
Definition SDL3pp_gpu.h:4325
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x10_FLOAT
GPU_TEXTUREFORMAT_ASTC_10x10_FLOAT.
Definition SDL3pp_gpu.h:2935
void GDKSuspendGPU()
Call this to suspend GPU operation on Xbox when you receive the EVENT_DID_ENTER_BACKGROUND event.
Definition SDL3pp_gpu.h:8231
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_6x5_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_6x5_UNORM_SRGB.
Definition SDL3pp_gpu.h:2869
SDL_GPUGraphicsPipeline * GPUGraphicsPipelineRaw
Alias to raw representation for GPUGraphicsPipeline.
Definition SDL3pp_gpu.h:426
GPUCopyPass BeginCopyPass()
Begins a copy pass on a command buffer.
Definition SDL3pp_gpu.h:7283
SDL_GPUBufferRegion GPUBufferRegion
A structure specifying a region of a buffer.
Definition SDL3pp_gpu.h:1660
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x8_FLOAT
GPU_TEXTUREFORMAT_ASTC_10x8_FLOAT.
Definition SDL3pp_gpu.h:2932
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32G32_INT
GPU_TEXTUREFORMAT_R32G32_INT.
Definition SDL3pp_gpu.h:2779
void ReleaseGPUTexture(GPUDeviceRef device, GPUTexture texture)
Frees the given texture as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6109
constexpr GPUBlendOp GPU_BLENDOP_INVALID
GPU_BLENDOP_INVALID.
Definition SDL3pp_gpu.h:4544
GPUTextureFormat GetSwapchainTextureFormat(WindowRef window)
Obtains the texture format of the swapchain for the given window.
Definition SDL3pp_gpu.h:7743
constexpr GPUSwapchainComposition GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR
GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR.
Definition SDL3pp_gpu.h:2504
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:6403
void BindVertexStorageTextures(Uint32 first_slot, SpanRef< const GPUTextureRaw > storage_textures)
Binds storage textures for use on the vertex shader.
Definition SDL3pp_gpu.h:6632
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:6806
SDL_GPUTransferBuffer * GPUTransferBufferRaw
Alias to raw representation for GPUTransferBuffer.
Definition SDL3pp_gpu.h:396
constexpr GPUPresentMode GPU_PRESENTMODE_IMMEDIATE
GPU_PRESENTMODE_IMMEDIATE.
Definition SDL3pp_gpu.h:2540
constexpr GPUBufferUsageFlags GPU_BUFFERUSAGE_VERTEX
Buffer is a vertex buffer.
Definition SDL3pp_gpu.h:4226
GPUCommandBuffer AcquireGPUCommandBuffer(GPUDeviceRef device)
Acquire a command buffer.
Definition SDL3pp_gpu.h:6269
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8B8A8_UINT
GPU_TEXTUREFORMAT_R8G8B8A8_UINT.
Definition SDL3pp_gpu.h:2737
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:8123
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC4_R_UNORM
GPU_TEXTUREFORMAT_BC4_R_UNORM.
Definition SDL3pp_gpu.h:2677
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:6585
void WaitForGPUSwapchain(GPUDeviceRef device, WindowRef window)
Blocks the thread until a swapchain texture is available to be acquired.
Definition SDL3pp_gpu.h:7837
constexpr GPUBufferUsageFlags GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ
Buffer supports storage reads in graphics stages.
Definition SDL3pp_gpu.h:4235
constexpr GPUCubeMapFace GPU_CUBEMAPFACE_POSITIVEZ
GPU_CUBEMAPFACE_POSITIVEZ.
Definition SDL3pp_gpu.h:4201
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_4x4_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_4x4_UNORM_SRGB.
Definition SDL3pp_gpu.h:2860
Uint32 GPUBufferUsageFlags
Specifies how a buffer is intended to be used by the client.
Definition SDL3pp_gpu.h:4224
void DispatchIndirect(GPUBuffer buffer, Uint32 offset)
Dispatches compute work with parameters set from a buffer.
Definition SDL3pp_gpu.h:7194
SDL_GPUStorageBufferReadWriteBinding GPUStorageBufferReadWriteBinding
A structure specifying parameters related to binding buffers in a compute pass.
Definition SDL3pp_gpu.h:1990
constexpr GPUCompareOp GPU_COMPAREOP_EQUAL
The comparison evaluates reference == test.
Definition SDL3pp_gpu.h:4470
SDL_GPUIndexedIndirectDrawCommand GPUIndexedIndirectDrawCommand
A structure specifying the parameters of an indexed indirect draw command.
Definition SDL3pp_gpu.h:4729
void SetTextureName(GPUTexture texture, StringParam text)
Sets an arbitrary string constant to label a texture.
Definition SDL3pp_gpu.h:6008
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:6233
void SetViewport(const GPUViewport &viewport)
Sets the current viewport state on a command buffer.
Definition SDL3pp_gpu.h:6457
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_SHORT2_NORM
GPU_VERTEXELEMENTFORMAT_SHORT2_NORM.
Definition SDL3pp_gpu.h:4364
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_BYTE4
GPU_VERTEXELEMENTFORMAT_BYTE4.
Definition SDL3pp_gpu.h:4331
constexpr GPUSwapchainComposition GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR
GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR.
Definition SDL3pp_gpu.h:2501
SDL_GPUComputePipeline * GPUComputePipelineRaw
Alias to raw representation for GPUComputePipeline.
Definition SDL3pp_gpu.h:420
constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR
1 - source color
Definition SDL3pp_gpu.h:4586
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:8131
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_B5G5R5A1_UNORM
GPU_TEXTUREFORMAT_B5G5R5A1_UNORM.
Definition SDL3pp_gpu.h:2659
void Submit()
Submits a command buffer so its commands can be processed on the GPU.
Definition SDL3pp_gpu.h:7938
void ReleaseWindowFromGPUDevice(GPUDeviceRef device, WindowRef window)
Unclaims a window, destroying its swapchain structure.
Definition SDL3pp_gpu.h:7638
constexpr GPUFilter GPU_FILTER_LINEAR
Linear filtering.
Definition SDL3pp_gpu.h:4650
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:7015
void ReleaseGPUSampler(GPUDeviceRef device, GPUSampler sampler)
Frees the given sampler as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6129
void BindFragmentStorageBuffers(Uint32 first_slot, SpanRef< const GPUBufferRaw > storage_buffers)
Binds storage buffers for use on the fragment shader.
Definition SDL3pp_gpu.h:6775
constexpr GPUBlendFactor GPU_BLENDFACTOR_CONSTANT_COLOR
blend constant
Definition SDL3pp_gpu.h:4607
constexpr GPUVertexInputRate GPU_VERTEXINPUTRATE_VERTEX
Attribute addressing is a function of the vertex index.
Definition SDL3pp_gpu.h:4392
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:4132
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8B8A8_UNORM
GPU_TEXTUREFORMAT_R8G8B8A8_UNORM.
Definition SDL3pp_gpu.h:2641
SDL_GPUCommandBuffer * GPUCommandBufferRaw
Alias to raw representation for GPUCommandBuffer.
Definition SDL3pp_gpu.h:432
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8B8A8_INT
GPU_TEXTUREFORMAT_R8G8B8A8_INT.
Definition SDL3pp_gpu.h:2764
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:7380
constexpr GPUTransferBufferUsage GPU_TRANSFERBUFFERUSAGE_UPLOAD
GPU_TRANSFERBUFFERUSAGE_UPLOAD.
Definition SDL3pp_gpu.h:4259
SDL_GPUShaderCreateInfo GPUShaderCreateInfo
A structure specifying code and metadata for creating a shader object.
Definition SDL3pp_gpu.h:838
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:5579
SDL_GPUPrimitiveType GPUPrimitiveType
Specifies the primitive topology of a graphics pipeline.
Definition SDL3pp_gpu.h:4107
SDL_GPUBufferCreateInfo GPUBufferCreateInfo
A structure specifying the parameters of a buffer.
Definition SDL3pp_gpu.h:466
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT
GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT.
Definition SDL3pp_gpu.h:2725
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:4177
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16_SNORM
GPU_TEXTUREFORMAT_R16_SNORM.
Definition SDL3pp_gpu.h:2701
SDL_GPUStencilOp GPUStencilOp
Specifies what happens to a stored stencil value if stencil tests fail or pass.
Definition SDL3pp_gpu.h:4498
constexpr GPUPresentMode GPU_PRESENTMODE_VSYNC
GPU_PRESENTMODE_VSYNC.
Definition SDL3pp_gpu.h:2537
constexpr GPUSamplerAddressMode GPU_SAMPLERADDRESSMODE_REPEAT
Specifies that the coordinates will wrap around.
Definition SDL3pp_gpu.h:4678
Uint32 GPUTextureUsageFlags
Specifies how a texture is intended to be used by the client.
Definition SDL3pp_gpu.h:2988
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_HALF4
GPU_VERTEXELEMENTFORMAT_HALF4.
Definition SDL3pp_gpu.h:4379
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UINT3
GPU_VERTEXELEMENTFORMAT_UINT3.
Definition SDL3pp_gpu.h:4310
constexpr GPUCubeMapFace GPU_CUBEMAPFACE_NEGATIVEX
GPU_CUBEMAPFACE_NEGATIVEX.
Definition SDL3pp_gpu.h:4192
void End()
Ends the current compute pass.
Definition SDL3pp_gpu.h:7214
SDL_GPUVertexInputState GPUVertexInputState
A structure specifying the parameters of a graphics pipeline vertex input state.
Definition SDL3pp_gpu.h:4784
constexpr GPUShaderStage GPU_SHADERSTAGE_VERTEX
GPU_SHADERSTAGE_VERTEX.
Definition SDL3pp_gpu.h:4274
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_D24_UNORM
GPU_TEXTUREFORMAT_D24_UNORM.
Definition SDL3pp_gpu.h:2806
void SetGPUStencilReference(GPURenderPass render_pass, Uint8 reference)
Sets the current stencil reference value on a command buffer.
Definition SDL3pp_gpu.h:6510
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:6764
constexpr GPUCompareOp GPU_COMPAREOP_LESS
The comparison evaluates reference < test.
Definition SDL3pp_gpu.h:4467
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET
Texture is a depth stencil target.
Definition SDL3pp_gpu.h:2996
void DispatchGPUCompute(GPUComputePass compute_pass, Uint32 groupcount_x, Uint32 groupcount_y, Uint32 groupcount_z)
Dispatches compute work.
Definition SDL3pp_gpu.h:7153
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_INT2
GPU_VERTEXELEMENTFORMAT_INT2.
Definition SDL3pp_gpu.h:4295
GPUComputePipeline CreateGPUComputePipeline(GPUDeviceRef device, const GPUComputePipelineCreateInfo &createinfo)
Creates a pipeline object to be used in a compute workflow.
Definition SDL3pp_gpu.h:5471
constexpr GPUPrimitiveType GPU_PRIMITIVETYPE_POINTLIST
A series of separate points.
Definition SDL3pp_gpu.h:4121
constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR
1 - destination color
Definition SDL3pp_gpu.h:4592
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC7_RGBA_UNORM
GPU_TEXTUREFORMAT_BC7_RGBA_UNORM.
Definition SDL3pp_gpu.h:2683
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:6987
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:7670
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:6692
GPUShaderFormat GetShaderFormats()
Returns the supported shader formats for this GPU context.
Definition SDL3pp_gpu.h:5278
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:4154
constexpr GPUVertexInputRate GPU_VERTEXINPUTRATE_INSTANCE
Attribute addressing is a function of the instance index.
Definition SDL3pp_gpu.h:4396
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:8229
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT
GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT.
Definition SDL3pp_gpu.h:2686
constexpr GPUShaderStage GPU_SHADERSTAGE_FRAGMENT
GPU_SHADERSTAGE_FRAGMENT.
Definition SDL3pp_gpu.h:4277
constexpr GPUCompareOp GPU_COMPAREOP_INVALID
GPU_COMPAREOP_INVALID.
Definition SDL3pp_gpu.h:4461
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC5_RG_UNORM
GPU_TEXTUREFORMAT_BC5_RG_UNORM.
Definition SDL3pp_gpu.h:2680
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:6562
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:6657
constexpr GPUCubeMapFace GPU_CUBEMAPFACE_NEGATIVEZ
GPU_CUBEMAPFACE_NEGATIVEZ.
Definition SDL3pp_gpu.h:4204
void UnmapGPUTransferBuffer(GPUDeviceRef device, GPUTransferBuffer transfer_buffer)
Unmaps a previously mapped transfer buffer.
Definition SDL3pp_gpu.h:7252
constexpr GPUPrimitiveType GPU_PRIMITIVETYPE_LINESTRIP
A series of connected lines.
Definition SDL3pp_gpu.h:4118
constexpr GPUStencilOp GPU_STENCILOP_DECREMENT_AND_WRAP
Decrements the current value and wraps to the maximum value.
Definition SDL3pp_gpu.h:4528
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8_UINT
GPU_TEXTUREFORMAT_R8_UINT.
Definition SDL3pp_gpu.h:2731
constexpr GPUSampleCount GPU_SAMPLECOUNT_4
MSAA 4x.
Definition SDL3pp_gpu.h:3038
constexpr GPUTransferBufferUsage GPU_TRANSFERBUFFERUSAGE_DOWNLOAD
GPU_TRANSFERBUFFERUSAGE_DOWNLOAD.
Definition SDL3pp_gpu.h:4262
constexpr GPUStencilOp GPU_STENCILOP_INVALID
GPU_STENCILOP_INVALID.
Definition SDL3pp_gpu.h:4500
constexpr GPUTextureType GPU_TEXTURETYPE_CUBE_ARRAY
The texture is a cube array image.
Definition SDL3pp_gpu.h:2965
void GDKResumeGPU()
Call this to resume GPU operation on Xbox when you receive the EVENT_WILL_ENTER_FOREGROUND event.
Definition SDL3pp_gpu.h:8248
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32_INT
GPU_TEXTUREFORMAT_R32_INT.
Definition SDL3pp_gpu.h:2776
bool WindowSupportsGPUPresentMode(GPUDeviceRef device, WindowRef window, GPUPresentMode present_mode)
Determines whether a presentation mode is supported by the window.
Definition SDL3pp_gpu.h:7579
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:7305
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:7464
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_5x4_FLOAT
GPU_TEXTUREFORMAT_ASTC_5x4_FLOAT.
Definition SDL3pp_gpu.h:2905
void WaitForSwapchain(WindowRef window)
Blocks the thread until a swapchain texture is available to be acquired.
Definition SDL3pp_gpu.h:7842
SDL_GPUDepthStencilState GPUDepthStencilState
A structure specifying the parameters of the graphics pipeline depth stencil state.
Definition SDL3pp_gpu.h:4843
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB
GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB.
Definition SDL3pp_gpu.h:2791
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_12x10_FLOAT
GPU_TEXTUREFORMAT_ASTC_12x10_FLOAT.
Definition SDL3pp_gpu.h:2938
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB
GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB.
Definition SDL3pp_gpu.h:2788
constexpr GPUColorComponentFlags GPU_COLORCOMPONENT_B
the blue component
Definition SDL3pp_gpu.h:4632
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x8_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_8x8_UNORM_SRGB.
Definition SDL3pp_gpu.h:2881
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16B16A16_SNORM
GPU_TEXTUREFORMAT_R16G16B16A16_SNORM.
Definition SDL3pp_gpu.h:2707
constexpr GPUSampleCount GPU_SAMPLECOUNT_8
MSAA 8x.
Definition SDL3pp_gpu.h:3040
constexpr GPUTextureType GPU_TEXTURETYPE_3D
The texture is a 3-dimensional image.
Definition SDL3pp_gpu.h:2959
SDL_GPURenderPass * GPURenderPassRaw
Alias to raw representation for GPURenderPass.
Definition SDL3pp_gpu.h:438
constexpr GPUBufferUsageFlags GPU_BUFFERUSAGE_INDEX
Buffer is an index buffer.
Definition SDL3pp_gpu.h:4229
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT
GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT.
Definition SDL3pp_gpu.h:2689
SDL_GPUVertexBufferDescription GPUVertexBufferDescription
A structure specifying the parameters of vertex buffers used in a graphics pipeline.
Definition SDL3pp_gpu.h:4758
constexpr GPUIndexElementSize GPU_INDEXELEMENTSIZE_16BIT
The index elements are 16-bit.
Definition SDL3pp_gpu.h:1149
SDL_GPUFrontFace GPUFrontFace
Specifies the vertex winding that will cause a triangle to be determined to be front-facing.
Definition SDL3pp_gpu.h:4440
constexpr GPUStencilOp GPU_STENCILOP_DECREMENT_AND_CLAMP
Decrements the current value and clamps to 0.
Definition SDL3pp_gpu.h:4516
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UINT4
GPU_VERTEXELEMENTFORMAT_UINT4.
Definition SDL3pp_gpu.h:4313
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16_UINT
GPU_TEXTUREFORMAT_R16_UINT.
Definition SDL3pp_gpu.h:2740
void ClaimWindow(WindowRef window)
Claims a window, creating a swapchain structure for it.
Definition SDL3pp_gpu.h:7623
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16_FLOAT
GPU_TEXTUREFORMAT_R16G16_FLOAT.
Definition SDL3pp_gpu.h:2713
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:6538
constexpr GPUSampleCount GPU_SAMPLECOUNT_2
MSAA 2x.
Definition SDL3pp_gpu.h:3036
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE
Texture supports storage writes in the compute stage.
Definition SDL3pp_gpu.h:3009
void End()
Ends the given render pass.
Definition SDL3pp_gpu.h:6952
SDL_GPUBufferBinding GPUBufferBinding
A structure specifying parameters in a buffer binding call.
Definition SDL3pp_gpu.h:1138
void BindVertexStorageBuffers(Uint32 first_slot, SpanRef< const GPUBufferRaw > storage_buffers)
Binds storage buffers for use on the vertex shader.
Definition SDL3pp_gpu.h:6668
void WaitForGPUIdle(GPUDeviceRef device)
Blocks the thread until the GPU is completely idle.
Definition SDL3pp_gpu.h:8019
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:6999
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x5_UNORM
GPU_TEXTUREFORMAT_ASTC_8x5_UNORM.
Definition SDL3pp_gpu.h:2833
SDL_GPURasterizerState GPURasterizerState
A structure specifying the parameters of the graphics pipeline rasterizer state.
Definition SDL3pp_gpu.h:4823
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:5922
constexpr GPUCullMode GPU_CULLMODE_FRONT
Front-facing triangles are culled.
Definition SDL3pp_gpu.h:4426
constexpr GPUCubeMapFace GPU_CUBEMAPFACE_POSITIVEY
GPU_CUBEMAPFACE_POSITIVEY.
Definition SDL3pp_gpu.h:4195
void WaitForFences(bool wait_all, std::span< GPUFence *const > fences)
Blocks the thread until the given fences are signaled.
Definition SDL3pp_gpu.h:8048
constexpr GPUCompareOp GPU_COMPAREOP_GREATER
The comparison evaluates reference > test.
Definition SDL3pp_gpu.h:4477
SDL_GPUComputePipelineCreateInfo GPUComputePipelineCreateInfo
A structure specifying the parameters of a compute pipeline state.
Definition SDL3pp_gpu.h:955
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16_FLOAT
GPU_TEXTUREFORMAT_R16_FLOAT.
Definition SDL3pp_gpu.h:2710
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_12x12_FLOAT
GPU_TEXTUREFORMAT_ASTC_12x12_FLOAT.
Definition SDL3pp_gpu.h:2941
void GenerateMipmapsForTexture(GPUTexture texture)
Generates mipmaps for the given texture.
Definition SDL3pp_gpu.h:7508
GPUTexture CreateTexture(const GPUTextureCreateInfo &createinfo)
Creates a texture object to be used in graphics or compute workflows.
Definition SDL3pp_gpu.h:5774
constexpr GPUFrontFace GPU_FRONTFACE_COUNTER_CLOCKWISE
A triangle with counter-clockwise vertex winding will be considered front-facing.
Definition SDL3pp_gpu.h:4446
SDL_GPUMultisampleState GPUMultisampleState
A structure specifying the parameters of the graphics pipeline multisample state.
Definition SDL3pp_gpu.h:4833
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:6297
constexpr GPUColorComponentFlags GPU_COLORCOMPONENT_R
the red component
Definition SDL3pp_gpu.h:4626
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x5_FLOAT
GPU_TEXTUREFORMAT_ASTC_10x5_FLOAT.
Definition SDL3pp_gpu.h:2926
constexpr GPUSamplerMipmapMode GPU_SAMPLERMIPMAPMODE_NEAREST
Point filtering.
Definition SDL3pp_gpu.h:4662
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_BYTE2_NORM
GPU_VERTEXELEMENTFORMAT_BYTE2_NORM.
Definition SDL3pp_gpu.h:4340
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_HALF2
GPU_VERTEXELEMENTFORMAT_HALF2.
Definition SDL3pp_gpu.h:4376
SDL_GPUSampler * GPUSamplerRaw
Alias to raw representation for GPUSampler.
Definition SDL3pp_gpu.h:408
void ClaimWindowForGPUDevice(GPUDeviceRef device, WindowRef window)
Claims a window, creating a swapchain structure for it.
Definition SDL3pp_gpu.h:7618
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_6x5_UNORM
GPU_TEXTUREFORMAT_ASTC_6x5_UNORM.
Definition SDL3pp_gpu.h:2827
constexpr GPUCullMode GPU_CULLMODE_BACK
Back-facing triangles are culled.
Definition SDL3pp_gpu.h:4429
SDL_GPUIndirectDrawCommand GPUIndirectDrawCommand
A structure specifying the parameters of an indirect draw command.
Definition SDL3pp_gpu.h:4713
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UINT2
GPU_VERTEXELEMENTFORMAT_UINT2.
Definition SDL3pp_gpu.h:4307
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x6_UNORM
GPU_TEXTUREFORMAT_ASTC_10x6_UNORM.
Definition SDL3pp_gpu.h:2845
GPUTransferBuffer CreateTransferBuffer(const GPUTransferBufferCreateInfo &createinfo)
Creates a transfer buffer to be used when uploading to or downloading from graphics resources.
Definition SDL3pp_gpu.h:5929
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8B8A8_SNORM
GPU_TEXTUREFORMAT_R8G8B8A8_SNORM.
Definition SDL3pp_gpu.h:2698
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UBYTE4
GPU_VERTEXELEMENTFORMAT_UBYTE4.
Definition SDL3pp_gpu.h:4337
void PushFragmentUniformData(Uint32 slot_index, SourceBytes data)
Pushes data to a fragment uniform slot on the command buffer.
Definition SDL3pp_gpu.h:6335
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:7334
void PushGPUComputeUniformData(GPUCommandBuffer command_buffer, Uint32 slot_index, SourceBytes data)
Pushes data to a uniform slot on the command buffer.
Definition SDL3pp_gpu.h:6357
constexpr GPUBlendFactor GPU_BLENDFACTOR_INVALID
GPU_BLENDFACTOR_INVALID.
Definition SDL3pp_gpu.h:4576
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:8173
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_INVALID
GPU_VERTEXELEMENTFORMAT_INVALID.
Definition SDL3pp_gpu.h:4289
void PushVertexUniformData(Uint32 slot_index, SourceBytes data)
Pushes data to a vertex uniform slot on the command buffer.
Definition SDL3pp_gpu.h:6305
SDL_GPUCopyPass * GPUCopyPassRaw
Alias to raw representation for GPUCopyPass.
Definition SDL3pp_gpu.h:450
GPUShader CreateGPUShader(GPUDeviceRef device, const GPUShaderCreateInfo &createinfo)
Creates a shader to be used when creating a graphics pipeline.
Definition SDL3pp_gpu.h:5680
constexpr GPUStencilOp GPU_STENCILOP_INCREMENT_AND_CLAMP
Increments the current value and clamps to the maximum value.
Definition SDL3pp_gpu.h:4513
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_SHORT4_NORM
GPU_VERTEXELEMENTFORMAT_SHORT4_NORM.
Definition SDL3pp_gpu.h:4367
SDL_GPUVertexElementFormat GPUVertexElementFormat
Specifies the format of a vertex attribute.
Definition SDL3pp_gpu.h:4287
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT
GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT.
Definition SDL3pp_gpu.h:2815
void GenerateMipmapsForGPUTexture(GPUCommandBuffer command_buffer, GPUTexture texture)
Generates mipmaps for the given texture.
Definition SDL3pp_gpu.h:7502
constexpr GPUTextureType GPU_TEXTURETYPE_2D
The texture is a 2-dimensional image.
Definition SDL3pp_gpu.h:2953
void CopyBufferToBuffer(const GPUBufferLocation &source, const GPUBufferLocation &destination, Uint32 size, bool cycle)
Performs a buffer-to-buffer copy.
Definition SDL3pp_gpu.h:7416
constexpr GPUBlendFactor GPU_BLENDFACTOR_SRC_COLOR
source color
Definition SDL3pp_gpu.h:4583
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC2_RGBA_UNORM
GPU_TEXTUREFORMAT_BC2_RGBA_UNORM.
Definition SDL3pp_gpu.h:2671
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB
GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB.
Definition SDL3pp_gpu.h:2785
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:6191
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_B4G4R4A4_UNORM
GPU_TEXTUREFORMAT_B4G4R4A4_UNORM.
Definition SDL3pp_gpu.h:2662
GPUTexture CreateGPUTexture(GPUDeviceRef device, const GPUTextureCreateInfo &createinfo)
Creates a texture object to be used in graphics or compute workflows.
Definition SDL3pp_gpu.h:5768
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_12x10_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_12x10_UNORM_SRGB.
Definition SDL3pp_gpu.h:2896
void DestroyGPUDevice(GPUDeviceRaw device)
Destroys a GPU context previously returned by CreateGPUDevice.
Definition SDL3pp_gpu.h:5209
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x10_UNORM
GPU_TEXTUREFORMAT_ASTC_10x10_UNORM.
Definition SDL3pp_gpu.h:2851
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_5x4_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_5x4_UNORM_SRGB.
Definition SDL3pp_gpu.h:2863
bool QueryFence(GPUFence *fence)
Checks the status of a fence.
Definition SDL3pp_gpu.h:8070
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_12x10_UNORM
GPU_TEXTUREFORMAT_ASTC_12x10_UNORM.
Definition SDL3pp_gpu.h:2854
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:6432
SDL_GPUTextureType GPUTextureType
Specifies the type of a texture.
Definition SDL3pp_gpu.h:2951
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_5x5_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_5x5_UNORM_SRGB.
Definition SDL3pp_gpu.h:2866
constexpr GPUShaderFormat GPU_SHADERFORMAT_METALLIB
Precompiled metallib shaders for Metal.
Definition SDL3pp_gpu.h:2468
constexpr GPUFillMode GPU_FILLMODE_LINE
Polygon edges will be drawn as line segments.
Definition SDL3pp_gpu.h:4411
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:7407
SDL_GPUIndirectDispatchCommand GPUIndirectDispatchCommand
A structure specifying the parameters of an indexed dispatch command.
Definition SDL3pp_gpu.h:4738
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_4x4_UNORM
GPU_TEXTUREFORMAT_ASTC_4x4_UNORM.
Definition SDL3pp_gpu.h:2818
constexpr GPUPrimitiveType GPU_PRIMITIVETYPE_TRIANGLESTRIP
A series of connected triangles.
Definition SDL3pp_gpu.h:4112
SDL_GPUColorTargetBlendState GPUColorTargetBlendState
A structure specifying the blend state of a color target.
Definition SDL3pp_gpu.h:4805
SDL_GPUTransferBufferLocation GPUTransferBufferLocation
A structure specifying a location in a transfer buffer.
Definition SDL3pp_gpu.h:1730
constexpr GPUShaderFormat GPU_SHADERFORMAT_MSL
MSL shaders for Metal.
Definition SDL3pp_gpu.h:2465
PropertiesRef GetGPUDeviceProperties(GPUDeviceRef device)
Get the properties associated with a GPU device.
Definition SDL3pp_gpu.h:5386
SDL_GPUBuffer * GPUBufferRaw
Alias to raw representation for GPUBuffer.
Definition SDL3pp_gpu.h:390
void PopDebugGroup()
Ends the most-recently pushed debug group.
Definition SDL3pp_gpu.h:6094
void UploadToTexture(const GPUTextureTransferInfo &source, const GPUTextureRegion &destination, bool cycle)
Uploads data from a transfer buffer to a texture.
Definition SDL3pp_gpu.h:7313
SDL_GPUSamplerMipmapMode GPUSamplerMipmapMode
Specifies a mipmap mode used by a sampler.
Definition SDL3pp_gpu.h:4660
bool SetSwapchainParameters(WindowRef window, GPUSwapchainComposition swapchain_composition, GPUPresentMode present_mode)
Changes the swapchain parameters for the given claimed window.
Definition SDL3pp_gpu.h:7680
Uint8 GPUColorComponentFlags
Specifies which color components are written in a graphics pipeline.
Definition SDL3pp_gpu.h:4624
const char * GetGPUDeviceDriver(GPUDeviceRef device)
Returns the name of the backend used to create this GPU context.
Definition SDL3pp_gpu.h:5254
constexpr GPUCompareOp GPU_COMPAREOP_NEVER
The comparison always evaluates false.
Definition SDL3pp_gpu.h:4464
SDL_GPUVulkanOptions GPUVulkanOptions
A structure specifying additional options when using Vulkan.
Definition SDL3pp_gpu.h:5196
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16_SNORM
GPU_TEXTUREFORMAT_R16G16_SNORM.
Definition SDL3pp_gpu.h:2704
void SetBlendConstants(FColorRaw blend_constants)
Sets the current blend constants on a command buffer.
Definition SDL3pp_gpu.h:6497
constexpr GPUBlendFactor GPU_BLENDFACTOR_SRC_ALPHA
source alpha
Definition SDL3pp_gpu.h:4595
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x5_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_8x5_UNORM_SRGB.
Definition SDL3pp_gpu.h:2875
void ReleaseSampler(GPUSampler sampler)
Frees the given sampler as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6134
bool TextureSupportsSampleCount(GPUTextureFormat format, GPUSampleCount sample_count)
Determines if a sample count for a texture format is supported.
Definition SDL3pp_gpu.h:8155
SDL_GPUSamplerAddressMode GPUSamplerAddressMode
Specifies behavior of texture sampling when the coordinates exceed the 0-1 range.
Definition SDL3pp_gpu.h:4676
void Destroy()
Destroys a GPU context previously returned by CreateGPUDevice.
Definition SDL3pp_gpu.h:5214
GPUDevice CreateGPUDevice(GPUShaderFormat format_flags, bool debug_mode, StringParam name)
Creates a GPU context.
Definition SDL3pp_gpu.h:4927
void ReleaseBuffer(GPUBuffer buffer)
Frees the given buffer as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6154
void ReleaseGraphicsPipeline(GPUGraphicsPipeline graphics_pipeline)
Frees the given graphics pipeline as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6239
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_6x6_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_6x6_UNORM_SRGB.
Definition SDL3pp_gpu.h:2872
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R10G10B10A2_UNORM
GPU_TEXTUREFORMAT_R10G10B10A2_UNORM.
Definition SDL3pp_gpu.h:2653
void BindPipeline(GPUGraphicsPipeline graphics_pipeline)
Binds a graphics pipeline on a render pass to be used in rendering.
Definition SDL3pp_gpu.h:6438
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_B8G8R8A8_UNORM
GPU_TEXTUREFORMAT_B8G8R8A8_UNORM.
Definition SDL3pp_gpu.h:2665
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:6890
constexpr GPULoadOp GPU_LOADOP_DONT_CARE
The previous contents of the texture need not be preserved.
Definition SDL3pp_gpu.h:4144
constexpr GPUBlendFactor GPU_BLENDFACTOR_ZERO
0
Definition SDL3pp_gpu.h:4579
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8_SNORM
GPU_TEXTUREFORMAT_R8G8_SNORM.
Definition SDL3pp_gpu.h:2695
SDL_GPUSwapchainComposition GPUSwapchainComposition
Specifies the texture format and colorspace of the swapchain textures.
Definition SDL3pp_gpu.h:2496
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32G32B32A32_INT
GPU_TEXTUREFORMAT_R32G32B32A32_INT.
Definition SDL3pp_gpu.h:2782
GPUCommandBuffer AcquireCommandBuffer()
Acquire a command buffer.
Definition SDL3pp_gpu.h:6274
constexpr GPUBlendOp GPU_BLENDOP_MAX
max(source, destination)
Definition SDL3pp_gpu.h:4560
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16_INT
GPU_TEXTUREFORMAT_R16G16_INT.
Definition SDL3pp_gpu.h:2770
bool WindowSupportsSwapchainComposition(WindowRef window, GPUSwapchainComposition swapchain_composition)
Determines whether a swapchain composition is supported by the window.
Definition SDL3pp_gpu.h:7557
const char * GetGPUDriver(int index)
Get the name of a built in GPU driver.
Definition SDL3pp_gpu.h:5244
constexpr GPUStoreOp GPU_STOREOP_STORE
The contents generated during the render pass will be written to memory.
Definition SDL3pp_gpu.h:4157
SDL_GPUSampleCount GPUSampleCount
Specifies the sample count of a texture.
Definition SDL3pp_gpu.h:3031
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB
GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB.
Definition SDL3pp_gpu.h:2794
void InsertDebugLabel(StringParam text)
Inserts an arbitrary string label into the command buffer callstream.
Definition SDL3pp_gpu.h:6034
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB
GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB.
Definition SDL3pp_gpu.h:2800
constexpr GPUBlendFactor GPU_BLENDFACTOR_SRC_ALPHA_SATURATE
min(source alpha, 1 - destination alpha)
Definition SDL3pp_gpu.h:4613
constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA
1 - destination alpha
Definition SDL3pp_gpu.h:4604
GPUTextureFormat GetGPUSwapchainTextureFormat(GPUDeviceRef device, WindowRef window)
Obtains the texture format of the swapchain for the given window.
Definition SDL3pp_gpu.h:7737
void BindPipeline(GPUComputePipeline compute_pipeline)
Binds a compute pipeline on a command buffer for use in compute dispatch.
Definition SDL3pp_gpu.h:7021
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_BYTE2
GPU_VERTEXELEMENTFORMAT_BYTE2.
Definition SDL3pp_gpu.h:4328
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x8_UNORM
GPU_TEXTUREFORMAT_ASTC_8x8_UNORM.
Definition SDL3pp_gpu.h:2839
constexpr GPUStencilOp GPU_STENCILOP_KEEP
Keeps the current value.
Definition SDL3pp_gpu.h:4503
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_INT3
GPU_VERTEXELEMENTFORMAT_INT3.
Definition SDL3pp_gpu.h:4298
void SetGPUBufferName(GPUDeviceRef device, GPUBuffer buffer, StringParam text)
Sets an arbitrary string constant to label a buffer.
Definition SDL3pp_gpu.h:5972
constexpr GPUBufferUsageFlags GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ
Buffer supports storage reads in the compute stage.
Definition SDL3pp_gpu.h:4240
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:7471
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x5_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_10x5_UNORM_SRGB.
Definition SDL3pp_gpu.h:2884
void SetGPUBlendConstants(GPURenderPass render_pass, FColorRaw blend_constants)
Sets the current blend constants on a command buffer.
Definition SDL3pp_gpu.h:6491
SDL_GPUTextureCreateInfo GPUTextureCreateInfo
A structure specifying the parameters of a texture.
Definition SDL3pp_gpu.h:654
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16B16A16_UINT
GPU_TEXTUREFORMAT_R16G16B16A16_UINT.
Definition SDL3pp_gpu.h:2746
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x8_FLOAT
GPU_TEXTUREFORMAT_ASTC_8x8_FLOAT.
Definition SDL3pp_gpu.h:2923
SDL_GPUFilter GPUFilter
Specifies a filter operation used by a sampler.
Definition SDL3pp_gpu.h:4645
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_5x4_UNORM
GPU_TEXTUREFORMAT_ASTC_5x4_UNORM.
Definition SDL3pp_gpu.h:2821
void End()
Ends the current copy pass.
Definition SDL3pp_gpu.h:7490
ResourceRefT< GPUDeviceBase > GPUDeviceRef
Reference for GPUDevice.
Definition SDL3pp_gpu.h:387
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_USHORT4
GPU_VERTEXELEMENTFORMAT_USHORT4.
Definition SDL3pp_gpu.h:4361
GPUFence * SubmitAndAcquireFence()
Submits a command buffer so its commands can be processed on the GPU, and acquires a fence associated...
Definition SDL3pp_gpu.h:7973
bool GPUSupportsProperties(PropertiesRef props)
Checks for GPU runtime support.
Definition SDL3pp_gpu.h:4896
constexpr GPUShaderFormat GPU_SHADERFORMAT_INVALID
INVALID.
Definition SDL3pp_gpu.h:2450
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:8040
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:7114
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_B5G6R5_UNORM
GPU_TEXTUREFORMAT_B5G6R5_UNORM.
Definition SDL3pp_gpu.h:2656
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:7438
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8_UNORM
GPU_TEXTUREFORMAT_R8G8_UNORM.
Definition SDL3pp_gpu.h:2638
void EndGPURenderPass(GPURenderPass render_pass)
Ends the given render pass.
Definition SDL3pp_gpu.h:6947
constexpr GPUBlendOp GPU_BLENDOP_REVERSE_SUBTRACT
(destination * destination_factor) - (source * source_factor)
Definition SDL3pp_gpu.h:4554
constexpr GPUColorComponentFlags GPU_COLORCOMPONENT_G
the green component
Definition SDL3pp_gpu.h:4629
void SetBufferName(GPUBuffer buffer, StringParam text)
Sets an arbitrary string constant to label a buffer.
Definition SDL3pp_gpu.h:5979
constexpr GPUSwapchainComposition GPU_SWAPCHAINCOMPOSITION_SDR
GPU_SWAPCHAINCOMPOSITION_SDR.
Definition SDL3pp_gpu.h:2498
constexpr GPUBufferUsageFlags GPU_BUFFERUSAGE_INDIRECT
Buffer is an indirect buffer.
Definition SDL3pp_gpu.h:4232
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ
Texture supports storage reads in the compute stage.
Definition SDL3pp_gpu.h:3005
constexpr GPUBlendOp GPU_BLENDOP_SUBTRACT
(source * source_factor) - (destination * destination_factor)
Definition SDL3pp_gpu.h:4551
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8_INT
GPU_TEXTUREFORMAT_R8_INT.
Definition SDL3pp_gpu.h:2758
void InsertGPUDebugLabel(GPUCommandBuffer command_buffer, StringParam text)
Inserts an arbitrary string label into the command buffer callstream.
Definition SDL3pp_gpu.h:6028
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16_UNORM
GPU_TEXTUREFORMAT_R16_UNORM.
Definition SDL3pp_gpu.h:2644
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x10_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_10x10_UNORM_SRGB.
Definition SDL3pp_gpu.h:2893
SDL_GPUDevice * GPUDeviceRaw
Alias to raw representation for GPUDevice.
Definition SDL3pp_gpu.h:380
void ReleaseTransferBuffer(GPUTransferBuffer transfer_buffer)
Frees the given transfer buffer as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6175
SDL_GPUBlitRegion GPUBlitRegion
A structure specifying a region of a texture used in the blit operation.
Definition SDL3pp_gpu.h:4697
SDL_GPUTextureSamplerBinding GPUTextureSamplerBinding
A structure specifying parameters in a sampler binding call.
Definition SDL3pp_gpu.h:1165
void EndGPUCopyPass(GPUCopyPass copy_pass)
Ends the current copy pass.
Definition SDL3pp_gpu.h:7485
void DispatchGPUComputeIndirect(GPUComputePass compute_pass, GPUBuffer buffer, Uint32 offset)
Dispatches compute work with parameters set from a buffer.
Definition SDL3pp_gpu.h:7187
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:7902
constexpr GPUStoreOp GPU_STOREOP_DONT_CARE
The contents generated during the render pass are not needed and may be discarded.
Definition SDL3pp_gpu.h:4163
constexpr GPULoadOp GPU_LOADOP_CLEAR
The contents of the texture will be cleared to a color.
Definition SDL3pp_gpu.h:4138
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM
GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM.
Definition SDL3pp_gpu.h:4349
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32G32B32A32_UINT
GPU_TEXTUREFORMAT_R32G32B32A32_UINT.
Definition SDL3pp_gpu.h:2755
SDL_GPUShader * GPUShaderRaw
Alias to raw representation for GPUShader.
Definition SDL3pp_gpu.h:414
constexpr GPUTextureType GPU_TEXTURETYPE_2D_ARRAY
The texture is a 2-dimensional array image.
Definition SDL3pp_gpu.h:2956
constexpr GPUPresentMode GPU_PRESENTMODE_MAILBOX
GPU_PRESENTMODE_MAILBOX.
Definition SDL3pp_gpu.h:2543
constexpr GPUCubeMapFace GPU_CUBEMAPFACE_NEGATIVEY
GPU_CUBEMAPFACE_NEGATIVEY.
Definition SDL3pp_gpu.h:4198
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:4574
void PushDebugGroup(StringParam name)
Begins a debug group with an arbitrary name.
Definition SDL3pp_gpu.h:6070
bool GPUSupportsShaderFormats(GPUShaderFormat format_flags, StringParam name)
Checks for GPU runtime support.
Definition SDL3pp_gpu.h:4880
void ReleaseGPUFence(GPUDeviceRef device, GPUFence *fence)
Releases a fence obtained from SubmitGPUCommandBufferAndAcquireFence.
Definition SDL3pp_gpu.h:8087
constexpr GPUShaderFormat GPU_SHADERFORMAT_SPIRV
SPIR-V shaders for Vulkan.
Definition SDL3pp_gpu.h:2456
constexpr GPUSamplerAddressMode GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT
Specifies that the coordinates will wrap around mirrored.
Definition SDL3pp_gpu.h:4683
const char * GetDriver()
Returns the name of the backend used to create this GPU context.
Definition SDL3pp_gpu.h:5259
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:6530
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:7089
void DrawPrimitives(Uint32 num_vertices, Uint32 num_instances, Uint32 first_vertex, Uint32 first_instance)
Draws data using bound graphics state.
Definition SDL3pp_gpu.h:6865
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x5_FLOAT
GPU_TEXTUREFORMAT_ASTC_8x5_FLOAT.
Definition SDL3pp_gpu.h:2917
void SetGPUScissor(GPURenderPass render_pass, const RectRaw &scissor)
Sets the current scissor state on a command buffer.
Definition SDL3pp_gpu.h:6470
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_D16_UNORM
GPU_TEXTUREFORMAT_D16_UNORM.
Definition SDL3pp_gpu.h:2803
void SubmitGPUCommandBuffer(GPUCommandBuffer command_buffer)
Submits a command buffer so its commands can be processed on the GPU.
Definition SDL3pp_gpu.h:7933
void ReleaseShader(GPUShader shader)
Frees the given shader as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6218
constexpr GPUFilter GPU_FILTER_NEAREST
Point filtering.
Definition SDL3pp_gpu.h:4647
void SetGPUTextureName(GPUDeviceRef device, GPUTexture texture, StringParam text)
Sets an arbitrary string constant to label a texture.
Definition SDL3pp_gpu.h:6001
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x6_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_10x6_UNORM_SRGB.
Definition SDL3pp_gpu.h:2887
SDL_GPUStencilOpState GPUStencilOpState
A structure specifying the stencil operation state of a graphics pipeline.
Definition SDL3pp_gpu.h:4793
constexpr GPUCubeMapFace GPU_CUBEMAPFACE_POSITIVEX
GPU_CUBEMAPFACE_POSITIVEX.
Definition SDL3pp_gpu.h:4189
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:7042
void UnmapTransferBuffer(GPUTransferBuffer transfer_buffer)
Unmaps a previously mapped transfer buffer.
Definition SDL3pp_gpu.h:7258
void WaitForIdle()
Blocks the thread until the GPU is completely idle.
Definition SDL3pp_gpu.h:8024
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:7078
SDL_GPUBufferLocation GPUBufferLocation
A structure specifying a location in a buffer.
Definition SDL3pp_gpu.h:1682
GPUCopyPass BeginGPUCopyPass(GPUCommandBuffer command_buffer)
Begins a copy pass on a command buffer.
Definition SDL3pp_gpu.h:7278
constexpr GPUBlendOp GPU_BLENDOP_ADD
(source * source_factor) + (destination * destination_factor)
Definition SDL3pp_gpu.h:4548
constexpr GPUTextureType GPU_TEXTURETYPE_CUBE
The texture is a cube image.
Definition SDL3pp_gpu.h:2962
constexpr GPUStencilOp GPU_STENCILOP_INCREMENT_AND_WRAP
Increments the current value and wraps back to 0.
Definition SDL3pp_gpu.h:4523
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB
GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB.
Definition SDL3pp_gpu.h:2797
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_INVALID
GPU_TEXTUREFORMAT_INVALID.
Definition SDL3pp_gpu.h:2629
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_5x5_UNORM
GPU_TEXTUREFORMAT_ASTC_5x5_UNORM.
Definition SDL3pp_gpu.h:2824
GPUComputePipeline CreateComputePipeline(const GPUComputePipelineCreateInfo &createinfo)
Creates a pipeline object to be used in a compute workflow.
Definition SDL3pp_gpu.h:5478
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_BYTE4_NORM
GPU_VERTEXELEMENTFORMAT_BYTE4_NORM.
Definition SDL3pp_gpu.h:4343
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_FLOAT
GPU_VERTEXELEMENTFORMAT_FLOAT.
Definition SDL3pp_gpu.h:4316
constexpr GPUSampleCount GPU_SAMPLECOUNT_1
No multisampling.
Definition SDL3pp_gpu.h:3033
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:6414
constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA
1 - source alpha
Definition SDL3pp_gpu.h:4598
constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE
1
Definition SDL3pp_gpu.h:4581
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM
GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM.
Definition SDL3pp_gpu.h:4346
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_SHORT4
GPU_VERTEXELEMENTFORMAT_SHORT4.
Definition SDL3pp_gpu.h:4355
void PopGPUDebugGroup(GPUCommandBuffer command_buffer)
Ends the most-recently pushed debug group.
Definition SDL3pp_gpu.h:6089
SDL_GPUComputePass * GPUComputePassRaw
Alias to raw representation for GPUComputePass.
Definition SDL3pp_gpu.h:444
void ReleaseGPUBuffer(GPUDeviceRef device, GPUBuffer buffer)
Frees the given buffer as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6149
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:8246
constexpr GPULoadOp GPU_LOADOP_LOAD
The previous contents of the texture will be preserved.
Definition SDL3pp_gpu.h:4135
constexpr GPUCullMode GPU_CULLMODE_NONE
No triangles are culled.
Definition SDL3pp_gpu.h:4423
constexpr GPUBlendFactor GPU_BLENDFACTOR_DST_ALPHA
destination alpha
Definition SDL3pp_gpu.h:4601
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:6929
void EndGPUComputePass(GPUComputePass compute_pass)
Ends the current compute pass.
Definition SDL3pp_gpu.h:7209
SDL_GPUVertexInputRate GPUVertexInputRate
Specifies the rate at which vertex attributes are pulled from buffers.
Definition SDL3pp_gpu.h:4389
SDL_GPUBlitInfo GPUBlitInfo
A structure containing parameters for a blit command.
Definition SDL3pp_gpu.h:1999
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x5_UNORM
GPU_TEXTUREFORMAT_ASTC_10x5_UNORM.
Definition SDL3pp_gpu.h:2842
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8_UINT
GPU_TEXTUREFORMAT_R8G8_UINT.
Definition SDL3pp_gpu.h:2734
SDL_FColor FColorRaw
Alias to raw representation for FColor.
Definition SDL3pp_pixels.h:89
ResourceRefT< PropertiesBase > PropertiesRef
Reference for Properties.
Definition SDL3pp_properties.h:53
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:283
::Uint32 Uint32
An unsigned 32-bit integer type.
Definition SDL3pp_stdinc.h:296
::Uint8 Uint8
An unsigned 8-bit integer type.
Definition SDL3pp_stdinc.h:244
ResourceRefT< WindowBase > WindowRef
Reference for Window.
Definition SDL3pp_video.h:57
Properties for GPUBuffer creation.
Definition SDL3pp_gpu.h:5888
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_gpu.h:5890
Properties for GPUComputePipeline creation.
Definition SDL3pp_gpu.h:5497
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_gpu.h:5499
Properties for GPUDevice creation.
Definition SDL3pp_gpu.h:5067
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_gpu.h:5082
constexpr auto FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN
Enable feature indirect draw first instance.
Definition SDL3pp_gpu.h:5096
constexpr auto D3D12_AGILITY_SDK_PATH_STRING
String for d3d12 agility sdk path.
Definition SDL3pp_gpu.h:5149
constexpr auto DEBUGMODE_BOOLEAN
Enable debugmode.
Definition SDL3pp_gpu.h:5069
constexpr auto FEATURE_DEPTH_CLAMPING_BOOLEAN
Enable feature depth clamping.
Definition SDL3pp_gpu.h:5091
constexpr auto SHADERS_PRIVATE_BOOLEAN
Enable shaders private.
Definition SDL3pp_gpu.h:5105
constexpr auto D3D12_AGILITY_SDK_VERSION_NUMBER
Number for d3d12 agility sdk version.
Definition SDL3pp_gpu.h:5143
constexpr auto SHADERS_MSL_BOOLEAN
Enable shaders msl.
Definition SDL3pp_gpu.h:5118
constexpr auto METAL_ALLOW_MACFAMILY1_BOOLEAN
Enable metal allow macfamily1.
Definition SDL3pp_gpu.h:5169
constexpr auto VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN
Enable vulkan require hardware acceleration.
Definition SDL3pp_gpu.h:5158
constexpr auto D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN
Enable d3d12 allow fewer resource slots.
Definition SDL3pp_gpu.h:5127
constexpr auto SHADERS_DXIL_BOOLEAN
Enable shaders dxil.
Definition SDL3pp_gpu.h:5115
constexpr auto SHADERS_DXBC_BOOLEAN
Enable shaders dxbc.
Definition SDL3pp_gpu.h:5112
constexpr auto SHADERS_SPIRV_BOOLEAN
Enable shaders spirv.
Definition SDL3pp_gpu.h:5109
constexpr auto PREFERLOWPOWER_BOOLEAN
Enable preferlowpower.
Definition SDL3pp_gpu.h:5072
constexpr auto FEATURE_ANISOTROPY_BOOLEAN
Enable feature anisotropy.
Definition SDL3pp_gpu.h:5099
constexpr auto FEATURE_CLIP_DISTANCE_BOOLEAN
Enable feature clip distance.
Definition SDL3pp_gpu.h:5087
constexpr auto VULKAN_OPTIONS_POINTER
Pointer to vulkan options.
Definition SDL3pp_gpu.h:5161
constexpr auto SHADERS_METALLIB_BOOLEAN
Enable shaders metallib.
Definition SDL3pp_gpu.h:5121
constexpr auto VERBOSE_BOOLEAN
Enable verbose.
Definition SDL3pp_gpu.h:5077
constexpr auto D3D12_SEMANTIC_NAME_STRING
String for d3d12 semantic name.
Definition SDL3pp_gpu.h:5137
Properties for GPUDevice creation and information.
Definition SDL3pp_gpu.h:5067
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_gpu.h:5410
constexpr auto DRIVER_VERSION_STRING
String for driver version.
Definition SDL3pp_gpu.h:5416
constexpr auto DRIVER_NAME_STRING
String for driver name.
Definition SDL3pp_gpu.h:5413
constexpr auto DRIVER_INFO_STRING
String for driver info.
Definition SDL3pp_gpu.h:5419
Properties for GPUGraphicsPipeline creation.
Definition SDL3pp_gpu.h:5551
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_gpu.h:5553
Properties for GPUSampler creation.
Definition SDL3pp_gpu.h:5602
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_gpu.h:5604
Properties for GPUShader creation.
Definition SDL3pp_gpu.h:5703
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_gpu.h:5705
Properties for GPUTexture creation.
Definition SDL3pp_gpu.h:5791
constexpr auto D3D12_CLEAR_G_FLOAT
Float for d3d12 clear g.
Definition SDL3pp_gpu.h:5796
constexpr auto D3D12_CLEAR_DEPTH_FLOAT
Float for d3d12 clear depth.
Definition SDL3pp_gpu.h:5805
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_gpu.h:5817
constexpr auto D3D12_CLEAR_A_FLOAT
Float for d3d12 clear a.
Definition SDL3pp_gpu.h:5802
constexpr auto D3D12_CLEAR_STENCIL_NUMBER
Number for d3d12 clear stencil.
Definition SDL3pp_gpu.h:5811
constexpr auto D3D12_CLEAR_B_FLOAT
Float for d3d12 clear b.
Definition SDL3pp_gpu.h:5799
constexpr auto D3D12_CLEAR_R_FLOAT
Float for d3d12 clear r.
Definition SDL3pp_gpu.h:5793
Properties for GPUTransferBuffer creation.
Definition SDL3pp_gpu.h:5948
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_gpu.h:5950
Main include header for the SDL3pp library.
Uint32 narrowU32(T value)
Narrows to Uint32.
Definition SDL3pp_stdinc.h:6276
Base class to GPUDevice.
Definition SDL3pp_gpu.h:3048
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
An opaque handle representing the SDL_GPU context.
Definition SDL3pp_gpu.h:3914
constexpr GPUDevice & operator=(GPUDevice &&other) noexcept
Assignment operator.
Definition SDL3pp_gpu.h:4080
~GPUDevice()
Destructor.
Definition SDL3pp_gpu.h:4077
constexpr GPUDevice(GPUDeviceRaw resource) noexcept
Constructs from raw GPUDevice.
Definition SDL3pp_gpu.h:3924
constexpr GPUDevice(GPUDevice &&other) noexcept
Move constructor.
Definition SDL3pp_gpu.h:3930
A non-owning reference wrapper for a given resource.
Definition SDL3pp_resource.h:93