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
1298 void BindVertexSamplers(
1299 Uint32 first_slot,
1300 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings);
1301
1321 void BindVertexStorageTextures(Uint32 first_slot,
1322 SpanRef<const GPUTextureRaw> storage_textures);
1323
1340 void BindVertexStorageBuffers(Uint32 first_slot,
1341 SpanRef<const GPUBufferRaw> storage_buffers);
1342
1363 Uint32 first_slot,
1364 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings);
1365
1386 Uint32 first_slot,
1387 SpanRef<const GPUTextureRaw> storage_textures);
1388
1405 void BindFragmentStorageBuffers(Uint32 first_slot,
1406 SpanRef<const GPUBufferRaw> storage_buffers);
1407
1430 void DrawIndexedPrimitives(Uint32 num_indices,
1431 Uint32 num_instances,
1432 Uint32 first_index,
1433 Sint32 vertex_offset,
1434 Uint32 first_instance);
1435
1455 void DrawPrimitives(Uint32 num_vertices,
1456 Uint32 num_instances,
1457 Uint32 first_vertex,
1458 Uint32 first_instance);
1459
1476 Uint32 offset,
1477 Uint32 draw_count);
1478
1495 Uint32 offset,
1496 Uint32 draw_count);
1497
1506 void End();
1507};
1508
1521{
1522 GPUComputePassRaw m_gPUComputePass;
1523
1524public:
1530 constexpr GPUComputePass(GPUComputePassRaw gPUComputePass = {}) noexcept
1531 : m_gPUComputePass(gPUComputePass)
1532 {
1533 }
1534
1540 constexpr operator GPUComputePassRaw() const noexcept
1541 {
1542 return m_gPUComputePass;
1543 }
1544
1552 void BindPipeline(GPUComputePipeline compute_pipeline);
1553
1573 void BindSamplers(
1574 Uint32 first_slot,
1575 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings);
1576
1596 void BindStorageTextures(Uint32 first_slot,
1597 SpanRef<const GPUTextureRaw> storage_textures);
1598
1615 void BindStorageBuffers(Uint32 first_slot,
1616 SpanRef<const GPUBufferRaw> storage_buffers);
1617
1637 void Dispatch(Uint32 groupcount_x, Uint32 groupcount_y, Uint32 groupcount_z);
1638
1655 void DispatchIndirect(GPUBuffer buffer, Uint32 offset);
1656
1665 void End();
1666};
1667
1678using GPUBufferRegion = SDL_GPUBufferRegion;
1679
1690using GPUTextureLocation = SDL_GPUTextureLocation;
1691
1701using GPUBufferLocation = SDL_GPUBufferLocation;
1702
1715using GPUTextureRegion = SDL_GPUTextureRegion;
1716
1739using GPUTextureTransferInfo = SDL_GPUTextureTransferInfo;
1740
1752using GPUTransferBufferLocation = SDL_GPUTransferBufferLocation;
1753
1766{
1767 GPUCopyPassRaw m_gPUCopyPass;
1768
1769public:
1775 constexpr GPUCopyPass(GPUCopyPassRaw gPUCopyPass = {}) noexcept
1776 : m_gPUCopyPass(gPUCopyPass)
1777 {
1778 }
1779
1785 constexpr operator GPUCopyPassRaw() const noexcept { return m_gPUCopyPass; }
1786
1803 void UploadToTexture(const GPUTextureTransferInfo& source,
1804 const GPUTextureRegion& destination,
1805 bool cycle);
1806
1820 void UploadToBuffer(const GPUTransferBufferLocation& source,
1821 const GPUBufferRegion& destination,
1822 bool cycle);
1823
1844 void CopyTextureToTexture(const GPUTextureLocation& source,
1845 const GPUTextureLocation& destination,
1846 Uint32 w,
1847 Uint32 h,
1848 Uint32 d,
1849 bool cycle);
1850
1865 void CopyBufferToBuffer(const GPUBufferLocation& source,
1866 const GPUBufferLocation& destination,
1867 Uint32 size,
1868 bool cycle);
1869
1882 void DownloadFromTexture(const GPUTextureRegion& source,
1883 const GPUTextureTransferInfo& destination);
1884
1896 void DownloadFromBuffer(const GPUBufferRegion& source,
1897 const GPUTransferBufferLocation& destination);
1898
1904 void End();
1905};
1906
1943using GPUColorTargetInfo = SDL_GPUColorTargetInfo;
1944
1992using GPUDepthStencilTargetInfo = SDL_GPUDepthStencilTargetInfo;
1993
2002using GPUStorageTextureReadWriteBinding = SDL_GPUStorageTextureReadWriteBinding;
2003
2012using GPUStorageBufferReadWriteBinding = SDL_GPUStorageBufferReadWriteBinding;
2013
2026using GPUBlitInfo = SDL_GPUBlitInfo;
2027
2038using GPUFence = SDL_GPUFence;
2039
2064{
2065 GPUCommandBufferRaw m_gPUCommandBuffer;
2066
2067public:
2073 constexpr GPUCommandBuffer(GPUCommandBufferRaw gPUCommandBuffer = {}) noexcept
2074 : m_gPUCommandBuffer(gPUCommandBuffer)
2075 {
2076 }
2077
2083 constexpr operator GPUCommandBufferRaw() const noexcept
2084 {
2085 return m_gPUCommandBuffer;
2086 }
2087
2102 void InsertDebugLabel(StringParam text);
2103
2129 void PushDebugGroup(StringParam name);
2130
2143 void PopDebugGroup();
2144
2162 void PushVertexUniformData(Uint32 slot_index, SourceBytes data);
2163
2178 void PushFragmentUniformData(Uint32 slot_index, SourceBytes data);
2179
2194 void PushComputeUniformData(Uint32 slot_index, SourceBytes data);
2195
2227 std::span<const GPUColorTargetInfo> color_target_infos,
2228 OptionalRef<const GPUDepthStencilTargetInfo> depth_stencil_target_info);
2229
2263 std::span<const GPUStorageTextureReadWriteBinding> storage_texture_bindings,
2264 std::span<const GPUStorageBufferReadWriteBinding> storage_buffer_bindings);
2265
2280
2291
2301 void BlitTexture(const GPUBlitInfo& info);
2302
2349 WindowRef window,
2350 Uint32* swapchain_texture_width = nullptr,
2351 Uint32* swapchain_texture_height = nullptr);
2352
2393 WindowRef window,
2394 Uint32* swapchain_texture_width = nullptr,
2395 Uint32* swapchain_texture_height = nullptr);
2396
2416 void Submit();
2417
2442
2463 void Cancel();
2464};
2465
2476
2478 SDL_GPU_SHADERFORMAT_INVALID;
2479
2481 SDL_GPU_SHADERFORMAT_PRIVATE;
2482
2484 SDL_GPU_SHADERFORMAT_SPIRV;
2485
2487 SDL_GPU_SHADERFORMAT_DXBC;
2488
2490 SDL_GPU_SHADERFORMAT_DXIL;
2491
2493 SDL_GPU_SHADERFORMAT_MSL;
2494
2496 SDL_GPU_SHADERFORMAT_METALLIB;
2497
2523using GPUSwapchainComposition = SDL_GPUSwapchainComposition;
2524
2526 SDL_GPU_SWAPCHAINCOMPOSITION_SDR;
2527
2529 SDL_GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR;
2530
2532 SDL_GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR;
2533
2535 SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2084;
2536
2562using GPUPresentMode = SDL_GPUPresentMode;
2563
2565 SDL_GPU_PRESENTMODE_VSYNC;
2566
2568 SDL_GPU_PRESENTMODE_IMMEDIATE;
2569
2571 SDL_GPU_PRESENTMODE_MAILBOX;
2572
2654using GPUTextureFormat = SDL_GPUTextureFormat;
2655
2657 SDL_GPU_TEXTUREFORMAT_INVALID;
2658
2660 SDL_GPU_TEXTUREFORMAT_A8_UNORM;
2661
2663 SDL_GPU_TEXTUREFORMAT_R8_UNORM;
2664
2666 SDL_GPU_TEXTUREFORMAT_R8G8_UNORM;
2667
2669 SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM;
2670
2672 SDL_GPU_TEXTUREFORMAT_R16_UNORM;
2673
2675 SDL_GPU_TEXTUREFORMAT_R16G16_UNORM;
2676
2678 SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UNORM;
2679
2681 SDL_GPU_TEXTUREFORMAT_R10G10B10A2_UNORM;
2682
2684 SDL_GPU_TEXTUREFORMAT_B5G6R5_UNORM;
2685
2687 SDL_GPU_TEXTUREFORMAT_B5G5R5A1_UNORM;
2688
2690 SDL_GPU_TEXTUREFORMAT_B4G4R4A4_UNORM;
2691
2693 SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM;
2694
2696 SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM;
2697
2699 SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM;
2700
2702 SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM;
2703
2705 SDL_GPU_TEXTUREFORMAT_BC4_R_UNORM;
2706
2708 SDL_GPU_TEXTUREFORMAT_BC5_RG_UNORM;
2709
2711 SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM;
2712
2714 SDL_GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT;
2715
2717 SDL_GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT;
2718
2720 SDL_GPU_TEXTUREFORMAT_R8_SNORM;
2721
2723 SDL_GPU_TEXTUREFORMAT_R8G8_SNORM;
2724
2726 SDL_GPU_TEXTUREFORMAT_R8G8B8A8_SNORM;
2727
2729 SDL_GPU_TEXTUREFORMAT_R16_SNORM;
2730
2732 SDL_GPU_TEXTUREFORMAT_R16G16_SNORM;
2733
2735 SDL_GPU_TEXTUREFORMAT_R16G16B16A16_SNORM;
2736
2738 SDL_GPU_TEXTUREFORMAT_R16_FLOAT;
2739
2741 SDL_GPU_TEXTUREFORMAT_R16G16_FLOAT;
2742
2744 SDL_GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT;
2745
2747 SDL_GPU_TEXTUREFORMAT_R32_FLOAT;
2748
2750 SDL_GPU_TEXTUREFORMAT_R32G32_FLOAT;
2751
2753 SDL_GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT;
2754
2756 SDL_GPU_TEXTUREFORMAT_R11G11B10_UFLOAT;
2757
2759 SDL_GPU_TEXTUREFORMAT_R8_UINT;
2760
2762 SDL_GPU_TEXTUREFORMAT_R8G8_UINT;
2763
2765 SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UINT;
2766
2768 SDL_GPU_TEXTUREFORMAT_R16_UINT;
2769
2771 SDL_GPU_TEXTUREFORMAT_R16G16_UINT;
2772
2774 SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UINT;
2775
2777 SDL_GPU_TEXTUREFORMAT_R32_UINT;
2778
2780 SDL_GPU_TEXTUREFORMAT_R32G32_UINT;
2781
2783 SDL_GPU_TEXTUREFORMAT_R32G32B32A32_UINT;
2784
2786 SDL_GPU_TEXTUREFORMAT_R8_INT;
2787
2789 SDL_GPU_TEXTUREFORMAT_R8G8_INT;
2790
2792 SDL_GPU_TEXTUREFORMAT_R8G8B8A8_INT;
2793
2795 SDL_GPU_TEXTUREFORMAT_R16_INT;
2796
2798 SDL_GPU_TEXTUREFORMAT_R16G16_INT;
2799
2801 SDL_GPU_TEXTUREFORMAT_R16G16B16A16_INT;
2802
2804 SDL_GPU_TEXTUREFORMAT_R32_INT;
2805
2807 SDL_GPU_TEXTUREFORMAT_R32G32_INT;
2808
2810 SDL_GPU_TEXTUREFORMAT_R32G32B32A32_INT;
2811
2813 SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB;
2814
2816 SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB;
2817
2819 SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB;
2820
2822 SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB;
2823
2825 SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB;
2826
2828 SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB;
2829
2831 SDL_GPU_TEXTUREFORMAT_D16_UNORM;
2832
2834 SDL_GPU_TEXTUREFORMAT_D24_UNORM;
2835
2837 SDL_GPU_TEXTUREFORMAT_D32_FLOAT;
2838
2840 SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT;
2841
2843 SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT;
2844
2846 SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM;
2847
2849 SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM;
2850
2852 SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM;
2853
2855 SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM;
2856
2858 SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM;
2859
2861 SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM;
2862
2864 SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM;
2865
2867 SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM;
2868
2870 SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM;
2871
2873 SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM;
2874
2876 SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM;
2877
2879 SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM;
2880
2882 SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM;
2883
2885 SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM;
2886
2888 SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM_SRGB;
2889
2891 SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM_SRGB;
2892
2894 SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM_SRGB;
2895
2897 SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM_SRGB;
2898
2900 SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM_SRGB;
2901
2903 SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM_SRGB;
2904
2906 SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM_SRGB;
2907
2909 SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM_SRGB;
2910
2912 SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM_SRGB;
2913
2915 SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM_SRGB;
2916
2918 SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM_SRGB;
2919
2921 SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM_SRGB;
2922
2924 SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM_SRGB;
2925
2927 SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM_SRGB;
2928
2930 SDL_GPU_TEXTUREFORMAT_ASTC_4x4_FLOAT;
2931
2933 SDL_GPU_TEXTUREFORMAT_ASTC_5x4_FLOAT;
2934
2936 SDL_GPU_TEXTUREFORMAT_ASTC_5x5_FLOAT;
2937
2939 SDL_GPU_TEXTUREFORMAT_ASTC_6x5_FLOAT;
2940
2942 SDL_GPU_TEXTUREFORMAT_ASTC_6x6_FLOAT;
2943
2945 SDL_GPU_TEXTUREFORMAT_ASTC_8x5_FLOAT;
2946
2948 SDL_GPU_TEXTUREFORMAT_ASTC_8x6_FLOAT;
2949
2951 SDL_GPU_TEXTUREFORMAT_ASTC_8x8_FLOAT;
2952
2954 SDL_GPU_TEXTUREFORMAT_ASTC_10x5_FLOAT;
2955
2957 SDL_GPU_TEXTUREFORMAT_ASTC_10x6_FLOAT;
2958
2960 SDL_GPU_TEXTUREFORMAT_ASTC_10x8_FLOAT;
2961
2963 SDL_GPU_TEXTUREFORMAT_ASTC_10x10_FLOAT;
2964
2966 SDL_GPU_TEXTUREFORMAT_ASTC_12x10_FLOAT;
2967
2969 SDL_GPU_TEXTUREFORMAT_ASTC_12x12_FLOAT;
2970
2978using GPUTextureType = SDL_GPUTextureType;
2979
2981 SDL_GPU_TEXTURETYPE_2D;
2982
2984 SDL_GPU_TEXTURETYPE_2D_ARRAY;
2985
2987 SDL_GPU_TEXTURETYPE_3D;
2988
2990 SDL_GPU_TEXTURETYPE_CUBE;
2991
2993 SDL_GPU_TEXTURETYPE_CUBE_ARRAY;
2994
3016
3018 SDL_GPU_TEXTUREUSAGE_SAMPLER;
3019
3021 SDL_GPU_TEXTUREUSAGE_COLOR_TARGET;
3022
3024 SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET;
3026
3028 SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ;
3030
3033 SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ;
3034
3037 SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE;
3038
3043constexpr GPUTextureUsageFlags
3045 SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE;
3046
3058using GPUSampleCount = SDL_GPUSampleCount;
3059
3061 SDL_GPU_SAMPLECOUNT_1;
3062
3063constexpr GPUSampleCount GPU_SAMPLECOUNT_2 = SDL_GPU_SAMPLECOUNT_2;
3064
3065constexpr GPUSampleCount GPU_SAMPLECOUNT_4 = SDL_GPU_SAMPLECOUNT_4;
3066
3067constexpr GPUSampleCount GPU_SAMPLECOUNT_8 = SDL_GPU_SAMPLECOUNT_8;
3068
3074struct GPUDeviceBase : ResourceBaseT<GPUDeviceRaw>
3075{
3077
3085 void Destroy();
3086
3094 const char* GetDriver();
3095
3105
3106#if SDL_VERSION_ATLEAST(3, 4, 0)
3107
3210
3211#endif // SDL_VERSION_ATLEAST(3, 4, 0)
3212
3258 const GPUComputePipelineCreateInfo& createinfo);
3259
3281 const GPUGraphicsPipelineCreateInfo& createinfo);
3282
3304
3377 GPUShader CreateShader(const GPUShaderCreateInfo& createinfo);
3378
3437
3480 GPUBuffer CreateBuffer(const GPUBufferCreateInfo& createinfo);
3481
3509 const GPUTransferBufferCreateInfo& createinfo);
3510
3527 void SetBufferName(GPUBuffer buffer, StringParam text);
3528
3545 void SetTextureName(GPUTexture texture, StringParam text);
3546
3556 void ReleaseTexture(GPUTexture texture);
3557
3567 void ReleaseSampler(GPUSampler sampler);
3568
3578 void ReleaseBuffer(GPUBuffer buffer);
3579
3589 void ReleaseTransferBuffer(GPUTransferBuffer transfer_buffer);
3590
3600 void ReleaseComputePipeline(GPUComputePipeline compute_pipeline);
3601
3611 void ReleaseShader(GPUShader shader);
3612
3622 void ReleaseGraphicsPipeline(GPUGraphicsPipeline graphics_pipeline);
3623
3648
3663 void* MapTransferBuffer(GPUTransferBuffer transfer_buffer, bool cycle);
3664
3672 void UnmapTransferBuffer(GPUTransferBuffer transfer_buffer);
3673
3688 WindowRef window,
3689 GPUSwapchainComposition swapchain_composition);
3690
3704 bool WindowSupportsPresentMode(WindowRef window, GPUPresentMode present_mode);
3705
3730 void ClaimWindow(WindowRef window);
3731
3741 void ReleaseWindow(WindowRef window);
3742
3766 GPUSwapchainComposition swapchain_composition,
3767 GPUPresentMode present_mode);
3768
3793 bool SetAllowedFramesInFlight(Uint32 allowed_frames_in_flight);
3794
3806
3822 void WaitForSwapchain(WindowRef window);
3823
3833 void WaitForIdle();
3834
3848 void WaitForFences(bool wait_all, std::span<GPUFence* const> fences);
3849
3860 bool QueryFence(GPUFence* fence);
3861
3873 void ReleaseFence(GPUFence* fence);
3874
3887 GPUTextureType type,
3888 GPUTextureUsageFlags usage);
3889
3900 GPUSampleCount sample_count);
3901
3902#ifdef SDL_PLATFORM_GDK
3903
3915 void GDKSuspendGPU();
3916
3928 void GDKResumeGPU();
3929
3930#endif /* SDL_PLATFORM_GDK */
3931};
3932
3941{
3942 using GPUDeviceBase::GPUDeviceBase;
3943
3951 constexpr explicit GPUDevice(GPUDeviceRaw resource) noexcept
3952 : GPUDeviceBase(resource)
3953 {
3954 }
3955
3957 constexpr GPUDevice(GPUDevice&& other) noexcept
3958 : GPUDevice(other.release())
3959 {
3960 }
3961
3988 GPUDevice(GPUShaderFormat format_flags, bool debug_mode, StringParam name);
3989
4101 GPUDevice(PropertiesRef props);
4102
4104 ~GPUDevice() { SDL_DestroyGPUDevice(get()); }
4105
4107 constexpr GPUDevice& operator=(GPUDevice&& other) noexcept
4108 {
4109 swap(*this, other);
4110 return *this;
4111 }
4112};
4113
4134using GPUPrimitiveType = SDL_GPUPrimitiveType;
4135
4137 SDL_GPU_PRIMITIVETYPE_TRIANGLELIST;
4138
4140 SDL_GPU_PRIMITIVETYPE_TRIANGLESTRIP;
4141
4143 SDL_GPU_PRIMITIVETYPE_LINELIST;
4144
4146 SDL_GPU_PRIMITIVETYPE_LINESTRIP;
4147
4149 SDL_GPU_PRIMITIVETYPE_POINTLIST;
4150
4159using GPULoadOp = SDL_GPULoadOp;
4160
4162constexpr GPULoadOp GPU_LOADOP_LOAD = SDL_GPU_LOADOP_LOAD;
4163
4165constexpr GPULoadOp GPU_LOADOP_CLEAR = SDL_GPU_LOADOP_CLEAR;
4166
4171constexpr GPULoadOp GPU_LOADOP_DONT_CARE = SDL_GPU_LOADOP_DONT_CARE;
4172
4181using GPUStoreOp = SDL_GPUStoreOp;
4182
4184constexpr GPUStoreOp GPU_STOREOP_STORE = SDL_GPU_STOREOP_STORE;
4185
4190constexpr GPUStoreOp GPU_STOREOP_DONT_CARE = SDL_GPU_STOREOP_DONT_CARE;
4191
4197constexpr GPUStoreOp GPU_STOREOP_RESOLVE = SDL_GPU_STOREOP_RESOLVE;
4198
4205 SDL_GPU_STOREOP_RESOLVE_AND_STORE;
4206
4214using GPUCubeMapFace = SDL_GPUCubeMapFace;
4215
4217 SDL_GPU_CUBEMAPFACE_POSITIVEX;
4218
4220 SDL_GPU_CUBEMAPFACE_NEGATIVEX;
4221
4223 SDL_GPU_CUBEMAPFACE_POSITIVEY;
4224
4226 SDL_GPU_CUBEMAPFACE_NEGATIVEY;
4227
4229 SDL_GPU_CUBEMAPFACE_POSITIVEZ;
4230
4232 SDL_GPU_CUBEMAPFACE_NEGATIVEZ;
4233
4255
4257 SDL_GPU_BUFFERUSAGE_VERTEX;
4258
4260 SDL_GPU_BUFFERUSAGE_INDEX;
4261
4263 SDL_GPU_BUFFERUSAGE_INDIRECT;
4264
4266 SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ;
4268
4271 SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ;
4272
4275 SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE;
4276
4287using GPUTransferBufferUsage = SDL_GPUTransferBufferUsage;
4288
4290 SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD;
4291
4293 SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD;
4294
4302using GPUShaderStage = SDL_GPUShaderStage;
4303
4305 SDL_GPU_SHADERSTAGE_VERTEX;
4306
4308 SDL_GPU_SHADERSTAGE_FRAGMENT;
4309
4317using GPUVertexElementFormat = SDL_GPUVertexElementFormat;
4318
4320 SDL_GPU_VERTEXELEMENTFORMAT_INVALID;
4321
4323 SDL_GPU_VERTEXELEMENTFORMAT_INT;
4324
4326 SDL_GPU_VERTEXELEMENTFORMAT_INT2;
4327
4329 SDL_GPU_VERTEXELEMENTFORMAT_INT3;
4330
4332 SDL_GPU_VERTEXELEMENTFORMAT_INT4;
4333
4335 SDL_GPU_VERTEXELEMENTFORMAT_UINT;
4336
4338 SDL_GPU_VERTEXELEMENTFORMAT_UINT2;
4339
4341 SDL_GPU_VERTEXELEMENTFORMAT_UINT3;
4342
4344 SDL_GPU_VERTEXELEMENTFORMAT_UINT4;
4345
4347 SDL_GPU_VERTEXELEMENTFORMAT_FLOAT;
4348
4350 SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2;
4351
4353 SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3;
4354
4356 SDL_GPU_VERTEXELEMENTFORMAT_FLOAT4;
4357
4359 SDL_GPU_VERTEXELEMENTFORMAT_BYTE2;
4360
4362 SDL_GPU_VERTEXELEMENTFORMAT_BYTE4;
4363
4365 SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2;
4366
4368 SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4;
4369
4371 SDL_GPU_VERTEXELEMENTFORMAT_BYTE2_NORM;
4372
4374 SDL_GPU_VERTEXELEMENTFORMAT_BYTE4_NORM;
4375
4377 SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM;
4378
4380 SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM;
4381
4383 SDL_GPU_VERTEXELEMENTFORMAT_SHORT2;
4384
4386 SDL_GPU_VERTEXELEMENTFORMAT_SHORT4;
4387
4389 SDL_GPU_VERTEXELEMENTFORMAT_USHORT2;
4390
4392 SDL_GPU_VERTEXELEMENTFORMAT_USHORT4;
4393
4395 SDL_GPU_VERTEXELEMENTFORMAT_SHORT2_NORM;
4396
4398 SDL_GPU_VERTEXELEMENTFORMAT_SHORT4_NORM;
4399
4401 SDL_GPU_VERTEXELEMENTFORMAT_USHORT2_NORM;
4402
4404 SDL_GPU_VERTEXELEMENTFORMAT_USHORT4_NORM;
4405
4407 SDL_GPU_VERTEXELEMENTFORMAT_HALF2;
4408
4410 SDL_GPU_VERTEXELEMENTFORMAT_HALF4;
4411
4419using GPUVertexInputRate = SDL_GPUVertexInputRate;
4420
4423 SDL_GPU_VERTEXINPUTRATE_VERTEX;
4424
4427 SDL_GPU_VERTEXINPUTRATE_INSTANCE;
4428
4436using GPUFillMode = SDL_GPUFillMode;
4437
4439 SDL_GPU_FILLMODE_FILL;
4440
4442 SDL_GPU_FILLMODE_LINE;
4443
4451using GPUCullMode = SDL_GPUCullMode;
4452
4454 SDL_GPU_CULLMODE_NONE;
4455
4457 SDL_GPU_CULLMODE_FRONT;
4458
4460 SDL_GPU_CULLMODE_BACK;
4461
4470using GPUFrontFace = SDL_GPUFrontFace;
4471
4477 SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE;
4478
4480constexpr GPUFrontFace GPU_FRONTFACE_CLOCKWISE = SDL_GPU_FRONTFACE_CLOCKWISE;
4481
4489using GPUCompareOp = SDL_GPUCompareOp;
4490
4492 SDL_GPU_COMPAREOP_INVALID;
4493
4495 SDL_GPU_COMPAREOP_NEVER;
4496
4498 SDL_GPU_COMPAREOP_LESS;
4499
4501 SDL_GPU_COMPAREOP_EQUAL;
4502
4504 SDL_GPU_COMPAREOP_LESS_OR_EQUAL;
4506
4508 SDL_GPU_COMPAREOP_GREATER;
4509
4511 SDL_GPU_COMPAREOP_NOT_EQUAL;
4512
4514 SDL_GPU_COMPAREOP_GREATER_OR_EQUAL;
4516
4518 SDL_GPU_COMPAREOP_ALWAYS;
4519
4528using GPUStencilOp = SDL_GPUStencilOp;
4529
4531 SDL_GPU_STENCILOP_INVALID;
4532
4534 SDL_GPU_STENCILOP_KEEP;
4535
4537 SDL_GPU_STENCILOP_ZERO;
4538
4540 SDL_GPU_STENCILOP_REPLACE;
4541
4544 SDL_GPU_STENCILOP_INCREMENT_AND_CLAMP;
4545
4547 SDL_GPU_STENCILOP_DECREMENT_AND_CLAMP;
4549
4551 SDL_GPU_STENCILOP_INVERT;
4552
4554 SDL_GPU_STENCILOP_INCREMENT_AND_WRAP;
4556
4559 SDL_GPU_STENCILOP_DECREMENT_AND_WRAP;
4560
4572using GPUBlendOp = SDL_GPUBlendOp;
4573
4575 SDL_GPU_BLENDOP_INVALID;
4576
4578constexpr GPUBlendOp GPU_BLENDOP_ADD = SDL_GPU_BLENDOP_ADD;
4579
4581constexpr GPUBlendOp GPU_BLENDOP_SUBTRACT = SDL_GPU_BLENDOP_SUBTRACT;
4582
4585 SDL_GPU_BLENDOP_REVERSE_SUBTRACT;
4586
4588 SDL_GPU_BLENDOP_MIN;
4589
4591 SDL_GPU_BLENDOP_MAX;
4592
4604using GPUBlendFactor = SDL_GPUBlendFactor;
4605
4607 SDL_GPU_BLENDFACTOR_INVALID;
4608
4609constexpr GPUBlendFactor GPU_BLENDFACTOR_ZERO = SDL_GPU_BLENDFACTOR_ZERO;
4610
4611constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE = SDL_GPU_BLENDFACTOR_ONE;
4612
4614 SDL_GPU_BLENDFACTOR_SRC_COLOR;
4615
4617 SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR;
4618
4620 SDL_GPU_BLENDFACTOR_DST_COLOR;
4621
4623 SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR;
4624
4626 SDL_GPU_BLENDFACTOR_SRC_ALPHA;
4627
4629 SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA;
4630
4632 SDL_GPU_BLENDFACTOR_DST_ALPHA;
4633
4635 SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA;
4636
4638 SDL_GPU_BLENDFACTOR_CONSTANT_COLOR;
4639
4641 SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR;
4642
4644 SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE;
4646
4655
4657 SDL_GPU_COLORCOMPONENT_R;
4658
4660 SDL_GPU_COLORCOMPONENT_G;
4661
4663 SDL_GPU_COLORCOMPONENT_B;
4664
4666 SDL_GPU_COLORCOMPONENT_A;
4667
4675using GPUFilter = SDL_GPUFilter;
4676
4678 SDL_GPU_FILTER_NEAREST;
4679
4681 SDL_GPU_FILTER_LINEAR;
4682
4690using GPUSamplerMipmapMode = SDL_GPUSamplerMipmapMode;
4691
4693 SDL_GPU_SAMPLERMIPMAPMODE_NEAREST;
4694
4696 SDL_GPU_SAMPLERMIPMAPMODE_LINEAR;
4697
4706using GPUSamplerAddressMode = SDL_GPUSamplerAddressMode;
4707
4709 SDL_GPU_SAMPLERADDRESSMODE_REPEAT;
4711
4714 SDL_GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT;
4715
4718 SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE;
4719
4728using GPUBlitRegion = SDL_GPUBlitRegion;
4729
4744using GPUIndirectDrawCommand = SDL_GPUIndirectDrawCommand;
4745
4760using GPUIndexedIndirectDrawCommand = SDL_GPUIndexedIndirectDrawCommand;
4761
4769using GPUIndirectDispatchCommand = SDL_GPUIndirectDispatchCommand;
4770
4789using GPUVertexBufferDescription = SDL_GPUVertexBufferDescription;
4790
4803using GPUVertexAttribute = SDL_GPUVertexAttribute;
4804
4815using GPUVertexInputState = SDL_GPUVertexInputState;
4816
4824using GPUStencilOpState = SDL_GPUStencilOpState;
4825
4837using GPUColorTargetBlendState = SDL_GPUColorTargetBlendState;
4838
4855using GPURasterizerState = SDL_GPURasterizerState;
4856
4865using GPUMultisampleState = SDL_GPUMultisampleState;
4866
4875using GPUDepthStencilState = SDL_GPUDepthStencilState;
4876
4885using GPUColorTargetDescription = SDL_GPUColorTargetDescription;
4886
4897using GPUGraphicsPipelineTargetInfo = SDL_GPUGraphicsPipelineTargetInfo;
4898
4913 StringParam name)
4914{
4915 return SDL_GPUSupportsShaderFormats(format_flags, name);
4916}
4917
4929{
4930 return SDL_GPUSupportsProperties(props);
4931}
4932
4960 bool debug_mode,
4961 StringParam name)
4962{
4963 return GPUDevice(format_flags, debug_mode, name);
4964}
4965
4967 bool debug_mode,
4968 StringParam name)
4969 : GPUDevice(CheckError(SDL_CreateGPUDevice(format_flags, debug_mode, name)))
4970{
4971}
4972
4974 : GPUDevice(CheckError(SDL_CreateGPUDeviceWithProperties(props)))
4975{
4976}
4977
5088{
5089 return GPUDevice(props);
5090}
5091
5100
5101constexpr auto DEBUGMODE_BOOLEAN =
5102 SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN;
5103
5105 SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN;
5106
5107#if SDL_VERSION_ATLEAST(3, 4, 0)
5108
5109constexpr auto VERBOSE_BOOLEAN =
5110 SDL_PROP_GPU_DEVICE_CREATE_VERBOSE_BOOLEAN;
5111
5112#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5113
5114constexpr auto NAME_STRING =
5115 SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING;
5116
5117#if SDL_VERSION_ATLEAST(3, 4, 0)
5118
5120 SDL_PROP_GPU_DEVICE_CREATE_FEATURE_CLIP_DISTANCE_BOOLEAN;
5122
5124 SDL_PROP_GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN;
5127
5129 SDL_PROP_GPU_DEVICE_CREATE_FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN;
5130
5132 SDL_PROP_GPU_DEVICE_CREATE_FEATURE_ANISOTROPY_BOOLEAN;
5134
5135#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5136
5138 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN;
5140
5142 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOLEAN;
5143
5144constexpr auto SHADERS_DXBC_BOOLEAN =
5145 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOLEAN;
5146
5147constexpr auto SHADERS_DXIL_BOOLEAN =
5148 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN;
5149
5150constexpr auto SHADERS_MSL_BOOLEAN =
5151 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN;
5152
5154 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN;
5156
5157#if SDL_VERSION_ATLEAST(3, 4, 0)
5158
5160 SDL_PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN;
5166
5167#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5168
5170 SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING;
5172
5173#if SDL_VERSION_ATLEAST(3, 4, 2)
5174
5176 SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_VERSION_NUMBER;
5180
5182 SDL_PROP_GPU_DEVICE_CREATE_D3D12_AGILITY_SDK_PATH_STRING;
5185
5186#endif // SDL_VERSION_ATLEAST(3, 4, 2)
5187
5188#if SDL_VERSION_ATLEAST(3, 4, 0)
5189
5191 SDL_PROP_GPU_DEVICE_CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN;
5192
5194 SDL_PROP_GPU_DEVICE_CREATE_VULKAN_OPTIONS_POINTER;
5196
5197#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5198
5199#if SDL_VERSION_ATLEAST(3, 4, 2)
5200
5202 SDL_PROP_GPU_DEVICE_CREATE_METAL_ALLOW_MACFAMILY1_BOOLEAN;
5205
5206#endif // SDL_VERSION_ATLEAST(3, 4, 2)
5207
5208} // namespace prop::GPUDevice::Create
5209
5210#if SDL_VERSION_ATLEAST(3, 4, 0)
5211
5228using GPUVulkanOptions = SDL_GPUVulkanOptions;
5229
5230#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5231
5242{
5243 SDL_DestroyGPUDevice(device);
5244}
5245
5247
5257inline int GetNumGPUDrivers() { return SDL_GetNumGPUDrivers(); }
5258
5276inline const char* GetGPUDriver(int index) { return SDL_GetGPUDriver(index); }
5277
5286inline const char* GetGPUDeviceDriver(GPUDeviceRef device)
5287{
5288 return SDL_GetGPUDeviceDriver(device);
5289}
5290
5291inline const char* GPUDeviceBase::GetDriver()
5292{
5293 return SDL::GetGPUDeviceDriver(get());
5294}
5295
5306{
5307 return SDL_GetGPUShaderFormats(device);
5308}
5309
5314
5315#if SDL_VERSION_ATLEAST(3, 4, 0)
5316
5419{
5420 return CheckError(SDL_GetGPUDeviceProperties(device));
5421}
5422
5427
5440namespace prop::GPUDevice {
5441
5442constexpr auto NAME_STRING =
5443 SDL_PROP_GPU_DEVICE_NAME_STRING;
5444
5445constexpr auto DRIVER_NAME_STRING =
5446 SDL_PROP_GPU_DEVICE_DRIVER_NAME_STRING;
5447
5449 SDL_PROP_GPU_DEVICE_DRIVER_VERSION_STRING;
5450
5451constexpr auto DRIVER_INFO_STRING =
5452 SDL_PROP_GPU_DEVICE_DRIVER_INFO_STRING;
5453
5454} // namespace prop::GPUDevice
5455
5456#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5457
5504 GPUDeviceRef device,
5505 const GPUComputePipelineCreateInfo& createinfo)
5506{
5507 return GPUComputePipeline(device, createinfo);
5508}
5509
5511 const GPUComputePipelineCreateInfo& createinfo)
5512{
5513 return GPUComputePipeline(get(), createinfo);
5514}
5515
5517 GPUDeviceRef device,
5518 const GPUComputePipelineCreateInfo& createinfo)
5519 : m_gPUComputePipeline(
5520 CheckError(SDL_CreateGPUComputePipeline(device, &createinfo)))
5521{
5522}
5523
5530
5531constexpr auto NAME_STRING =
5532 SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING;
5533
5534} // namespace prop::GPUComputePipeline::Create
5535
5558 GPUDeviceRef device,
5559 const GPUGraphicsPipelineCreateInfo& createinfo)
5560{
5561 return GPUGraphicsPipeline(device, createinfo);
5562}
5563
5565 const GPUGraphicsPipelineCreateInfo& createinfo)
5566{
5567 return GPUGraphicsPipeline(get(), createinfo);
5568}
5569
5571 GPUDeviceRef device,
5572 const GPUGraphicsPipelineCreateInfo& createinfo)
5573 : m_gPUGraphicsPipeline(
5574 CheckError(SDL_CreateGPUGraphicsPipeline(device, &createinfo)))
5575{
5576}
5577
5584
5585constexpr auto NAME_STRING =
5586 SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING;
5587
5588} // namespace prop::GPUGraphicsPipeline::Create
5589
5612 const GPUSamplerCreateInfo& createinfo)
5613{
5614 return GPUSampler(device, createinfo);
5615}
5616
5618 const GPUSamplerCreateInfo& createinfo)
5619{
5620 return GPUSampler(get(), createinfo);
5621}
5622
5624 const GPUSamplerCreateInfo& createinfo)
5625 : m_gPUSampler(CheckError(SDL_CreateGPUSampler(device, &createinfo)))
5626{
5627}
5628
5635
5636constexpr auto NAME_STRING =
5637 SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING;
5638
5639} // namespace prop::GPUSampler::Create
5640
5713 const GPUShaderCreateInfo& createinfo)
5714{
5715 return GPUShader(device, createinfo);
5716}
5717
5719 const GPUShaderCreateInfo& createinfo)
5720{
5721 return GPUShader(get(), createinfo);
5722}
5723
5725 const GPUShaderCreateInfo& createinfo)
5726 : m_gPUShader(CheckError(SDL_CreateGPUShader(device, &createinfo)))
5727{
5728}
5729
5736
5737constexpr auto NAME_STRING =
5738 SDL_PROP_GPU_SHADER_CREATE_NAME_STRING;
5739
5740} // namespace prop::GPUShader::Create
5741
5801 const GPUTextureCreateInfo& createinfo)
5802{
5803 return GPUTexture(device, createinfo);
5804}
5805
5807 const GPUTextureCreateInfo& createinfo)
5808{
5809 return GPUTexture(get(), createinfo);
5810}
5811
5813 const GPUTextureCreateInfo& createinfo)
5814 : m_gPUTexture(CheckError(SDL_CreateGPUTexture(device, &createinfo)))
5815{
5816}
5817
5824
5825constexpr auto D3D12_CLEAR_R_FLOAT =
5826 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT;
5827
5828constexpr auto D3D12_CLEAR_G_FLOAT =
5829 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT;
5830
5831constexpr auto D3D12_CLEAR_B_FLOAT =
5832 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT;
5833
5834constexpr auto D3D12_CLEAR_A_FLOAT =
5835 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT;
5836
5838 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT;
5840
5841#if SDL_VERSION_ATLEAST(3, 2, 12)
5842
5844 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_NUMBER;
5846
5847#endif // SDL_VERSION_ATLEAST(3, 2, 12)
5848
5849constexpr auto NAME_STRING =
5850 SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING;
5851
5852} // namespace prop::GPUTexture::Create
5853
5898 const GPUBufferCreateInfo& createinfo)
5899{
5900 return GPUBuffer(device, createinfo);
5901}
5902
5904 const GPUBufferCreateInfo& createinfo)
5905{
5906 return GPUBuffer(get(), createinfo);
5907}
5908
5910 const GPUBufferCreateInfo& createinfo)
5911 : m_gPUBuffer(CheckError(SDL_CreateGPUBuffer(device, &createinfo)))
5912{
5913}
5914
5921
5922constexpr auto NAME_STRING =
5923 SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING;
5924
5925} // namespace prop::GPUBuffer::Create
5926
5955 GPUDeviceRef device,
5956 const GPUTransferBufferCreateInfo& createinfo)
5957{
5958 return GPUTransferBuffer(device, createinfo);
5959}
5960
5962 const GPUTransferBufferCreateInfo& createinfo)
5963{
5964 return GPUTransferBuffer(get(), createinfo);
5965}
5966
5968 GPUDeviceRef device,
5969 const GPUTransferBufferCreateInfo& createinfo)
5970 : m_gPUTransferBuffer(
5971 CheckError(SDL_CreateGPUTransferBuffer(device, &createinfo)))
5972{
5973}
5974
5981
5982constexpr auto NAME_STRING =
5983 SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING;
5984
5985} // namespace prop::GPUTransferBuffer::Create
5986
6005 GPUBuffer buffer,
6006 StringParam text)
6007{
6008 SDL_SetGPUBufferName(device, buffer, text);
6009}
6010
6012{
6013 SDL::SetGPUBufferName(get(), buffer, text);
6014}
6015
6034 GPUTexture texture,
6035 StringParam text)
6036{
6037 SDL_SetGPUTextureName(device, texture, text);
6038}
6039
6041{
6042 SDL::SetGPUTextureName(get(), texture, text);
6043}
6044
6060inline void InsertGPUDebugLabel(GPUCommandBuffer command_buffer,
6061 StringParam text)
6062{
6063 SDL_InsertGPUDebugLabel(command_buffer, text);
6064}
6065
6067{
6068 SDL::InsertGPUDebugLabel(m_gPUCommandBuffer, text);
6069}
6070
6097inline void PushGPUDebugGroup(GPUCommandBuffer command_buffer, StringParam name)
6098{
6099 SDL_PushGPUDebugGroup(command_buffer, name);
6100}
6101
6103{
6104 SDL::PushGPUDebugGroup(m_gPUCommandBuffer, name);
6105}
6106
6121inline void PopGPUDebugGroup(GPUCommandBuffer command_buffer)
6122{
6123 SDL_PopGPUDebugGroup(command_buffer);
6124}
6125
6127{
6128 SDL::PopGPUDebugGroup(m_gPUCommandBuffer);
6129}
6130
6141inline void ReleaseGPUTexture(GPUDeviceRef device, GPUTexture texture)
6142{
6143 SDL_ReleaseGPUTexture(device, texture);
6144}
6145
6147{
6148 SDL::ReleaseGPUTexture(get(), texture);
6149}
6150
6161inline void ReleaseGPUSampler(GPUDeviceRef device, GPUSampler sampler)
6162{
6163 SDL_ReleaseGPUSampler(device, sampler);
6164}
6165
6167{
6168 SDL::ReleaseGPUSampler(get(), sampler);
6169}
6170
6181inline void ReleaseGPUBuffer(GPUDeviceRef device, GPUBuffer buffer)
6182{
6183 SDL_ReleaseGPUBuffer(device, buffer);
6184}
6185
6187{
6188 SDL::ReleaseGPUBuffer(get(), buffer);
6189}
6190
6202 GPUTransferBuffer transfer_buffer)
6203{
6204 SDL_ReleaseGPUTransferBuffer(device, transfer_buffer);
6205}
6206
6208 GPUTransferBuffer transfer_buffer)
6209{
6210 SDL::ReleaseGPUTransferBuffer(get(), transfer_buffer);
6211}
6212
6224 GPUComputePipeline compute_pipeline)
6225{
6226 SDL_ReleaseGPUComputePipeline(device, compute_pipeline);
6227}
6228
6230 GPUComputePipeline compute_pipeline)
6231{
6232 SDL::ReleaseGPUComputePipeline(get(), compute_pipeline);
6233}
6234
6245inline void ReleaseGPUShader(GPUDeviceRef device, GPUShader shader)
6246{
6247 SDL_ReleaseGPUShader(device, shader);
6248}
6249
6251{
6252 SDL::ReleaseGPUShader(get(), shader);
6253}
6254
6266 GPUGraphicsPipeline graphics_pipeline)
6267{
6268 SDL_ReleaseGPUGraphicsPipeline(device, graphics_pipeline);
6269}
6270
6272 GPUGraphicsPipeline graphics_pipeline)
6273{
6274 SDL::ReleaseGPUGraphicsPipeline(get(), graphics_pipeline);
6275}
6276
6302{
6303 return CheckError(SDL_AcquireGPUCommandBuffer(device));
6304}
6305
6310
6330 Uint32 slot_index,
6331 SourceBytes data)
6332{
6333 SDL_PushGPUVertexUniformData(
6334 command_buffer, slot_index, data.data(), narrowU32(data.size_bytes()));
6335}
6336
6338 SourceBytes data)
6339{
6341 m_gPUCommandBuffer, slot_index, std::move(data));
6342}
6343
6360 Uint32 slot_index,
6361 SourceBytes data)
6362{
6363 SDL_PushGPUFragmentUniformData(
6364 command_buffer, slot_index, data.data(), narrowU32(data.size_bytes()));
6365}
6366
6368 SourceBytes data)
6369{
6371 m_gPUCommandBuffer, slot_index, std::move(data));
6372}
6373
6390 Uint32 slot_index,
6391 SourceBytes data)
6392{
6393 SDL_PushGPUComputeUniformData(
6394 command_buffer, slot_index, data.data(), narrowU32(data.size_bytes()));
6395}
6396
6398 SourceBytes data)
6399{
6401 m_gPUCommandBuffer, slot_index, std::move(data));
6402}
6403
6436 GPUCommandBuffer command_buffer,
6437 std::span<const GPUColorTargetInfo> color_target_infos,
6438 OptionalRef<const GPUDepthStencilTargetInfo> depth_stencil_target_info)
6439{
6440 return SDL_BeginGPURenderPass(command_buffer,
6441 color_target_infos.data(),
6442 narrowU32(color_target_infos.size()),
6443 depth_stencil_target_info);
6444}
6445
6447 std::span<const GPUColorTargetInfo> color_target_infos,
6448 OptionalRef<const GPUDepthStencilTargetInfo> depth_stencil_target_info)
6449{
6451 m_gPUCommandBuffer, color_target_infos, depth_stencil_target_info);
6452}
6453
6465 GPUGraphicsPipeline graphics_pipeline)
6466{
6467 SDL_BindGPUGraphicsPipeline(render_pass, graphics_pipeline);
6468}
6469
6471{
6472 SDL::BindGPUGraphicsPipeline(m_gPURenderPass, graphics_pipeline);
6473}
6474
6483inline void SetGPUViewport(GPURenderPass render_pass,
6484 const GPUViewport& viewport)
6485{
6486 SDL_SetGPUViewport(render_pass, &viewport);
6487}
6488
6489inline void GPURenderPass::SetViewport(const GPUViewport& viewport)
6490{
6491 SDL::SetGPUViewport(m_gPURenderPass, viewport);
6492}
6493
6502inline void SetGPUScissor(GPURenderPass render_pass, const RectRaw& scissor)
6503{
6504 SDL_SetGPUScissor(render_pass, &scissor);
6505}
6506
6507inline void GPURenderPass::SetScissor(const RectRaw& scissor)
6508{
6509 SDL::SetGPUScissor(m_gPURenderPass, scissor);
6510}
6511
6523inline void SetGPUBlendConstants(GPURenderPass render_pass,
6524 FColorRaw blend_constants)
6525{
6526 SDL_SetGPUBlendConstants(render_pass, blend_constants);
6527}
6528
6530{
6531 SDL::SetGPUBlendConstants(m_gPURenderPass, blend_constants);
6532}
6533
6542inline void SetGPUStencilReference(GPURenderPass render_pass, Uint8 reference)
6543{
6544 SDL_SetGPUStencilReference(render_pass, reference);
6545}
6546
6548{
6549 SDL::SetGPUStencilReference(m_gPURenderPass, reference);
6550}
6551
6562inline void BindGPUVertexBuffers(GPURenderPass render_pass,
6563 Uint32 first_slot,
6564 std::span<const GPUBufferBinding> bindings)
6565{
6566 SDL_BindGPUVertexBuffers(
6567 render_pass, first_slot, bindings.data(), narrowU32(bindings.size()));
6568}
6569
6571 Uint32 first_slot,
6572 std::span<const GPUBufferBinding> bindings)
6573{
6574 SDL::BindGPUVertexBuffers(m_gPURenderPass, first_slot, bindings);
6575}
6576
6587inline void BindGPUIndexBuffer(GPURenderPass render_pass,
6588 const GPUBufferBinding& binding,
6589 GPUIndexElementSize index_element_size)
6590{
6591 SDL_BindGPUIndexBuffer(render_pass, &binding, index_element_size);
6592}
6593
6595 const GPUBufferBinding& binding,
6596 GPUIndexElementSize index_element_size)
6597{
6598 SDL::BindGPUIndexBuffer(m_gPURenderPass, binding, index_element_size);
6599}
6600
6621 GPURenderPass render_pass,
6622 Uint32 first_slot,
6623 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
6624{
6625 SDL_BindGPUVertexSamplers(render_pass,
6626 first_slot,
6627 texture_sampler_bindings.data(),
6628 narrowU32(texture_sampler_bindings.size()));
6629}
6630
6632 Uint32 first_slot,
6633 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
6634{
6636 m_gPURenderPass, first_slot, texture_sampler_bindings);
6637}
6638
6660 GPURenderPass render_pass,
6661 Uint32 first_slot,
6662 SpanRef<const GPUTextureRaw> storage_textures)
6663{
6664 SDL_BindGPUVertexStorageTextures(render_pass,
6665 first_slot,
6666 storage_textures.data(),
6667 narrowU32(storage_textures.size()));
6668}
6669
6671 Uint32 first_slot,
6672 SpanRef<const GPUTextureRaw> storage_textures)
6673{
6675 m_gPURenderPass, first_slot, storage_textures);
6676}
6677
6696 GPURenderPass render_pass,
6697 Uint32 first_slot,
6698 SpanRef<const GPUBufferRaw> storage_buffers)
6699{
6700 SDL_BindGPUVertexStorageBuffers(render_pass,
6701 first_slot,
6702 storage_buffers.data(),
6703 narrowU32(storage_buffers.size()));
6704}
6705
6707 Uint32 first_slot,
6708 SpanRef<const GPUBufferRaw> storage_buffers)
6709{
6711 m_gPURenderPass, first_slot, storage_buffers);
6712}
6713
6734 GPURenderPass render_pass,
6735 Uint32 first_slot,
6736 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
6737{
6738 SDL_BindGPUFragmentSamplers(render_pass,
6739 first_slot,
6740 texture_sampler_bindings.data(),
6741 narrowU32(texture_sampler_bindings.size()));
6742}
6743
6745 Uint32 first_slot,
6746 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
6747{
6749 m_gPURenderPass, first_slot, texture_sampler_bindings);
6750}
6751
6773 GPURenderPass render_pass,
6774 Uint32 first_slot,
6775 SpanRef<const GPUTextureRaw> storage_textures)
6776{
6777 SDL_BindGPUFragmentStorageTextures(render_pass,
6778 first_slot,
6779 storage_textures.data(),
6780 narrowU32(storage_textures.size()));
6781}
6782
6784 Uint32 first_slot,
6785 SpanRef<const GPUTextureRaw> storage_textures)
6786{
6788 m_gPURenderPass, first_slot, storage_textures);
6789}
6790
6809 GPURenderPass render_pass,
6810 Uint32 first_slot,
6811 SpanRef<const GPUBufferRaw> storage_buffers)
6812{
6813 SDL_BindGPUFragmentStorageBuffers(render_pass,
6814 first_slot,
6815 storage_buffers.data(),
6816 narrowU32(storage_buffers.size()));
6817}
6818
6820 Uint32 first_slot,
6821 SpanRef<const GPUBufferRaw> storage_buffers)
6822{
6824 m_gPURenderPass, first_slot, storage_buffers);
6825}
6826
6851 Uint32 num_indices,
6852 Uint32 num_instances,
6853 Uint32 first_index,
6854 Sint32 vertex_offset,
6855 Uint32 first_instance)
6856{
6857 SDL_DrawGPUIndexedPrimitives(render_pass,
6858 num_indices,
6859 num_instances,
6860 first_index,
6861 vertex_offset,
6862 first_instance);
6863}
6864
6866 Uint32 num_instances,
6867 Uint32 first_index,
6868 Sint32 vertex_offset,
6869 Uint32 first_instance)
6870{
6871 SDL::DrawGPUIndexedPrimitives(m_gPURenderPass,
6872 num_indices,
6873 num_instances,
6874 first_index,
6875 vertex_offset,
6876 first_instance);
6877}
6878
6899inline void DrawGPUPrimitives(GPURenderPass render_pass,
6900 Uint32 num_vertices,
6901 Uint32 num_instances,
6902 Uint32 first_vertex,
6903 Uint32 first_instance)
6904{
6905 SDL_DrawGPUPrimitives(
6906 render_pass, num_vertices, num_instances, first_vertex, first_instance);
6907}
6908
6909inline void GPURenderPass::DrawPrimitives(Uint32 num_vertices,
6910 Uint32 num_instances,
6911 Uint32 first_vertex,
6912 Uint32 first_instance)
6913{
6915 m_gPURenderPass, num_vertices, num_instances, first_vertex, first_instance);
6916}
6917
6935 GPUBuffer buffer,
6936 Uint32 offset,
6937 Uint32 draw_count)
6938{
6939 SDL_DrawGPUPrimitivesIndirect(render_pass, buffer, offset, draw_count);
6940}
6941
6943 Uint32 offset,
6944 Uint32 draw_count)
6945{
6946 SDL::DrawGPUPrimitivesIndirect(m_gPURenderPass, buffer, offset, draw_count);
6947}
6948
6966 GPUBuffer buffer,
6967 Uint32 offset,
6968 Uint32 draw_count)
6969{
6970 SDL_DrawGPUIndexedPrimitivesIndirect(render_pass, buffer, offset, draw_count);
6971}
6972
6974 Uint32 offset,
6975 Uint32 draw_count)
6976{
6978 m_gPURenderPass, buffer, offset, draw_count);
6979}
6980
6991inline void EndGPURenderPass(GPURenderPass render_pass)
6992{
6993 SDL_EndGPURenderPass(render_pass);
6994}
6995
6996inline void GPURenderPass::End() { SDL::EndGPURenderPass(m_gPURenderPass); }
6997
7032 GPUCommandBuffer command_buffer,
7033 std::span<const GPUStorageTextureReadWriteBinding> storage_texture_bindings,
7034 std::span<const GPUStorageBufferReadWriteBinding> storage_buffer_bindings)
7035{
7036 return SDL_BeginGPUComputePass(command_buffer,
7037 storage_texture_bindings.data(),
7038 narrowU32(storage_texture_bindings.size()),
7039 storage_buffer_bindings.data(),
7040 narrowU32(storage_buffer_bindings.size()));
7041}
7042
7044 std::span<const GPUStorageTextureReadWriteBinding> storage_texture_bindings,
7045 std::span<const GPUStorageBufferReadWriteBinding> storage_buffer_bindings)
7046{
7048 m_gPUCommandBuffer, storage_texture_bindings, storage_buffer_bindings);
7049}
7050
7060 GPUComputePipeline compute_pipeline)
7061{
7062 SDL_BindGPUComputePipeline(compute_pass, compute_pipeline);
7063}
7064
7066{
7067 SDL::BindGPUComputePipeline(m_gPUComputePass, compute_pipeline);
7068}
7069
7090 GPUComputePass compute_pass,
7091 Uint32 first_slot,
7092 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
7093{
7094 SDL_BindGPUComputeSamplers(compute_pass,
7095 first_slot,
7096 texture_sampler_bindings.data(),
7097 narrowU32(texture_sampler_bindings.size()));
7098}
7099
7101 Uint32 first_slot,
7102 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
7103{
7105 m_gPUComputePass, first_slot, texture_sampler_bindings);
7106}
7107
7129 GPUComputePass compute_pass,
7130 Uint32 first_slot,
7131 SpanRef<const GPUTextureRaw> storage_textures)
7132{
7133 SDL_BindGPUComputeStorageTextures(compute_pass,
7134 first_slot,
7135 storage_textures.data(),
7136 narrowU32(storage_textures.size()));
7137}
7138
7140 Uint32 first_slot,
7141 SpanRef<const GPUTextureRaw> storage_textures)
7142{
7144 m_gPUComputePass, first_slot, storage_textures);
7145}
7146
7165 GPUComputePass compute_pass,
7166 Uint32 first_slot,
7167 SpanRef<const GPUBufferRaw> storage_buffers)
7168{
7169 SDL_BindGPUComputeStorageBuffers(compute_pass,
7170 first_slot,
7171 storage_buffers.data(),
7172 narrowU32(storage_buffers.size()));
7173}
7174
7176 Uint32 first_slot,
7177 SpanRef<const GPUBufferRaw> storage_buffers)
7178{
7180 m_gPUComputePass, first_slot, storage_buffers);
7181}
7182
7203inline void DispatchGPUCompute(GPUComputePass compute_pass,
7204 Uint32 groupcount_x,
7205 Uint32 groupcount_y,
7206 Uint32 groupcount_z)
7207{
7208 SDL_DispatchGPUCompute(
7209 compute_pass, groupcount_x, groupcount_y, groupcount_z);
7210}
7211
7212inline void GPUComputePass::Dispatch(Uint32 groupcount_x,
7213 Uint32 groupcount_y,
7214 Uint32 groupcount_z)
7215{
7217 m_gPUComputePass, groupcount_x, groupcount_y, groupcount_z);
7218}
7219
7238 GPUBuffer buffer,
7239 Uint32 offset)
7240{
7241 SDL_DispatchGPUComputeIndirect(compute_pass, buffer, offset);
7242}
7243
7245{
7246 SDL::DispatchGPUComputeIndirect(m_gPUComputePass, buffer, offset);
7247}
7248
7259inline void EndGPUComputePass(GPUComputePass compute_pass)
7260{
7261 SDL_EndGPUComputePass(compute_pass);
7262}
7263
7264inline void GPUComputePass::End() { SDL::EndGPUComputePass(m_gPUComputePass); }
7265
7282 GPUTransferBuffer transfer_buffer,
7283 bool cycle)
7284{
7285 return CheckError(SDL_MapGPUTransferBuffer(device, transfer_buffer, cycle));
7286}
7287
7289 bool cycle)
7290{
7291 return SDL::MapGPUTransferBuffer(get(), transfer_buffer, cycle);
7292}
7293
7303 GPUTransferBuffer transfer_buffer)
7304{
7305 SDL_UnmapGPUTransferBuffer(device, transfer_buffer);
7306}
7307
7309 GPUTransferBuffer transfer_buffer)
7310{
7311 SDL::UnmapGPUTransferBuffer(get(), transfer_buffer);
7312}
7313
7329{
7330 return SDL_BeginGPUCopyPass(command_buffer);
7331}
7332
7334{
7335 return SDL::BeginGPUCopyPass(m_gPUCommandBuffer);
7336}
7337
7355inline void UploadToGPUTexture(GPUCopyPass copy_pass,
7356 const GPUTextureTransferInfo& source,
7357 const GPUTextureRegion& destination,
7358 bool cycle)
7359{
7360 SDL_UploadToGPUTexture(copy_pass, &source, &destination, cycle);
7361}
7362
7364 const GPUTextureRegion& destination,
7365 bool cycle)
7366{
7367 SDL::UploadToGPUTexture(m_gPUCopyPass, source, destination, cycle);
7368}
7369
7384inline void UploadToGPUBuffer(GPUCopyPass copy_pass,
7385 const GPUTransferBufferLocation& source,
7386 const GPUBufferRegion& destination,
7387 bool cycle)
7388{
7389 SDL_UploadToGPUBuffer(copy_pass, &source, &destination, cycle);
7390}
7391
7393 const GPUBufferRegion& destination,
7394 bool cycle)
7395{
7396 SDL::UploadToGPUBuffer(m_gPUCopyPass, source, destination, cycle);
7397}
7398
7420 const GPUTextureLocation& source,
7421 const GPUTextureLocation& destination,
7422 Uint32 w,
7423 Uint32 h,
7424 Uint32 d,
7425 bool cycle)
7426{
7427 SDL_CopyGPUTextureToTexture(copy_pass, &source, &destination, w, h, d, cycle);
7428}
7429
7431 const GPUTextureLocation& source,
7432 const GPUTextureLocation& destination,
7433 Uint32 w,
7434 Uint32 h,
7435 Uint32 d,
7436 bool cycle)
7437{
7439 m_gPUCopyPass, source, destination, w, h, d, cycle);
7440}
7441
7458 const GPUBufferLocation& source,
7459 const GPUBufferLocation& destination,
7460 Uint32 size,
7461 bool cycle)
7462{
7463 SDL_CopyGPUBufferToBuffer(copy_pass, &source, &destination, size, cycle);
7464}
7465
7467 const GPUBufferLocation& source,
7468 const GPUBufferLocation& destination,
7469 Uint32 size,
7470 bool cycle)
7471{
7472 SDL::CopyGPUBufferToBuffer(m_gPUCopyPass, source, destination, size, cycle);
7473}
7474
7489 const GPUTextureRegion& source,
7490 const GPUTextureTransferInfo& destination)
7491{
7492 SDL_DownloadFromGPUTexture(copy_pass, &source, &destination);
7493}
7494
7496 const GPUTextureRegion& source,
7497 const GPUTextureTransferInfo& destination)
7498{
7499 SDL::DownloadFromGPUTexture(m_gPUCopyPass, source, destination);
7500}
7501
7515 const GPUBufferRegion& source,
7516 const GPUTransferBufferLocation& destination)
7517{
7518 SDL_DownloadFromGPUBuffer(copy_pass, &source, &destination);
7519}
7520
7522 const GPUBufferRegion& source,
7523 const GPUTransferBufferLocation& destination)
7524{
7525 SDL::DownloadFromGPUBuffer(m_gPUCopyPass, source, destination);
7526}
7527
7535inline void EndGPUCopyPass(GPUCopyPass copy_pass)
7536{
7537 SDL_EndGPUCopyPass(copy_pass);
7538}
7539
7540inline void GPUCopyPass::End() { SDL::EndGPUCopyPass(m_gPUCopyPass); }
7541
7553 GPUTexture texture)
7554{
7555 SDL_GenerateMipmapsForGPUTexture(command_buffer, texture);
7556}
7557
7559{
7560 SDL::GenerateMipmapsForGPUTexture(m_gPUCommandBuffer, texture);
7561}
7562
7573inline void BlitGPUTexture(GPUCommandBuffer command_buffer,
7574 const GPUBlitInfo& info)
7575{
7576 SDL_BlitGPUTexture(command_buffer, &info);
7577}
7578
7580{
7581 SDL::BlitGPUTexture(m_gPUCommandBuffer, info);
7582}
7583
7599 GPUDeviceRef device,
7600 WindowRef window,
7601 GPUSwapchainComposition swapchain_composition)
7602{
7603 return SDL_WindowSupportsGPUSwapchainComposition(
7604 device, window, swapchain_composition);
7605}
7606
7608 WindowRef window,
7609 GPUSwapchainComposition swapchain_composition)
7610{
7612 get(), window, swapchain_composition);
7613}
7614
7630 WindowRef window,
7631 GPUPresentMode present_mode)
7632{
7633 return SDL_WindowSupportsGPUPresentMode(device, window, present_mode);
7634}
7635
7637 WindowRef window,
7638 GPUPresentMode present_mode)
7639{
7640 return SDL::WindowSupportsGPUPresentMode(get(), window, present_mode);
7641}
7642
7669{
7670 CheckError(SDL_ClaimWindowForGPUDevice(device, window));
7671}
7672
7674{
7676}
7677
7689{
7690 SDL_ReleaseWindowFromGPUDevice(device, window);
7691}
7692
7694{
7696}
7697
7721 GPUDeviceRef device,
7722 WindowRef window,
7723 GPUSwapchainComposition swapchain_composition,
7724 GPUPresentMode present_mode)
7725{
7726 return SDL_SetGPUSwapchainParameters(
7727 device, window, swapchain_composition, present_mode);
7728}
7729
7731 WindowRef window,
7732 GPUSwapchainComposition swapchain_composition,
7733 GPUPresentMode present_mode)
7734{
7736 get(), window, swapchain_composition, present_mode);
7737}
7738
7765 Uint32 allowed_frames_in_flight)
7766{
7767 return SDL_SetGPUAllowedFramesInFlight(device, allowed_frames_in_flight);
7768}
7769
7771 Uint32 allowed_frames_in_flight)
7772{
7773 return SDL::SetGPUAllowedFramesInFlight(get(), allowed_frames_in_flight);
7774}
7775
7788 WindowRef window)
7789{
7790 return SDL_GetGPUSwapchainTextureFormat(device, window);
7791}
7792
7798
7846 GPUCommandBuffer command_buffer,
7847 WindowRef window,
7848 Uint32* swapchain_texture_width = nullptr,
7849 Uint32* swapchain_texture_height = nullptr)
7850{
7851 GPUTextureRaw texture;
7852 CheckError(SDL_AcquireGPUSwapchainTexture(command_buffer,
7853 window,
7854 &texture,
7855 swapchain_texture_width,
7856 swapchain_texture_height));
7857 return texture;
7858}
7859
7861 WindowRef window,
7862 Uint32* swapchain_texture_width,
7863 Uint32* swapchain_texture_height)
7864{
7865 return SDL::AcquireGPUSwapchainTexture(m_gPUCommandBuffer,
7866 window,
7867 swapchain_texture_width,
7868 swapchain_texture_height);
7869}
7870
7887inline void WaitForGPUSwapchain(GPUDeviceRef device, WindowRef window)
7888{
7889 CheckError(SDL_WaitForGPUSwapchain(device, window));
7890}
7891
7893{
7894 SDL::WaitForGPUSwapchain(get(), window);
7895}
7896
7938 GPUCommandBuffer command_buffer,
7939 WindowRef window,
7940 Uint32* swapchain_texture_width = nullptr,
7941 Uint32* swapchain_texture_height = nullptr)
7942{
7943 GPUTextureRaw texture;
7944 CheckError(SDL_WaitAndAcquireGPUSwapchainTexture(command_buffer,
7945 window,
7946 &texture,
7947 swapchain_texture_width,
7948 swapchain_texture_height));
7949 return texture;
7950}
7951
7953 WindowRef window,
7954 Uint32* swapchain_texture_width,
7955 Uint32* swapchain_texture_height)
7956{
7957 return SDL::WaitAndAcquireGPUSwapchainTexture(m_gPUCommandBuffer,
7958 window,
7959 swapchain_texture_width,
7960 swapchain_texture_height);
7961}
7962
7983inline void SubmitGPUCommandBuffer(GPUCommandBuffer command_buffer)
7984{
7985 CheckError(SDL_SubmitGPUCommandBuffer(command_buffer));
7986}
7987
7989{
7990 SDL::SubmitGPUCommandBuffer(m_gPUCommandBuffer);
7991}
7992
8018 GPUCommandBuffer command_buffer)
8019{
8020 return CheckError(SDL_SubmitGPUCommandBufferAndAcquireFence(command_buffer));
8021}
8022
8027
8049inline void CancelGPUCommandBuffer(GPUCommandBuffer command_buffer)
8050{
8051 CheckError(SDL_CancelGPUCommandBuffer(command_buffer));
8052}
8053
8055{
8056 SDL::CancelGPUCommandBuffer(m_gPUCommandBuffer);
8057}
8058
8069inline void WaitForGPUIdle(GPUDeviceRef device)
8070{
8071 CheckError(SDL_WaitForGPUIdle(device));
8072}
8073
8075
8091 bool wait_all,
8092 std::span<GPUFence* const> fences)
8093{
8094 CheckError(SDL_WaitForGPUFences(
8095 device, wait_all, fences.data(), narrowU32(fences.size())));
8096}
8097
8098inline void GPUDeviceBase::WaitForFences(bool wait_all,
8099 std::span<GPUFence* const> fences)
8100{
8101 SDL::WaitForGPUFences(get(), wait_all, fences);
8102}
8103
8115inline bool QueryGPUFence(GPUDeviceRef device, GPUFence* fence)
8116{
8117 return SDL_QueryGPUFence(device, fence);
8118}
8119
8121{
8122 return SDL::QueryGPUFence(get(), fence);
8123}
8124
8137inline void ReleaseGPUFence(GPUDeviceRef device, GPUFence* fence)
8138{
8139 SDL_ReleaseGPUFence(device, fence);
8140}
8141
8143{
8144 SDL::ReleaseGPUFence(get(), fence);
8145}
8146
8158{
8159 return SDL_GPUTextureFormatTexelBlockSize(format);
8160}
8161
8174 GPUTextureFormat format,
8175 GPUTextureType type,
8177{
8178 return SDL_GPUTextureSupportsFormat(device, format, type, usage);
8179}
8180
8182 GPUTextureType type,
8184{
8185 return SDL::GPUTextureSupportsFormat(get(), format, type, usage);
8186}
8187
8199 GPUTextureFormat format,
8200 GPUSampleCount sample_count)
8201{
8202 return SDL_GPUTextureSupportsSampleCount(device, format, sample_count);
8203}
8204
8206 GPUTextureFormat format,
8207 GPUSampleCount sample_count)
8208{
8209 return SDL::GPUTextureSupportsSampleCount(get(), format, sample_count);
8210}
8211
8224 Uint32 width,
8225 Uint32 height,
8226 Uint32 depth_or_layer_count)
8227{
8228 return SDL_CalculateGPUTextureFormatSize(
8229 format, width, height, depth_or_layer_count);
8230}
8231
8232#if SDL_VERSION_ATLEAST(3, 4, 0)
8233
8244{
8245 return SDL_GetPixelFormatFromGPUTextureFormat(format);
8246}
8247
8258{
8259 return SDL_GetGPUTextureFormatFromPixelFormat(format);
8260}
8261
8262#endif // SDL_VERSION_ATLEAST(3, 4, 0)
8263
8264#ifdef SDL_PLATFORM_GDK
8265
8279inline void GDKSuspendGPU(GPUDeviceRef device) { SDL_GDKSuspendGPU(device); }
8280
8282
8296inline void GDKResumeGPU(GPUDeviceRef device) { SDL_GDKResumeGPU(device); }
8297
8299
8300#endif /* SDL_PLATFORM_GDK */
8301
8303
8304} // namespace SDL
8305
8306#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:2064
constexpr GPUCommandBuffer(GPUCommandBufferRaw gPUCommandBuffer={}) noexcept
Wraps GPUCommandBuffer.
Definition SDL3pp_gpu.h:2073
An opaque handle representing a compute pass.
Definition SDL3pp_gpu.h:1521
constexpr GPUComputePass(GPUComputePassRaw gPUComputePass={}) noexcept
Wraps GPUComputePass.
Definition SDL3pp_gpu.h:1530
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:1766
constexpr GPUCopyPass(GPUCopyPassRaw gPUCopyPass={}) noexcept
Wraps GPUCopyPass.
Definition SDL3pp_gpu.h:1775
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:5557
void ReleaseTexture(GPUTexture texture)
Frees the given texture as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6146
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UINT
GPU_VERTEXELEMENTFORMAT_UINT.
Definition SDL3pp_gpu.h:4334
SDL_GPUPresentMode GPUPresentMode
Specifies the timing that will be used to present swapchain textures to the OS.
Definition SDL3pp_gpu.h:2562
constexpr GPUShaderFormat GPU_SHADERFORMAT_DXIL
DXIL SM6_0 shaders for D3D12.
Definition SDL3pp_gpu.h:2489
void Dispatch(Uint32 groupcount_x, Uint32 groupcount_y, Uint32 groupcount_z)
Dispatches compute work.
Definition SDL3pp_gpu.h:7212
void PushComputeUniformData(Uint32 slot_index, SourceBytes data)
Pushes data to a uniform slot on the command buffer.
Definition SDL3pp_gpu.h:6397
void ReleaseComputePipeline(GPUComputePipeline compute_pipeline)
Frees the given compute pipeline as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6229
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_12x12_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_12x12_UNORM_SRGB.
Definition SDL3pp_gpu.h:2926
constexpr GPUFillMode GPU_FILLMODE_FILL
Polygons will be rendered via rasterization.
Definition SDL3pp_gpu.h:4438
SDL_GPUTransferBufferUsage GPUTransferBufferUsage
Specifies how a transfer buffer is intended to be used by the client.
Definition SDL3pp_gpu.h:4287
constexpr GPUShaderFormat GPU_SHADERFORMAT_PRIVATE
Shaders for NDA'd platforms.
Definition SDL3pp_gpu.h:2480
constexpr GPUCompareOp GPU_COMPAREOP_LESS_OR_EQUAL
The comparison evaluates reference <= test.
Definition SDL3pp_gpu.h:4503
constexpr GPUSwapchainComposition GPU_SWAPCHAINCOMPOSITION_HDR10_ST2084
GPU_SWAPCHAINCOMPOSITION_HDR10_ST2084.
Definition SDL3pp_gpu.h:2534
int GetNumGPUDrivers()
Get the number of GPU drivers compiled into SDL.
Definition SDL3pp_gpu.h:5257
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:6359
bool SetAllowedFramesInFlight(Uint32 allowed_frames_in_flight)
Configures the maximum allowed number of frames in flight.
Definition SDL3pp_gpu.h:7770
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:5087
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:6772
SDL_GPUCompareOp GPUCompareOp
Specifies a comparison operator for depth, stencil and sampler operations.
Definition SDL3pp_gpu.h:4489
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_6x6_FLOAT
GPU_TEXTUREFORMAT_ASTC_6x6_FLOAT.
Definition SDL3pp_gpu.h:2941
constexpr GPUStencilOp GPU_STENCILOP_ZERO
Sets the value to 0.
Definition SDL3pp_gpu.h:4536
void * MapTransferBuffer(GPUTransferBuffer transfer_buffer, bool cycle)
Maps a transfer buffer into application address space.
Definition SDL3pp_gpu.h:7288
constexpr GPUCompareOp GPU_COMPAREOP_ALWAYS
The comparison always evaluates true.
Definition SDL3pp_gpu.h:4517
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8_UNORM
GPU_TEXTUREFORMAT_R8_UNORM.
Definition SDL3pp_gpu.h:2662
SDL_GPUCullMode GPUCullMode
Specifies the facing direction in which triangle faces will be culled.
Definition SDL3pp_gpu.h:4451
constexpr GPUBlendOp GPU_BLENDOP_MIN
min(source, destination)
Definition SDL3pp_gpu.h:4587
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:6965
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_FLOAT2
GPU_VERTEXELEMENTFORMAT_FLOAT2.
Definition SDL3pp_gpu.h:4349
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:7419
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:2749
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE
Texture supports reads and writes in the same compute shader.
Definition SDL3pp_gpu.h:3044
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_USHORT2_NORM
GPU_VERTEXELEMENTFORMAT_USHORT2_NORM.
Definition SDL3pp_gpu.h:4400
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8_INT
GPU_TEXTUREFORMAT_R8G8_INT.
Definition SDL3pp_gpu.h:2788
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_6x6_UNORM
GPU_TEXTUREFORMAT_ASTC_6x6_UNORM.
Definition SDL3pp_gpu.h:2857
Uint32 GPUShaderFormat
Specifies the format of shader code.
Definition SDL3pp_gpu.h:2475
void ReleaseGPUShader(GPUDeviceRef device, GPUShader shader)
Frees the given shader as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6245
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16B16A16_INT
GPU_TEXTUREFORMAT_R16G16B16A16_INT.
Definition SDL3pp_gpu.h:2800
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_12x12_UNORM
GPU_TEXTUREFORMAT_ASTC_12x12_UNORM.
Definition SDL3pp_gpu.h:2884
void BlitGPUTexture(GPUCommandBuffer command_buffer, const GPUBlitInfo &info)
Blits from a source texture region to a destination texture region.
Definition SDL3pp_gpu.h:7573
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:8017
SDL_GPUCubeMapFace GPUCubeMapFace
Specifies the face of a cube map.
Definition SDL3pp_gpu.h:4214
SDL_GPUFence GPUFence
An opaque handle representing a fence.
Definition SDL3pp_gpu.h:2038
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_4x4_FLOAT
GPU_TEXTUREFORMAT_ASTC_4x4_FLOAT.
Definition SDL3pp_gpu.h:2929
constexpr GPUStencilOp GPU_STENCILOP_INVERT
Bitwise-inverts the current value.
Definition SDL3pp_gpu.h:4550
PixelFormat GetPixelFormatFromGPUTextureFormat(GPUTextureFormat format)
Get the SDL pixel format corresponding to a GPU texture format.
Definition SDL3pp_gpu.h:8243
constexpr GPUFrontFace GPU_FRONTFACE_CLOCKWISE
A triangle with clockwise vertex winding will be considered front-facing.
Definition SDL3pp_gpu.h:4480
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_D32_FLOAT
GPU_TEXTUREFORMAT_D32_FLOAT.
Definition SDL3pp_gpu.h:2836
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:4302
GPUSampler CreateSampler(const GPUSamplerCreateInfo &createinfo)
Creates a sampler object to be used when binding textures in a graphics workflow.
Definition SDL3pp_gpu.h:5617
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_FLOAT3
GPU_VERTEXELEMENTFORMAT_FLOAT3.
Definition SDL3pp_gpu.h:4352
constexpr GPUCompareOp GPU_COMPAREOP_GREATER_OR_EQUAL
The comparison evaluates reference >= test.
Definition SDL3pp_gpu.h:4513
SDL_GPUVertexAttribute GPUVertexAttribute
A structure specifying a vertex attribute.
Definition SDL3pp_gpu.h:4803
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x6_FLOAT
GPU_TEXTUREFORMAT_ASTC_8x6_FLOAT.
Definition SDL3pp_gpu.h:2947
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:6865
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UBYTE2
GPU_VERTEXELEMENTFORMAT_UBYTE2.
Definition SDL3pp_gpu.h:4364
SDL_GPUTextureFormat GPUTextureFormat
Specifies the pixel format of a texture.
Definition SDL3pp_gpu.h:2654
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:6659
constexpr GPUPrimitiveType GPU_PRIMITIVETYPE_LINELIST
A series of separate lines.
Definition SDL3pp_gpu.h:4142
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_USHORT4_NORM
GPU_VERTEXELEMENTFORMAT_USHORT4_NORM.
Definition SDL3pp_gpu.h:4403
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32_UINT
GPU_TEXTUREFORMAT_R32_UINT.
Definition SDL3pp_gpu.h:2776
void PushGPUDebugGroup(GPUCommandBuffer command_buffer, StringParam name)
Begins a debug group with an arbitrary name.
Definition SDL3pp_gpu.h:6097
GPUBuffer CreateBuffer(const GPUBufferCreateInfo &createinfo)
Creates a buffer object to be used in graphics or compute workflows.
Definition SDL3pp_gpu.h:5903
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x6_UNORM
GPU_TEXTUREFORMAT_ASTC_8x6_UNORM.
Definition SDL3pp_gpu.h:2863
SDL_GPUFillMode GPUFillMode
Specifies the fill mode of the graphics pipeline.
Definition SDL3pp_gpu.h:4436
void SetGPUViewport(GPURenderPass render_pass, const GPUViewport &viewport)
Sets the current viewport state on a command buffer.
Definition SDL3pp_gpu.h:6483
constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR
1 - blend constant
Definition SDL3pp_gpu.h:4640
PropertiesRef GetProperties()
Get the properties associated with a GPU device.
Definition SDL3pp_gpu.h:5423
void SetScissor(const RectRaw &scissor)
Sets the current scissor state on a command buffer.
Definition SDL3pp_gpu.h:6507
constexpr GPUCompareOp GPU_COMPAREOP_NOT_EQUAL
The comparison evaluates reference != test.
Definition SDL3pp_gpu.h:4510
SDL_GPUGraphicsPipelineTargetInfo GPUGraphicsPipelineTargetInfo
A structure specifying the descriptions of render targets used in a graphics pipeline.
Definition SDL3pp_gpu.h:4897
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_USHORT2
GPU_VERTEXELEMENTFORMAT_USHORT2.
Definition SDL3pp_gpu.h:4388
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16B16A16_UNORM
GPU_TEXTUREFORMAT_R16G16B16A16_UNORM.
Definition SDL3pp_gpu.h:2677
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:2770
SDL_GPUColorTargetInfo GPUColorTargetInfo
A structure specifying the parameters of a color target used by a render pass.
Definition SDL3pp_gpu.h:1943
void CancelGPUCommandBuffer(GPUCommandBuffer command_buffer)
Cancels a command buffer.
Definition SDL3pp_gpu.h:8049
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:2875
constexpr GPUPrimitiveType GPU_PRIMITIVETYPE_TRIANGLELIST
A series of separate triangles.
Definition SDL3pp_gpu.h:4136
bool QueryGPUFence(GPUDeviceRef device, GPUFence *fence)
Checks the status of a fence.
Definition SDL3pp_gpu.h:8115
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_A8_UNORM
GPU_TEXTUREFORMAT_A8_UNORM.
Definition SDL3pp_gpu.h:2659
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:6201
void * MapGPUTransferBuffer(GPUDeviceRef device, GPUTransferBuffer transfer_buffer, bool cycle)
Maps a transfer buffer into application address space.
Definition SDL3pp_gpu.h:7281
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_INT4
GPU_VERTEXELEMENTFORMAT_INT4.
Definition SDL3pp_gpu.h:4331
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:7937
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_5x5_FLOAT
GPU_TEXTUREFORMAT_ASTC_5x5_FLOAT.
Definition SDL3pp_gpu.h:2935
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32_FLOAT
GPU_TEXTUREFORMAT_R32_FLOAT.
Definition SDL3pp_gpu.h:2746
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:4197
GPUGraphicsPipeline CreateGraphicsPipeline(const GPUGraphicsPipelineCreateInfo &createinfo)
Creates a pipeline object to be used in a graphics workflow.
Definition SDL3pp_gpu.h:5564
constexpr GPUSamplerAddressMode GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE
Specifies that the coordinates will clamp to the 0-1 range.
Definition SDL3pp_gpu.h:4717
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16_UNORM
GPU_TEXTUREFORMAT_R16G16_UNORM.
Definition SDL3pp_gpu.h:2674
bool SetGPUAllowedFramesInFlight(GPUDeviceRef device, Uint32 allowed_frames_in_flight)
Configures the maximum allowed number of frames in flight.
Definition SDL3pp_gpu.h:7764
void ReleaseWindow(WindowRef window)
Unclaims a window, destroying its swapchain structure.
Definition SDL3pp_gpu.h:7693
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:6899
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x6_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_8x6_UNORM_SRGB.
Definition SDL3pp_gpu.h:2905
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:7100
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_6x5_FLOAT
GPU_TEXTUREFORMAT_ASTC_6x5_FLOAT.
Definition SDL3pp_gpu.h:2938
SDL_GPUTextureLocation GPUTextureLocation
A structure specifying a location in a texture.
Definition SDL3pp_gpu.h:1690
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC1_RGBA_UNORM
GPU_TEXTUREFORMAT_BC1_RGBA_UNORM.
Definition SDL3pp_gpu.h:2695
void BlitTexture(const GPUBlitInfo &info)
Blits from a source texture region to a destination texture region.
Definition SDL3pp_gpu.h:7579
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:7495
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:6744
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32G32_UINT
GPU_TEXTUREFORMAT_R32G32_UINT.
Definition SDL3pp_gpu.h:2779
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:6587
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC3_RGBA_UNORM
GPU_TEXTUREFORMAT_BC3_RGBA_UNORM.
Definition SDL3pp_gpu.h:2701
GPUShader CreateShader(const GPUShaderCreateInfo &createinfo)
Creates a shader to be used when creating a graphics pipeline.
Definition SDL3pp_gpu.h:5718
Uint32 GPUTextureFormatTexelBlockSize(GPUTextureFormat format)
Obtains the texel block size for a texture format.
Definition SDL3pp_gpu.h:8157
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ
Texture supports storage reads in graphics stages.
Definition SDL3pp_gpu.h:3027
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:7175
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_SHORT2
GPU_VERTEXELEMENTFORMAT_SHORT2.
Definition SDL3pp_gpu.h:4382
bool WindowSupportsPresentMode(WindowRef window, GPUPresentMode present_mode)
Determines whether a presentation mode is supported by the window.
Definition SDL3pp_gpu.h:7636
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8_SNORM
GPU_TEXTUREFORMAT_R8_SNORM.
Definition SDL3pp_gpu.h:2719
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:4572
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_SAMPLER
Texture supports sampling.
Definition SDL3pp_gpu.h:3017
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x8_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_10x8_UNORM_SRGB.
Definition SDL3pp_gpu.h:2917
void Cancel()
Cancels a command buffer.
Definition SDL3pp_gpu.h:8054
SDL_GPUStorageTextureReadWriteBinding GPUStorageTextureReadWriteBinding
A structure specifying parameters related to binding textures in a compute pass.
Definition SDL3pp_gpu.h:2002
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:7845
SDL_GPUColorTargetDescription GPUColorTargetDescription
A structure specifying the parameters of color targets used in a graphics pipeline.
Definition SDL3pp_gpu.h:4885
constexpr GPUColorComponentFlags GPU_COLORCOMPONENT_A
the alpha component
Definition SDL3pp_gpu.h:4665
constexpr GPUBufferUsageFlags GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE
Buffer supports storage writes in the compute stage.
Definition SDL3pp_gpu.h:4274
constexpr GPUSamplerMipmapMode GPU_SAMPLERMIPMAPMODE_LINEAR
Linear filtering.
Definition SDL3pp_gpu.h:4695
bool GPUTextureSupportsSampleCount(GPUDeviceRef device, GPUTextureFormat format, GPUSampleCount sample_count)
Determines if a sample count for a texture format is supported.
Definition SDL3pp_gpu.h:8198
constexpr GPUShaderFormat GPU_SHADERFORMAT_DXBC
DXBC SM5_1 shaders for D3D12.
Definition SDL3pp_gpu.h:2486
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x6_FLOAT
GPU_TEXTUREFORMAT_ASTC_10x6_FLOAT.
Definition SDL3pp_gpu.h:2956
void SetStencilReference(Uint8 reference)
Sets the current stencil reference value on a command buffer.
Definition SDL3pp_gpu.h:6547
bool WindowSupportsGPUSwapchainComposition(GPUDeviceRef device, WindowRef window, GPUSwapchainComposition swapchain_composition)
Determines whether a swapchain composition is supported by the window.
Definition SDL3pp_gpu.h:7598
void ReleaseFence(GPUFence *fence)
Releases a fence obtained from SubmitGPUCommandBufferAndAcquireFence.
Definition SDL3pp_gpu.h:8142
GPUShaderFormat GetGPUShaderFormats(GPUDeviceRef device)
Returns the supported shader formats for this GPU context.
Definition SDL3pp_gpu.h:5305
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R11G11B10_UFLOAT
GPU_TEXTUREFORMAT_R11G11B10_UFLOAT.
Definition SDL3pp_gpu.h:2755
GPUBuffer CreateGPUBuffer(GPUDeviceRef device, const GPUBufferCreateInfo &createinfo)
Creates a buffer object to be used in graphics or compute workflows.
Definition SDL3pp_gpu.h:5897
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_COLOR_TARGET
Texture is a color render target.
Definition SDL3pp_gpu.h:3020
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_INT
GPU_VERTEXELEMENTFORMAT_INT.
Definition SDL3pp_gpu.h:4322
GPUTextureFormat GetGPUTextureFormatFromPixelFormat(PixelFormat format)
Get the GPU texture format corresponding to an SDL pixel format.
Definition SDL3pp_gpu.h:8257
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:7860
constexpr GPUStencilOp GPU_STENCILOP_REPLACE
Sets the value to reference.
Definition SDL3pp_gpu.h:4539
SDL_GPUDepthStencilTargetInfo GPUDepthStencilTargetInfo
A structure specifying the parameters of a depth-stencil target used by a render pass.
Definition SDL3pp_gpu.h:1992
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16_INT
GPU_TEXTUREFORMAT_R16_INT.
Definition SDL3pp_gpu.h:2794
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT
GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT.
Definition SDL3pp_gpu.h:2839
void BindFragmentStorageTextures(Uint32 first_slot, SpanRef< const GPUTextureRaw > storage_textures)
Binds storage textures for use on the fragment shader.
Definition SDL3pp_gpu.h:6783
SDL_GPUTextureRegion GPUTextureRegion
A structure specifying a region of a texture.
Definition SDL3pp_gpu.h:1715
void UploadToBuffer(const GPUTransferBufferLocation &source, const GPUBufferRegion &destination, bool cycle)
Uploads data from a transfer buffer to a buffer.
Definition SDL3pp_gpu.h:7392
constexpr GPUBlendFactor GPU_BLENDFACTOR_DST_COLOR
destination color
Definition SDL3pp_gpu.h:4619
SDL_GPUTextureTransferInfo GPUTextureTransferInfo
A structure specifying parameters related to transferring data to or from a texture.
Definition SDL3pp_gpu.h:1739
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT
GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT.
Definition SDL3pp_gpu.h:2743
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:6631
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:6942
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_FLOAT4
GPU_VERTEXELEMENTFORMAT_FLOAT4.
Definition SDL3pp_gpu.h:4355
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x10_FLOAT
GPU_TEXTUREFORMAT_ASTC_10x10_FLOAT.
Definition SDL3pp_gpu.h:2962
void GDKSuspendGPU()
Call this to suspend GPU operation on Xbox when you receive the EVENT_DID_ENTER_BACKGROUND event.
Definition SDL3pp_gpu.h:8281
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_6x5_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_6x5_UNORM_SRGB.
Definition SDL3pp_gpu.h:2896
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:7333
SDL_GPUBufferRegion GPUBufferRegion
A structure specifying a region of a buffer.
Definition SDL3pp_gpu.h:1678
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x8_FLOAT
GPU_TEXTUREFORMAT_ASTC_10x8_FLOAT.
Definition SDL3pp_gpu.h:2959
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32G32_INT
GPU_TEXTUREFORMAT_R32G32_INT.
Definition SDL3pp_gpu.h:2806
void ReleaseGPUTexture(GPUDeviceRef device, GPUTexture texture)
Frees the given texture as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6141
constexpr GPUBlendOp GPU_BLENDOP_INVALID
GPU_BLENDOP_INVALID.
Definition SDL3pp_gpu.h:4574
GPUTextureFormat GetSwapchainTextureFormat(WindowRef window)
Obtains the texture format of the swapchain for the given window.
Definition SDL3pp_gpu.h:7793
constexpr GPUSwapchainComposition GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR
GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR.
Definition SDL3pp_gpu.h:2531
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:6435
void BindVertexStorageTextures(Uint32 first_slot, SpanRef< const GPUTextureRaw > storage_textures)
Binds storage textures for use on the vertex shader.
Definition SDL3pp_gpu.h:6670
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:6850
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:2567
constexpr GPUBufferUsageFlags GPU_BUFFERUSAGE_VERTEX
Buffer is a vertex buffer.
Definition SDL3pp_gpu.h:4256
GPUCommandBuffer AcquireGPUCommandBuffer(GPUDeviceRef device)
Acquire a command buffer.
Definition SDL3pp_gpu.h:6301
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8B8A8_UINT
GPU_TEXTUREFORMAT_R8G8B8A8_UINT.
Definition SDL3pp_gpu.h:2764
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:8173
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC4_R_UNORM
GPU_TEXTUREFORMAT_BC4_R_UNORM.
Definition SDL3pp_gpu.h:2704
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:6620
void WaitForGPUSwapchain(GPUDeviceRef device, WindowRef window)
Blocks the thread until a swapchain texture is available to be acquired.
Definition SDL3pp_gpu.h:7887
constexpr GPUBufferUsageFlags GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ
Buffer supports storage reads in graphics stages.
Definition SDL3pp_gpu.h:4265
constexpr GPUCubeMapFace GPU_CUBEMAPFACE_POSITIVEZ
GPU_CUBEMAPFACE_POSITIVEZ.
Definition SDL3pp_gpu.h:4228
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_4x4_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_4x4_UNORM_SRGB.
Definition SDL3pp_gpu.h:2887
Uint32 GPUBufferUsageFlags
Specifies how a buffer is intended to be used by the client.
Definition SDL3pp_gpu.h:4254
void DispatchIndirect(GPUBuffer buffer, Uint32 offset)
Dispatches compute work with parameters set from a buffer.
Definition SDL3pp_gpu.h:7244
SDL_GPUStorageBufferReadWriteBinding GPUStorageBufferReadWriteBinding
A structure specifying parameters related to binding buffers in a compute pass.
Definition SDL3pp_gpu.h:2012
constexpr GPUCompareOp GPU_COMPAREOP_EQUAL
The comparison evaluates reference == test.
Definition SDL3pp_gpu.h:4500
SDL_GPUIndexedIndirectDrawCommand GPUIndexedIndirectDrawCommand
A structure specifying the parameters of an indexed indirect draw command.
Definition SDL3pp_gpu.h:4760
void SetTextureName(GPUTexture texture, StringParam text)
Sets an arbitrary string constant to label a texture.
Definition SDL3pp_gpu.h:6040
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:6265
void SetViewport(const GPUViewport &viewport)
Sets the current viewport state on a command buffer.
Definition SDL3pp_gpu.h:6489
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_SHORT2_NORM
GPU_VERTEXELEMENTFORMAT_SHORT2_NORM.
Definition SDL3pp_gpu.h:4394
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_BYTE4
GPU_VERTEXELEMENTFORMAT_BYTE4.
Definition SDL3pp_gpu.h:4361
constexpr GPUSwapchainComposition GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR
GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR.
Definition SDL3pp_gpu.h:2528
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:4616
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:8181
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_B5G5R5A1_UNORM
GPU_TEXTUREFORMAT_B5G5R5A1_UNORM.
Definition SDL3pp_gpu.h:2686
void Submit()
Submits a command buffer so its commands can be processed on the GPU.
Definition SDL3pp_gpu.h:7988
void ReleaseWindowFromGPUDevice(GPUDeviceRef device, WindowRef window)
Unclaims a window, destroying its swapchain structure.
Definition SDL3pp_gpu.h:7688
constexpr GPUFilter GPU_FILTER_LINEAR
Linear filtering.
Definition SDL3pp_gpu.h:4680
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:7059
void ReleaseGPUSampler(GPUDeviceRef device, GPUSampler sampler)
Frees the given sampler as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6161
void BindFragmentStorageBuffers(Uint32 first_slot, SpanRef< const GPUBufferRaw > storage_buffers)
Binds storage buffers for use on the fragment shader.
Definition SDL3pp_gpu.h:6819
constexpr GPUBlendFactor GPU_BLENDFACTOR_CONSTANT_COLOR
blend constant
Definition SDL3pp_gpu.h:4637
constexpr GPUVertexInputRate GPU_VERTEXINPUTRATE_VERTEX
Attribute addressing is a function of the vertex index.
Definition SDL3pp_gpu.h:4422
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:4159
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8B8A8_UNORM
GPU_TEXTUREFORMAT_R8G8B8A8_UNORM.
Definition SDL3pp_gpu.h:2668
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:2791
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:7430
constexpr GPUTransferBufferUsage GPU_TRANSFERBUFFERUSAGE_UPLOAD
GPU_TRANSFERBUFFERUSAGE_UPLOAD.
Definition SDL3pp_gpu.h:4289
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:5611
SDL_GPUPrimitiveType GPUPrimitiveType
Specifies the primitive topology of a graphics pipeline.
Definition SDL3pp_gpu.h:4134
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:2752
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:4204
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16_SNORM
GPU_TEXTUREFORMAT_R16_SNORM.
Definition SDL3pp_gpu.h:2728
SDL_GPUStencilOp GPUStencilOp
Specifies what happens to a stored stencil value if stencil tests fail or pass.
Definition SDL3pp_gpu.h:4528
constexpr GPUPresentMode GPU_PRESENTMODE_VSYNC
GPU_PRESENTMODE_VSYNC.
Definition SDL3pp_gpu.h:2564
constexpr GPUSamplerAddressMode GPU_SAMPLERADDRESSMODE_REPEAT
Specifies that the coordinates will wrap around.
Definition SDL3pp_gpu.h:4708
Uint32 GPUTextureUsageFlags
Specifies how a texture is intended to be used by the client.
Definition SDL3pp_gpu.h:3015
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_HALF4
GPU_VERTEXELEMENTFORMAT_HALF4.
Definition SDL3pp_gpu.h:4409
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UINT3
GPU_VERTEXELEMENTFORMAT_UINT3.
Definition SDL3pp_gpu.h:4340
constexpr GPUCubeMapFace GPU_CUBEMAPFACE_NEGATIVEX
GPU_CUBEMAPFACE_NEGATIVEX.
Definition SDL3pp_gpu.h:4219
void End()
Ends the current compute pass.
Definition SDL3pp_gpu.h:7264
SDL_GPUVertexInputState GPUVertexInputState
A structure specifying the parameters of a graphics pipeline vertex input state.
Definition SDL3pp_gpu.h:4815
constexpr GPUShaderStage GPU_SHADERSTAGE_VERTEX
GPU_SHADERSTAGE_VERTEX.
Definition SDL3pp_gpu.h:4304
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_D24_UNORM
GPU_TEXTUREFORMAT_D24_UNORM.
Definition SDL3pp_gpu.h:2833
void SetGPUStencilReference(GPURenderPass render_pass, Uint8 reference)
Sets the current stencil reference value on a command buffer.
Definition SDL3pp_gpu.h:6542
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:6808
constexpr GPUCompareOp GPU_COMPAREOP_LESS
The comparison evaluates reference < test.
Definition SDL3pp_gpu.h:4497
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET
Texture is a depth stencil target.
Definition SDL3pp_gpu.h:3023
void DispatchGPUCompute(GPUComputePass compute_pass, Uint32 groupcount_x, Uint32 groupcount_y, Uint32 groupcount_z)
Dispatches compute work.
Definition SDL3pp_gpu.h:7203
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_INT2
GPU_VERTEXELEMENTFORMAT_INT2.
Definition SDL3pp_gpu.h:4325
GPUComputePipeline CreateGPUComputePipeline(GPUDeviceRef device, const GPUComputePipelineCreateInfo &createinfo)
Creates a pipeline object to be used in a compute workflow.
Definition SDL3pp_gpu.h:5503
constexpr GPUPrimitiveType GPU_PRIMITIVETYPE_POINTLIST
A series of separate points.
Definition SDL3pp_gpu.h:4148
constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR
1 - destination color
Definition SDL3pp_gpu.h:4622
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC7_RGBA_UNORM
GPU_TEXTUREFORMAT_BC7_RGBA_UNORM.
Definition SDL3pp_gpu.h:2710
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:7031
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:7720
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:6733
GPUShaderFormat GetShaderFormats()
Returns the supported shader formats for this GPU context.
Definition SDL3pp_gpu.h:5310
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:4181
constexpr GPUVertexInputRate GPU_VERTEXINPUTRATE_INSTANCE
Attribute addressing is a function of the instance index.
Definition SDL3pp_gpu.h:4426
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:8279
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT
GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT.
Definition SDL3pp_gpu.h:2713
constexpr GPUShaderStage GPU_SHADERSTAGE_FRAGMENT
GPU_SHADERSTAGE_FRAGMENT.
Definition SDL3pp_gpu.h:4307
constexpr GPUCompareOp GPU_COMPAREOP_INVALID
GPU_COMPAREOP_INVALID.
Definition SDL3pp_gpu.h:4491
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC5_RG_UNORM
GPU_TEXTUREFORMAT_BC5_RG_UNORM.
Definition SDL3pp_gpu.h:2707
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:6594
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:6695
constexpr GPUCubeMapFace GPU_CUBEMAPFACE_NEGATIVEZ
GPU_CUBEMAPFACE_NEGATIVEZ.
Definition SDL3pp_gpu.h:4231
void UnmapGPUTransferBuffer(GPUDeviceRef device, GPUTransferBuffer transfer_buffer)
Unmaps a previously mapped transfer buffer.
Definition SDL3pp_gpu.h:7302
constexpr GPUPrimitiveType GPU_PRIMITIVETYPE_LINESTRIP
A series of connected lines.
Definition SDL3pp_gpu.h:4145
constexpr GPUStencilOp GPU_STENCILOP_DECREMENT_AND_WRAP
Decrements the current value and wraps to the maximum value.
Definition SDL3pp_gpu.h:4558
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8_UINT
GPU_TEXTUREFORMAT_R8_UINT.
Definition SDL3pp_gpu.h:2758
constexpr GPUSampleCount GPU_SAMPLECOUNT_4
MSAA 4x.
Definition SDL3pp_gpu.h:3065
constexpr GPUTransferBufferUsage GPU_TRANSFERBUFFERUSAGE_DOWNLOAD
GPU_TRANSFERBUFFERUSAGE_DOWNLOAD.
Definition SDL3pp_gpu.h:4292
constexpr GPUStencilOp GPU_STENCILOP_INVALID
GPU_STENCILOP_INVALID.
Definition SDL3pp_gpu.h:4530
constexpr GPUTextureType GPU_TEXTURETYPE_CUBE_ARRAY
The texture is a cube array image.
Definition SDL3pp_gpu.h:2992
void GDKResumeGPU()
Call this to resume GPU operation on Xbox when you receive the EVENT_WILL_ENTER_FOREGROUND event.
Definition SDL3pp_gpu.h:8298
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32_INT
GPU_TEXTUREFORMAT_R32_INT.
Definition SDL3pp_gpu.h:2803
bool WindowSupportsGPUPresentMode(GPUDeviceRef device, WindowRef window, GPUPresentMode present_mode)
Determines whether a presentation mode is supported by the window.
Definition SDL3pp_gpu.h:7629
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:7355
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:7514
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_5x4_FLOAT
GPU_TEXTUREFORMAT_ASTC_5x4_FLOAT.
Definition SDL3pp_gpu.h:2932
void WaitForSwapchain(WindowRef window)
Blocks the thread until a swapchain texture is available to be acquired.
Definition SDL3pp_gpu.h:7892
SDL_GPUDepthStencilState GPUDepthStencilState
A structure specifying the parameters of the graphics pipeline depth stencil state.
Definition SDL3pp_gpu.h:4875
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB
GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB.
Definition SDL3pp_gpu.h:2818
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_12x10_FLOAT
GPU_TEXTUREFORMAT_ASTC_12x10_FLOAT.
Definition SDL3pp_gpu.h:2965
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB
GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB.
Definition SDL3pp_gpu.h:2815
constexpr GPUColorComponentFlags GPU_COLORCOMPONENT_B
the blue component
Definition SDL3pp_gpu.h:4662
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x8_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_8x8_UNORM_SRGB.
Definition SDL3pp_gpu.h:2908
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16B16A16_SNORM
GPU_TEXTUREFORMAT_R16G16B16A16_SNORM.
Definition SDL3pp_gpu.h:2734
constexpr GPUSampleCount GPU_SAMPLECOUNT_8
MSAA 8x.
Definition SDL3pp_gpu.h:3067
constexpr GPUTextureType GPU_TEXTURETYPE_3D
The texture is a 3-dimensional image.
Definition SDL3pp_gpu.h:2986
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:4259
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT
GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT.
Definition SDL3pp_gpu.h:2716
SDL_GPUVertexBufferDescription GPUVertexBufferDescription
A structure specifying the parameters of vertex buffers used in a graphics pipeline.
Definition SDL3pp_gpu.h:4789
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:4470
constexpr GPUStencilOp GPU_STENCILOP_DECREMENT_AND_CLAMP
Decrements the current value and clamps to 0.
Definition SDL3pp_gpu.h:4546
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UINT4
GPU_VERTEXELEMENTFORMAT_UINT4.
Definition SDL3pp_gpu.h:4343
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16_UINT
GPU_TEXTUREFORMAT_R16_UINT.
Definition SDL3pp_gpu.h:2767
void ClaimWindow(WindowRef window)
Claims a window, creating a swapchain structure for it.
Definition SDL3pp_gpu.h:7673
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16_FLOAT
GPU_TEXTUREFORMAT_R16G16_FLOAT.
Definition SDL3pp_gpu.h:2740
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:6570
constexpr GPUSampleCount GPU_SAMPLECOUNT_2
MSAA 2x.
Definition SDL3pp_gpu.h:3063
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE
Texture supports storage writes in the compute stage.
Definition SDL3pp_gpu.h:3036
void End()
Ends the given render pass.
Definition SDL3pp_gpu.h:6996
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:6706
void WaitForGPUIdle(GPUDeviceRef device)
Blocks the thread until the GPU is completely idle.
Definition SDL3pp_gpu.h:8069
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:7043
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x5_UNORM
GPU_TEXTUREFORMAT_ASTC_8x5_UNORM.
Definition SDL3pp_gpu.h:2860
SDL_GPURasterizerState GPURasterizerState
A structure specifying the parameters of the graphics pipeline rasterizer state.
Definition SDL3pp_gpu.h:4855
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:5954
constexpr GPUCullMode GPU_CULLMODE_FRONT
Front-facing triangles are culled.
Definition SDL3pp_gpu.h:4456
constexpr GPUCubeMapFace GPU_CUBEMAPFACE_POSITIVEY
GPU_CUBEMAPFACE_POSITIVEY.
Definition SDL3pp_gpu.h:4222
void WaitForFences(bool wait_all, std::span< GPUFence *const > fences)
Blocks the thread until the given fences are signaled.
Definition SDL3pp_gpu.h:8098
constexpr GPUCompareOp GPU_COMPAREOP_GREATER
The comparison evaluates reference > test.
Definition SDL3pp_gpu.h:4507
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:2737
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_12x12_FLOAT
GPU_TEXTUREFORMAT_ASTC_12x12_FLOAT.
Definition SDL3pp_gpu.h:2968
void GenerateMipmapsForTexture(GPUTexture texture)
Generates mipmaps for the given texture.
Definition SDL3pp_gpu.h:7558
GPUTexture CreateTexture(const GPUTextureCreateInfo &createinfo)
Creates a texture object to be used in graphics or compute workflows.
Definition SDL3pp_gpu.h:5806
constexpr GPUFrontFace GPU_FRONTFACE_COUNTER_CLOCKWISE
A triangle with counter-clockwise vertex winding will be considered front-facing.
Definition SDL3pp_gpu.h:4476
SDL_GPUMultisampleState GPUMultisampleState
A structure specifying the parameters of the graphics pipeline multisample state.
Definition SDL3pp_gpu.h:4865
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:6329
constexpr GPUColorComponentFlags GPU_COLORCOMPONENT_R
the red component
Definition SDL3pp_gpu.h:4656
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x5_FLOAT
GPU_TEXTUREFORMAT_ASTC_10x5_FLOAT.
Definition SDL3pp_gpu.h:2953
constexpr GPUSamplerMipmapMode GPU_SAMPLERMIPMAPMODE_NEAREST
Point filtering.
Definition SDL3pp_gpu.h:4692
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_BYTE2_NORM
GPU_VERTEXELEMENTFORMAT_BYTE2_NORM.
Definition SDL3pp_gpu.h:4370
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_HALF2
GPU_VERTEXELEMENTFORMAT_HALF2.
Definition SDL3pp_gpu.h:4406
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:7668
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_6x5_UNORM
GPU_TEXTUREFORMAT_ASTC_6x5_UNORM.
Definition SDL3pp_gpu.h:2854
constexpr GPUCullMode GPU_CULLMODE_BACK
Back-facing triangles are culled.
Definition SDL3pp_gpu.h:4459
SDL_GPUIndirectDrawCommand GPUIndirectDrawCommand
A structure specifying the parameters of an indirect draw command.
Definition SDL3pp_gpu.h:4744
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UINT2
GPU_VERTEXELEMENTFORMAT_UINT2.
Definition SDL3pp_gpu.h:4337
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x6_UNORM
GPU_TEXTUREFORMAT_ASTC_10x6_UNORM.
Definition SDL3pp_gpu.h:2872
GPUTransferBuffer CreateTransferBuffer(const GPUTransferBufferCreateInfo &createinfo)
Creates a transfer buffer to be used when uploading to or downloading from graphics resources.
Definition SDL3pp_gpu.h:5961
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8B8A8_SNORM
GPU_TEXTUREFORMAT_R8G8B8A8_SNORM.
Definition SDL3pp_gpu.h:2725
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UBYTE4
GPU_VERTEXELEMENTFORMAT_UBYTE4.
Definition SDL3pp_gpu.h:4367
void PushFragmentUniformData(Uint32 slot_index, SourceBytes data)
Pushes data to a fragment uniform slot on the command buffer.
Definition SDL3pp_gpu.h:6367
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:7384
void PushGPUComputeUniformData(GPUCommandBuffer command_buffer, Uint32 slot_index, SourceBytes data)
Pushes data to a uniform slot on the command buffer.
Definition SDL3pp_gpu.h:6389
constexpr GPUBlendFactor GPU_BLENDFACTOR_INVALID
GPU_BLENDFACTOR_INVALID.
Definition SDL3pp_gpu.h:4606
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:8223
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_INVALID
GPU_VERTEXELEMENTFORMAT_INVALID.
Definition SDL3pp_gpu.h:4319
void PushVertexUniformData(Uint32 slot_index, SourceBytes data)
Pushes data to a vertex uniform slot on the command buffer.
Definition SDL3pp_gpu.h:6337
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:5712
constexpr GPUStencilOp GPU_STENCILOP_INCREMENT_AND_CLAMP
Increments the current value and clamps to the maximum value.
Definition SDL3pp_gpu.h:4543
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_SHORT4_NORM
GPU_VERTEXELEMENTFORMAT_SHORT4_NORM.
Definition SDL3pp_gpu.h:4397
SDL_GPUVertexElementFormat GPUVertexElementFormat
Specifies the format of a vertex attribute.
Definition SDL3pp_gpu.h:4317
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT
GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT.
Definition SDL3pp_gpu.h:2842
void GenerateMipmapsForGPUTexture(GPUCommandBuffer command_buffer, GPUTexture texture)
Generates mipmaps for the given texture.
Definition SDL3pp_gpu.h:7552
constexpr GPUTextureType GPU_TEXTURETYPE_2D
The texture is a 2-dimensional image.
Definition SDL3pp_gpu.h:2980
void CopyBufferToBuffer(const GPUBufferLocation &source, const GPUBufferLocation &destination, Uint32 size, bool cycle)
Performs a buffer-to-buffer copy.
Definition SDL3pp_gpu.h:7466
constexpr GPUBlendFactor GPU_BLENDFACTOR_SRC_COLOR
source color
Definition SDL3pp_gpu.h:4613
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC2_RGBA_UNORM
GPU_TEXTUREFORMAT_BC2_RGBA_UNORM.
Definition SDL3pp_gpu.h:2698
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB
GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB.
Definition SDL3pp_gpu.h:2812
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:6223
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_B4G4R4A4_UNORM
GPU_TEXTUREFORMAT_B4G4R4A4_UNORM.
Definition SDL3pp_gpu.h:2689
GPUTexture CreateGPUTexture(GPUDeviceRef device, const GPUTextureCreateInfo &createinfo)
Creates a texture object to be used in graphics or compute workflows.
Definition SDL3pp_gpu.h:5800
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_12x10_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_12x10_UNORM_SRGB.
Definition SDL3pp_gpu.h:2923
void DestroyGPUDevice(GPUDeviceRaw device)
Destroys a GPU context previously returned by CreateGPUDevice.
Definition SDL3pp_gpu.h:5241
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x10_UNORM
GPU_TEXTUREFORMAT_ASTC_10x10_UNORM.
Definition SDL3pp_gpu.h:2878
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_5x4_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_5x4_UNORM_SRGB.
Definition SDL3pp_gpu.h:2890
bool QueryFence(GPUFence *fence)
Checks the status of a fence.
Definition SDL3pp_gpu.h:8120
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_12x10_UNORM
GPU_TEXTUREFORMAT_ASTC_12x10_UNORM.
Definition SDL3pp_gpu.h:2881
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:6464
SDL_GPUTextureType GPUTextureType
Specifies the type of a texture.
Definition SDL3pp_gpu.h:2978
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_5x5_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_5x5_UNORM_SRGB.
Definition SDL3pp_gpu.h:2893
constexpr GPUShaderFormat GPU_SHADERFORMAT_METALLIB
Precompiled metallib shaders for Metal.
Definition SDL3pp_gpu.h:2495
constexpr GPUFillMode GPU_FILLMODE_LINE
Polygon edges will be drawn as line segments.
Definition SDL3pp_gpu.h:4441
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:7457
SDL_GPUIndirectDispatchCommand GPUIndirectDispatchCommand
A structure specifying the parameters of an indexed dispatch command.
Definition SDL3pp_gpu.h:4769
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_4x4_UNORM
GPU_TEXTUREFORMAT_ASTC_4x4_UNORM.
Definition SDL3pp_gpu.h:2845
constexpr GPUPrimitiveType GPU_PRIMITIVETYPE_TRIANGLESTRIP
A series of connected triangles.
Definition SDL3pp_gpu.h:4139
SDL_GPUColorTargetBlendState GPUColorTargetBlendState
A structure specifying the blend state of a color target.
Definition SDL3pp_gpu.h:4837
SDL_GPUTransferBufferLocation GPUTransferBufferLocation
A structure specifying a location in a transfer buffer.
Definition SDL3pp_gpu.h:1752
constexpr GPUShaderFormat GPU_SHADERFORMAT_MSL
MSL shaders for Metal.
Definition SDL3pp_gpu.h:2492
PropertiesRef GetGPUDeviceProperties(GPUDeviceRef device)
Get the properties associated with a GPU device.
Definition SDL3pp_gpu.h:5418
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:6126
void UploadToTexture(const GPUTextureTransferInfo &source, const GPUTextureRegion &destination, bool cycle)
Uploads data from a transfer buffer to a texture.
Definition SDL3pp_gpu.h:7363
SDL_GPUSamplerMipmapMode GPUSamplerMipmapMode
Specifies a mipmap mode used by a sampler.
Definition SDL3pp_gpu.h:4690
bool SetSwapchainParameters(WindowRef window, GPUSwapchainComposition swapchain_composition, GPUPresentMode present_mode)
Changes the swapchain parameters for the given claimed window.
Definition SDL3pp_gpu.h:7730
Uint8 GPUColorComponentFlags
Specifies which color components are written in a graphics pipeline.
Definition SDL3pp_gpu.h:4654
const char * GetGPUDeviceDriver(GPUDeviceRef device)
Returns the name of the backend used to create this GPU context.
Definition SDL3pp_gpu.h:5286
constexpr GPUCompareOp GPU_COMPAREOP_NEVER
The comparison always evaluates false.
Definition SDL3pp_gpu.h:4494
SDL_GPUVulkanOptions GPUVulkanOptions
A structure specifying additional options when using Vulkan.
Definition SDL3pp_gpu.h:5228
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16_SNORM
GPU_TEXTUREFORMAT_R16G16_SNORM.
Definition SDL3pp_gpu.h:2731
void SetBlendConstants(FColorRaw blend_constants)
Sets the current blend constants on a command buffer.
Definition SDL3pp_gpu.h:6529
constexpr GPUBlendFactor GPU_BLENDFACTOR_SRC_ALPHA
source alpha
Definition SDL3pp_gpu.h:4625
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x5_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_8x5_UNORM_SRGB.
Definition SDL3pp_gpu.h:2902
void ReleaseSampler(GPUSampler sampler)
Frees the given sampler as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6166
bool TextureSupportsSampleCount(GPUTextureFormat format, GPUSampleCount sample_count)
Determines if a sample count for a texture format is supported.
Definition SDL3pp_gpu.h:8205
SDL_GPUSamplerAddressMode GPUSamplerAddressMode
Specifies behavior of texture sampling when the coordinates exceed the 0-1 range.
Definition SDL3pp_gpu.h:4706
void Destroy()
Destroys a GPU context previously returned by CreateGPUDevice.
Definition SDL3pp_gpu.h:5246
GPUDevice CreateGPUDevice(GPUShaderFormat format_flags, bool debug_mode, StringParam name)
Creates a GPU context.
Definition SDL3pp_gpu.h:4959
void ReleaseBuffer(GPUBuffer buffer)
Frees the given buffer as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6186
void ReleaseGraphicsPipeline(GPUGraphicsPipeline graphics_pipeline)
Frees the given graphics pipeline as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6271
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_6x6_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_6x6_UNORM_SRGB.
Definition SDL3pp_gpu.h:2899
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R10G10B10A2_UNORM
GPU_TEXTUREFORMAT_R10G10B10A2_UNORM.
Definition SDL3pp_gpu.h:2680
void BindPipeline(GPUGraphicsPipeline graphics_pipeline)
Binds a graphics pipeline on a render pass to be used in rendering.
Definition SDL3pp_gpu.h:6470
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_B8G8R8A8_UNORM
GPU_TEXTUREFORMAT_B8G8R8A8_UNORM.
Definition SDL3pp_gpu.h:2692
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:6934
constexpr GPULoadOp GPU_LOADOP_DONT_CARE
The previous contents of the texture need not be preserved.
Definition SDL3pp_gpu.h:4171
constexpr GPUBlendFactor GPU_BLENDFACTOR_ZERO
0
Definition SDL3pp_gpu.h:4609
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8_SNORM
GPU_TEXTUREFORMAT_R8G8_SNORM.
Definition SDL3pp_gpu.h:2722
SDL_GPUSwapchainComposition GPUSwapchainComposition
Specifies the texture format and colorspace of the swapchain textures.
Definition SDL3pp_gpu.h:2523
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32G32B32A32_INT
GPU_TEXTUREFORMAT_R32G32B32A32_INT.
Definition SDL3pp_gpu.h:2809
GPUCommandBuffer AcquireCommandBuffer()
Acquire a command buffer.
Definition SDL3pp_gpu.h:6306
constexpr GPUBlendOp GPU_BLENDOP_MAX
max(source, destination)
Definition SDL3pp_gpu.h:4590
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16_INT
GPU_TEXTUREFORMAT_R16G16_INT.
Definition SDL3pp_gpu.h:2797
bool WindowSupportsSwapchainComposition(WindowRef window, GPUSwapchainComposition swapchain_composition)
Determines whether a swapchain composition is supported by the window.
Definition SDL3pp_gpu.h:7607
const char * GetGPUDriver(int index)
Get the name of a built in GPU driver.
Definition SDL3pp_gpu.h:5276
constexpr GPUStoreOp GPU_STOREOP_STORE
The contents generated during the render pass will be written to memory.
Definition SDL3pp_gpu.h:4184
SDL_GPUSampleCount GPUSampleCount
Specifies the sample count of a texture.
Definition SDL3pp_gpu.h:3058
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB
GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB.
Definition SDL3pp_gpu.h:2821
void InsertDebugLabel(StringParam text)
Inserts an arbitrary string label into the command buffer callstream.
Definition SDL3pp_gpu.h:6066
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB
GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB.
Definition SDL3pp_gpu.h:2827
constexpr GPUBlendFactor GPU_BLENDFACTOR_SRC_ALPHA_SATURATE
min(source alpha, 1 - destination alpha)
Definition SDL3pp_gpu.h:4643
constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA
1 - destination alpha
Definition SDL3pp_gpu.h:4634
GPUTextureFormat GetGPUSwapchainTextureFormat(GPUDeviceRef device, WindowRef window)
Obtains the texture format of the swapchain for the given window.
Definition SDL3pp_gpu.h:7787
void BindPipeline(GPUComputePipeline compute_pipeline)
Binds a compute pipeline on a command buffer for use in compute dispatch.
Definition SDL3pp_gpu.h:7065
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_BYTE2
GPU_VERTEXELEMENTFORMAT_BYTE2.
Definition SDL3pp_gpu.h:4358
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x8_UNORM
GPU_TEXTUREFORMAT_ASTC_8x8_UNORM.
Definition SDL3pp_gpu.h:2866
constexpr GPUStencilOp GPU_STENCILOP_KEEP
Keeps the current value.
Definition SDL3pp_gpu.h:4533
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_INT3
GPU_VERTEXELEMENTFORMAT_INT3.
Definition SDL3pp_gpu.h:4328
void SetGPUBufferName(GPUDeviceRef device, GPUBuffer buffer, StringParam text)
Sets an arbitrary string constant to label a buffer.
Definition SDL3pp_gpu.h:6004
constexpr GPUBufferUsageFlags GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ
Buffer supports storage reads in the compute stage.
Definition SDL3pp_gpu.h:4270
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:7521
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x5_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_10x5_UNORM_SRGB.
Definition SDL3pp_gpu.h:2911
void SetGPUBlendConstants(GPURenderPass render_pass, FColorRaw blend_constants)
Sets the current blend constants on a command buffer.
Definition SDL3pp_gpu.h:6523
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:2773
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x8_FLOAT
GPU_TEXTUREFORMAT_ASTC_8x8_FLOAT.
Definition SDL3pp_gpu.h:2950
SDL_GPUFilter GPUFilter
Specifies a filter operation used by a sampler.
Definition SDL3pp_gpu.h:4675
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_5x4_UNORM
GPU_TEXTUREFORMAT_ASTC_5x4_UNORM.
Definition SDL3pp_gpu.h:2848
void End()
Ends the current copy pass.
Definition SDL3pp_gpu.h:7540
ResourceRefT< GPUDeviceBase > GPUDeviceRef
Reference for GPUDevice.
Definition SDL3pp_gpu.h:387
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_USHORT4
GPU_VERTEXELEMENTFORMAT_USHORT4.
Definition SDL3pp_gpu.h:4391
GPUFence * SubmitAndAcquireFence()
Submits a command buffer so its commands can be processed on the GPU, and acquires a fence associated...
Definition SDL3pp_gpu.h:8023
bool GPUSupportsProperties(PropertiesRef props)
Checks for GPU runtime support.
Definition SDL3pp_gpu.h:4928
constexpr GPUShaderFormat GPU_SHADERFORMAT_INVALID
INVALID.
Definition SDL3pp_gpu.h:2477
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:8090
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:7164
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_B5G6R5_UNORM
GPU_TEXTUREFORMAT_B5G6R5_UNORM.
Definition SDL3pp_gpu.h:2683
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:7488
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8_UNORM
GPU_TEXTUREFORMAT_R8G8_UNORM.
Definition SDL3pp_gpu.h:2665
void EndGPURenderPass(GPURenderPass render_pass)
Ends the given render pass.
Definition SDL3pp_gpu.h:6991
constexpr GPUBlendOp GPU_BLENDOP_REVERSE_SUBTRACT
(destination * destination_factor) - (source * source_factor)
Definition SDL3pp_gpu.h:4584
constexpr GPUColorComponentFlags GPU_COLORCOMPONENT_G
the green component
Definition SDL3pp_gpu.h:4659
void SetBufferName(GPUBuffer buffer, StringParam text)
Sets an arbitrary string constant to label a buffer.
Definition SDL3pp_gpu.h:6011
constexpr GPUSwapchainComposition GPU_SWAPCHAINCOMPOSITION_SDR
GPU_SWAPCHAINCOMPOSITION_SDR.
Definition SDL3pp_gpu.h:2525
constexpr GPUBufferUsageFlags GPU_BUFFERUSAGE_INDIRECT
Buffer is an indirect buffer.
Definition SDL3pp_gpu.h:4262
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ
Texture supports storage reads in the compute stage.
Definition SDL3pp_gpu.h:3032
constexpr GPUBlendOp GPU_BLENDOP_SUBTRACT
(source * source_factor) - (destination * destination_factor)
Definition SDL3pp_gpu.h:4581
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8_INT
GPU_TEXTUREFORMAT_R8_INT.
Definition SDL3pp_gpu.h:2785
void InsertGPUDebugLabel(GPUCommandBuffer command_buffer, StringParam text)
Inserts an arbitrary string label into the command buffer callstream.
Definition SDL3pp_gpu.h:6060
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16_UNORM
GPU_TEXTUREFORMAT_R16_UNORM.
Definition SDL3pp_gpu.h:2671
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x10_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_10x10_UNORM_SRGB.
Definition SDL3pp_gpu.h:2920
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:6207
SDL_GPUBlitRegion GPUBlitRegion
A structure specifying a region of a texture used in the blit operation.
Definition SDL3pp_gpu.h:4728
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:7535
void DispatchGPUComputeIndirect(GPUComputePass compute_pass, GPUBuffer buffer, Uint32 offset)
Dispatches compute work with parameters set from a buffer.
Definition SDL3pp_gpu.h:7237
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:7952
constexpr GPUStoreOp GPU_STOREOP_DONT_CARE
The contents generated during the render pass are not needed and may be discarded.
Definition SDL3pp_gpu.h:4190
constexpr GPULoadOp GPU_LOADOP_CLEAR
The contents of the texture will be cleared to a color.
Definition SDL3pp_gpu.h:4165
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM
GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM.
Definition SDL3pp_gpu.h:4379
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32G32B32A32_UINT
GPU_TEXTUREFORMAT_R32G32B32A32_UINT.
Definition SDL3pp_gpu.h:2782
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:2983
constexpr GPUPresentMode GPU_PRESENTMODE_MAILBOX
GPU_PRESENTMODE_MAILBOX.
Definition SDL3pp_gpu.h:2570
constexpr GPUCubeMapFace GPU_CUBEMAPFACE_NEGATIVEY
GPU_CUBEMAPFACE_NEGATIVEY.
Definition SDL3pp_gpu.h:4225
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:4604
void PushDebugGroup(StringParam name)
Begins a debug group with an arbitrary name.
Definition SDL3pp_gpu.h:6102
bool GPUSupportsShaderFormats(GPUShaderFormat format_flags, StringParam name)
Checks for GPU runtime support.
Definition SDL3pp_gpu.h:4912
void ReleaseGPUFence(GPUDeviceRef device, GPUFence *fence)
Releases a fence obtained from SubmitGPUCommandBufferAndAcquireFence.
Definition SDL3pp_gpu.h:8137
constexpr GPUShaderFormat GPU_SHADERFORMAT_SPIRV
SPIR-V shaders for Vulkan.
Definition SDL3pp_gpu.h:2483
constexpr GPUSamplerAddressMode GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT
Specifies that the coordinates will wrap around mirrored.
Definition SDL3pp_gpu.h:4713
const char * GetDriver()
Returns the name of the backend used to create this GPU context.
Definition SDL3pp_gpu.h:5291
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:6562
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:7139
void DrawPrimitives(Uint32 num_vertices, Uint32 num_instances, Uint32 first_vertex, Uint32 first_instance)
Draws data using bound graphics state.
Definition SDL3pp_gpu.h:6909
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x5_FLOAT
GPU_TEXTUREFORMAT_ASTC_8x5_FLOAT.
Definition SDL3pp_gpu.h:2944
void SetGPUScissor(GPURenderPass render_pass, const RectRaw &scissor)
Sets the current scissor state on a command buffer.
Definition SDL3pp_gpu.h:6502
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_D16_UNORM
GPU_TEXTUREFORMAT_D16_UNORM.
Definition SDL3pp_gpu.h:2830
void SubmitGPUCommandBuffer(GPUCommandBuffer command_buffer)
Submits a command buffer so its commands can be processed on the GPU.
Definition SDL3pp_gpu.h:7983
void ReleaseShader(GPUShader shader)
Frees the given shader as soon as it is safe to do so.
Definition SDL3pp_gpu.h:6250
constexpr GPUFilter GPU_FILTER_NEAREST
Point filtering.
Definition SDL3pp_gpu.h:4677
void SetGPUTextureName(GPUDeviceRef device, GPUTexture texture, StringParam text)
Sets an arbitrary string constant to label a texture.
Definition SDL3pp_gpu.h:6033
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x6_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_10x6_UNORM_SRGB.
Definition SDL3pp_gpu.h:2914
SDL_GPUStencilOpState GPUStencilOpState
A structure specifying the stencil operation state of a graphics pipeline.
Definition SDL3pp_gpu.h:4824
constexpr GPUCubeMapFace GPU_CUBEMAPFACE_POSITIVEX
GPU_CUBEMAPFACE_POSITIVEX.
Definition SDL3pp_gpu.h:4216
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:7089
void UnmapTransferBuffer(GPUTransferBuffer transfer_buffer)
Unmaps a previously mapped transfer buffer.
Definition SDL3pp_gpu.h:7308
void WaitForIdle()
Blocks the thread until the GPU is completely idle.
Definition SDL3pp_gpu.h:8074
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:7128
SDL_GPUBufferLocation GPUBufferLocation
A structure specifying a location in a buffer.
Definition SDL3pp_gpu.h:1701
GPUCopyPass BeginGPUCopyPass(GPUCommandBuffer command_buffer)
Begins a copy pass on a command buffer.
Definition SDL3pp_gpu.h:7328
constexpr GPUBlendOp GPU_BLENDOP_ADD
(source * source_factor) + (destination * destination_factor)
Definition SDL3pp_gpu.h:4578
constexpr GPUTextureType GPU_TEXTURETYPE_CUBE
The texture is a cube image.
Definition SDL3pp_gpu.h:2989
constexpr GPUStencilOp GPU_STENCILOP_INCREMENT_AND_WRAP
Increments the current value and wraps back to 0.
Definition SDL3pp_gpu.h:4553
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB
GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB.
Definition SDL3pp_gpu.h:2824
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_INVALID
GPU_TEXTUREFORMAT_INVALID.
Definition SDL3pp_gpu.h:2656
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_5x5_UNORM
GPU_TEXTUREFORMAT_ASTC_5x5_UNORM.
Definition SDL3pp_gpu.h:2851
GPUComputePipeline CreateComputePipeline(const GPUComputePipelineCreateInfo &createinfo)
Creates a pipeline object to be used in a compute workflow.
Definition SDL3pp_gpu.h:5510
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_BYTE4_NORM
GPU_VERTEXELEMENTFORMAT_BYTE4_NORM.
Definition SDL3pp_gpu.h:4373
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_FLOAT
GPU_VERTEXELEMENTFORMAT_FLOAT.
Definition SDL3pp_gpu.h:4346
constexpr GPUSampleCount GPU_SAMPLECOUNT_1
No multisampling.
Definition SDL3pp_gpu.h:3060
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:6446
constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA
1 - source alpha
Definition SDL3pp_gpu.h:4628
constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE
1
Definition SDL3pp_gpu.h:4611
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM
GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM.
Definition SDL3pp_gpu.h:4376
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_SHORT4
GPU_VERTEXELEMENTFORMAT_SHORT4.
Definition SDL3pp_gpu.h:4385
void PopGPUDebugGroup(GPUCommandBuffer command_buffer)
Ends the most-recently pushed debug group.
Definition SDL3pp_gpu.h:6121
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:6181
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:8296
constexpr GPULoadOp GPU_LOADOP_LOAD
The previous contents of the texture will be preserved.
Definition SDL3pp_gpu.h:4162
constexpr GPUCullMode GPU_CULLMODE_NONE
No triangles are culled.
Definition SDL3pp_gpu.h:4453
constexpr GPUBlendFactor GPU_BLENDFACTOR_DST_ALPHA
destination alpha
Definition SDL3pp_gpu.h:4631
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:6973
void EndGPUComputePass(GPUComputePass compute_pass)
Ends the current compute pass.
Definition SDL3pp_gpu.h:7259
SDL_GPUVertexInputRate GPUVertexInputRate
Specifies the rate at which vertex attributes are pulled from buffers.
Definition SDL3pp_gpu.h:4419
SDL_GPUBlitInfo GPUBlitInfo
A structure containing parameters for a blit command.
Definition SDL3pp_gpu.h:2026
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x5_UNORM
GPU_TEXTUREFORMAT_ASTC_10x5_UNORM.
Definition SDL3pp_gpu.h:2869
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8_UINT
GPU_TEXTUREFORMAT_R8G8_UINT.
Definition SDL3pp_gpu.h:2761
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:5920
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_gpu.h:5922
Properties for GPUComputePipeline creation.
Definition SDL3pp_gpu.h:5529
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_gpu.h:5531
Properties for GPUDevice creation.
Definition SDL3pp_gpu.h:5099
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_gpu.h:5114
constexpr auto FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN
Enable feature indirect draw first instance.
Definition SDL3pp_gpu.h:5128
constexpr auto D3D12_AGILITY_SDK_PATH_STRING
String for d3d12 agility sdk path.
Definition SDL3pp_gpu.h:5181
constexpr auto DEBUGMODE_BOOLEAN
Enable debugmode.
Definition SDL3pp_gpu.h:5101
constexpr auto FEATURE_DEPTH_CLAMPING_BOOLEAN
Enable feature depth clamping.
Definition SDL3pp_gpu.h:5123
constexpr auto SHADERS_PRIVATE_BOOLEAN
Enable shaders private.
Definition SDL3pp_gpu.h:5137
constexpr auto D3D12_AGILITY_SDK_VERSION_NUMBER
Number for d3d12 agility sdk version.
Definition SDL3pp_gpu.h:5175
constexpr auto SHADERS_MSL_BOOLEAN
Enable shaders msl.
Definition SDL3pp_gpu.h:5150
constexpr auto METAL_ALLOW_MACFAMILY1_BOOLEAN
Enable metal allow macfamily1.
Definition SDL3pp_gpu.h:5201
constexpr auto VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN
Enable vulkan require hardware acceleration.
Definition SDL3pp_gpu.h:5190
constexpr auto D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN
Enable d3d12 allow fewer resource slots.
Definition SDL3pp_gpu.h:5159
constexpr auto SHADERS_DXIL_BOOLEAN
Enable shaders dxil.
Definition SDL3pp_gpu.h:5147
constexpr auto SHADERS_DXBC_BOOLEAN
Enable shaders dxbc.
Definition SDL3pp_gpu.h:5144
constexpr auto SHADERS_SPIRV_BOOLEAN
Enable shaders spirv.
Definition SDL3pp_gpu.h:5141
constexpr auto PREFERLOWPOWER_BOOLEAN
Enable preferlowpower.
Definition SDL3pp_gpu.h:5104
constexpr auto FEATURE_ANISOTROPY_BOOLEAN
Enable feature anisotropy.
Definition SDL3pp_gpu.h:5131
constexpr auto FEATURE_CLIP_DISTANCE_BOOLEAN
Enable feature clip distance.
Definition SDL3pp_gpu.h:5119
constexpr auto VULKAN_OPTIONS_POINTER
Pointer to vulkan options.
Definition SDL3pp_gpu.h:5193
constexpr auto SHADERS_METALLIB_BOOLEAN
Enable shaders metallib.
Definition SDL3pp_gpu.h:5153
constexpr auto VERBOSE_BOOLEAN
Enable verbose.
Definition SDL3pp_gpu.h:5109
constexpr auto D3D12_SEMANTIC_NAME_STRING
String for d3d12 semantic name.
Definition SDL3pp_gpu.h:5169
Properties for GPUDevice creation and information.
Definition SDL3pp_gpu.h:5099
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_gpu.h:5442
constexpr auto DRIVER_VERSION_STRING
String for driver version.
Definition SDL3pp_gpu.h:5448
constexpr auto DRIVER_NAME_STRING
String for driver name.
Definition SDL3pp_gpu.h:5445
constexpr auto DRIVER_INFO_STRING
String for driver info.
Definition SDL3pp_gpu.h:5451
Properties for GPUGraphicsPipeline creation.
Definition SDL3pp_gpu.h:5583
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_gpu.h:5585
Properties for GPUSampler creation.
Definition SDL3pp_gpu.h:5634
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_gpu.h:5636
Properties for GPUShader creation.
Definition SDL3pp_gpu.h:5735
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_gpu.h:5737
Properties for GPUTexture creation.
Definition SDL3pp_gpu.h:5823
constexpr auto D3D12_CLEAR_G_FLOAT
Float for d3d12 clear g.
Definition SDL3pp_gpu.h:5828
constexpr auto D3D12_CLEAR_DEPTH_FLOAT
Float for d3d12 clear depth.
Definition SDL3pp_gpu.h:5837
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_gpu.h:5849
constexpr auto D3D12_CLEAR_A_FLOAT
Float for d3d12 clear a.
Definition SDL3pp_gpu.h:5834
constexpr auto D3D12_CLEAR_STENCIL_NUMBER
Number for d3d12 clear stencil.
Definition SDL3pp_gpu.h:5843
constexpr auto D3D12_CLEAR_B_FLOAT
Float for d3d12 clear b.
Definition SDL3pp_gpu.h:5831
constexpr auto D3D12_CLEAR_R_FLOAT
Float for d3d12 clear r.
Definition SDL3pp_gpu.h:5825
Properties for GPUTransferBuffer creation.
Definition SDL3pp_gpu.h:5980
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_gpu.h:5982
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:3075
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
An opaque handle representing the SDL_GPU context.
Definition SDL3pp_gpu.h:3941
constexpr GPUDevice & operator=(GPUDevice &&other) noexcept
Assignment operator.
Definition SDL3pp_gpu.h:4107
~GPUDevice()
Destructor.
Definition SDL3pp_gpu.h:4104
constexpr GPUDevice(GPUDeviceRaw resource) noexcept
Constructs from raw GPUDevice.
Definition SDL3pp_gpu.h:3951
constexpr GPUDevice(GPUDevice &&other) noexcept
Move constructor.
Definition SDL3pp_gpu.h:3957
A non-owning reference wrapper for a given resource.
Definition SDL3pp_resource.h:93