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
4228
4230 SDL_GPU_BUFFERUSAGE_VERTEX;
4231
4233 SDL_GPU_BUFFERUSAGE_INDEX;
4234
4236 SDL_GPU_BUFFERUSAGE_INDIRECT;
4237
4239 SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ;
4241
4244 SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ;
4245
4248 SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE;
4249
4260using GPUTransferBufferUsage = SDL_GPUTransferBufferUsage;
4261
4263 SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD;
4264
4266 SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD;
4267
4275using GPUShaderStage = SDL_GPUShaderStage;
4276
4278 SDL_GPU_SHADERSTAGE_VERTEX;
4279
4281 SDL_GPU_SHADERSTAGE_FRAGMENT;
4282
4290using GPUVertexElementFormat = SDL_GPUVertexElementFormat;
4291
4293 SDL_GPU_VERTEXELEMENTFORMAT_INVALID;
4294
4296 SDL_GPU_VERTEXELEMENTFORMAT_INT;
4297
4299 SDL_GPU_VERTEXELEMENTFORMAT_INT2;
4300
4302 SDL_GPU_VERTEXELEMENTFORMAT_INT3;
4303
4305 SDL_GPU_VERTEXELEMENTFORMAT_INT4;
4306
4308 SDL_GPU_VERTEXELEMENTFORMAT_UINT;
4309
4311 SDL_GPU_VERTEXELEMENTFORMAT_UINT2;
4312
4314 SDL_GPU_VERTEXELEMENTFORMAT_UINT3;
4315
4317 SDL_GPU_VERTEXELEMENTFORMAT_UINT4;
4318
4320 SDL_GPU_VERTEXELEMENTFORMAT_FLOAT;
4321
4323 SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2;
4324
4326 SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3;
4327
4329 SDL_GPU_VERTEXELEMENTFORMAT_FLOAT4;
4330
4332 SDL_GPU_VERTEXELEMENTFORMAT_BYTE2;
4333
4335 SDL_GPU_VERTEXELEMENTFORMAT_BYTE4;
4336
4338 SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2;
4339
4341 SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4;
4342
4344 SDL_GPU_VERTEXELEMENTFORMAT_BYTE2_NORM;
4345
4347 SDL_GPU_VERTEXELEMENTFORMAT_BYTE4_NORM;
4348
4350 SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM;
4351
4353 SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM;
4354
4356 SDL_GPU_VERTEXELEMENTFORMAT_SHORT2;
4357
4359 SDL_GPU_VERTEXELEMENTFORMAT_SHORT4;
4360
4362 SDL_GPU_VERTEXELEMENTFORMAT_USHORT2;
4363
4365 SDL_GPU_VERTEXELEMENTFORMAT_USHORT4;
4366
4368 SDL_GPU_VERTEXELEMENTFORMAT_SHORT2_NORM;
4369
4371 SDL_GPU_VERTEXELEMENTFORMAT_SHORT4_NORM;
4372
4374 SDL_GPU_VERTEXELEMENTFORMAT_USHORT2_NORM;
4375
4377 SDL_GPU_VERTEXELEMENTFORMAT_USHORT4_NORM;
4378
4380 SDL_GPU_VERTEXELEMENTFORMAT_HALF2;
4381
4383 SDL_GPU_VERTEXELEMENTFORMAT_HALF4;
4384
4392using GPUVertexInputRate = SDL_GPUVertexInputRate;
4393
4396 SDL_GPU_VERTEXINPUTRATE_VERTEX;
4397
4400 SDL_GPU_VERTEXINPUTRATE_INSTANCE;
4401
4409using GPUFillMode = SDL_GPUFillMode;
4410
4412 SDL_GPU_FILLMODE_FILL;
4413
4415 SDL_GPU_FILLMODE_LINE;
4416
4424using GPUCullMode = SDL_GPUCullMode;
4425
4427 SDL_GPU_CULLMODE_NONE;
4428
4430 SDL_GPU_CULLMODE_FRONT;
4431
4433 SDL_GPU_CULLMODE_BACK;
4434
4443using GPUFrontFace = SDL_GPUFrontFace;
4444
4450 SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE;
4451
4453constexpr GPUFrontFace GPU_FRONTFACE_CLOCKWISE = SDL_GPU_FRONTFACE_CLOCKWISE;
4454
4462using GPUCompareOp = SDL_GPUCompareOp;
4463
4465 SDL_GPU_COMPAREOP_INVALID;
4466
4468 SDL_GPU_COMPAREOP_NEVER;
4469
4471 SDL_GPU_COMPAREOP_LESS;
4472
4474 SDL_GPU_COMPAREOP_EQUAL;
4475
4477 SDL_GPU_COMPAREOP_LESS_OR_EQUAL;
4479
4481 SDL_GPU_COMPAREOP_GREATER;
4482
4484 SDL_GPU_COMPAREOP_NOT_EQUAL;
4485
4487 SDL_GPU_COMPAREOP_GREATER_OR_EQUAL;
4489
4491 SDL_GPU_COMPAREOP_ALWAYS;
4492
4501using GPUStencilOp = SDL_GPUStencilOp;
4502
4504 SDL_GPU_STENCILOP_INVALID;
4505
4507 SDL_GPU_STENCILOP_KEEP;
4508
4510 SDL_GPU_STENCILOP_ZERO;
4511
4513 SDL_GPU_STENCILOP_REPLACE;
4514
4517 SDL_GPU_STENCILOP_INCREMENT_AND_CLAMP;
4518
4520 SDL_GPU_STENCILOP_DECREMENT_AND_CLAMP;
4522
4524 SDL_GPU_STENCILOP_INVERT;
4525
4527 SDL_GPU_STENCILOP_INCREMENT_AND_WRAP;
4529
4532 SDL_GPU_STENCILOP_DECREMENT_AND_WRAP;
4533
4545using GPUBlendOp = SDL_GPUBlendOp;
4546
4548 SDL_GPU_BLENDOP_INVALID;
4549
4551constexpr GPUBlendOp GPU_BLENDOP_ADD = SDL_GPU_BLENDOP_ADD;
4552
4554constexpr GPUBlendOp GPU_BLENDOP_SUBTRACT = SDL_GPU_BLENDOP_SUBTRACT;
4555
4558 SDL_GPU_BLENDOP_REVERSE_SUBTRACT;
4559
4561 SDL_GPU_BLENDOP_MIN;
4562
4564 SDL_GPU_BLENDOP_MAX;
4565
4577using GPUBlendFactor = SDL_GPUBlendFactor;
4578
4580 SDL_GPU_BLENDFACTOR_INVALID;
4581
4582constexpr GPUBlendFactor GPU_BLENDFACTOR_ZERO = SDL_GPU_BLENDFACTOR_ZERO;
4583
4584constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE = SDL_GPU_BLENDFACTOR_ONE;
4585
4587 SDL_GPU_BLENDFACTOR_SRC_COLOR;
4588
4590 SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR;
4591
4593 SDL_GPU_BLENDFACTOR_DST_COLOR;
4594
4596 SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR;
4597
4599 SDL_GPU_BLENDFACTOR_SRC_ALPHA;
4600
4602 SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA;
4603
4605 SDL_GPU_BLENDFACTOR_DST_ALPHA;
4606
4608 SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA;
4609
4611 SDL_GPU_BLENDFACTOR_CONSTANT_COLOR;
4612
4614 SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR;
4615
4617 SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE;
4619
4628
4630 SDL_GPU_COLORCOMPONENT_R;
4631
4633 SDL_GPU_COLORCOMPONENT_G;
4634
4636 SDL_GPU_COLORCOMPONENT_B;
4637
4639 SDL_GPU_COLORCOMPONENT_A;
4640
4648using GPUFilter = SDL_GPUFilter;
4649
4651 SDL_GPU_FILTER_NEAREST;
4652
4654 SDL_GPU_FILTER_LINEAR;
4655
4663using GPUSamplerMipmapMode = SDL_GPUSamplerMipmapMode;
4664
4666 SDL_GPU_SAMPLERMIPMAPMODE_NEAREST;
4667
4669 SDL_GPU_SAMPLERMIPMAPMODE_LINEAR;
4670
4679using GPUSamplerAddressMode = SDL_GPUSamplerAddressMode;
4680
4682 SDL_GPU_SAMPLERADDRESSMODE_REPEAT;
4684
4687 SDL_GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT;
4688
4691 SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE;
4692
4700using GPUBlitRegion = SDL_GPUBlitRegion;
4701
4716using GPUIndirectDrawCommand = SDL_GPUIndirectDrawCommand;
4717
4732using GPUIndexedIndirectDrawCommand = SDL_GPUIndexedIndirectDrawCommand;
4733
4741using GPUIndirectDispatchCommand = SDL_GPUIndirectDispatchCommand;
4742
4761using GPUVertexBufferDescription = SDL_GPUVertexBufferDescription;
4762
4775using GPUVertexAttribute = SDL_GPUVertexAttribute;
4776
4787using GPUVertexInputState = SDL_GPUVertexInputState;
4788
4796using GPUStencilOpState = SDL_GPUStencilOpState;
4797
4808using GPUColorTargetBlendState = SDL_GPUColorTargetBlendState;
4809
4826using GPURasterizerState = SDL_GPURasterizerState;
4827
4836using GPUMultisampleState = SDL_GPUMultisampleState;
4837
4846using GPUDepthStencilState = SDL_GPUDepthStencilState;
4847
4856using GPUColorTargetDescription = SDL_GPUColorTargetDescription;
4857
4868using GPUGraphicsPipelineTargetInfo = SDL_GPUGraphicsPipelineTargetInfo;
4869
4884 StringParam name)
4885{
4886 return SDL_GPUSupportsShaderFormats(format_flags, name);
4887}
4888
4900{
4901 return SDL_GPUSupportsProperties(props);
4902}
4903
4931 bool debug_mode,
4932 StringParam name)
4933{
4934 return GPUDevice(format_flags, debug_mode, name);
4935}
4936
4938 bool debug_mode,
4939 StringParam name)
4940 : GPUDevice(CheckError(SDL_CreateGPUDevice(format_flags, debug_mode, name)))
4941{
4942}
4943
4945 : GPUDevice(CheckError(SDL_CreateGPUDeviceWithProperties(props)))
4946{
4947}
4948
5059{
5060 return GPUDevice(props);
5061}
5062
5071
5072constexpr auto DEBUGMODE_BOOLEAN =
5073 SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN;
5074
5076 SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN;
5077
5078#if SDL_VERSION_ATLEAST(3, 4, 0)
5079
5080constexpr auto VERBOSE_BOOLEAN =
5081 SDL_PROP_GPU_DEVICE_CREATE_VERBOSE_BOOLEAN;
5082
5083#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5084
5085constexpr auto NAME_STRING =
5086 SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING;
5087
5088#if SDL_VERSION_ATLEAST(3, 4, 0)
5089
5091 SDL_PROP_GPU_DEVICE_CREATE_FEATURE_CLIP_DISTANCE_BOOLEAN;
5093
5095 SDL_PROP_GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN;
5098
5100 SDL_PROP_GPU_DEVICE_CREATE_FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN;
5101
5103 SDL_PROP_GPU_DEVICE_CREATE_FEATURE_ANISOTROPY_BOOLEAN;
5105
5106#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5107
5109 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN;
5111
5113 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOLEAN;
5114
5115constexpr auto SHADERS_DXBC_BOOLEAN =
5116 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOLEAN;
5117
5118constexpr auto SHADERS_DXIL_BOOLEAN =
5119 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN;
5120
5121constexpr auto SHADERS_MSL_BOOLEAN =
5122 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN;
5123
5125 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN;
5127
5128#if SDL_VERSION_ATLEAST(3, 4, 0)
5129
5131 SDL_PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN;
5137
5138#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5139
5141 SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING;
5143
5144#if SDL_VERSION_ATLEAST(3, 4, 2)
5145
5147 SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_VERSION_NUMBER;
5151
5153 SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_PATH_STRING;
5156
5157#endif // SDL_VERSION_ATLEAST(3, 4, 2)
5158
5159#if SDL_VERSION_ATLEAST(3, 4, 0)
5160
5162 SDL_PROP_GPU_DEVICE_CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN;
5163
5165 SDL_PROP_GPU_DEVICE_CREATE_VULKAN_OPTIONS_POINTER;
5167
5168#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5169
5170#if SDL_VERSION_ATLEAST(3, 4, 2)
5171
5173 SDL_PROP_GPU_DEVICE_CREATE_METAL_ALLOW_MACFAMILY1_BOOLEAN;
5176
5177#endif // SDL_VERSION_ATLEAST(3, 4, 2)
5178
5179} // namespace prop::GPUDevice::Create
5180
5181#if SDL_VERSION_ATLEAST(3, 4, 0)
5182
5199using GPUVulkanOptions = SDL_GPUVulkanOptions;
5200
5201#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5202
5213{
5214 SDL_DestroyGPUDevice(device);
5215}
5216
5218
5228inline int GetNumGPUDrivers() { return SDL_GetNumGPUDrivers(); }
5229
5247inline const char* GetGPUDriver(int index) { return SDL_GetGPUDriver(index); }
5248
5257inline const char* GetGPUDeviceDriver(GPUDeviceRef device)
5258{
5259 return SDL_GetGPUDeviceDriver(device);
5260}
5261
5262inline const char* GPUDeviceBase::GetDriver()
5263{
5264 return SDL::GetGPUDeviceDriver(get());
5265}
5266
5277{
5278 return SDL_GetGPUShaderFormats(device);
5279}
5280
5285
5286#if SDL_VERSION_ATLEAST(3, 4, 0)
5287
5390{
5391 return CheckError(SDL_GetGPUDeviceProperties(device));
5392}
5393
5398
5411namespace prop::GPUDevice {
5412
5413constexpr auto NAME_STRING =
5414 SDL_PROP_GPU_DEVICE_NAME_STRING;
5415
5416constexpr auto DRIVER_NAME_STRING =
5417 SDL_PROP_GPU_DEVICE_DRIVER_NAME_STRING;
5418
5420 SDL_PROP_GPU_DEVICE_DRIVER_VERSION_STRING;
5421
5422constexpr auto DRIVER_INFO_STRING =
5423 SDL_PROP_GPU_DEVICE_DRIVER_INFO_STRING;
5424
5425} // namespace prop::GPUDevice
5426
5427#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5428
5475 GPUDeviceRef device,
5476 const GPUComputePipelineCreateInfo& createinfo)
5477{
5478 return GPUComputePipeline(device, createinfo);
5479}
5480
5482 const GPUComputePipelineCreateInfo& createinfo)
5483{
5484 return GPUComputePipeline(get(), createinfo);
5485}
5486
5488 GPUDeviceRef device,
5489 const GPUComputePipelineCreateInfo& createinfo)
5490 : m_gPUComputePipeline(
5491 CheckError(SDL_CreateGPUComputePipeline(device, &createinfo)))
5492{
5493}
5494
5501
5502constexpr auto NAME_STRING =
5503 SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING;
5504
5505} // namespace prop::GPUComputePipeline::Create
5506
5529 GPUDeviceRef device,
5530 const GPUGraphicsPipelineCreateInfo& createinfo)
5531{
5532 return GPUGraphicsPipeline(device, createinfo);
5533}
5534
5536 const GPUGraphicsPipelineCreateInfo& createinfo)
5537{
5538 return GPUGraphicsPipeline(get(), createinfo);
5539}
5540
5542 GPUDeviceRef device,
5543 const GPUGraphicsPipelineCreateInfo& createinfo)
5544 : m_gPUGraphicsPipeline(
5545 CheckError(SDL_CreateGPUGraphicsPipeline(device, &createinfo)))
5546{
5547}
5548
5555
5556constexpr auto NAME_STRING =
5557 SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING;
5558
5559} // namespace prop::GPUGraphicsPipeline::Create
5560
5583 const GPUSamplerCreateInfo& createinfo)
5584{
5585 return GPUSampler(device, createinfo);
5586}
5587
5589 const GPUSamplerCreateInfo& createinfo)
5590{
5591 return GPUSampler(get(), createinfo);
5592}
5593
5595 const GPUSamplerCreateInfo& createinfo)
5596 : m_gPUSampler(CheckError(SDL_CreateGPUSampler(device, &createinfo)))
5597{
5598}
5599
5606
5607constexpr auto NAME_STRING =
5608 SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING;
5609
5610} // namespace prop::GPUSampler::Create
5611
5684 const GPUShaderCreateInfo& createinfo)
5685{
5686 return GPUShader(device, createinfo);
5687}
5688
5690 const GPUShaderCreateInfo& createinfo)
5691{
5692 return GPUShader(get(), createinfo);
5693}
5694
5696 const GPUShaderCreateInfo& createinfo)
5697 : m_gPUShader(CheckError(SDL_CreateGPUShader(device, &createinfo)))
5698{
5699}
5700
5707
5708constexpr auto NAME_STRING =
5709 SDL_PROP_GPU_SHADER_CREATE_NAME_STRING;
5710
5711} // namespace prop::GPUShader::Create
5712
5772 const GPUTextureCreateInfo& createinfo)
5773{
5774 return GPUTexture(device, createinfo);
5775}
5776
5778 const GPUTextureCreateInfo& createinfo)
5779{
5780 return GPUTexture(get(), createinfo);
5781}
5782
5784 const GPUTextureCreateInfo& createinfo)
5785 : m_gPUTexture(CheckError(SDL_CreateGPUTexture(device, &createinfo)))
5786{
5787}
5788
5795
5796constexpr auto D3D12_CLEAR_R_FLOAT =
5797 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT;
5798
5799constexpr auto D3D12_CLEAR_G_FLOAT =
5800 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT;
5801
5802constexpr auto D3D12_CLEAR_B_FLOAT =
5803 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT;
5804
5805constexpr auto D3D12_CLEAR_A_FLOAT =
5806 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT;
5807
5809 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT;
5811
5812#if SDL_VERSION_ATLEAST(3, 2, 12)
5813
5815 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_NUMBER;
5817
5818#endif // SDL_VERSION_ATLEAST(3, 2, 12)
5819
5820constexpr auto NAME_STRING =
5821 SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING;
5822
5823} // namespace prop::GPUTexture::Create
5824
5869 const GPUBufferCreateInfo& createinfo)
5870{
5871 return GPUBuffer(device, createinfo);
5872}
5873
5875 const GPUBufferCreateInfo& createinfo)
5876{
5877 return GPUBuffer(get(), createinfo);
5878}
5879
5881 const GPUBufferCreateInfo& createinfo)
5882 : m_gPUBuffer(CheckError(SDL_CreateGPUBuffer(device, &createinfo)))
5883{
5884}
5885
5892
5893constexpr auto NAME_STRING =
5894 SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING;
5895
5896} // namespace prop::GPUBuffer::Create
5897
5926 GPUDeviceRef device,
5927 const GPUTransferBufferCreateInfo& createinfo)
5928{
5929 return GPUTransferBuffer(device, createinfo);
5930}
5931
5933 const GPUTransferBufferCreateInfo& createinfo)
5934{
5935 return GPUTransferBuffer(get(), createinfo);
5936}
5937
5939 GPUDeviceRef device,
5940 const GPUTransferBufferCreateInfo& createinfo)
5941 : m_gPUTransferBuffer(
5942 CheckError(SDL_CreateGPUTransferBuffer(device, &createinfo)))
5943{
5944}
5945
5952
5953constexpr auto NAME_STRING =
5954 SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING;
5955
5956} // namespace prop::GPUTransferBuffer::Create
5957
5976 GPUBuffer buffer,
5977 StringParam text)
5978{
5979 SDL_SetGPUBufferName(device, buffer, text);
5980}
5981
5983{
5984 SDL::SetGPUBufferName(get(), buffer, text);
5985}
5986
6005 GPUTexture texture,
6006 StringParam text)
6007{
6008 SDL_SetGPUTextureName(device, texture, text);
6009}
6010
6012{
6013 SDL::SetGPUTextureName(get(), texture, text);
6014}
6015
6031inline void InsertGPUDebugLabel(GPUCommandBuffer command_buffer,
6032 StringParam text)
6033{
6034 SDL_InsertGPUDebugLabel(command_buffer, text);
6035}
6036
6038{
6039 SDL::InsertGPUDebugLabel(m_gPUCommandBuffer, text);
6040}
6041
6068inline void PushGPUDebugGroup(GPUCommandBuffer command_buffer, StringParam name)
6069{
6070 SDL_PushGPUDebugGroup(command_buffer, name);
6071}
6072
6074{
6075 SDL::PushGPUDebugGroup(m_gPUCommandBuffer, name);
6076}
6077
6092inline void PopGPUDebugGroup(GPUCommandBuffer command_buffer)
6093{
6094 SDL_PopGPUDebugGroup(command_buffer);
6095}
6096
6098{
6099 SDL::PopGPUDebugGroup(m_gPUCommandBuffer);
6100}
6101
6112inline void ReleaseGPUTexture(GPUDeviceRef device, GPUTexture texture)
6113{
6114 SDL_ReleaseGPUTexture(device, texture);
6115}
6116
6118{
6119 SDL::ReleaseGPUTexture(get(), texture);
6120}
6121
6132inline void ReleaseGPUSampler(GPUDeviceRef device, GPUSampler sampler)
6133{
6134 SDL_ReleaseGPUSampler(device, sampler);
6135}
6136
6138{
6139 SDL::ReleaseGPUSampler(get(), sampler);
6140}
6141
6152inline void ReleaseGPUBuffer(GPUDeviceRef device, GPUBuffer buffer)
6153{
6154 SDL_ReleaseGPUBuffer(device, buffer);
6155}
6156
6158{
6159 SDL::ReleaseGPUBuffer(get(), buffer);
6160}
6161
6173 GPUTransferBuffer transfer_buffer)
6174{
6175 SDL_ReleaseGPUTransferBuffer(device, transfer_buffer);
6176}
6177
6179 GPUTransferBuffer transfer_buffer)
6180{
6181 SDL::ReleaseGPUTransferBuffer(get(), transfer_buffer);
6182}
6183
6195 GPUComputePipeline compute_pipeline)
6196{
6197 SDL_ReleaseGPUComputePipeline(device, compute_pipeline);
6198}
6199
6201 GPUComputePipeline compute_pipeline)
6202{
6203 SDL::ReleaseGPUComputePipeline(get(), compute_pipeline);
6204}
6205
6216inline void ReleaseGPUShader(GPUDeviceRef device, GPUShader shader)
6217{
6218 SDL_ReleaseGPUShader(device, shader);
6219}
6220
6222{
6223 SDL::ReleaseGPUShader(get(), shader);
6224}
6225
6237 GPUGraphicsPipeline graphics_pipeline)
6238{
6239 SDL_ReleaseGPUGraphicsPipeline(device, graphics_pipeline);
6240}
6241
6243 GPUGraphicsPipeline graphics_pipeline)
6244{
6245 SDL::ReleaseGPUGraphicsPipeline(get(), graphics_pipeline);
6246}
6247
6273{
6274 return CheckError(SDL_AcquireGPUCommandBuffer(device));
6275}
6276
6281
6301 Uint32 slot_index,
6302 SourceBytes data)
6303{
6304 SDL_PushGPUVertexUniformData(
6305 command_buffer, slot_index, data.data(), narrowU32(data.size_bytes()));
6306}
6307
6309 SourceBytes data)
6310{
6312 m_gPUCommandBuffer, slot_index, std::move(data));
6313}
6314
6331 Uint32 slot_index,
6332 SourceBytes data)
6333{
6334 SDL_PushGPUFragmentUniformData(
6335 command_buffer, slot_index, data.data(), narrowU32(data.size_bytes()));
6336}
6337
6339 SourceBytes data)
6340{
6342 m_gPUCommandBuffer, slot_index, std::move(data));
6343}
6344
6361 Uint32 slot_index,
6362 SourceBytes data)
6363{
6364 SDL_PushGPUComputeUniformData(
6365 command_buffer, slot_index, data.data(), narrowU32(data.size_bytes()));
6366}
6367
6369 SourceBytes data)
6370{
6372 m_gPUCommandBuffer, slot_index, std::move(data));
6373}
6374
6407 GPUCommandBuffer command_buffer,
6408 std::span<const GPUColorTargetInfo> color_target_infos,
6409 OptionalRef<const GPUDepthStencilTargetInfo> depth_stencil_target_info)
6410{
6411 return SDL_BeginGPURenderPass(command_buffer,
6412 color_target_infos.data(),
6413 narrowU32(color_target_infos.size()),
6414 depth_stencil_target_info);
6415}
6416
6418 std::span<const GPUColorTargetInfo> color_target_infos,
6419 OptionalRef<const GPUDepthStencilTargetInfo> depth_stencil_target_info)
6420{
6422 m_gPUCommandBuffer, color_target_infos, depth_stencil_target_info);
6423}
6424
6436 GPUGraphicsPipeline graphics_pipeline)
6437{
6438 SDL_BindGPUGraphicsPipeline(render_pass, graphics_pipeline);
6439}
6440
6442{
6443 SDL::BindGPUGraphicsPipeline(m_gPURenderPass, graphics_pipeline);
6444}
6445
6454inline void SetGPUViewport(GPURenderPass render_pass,
6455 const GPUViewport& viewport)
6456{
6457 SDL_SetGPUViewport(render_pass, &viewport);
6458}
6459
6460inline void GPURenderPass::SetViewport(const GPUViewport& viewport)
6461{
6462 SDL::SetGPUViewport(m_gPURenderPass, viewport);
6463}
6464
6473inline void SetGPUScissor(GPURenderPass render_pass, const RectRaw& scissor)
6474{
6475 SDL_SetGPUScissor(render_pass, &scissor);
6476}
6477
6478inline void GPURenderPass::SetScissor(const RectRaw& scissor)
6479{
6480 SDL::SetGPUScissor(m_gPURenderPass, scissor);
6481}
6482
6494inline void SetGPUBlendConstants(GPURenderPass render_pass,
6495 FColorRaw blend_constants)
6496{
6497 SDL_SetGPUBlendConstants(render_pass, blend_constants);
6498}
6499
6501{
6502 SDL::SetGPUBlendConstants(m_gPURenderPass, blend_constants);
6503}
6504
6513inline void SetGPUStencilReference(GPURenderPass render_pass, Uint8 reference)
6514{
6515 SDL_SetGPUStencilReference(render_pass, reference);
6516}
6517
6519{
6520 SDL::SetGPUStencilReference(m_gPURenderPass, reference);
6521}
6522
6533inline void BindGPUVertexBuffers(GPURenderPass render_pass,
6534 Uint32 first_slot,
6535 std::span<const GPUBufferBinding> bindings)
6536{
6537 SDL_BindGPUVertexBuffers(
6538 render_pass, first_slot, bindings.data(), narrowU32(bindings.size()));
6539}
6540
6542 Uint32 first_slot,
6543 std::span<const GPUBufferBinding> bindings)
6544{
6545 SDL::BindGPUVertexBuffers(m_gPURenderPass, first_slot, bindings);
6546}
6547
6558inline void BindGPUIndexBuffer(GPURenderPass render_pass,
6559 const GPUBufferBinding& binding,
6560 GPUIndexElementSize index_element_size)
6561{
6562 SDL_BindGPUIndexBuffer(render_pass, &binding, index_element_size);
6563}
6564
6566 const GPUBufferBinding& binding,
6567 GPUIndexElementSize index_element_size)
6568{
6569 SDL::BindGPUIndexBuffer(m_gPURenderPass, binding, index_element_size);
6570}
6571
6589 GPURenderPass render_pass,
6590 Uint32 first_slot,
6591 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
6592{
6593 SDL_BindGPUVertexSamplers(render_pass,
6594 first_slot,
6595 texture_sampler_bindings.data(),
6596 narrowU32(texture_sampler_bindings.size()));
6597}
6598
6600 Uint32 first_slot,
6601 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
6602{
6604 m_gPURenderPass, first_slot, texture_sampler_bindings);
6605}
6606
6625 GPURenderPass render_pass,
6626 Uint32 first_slot,
6627 SpanRef<const GPUTextureRaw> storage_textures)
6628{
6629 SDL_BindGPUVertexStorageTextures(render_pass,
6630 first_slot,
6631 storage_textures.data(),
6632 narrowU32(storage_textures.size()));
6633}
6634
6636 Uint32 first_slot,
6637 SpanRef<const GPUTextureRaw> storage_textures)
6638{
6640 m_gPURenderPass, first_slot, storage_textures);
6641}
6642
6661 GPURenderPass render_pass,
6662 Uint32 first_slot,
6663 SpanRef<const GPUBufferRaw> storage_buffers)
6664{
6665 SDL_BindGPUVertexStorageBuffers(render_pass,
6666 first_slot,
6667 storage_buffers.data(),
6668 narrowU32(storage_buffers.size()));
6669}
6670
6672 Uint32 first_slot,
6673 SpanRef<const GPUBufferRaw> storage_buffers)
6674{
6676 m_gPURenderPass, first_slot, storage_buffers);
6677}
6678
6696 GPURenderPass render_pass,
6697 Uint32 first_slot,
6698 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
6699{
6700 SDL_BindGPUFragmentSamplers(render_pass,
6701 first_slot,
6702 texture_sampler_bindings.data(),
6703 narrowU32(texture_sampler_bindings.size()));
6704}
6705
6707 Uint32 first_slot,
6708 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
6709{
6711 m_gPURenderPass, first_slot, texture_sampler_bindings);
6712}
6713
6732 GPURenderPass render_pass,
6733 Uint32 first_slot,
6734 SpanRef<const GPUTextureRaw> storage_textures)
6735{
6736 SDL_BindGPUFragmentStorageTextures(render_pass,
6737 first_slot,
6738 storage_textures.data(),
6739 narrowU32(storage_textures.size()));
6740}
6741
6743 Uint32 first_slot,
6744 SpanRef<const GPUTextureRaw> storage_textures)
6745{
6747 m_gPURenderPass, first_slot, storage_textures);
6748}
6749
6768 GPURenderPass render_pass,
6769 Uint32 first_slot,
6770 SpanRef<const GPUBufferRaw> storage_buffers)
6771{
6772 SDL_BindGPUFragmentStorageBuffers(render_pass,
6773 first_slot,
6774 storage_buffers.data(),
6775 narrowU32(storage_buffers.size()));
6776}
6777
6779 Uint32 first_slot,
6780 SpanRef<const GPUBufferRaw> storage_buffers)
6781{
6783 m_gPURenderPass, first_slot, storage_buffers);
6784}
6785
6810 Uint32 num_indices,
6811 Uint32 num_instances,
6812 Uint32 first_index,
6813 Sint32 vertex_offset,
6814 Uint32 first_instance)
6815{
6816 SDL_DrawGPUIndexedPrimitives(render_pass,
6817 num_indices,
6818 num_instances,
6819 first_index,
6820 vertex_offset,
6821 first_instance);
6822}
6823
6825 Uint32 num_instances,
6826 Uint32 first_index,
6827 Sint32 vertex_offset,
6828 Uint32 first_instance)
6829{
6830 SDL::DrawGPUIndexedPrimitives(m_gPURenderPass,
6831 num_indices,
6832 num_instances,
6833 first_index,
6834 vertex_offset,
6835 first_instance);
6836}
6837
6858inline void DrawGPUPrimitives(GPURenderPass render_pass,
6859 Uint32 num_vertices,
6860 Uint32 num_instances,
6861 Uint32 first_vertex,
6862 Uint32 first_instance)
6863{
6864 SDL_DrawGPUPrimitives(
6865 render_pass, num_vertices, num_instances, first_vertex, first_instance);
6866}
6867
6868inline void GPURenderPass::DrawPrimitives(Uint32 num_vertices,
6869 Uint32 num_instances,
6870 Uint32 first_vertex,
6871 Uint32 first_instance)
6872{
6874 m_gPURenderPass, num_vertices, num_instances, first_vertex, first_instance);
6875}
6876
6894 GPUBuffer buffer,
6895 Uint32 offset,
6896 Uint32 draw_count)
6897{
6898 SDL_DrawGPUPrimitivesIndirect(render_pass, buffer, offset, draw_count);
6899}
6900
6902 Uint32 offset,
6903 Uint32 draw_count)
6904{
6905 SDL::DrawGPUPrimitivesIndirect(m_gPURenderPass, buffer, offset, draw_count);
6906}
6907
6925 GPUBuffer buffer,
6926 Uint32 offset,
6927 Uint32 draw_count)
6928{
6929 SDL_DrawGPUIndexedPrimitivesIndirect(render_pass, buffer, offset, draw_count);
6930}
6931
6933 Uint32 offset,
6934 Uint32 draw_count)
6935{
6937 m_gPURenderPass, buffer, offset, draw_count);
6938}
6939
6950inline void EndGPURenderPass(GPURenderPass render_pass)
6951{
6952 SDL_EndGPURenderPass(render_pass);
6953}
6954
6955inline void GPURenderPass::End() { SDL::EndGPURenderPass(m_gPURenderPass); }
6956
6991 GPUCommandBuffer command_buffer,
6992 std::span<const GPUStorageTextureReadWriteBinding> storage_texture_bindings,
6993 std::span<const GPUStorageBufferReadWriteBinding> storage_buffer_bindings)
6994{
6995 return SDL_BeginGPUComputePass(command_buffer,
6996 storage_texture_bindings.data(),
6997 narrowU32(storage_texture_bindings.size()),
6998 storage_buffer_bindings.data(),
6999 narrowU32(storage_buffer_bindings.size()));
7000}
7001
7003 std::span<const GPUStorageTextureReadWriteBinding> storage_texture_bindings,
7004 std::span<const GPUStorageBufferReadWriteBinding> storage_buffer_bindings)
7005{
7007 m_gPUCommandBuffer, storage_texture_bindings, storage_buffer_bindings);
7008}
7009
7019 GPUComputePipeline compute_pipeline)
7020{
7021 SDL_BindGPUComputePipeline(compute_pass, compute_pipeline);
7022}
7023
7025{
7026 SDL::BindGPUComputePipeline(m_gPUComputePass, compute_pipeline);
7027}
7028
7046 GPUComputePass compute_pass,
7047 Uint32 first_slot,
7048 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
7049{
7050 SDL_BindGPUComputeSamplers(compute_pass,
7051 first_slot,
7052 texture_sampler_bindings.data(),
7053 narrowU32(texture_sampler_bindings.size()));
7054}
7055
7057 Uint32 first_slot,
7058 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
7059{
7061 m_gPUComputePass, first_slot, texture_sampler_bindings);
7062}
7063
7082 GPUComputePass compute_pass,
7083 Uint32 first_slot,
7084 SpanRef<const GPUTextureRaw> storage_textures)
7085{
7086 SDL_BindGPUComputeStorageTextures(compute_pass,
7087 first_slot,
7088 storage_textures.data(),
7089 narrowU32(storage_textures.size()));
7090}
7091
7093 Uint32 first_slot,
7094 SpanRef<const GPUTextureRaw> storage_textures)
7095{
7097 m_gPUComputePass, first_slot, storage_textures);
7098}
7099
7118 GPUComputePass compute_pass,
7119 Uint32 first_slot,
7120 SpanRef<const GPUBufferRaw> storage_buffers)
7121{
7122 SDL_BindGPUComputeStorageBuffers(compute_pass,
7123 first_slot,
7124 storage_buffers.data(),
7125 narrowU32(storage_buffers.size()));
7126}
7127
7129 Uint32 first_slot,
7130 SpanRef<const GPUBufferRaw> storage_buffers)
7131{
7133 m_gPUComputePass, first_slot, storage_buffers);
7134}
7135
7156inline void DispatchGPUCompute(GPUComputePass compute_pass,
7157 Uint32 groupcount_x,
7158 Uint32 groupcount_y,
7159 Uint32 groupcount_z)
7160{
7161 SDL_DispatchGPUCompute(
7162 compute_pass, groupcount_x, groupcount_y, groupcount_z);
7163}
7164
7165inline void GPUComputePass::Dispatch(Uint32 groupcount_x,
7166 Uint32 groupcount_y,
7167 Uint32 groupcount_z)
7168{
7170 m_gPUComputePass, groupcount_x, groupcount_y, groupcount_z);
7171}
7172
7191 GPUBuffer buffer,
7192 Uint32 offset)
7193{
7194 SDL_DispatchGPUComputeIndirect(compute_pass, buffer, offset);
7195}
7196
7198{
7199 SDL::DispatchGPUComputeIndirect(m_gPUComputePass, buffer, offset);
7200}
7201
7212inline void EndGPUComputePass(GPUComputePass compute_pass)
7213{
7214 SDL_EndGPUComputePass(compute_pass);
7215}
7216
7217inline void GPUComputePass::End() { SDL::EndGPUComputePass(m_gPUComputePass); }
7218
7235 GPUTransferBuffer transfer_buffer,
7236 bool cycle)
7237{
7238 return CheckError(SDL_MapGPUTransferBuffer(device, transfer_buffer, cycle));
7239}
7240
7242 bool cycle)
7243{
7244 return SDL::MapGPUTransferBuffer(get(), transfer_buffer, cycle);
7245}
7246
7256 GPUTransferBuffer transfer_buffer)
7257{
7258 SDL_UnmapGPUTransferBuffer(device, transfer_buffer);
7259}
7260
7262 GPUTransferBuffer transfer_buffer)
7263{
7264 SDL::UnmapGPUTransferBuffer(get(), transfer_buffer);
7265}
7266
7282{
7283 return SDL_BeginGPUCopyPass(command_buffer);
7284}
7285
7287{
7288 return SDL::BeginGPUCopyPass(m_gPUCommandBuffer);
7289}
7290
7308inline void UploadToGPUTexture(GPUCopyPass copy_pass,
7309 const GPUTextureTransferInfo& source,
7310 const GPUTextureRegion& destination,
7311 bool cycle)
7312{
7313 SDL_UploadToGPUTexture(copy_pass, &source, &destination, cycle);
7314}
7315
7317 const GPUTextureRegion& destination,
7318 bool cycle)
7319{
7320 SDL::UploadToGPUTexture(m_gPUCopyPass, source, destination, cycle);
7321}
7322
7337inline void UploadToGPUBuffer(GPUCopyPass copy_pass,
7338 const GPUTransferBufferLocation& source,
7339 const GPUBufferRegion& destination,
7340 bool cycle)
7341{
7342 SDL_UploadToGPUBuffer(copy_pass, &source, &destination, cycle);
7343}
7344
7346 const GPUBufferRegion& destination,
7347 bool cycle)
7348{
7349 SDL::UploadToGPUBuffer(m_gPUCopyPass, source, destination, cycle);
7350}
7351
7373 const GPUTextureLocation& source,
7374 const GPUTextureLocation& destination,
7375 Uint32 w,
7376 Uint32 h,
7377 Uint32 d,
7378 bool cycle)
7379{
7380 SDL_CopyGPUTextureToTexture(copy_pass, &source, &destination, w, h, d, cycle);
7381}
7382
7384 const GPUTextureLocation& source,
7385 const GPUTextureLocation& destination,
7386 Uint32 w,
7387 Uint32 h,
7388 Uint32 d,
7389 bool cycle)
7390{
7392 m_gPUCopyPass, source, destination, w, h, d, cycle);
7393}
7394
7411 const GPUBufferLocation& source,
7412 const GPUBufferLocation& destination,
7413 Uint32 size,
7414 bool cycle)
7415{
7416 SDL_CopyGPUBufferToBuffer(copy_pass, &source, &destination, size, cycle);
7417}
7418
7420 const GPUBufferLocation& source,
7421 const GPUBufferLocation& destination,
7422 Uint32 size,
7423 bool cycle)
7424{
7425 SDL::CopyGPUBufferToBuffer(m_gPUCopyPass, source, destination, size, cycle);
7426}
7427
7442 const GPUTextureRegion& source,
7443 const GPUTextureTransferInfo& destination)
7444{
7445 SDL_DownloadFromGPUTexture(copy_pass, &source, &destination);
7446}
7447
7449 const GPUTextureRegion& source,
7450 const GPUTextureTransferInfo& destination)
7451{
7452 SDL::DownloadFromGPUTexture(m_gPUCopyPass, source, destination);
7453}
7454
7468 const GPUBufferRegion& source,
7469 const GPUTransferBufferLocation& destination)
7470{
7471 SDL_DownloadFromGPUBuffer(copy_pass, &source, &destination);
7472}
7473
7475 const GPUBufferRegion& source,
7476 const GPUTransferBufferLocation& destination)
7477{
7478 SDL::DownloadFromGPUBuffer(m_gPUCopyPass, source, destination);
7479}
7480
7488inline void EndGPUCopyPass(GPUCopyPass copy_pass)
7489{
7490 SDL_EndGPUCopyPass(copy_pass);
7491}
7492
7493inline void GPUCopyPass::End() { SDL::EndGPUCopyPass(m_gPUCopyPass); }
7494
7506 GPUTexture texture)
7507{
7508 SDL_GenerateMipmapsForGPUTexture(command_buffer, texture);
7509}
7510
7512{
7513 SDL::GenerateMipmapsForGPUTexture(m_gPUCommandBuffer, texture);
7514}
7515
7526inline void BlitGPUTexture(GPUCommandBuffer command_buffer,
7527 const GPUBlitInfo& info)
7528{
7529 SDL_BlitGPUTexture(command_buffer, &info);
7530}
7531
7533{
7534 SDL::BlitGPUTexture(m_gPUCommandBuffer, info);
7535}
7536
7552 GPUDeviceRef device,
7553 WindowRef window,
7554 GPUSwapchainComposition swapchain_composition)
7555{
7556 return SDL_WindowSupportsGPUSwapchainComposition(
7557 device, window, swapchain_composition);
7558}
7559
7561 WindowRef window,
7562 GPUSwapchainComposition swapchain_composition)
7563{
7565 get(), window, swapchain_composition);
7566}
7567
7583 WindowRef window,
7584 GPUPresentMode present_mode)
7585{
7586 return SDL_WindowSupportsGPUPresentMode(device, window, present_mode);
7587}
7588
7590 WindowRef window,
7591 GPUPresentMode present_mode)
7592{
7593 return SDL::WindowSupportsGPUPresentMode(get(), window, present_mode);
7594}
7595
7622{
7623 CheckError(SDL_ClaimWindowForGPUDevice(device, window));
7624}
7625
7627{
7629}
7630
7642{
7643 SDL_ReleaseWindowFromGPUDevice(device, window);
7644}
7645
7647{
7649}
7650
7674 GPUDeviceRef device,
7675 WindowRef window,
7676 GPUSwapchainComposition swapchain_composition,
7677 GPUPresentMode present_mode)
7678{
7679 return SDL_SetGPUSwapchainParameters(
7680 device, window, swapchain_composition, present_mode);
7681}
7682
7684 WindowRef window,
7685 GPUSwapchainComposition swapchain_composition,
7686 GPUPresentMode present_mode)
7687{
7689 get(), window, swapchain_composition, present_mode);
7690}
7691
7718 Uint32 allowed_frames_in_flight)
7719{
7720 return SDL_SetGPUAllowedFramesInFlight(device, allowed_frames_in_flight);
7721}
7722
7724 Uint32 allowed_frames_in_flight)
7725{
7726 return SDL::SetGPUAllowedFramesInFlight(get(), allowed_frames_in_flight);
7727}
7728
7741 WindowRef window)
7742{
7743 return SDL_GetGPUSwapchainTextureFormat(device, window);
7744}
7745
7751
7799 GPUCommandBuffer command_buffer,
7800 WindowRef window,
7801 Uint32* swapchain_texture_width = nullptr,
7802 Uint32* swapchain_texture_height = nullptr)
7803{
7804 GPUTextureRaw texture;
7805 CheckError(SDL_AcquireGPUSwapchainTexture(command_buffer,
7806 window,
7807 &texture,
7808 swapchain_texture_width,
7809 swapchain_texture_height));
7810 return texture;
7811}
7812
7814 WindowRef window,
7815 Uint32* swapchain_texture_width,
7816 Uint32* swapchain_texture_height)
7817{
7818 return SDL::AcquireGPUSwapchainTexture(m_gPUCommandBuffer,
7819 window,
7820 swapchain_texture_width,
7821 swapchain_texture_height);
7822}
7823
7840inline void WaitForGPUSwapchain(GPUDeviceRef device, WindowRef window)
7841{
7842 CheckError(SDL_WaitForGPUSwapchain(device, window));
7843}
7844
7846{
7847 SDL::WaitForGPUSwapchain(get(), window);
7848}
7849
7891 GPUCommandBuffer command_buffer,
7892 WindowRef window,
7893 Uint32* swapchain_texture_width = nullptr,
7894 Uint32* swapchain_texture_height = nullptr)
7895{
7896 GPUTextureRaw texture;
7897 CheckError(SDL_WaitAndAcquireGPUSwapchainTexture(command_buffer,
7898 window,
7899 &texture,
7900 swapchain_texture_width,
7901 swapchain_texture_height));
7902 return texture;
7903}
7904
7906 WindowRef window,
7907 Uint32* swapchain_texture_width,
7908 Uint32* swapchain_texture_height)
7909{
7910 return SDL::WaitAndAcquireGPUSwapchainTexture(m_gPUCommandBuffer,
7911 window,
7912 swapchain_texture_width,
7913 swapchain_texture_height);
7914}
7915
7936inline void SubmitGPUCommandBuffer(GPUCommandBuffer command_buffer)
7937{
7938 CheckError(SDL_SubmitGPUCommandBuffer(command_buffer));
7939}
7940
7942{
7943 SDL::SubmitGPUCommandBuffer(m_gPUCommandBuffer);
7944}
7945
7971 GPUCommandBuffer command_buffer)
7972{
7973 return CheckError(SDL_SubmitGPUCommandBufferAndAcquireFence(command_buffer));
7974}
7975
7980
8002inline void CancelGPUCommandBuffer(GPUCommandBuffer command_buffer)
8003{
8004 CheckError(SDL_CancelGPUCommandBuffer(command_buffer));
8005}
8006
8008{
8009 SDL::CancelGPUCommandBuffer(m_gPUCommandBuffer);
8010}
8011
8022inline void WaitForGPUIdle(GPUDeviceRef device)
8023{
8024 CheckError(SDL_WaitForGPUIdle(device));
8025}
8026
8028
8044 bool wait_all,
8045 std::span<GPUFence* const> fences)
8046{
8047 CheckError(SDL_WaitForGPUFences(
8048 device, wait_all, fences.data(), narrowU32(fences.size())));
8049}
8050
8051inline void GPUDeviceBase::WaitForFences(bool wait_all,
8052 std::span<GPUFence* const> fences)
8053{
8054 SDL::WaitForGPUFences(get(), wait_all, fences);
8055}
8056
8068inline bool QueryGPUFence(GPUDeviceRef device, GPUFence* fence)
8069{
8070 return SDL_QueryGPUFence(device, fence);
8071}
8072
8074{
8075 return SDL::QueryGPUFence(get(), fence);
8076}
8077
8090inline void ReleaseGPUFence(GPUDeviceRef device, GPUFence* fence)
8091{
8092 SDL_ReleaseGPUFence(device, fence);
8093}
8094
8096{
8097 SDL::ReleaseGPUFence(get(), fence);
8098}
8099
8111{
8112 return SDL_GPUTextureFormatTexelBlockSize(format);
8113}
8114
8127 GPUTextureFormat format,
8128 GPUTextureType type,
8130{
8131 return SDL_GPUTextureSupportsFormat(device, format, type, usage);
8132}
8133
8135 GPUTextureType type,
8137{
8138 return SDL::GPUTextureSupportsFormat(get(), format, type, usage);
8139}
8140
8152 GPUTextureFormat format,
8153 GPUSampleCount sample_count)
8154{
8155 return SDL_GPUTextureSupportsSampleCount(device, format, sample_count);
8156}
8157
8159 GPUTextureFormat format,
8160 GPUSampleCount sample_count)
8161{
8162 return SDL::GPUTextureSupportsSampleCount(get(), format, sample_count);
8163}
8164
8177 Uint32 width,
8178 Uint32 height,
8179 Uint32 depth_or_layer_count)
8180{
8181 return SDL_CalculateGPUTextureFormatSize(
8182 format, width, height, depth_or_layer_count);
8183}
8184
8185#if SDL_VERSION_ATLEAST(3, 4, 0)
8186
8197{
8198 return SDL_GetPixelFormatFromGPUTextureFormat(format);
8199}
8200
8211{
8212 return SDL_GetGPUTextureFormatFromPixelFormat(format);
8213}
8214
8215#endif // SDL_VERSION_ATLEAST(3, 4, 0)
8216
8217#ifdef SDL_PLATFORM_GDK
8218
8232inline void GDKSuspendGPU(GPUDeviceRef device) { SDL_GDKSuspendGPU(device); }
8233
8235
8249inline void GDKResumeGPU(GPUDeviceRef device) { SDL_GDKResumeGPU(device); }
8250
8252
8253#endif /* SDL_PLATFORM_GDK */
8254
8256
8257} // namespace SDL
8258
8259#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:246
constexpr size_t size_bytes() const
Retrieves contained size in bytes.
Definition SDL3pp_strings.h:310
constexpr const char * data() const
Retrieves contained data.
Definition SDL3pp_strings.h:313
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:58
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:5528
void ReleaseTexture(GPUTexture texture)
Frees the given texture as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6117
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UINT
GPU_VERTEXELEMENTFORMAT_UINT.
Definition SDL3pp_gpu.h:4307
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:7165
void PushComputeUniformData(Uint32 slot_index, SourceBytes data)
Pushes data to a uniform slot on the command buffer.
Definition SDL3pp_gpu.h:6368
void ReleaseComputePipeline(GPUComputePipeline compute_pipeline)
Frees the given compute pipeline as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6200
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:4411
SDL_GPUTransferBufferUsage GPUTransferBufferUsage
Specifies how a transfer buffer is intended to be used by the client.
Definition SDL3pp_gpu.h:4260
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:4476
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:5228
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:6330
bool SetAllowedFramesInFlight(Uint32 allowed_frames_in_flight)
Configures the maximum allowed number of frames in flight.
Definition SDL3pp_gpu.h:7723
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:5058
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:6731
SDL_GPUCompareOp GPUCompareOp
Specifies a comparison operator for depth, stencil and sampler operations.
Definition SDL3pp_gpu.h:4462
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:4509
void * MapTransferBuffer(GPUTransferBuffer transfer_buffer, bool cycle)
Maps a transfer buffer into application address space.
Definition SDL3pp_gpu.h:7241
constexpr GPUCompareOp GPU_COMPAREOP_ALWAYS
The comparison always evaluates true.
Definition SDL3pp_gpu.h:4490
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:4424
constexpr GPUBlendOp GPU_BLENDOP_MIN
min(source, destination)
Definition SDL3pp_gpu.h:4560
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:6924
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_FLOAT2
GPU_VERTEXELEMENTFORMAT_FLOAT2.
Definition SDL3pp_gpu.h:4322
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:7372
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:4373
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:6216
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:7526
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:7970
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:4523
PixelFormat GetPixelFormatFromGPUTextureFormat(GPUTextureFormat format)
Get the SDL pixel format corresponding to a GPU texture format.
Definition SDL3pp_gpu.h:8196
constexpr GPUFrontFace GPU_FRONTFACE_CLOCKWISE
A triangle with clockwise vertex winding will be considered front-facing.
Definition SDL3pp_gpu.h:4453
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:4275
GPUSampler CreateSampler(const GPUSamplerCreateInfo &createinfo)
Creates a sampler object to be used when binding textures in a graphics workflow.
Definition SDL3pp_gpu.h:5588
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_FLOAT3
GPU_VERTEXELEMENTFORMAT_FLOAT3.
Definition SDL3pp_gpu.h:4325
constexpr GPUCompareOp GPU_COMPAREOP_GREATER_OR_EQUAL
The comparison evaluates reference >= test.
Definition SDL3pp_gpu.h:4486
SDL_GPUVertexAttribute GPUVertexAttribute
A structure specifying a vertex attribute.
Definition SDL3pp_gpu.h:4775
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:6824
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UBYTE2
GPU_VERTEXELEMENTFORMAT_UBYTE2.
Definition SDL3pp_gpu.h:4337
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:6624
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:4376
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:6068
GPUBuffer CreateBuffer(const GPUBufferCreateInfo &createinfo)
Creates a buffer object to be used in graphics or compute workflows.
Definition SDL3pp_gpu.h:5874
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:4409
void SetGPUViewport(GPURenderPass render_pass, const GPUViewport &viewport)
Sets the current viewport state on a command buffer.
Definition SDL3pp_gpu.h:6454
constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR
1 - blend constant
Definition SDL3pp_gpu.h:4613
PropertiesRef GetProperties()
Get the properties associated with a GPU device.
Definition SDL3pp_gpu.h:5394
void SetScissor(const RectRaw &scissor)
Sets the current scissor state on a command buffer.
Definition SDL3pp_gpu.h:6478
constexpr GPUCompareOp GPU_COMPAREOP_NOT_EQUAL
The comparison evaluates reference != test.
Definition SDL3pp_gpu.h:4483
SDL_GPUGraphicsPipelineTargetInfo GPUGraphicsPipelineTargetInfo
A structure specifying the descriptions of render targets used in a graphics pipeline.
Definition SDL3pp_gpu.h:4868
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_USHORT2
GPU_VERTEXELEMENTFORMAT_USHORT2.
Definition SDL3pp_gpu.h:4361
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:8002
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:8068
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:6172
void * MapGPUTransferBuffer(GPUDeviceRef device, GPUTransferBuffer transfer_buffer, bool cycle)
Maps a transfer buffer into application address space.
Definition SDL3pp_gpu.h:7234
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_INT4
GPU_VERTEXELEMENTFORMAT_INT4.
Definition SDL3pp_gpu.h:4304
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:7890
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:5535
constexpr GPUSamplerAddressMode GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE
Specifies that the coordinates will clamp to the 0-1 range.
Definition SDL3pp_gpu.h:4690
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:7717
void ReleaseWindow(WindowRef window)
Unclaims a window, destroying its swapchain structure.
Definition SDL3pp_gpu.h:7646
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:6858
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:7056
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:7532
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:7448
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:6706
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:6558
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:5689
Uint32 GPUTextureFormatTexelBlockSize(GPUTextureFormat format)
Obtains the texel block size for a texture format.
Definition SDL3pp_gpu.h:8110
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:7128
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_SHORT2
GPU_VERTEXELEMENTFORMAT_SHORT2.
Definition SDL3pp_gpu.h:4355
bool WindowSupportsPresentMode(WindowRef window, GPUPresentMode present_mode)
Determines whether a presentation mode is supported by the window.
Definition SDL3pp_gpu.h:7589
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:4545
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:8007
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:7798
SDL_GPUColorTargetDescription GPUColorTargetDescription
A structure specifying the parameters of color targets used in a graphics pipeline.
Definition SDL3pp_gpu.h:4856
constexpr GPUColorComponentFlags GPU_COLORCOMPONENT_A
the alpha component
Definition SDL3pp_gpu.h:4638
constexpr GPUBufferUsageFlags GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE
Buffer supports storage writes in the compute stage.
Definition SDL3pp_gpu.h:4247
constexpr GPUSamplerMipmapMode GPU_SAMPLERMIPMAPMODE_LINEAR
Linear filtering.
Definition SDL3pp_gpu.h:4668
bool GPUTextureSupportsSampleCount(GPUDeviceRef device, GPUTextureFormat format, GPUSampleCount sample_count)
Determines if a sample count for a texture format is supported.
Definition SDL3pp_gpu.h:8151
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:6518
bool WindowSupportsGPUSwapchainComposition(GPUDeviceRef device, WindowRef window, GPUSwapchainComposition swapchain_composition)
Determines whether a swapchain composition is supported by the window.
Definition SDL3pp_gpu.h:7551
void ReleaseFence(GPUFence *fence)
Releases a fence obtained from SubmitGPUCommandBufferAndAcquireFence.
Definition SDL3pp_gpu.h:8095
GPUShaderFormat GetGPUShaderFormats(GPUDeviceRef device)
Returns the supported shader formats for this GPU context.
Definition SDL3pp_gpu.h:5276
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:5868
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:4295
GPUTextureFormat GetGPUTextureFormatFromPixelFormat(PixelFormat format)
Get the GPU texture format corresponding to an SDL pixel format.
Definition SDL3pp_gpu.h:8210
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:7813
constexpr GPUStencilOp GPU_STENCILOP_REPLACE
Sets the value to reference.
Definition SDL3pp_gpu.h:4512
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:6742
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:7345
constexpr GPUBlendFactor GPU_BLENDFACTOR_DST_COLOR
destination color
Definition SDL3pp_gpu.h:4592
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:6599
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:6901
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_FLOAT4
GPU_VERTEXELEMENTFORMAT_FLOAT4.
Definition SDL3pp_gpu.h:4328
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:8234
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:7286
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:6112
constexpr GPUBlendOp GPU_BLENDOP_INVALID
GPU_BLENDOP_INVALID.
Definition SDL3pp_gpu.h:4547
GPUTextureFormat GetSwapchainTextureFormat(WindowRef window)
Obtains the texture format of the swapchain for the given window.
Definition SDL3pp_gpu.h:7746
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:6406
void BindVertexStorageTextures(Uint32 first_slot, SpanRef< const GPUTextureRaw > storage_textures)
Binds storage textures for use on the vertex shader.
Definition SDL3pp_gpu.h:6635
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:6809
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:4229
GPUCommandBuffer AcquireGPUCommandBuffer(GPUDeviceRef device)
Acquire a command buffer.
Definition SDL3pp_gpu.h:6272
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:8126
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:6588
void WaitForGPUSwapchain(GPUDeviceRef device, WindowRef window)
Blocks the thread until a swapchain texture is available to be acquired.
Definition SDL3pp_gpu.h:7840
constexpr GPUBufferUsageFlags GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ
Buffer supports storage reads in graphics stages.
Definition SDL3pp_gpu.h:4238
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:4227
void DispatchIndirect(GPUBuffer buffer, Uint32 offset)
Dispatches compute work with parameters set from a buffer.
Definition SDL3pp_gpu.h:7197
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:4473
SDL_GPUIndexedIndirectDrawCommand GPUIndexedIndirectDrawCommand
A structure specifying the parameters of an indexed indirect draw command.
Definition SDL3pp_gpu.h:4732
void SetTextureName(GPUTexture texture, StringParam text)
Sets an arbitrary string constant to label a texture.
Definition SDL3pp_gpu.h:6011
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:6236
void SetViewport(const GPUViewport &viewport)
Sets the current viewport state on a command buffer.
Definition SDL3pp_gpu.h:6460
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_SHORT2_NORM
GPU_VERTEXELEMENTFORMAT_SHORT2_NORM.
Definition SDL3pp_gpu.h:4367
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_BYTE4
GPU_VERTEXELEMENTFORMAT_BYTE4.
Definition SDL3pp_gpu.h:4334
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:4589
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:8134
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:7941
void ReleaseWindowFromGPUDevice(GPUDeviceRef device, WindowRef window)
Unclaims a window, destroying its swapchain structure.
Definition SDL3pp_gpu.h:7641
constexpr GPUFilter GPU_FILTER_LINEAR
Linear filtering.
Definition SDL3pp_gpu.h:4653
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:7018
void ReleaseGPUSampler(GPUDeviceRef device, GPUSampler sampler)
Frees the given sampler as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6132
void BindFragmentStorageBuffers(Uint32 first_slot, SpanRef< const GPUBufferRaw > storage_buffers)
Binds storage buffers for use on the fragment shader.
Definition SDL3pp_gpu.h:6778
constexpr GPUBlendFactor GPU_BLENDFACTOR_CONSTANT_COLOR
blend constant
Definition SDL3pp_gpu.h:4610
constexpr GPUVertexInputRate GPU_VERTEXINPUTRATE_VERTEX
Attribute addressing is a function of the vertex index.
Definition SDL3pp_gpu.h:4395
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:7383
constexpr GPUTransferBufferUsage GPU_TRANSFERBUFFERUSAGE_UPLOAD
GPU_TRANSFERBUFFERUSAGE_UPLOAD.
Definition SDL3pp_gpu.h:4262
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:5582
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:4501
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:4681
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:4382
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UINT3
GPU_VERTEXELEMENTFORMAT_UINT3.
Definition SDL3pp_gpu.h:4313
constexpr GPUCubeMapFace GPU_CUBEMAPFACE_NEGATIVEX
GPU_CUBEMAPFACE_NEGATIVEX.
Definition SDL3pp_gpu.h:4192
void End()
Ends the current compute pass.
Definition SDL3pp_gpu.h:7217
SDL_GPUVertexInputState GPUVertexInputState
A structure specifying the parameters of a graphics pipeline vertex input state.
Definition SDL3pp_gpu.h:4787
constexpr GPUShaderStage GPU_SHADERSTAGE_VERTEX
GPU_SHADERSTAGE_VERTEX.
Definition SDL3pp_gpu.h:4277
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:6513
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:6767
constexpr GPUCompareOp GPU_COMPAREOP_LESS
The comparison evaluates reference < test.
Definition SDL3pp_gpu.h:4470
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:7156
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_INT2
GPU_VERTEXELEMENTFORMAT_INT2.
Definition SDL3pp_gpu.h:4298
GPUComputePipeline CreateGPUComputePipeline(GPUDeviceRef device, const GPUComputePipelineCreateInfo &createinfo)
Creates a pipeline object to be used in a compute workflow.
Definition SDL3pp_gpu.h:5474
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:4595
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:6990
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:7673
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:6695
GPUShaderFormat GetShaderFormats()
Returns the supported shader formats for this GPU context.
Definition SDL3pp_gpu.h:5281
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:4399
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:8232
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:4280
constexpr GPUCompareOp GPU_COMPAREOP_INVALID
GPU_COMPAREOP_INVALID.
Definition SDL3pp_gpu.h:4464
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:6565
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:6660
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:7255
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:4531
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:4265
constexpr GPUStencilOp GPU_STENCILOP_INVALID
GPU_STENCILOP_INVALID.
Definition SDL3pp_gpu.h:4503
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:8251
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:7582
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:7308
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:7467
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:7845
SDL_GPUDepthStencilState GPUDepthStencilState
A structure specifying the parameters of the graphics pipeline depth stencil state.
Definition SDL3pp_gpu.h:4846
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:4635
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:4232
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:4761
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:4443
constexpr GPUStencilOp GPU_STENCILOP_DECREMENT_AND_CLAMP
Decrements the current value and clamps to 0.
Definition SDL3pp_gpu.h:4519
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UINT4
GPU_VERTEXELEMENTFORMAT_UINT4.
Definition SDL3pp_gpu.h:4316
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:7626
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:6541
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:6955
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:6671
void WaitForGPUIdle(GPUDeviceRef device)
Blocks the thread until the GPU is completely idle.
Definition SDL3pp_gpu.h:8022
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:7002
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:4826
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:5925
constexpr GPUCullMode GPU_CULLMODE_FRONT
Front-facing triangles are culled.
Definition SDL3pp_gpu.h:4429
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:8051
constexpr GPUCompareOp GPU_COMPAREOP_GREATER
The comparison evaluates reference > test.
Definition SDL3pp_gpu.h:4480
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:7511
GPUTexture CreateTexture(const GPUTextureCreateInfo &createinfo)
Creates a texture object to be used in graphics or compute workflows.
Definition SDL3pp_gpu.h:5777
constexpr GPUFrontFace GPU_FRONTFACE_COUNTER_CLOCKWISE
A triangle with counter-clockwise vertex winding will be considered front-facing.
Definition SDL3pp_gpu.h:4449
SDL_GPUMultisampleState GPUMultisampleState
A structure specifying the parameters of the graphics pipeline multisample state.
Definition SDL3pp_gpu.h:4836
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:6300
constexpr GPUColorComponentFlags GPU_COLORCOMPONENT_R
the red component
Definition SDL3pp_gpu.h:4629
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:4665
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_BYTE2_NORM
GPU_VERTEXELEMENTFORMAT_BYTE2_NORM.
Definition SDL3pp_gpu.h:4343
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_HALF2
GPU_VERTEXELEMENTFORMAT_HALF2.
Definition SDL3pp_gpu.h:4379
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:7621
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:4432
SDL_GPUIndirectDrawCommand GPUIndirectDrawCommand
A structure specifying the parameters of an indirect draw command.
Definition SDL3pp_gpu.h:4716
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UINT2
GPU_VERTEXELEMENTFORMAT_UINT2.
Definition SDL3pp_gpu.h:4310
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:5932
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:4340
void PushFragmentUniformData(Uint32 slot_index, SourceBytes data)
Pushes data to a fragment uniform slot on the command buffer.
Definition SDL3pp_gpu.h:6338
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:7337
void PushGPUComputeUniformData(GPUCommandBuffer command_buffer, Uint32 slot_index, SourceBytes data)
Pushes data to a uniform slot on the command buffer.
Definition SDL3pp_gpu.h:6360
constexpr GPUBlendFactor GPU_BLENDFACTOR_INVALID
GPU_BLENDFACTOR_INVALID.
Definition SDL3pp_gpu.h:4579
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:8176
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_INVALID
GPU_VERTEXELEMENTFORMAT_INVALID.
Definition SDL3pp_gpu.h:4292
void PushVertexUniformData(Uint32 slot_index, SourceBytes data)
Pushes data to a vertex uniform slot on the command buffer.
Definition SDL3pp_gpu.h:6308
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:5683
constexpr GPUStencilOp GPU_STENCILOP_INCREMENT_AND_CLAMP
Increments the current value and clamps to the maximum value.
Definition SDL3pp_gpu.h:4516
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_SHORT4_NORM
GPU_VERTEXELEMENTFORMAT_SHORT4_NORM.
Definition SDL3pp_gpu.h:4370
SDL_GPUVertexElementFormat GPUVertexElementFormat
Specifies the format of a vertex attribute.
Definition SDL3pp_gpu.h:4290
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:7505
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:7419
constexpr GPUBlendFactor GPU_BLENDFACTOR_SRC_COLOR
source color
Definition SDL3pp_gpu.h:4586
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:6194
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:5771
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:5212
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:8073
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:6435
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:4414
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:7410
SDL_GPUIndirectDispatchCommand GPUIndirectDispatchCommand
A structure specifying the parameters of an indexed dispatch command.
Definition SDL3pp_gpu.h:4741
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:4808
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:5389
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:6097
void UploadToTexture(const GPUTextureTransferInfo &source, const GPUTextureRegion &destination, bool cycle)
Uploads data from a transfer buffer to a texture.
Definition SDL3pp_gpu.h:7316
SDL_GPUSamplerMipmapMode GPUSamplerMipmapMode
Specifies a mipmap mode used by a sampler.
Definition SDL3pp_gpu.h:4663
bool SetSwapchainParameters(WindowRef window, GPUSwapchainComposition swapchain_composition, GPUPresentMode present_mode)
Changes the swapchain parameters for the given claimed window.
Definition SDL3pp_gpu.h:7683
Uint8 GPUColorComponentFlags
Specifies which color components are written in a graphics pipeline.
Definition SDL3pp_gpu.h:4627
const char * GetGPUDeviceDriver(GPUDeviceRef device)
Returns the name of the backend used to create this GPU context.
Definition SDL3pp_gpu.h:5257
constexpr GPUCompareOp GPU_COMPAREOP_NEVER
The comparison always evaluates false.
Definition SDL3pp_gpu.h:4467
SDL_GPUVulkanOptions GPUVulkanOptions
A structure specifying additional options when using Vulkan.
Definition SDL3pp_gpu.h:5199
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:6500
constexpr GPUBlendFactor GPU_BLENDFACTOR_SRC_ALPHA
source alpha
Definition SDL3pp_gpu.h:4598
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:6137
bool TextureSupportsSampleCount(GPUTextureFormat format, GPUSampleCount sample_count)
Determines if a sample count for a texture format is supported.
Definition SDL3pp_gpu.h:8158
SDL_GPUSamplerAddressMode GPUSamplerAddressMode
Specifies behavior of texture sampling when the coordinates exceed the 0-1 range.
Definition SDL3pp_gpu.h:4679
void Destroy()
Destroys a GPU context previously returned by CreateGPUDevice.
Definition SDL3pp_gpu.h:5217
GPUDevice CreateGPUDevice(GPUShaderFormat format_flags, bool debug_mode, StringParam name)
Creates a GPU context.
Definition SDL3pp_gpu.h:4930
void ReleaseBuffer(GPUBuffer buffer)
Frees the given buffer as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6157
void ReleaseGraphicsPipeline(GPUGraphicsPipeline graphics_pipeline)
Frees the given graphics pipeline as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6242
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:6441
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:6893
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:4582
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:6277
constexpr GPUBlendOp GPU_BLENDOP_MAX
max(source, destination)
Definition SDL3pp_gpu.h:4563
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:7560
const char * GetGPUDriver(int index)
Get the name of a built in GPU driver.
Definition SDL3pp_gpu.h:5247
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:6037
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:4616
constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA
1 - destination alpha
Definition SDL3pp_gpu.h:4607
GPUTextureFormat GetGPUSwapchainTextureFormat(GPUDeviceRef device, WindowRef window)
Obtains the texture format of the swapchain for the given window.
Definition SDL3pp_gpu.h:7740
void BindPipeline(GPUComputePipeline compute_pipeline)
Binds a compute pipeline on a command buffer for use in compute dispatch.
Definition SDL3pp_gpu.h:7024
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_BYTE2
GPU_VERTEXELEMENTFORMAT_BYTE2.
Definition SDL3pp_gpu.h:4331
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:4506
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_INT3
GPU_VERTEXELEMENTFORMAT_INT3.
Definition SDL3pp_gpu.h:4301
void SetGPUBufferName(GPUDeviceRef device, GPUBuffer buffer, StringParam text)
Sets an arbitrary string constant to label a buffer.
Definition SDL3pp_gpu.h:5975
constexpr GPUBufferUsageFlags GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ
Buffer supports storage reads in the compute stage.
Definition SDL3pp_gpu.h:4243
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:7474
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:6494
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:4648
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:7493
ResourceRefT< GPUDeviceBase > GPUDeviceRef
Reference for GPUDevice.
Definition SDL3pp_gpu.h:387
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_USHORT4
GPU_VERTEXELEMENTFORMAT_USHORT4.
Definition SDL3pp_gpu.h:4364
GPUFence * SubmitAndAcquireFence()
Submits a command buffer so its commands can be processed on the GPU, and acquires a fence associated...
Definition SDL3pp_gpu.h:7976
bool GPUSupportsProperties(PropertiesRef props)
Checks for GPU runtime support.
Definition SDL3pp_gpu.h:4899
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:8043
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:7117
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:7441
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:6950
constexpr GPUBlendOp GPU_BLENDOP_REVERSE_SUBTRACT
(destination * destination_factor) - (source * source_factor)
Definition SDL3pp_gpu.h:4557
constexpr GPUColorComponentFlags GPU_COLORCOMPONENT_G
the green component
Definition SDL3pp_gpu.h:4632
void SetBufferName(GPUBuffer buffer, StringParam text)
Sets an arbitrary string constant to label a buffer.
Definition SDL3pp_gpu.h:5982
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:4235
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:4554
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:6031
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:6178
SDL_GPUBlitRegion GPUBlitRegion
A structure specifying a region of a texture used in the blit operation.
Definition SDL3pp_gpu.h:4700
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:7488
void DispatchGPUComputeIndirect(GPUComputePass compute_pass, GPUBuffer buffer, Uint32 offset)
Dispatches compute work with parameters set from a buffer.
Definition SDL3pp_gpu.h:7190
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:7905
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:4352
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:4577
void PushDebugGroup(StringParam name)
Begins a debug group with an arbitrary name.
Definition SDL3pp_gpu.h:6073
bool GPUSupportsShaderFormats(GPUShaderFormat format_flags, StringParam name)
Checks for GPU runtime support.
Definition SDL3pp_gpu.h:4883
void ReleaseGPUFence(GPUDeviceRef device, GPUFence *fence)
Releases a fence obtained from SubmitGPUCommandBufferAndAcquireFence.
Definition SDL3pp_gpu.h:8090
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:4686
const char * GetDriver()
Returns the name of the backend used to create this GPU context.
Definition SDL3pp_gpu.h:5262
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:6533
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:7092
void DrawPrimitives(Uint32 num_vertices, Uint32 num_instances, Uint32 first_vertex, Uint32 first_instance)
Draws data using bound graphics state.
Definition SDL3pp_gpu.h:6868
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:6473
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:7936
void ReleaseShader(GPUShader shader)
Frees the given shader as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6221
constexpr GPUFilter GPU_FILTER_NEAREST
Point filtering.
Definition SDL3pp_gpu.h:4650
void SetGPUTextureName(GPUDeviceRef device, GPUTexture texture, StringParam text)
Sets an arbitrary string constant to label a texture.
Definition SDL3pp_gpu.h:6004
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:4796
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:7045
void UnmapTransferBuffer(GPUTransferBuffer transfer_buffer)
Unmaps a previously mapped transfer buffer.
Definition SDL3pp_gpu.h:7261
void WaitForIdle()
Blocks the thread until the GPU is completely idle.
Definition SDL3pp_gpu.h:8027
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:7081
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:7281
constexpr GPUBlendOp GPU_BLENDOP_ADD
(source * source_factor) + (destination * destination_factor)
Definition SDL3pp_gpu.h:4551
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:4526
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:5481
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_BYTE4_NORM
GPU_VERTEXELEMENTFORMAT_BYTE4_NORM.
Definition SDL3pp_gpu.h:4346
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_FLOAT
GPU_VERTEXELEMENTFORMAT_FLOAT.
Definition SDL3pp_gpu.h:4319
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:6417
constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA
1 - source alpha
Definition SDL3pp_gpu.h:4601
constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE
1
Definition SDL3pp_gpu.h:4584
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM
GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM.
Definition SDL3pp_gpu.h:4349
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_SHORT4
GPU_VERTEXELEMENTFORMAT_SHORT4.
Definition SDL3pp_gpu.h:4358
void PopGPUDebugGroup(GPUCommandBuffer command_buffer)
Ends the most-recently pushed debug group.
Definition SDL3pp_gpu.h:6092
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:6152
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:8249
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:4426
constexpr GPUBlendFactor GPU_BLENDFACTOR_DST_ALPHA
destination alpha
Definition SDL3pp_gpu.h:4604
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:6932
void EndGPUComputePass(GPUComputePass compute_pass)
Ends the current compute pass.
Definition SDL3pp_gpu.h:7212
SDL_GPUVertexInputRate GPUVertexInputRate
Specifies the rate at which vertex attributes are pulled from buffers.
Definition SDL3pp_gpu.h:4392
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:55
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:5891
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_gpu.h:5893
Properties for GPUComputePipeline creation.
Definition SDL3pp_gpu.h:5500
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_gpu.h:5502
Properties for GPUDevice creation.
Definition SDL3pp_gpu.h:5070
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_gpu.h:5085
constexpr auto FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN
Enable feature indirect draw first instance.
Definition SDL3pp_gpu.h:5099
constexpr auto D3D12_AGILITY_SDK_PATH_STRING
String for d3d12 agility sdk path.
Definition SDL3pp_gpu.h:5152
constexpr auto DEBUGMODE_BOOLEAN
Enable debugmode.
Definition SDL3pp_gpu.h:5072
constexpr auto FEATURE_DEPTH_CLAMPING_BOOLEAN
Enable feature depth clamping.
Definition SDL3pp_gpu.h:5094
constexpr auto SHADERS_PRIVATE_BOOLEAN
Enable shaders private.
Definition SDL3pp_gpu.h:5108
constexpr auto D3D12_AGILITY_SDK_VERSION_NUMBER
Number for d3d12 agility sdk version.
Definition SDL3pp_gpu.h:5146
constexpr auto SHADERS_MSL_BOOLEAN
Enable shaders msl.
Definition SDL3pp_gpu.h:5121
constexpr auto METAL_ALLOW_MACFAMILY1_BOOLEAN
Enable metal allow macfamily1.
Definition SDL3pp_gpu.h:5172
constexpr auto VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN
Enable vulkan require hardware acceleration.
Definition SDL3pp_gpu.h:5161
constexpr auto D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN
Enable d3d12 allow fewer resource slots.
Definition SDL3pp_gpu.h:5130
constexpr auto SHADERS_DXIL_BOOLEAN
Enable shaders dxil.
Definition SDL3pp_gpu.h:5118
constexpr auto SHADERS_DXBC_BOOLEAN
Enable shaders dxbc.
Definition SDL3pp_gpu.h:5115
constexpr auto SHADERS_SPIRV_BOOLEAN
Enable shaders spirv.
Definition SDL3pp_gpu.h:5112
constexpr auto PREFERLOWPOWER_BOOLEAN
Enable preferlowpower.
Definition SDL3pp_gpu.h:5075
constexpr auto FEATURE_ANISOTROPY_BOOLEAN
Enable feature anisotropy.
Definition SDL3pp_gpu.h:5102
constexpr auto FEATURE_CLIP_DISTANCE_BOOLEAN
Enable feature clip distance.
Definition SDL3pp_gpu.h:5090
constexpr auto VULKAN_OPTIONS_POINTER
Pointer to vulkan options.
Definition SDL3pp_gpu.h:5164
constexpr auto SHADERS_METALLIB_BOOLEAN
Enable shaders metallib.
Definition SDL3pp_gpu.h:5124
constexpr auto VERBOSE_BOOLEAN
Enable verbose.
Definition SDL3pp_gpu.h:5080
constexpr auto D3D12_SEMANTIC_NAME_STRING
String for d3d12 semantic name.
Definition SDL3pp_gpu.h:5140
Properties for GPUDevice creation and information.
Definition SDL3pp_gpu.h:5070
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_gpu.h:5413
constexpr auto DRIVER_VERSION_STRING
String for driver version.
Definition SDL3pp_gpu.h:5419
constexpr auto DRIVER_NAME_STRING
String for driver name.
Definition SDL3pp_gpu.h:5416
constexpr auto DRIVER_INFO_STRING
String for driver info.
Definition SDL3pp_gpu.h:5422
Properties for GPUGraphicsPipeline creation.
Definition SDL3pp_gpu.h:5554
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_gpu.h:5556
Properties for GPUSampler creation.
Definition SDL3pp_gpu.h:5605
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_gpu.h:5607
Properties for GPUShader creation.
Definition SDL3pp_gpu.h:5706
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_gpu.h:5708
Properties for GPUTexture creation.
Definition SDL3pp_gpu.h:5794
constexpr auto D3D12_CLEAR_G_FLOAT
Float for d3d12 clear g.
Definition SDL3pp_gpu.h:5799
constexpr auto D3D12_CLEAR_DEPTH_FLOAT
Float for d3d12 clear depth.
Definition SDL3pp_gpu.h:5808
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_gpu.h:5820
constexpr auto D3D12_CLEAR_A_FLOAT
Float for d3d12 clear a.
Definition SDL3pp_gpu.h:5805
constexpr auto D3D12_CLEAR_STENCIL_NUMBER
Number for d3d12 clear stencil.
Definition SDL3pp_gpu.h:5814
constexpr auto D3D12_CLEAR_B_FLOAT
Float for d3d12 clear b.
Definition SDL3pp_gpu.h:5802
constexpr auto D3D12_CLEAR_R_FLOAT
Float for d3d12 clear r.
Definition SDL3pp_gpu.h:5796
Properties for GPUTransferBuffer creation.
Definition SDL3pp_gpu.h:5951
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_gpu.h:5953
Main include header for the SDL3pp library.
Uint32 narrowU32(T value)
Narrows to Uint32.
Definition SDL3pp_stdinc.h:6275
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