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
376// Forward decl
377struct GPUDevice;
378
380using GPUDeviceRaw = SDL_GPUDevice*;
381
382// Forward decl
383struct GPUDeviceRef;
384
387{
389
392 : value(value)
393 {
394 }
395
397 constexpr GPUDeviceParam(std::nullptr_t = nullptr)
398 : value(nullptr)
399 {
400 }
401
403 constexpr explicit operator bool() const { return !!value; }
404
406 constexpr auto operator<=>(const GPUDeviceParam& other) const = default;
407
409 constexpr operator GPUDeviceRaw() const { return value; }
410};
411
413using GPUBufferRaw = SDL_GPUBuffer*;
414
415// Forward decl
416struct GPUBuffer;
417
419using GPUTransferBufferRaw = SDL_GPUTransferBuffer*;
420
421// Forward decl
422struct GPUTransferBuffer;
423
425using GPUTextureRaw = SDL_GPUTexture*;
426
427// Forward decl
428struct GPUTexture;
429
431using GPUSamplerRaw = SDL_GPUSampler*;
432
433// Forward decl
434struct GPUSampler;
435
437using GPUShaderRaw = SDL_GPUShader*;
438
439// Forward decl
440struct GPUShader;
441
443using GPUComputePipelineRaw = SDL_GPUComputePipeline*;
444
445// Forward decl
446struct GPUComputePipeline;
447
449using GPUGraphicsPipelineRaw = SDL_GPUGraphicsPipeline*;
450
451// Forward decl
453
455using GPUCommandBufferRaw = SDL_GPUCommandBuffer*;
456
457// Forward decl
458struct GPUCommandBuffer;
459
461using GPURenderPassRaw = SDL_GPURenderPass*;
462
463// Forward decl
464struct GPURenderPass;
465
467using GPUComputePassRaw = SDL_GPUComputePass*;
468
469// Forward decl
470struct GPUComputePass;
471
473using GPUCopyPassRaw = SDL_GPUCopyPass*;
474
475// Forward decl
476struct GPUCopyPass;
477
489using GPUBufferCreateInfo = SDL_GPUBufferCreateInfo;
490
513{
514 GPUBufferRaw m_gPUBuffer;
515
516public:
522 constexpr GPUBuffer(GPUBufferRaw gPUBuffer = {}) noexcept
523 : m_gPUBuffer(gPUBuffer)
524 {
525 }
526
571 : m_gPUBuffer(CheckError(SDL_CreateGPUBuffer(device, &createinfo)))
572 {
573 }
574
580 constexpr operator GPUBufferRaw() const noexcept { return m_gPUBuffer; }
581};
582
590using GPUTransferBufferCreateInfo = SDL_GPUTransferBufferCreateInfo;
591
609{
610 GPUTransferBufferRaw m_gPUTransferBuffer;
611
612public:
619 GPUTransferBufferRaw gPUTransferBuffer = {}) noexcept
620 : m_gPUTransferBuffer(gPUTransferBuffer)
621 {
622 }
623
652 const GPUTransferBufferCreateInfo& createinfo)
653 : m_gPUTransferBuffer(
654 CheckError(SDL_CreateGPUTransferBuffer(device, &createinfo)))
655 {
656 }
657
663 constexpr operator GPUTransferBufferRaw() const noexcept
664 {
665 return m_gPUTransferBuffer;
666 }
667};
668
684using GPUTextureCreateInfo = SDL_GPUTextureCreateInfo;
685
705{
706 GPUTextureRaw m_gPUTexture;
707
708public:
714 constexpr GPUTexture(GPUTextureRaw gPUTexture = {}) noexcept
715 : m_gPUTexture(gPUTexture)
716 {
717 }
718
778 : m_gPUTexture(CheckError(SDL_CreateGPUTexture(device, &createinfo)))
779 {
780 }
781
787 constexpr operator GPUTextureRaw() const noexcept { return m_gPUTexture; }
788};
789
804using GPUSamplerCreateInfo = SDL_GPUSamplerCreateInfo;
805
817{
818 GPUSamplerRaw m_gPUSampler;
819
820public:
826 constexpr GPUSampler(GPUSamplerRaw gPUSampler = {}) noexcept
827 : m_gPUSampler(gPUSampler)
828 {
829 }
830
853 : m_gPUSampler(CheckError(SDL_CreateGPUSampler(device, &createinfo)))
854 {
855 }
856
862 constexpr operator GPUSamplerRaw() const noexcept { return m_gPUSampler; }
863};
864
874using GPUShaderCreateInfo = SDL_GPUShaderCreateInfo;
875
886{
887 GPUShaderRaw m_gPUShader;
888
889public:
895 constexpr GPUShader(GPUShaderRaw gPUShader = {}) noexcept
896 : m_gPUShader(gPUShader)
897 {
898 }
899
974 : m_gPUShader(CheckError(SDL_CreateGPUShader(device, &createinfo)))
975 {
976 }
977
983 constexpr operator GPUShaderRaw() const noexcept { return m_gPUShader; }
984};
985
994using GPUComputePipelineCreateInfo = SDL_GPUComputePipelineCreateInfo;
995
1008{
1009 GPUComputePipelineRaw m_gPUComputePipeline;
1010
1011public:
1018 GPUComputePipelineRaw gPUComputePipeline = {}) noexcept
1019 : m_gPUComputePipeline(gPUComputePipeline)
1020 {
1021 }
1022
1069 const GPUComputePipelineCreateInfo& createinfo)
1070 : m_gPUComputePipeline(
1071 CheckError(SDL_CreateGPUComputePipeline(device, &createinfo)))
1072 {
1073 }
1074
1080 constexpr operator GPUComputePipelineRaw() const noexcept
1081 {
1082 return m_gPUComputePipeline;
1083 }
1084};
1085
1100using GPUGraphicsPipelineCreateInfo = SDL_GPUGraphicsPipelineCreateInfo;
1101
1114{
1115 GPUGraphicsPipelineRaw m_gPUGraphicsPipeline;
1116
1117public:
1124 GPUGraphicsPipelineRaw gPUGraphicsPipeline = {}) noexcept
1125 : m_gPUGraphicsPipeline(gPUGraphicsPipeline)
1126 {
1127 }
1128
1151 const GPUGraphicsPipelineCreateInfo& createinfo)
1152 : m_gPUGraphicsPipeline(
1153 CheckError(SDL_CreateGPUGraphicsPipeline(device, &createinfo)))
1154 {
1155 }
1156
1162 constexpr operator GPUGraphicsPipelineRaw() const noexcept
1163 {
1164 return m_gPUGraphicsPipeline;
1165 }
1166};
1167
1175using GPUViewport = SDL_GPUViewport;
1176
1185using GPUBufferBinding = SDL_GPUBufferBinding;
1186
1194using GPUIndexElementSize = SDL_GPUIndexElementSize;
1195
1197 SDL_GPU_INDEXELEMENTSIZE_16BIT;
1198
1200 SDL_GPU_INDEXELEMENTSIZE_32BIT;
1201
1212using GPUTextureSamplerBinding = SDL_GPUTextureSamplerBinding;
1213
1226{
1227 GPURenderPassRaw m_gPURenderPass;
1228
1229public:
1235 constexpr GPURenderPass(GPURenderPassRaw gPURenderPass = {}) noexcept
1236 : m_gPURenderPass(gPURenderPass)
1237 {
1238 }
1239
1245 constexpr operator GPURenderPassRaw() const noexcept
1246 {
1247 return m_gPURenderPass;
1248 }
1249
1259 void BindPipeline(GPUGraphicsPipeline graphics_pipeline);
1260
1268 void SetViewport(const GPUViewport& viewport);
1269
1277 void SetScissor(const RectRaw& scissor);
1278
1289 void SetBlendConstants(FColorRaw blend_constants);
1290
1298 void SetStencilReference(Uint8 reference);
1299
1310 void BindVertexBuffers(Uint32 first_slot,
1311 std::span<const GPUBufferBinding> bindings);
1312
1323 void BindIndexBuffer(const GPUBufferBinding& binding,
1324 GPUIndexElementSize index_element_size);
1325
1342 void BindVertexSamplers(
1343 Uint32 first_slot,
1344 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings);
1345
1362 void BindVertexStorageTextures(Uint32 first_slot,
1363 SpanRef<const GPUTextureRaw> storage_textures);
1364
1381 void BindVertexStorageBuffers(Uint32 first_slot,
1382 SpanRef<const GPUBufferRaw> storage_buffers);
1383
1401 Uint32 first_slot,
1402 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings);
1403
1421 Uint32 first_slot,
1422 SpanRef<const GPUTextureRaw> storage_textures);
1423
1440 void BindFragmentStorageBuffers(Uint32 first_slot,
1441 SpanRef<const GPUBufferRaw> storage_buffers);
1442
1465 void DrawIndexedPrimitives(Uint32 num_indices,
1466 Uint32 num_instances,
1467 Uint32 first_index,
1468 Sint32 vertex_offset,
1469 Uint32 first_instance);
1470
1490 void DrawPrimitives(Uint32 num_vertices,
1491 Uint32 num_instances,
1492 Uint32 first_vertex,
1493 Uint32 first_instance);
1494
1511 Uint32 offset,
1512 Uint32 draw_count);
1513
1530 Uint32 offset,
1531 Uint32 draw_count);
1532
1541 void End();
1542};
1543
1556{
1557 GPUComputePassRaw m_gPUComputePass;
1558
1559public:
1565 constexpr GPUComputePass(GPUComputePassRaw gPUComputePass = {}) noexcept
1566 : m_gPUComputePass(gPUComputePass)
1567 {
1568 }
1569
1575 constexpr operator GPUComputePassRaw() const noexcept
1576 {
1577 return m_gPUComputePass;
1578 }
1579
1587 void BindPipeline(GPUComputePipeline compute_pipeline);
1588
1605 void BindSamplers(
1606 Uint32 first_slot,
1607 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings);
1608
1625 void BindStorageTextures(Uint32 first_slot,
1626 SpanRef<const GPUTextureRaw> storage_textures);
1627
1644 void BindStorageBuffers(Uint32 first_slot,
1645 SpanRef<const GPUBufferRaw> storage_buffers);
1646
1666 void Dispatch(Uint32 groupcount_x, Uint32 groupcount_y, Uint32 groupcount_z);
1667
1684 void DispatchIndirect(GPUBuffer buffer, Uint32 offset);
1685
1694 void End();
1695};
1696
1707using GPUBufferRegion = SDL_GPUBufferRegion;
1708
1718using GPUTextureLocation = SDL_GPUTextureLocation;
1719
1729using GPUBufferLocation = SDL_GPUBufferLocation;
1730
1742using GPUTextureRegion = SDL_GPUTextureRegion;
1743
1764using GPUTextureTransferInfo = SDL_GPUTextureTransferInfo;
1765
1776using GPUTransferBufferLocation = SDL_GPUTransferBufferLocation;
1777
1790{
1791 GPUCopyPassRaw m_gPUCopyPass;
1792
1793public:
1799 constexpr GPUCopyPass(GPUCopyPassRaw gPUCopyPass = {}) noexcept
1800 : m_gPUCopyPass(gPUCopyPass)
1801 {
1802 }
1803
1809 constexpr operator GPUCopyPassRaw() const noexcept { return m_gPUCopyPass; }
1810
1827 void UploadToTexture(const GPUTextureTransferInfo& source,
1828 const GPUTextureRegion& destination,
1829 bool cycle);
1830
1844 void UploadToBuffer(const GPUTransferBufferLocation& source,
1845 const GPUBufferRegion& destination,
1846 bool cycle);
1847
1868 void CopyTextureToTexture(const GPUTextureLocation& source,
1869 const GPUTextureLocation& destination,
1870 Uint32 w,
1871 Uint32 h,
1872 Uint32 d,
1873 bool cycle);
1874
1889 void CopyBufferToBuffer(const GPUBufferLocation& source,
1890 const GPUBufferLocation& destination,
1891 Uint32 size,
1892 bool cycle);
1893
1906 void DownloadFromTexture(const GPUTextureRegion& source,
1907 const GPUTextureTransferInfo& destination);
1908
1920 void DownloadFromBuffer(const GPUBufferRegion& source,
1921 const GPUTransferBufferLocation& destination);
1922
1928 void End();
1929};
1930
1967using GPUColorTargetInfo = SDL_GPUColorTargetInfo;
1968
2016using GPUDepthStencilTargetInfo = SDL_GPUDepthStencilTargetInfo;
2017
2026using GPUStorageTextureReadWriteBinding = SDL_GPUStorageTextureReadWriteBinding;
2027
2036using GPUStorageBufferReadWriteBinding = SDL_GPUStorageBufferReadWriteBinding;
2037
2045using GPUBlitInfo = SDL_GPUBlitInfo;
2046
2057using GPUFence = SDL_GPUFence;
2058
2083{
2084 GPUCommandBufferRaw m_gPUCommandBuffer;
2085
2086public:
2092 constexpr GPUCommandBuffer(GPUCommandBufferRaw gPUCommandBuffer = {}) noexcept
2093 : m_gPUCommandBuffer(gPUCommandBuffer)
2094 {
2095 }
2096
2102 constexpr operator GPUCommandBufferRaw() const noexcept
2103 {
2104 return m_gPUCommandBuffer;
2105 }
2106
2122 void InsertDebugLabel(StringParam text);
2123
2150 void PushDebugGroup(StringParam name);
2151
2165 void PopDebugGroup();
2166
2184 void PushVertexUniformData(Uint32 slot_index, SourceBytes data);
2185
2200 void PushFragmentUniformData(Uint32 slot_index, SourceBytes data);
2201
2216 void PushComputeUniformData(Uint32 slot_index, SourceBytes data);
2217
2249 std::span<const GPUColorTargetInfo> color_target_infos,
2250 OptionalRef<const GPUDepthStencilTargetInfo> depth_stencil_target_info);
2251
2285 std::span<const GPUStorageTextureReadWriteBinding> storage_texture_bindings,
2286 std::span<const GPUStorageBufferReadWriteBinding> storage_buffer_bindings);
2287
2302
2313
2323 void BlitTexture(const GPUBlitInfo& info);
2324
2371 WindowParam window,
2372 Uint32* swapchain_texture_width = nullptr,
2373 Uint32* swapchain_texture_height = nullptr);
2374
2415 WindowParam window,
2416 Uint32* swapchain_texture_width = nullptr,
2417 Uint32* swapchain_texture_height = nullptr);
2418
2438 void Submit();
2439
2464
2485 void Cancel();
2486};
2487
2498
2500 SDL_GPU_SHADERFORMAT_INVALID;
2501
2503 SDL_GPU_SHADERFORMAT_PRIVATE;
2504
2506 SDL_GPU_SHADERFORMAT_SPIRV;
2507
2509 SDL_GPU_SHADERFORMAT_DXBC;
2510
2512 SDL_GPU_SHADERFORMAT_DXIL;
2513
2515 SDL_GPU_SHADERFORMAT_MSL;
2516
2518 SDL_GPU_SHADERFORMAT_METALLIB;
2519
2545using GPUSwapchainComposition = SDL_GPUSwapchainComposition;
2546
2548 SDL_GPU_SWAPCHAINCOMPOSITION_SDR;
2549
2551 SDL_GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR;
2552
2554 SDL_GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR;
2555
2557 SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2084;
2558
2584using GPUPresentMode = SDL_GPUPresentMode;
2585
2587 SDL_GPU_PRESENTMODE_VSYNC;
2588
2590 SDL_GPU_PRESENTMODE_IMMEDIATE;
2591
2593 SDL_GPU_PRESENTMODE_MAILBOX;
2594
2680using GPUTextureFormat = SDL_GPUTextureFormat;
2681
2683 SDL_GPU_TEXTUREFORMAT_INVALID;
2684
2686 SDL_GPU_TEXTUREFORMAT_A8_UNORM;
2687
2689 SDL_GPU_TEXTUREFORMAT_R8_UNORM;
2690
2692 SDL_GPU_TEXTUREFORMAT_R8G8_UNORM;
2693
2695 SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM;
2696
2698 SDL_GPU_TEXTUREFORMAT_R16_UNORM;
2699
2701 SDL_GPU_TEXTUREFORMAT_R16G16_UNORM;
2702
2704 SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UNORM;
2705
2707 SDL_GPU_TEXTUREFORMAT_R10G10B10A2_UNORM;
2708
2710 SDL_GPU_TEXTUREFORMAT_B5G6R5_UNORM;
2711
2713 SDL_GPU_TEXTUREFORMAT_B5G5R5A1_UNORM;
2714
2716 SDL_GPU_TEXTUREFORMAT_B4G4R4A4_UNORM;
2717
2719 SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM;
2720
2722 SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM;
2723
2725 SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM;
2726
2728 SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM;
2729
2731 SDL_GPU_TEXTUREFORMAT_BC4_R_UNORM;
2732
2734 SDL_GPU_TEXTUREFORMAT_BC5_RG_UNORM;
2735
2737 SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM;
2738
2740 SDL_GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT;
2741
2743 SDL_GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT;
2744
2746 SDL_GPU_TEXTUREFORMAT_R8_SNORM;
2747
2749 SDL_GPU_TEXTUREFORMAT_R8G8_SNORM;
2750
2752 SDL_GPU_TEXTUREFORMAT_R8G8B8A8_SNORM;
2753
2755 SDL_GPU_TEXTUREFORMAT_R16_SNORM;
2756
2758 SDL_GPU_TEXTUREFORMAT_R16G16_SNORM;
2759
2761 SDL_GPU_TEXTUREFORMAT_R16G16B16A16_SNORM;
2762
2764 SDL_GPU_TEXTUREFORMAT_R16_FLOAT;
2765
2767 SDL_GPU_TEXTUREFORMAT_R16G16_FLOAT;
2768
2770 SDL_GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT;
2771
2773 SDL_GPU_TEXTUREFORMAT_R32_FLOAT;
2774
2776 SDL_GPU_TEXTUREFORMAT_R32G32_FLOAT;
2777
2779 SDL_GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT;
2780
2782 SDL_GPU_TEXTUREFORMAT_R11G11B10_UFLOAT;
2783
2785 SDL_GPU_TEXTUREFORMAT_R8_UINT;
2786
2788 SDL_GPU_TEXTUREFORMAT_R8G8_UINT;
2789
2791 SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UINT;
2792
2794 SDL_GPU_TEXTUREFORMAT_R16_UINT;
2795
2797 SDL_GPU_TEXTUREFORMAT_R16G16_UINT;
2798
2800 SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UINT;
2801
2803 SDL_GPU_TEXTUREFORMAT_R32_UINT;
2804
2806 SDL_GPU_TEXTUREFORMAT_R32G32_UINT;
2807
2809 SDL_GPU_TEXTUREFORMAT_R32G32B32A32_UINT;
2810
2812 SDL_GPU_TEXTUREFORMAT_R8_INT;
2813
2815 SDL_GPU_TEXTUREFORMAT_R8G8_INT;
2816
2818 SDL_GPU_TEXTUREFORMAT_R8G8B8A8_INT;
2819
2821 SDL_GPU_TEXTUREFORMAT_R16_INT;
2822
2824 SDL_GPU_TEXTUREFORMAT_R16G16_INT;
2825
2827 SDL_GPU_TEXTUREFORMAT_R16G16B16A16_INT;
2828
2830 SDL_GPU_TEXTUREFORMAT_R32_INT;
2831
2833 SDL_GPU_TEXTUREFORMAT_R32G32_INT;
2834
2836 SDL_GPU_TEXTUREFORMAT_R32G32B32A32_INT;
2837
2839 SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB;
2840
2842 SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB;
2843
2845 SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB;
2846
2848 SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB;
2849
2851 SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB;
2852
2854 SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB;
2855
2857 SDL_GPU_TEXTUREFORMAT_D16_UNORM;
2858
2860 SDL_GPU_TEXTUREFORMAT_D24_UNORM;
2861
2863 SDL_GPU_TEXTUREFORMAT_D32_FLOAT;
2864
2866 SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT;
2867
2869 SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT;
2870
2872 SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM;
2873
2875 SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM;
2876
2878 SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM;
2879
2881 SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM;
2882
2884 SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM;
2885
2887 SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM;
2888
2890 SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM;
2891
2893 SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM;
2894
2896 SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM;
2897
2899 SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM;
2900
2902 SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM;
2903
2905 SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM;
2906
2908 SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM;
2909
2911 SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM;
2912
2914 SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM_SRGB;
2915
2917 SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM_SRGB;
2918
2920 SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM_SRGB;
2921
2923 SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM_SRGB;
2924
2926 SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM_SRGB;
2927
2929 SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM_SRGB;
2930
2932 SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM_SRGB;
2933
2935 SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM_SRGB;
2936
2938 SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM_SRGB;
2939
2941 SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM_SRGB;
2942
2944 SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM_SRGB;
2945
2947 SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM_SRGB;
2948
2950 SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM_SRGB;
2951
2953 SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM_SRGB;
2954
2956 SDL_GPU_TEXTUREFORMAT_ASTC_4x4_FLOAT;
2957
2959 SDL_GPU_TEXTUREFORMAT_ASTC_5x4_FLOAT;
2960
2962 SDL_GPU_TEXTUREFORMAT_ASTC_5x5_FLOAT;
2963
2965 SDL_GPU_TEXTUREFORMAT_ASTC_6x5_FLOAT;
2966
2968 SDL_GPU_TEXTUREFORMAT_ASTC_6x6_FLOAT;
2969
2971 SDL_GPU_TEXTUREFORMAT_ASTC_8x5_FLOAT;
2972
2974 SDL_GPU_TEXTUREFORMAT_ASTC_8x6_FLOAT;
2975
2977 SDL_GPU_TEXTUREFORMAT_ASTC_8x8_FLOAT;
2978
2980 SDL_GPU_TEXTUREFORMAT_ASTC_10x5_FLOAT;
2981
2983 SDL_GPU_TEXTUREFORMAT_ASTC_10x6_FLOAT;
2984
2986 SDL_GPU_TEXTUREFORMAT_ASTC_10x8_FLOAT;
2987
2989 SDL_GPU_TEXTUREFORMAT_ASTC_10x10_FLOAT;
2990
2992 SDL_GPU_TEXTUREFORMAT_ASTC_12x10_FLOAT;
2993
2995 SDL_GPU_TEXTUREFORMAT_ASTC_12x12_FLOAT;
2996
3004using GPUTextureType = SDL_GPUTextureType;
3005
3007 SDL_GPU_TEXTURETYPE_2D;
3008
3010 SDL_GPU_TEXTURETYPE_2D_ARRAY;
3011
3013 SDL_GPU_TEXTURETYPE_3D;
3014
3016 SDL_GPU_TEXTURETYPE_CUBE;
3017
3019 SDL_GPU_TEXTURETYPE_CUBE_ARRAY;
3020
3042
3044 SDL_GPU_TEXTUREUSAGE_SAMPLER;
3045
3047 SDL_GPU_TEXTUREUSAGE_COLOR_TARGET;
3048
3050 SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET;
3052
3054 SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ;
3056
3059 SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ;
3060
3063 SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE;
3064
3069constexpr GPUTextureUsageFlags
3071 SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE;
3072
3084using GPUSampleCount = SDL_GPUSampleCount;
3085
3087 SDL_GPU_SAMPLECOUNT_1;
3088
3089constexpr GPUSampleCount GPU_SAMPLECOUNT_2 = SDL_GPU_SAMPLECOUNT_2;
3090
3091constexpr GPUSampleCount GPU_SAMPLECOUNT_4 = SDL_GPU_SAMPLECOUNT_4;
3092
3093constexpr GPUSampleCount GPU_SAMPLECOUNT_8 = SDL_GPU_SAMPLECOUNT_8;
3094
3103{
3104 GPUDeviceRaw m_resource = nullptr;
3105
3106public:
3108 constexpr GPUDevice(std::nullptr_t = nullptr) noexcept
3109 : m_resource(0)
3110 {
3111 }
3112
3120 constexpr explicit GPUDevice(const GPUDeviceRaw resource) noexcept
3121 : m_resource(resource)
3122 {
3123 }
3124
3125protected:
3127 constexpr GPUDevice(const GPUDevice& other) noexcept = default;
3128
3129public:
3131 constexpr GPUDevice(GPUDevice&& other) noexcept
3132 : GPUDevice(other.release())
3133 {
3134 }
3135
3136 constexpr GPUDevice(const GPUDeviceRef& other) = delete;
3137
3138 constexpr GPUDevice(GPUDeviceRef&& other) = delete;
3139
3166 GPUDevice(GPUShaderFormat format_flags, bool debug_mode, StringParam name)
3167 : m_resource(
3168 CheckError(SDL_CreateGPUDevice(format_flags, debug_mode, name)))
3169 {
3170 }
3171
3261 : m_resource(CheckError(SDL_CreateGPUDeviceWithProperties(props)))
3262 {
3263 }
3264
3266 ~GPUDevice() { SDL_DestroyGPUDevice(m_resource); }
3267
3269 constexpr GPUDevice& operator=(GPUDevice&& other) noexcept
3270 {
3271 std::swap(m_resource, other.m_resource);
3272 return *this;
3273 }
3274
3275protected:
3277 constexpr GPUDevice& operator=(const GPUDevice& other) noexcept = default;
3278
3279public:
3281 constexpr GPUDeviceRaw get() const noexcept { return m_resource; }
3282
3284 constexpr GPUDeviceRaw release() noexcept
3285 {
3286 auto r = m_resource;
3287 m_resource = nullptr;
3288 return r;
3289 }
3290
3292 constexpr auto operator<=>(const GPUDevice& other) const noexcept = default;
3293
3295 constexpr explicit operator bool() const noexcept { return !!m_resource; }
3296
3298 constexpr operator GPUDeviceParam() const noexcept { return {m_resource}; }
3299
3307 void Destroy();
3308
3316 const char* GetDriver();
3317
3327
3328#if SDL_VERSION_ATLEAST(3, 4, 0)
3329
3432
3433#endif // SDL_VERSION_ATLEAST(3, 4, 0)
3434
3480 const GPUComputePipelineCreateInfo& createinfo);
3481
3503 const GPUGraphicsPipelineCreateInfo& createinfo);
3504
3526
3599 GPUShader CreateShader(const GPUShaderCreateInfo& createinfo);
3600
3659
3702 GPUBuffer CreateBuffer(const GPUBufferCreateInfo& createinfo);
3703
3731 const GPUTransferBufferCreateInfo& createinfo);
3732
3749 void SetBufferName(GPUBuffer buffer, StringParam text);
3750
3768 void SetTextureName(GPUTexture texture, StringParam text);
3769
3779 void ReleaseTexture(GPUTexture texture);
3780
3790 void ReleaseSampler(GPUSampler sampler);
3791
3801 void ReleaseBuffer(GPUBuffer buffer);
3802
3812 void ReleaseTransferBuffer(GPUTransferBuffer transfer_buffer);
3813
3823 void ReleaseComputePipeline(GPUComputePipeline compute_pipeline);
3824
3834 void ReleaseShader(GPUShader shader);
3835
3845 void ReleaseGraphicsPipeline(GPUGraphicsPipeline graphics_pipeline);
3846
3871
3886 void* MapTransferBuffer(GPUTransferBuffer transfer_buffer, bool cycle);
3887
3895 void UnmapTransferBuffer(GPUTransferBuffer transfer_buffer);
3896
3911 WindowParam window,
3912 GPUSwapchainComposition swapchain_composition);
3913
3928 GPUPresentMode present_mode);
3929
3954 void ClaimWindow(WindowParam window);
3955
3965 void ReleaseWindow(WindowParam window);
3966
3991 GPUSwapchainComposition swapchain_composition,
3992 GPUPresentMode present_mode);
3993
4018 bool SetAllowedFramesInFlight(Uint32 allowed_frames_in_flight);
4019
4031
4047 void WaitForSwapchain(WindowParam window);
4048
4058 void WaitForIdle();
4059
4073 void WaitForFences(bool wait_all, std::span<GPUFence* const> fences);
4074
4085 bool QueryFence(GPUFence* fence);
4086
4098 void ReleaseFence(GPUFence* fence);
4099
4112 GPUTextureType type,
4113 GPUTextureUsageFlags usage);
4114
4125 GPUSampleCount sample_count);
4126
4127#ifdef SDL_PLATFORM_GDK
4128
4140 void GDKSuspendGPU();
4141
4153 void GDKResumeGPU();
4154
4155#endif /* SDL_PLATFORM_GDK */
4156};
4157
4160{
4162
4170 GPUDeviceRef(GPUDeviceParam resource) noexcept
4171 : GPUDevice(resource.value)
4172 {
4173 }
4174
4182 GPUDeviceRef(GPUDeviceRaw resource) noexcept
4183 : GPUDevice(resource)
4184 {
4185 }
4186
4188 constexpr GPUDeviceRef(const GPUDeviceRef& other) noexcept = default;
4189
4192};
4193
4214using GPUPrimitiveType = SDL_GPUPrimitiveType;
4215
4217 SDL_GPU_PRIMITIVETYPE_TRIANGLELIST;
4218
4220 SDL_GPU_PRIMITIVETYPE_TRIANGLESTRIP;
4221
4223 SDL_GPU_PRIMITIVETYPE_LINELIST;
4224
4226 SDL_GPU_PRIMITIVETYPE_LINESTRIP;
4227
4229 SDL_GPU_PRIMITIVETYPE_POINTLIST;
4230
4239using GPULoadOp = SDL_GPULoadOp;
4240
4242constexpr GPULoadOp GPU_LOADOP_LOAD = SDL_GPU_LOADOP_LOAD;
4243
4245constexpr GPULoadOp GPU_LOADOP_CLEAR = SDL_GPU_LOADOP_CLEAR;
4246
4251constexpr GPULoadOp GPU_LOADOP_DONT_CARE = SDL_GPU_LOADOP_DONT_CARE;
4252
4261using GPUStoreOp = SDL_GPUStoreOp;
4262
4264constexpr GPUStoreOp GPU_STOREOP_STORE = SDL_GPU_STOREOP_STORE;
4265
4270constexpr GPUStoreOp GPU_STOREOP_DONT_CARE = SDL_GPU_STOREOP_DONT_CARE;
4271
4277constexpr GPUStoreOp GPU_STOREOP_RESOLVE = SDL_GPU_STOREOP_RESOLVE;
4278
4285 SDL_GPU_STOREOP_RESOLVE_AND_STORE;
4286
4294using GPUCubeMapFace = SDL_GPUCubeMapFace;
4295
4297 SDL_GPU_CUBEMAPFACE_POSITIVEX;
4298
4300 SDL_GPU_CUBEMAPFACE_NEGATIVEX;
4301
4303 SDL_GPU_CUBEMAPFACE_POSITIVEY;
4304
4306 SDL_GPU_CUBEMAPFACE_NEGATIVEY;
4307
4309 SDL_GPU_CUBEMAPFACE_POSITIVEZ;
4310
4312 SDL_GPU_CUBEMAPFACE_NEGATIVEZ;
4313
4332
4334 SDL_GPU_BUFFERUSAGE_VERTEX;
4335
4337 SDL_GPU_BUFFERUSAGE_INDEX;
4338
4340 SDL_GPU_BUFFERUSAGE_INDIRECT;
4341
4343 SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ;
4345
4348 SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ;
4349
4352 SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE;
4353
4364using GPUTransferBufferUsage = SDL_GPUTransferBufferUsage;
4365
4367 SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD;
4368
4370 SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD;
4371
4379using GPUShaderStage = SDL_GPUShaderStage;
4380
4382 SDL_GPU_SHADERSTAGE_VERTEX;
4383
4385 SDL_GPU_SHADERSTAGE_FRAGMENT;
4386
4394using GPUVertexElementFormat = SDL_GPUVertexElementFormat;
4395
4397 SDL_GPU_VERTEXELEMENTFORMAT_INVALID;
4398
4400 SDL_GPU_VERTEXELEMENTFORMAT_INT;
4401
4403 SDL_GPU_VERTEXELEMENTFORMAT_INT2;
4404
4406 SDL_GPU_VERTEXELEMENTFORMAT_INT3;
4407
4409 SDL_GPU_VERTEXELEMENTFORMAT_INT4;
4410
4412 SDL_GPU_VERTEXELEMENTFORMAT_UINT;
4413
4415 SDL_GPU_VERTEXELEMENTFORMAT_UINT2;
4416
4418 SDL_GPU_VERTEXELEMENTFORMAT_UINT3;
4419
4421 SDL_GPU_VERTEXELEMENTFORMAT_UINT4;
4422
4424 SDL_GPU_VERTEXELEMENTFORMAT_FLOAT;
4425
4427 SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2;
4428
4430 SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3;
4431
4433 SDL_GPU_VERTEXELEMENTFORMAT_FLOAT4;
4434
4436 SDL_GPU_VERTEXELEMENTFORMAT_BYTE2;
4437
4439 SDL_GPU_VERTEXELEMENTFORMAT_BYTE4;
4440
4442 SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2;
4443
4445 SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4;
4446
4448 SDL_GPU_VERTEXELEMENTFORMAT_BYTE2_NORM;
4449
4451 SDL_GPU_VERTEXELEMENTFORMAT_BYTE4_NORM;
4452
4454 SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM;
4455
4457 SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM;
4458
4460 SDL_GPU_VERTEXELEMENTFORMAT_SHORT2;
4461
4463 SDL_GPU_VERTEXELEMENTFORMAT_SHORT4;
4464
4466 SDL_GPU_VERTEXELEMENTFORMAT_USHORT2;
4467
4469 SDL_GPU_VERTEXELEMENTFORMAT_USHORT4;
4470
4472 SDL_GPU_VERTEXELEMENTFORMAT_SHORT2_NORM;
4473
4475 SDL_GPU_VERTEXELEMENTFORMAT_SHORT4_NORM;
4476
4478 SDL_GPU_VERTEXELEMENTFORMAT_USHORT2_NORM;
4479
4481 SDL_GPU_VERTEXELEMENTFORMAT_USHORT4_NORM;
4482
4484 SDL_GPU_VERTEXELEMENTFORMAT_HALF2;
4485
4487 SDL_GPU_VERTEXELEMENTFORMAT_HALF4;
4488
4496using GPUVertexInputRate = SDL_GPUVertexInputRate;
4497
4500 SDL_GPU_VERTEXINPUTRATE_VERTEX;
4501
4504 SDL_GPU_VERTEXINPUTRATE_INSTANCE;
4505
4513using GPUFillMode = SDL_GPUFillMode;
4514
4516 SDL_GPU_FILLMODE_FILL;
4517
4519 SDL_GPU_FILLMODE_LINE;
4520
4528using GPUCullMode = SDL_GPUCullMode;
4529
4531 SDL_GPU_CULLMODE_NONE;
4532
4534 SDL_GPU_CULLMODE_FRONT;
4535
4537 SDL_GPU_CULLMODE_BACK;
4538
4547using GPUFrontFace = SDL_GPUFrontFace;
4548
4554 SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE;
4555
4557constexpr GPUFrontFace GPU_FRONTFACE_CLOCKWISE = SDL_GPU_FRONTFACE_CLOCKWISE;
4558
4566using GPUCompareOp = SDL_GPUCompareOp;
4567
4569 SDL_GPU_COMPAREOP_INVALID;
4570
4572 SDL_GPU_COMPAREOP_NEVER;
4573
4575 SDL_GPU_COMPAREOP_LESS;
4576
4578 SDL_GPU_COMPAREOP_EQUAL;
4579
4581 SDL_GPU_COMPAREOP_LESS_OR_EQUAL;
4583
4585 SDL_GPU_COMPAREOP_GREATER;
4586
4588 SDL_GPU_COMPAREOP_NOT_EQUAL;
4589
4591 SDL_GPU_COMPAREOP_GREATER_OR_EQUAL;
4593
4595 SDL_GPU_COMPAREOP_ALWAYS;
4596
4605using GPUStencilOp = SDL_GPUStencilOp;
4606
4608 SDL_GPU_STENCILOP_INVALID;
4609
4611 SDL_GPU_STENCILOP_KEEP;
4612
4614 SDL_GPU_STENCILOP_ZERO;
4615
4617 SDL_GPU_STENCILOP_REPLACE;
4618
4621 SDL_GPU_STENCILOP_INCREMENT_AND_CLAMP;
4622
4624 SDL_GPU_STENCILOP_DECREMENT_AND_CLAMP;
4626
4628 SDL_GPU_STENCILOP_INVERT;
4629
4631 SDL_GPU_STENCILOP_INCREMENT_AND_WRAP;
4633
4636 SDL_GPU_STENCILOP_DECREMENT_AND_WRAP;
4637
4649using GPUBlendOp = SDL_GPUBlendOp;
4650
4652 SDL_GPU_BLENDOP_INVALID;
4653
4655constexpr GPUBlendOp GPU_BLENDOP_ADD = SDL_GPU_BLENDOP_ADD;
4656
4658constexpr GPUBlendOp GPU_BLENDOP_SUBTRACT = SDL_GPU_BLENDOP_SUBTRACT;
4659
4662 SDL_GPU_BLENDOP_REVERSE_SUBTRACT;
4663
4665 SDL_GPU_BLENDOP_MIN;
4666
4668 SDL_GPU_BLENDOP_MAX;
4669
4681using GPUBlendFactor = SDL_GPUBlendFactor;
4682
4684 SDL_GPU_BLENDFACTOR_INVALID;
4685
4686constexpr GPUBlendFactor GPU_BLENDFACTOR_ZERO = SDL_GPU_BLENDFACTOR_ZERO;
4687
4688constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE = SDL_GPU_BLENDFACTOR_ONE;
4689
4691 SDL_GPU_BLENDFACTOR_SRC_COLOR;
4692
4694 SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR;
4695
4697 SDL_GPU_BLENDFACTOR_DST_COLOR;
4698
4700 SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR;
4701
4703 SDL_GPU_BLENDFACTOR_SRC_ALPHA;
4704
4706 SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA;
4707
4709 SDL_GPU_BLENDFACTOR_DST_ALPHA;
4710
4712 SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA;
4713
4715 SDL_GPU_BLENDFACTOR_CONSTANT_COLOR;
4716
4718 SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR;
4719
4721 SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE;
4723
4732
4734 SDL_GPU_COLORCOMPONENT_R;
4735
4737 SDL_GPU_COLORCOMPONENT_G;
4738
4740 SDL_GPU_COLORCOMPONENT_B;
4741
4743 SDL_GPU_COLORCOMPONENT_A;
4744
4752using GPUFilter = SDL_GPUFilter;
4753
4755 SDL_GPU_FILTER_NEAREST;
4756
4758 SDL_GPU_FILTER_LINEAR;
4759
4767using GPUSamplerMipmapMode = SDL_GPUSamplerMipmapMode;
4768
4770 SDL_GPU_SAMPLERMIPMAPMODE_NEAREST;
4771
4773 SDL_GPU_SAMPLERMIPMAPMODE_LINEAR;
4774
4783using GPUSamplerAddressMode = SDL_GPUSamplerAddressMode;
4784
4786 SDL_GPU_SAMPLERADDRESSMODE_REPEAT;
4788
4791 SDL_GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT;
4792
4795 SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE;
4796
4804using GPUBlitRegion = SDL_GPUBlitRegion;
4805
4820using GPUIndirectDrawCommand = SDL_GPUIndirectDrawCommand;
4821
4836using GPUIndexedIndirectDrawCommand = SDL_GPUIndexedIndirectDrawCommand;
4837
4845using GPUIndirectDispatchCommand = SDL_GPUIndirectDispatchCommand;
4846
4865using GPUVertexBufferDescription = SDL_GPUVertexBufferDescription;
4866
4879using GPUVertexAttribute = SDL_GPUVertexAttribute;
4880
4891using GPUVertexInputState = SDL_GPUVertexInputState;
4892
4900using GPUStencilOpState = SDL_GPUStencilOpState;
4901
4912using GPUColorTargetBlendState = SDL_GPUColorTargetBlendState;
4913
4930using GPURasterizerState = SDL_GPURasterizerState;
4931
4940using GPUMultisampleState = SDL_GPUMultisampleState;
4941
4950using GPUDepthStencilState = SDL_GPUDepthStencilState;
4951
4960using GPUColorTargetDescription = SDL_GPUColorTargetDescription;
4961
4972using GPUGraphicsPipelineTargetInfo = SDL_GPUGraphicsPipelineTargetInfo;
4973
4988 StringParam name)
4989{
4990 return SDL_GPUSupportsShaderFormats(format_flags, name);
4991}
4992
5004{
5005 return SDL_GPUSupportsProperties(props);
5006}
5007
5035 bool debug_mode,
5036 StringParam name)
5037{
5038 return GPUDevice(format_flags, debug_mode, std::move(name));
5039}
5040
5129{
5130 return GPUDevice(props);
5131}
5132
5133namespace prop::GpuDevice {
5134
5135constexpr auto CREATE_DEBUGMODE_BOOLEAN =
5136 SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN;
5137
5138constexpr auto CREATE_PREFERLOWPOWER_BOOLEAN =
5139 SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN;
5140
5141#if SDL_VERSION_ATLEAST(3, 4, 0)
5142
5143constexpr auto CREATE_VERBOSE_BOOLEAN =
5144 SDL_PROP_GPU_DEVICE_CREATE_VERBOSE_BOOLEAN;
5145
5146#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5147
5148constexpr auto CREATE_NAME_STRING = SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING;
5149
5150#if SDL_VERSION_ATLEAST(3, 4, 0)
5151
5152constexpr auto CREATE_FEATURE_CLIP_DISTANCE_BOOLEAN =
5153 SDL_PROP_GPU_DEVICE_CREATE_FEATURE_CLIP_DISTANCE_BOOLEAN;
5154
5155constexpr auto CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN =
5156 SDL_PROP_GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN;
5157
5158constexpr auto CREATE_FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN =
5159 SDL_PROP_GPU_DEVICE_CREATE_FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN;
5160
5161constexpr auto CREATE_FEATURE_ANISOTROPY_BOOLEAN =
5162 SDL_PROP_GPU_DEVICE_CREATE_FEATURE_ANISOTROPY_BOOLEAN;
5163
5164#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5165
5166constexpr auto CREATE_SHADERS_PRIVATE_BOOLEAN =
5167 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN;
5168
5169constexpr auto CREATE_SHADERS_SPIRV_BOOLEAN =
5170 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOLEAN;
5171
5172constexpr auto CREATE_SHADERS_DXBC_BOOLEAN =
5173 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOLEAN;
5174
5175constexpr auto CREATE_SHADERS_DXIL_BOOLEAN =
5176 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN;
5177
5178constexpr auto CREATE_SHADERS_MSL_BOOLEAN =
5179 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN;
5180
5181constexpr auto CREATE_SHADERS_METALLIB_BOOLEAN =
5182 SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN;
5183
5184#if SDL_VERSION_ATLEAST(3, 4, 0)
5185
5186constexpr auto CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN =
5187 SDL_PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN;
5188
5189#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5190
5191constexpr auto CREATE_D3D12_SEMANTIC_NAME_STRING =
5192 SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING;
5193
5194#if SDL_VERSION_ATLEAST(3, 4, 0)
5195
5196constexpr auto CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN =
5197 SDL_PROP_GPU_DEVICE_CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN;
5198
5199constexpr auto CREATE_VULKAN_OPTIONS_POINTER =
5200 SDL_PROP_GPU_DEVICE_CREATE_VULKAN_OPTIONS_POINTER;
5201
5202constexpr auto NAME_STRING = SDL_PROP_GPU_DEVICE_NAME_STRING;
5203
5204constexpr auto DRIVER_NAME_STRING = SDL_PROP_GPU_DEVICE_DRIVER_NAME_STRING;
5205
5206constexpr auto DRIVER_VERSION_STRING =
5207 SDL_PROP_GPU_DEVICE_DRIVER_VERSION_STRING;
5208
5209constexpr auto DRIVER_INFO_STRING = SDL_PROP_GPU_DEVICE_DRIVER_INFO_STRING;
5210
5211#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5212
5213} // namespace prop::GpuDevice
5214
5215#if SDL_VERSION_ATLEAST(3, 4, 0)
5216
5233using GPUVulkanOptions = SDL_GPUVulkanOptions;
5234
5235#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5236
5247{
5248 SDL_DestroyGPUDevice(device);
5249}
5250
5252
5262inline int GetNumGPUDrivers() { return SDL_GetNumGPUDrivers(); }
5263
5281inline const char* GetGPUDriver(int index) { return SDL_GetGPUDriver(index); }
5282
5291inline const char* GetGPUDeviceDriver(GPUDeviceParam device)
5292{
5293 return SDL_GetGPUDeviceDriver(device);
5294}
5295
5296inline const char* GPUDevice::GetDriver()
5297{
5298 return SDL::GetGPUDeviceDriver(m_resource);
5299}
5300
5311{
5312 return SDL_GetGPUShaderFormats(device);
5313}
5314
5316{
5317 return SDL::GetGPUShaderFormats(m_resource);
5318}
5319
5320#if SDL_VERSION_ATLEAST(3, 4, 0)
5321
5425{
5426 return CheckError(SDL_GetGPUDeviceProperties(device));
5427}
5428
5430{
5431 return SDL::GetGPUDeviceProperties(m_resource);
5432}
5433
5434#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5435
5482 GPUDeviceParam device,
5483 const GPUComputePipelineCreateInfo& createinfo)
5484{
5485 return GPUComputePipeline(device, createinfo);
5486}
5487
5489 const GPUComputePipelineCreateInfo& createinfo)
5490{
5491 return GPUComputePipeline(m_resource, createinfo);
5492}
5493
5494namespace prop::GPUComputePipeline {
5495
5496constexpr auto CREATE_NAME_STRING =
5497 SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING;
5498
5499} // namespace prop::GPUComputePipeline
5500
5523 GPUDeviceParam device,
5524 const GPUGraphicsPipelineCreateInfo& createinfo)
5525{
5526 return GPUGraphicsPipeline(device, createinfo);
5527}
5528
5530 const GPUGraphicsPipelineCreateInfo& createinfo)
5531{
5532 return GPUGraphicsPipeline(m_resource, createinfo);
5533}
5534
5535namespace prop::GPUGraphicsPipeline {
5536
5537constexpr auto CREATE_NAME_STRING =
5538 SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING;
5539
5540} // namespace prop::GPUGraphicsPipeline
5541
5564 const GPUSamplerCreateInfo& createinfo)
5565{
5566 return GPUSampler(device, createinfo);
5567}
5568
5570 const GPUSamplerCreateInfo& createinfo)
5571{
5572 return GPUSampler(m_resource, createinfo);
5573}
5574
5575namespace prop::GPUSampler {
5576
5577constexpr auto CREATE_NAME_STRING = SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING;
5578
5579} // namespace prop::GPUSampler
5580
5652 const GPUShaderCreateInfo& createinfo)
5653{
5654 return GPUShader(device, createinfo);
5655}
5656
5658{
5659 return GPUShader(m_resource, createinfo);
5660}
5661
5662namespace prop::GPUShader {
5663
5664constexpr auto CREATE_NAME_STRING = SDL_PROP_GPU_SHADER_CREATE_NAME_STRING;
5665
5666} // namespace prop::GPUShader
5667
5727 const GPUTextureCreateInfo& createinfo)
5728{
5729 return GPUTexture(device, createinfo);
5730}
5731
5733 const GPUTextureCreateInfo& createinfo)
5734{
5735 return GPUTexture(m_resource, createinfo);
5736}
5737
5738namespace prop::GPUTexture {
5739
5740constexpr auto CREATE_D3D12_CLEAR_R_FLOAT =
5741 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT;
5742
5743constexpr auto CREATE_D3D12_CLEAR_G_FLOAT =
5744 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT;
5745
5746constexpr auto CREATE_D3D12_CLEAR_B_FLOAT =
5747 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT;
5748
5749constexpr auto CREATE_D3D12_CLEAR_A_FLOAT =
5750 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT;
5751
5752constexpr auto CREATE_D3D12_CLEAR_DEPTH_FLOAT =
5753 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT;
5754
5755#if SDL_VERSION_ATLEAST(3, 2, 12)
5756
5757constexpr auto CREATE_D3D12_CLEAR_STENCIL_NUMBER =
5758 SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_NUMBER;
5759
5760#endif // SDL_VERSION_ATLEAST(3, 2, 12)
5761
5762constexpr auto CREATE_NAME_STRING = SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING;
5763
5764} // namespace prop::GPUTexture
5765
5810 const GPUBufferCreateInfo& createinfo)
5811{
5812 return GPUBuffer(device, createinfo);
5813}
5814
5816{
5817 return GPUBuffer(m_resource, createinfo);
5818}
5819
5820namespace prop::GPUBuffer {
5821
5822constexpr auto CREATE_NAME_STRING = SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING;
5823
5824} // namespace prop::GPUBuffer
5825
5854 GPUDeviceParam device,
5855 const GPUTransferBufferCreateInfo& createinfo)
5856{
5857 return GPUTransferBuffer(device, createinfo);
5858}
5859
5861 const GPUTransferBufferCreateInfo& createinfo)
5862{
5863 return GPUTransferBuffer(m_resource, createinfo);
5864}
5865
5866namespace prop::GPUTransferBuffer {
5867
5868constexpr auto CREATE_NAME_STRING =
5869 SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING;
5870
5871} // namespace prop::GPUTransferBuffer
5872
5891 GPUBuffer buffer,
5892 StringParam text)
5893{
5894 SDL_SetGPUBufferName(device, buffer, text);
5895}
5896
5898{
5899 SDL::SetGPUBufferName(m_resource, buffer, std::move(text));
5900}
5901
5920 GPUTexture texture,
5921 StringParam text)
5922{
5923 SDL_SetGPUTextureName(device, texture, text);
5924}
5925
5927{
5928 SDL::SetGPUTextureName(m_resource, texture, std::move(text));
5929}
5930
5947inline void InsertGPUDebugLabel(GPUCommandBuffer command_buffer,
5948 StringParam text)
5949{
5950 SDL_InsertGPUDebugLabel(command_buffer, text);
5951}
5952
5954{
5955 SDL::InsertGPUDebugLabel(m_gPUCommandBuffer, std::move(text));
5956}
5957
5985inline void PushGPUDebugGroup(GPUCommandBuffer command_buffer, StringParam name)
5986{
5987 SDL_PushGPUDebugGroup(command_buffer, name);
5988}
5989
5991{
5992 SDL::PushGPUDebugGroup(m_gPUCommandBuffer, std::move(name));
5993}
5994
6010inline void PopGPUDebugGroup(GPUCommandBuffer command_buffer)
6011{
6012 SDL_PopGPUDebugGroup(command_buffer);
6013}
6014
6016{
6017 SDL::PopGPUDebugGroup(m_gPUCommandBuffer);
6018}
6019
6030inline void ReleaseGPUTexture(GPUDeviceParam device, GPUTexture texture)
6031{
6032 SDL_ReleaseGPUTexture(device, texture);
6033}
6034
6036{
6037 SDL::ReleaseGPUTexture(m_resource, texture);
6038}
6039
6050inline void ReleaseGPUSampler(GPUDeviceParam device, GPUSampler sampler)
6051{
6052 SDL_ReleaseGPUSampler(device, sampler);
6053}
6054
6056{
6057 SDL::ReleaseGPUSampler(m_resource, sampler);
6058}
6059
6070inline void ReleaseGPUBuffer(GPUDeviceParam device, GPUBuffer buffer)
6071{
6072 SDL_ReleaseGPUBuffer(device, buffer);
6073}
6074
6076{
6077 SDL::ReleaseGPUBuffer(m_resource, buffer);
6078}
6079
6091 GPUTransferBuffer transfer_buffer)
6092{
6093 SDL_ReleaseGPUTransferBuffer(device, transfer_buffer);
6094}
6095
6097{
6098 SDL::ReleaseGPUTransferBuffer(m_resource, transfer_buffer);
6099}
6100
6112 GPUComputePipeline compute_pipeline)
6113{
6114 SDL_ReleaseGPUComputePipeline(device, compute_pipeline);
6115}
6116
6118 GPUComputePipeline compute_pipeline)
6119{
6120 SDL::ReleaseGPUComputePipeline(m_resource, compute_pipeline);
6121}
6122
6133inline void ReleaseGPUShader(GPUDeviceParam device, GPUShader shader)
6134{
6135 SDL_ReleaseGPUShader(device, shader);
6136}
6137
6139{
6140 SDL::ReleaseGPUShader(m_resource, shader);
6141}
6142
6154 GPUGraphicsPipeline graphics_pipeline)
6155{
6156 SDL_ReleaseGPUGraphicsPipeline(device, graphics_pipeline);
6157}
6158
6160 GPUGraphicsPipeline graphics_pipeline)
6161{
6162 SDL::ReleaseGPUGraphicsPipeline(m_resource, graphics_pipeline);
6163}
6164
6190{
6191 return SDL_AcquireGPUCommandBuffer(device);
6192}
6193
6195{
6196 return SDL::AcquireGPUCommandBuffer(m_resource);
6197}
6198
6218 Uint32 slot_index,
6219 SourceBytes data)
6220{
6221 SDL_PushGPUVertexUniformData(
6222 command_buffer, slot_index, data.data(), data.size_bytes());
6223}
6224
6226 SourceBytes data)
6227{
6229 m_gPUCommandBuffer, slot_index, std::move(data));
6230}
6231
6248 Uint32 slot_index,
6249 SourceBytes data)
6250{
6251 SDL_PushGPUFragmentUniformData(
6252 command_buffer, slot_index, data.data(), data.size_bytes());
6253}
6254
6256 SourceBytes data)
6257{
6259 m_gPUCommandBuffer, slot_index, std::move(data));
6260}
6261
6278 Uint32 slot_index,
6279 SourceBytes data)
6280{
6281 SDL_PushGPUComputeUniformData(
6282 command_buffer, slot_index, data.data(), data.size_bytes());
6283}
6284
6286 SourceBytes data)
6287{
6289 m_gPUCommandBuffer, slot_index, std::move(data));
6290}
6291
6324 GPUCommandBuffer command_buffer,
6325 std::span<const GPUColorTargetInfo> color_target_infos,
6326 OptionalRef<const GPUDepthStencilTargetInfo> depth_stencil_target_info)
6327{
6328 return SDL_BeginGPURenderPass(command_buffer,
6329 color_target_infos.data(),
6330 color_target_infos.size(),
6331 depth_stencil_target_info);
6332}
6333
6335 std::span<const GPUColorTargetInfo> color_target_infos,
6336 OptionalRef<const GPUDepthStencilTargetInfo> depth_stencil_target_info)
6337{
6339 m_gPUCommandBuffer, color_target_infos, depth_stencil_target_info);
6340}
6341
6353 GPUGraphicsPipeline graphics_pipeline)
6354{
6355 SDL_BindGPUGraphicsPipeline(render_pass, graphics_pipeline);
6356}
6357
6359{
6360 SDL::BindGPUGraphicsPipeline(m_gPURenderPass, graphics_pipeline);
6361}
6362
6371inline void SetGPUViewport(GPURenderPass render_pass,
6372 const GPUViewport& viewport)
6373{
6374 SDL_SetGPUViewport(render_pass, &viewport);
6375}
6376
6377inline void GPURenderPass::SetViewport(const GPUViewport& viewport)
6378{
6379 SDL::SetGPUViewport(m_gPURenderPass, viewport);
6380}
6381
6390inline void SetGPUScissor(GPURenderPass render_pass, const RectRaw& scissor)
6391{
6392 SDL_SetGPUScissor(render_pass, &scissor);
6393}
6394
6395inline void GPURenderPass::SetScissor(const RectRaw& scissor)
6396{
6397 SDL::SetGPUScissor(m_gPURenderPass, scissor);
6398}
6399
6411inline void SetGPUBlendConstants(GPURenderPass render_pass,
6412 FColorRaw blend_constants)
6413{
6414 SDL_SetGPUBlendConstants(render_pass, blend_constants);
6415}
6416
6418{
6419 SDL::SetGPUBlendConstants(m_gPURenderPass, blend_constants);
6420}
6421
6430inline void SetGPUStencilReference(GPURenderPass render_pass, Uint8 reference)
6431{
6432 SDL_SetGPUStencilReference(render_pass, reference);
6433}
6434
6436{
6437 SDL::SetGPUStencilReference(m_gPURenderPass, reference);
6438}
6439
6450inline void BindGPUVertexBuffers(GPURenderPass render_pass,
6451 Uint32 first_slot,
6452 std::span<const GPUBufferBinding> bindings)
6453{
6454 SDL_BindGPUVertexBuffers(
6455 render_pass, first_slot, bindings.data(), bindings.size());
6456}
6457
6459 Uint32 first_slot,
6460 std::span<const GPUBufferBinding> bindings)
6461{
6462 SDL::BindGPUVertexBuffers(m_gPURenderPass, first_slot, bindings);
6463}
6464
6475inline void BindGPUIndexBuffer(GPURenderPass render_pass,
6476 const GPUBufferBinding& binding,
6477 GPUIndexElementSize index_element_size)
6478{
6479 SDL_BindGPUIndexBuffer(render_pass, &binding, index_element_size);
6480}
6481
6483 const GPUBufferBinding& binding,
6484 GPUIndexElementSize index_element_size)
6485{
6486 SDL::BindGPUIndexBuffer(m_gPURenderPass, binding, index_element_size);
6487}
6488
6506 GPURenderPass render_pass,
6507 Uint32 first_slot,
6508 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
6509{
6510 SDL_BindGPUVertexSamplers(render_pass,
6511 first_slot,
6512 texture_sampler_bindings.data(),
6513 texture_sampler_bindings.size());
6514}
6515
6517 Uint32 first_slot,
6518 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
6519{
6521 m_gPURenderPass, first_slot, texture_sampler_bindings);
6522}
6523
6542 GPURenderPass render_pass,
6543 Uint32 first_slot,
6544 SpanRef<const GPUTextureRaw> storage_textures)
6545{
6546 SDL_BindGPUVertexStorageTextures(
6547 render_pass, first_slot, storage_textures.data(), storage_textures.size());
6548}
6549
6551 Uint32 first_slot,
6552 SpanRef<const GPUTextureRaw> storage_textures)
6553{
6555 m_gPURenderPass, first_slot, storage_textures);
6556}
6557
6576 GPURenderPass render_pass,
6577 Uint32 first_slot,
6578 SpanRef<const GPUBufferRaw> storage_buffers)
6579{
6580 SDL_BindGPUVertexStorageBuffers(
6581 render_pass, first_slot, storage_buffers.data(), storage_buffers.size());
6582}
6583
6585 Uint32 first_slot,
6586 SpanRef<const GPUBufferRaw> storage_buffers)
6587{
6589 m_gPURenderPass, first_slot, storage_buffers);
6590}
6591
6609 GPURenderPass render_pass,
6610 Uint32 first_slot,
6611 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
6612{
6613 SDL_BindGPUFragmentSamplers(render_pass,
6614 first_slot,
6615 texture_sampler_bindings.data(),
6616 texture_sampler_bindings.size());
6617}
6618
6620 Uint32 first_slot,
6621 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
6622{
6624 m_gPURenderPass, first_slot, texture_sampler_bindings);
6625}
6626
6645 GPURenderPass render_pass,
6646 Uint32 first_slot,
6647 SpanRef<const GPUTextureRaw> storage_textures)
6648{
6649 SDL_BindGPUFragmentStorageTextures(
6650 render_pass, first_slot, storage_textures.data(), storage_textures.size());
6651}
6652
6654 Uint32 first_slot,
6655 SpanRef<const GPUTextureRaw> storage_textures)
6656{
6658 m_gPURenderPass, first_slot, storage_textures);
6659}
6660
6679 GPURenderPass render_pass,
6680 Uint32 first_slot,
6681 SpanRef<const GPUBufferRaw> storage_buffers)
6682{
6683 SDL_BindGPUFragmentStorageBuffers(
6684 render_pass, first_slot, storage_buffers.data(), storage_buffers.size());
6685}
6686
6688 Uint32 first_slot,
6689 SpanRef<const GPUBufferRaw> storage_buffers)
6690{
6692 m_gPURenderPass, first_slot, storage_buffers);
6693}
6694
6719 Uint32 num_indices,
6720 Uint32 num_instances,
6721 Uint32 first_index,
6722 Sint32 vertex_offset,
6723 Uint32 first_instance)
6724{
6725 SDL_DrawGPUIndexedPrimitives(render_pass,
6726 num_indices,
6727 num_instances,
6728 first_index,
6729 vertex_offset,
6730 first_instance);
6731}
6732
6734 Uint32 num_instances,
6735 Uint32 first_index,
6736 Sint32 vertex_offset,
6737 Uint32 first_instance)
6738{
6739 SDL::DrawGPUIndexedPrimitives(m_gPURenderPass,
6740 num_indices,
6741 num_instances,
6742 first_index,
6743 vertex_offset,
6744 first_instance);
6745}
6746
6767inline void DrawGPUPrimitives(GPURenderPass render_pass,
6768 Uint32 num_vertices,
6769 Uint32 num_instances,
6770 Uint32 first_vertex,
6771 Uint32 first_instance)
6772{
6773 SDL_DrawGPUPrimitives(
6774 render_pass, num_vertices, num_instances, first_vertex, first_instance);
6775}
6776
6777inline void GPURenderPass::DrawPrimitives(Uint32 num_vertices,
6778 Uint32 num_instances,
6779 Uint32 first_vertex,
6780 Uint32 first_instance)
6781{
6783 m_gPURenderPass, num_vertices, num_instances, first_vertex, first_instance);
6784}
6785
6803 GPUBuffer buffer,
6804 Uint32 offset,
6805 Uint32 draw_count)
6806{
6807 SDL_DrawGPUPrimitivesIndirect(render_pass, buffer, offset, draw_count);
6808}
6809
6811 Uint32 offset,
6812 Uint32 draw_count)
6813{
6814 SDL::DrawGPUPrimitivesIndirect(m_gPURenderPass, buffer, offset, draw_count);
6815}
6816
6834 GPUBuffer buffer,
6835 Uint32 offset,
6836 Uint32 draw_count)
6837{
6838 SDL_DrawGPUIndexedPrimitivesIndirect(render_pass, buffer, offset, draw_count);
6839}
6840
6842 Uint32 offset,
6843 Uint32 draw_count)
6844{
6846 m_gPURenderPass, buffer, offset, draw_count);
6847}
6848
6859inline void EndGPURenderPass(GPURenderPass render_pass)
6860{
6861 SDL_EndGPURenderPass(render_pass);
6862}
6863
6864inline void GPURenderPass::End() { SDL::EndGPURenderPass(m_gPURenderPass); }
6865
6900 GPUCommandBuffer command_buffer,
6901 std::span<const GPUStorageTextureReadWriteBinding> storage_texture_bindings,
6902 std::span<const GPUStorageBufferReadWriteBinding> storage_buffer_bindings)
6903{
6904 return SDL_BeginGPUComputePass(command_buffer,
6905 storage_texture_bindings.data(),
6906 storage_texture_bindings.size(),
6907 storage_buffer_bindings.data(),
6908 storage_buffer_bindings.size());
6909}
6910
6912 std::span<const GPUStorageTextureReadWriteBinding> storage_texture_bindings,
6913 std::span<const GPUStorageBufferReadWriteBinding> storage_buffer_bindings)
6914{
6916 m_gPUCommandBuffer, storage_texture_bindings, storage_buffer_bindings);
6917}
6918
6928 GPUComputePipeline compute_pipeline)
6929{
6930 SDL_BindGPUComputePipeline(compute_pass, compute_pipeline);
6931}
6932
6934{
6935 SDL::BindGPUComputePipeline(m_gPUComputePass, compute_pipeline);
6936}
6937
6955 GPUComputePass compute_pass,
6956 Uint32 first_slot,
6957 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
6958{
6959 SDL_BindGPUComputeSamplers(compute_pass,
6960 first_slot,
6961 texture_sampler_bindings.data(),
6962 texture_sampler_bindings.size());
6963}
6964
6966 Uint32 first_slot,
6967 std::span<const GPUTextureSamplerBinding> texture_sampler_bindings)
6968{
6970 m_gPUComputePass, first_slot, texture_sampler_bindings);
6971}
6972
6991 GPUComputePass compute_pass,
6992 Uint32 first_slot,
6993 SpanRef<const GPUTextureRaw> storage_textures)
6994{
6995 SDL_BindGPUComputeStorageTextures(
6996 compute_pass, first_slot, storage_textures.data(), storage_textures.size());
6997}
6998
7000 Uint32 first_slot,
7001 SpanRef<const GPUTextureRaw> storage_textures)
7002{
7004 m_gPUComputePass, first_slot, storage_textures);
7005}
7006
7025 GPUComputePass compute_pass,
7026 Uint32 first_slot,
7027 SpanRef<const GPUBufferRaw> storage_buffers)
7028{
7029 SDL_BindGPUComputeStorageBuffers(
7030 compute_pass, first_slot, storage_buffers.data(), storage_buffers.size());
7031}
7032
7034 Uint32 first_slot,
7035 SpanRef<const GPUBufferRaw> storage_buffers)
7036{
7038 m_gPUComputePass, first_slot, storage_buffers);
7039}
7040
7061inline void DispatchGPUCompute(GPUComputePass compute_pass,
7062 Uint32 groupcount_x,
7063 Uint32 groupcount_y,
7064 Uint32 groupcount_z)
7065{
7066 SDL_DispatchGPUCompute(
7067 compute_pass, groupcount_x, groupcount_y, groupcount_z);
7068}
7069
7070inline void GPUComputePass::Dispatch(Uint32 groupcount_x,
7071 Uint32 groupcount_y,
7072 Uint32 groupcount_z)
7073{
7075 m_gPUComputePass, groupcount_x, groupcount_y, groupcount_z);
7076}
7077
7096 GPUBuffer buffer,
7097 Uint32 offset)
7098{
7099 SDL_DispatchGPUComputeIndirect(compute_pass, buffer, offset);
7100}
7101
7103{
7104 SDL::DispatchGPUComputeIndirect(m_gPUComputePass, buffer, offset);
7105}
7106
7117inline void EndGPUComputePass(GPUComputePass compute_pass)
7118{
7119 SDL_EndGPUComputePass(compute_pass);
7120}
7121
7122inline void GPUComputePass::End() { SDL::EndGPUComputePass(m_gPUComputePass); }
7123
7140 GPUTransferBuffer transfer_buffer,
7141 bool cycle)
7142{
7143 return SDL_MapGPUTransferBuffer(device, transfer_buffer, cycle);
7144}
7145
7147 bool cycle)
7148{
7149 return SDL::MapGPUTransferBuffer(m_resource, transfer_buffer, cycle);
7150}
7151
7161 GPUTransferBuffer transfer_buffer)
7162{
7163 SDL_UnmapGPUTransferBuffer(device, transfer_buffer);
7164}
7165
7167{
7168 SDL::UnmapGPUTransferBuffer(m_resource, transfer_buffer);
7169}
7170
7186{
7187 return SDL_BeginGPUCopyPass(command_buffer);
7188}
7189
7191{
7192 return SDL::BeginGPUCopyPass(m_gPUCommandBuffer);
7193}
7194
7212inline void UploadToGPUTexture(GPUCopyPass copy_pass,
7213 const GPUTextureTransferInfo& source,
7214 const GPUTextureRegion& destination,
7215 bool cycle)
7216{
7217 SDL_UploadToGPUTexture(copy_pass, &source, &destination, cycle);
7218}
7219
7221 const GPUTextureRegion& destination,
7222 bool cycle)
7223{
7224 SDL::UploadToGPUTexture(m_gPUCopyPass, source, destination, cycle);
7225}
7226
7241inline void UploadToGPUBuffer(GPUCopyPass copy_pass,
7242 const GPUTransferBufferLocation& source,
7243 const GPUBufferRegion& destination,
7244 bool cycle)
7245{
7246 SDL_UploadToGPUBuffer(copy_pass, &source, &destination, cycle);
7247}
7248
7250 const GPUBufferRegion& destination,
7251 bool cycle)
7252{
7253 SDL::UploadToGPUBuffer(m_gPUCopyPass, source, destination, cycle);
7254}
7255
7277 const GPUTextureLocation& source,
7278 const GPUTextureLocation& destination,
7279 Uint32 w,
7280 Uint32 h,
7281 Uint32 d,
7282 bool cycle)
7283{
7284 SDL_CopyGPUTextureToTexture(copy_pass, &source, &destination, w, h, d, cycle);
7285}
7286
7288 const GPUTextureLocation& source,
7289 const GPUTextureLocation& destination,
7290 Uint32 w,
7291 Uint32 h,
7292 Uint32 d,
7293 bool cycle)
7294{
7296 m_gPUCopyPass, source, destination, w, h, d, cycle);
7297}
7298
7315 const GPUBufferLocation& source,
7316 const GPUBufferLocation& destination,
7317 Uint32 size,
7318 bool cycle)
7319{
7320 SDL_CopyGPUBufferToBuffer(copy_pass, &source, &destination, size, cycle);
7321}
7322
7324 const GPUBufferLocation& source,
7325 const GPUBufferLocation& destination,
7326 Uint32 size,
7327 bool cycle)
7328{
7329 SDL::CopyGPUBufferToBuffer(m_gPUCopyPass, source, destination, size, cycle);
7330}
7331
7346 const GPUTextureRegion& source,
7347 const GPUTextureTransferInfo& destination)
7348{
7349 SDL_DownloadFromGPUTexture(copy_pass, &source, &destination);
7350}
7351
7353 const GPUTextureRegion& source,
7354 const GPUTextureTransferInfo& destination)
7355{
7356 SDL::DownloadFromGPUTexture(m_gPUCopyPass, source, destination);
7357}
7358
7372 const GPUBufferRegion& source,
7373 const GPUTransferBufferLocation& destination)
7374{
7375 SDL_DownloadFromGPUBuffer(copy_pass, &source, &destination);
7376}
7377
7379 const GPUBufferRegion& source,
7380 const GPUTransferBufferLocation& destination)
7381{
7382 SDL::DownloadFromGPUBuffer(m_gPUCopyPass, source, destination);
7383}
7384
7392inline void EndGPUCopyPass(GPUCopyPass copy_pass)
7393{
7394 SDL_EndGPUCopyPass(copy_pass);
7395}
7396
7397inline void GPUCopyPass::End() { SDL::EndGPUCopyPass(m_gPUCopyPass); }
7398
7410 GPUTexture texture)
7411{
7412 SDL_GenerateMipmapsForGPUTexture(command_buffer, texture);
7413}
7414
7416{
7417 SDL::GenerateMipmapsForGPUTexture(m_gPUCommandBuffer, texture);
7418}
7419
7430inline void BlitGPUTexture(GPUCommandBuffer command_buffer,
7431 const GPUBlitInfo& info)
7432{
7433 SDL_BlitGPUTexture(command_buffer, &info);
7434}
7435
7437{
7438 SDL::BlitGPUTexture(m_gPUCommandBuffer, info);
7439}
7440
7456 GPUDeviceParam device,
7457 WindowParam window,
7458 GPUSwapchainComposition swapchain_composition)
7459{
7460 return SDL_WindowSupportsGPUSwapchainComposition(
7461 device, window, swapchain_composition);
7462}
7463
7465 WindowParam window,
7466 GPUSwapchainComposition swapchain_composition)
7467{
7469 m_resource, window, swapchain_composition);
7470}
7471
7487 WindowParam window,
7488 GPUPresentMode present_mode)
7489{
7490 return SDL_WindowSupportsGPUPresentMode(device, window, present_mode);
7491}
7492
7494 GPUPresentMode present_mode)
7495{
7496 return SDL::WindowSupportsGPUPresentMode(m_resource, window, present_mode);
7497}
7498
7525{
7526 CheckError(SDL_ClaimWindowForGPUDevice(device, window));
7527}
7528
7530{
7531 SDL::ClaimWindowForGPUDevice(m_resource, window);
7532}
7533
7545 WindowParam window)
7546{
7547 SDL_ReleaseWindowFromGPUDevice(device, window);
7548}
7549
7551{
7552 SDL::ReleaseWindowFromGPUDevice(m_resource, window);
7553}
7554
7578 GPUDeviceParam device,
7579 WindowParam window,
7580 GPUSwapchainComposition swapchain_composition,
7581 GPUPresentMode present_mode)
7582{
7583 return SDL_SetGPUSwapchainParameters(
7584 device, window, swapchain_composition, present_mode);
7585}
7586
7588 WindowParam window,
7589 GPUSwapchainComposition swapchain_composition,
7590 GPUPresentMode present_mode)
7591{
7593 m_resource, window, swapchain_composition, present_mode);
7594}
7595
7622 Uint32 allowed_frames_in_flight)
7623{
7624 return SDL_SetGPUAllowedFramesInFlight(device, allowed_frames_in_flight);
7625}
7626
7627inline bool GPUDevice::SetAllowedFramesInFlight(Uint32 allowed_frames_in_flight)
7628{
7629 return SDL::SetGPUAllowedFramesInFlight(m_resource, allowed_frames_in_flight);
7630}
7631
7644 WindowParam window)
7645{
7646 return SDL_GetGPUSwapchainTextureFormat(device, window);
7647}
7648
7650{
7651 return SDL::GetGPUSwapchainTextureFormat(m_resource, window);
7652}
7653
7701 GPUCommandBuffer command_buffer,
7702 WindowParam window,
7703 Uint32* swapchain_texture_width = nullptr,
7704 Uint32* swapchain_texture_height = nullptr)
7705{
7706 GPUTextureRaw texture;
7707 CheckError(SDL_AcquireGPUSwapchainTexture(command_buffer,
7708 window,
7709 &texture,
7710 swapchain_texture_width,
7711 swapchain_texture_height));
7712 return texture;
7713}
7714
7716 WindowParam window,
7717 Uint32* swapchain_texture_width,
7718 Uint32* swapchain_texture_height)
7719{
7720 return SDL::AcquireGPUSwapchainTexture(m_gPUCommandBuffer,
7721 window,
7722 swapchain_texture_width,
7723 swapchain_texture_height);
7724}
7725
7743{
7744 CheckError(SDL_WaitForGPUSwapchain(device, window));
7745}
7746
7748{
7749 SDL::WaitForGPUSwapchain(m_resource, window);
7750}
7751
7793 GPUCommandBuffer command_buffer,
7794 WindowParam window,
7795 Uint32* swapchain_texture_width = nullptr,
7796 Uint32* swapchain_texture_height = nullptr)
7797{
7798 GPUTextureRaw texture;
7799 CheckError(SDL_WaitAndAcquireGPUSwapchainTexture(command_buffer,
7800 window,
7801 &texture,
7802 swapchain_texture_width,
7803 swapchain_texture_height));
7804 return texture;
7805}
7806
7808 WindowParam window,
7809 Uint32* swapchain_texture_width,
7810 Uint32* swapchain_texture_height)
7811{
7812 return SDL::WaitAndAcquireGPUSwapchainTexture(m_gPUCommandBuffer,
7813 window,
7814 swapchain_texture_width,
7815 swapchain_texture_height);
7816}
7817
7838inline void SubmitGPUCommandBuffer(GPUCommandBuffer command_buffer)
7839{
7840 CheckError(SDL_SubmitGPUCommandBuffer(command_buffer));
7841}
7842
7844{
7845 SDL::SubmitGPUCommandBuffer(m_gPUCommandBuffer);
7846}
7847
7873 GPUCommandBuffer command_buffer)
7874{
7875 return SDL_SubmitGPUCommandBufferAndAcquireFence(command_buffer);
7876}
7877
7879{
7880 return SDL::SubmitGPUCommandBufferAndAcquireFence(m_gPUCommandBuffer);
7881}
7882
7904inline void CancelGPUCommandBuffer(GPUCommandBuffer command_buffer)
7905{
7906 CheckError(SDL_CancelGPUCommandBuffer(command_buffer));
7907}
7908
7910{
7911 SDL::CancelGPUCommandBuffer(m_gPUCommandBuffer);
7912}
7913
7925{
7926 CheckError(SDL_WaitForGPUIdle(device));
7927}
7928
7929inline void GPUDevice::WaitForIdle() { SDL::WaitForGPUIdle(m_resource); }
7930
7946 bool wait_all,
7947 std::span<GPUFence* const> fences)
7948{
7949 CheckError(
7950 SDL_WaitForGPUFences(device, wait_all, fences.data(), fences.size()));
7951}
7952
7953inline void GPUDevice::WaitForFences(bool wait_all,
7954 std::span<GPUFence* const> fences)
7955{
7956 SDL::WaitForGPUFences(m_resource, wait_all, fences);
7957}
7958
7970inline bool QueryGPUFence(GPUDeviceParam device, GPUFence* fence)
7971{
7972 return SDL_QueryGPUFence(device, fence);
7973}
7974
7976{
7977 return SDL::QueryGPUFence(m_resource, fence);
7978}
7979
7992inline void ReleaseGPUFence(GPUDeviceParam device, GPUFence* fence)
7993{
7994 SDL_ReleaseGPUFence(device, fence);
7995}
7996
7998{
7999 SDL::ReleaseGPUFence(m_resource, fence);
8000}
8001
8013{
8014 return SDL_GPUTextureFormatTexelBlockSize(format);
8015}
8016
8029 GPUTextureFormat format,
8030 GPUTextureType type,
8032{
8033 return SDL_GPUTextureSupportsFormat(device, format, type, usage);
8034}
8035
8037 GPUTextureType type,
8039{
8040 return SDL::GPUTextureSupportsFormat(m_resource, format, type, usage);
8041}
8042
8054 GPUTextureFormat format,
8055 GPUSampleCount sample_count)
8056{
8057 return SDL_GPUTextureSupportsSampleCount(device, format, sample_count);
8058}
8059
8061 GPUSampleCount sample_count)
8062{
8063 return SDL::GPUTextureSupportsSampleCount(m_resource, format, sample_count);
8064}
8065
8078 Uint32 width,
8079 Uint32 height,
8080 Uint32 depth_or_layer_count)
8081{
8082 return SDL_CalculateGPUTextureFormatSize(
8083 format, width, height, depth_or_layer_count);
8084}
8085
8086#if SDL_VERSION_ATLEAST(3, 4, 0)
8087
8098{
8099 return SDL_GetPixelFormatFromGPUTextureFormat(format);
8100}
8101
8112{
8113 return SDL_GetGPUTextureFormatFromPixelFormat(format);
8114}
8115
8116#endif // SDL_VERSION_ATLEAST(3, 4, 0)
8117
8118#ifdef SDL_PLATFORM_GDK
8119
8133inline void GDKSuspendGPU(GPUDeviceParam device) { SDL_GDKSuspendGPU(device); }
8134
8135inline void GPUDevice::GDKSuspendGPU() { SDL::GDKSuspendGPU(m_resource); }
8136
8150inline void GDKResumeGPU(GPUDeviceParam device) { SDL_GDKResumeGPU(device); }
8151
8152inline void GPUDevice::GDKResumeGPU() { SDL::GDKResumeGPU(m_resource); }
8153
8154#endif /* SDL_PLATFORM_GDK */
8155
8157
8158} // namespace SDL
8159
8160#endif /* SDL3PP_GPU_H_ */
An opaque handle representing a buffer.
Definition: SDL3pp_gpu.h:513
GPUBuffer(GPUDeviceParam device, const GPUBufferCreateInfo &createinfo)
Creates a buffer object to be used in graphics or compute workflows.
Definition: SDL3pp_gpu.h:570
constexpr GPUBuffer(GPUBufferRaw gPUBuffer={}) noexcept
Wraps GPUBuffer.
Definition: SDL3pp_gpu.h:522
An opaque handle representing a command buffer.
Definition: SDL3pp_gpu.h:2083
constexpr GPUCommandBuffer(GPUCommandBufferRaw gPUCommandBuffer={}) noexcept
Wraps GPUCommandBuffer.
Definition: SDL3pp_gpu.h:2092
An opaque handle representing a compute pass.
Definition: SDL3pp_gpu.h:1556
constexpr GPUComputePass(GPUComputePassRaw gPUComputePass={}) noexcept
Wraps GPUComputePass.
Definition: SDL3pp_gpu.h:1565
An opaque handle representing a compute pipeline.
Definition: SDL3pp_gpu.h:1008
GPUComputePipeline(GPUDeviceParam device, const GPUComputePipelineCreateInfo &createinfo)
Creates a pipeline object to be used in a compute workflow.
Definition: SDL3pp_gpu.h:1068
constexpr GPUComputePipeline(GPUComputePipelineRaw gPUComputePipeline={}) noexcept
Wraps GPUComputePipeline.
Definition: SDL3pp_gpu.h:1017
An opaque handle representing a copy pass.
Definition: SDL3pp_gpu.h:1790
constexpr GPUCopyPass(GPUCopyPassRaw gPUCopyPass={}) noexcept
Wraps GPUCopyPass.
Definition: SDL3pp_gpu.h:1799
An opaque handle representing the SDL_GPU context.
Definition: SDL3pp_gpu.h:3103
constexpr GPUDevice & operator=(const GPUDevice &other) noexcept=default
Assignment operator.
GPUDevice(PropertiesParam props)
Creates a GPU context.
Definition: SDL3pp_gpu.h:3260
constexpr GPUDevice & operator=(GPUDevice &&other) noexcept
Assignment operator.
Definition: SDL3pp_gpu.h:3269
~GPUDevice()
Destructor.
Definition: SDL3pp_gpu.h:3266
constexpr GPUDevice(const GPUDevice &other) noexcept=default
Copy constructor.
constexpr GPUDevice(std::nullptr_t=nullptr) noexcept
Default ctor.
Definition: SDL3pp_gpu.h:3108
GPUDevice(GPUShaderFormat format_flags, bool debug_mode, StringParam name)
Creates a GPU context.
Definition: SDL3pp_gpu.h:3166
constexpr auto operator<=>(const GPUDevice &other) const noexcept=default
Comparison.
constexpr GPUDevice(const GPUDeviceRaw resource) noexcept
Constructs from GPUDeviceParam.
Definition: SDL3pp_gpu.h:3120
constexpr GPUDeviceRaw get() const noexcept
Retrieves underlying GPUDeviceRaw.
Definition: SDL3pp_gpu.h:3281
constexpr GPUDeviceRaw release() noexcept
Retrieves underlying GPUDeviceRaw and clear this.
Definition: SDL3pp_gpu.h:3284
constexpr GPUDevice(GPUDevice &&other) noexcept
Move constructor.
Definition: SDL3pp_gpu.h:3131
An opaque handle representing a graphics pipeline.
Definition: SDL3pp_gpu.h:1114
GPUGraphicsPipeline(GPUDeviceParam device, const GPUGraphicsPipelineCreateInfo &createinfo)
Creates a pipeline object to be used in a graphics workflow.
Definition: SDL3pp_gpu.h:1150
constexpr GPUGraphicsPipeline(GPUGraphicsPipelineRaw gPUGraphicsPipeline={}) noexcept
Wraps GPUGraphicsPipeline.
Definition: SDL3pp_gpu.h:1123
An opaque handle representing a render pass.
Definition: SDL3pp_gpu.h:1226
constexpr GPURenderPass(GPURenderPassRaw gPURenderPass={}) noexcept
Wraps GPURenderPass.
Definition: SDL3pp_gpu.h:1235
An opaque handle representing a sampler.
Definition: SDL3pp_gpu.h:817
constexpr GPUSampler(GPUSamplerRaw gPUSampler={}) noexcept
Wraps GPUSampler.
Definition: SDL3pp_gpu.h:826
GPUSampler(GPUDeviceParam device, const GPUSamplerCreateInfo &createinfo)
Creates a sampler object to be used when binding textures in a graphics workflow.
Definition: SDL3pp_gpu.h:852
An opaque handle representing a compiled shader object.
Definition: SDL3pp_gpu.h:886
GPUShader(GPUDeviceParam device, const GPUShaderCreateInfo &createinfo)
Creates a shader to be used when creating a graphics pipeline.
Definition: SDL3pp_gpu.h:973
constexpr GPUShader(GPUShaderRaw gPUShader={}) noexcept
Wraps GPUShader.
Definition: SDL3pp_gpu.h:895
An opaque handle representing a texture.
Definition: SDL3pp_gpu.h:705
GPUTexture(GPUDeviceParam device, const GPUTextureCreateInfo &createinfo)
Creates a texture object to be used in graphics or compute workflows.
Definition: SDL3pp_gpu.h:777
constexpr GPUTexture(GPUTextureRaw gPUTexture={}) noexcept
Wraps GPUTexture.
Definition: SDL3pp_gpu.h:714
An opaque handle representing a transfer buffer.
Definition: SDL3pp_gpu.h:609
constexpr GPUTransferBuffer(GPUTransferBufferRaw gPUTransferBuffer={}) noexcept
Wraps GPUTransferBuffer.
Definition: SDL3pp_gpu.h:618
GPUTransferBuffer(GPUDeviceParam device, const GPUTransferBufferCreateInfo &createinfo)
Creates a transfer buffer to be used when uploading to or downloading from graphics resources.
Definition: SDL3pp_gpu.h:651
Optional-like shim for references.
Definition: SDL3pp_optionalRef.h:20
Pixel format.
Definition: SDL3pp_pixels.h:414
Source byte stream.
Definition: SDL3pp_strings.h:240
constexpr size_t size_bytes() const
Retrieves contained size in bytes.
Definition: SDL3pp_strings.h:304
constexpr const char * data() const
Retrieves contained data.
Definition: SDL3pp_strings.h:307
span-like for empty-derived structs
Definition: SDL3pp_spanRef.h:24
constexpr T * data() const
Retrieves contained data.
Definition: SDL3pp_spanRef.h:75
constexpr size_t size() const
Retrieves contained size.
Definition: SDL3pp_spanRef.h:69
Helpers to use C++ strings parameters.
Definition: SDL3pp_strings.h:43
constexpr void CheckError(bool result)
Check and throw if returned value from SDL is an error.
Definition: SDL3pp_error.h:197
void Destroy()
Destroys a GPU context previously returned by GPUDevice.GPUDevice.
Definition: SDL3pp_gpu.h:5251
SDL_GPUDepthStencilState GPUDepthStencilState
A structure specifying the parameters of the graphics pipeline depth stencil state.
Definition: SDL3pp_gpu.h:4950
GPUShaderFormat GetGPUShaderFormats(GPUDeviceParam device)
Returns the supported shader formats for this GPU context.
Definition: SDL3pp_gpu.h:5310
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UINT
GPU_VERTEXELEMENTFORMAT_UINT.
Definition: SDL3pp_gpu.h:4411
constexpr GPUShaderFormat GPU_SHADERFORMAT_DXIL
DXIL SM6_0 shaders for D3D12.
Definition: SDL3pp_gpu.h:2511
GPUTransferBuffer CreateGPUTransferBuffer(GPUDeviceParam device, const GPUTransferBufferCreateInfo &createinfo)
Creates a transfer buffer to be used when uploading to or downloading from graphics resources.
Definition: SDL3pp_gpu.h:5853
void Dispatch(Uint32 groupcount_x, Uint32 groupcount_y, Uint32 groupcount_z)
Dispatches compute work.
Definition: SDL3pp_gpu.h:7070
void PushComputeUniformData(Uint32 slot_index, SourceBytes data)
Pushes data to a uniform slot on the command buffer.
Definition: SDL3pp_gpu.h:6285
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_12x12_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_12x12_UNORM_SRGB.
Definition: SDL3pp_gpu.h:2952
constexpr GPUFillMode GPU_FILLMODE_FILL
Polygons will be rendered via rasterization.
Definition: SDL3pp_gpu.h:4515
constexpr GPUShaderFormat GPU_SHADERFORMAT_PRIVATE
Shaders for NDA'd platforms.
Definition: SDL3pp_gpu.h:2502
SDL_GPUTexture * GPUTextureRaw
Alias to raw representation for GPUTexture.
Definition: SDL3pp_gpu.h:425
constexpr GPUCompareOp GPU_COMPAREOP_LESS_OR_EQUAL
The comparison evaluates reference <= test.
Definition: SDL3pp_gpu.h:4580
constexpr GPUSwapchainComposition GPU_SWAPCHAINCOMPOSITION_HDR10_ST2084
GPU_SWAPCHAINCOMPOSITION_HDR10_ST2084.
Definition: SDL3pp_gpu.h:2556
const char * GetDriver()
Returns the name of the backend used to create this GPU context.
Definition: SDL3pp_gpu.h:5296
int GetNumGPUDrivers()
Get the number of GPU drivers compiled into SDL.
Definition: SDL3pp_gpu.h:5262
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:6247
GPUTexture WaitAndAcquireGPUSwapchainTexture(GPUCommandBuffer command_buffer, WindowParam 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:7792
constexpr GPUIndexElementSize GPU_INDEXELEMENTSIZE_32BIT
The index elements are 32-bit.
Definition: SDL3pp_gpu.h:1199
SDL_GPUTextureRegion GPUTextureRegion
A structure specifying a region of a texture.
Definition: SDL3pp_gpu.h:1742
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:6644
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_6x6_FLOAT
GPU_TEXTUREFORMAT_ASTC_6x6_FLOAT.
Definition: SDL3pp_gpu.h:2967
constexpr GPUStencilOp GPU_STENCILOP_ZERO
Sets the value to 0.
Definition: SDL3pp_gpu.h:4613
constexpr GPUCompareOp GPU_COMPAREOP_ALWAYS
The comparison always evaluates true.
Definition: SDL3pp_gpu.h:4594
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8_UNORM
GPU_TEXTUREFORMAT_R8_UNORM.
Definition: SDL3pp_gpu.h:2688
constexpr GPUBlendOp GPU_BLENDOP_MIN
min(source, destination)
Definition: SDL3pp_gpu.h:4664
SDL_GPUVertexAttribute GPUVertexAttribute
A structure specifying a vertex attribute.
Definition: SDL3pp_gpu.h:4879
GPUTexture AcquireGPUSwapchainTexture(GPUCommandBuffer command_buffer, WindowParam window, Uint32 *swapchain_texture_width=nullptr, Uint32 *swapchain_texture_height=nullptr)
Acquire a texture to use in presentation.
Definition: SDL3pp_gpu.h:7700
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:6833
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_FLOAT2
GPU_VERTEXELEMENTFORMAT_FLOAT2.
Definition: SDL3pp_gpu.h:4426
void WaitForFences(bool wait_all, std::span< GPUFence *const > fences)
Blocks the thread until the given fences are signaled.
Definition: SDL3pp_gpu.h:7953
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:7276
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32G32_FLOAT
GPU_TEXTUREFORMAT_R32G32_FLOAT.
Definition: SDL3pp_gpu.h:2775
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE
Texture supports reads and writes in the same compute shader.
Definition: SDL3pp_gpu.h:3070
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_USHORT2_NORM
GPU_VERTEXELEMENTFORMAT_USHORT2_NORM.
Definition: SDL3pp_gpu.h:4477
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8_INT
GPU_TEXTUREFORMAT_R8G8_INT.
Definition: SDL3pp_gpu.h:2814
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_6x6_UNORM
GPU_TEXTUREFORMAT_ASTC_6x6_UNORM.
Definition: SDL3pp_gpu.h:2883
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16B16A16_INT
GPU_TEXTUREFORMAT_R16G16B16A16_INT.
Definition: SDL3pp_gpu.h:2826
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_12x12_UNORM
GPU_TEXTUREFORMAT_ASTC_12x12_UNORM.
Definition: SDL3pp_gpu.h:2910
void BlitGPUTexture(GPUCommandBuffer command_buffer, const GPUBlitInfo &info)
Blits from a source texture region to a destination texture region.
Definition: SDL3pp_gpu.h:7430
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:7872
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_4x4_FLOAT
GPU_TEXTUREFORMAT_ASTC_4x4_FLOAT.
Definition: SDL3pp_gpu.h:2955
constexpr GPUStencilOp GPU_STENCILOP_INVERT
Bitwise-inverts the current value.
Definition: SDL3pp_gpu.h:4627
PixelFormat GetPixelFormatFromGPUTextureFormat(GPUTextureFormat format)
Get the SDL pixel format corresponding to a GPU texture format.
Definition: SDL3pp_gpu.h:8097
constexpr GPUFrontFace GPU_FRONTFACE_CLOCKWISE
A triangle with clockwise vertex winding will be considered front-facing.
Definition: SDL3pp_gpu.h:4557
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_D32_FLOAT
GPU_TEXTUREFORMAT_D32_FLOAT.
Definition: SDL3pp_gpu.h:2862
bool SetAllowedFramesInFlight(Uint32 allowed_frames_in_flight)
Configures the maximum allowed number of frames in flight.
Definition: SDL3pp_gpu.h:7627
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_FLOAT3
GPU_VERTEXELEMENTFORMAT_FLOAT3.
Definition: SDL3pp_gpu.h:4429
constexpr GPUCompareOp GPU_COMPAREOP_GREATER_OR_EQUAL
The comparison evaluates reference >= test.
Definition: SDL3pp_gpu.h:4590
void ReleaseShader(GPUShader shader)
Frees the given shader as soon as it is safe to do so.
Definition: SDL3pp_gpu.h:6138
void ReleaseTransferBuffer(GPUTransferBuffer transfer_buffer)
Frees the given transfer buffer as soon as it is safe to do so.
Definition: SDL3pp_gpu.h:6096
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x6_FLOAT
GPU_TEXTUREFORMAT_ASTC_8x6_FLOAT.
Definition: SDL3pp_gpu.h:2973
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:6733
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UBYTE2
GPU_VERTEXELEMENTFORMAT_UBYTE2.
Definition: SDL3pp_gpu.h:4441
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:6541
constexpr GPUPrimitiveType GPU_PRIMITIVETYPE_LINELIST
A series of separate lines.
Definition: SDL3pp_gpu.h:4222
GPUSampler CreateSampler(const GPUSamplerCreateInfo &createinfo)
Creates a sampler object to be used when binding textures in a graphics workflow.
Definition: SDL3pp_gpu.h:5569
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_USHORT4_NORM
GPU_VERTEXELEMENTFORMAT_USHORT4_NORM.
Definition: SDL3pp_gpu.h:4480
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32_UINT
GPU_TEXTUREFORMAT_R32_UINT.
Definition: SDL3pp_gpu.h:2802
void PushGPUDebugGroup(GPUCommandBuffer command_buffer, StringParam name)
Begins a debug group with an arbitrary name.
Definition: SDL3pp_gpu.h:5985
void ReleaseGPUSampler(GPUDeviceParam device, GPUSampler sampler)
Frees the given sampler as soon as it is safe to do so.
Definition: SDL3pp_gpu.h:6050
bool GPUTextureSupportsSampleCount(GPUDeviceParam device, GPUTextureFormat format, GPUSampleCount sample_count)
Determines if a sample count for a texture format is supported.
Definition: SDL3pp_gpu.h:8053
void * MapTransferBuffer(GPUTransferBuffer transfer_buffer, bool cycle)
Maps a transfer buffer into application address space.
Definition: SDL3pp_gpu.h:7146
void SetGPUBufferName(GPUDeviceParam device, GPUBuffer buffer, StringParam text)
Sets an arbitrary string constant to label a buffer.
Definition: SDL3pp_gpu.h:5890
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x6_UNORM
GPU_TEXTUREFORMAT_ASTC_8x6_UNORM.
Definition: SDL3pp_gpu.h:2889
void SetGPUViewport(GPURenderPass render_pass, const GPUViewport &viewport)
Sets the current viewport state on a command buffer.
Definition: SDL3pp_gpu.h:6371
constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR
1 - blend constant
Definition: SDL3pp_gpu.h:4717
GPUComputePipeline CreateComputePipeline(const GPUComputePipelineCreateInfo &createinfo)
Creates a pipeline object to be used in a compute workflow.
Definition: SDL3pp_gpu.h:5488
void SetScissor(const RectRaw &scissor)
Sets the current scissor state on a command buffer.
Definition: SDL3pp_gpu.h:6395
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:8036
constexpr GPUCompareOp GPU_COMPAREOP_NOT_EQUAL
The comparison evaluates reference != test.
Definition: SDL3pp_gpu.h:4587
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_USHORT2
GPU_VERTEXELEMENTFORMAT_USHORT2.
Definition: SDL3pp_gpu.h:4465
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16B16A16_UNORM
GPU_TEXTUREFORMAT_R16G16B16A16_UNORM.
Definition: SDL3pp_gpu.h:2703
SDL_GPUColorTargetInfo GPUColorTargetInfo
A structure specifying the parameters of a color target used by a render pass.
Definition: SDL3pp_gpu.h:1967
SDL_GPUCommandBuffer * GPUCommandBufferRaw
Alias to raw representation for GPUCommandBuffer.
Definition: SDL3pp_gpu.h:455
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16_UINT
GPU_TEXTUREFORMAT_R16G16_UINT.
Definition: SDL3pp_gpu.h:2796
SDL_GPUCompareOp GPUCompareOp
Specifies a comparison operator for depth, stencil and sampler operations.
Definition: SDL3pp_gpu.h:4566
void CancelGPUCommandBuffer(GPUCommandBuffer command_buffer)
Cancels a command buffer.
Definition: SDL3pp_gpu.h:7904
SDL_GPUDepthStencilTargetInfo GPUDepthStencilTargetInfo
A structure specifying the parameters of a depth-stencil target used by a render pass.
Definition: SDL3pp_gpu.h:2016
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:4649
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x8_UNORM
GPU_TEXTUREFORMAT_ASTC_10x8_UNORM.
Definition: SDL3pp_gpu.h:2901
constexpr GPUPrimitiveType GPU_PRIMITIVETYPE_TRIANGLELIST
A series of separate triangles.
Definition: SDL3pp_gpu.h:4216
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_A8_UNORM
GPU_TEXTUREFORMAT_A8_UNORM.
Definition: SDL3pp_gpu.h:2685
PropertiesRef GetProperties()
Get the properties associated with a GPU device.
Definition: SDL3pp_gpu.h:5429
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_INT4
GPU_VERTEXELEMENTFORMAT_INT4.
Definition: SDL3pp_gpu.h:4408
SDL_GPUGraphicsPipelineTargetInfo GPUGraphicsPipelineTargetInfo
A structure specifying the descriptions of render targets used in a graphics pipeline.
Definition: SDL3pp_gpu.h:4972
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_5x5_FLOAT
GPU_TEXTUREFORMAT_ASTC_5x5_FLOAT.
Definition: SDL3pp_gpu.h:2961
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32_FLOAT
GPU_TEXTUREFORMAT_R32_FLOAT.
Definition: SDL3pp_gpu.h:2772
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:4277
constexpr GPUSamplerAddressMode GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE
Specifies that the coordinates will clamp to the 0-1 range.
Definition: SDL3pp_gpu.h:4794
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16_UNORM
GPU_TEXTUREFORMAT_R16G16_UNORM.
Definition: SDL3pp_gpu.h:2700
SDL_GPUGraphicsPipeline * GPUGraphicsPipelineRaw
Alias to raw representation for GPUGraphicsPipeline.
Definition: SDL3pp_gpu.h:449
SDL_GPUVulkanOptions GPUVulkanOptions
A structure specifying additional options when using Vulkan.
Definition: SDL3pp_gpu.h:5233
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:6767
Uint32 GPUBufferUsageFlags
Specifies how a buffer is intended to be used by the client.
Definition: SDL3pp_gpu.h:4331
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x6_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_8x6_UNORM_SRGB.
Definition: SDL3pp_gpu.h:2931
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:6965
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_6x5_FLOAT
GPU_TEXTUREFORMAT_ASTC_6x5_FLOAT.
Definition: SDL3pp_gpu.h:2964
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC1_RGBA_UNORM
GPU_TEXTUREFORMAT_BC1_RGBA_UNORM.
Definition: SDL3pp_gpu.h:2721
void BlitTexture(const GPUBlitInfo &info)
Blits from a source texture region to a destination texture region.
Definition: SDL3pp_gpu.h:7436
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:7352
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:6619
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32G32_UINT
GPU_TEXTUREFORMAT_R32G32_UINT.
Definition: SDL3pp_gpu.h:2805
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:6475
SDL_GPUSampler * GPUSamplerRaw
Alias to raw representation for GPUSampler.
Definition: SDL3pp_gpu.h:431
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC3_RGBA_UNORM
GPU_TEXTUREFORMAT_BC3_RGBA_UNORM.
Definition: SDL3pp_gpu.h:2727
void SetGPUTextureName(GPUDeviceParam device, GPUTexture texture, StringParam text)
Sets an arbitrary string constant to label a texture.
Definition: SDL3pp_gpu.h:5919
bool GPUTextureSupportsFormat(GPUDeviceParam device, GPUTextureFormat format, GPUTextureType type, GPUTextureUsageFlags usage)
Determines whether a texture format is supported for a given type and usage.
Definition: SDL3pp_gpu.h:8028
Uint32 GPUTextureFormatTexelBlockSize(GPUTextureFormat format)
Obtains the texel block size for a texture format.
Definition: SDL3pp_gpu.h:8012
SDL_GPUColorTargetDescription GPUColorTargetDescription
A structure specifying the parameters of color targets used in a graphics pipeline.
Definition: SDL3pp_gpu.h:4960
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ
Texture supports storage reads in graphics stages.
Definition: SDL3pp_gpu.h:3053
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:7033
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_SHORT2
GPU_VERTEXELEMENTFORMAT_SHORT2.
Definition: SDL3pp_gpu.h:4459
void ReleaseGPUFence(GPUDeviceParam device, GPUFence *fence)
Releases a fence obtained from GPUCommandBuffer.SubmitAndAcquireFence.
Definition: SDL3pp_gpu.h:7992
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8_SNORM
GPU_TEXTUREFORMAT_R8_SNORM.
Definition: SDL3pp_gpu.h:2745
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_SAMPLER
Texture supports sampling.
Definition: SDL3pp_gpu.h:3043
GPUCommandBuffer AcquireCommandBuffer()
Acquire a command buffer.
Definition: SDL3pp_gpu.h:6194
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x8_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_10x8_UNORM_SRGB.
Definition: SDL3pp_gpu.h:2943
void Cancel()
Cancels a command buffer.
Definition: SDL3pp_gpu.h:7909
void ClaimWindowForGPUDevice(GPUDeviceParam device, WindowParam window)
Claims a window, creating a swapchain structure for it.
Definition: SDL3pp_gpu.h:7524
SDL_GPUIndirectDispatchCommand GPUIndirectDispatchCommand
A structure specifying the parameters of an indexed dispatch command.
Definition: SDL3pp_gpu.h:4845
constexpr GPUColorComponentFlags GPU_COLORCOMPONENT_A
the alpha component
Definition: SDL3pp_gpu.h:4742
constexpr GPUBufferUsageFlags GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE
Buffer supports storage writes in the compute stage.
Definition: SDL3pp_gpu.h:4351
constexpr GPUSamplerMipmapMode GPU_SAMPLERMIPMAPMODE_LINEAR
Linear filtering.
Definition: SDL3pp_gpu.h:4772
constexpr GPUShaderFormat GPU_SHADERFORMAT_DXBC
DXBC SM5_1 shaders for D3D12.
Definition: SDL3pp_gpu.h:2508
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x6_FLOAT
GPU_TEXTUREFORMAT_ASTC_10x6_FLOAT.
Definition: SDL3pp_gpu.h:2982
void SetStencilReference(Uint8 reference)
Sets the current stencil reference value on a command buffer.
Definition: SDL3pp_gpu.h:6435
void ReleaseGPUComputePipeline(GPUDeviceParam device, GPUComputePipeline compute_pipeline)
Frees the given compute pipeline as soon as it is safe to do so.
Definition: SDL3pp_gpu.h:6111
SDL_GPUVertexBufferDescription GPUVertexBufferDescription
A structure specifying the parameters of vertex buffers used in a graphics pipeline.
Definition: SDL3pp_gpu.h:4865
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R11G11B10_UFLOAT
GPU_TEXTUREFORMAT_R11G11B10_UFLOAT.
Definition: SDL3pp_gpu.h:2781
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_COLOR_TARGET
Texture is a color render target.
Definition: SDL3pp_gpu.h:3046
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_INT
GPU_VERTEXELEMENTFORMAT_INT.
Definition: SDL3pp_gpu.h:4399
GPUTextureFormat GetGPUTextureFormatFromPixelFormat(PixelFormat format)
Get the GPU texture format corresponding to an SDL pixel format.
Definition: SDL3pp_gpu.h:8111
constexpr GPUStencilOp GPU_STENCILOP_REPLACE
Sets the value to reference.
Definition: SDL3pp_gpu.h:4616
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16_INT
GPU_TEXTUREFORMAT_R16_INT.
Definition: SDL3pp_gpu.h:2820
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT
GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT.
Definition: SDL3pp_gpu.h:2865
void BindFragmentStorageTextures(Uint32 first_slot, SpanRef< const GPUTextureRaw > storage_textures)
Binds storage textures for use on the fragment shader.
Definition: SDL3pp_gpu.h:6653
SDL_GPUMultisampleState GPUMultisampleState
A structure specifying the parameters of the graphics pipeline multisample state.
Definition: SDL3pp_gpu.h:4940
bool QueryFence(GPUFence *fence)
Checks the status of a fence.
Definition: SDL3pp_gpu.h:7975
void UploadToBuffer(const GPUTransferBufferLocation &source, const GPUBufferRegion &destination, bool cycle)
Uploads data from a transfer buffer to a buffer.
Definition: SDL3pp_gpu.h:7249
SDL_GPUIndexedIndirectDrawCommand GPUIndexedIndirectDrawCommand
A structure specifying the parameters of an indexed indirect draw command.
Definition: SDL3pp_gpu.h:4836
constexpr GPUBlendFactor GPU_BLENDFACTOR_DST_COLOR
destination color
Definition: SDL3pp_gpu.h:4696
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT
GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT.
Definition: SDL3pp_gpu.h:2769
void ReleaseComputePipeline(GPUComputePipeline compute_pipeline)
Frees the given compute pipeline as soon as it is safe to do so.
Definition: SDL3pp_gpu.h:6117
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:6516
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:6810
void ReleaseWindowFromGPUDevice(GPUDeviceParam device, WindowParam window)
Unclaims a window, destroying its swapchain structure.
Definition: SDL3pp_gpu.h:7544
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_FLOAT4
GPU_VERTEXELEMENTFORMAT_FLOAT4.
Definition: SDL3pp_gpu.h:4432
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x10_FLOAT
GPU_TEXTUREFORMAT_ASTC_10x10_FLOAT.
Definition: SDL3pp_gpu.h:2988
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:4681
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_6x5_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_6x5_UNORM_SRGB.
Definition: SDL3pp_gpu.h:2922
GPUBuffer CreateBuffer(const GPUBufferCreateInfo &createinfo)
Creates a buffer object to be used in graphics or compute workflows.
Definition: SDL3pp_gpu.h:5815
bool QueryGPUFence(GPUDeviceParam device, GPUFence *fence)
Checks the status of a fence.
Definition: SDL3pp_gpu.h:7970
GPUCopyPass BeginCopyPass()
Begins a copy pass on a command buffer.
Definition: SDL3pp_gpu.h:7190
SDL_GPUSampleCount GPUSampleCount
Specifies the sample count of a texture.
Definition: SDL3pp_gpu.h:3084
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x8_FLOAT
GPU_TEXTUREFORMAT_ASTC_10x8_FLOAT.
Definition: SDL3pp_gpu.h:2985
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32G32_INT
GPU_TEXTUREFORMAT_R32G32_INT.
Definition: SDL3pp_gpu.h:2832
constexpr GPUBlendOp GPU_BLENDOP_INVALID
GPU_BLENDOP_INVALID.
Definition: SDL3pp_gpu.h:4651
constexpr GPUSwapchainComposition GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR
GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR.
Definition: SDL3pp_gpu.h:2553
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:6323
SDL_GPUFillMode GPUFillMode
Specifies the fill mode of the graphics pipeline.
Definition: SDL3pp_gpu.h:4513
SDL_GPUColorTargetBlendState GPUColorTargetBlendState
A structure specifying the blend state of a color target.
Definition: SDL3pp_gpu.h:4912
void BindVertexStorageTextures(Uint32 first_slot, SpanRef< const GPUTextureRaw > storage_textures)
Binds storage textures for use on the vertex shader.
Definition: SDL3pp_gpu.h:6550
GPUDevice CreateGPUDeviceWithProperties(PropertiesParam props)
Creates a GPU context.
Definition: SDL3pp_gpu.h:5128
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:6718
constexpr GPUPresentMode GPU_PRESENTMODE_IMMEDIATE
GPU_PRESENTMODE_IMMEDIATE.
Definition: SDL3pp_gpu.h:2589
constexpr GPUBufferUsageFlags GPU_BUFFERUSAGE_VERTEX
Buffer is a vertex buffer.
Definition: SDL3pp_gpu.h:4333
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8B8A8_UINT
GPU_TEXTUREFORMAT_R8G8B8A8_UINT.
Definition: SDL3pp_gpu.h:2790
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC4_R_UNORM
GPU_TEXTUREFORMAT_BC4_R_UNORM.
Definition: SDL3pp_gpu.h:2730
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:6505
Uint32 GPUTextureUsageFlags
Specifies how a texture is intended to be used by the client.
Definition: SDL3pp_gpu.h:3041
constexpr GPUBufferUsageFlags GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ
Buffer supports storage reads in graphics stages.
Definition: SDL3pp_gpu.h:4342
constexpr GPUCubeMapFace GPU_CUBEMAPFACE_POSITIVEZ
GPU_CUBEMAPFACE_POSITIVEZ.
Definition: SDL3pp_gpu.h:4308
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_4x4_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_4x4_UNORM_SRGB.
Definition: SDL3pp_gpu.h:2913
void DispatchIndirect(GPUBuffer buffer, Uint32 offset)
Dispatches compute work with parameters set from a buffer.
Definition: SDL3pp_gpu.h:7102
constexpr GPUCompareOp GPU_COMPAREOP_EQUAL
The comparison evaluates reference == test.
Definition: SDL3pp_gpu.h:4577
SDL_GPUTextureLocation GPUTextureLocation
A structure specifying a location in a texture.
Definition: SDL3pp_gpu.h:1718
SDL_GPUShaderStage GPUShaderStage
Specifies which stage a shader program corresponds to.
Definition: SDL3pp_gpu.h:4379
void SetViewport(const GPUViewport &viewport)
Sets the current viewport state on a command buffer.
Definition: SDL3pp_gpu.h:6377
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_SHORT2_NORM
GPU_VERTEXELEMENTFORMAT_SHORT2_NORM.
Definition: SDL3pp_gpu.h:4471
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_BYTE4
GPU_VERTEXELEMENTFORMAT_BYTE4.
Definition: SDL3pp_gpu.h:4438
SDL_GPUSamplerMipmapMode GPUSamplerMipmapMode
Specifies a mipmap mode used by a sampler.
Definition: SDL3pp_gpu.h:4767
constexpr GPUSwapchainComposition GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR
GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR.
Definition: SDL3pp_gpu.h:2550
SDL_GPUGraphicsPipelineCreateInfo GPUGraphicsPipelineCreateInfo
A structure specifying the parameters of a graphics pipeline state.
Definition: SDL3pp_gpu.h:1100
GPUTextureFormat GetSwapchainTextureFormat(WindowParam window)
Obtains the texture format of the swapchain for the given window.
Definition: SDL3pp_gpu.h:7649
constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR
1 - source color
Definition: SDL3pp_gpu.h:4693
SDL_GPUTextureType GPUTextureType
Specifies the type of a texture.
Definition: SDL3pp_gpu.h:3004
Uint32 GPUShaderFormat
Specifies the format of shader code.
Definition: SDL3pp_gpu.h:2497
Uint8 GPUColorComponentFlags
Specifies which color components are written in a graphics pipeline.
Definition: SDL3pp_gpu.h:4731
SDL_GPUTextureTransferInfo GPUTextureTransferInfo
A structure specifying parameters related to transferring data to or from a texture.
Definition: SDL3pp_gpu.h:1764
void ReleaseFence(GPUFence *fence)
Releases a fence obtained from GPUCommandBuffer.SubmitAndAcquireFence.
Definition: SDL3pp_gpu.h:7997
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_B5G5R5A1_UNORM
GPU_TEXTUREFORMAT_B5G5R5A1_UNORM.
Definition: SDL3pp_gpu.h:2712
GPUGraphicsPipeline CreateGraphicsPipeline(const GPUGraphicsPipelineCreateInfo &createinfo)
Creates a pipeline object to be used in a graphics workflow.
Definition: SDL3pp_gpu.h:5529
void Submit()
Submits a command buffer so its commands can be processed on the GPU.
Definition: SDL3pp_gpu.h:7843
bool SetGPUSwapchainParameters(GPUDeviceParam device, WindowParam window, GPUSwapchainComposition swapchain_composition, GPUPresentMode present_mode)
Changes the swapchain parameters for the given claimed window.
Definition: SDL3pp_gpu.h:7577
constexpr GPUFilter GPU_FILTER_LINEAR
Linear filtering.
Definition: SDL3pp_gpu.h:4757
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:6927
void BindFragmentStorageBuffers(Uint32 first_slot, SpanRef< const GPUBufferRaw > storage_buffers)
Binds storage buffers for use on the fragment shader.
Definition: SDL3pp_gpu.h:6687
constexpr GPUBlendFactor GPU_BLENDFACTOR_CONSTANT_COLOR
blend constant
Definition: SDL3pp_gpu.h:4714
constexpr GPUVertexInputRate GPU_VERTEXINPUTRATE_VERTEX
Attribute addressing is a function of the vertex index.
Definition: SDL3pp_gpu.h:4499
SDL_GPUPresentMode GPUPresentMode
Specifies the timing that will be used to present swapchain textures to the OS.
Definition: SDL3pp_gpu.h:2584
SDL_GPUBufferBinding GPUBufferBinding
A structure specifying parameters in a buffer binding call.
Definition: SDL3pp_gpu.h:1185
void UnmapTransferBuffer(GPUTransferBuffer transfer_buffer)
Unmaps a previously mapped transfer buffer.
Definition: SDL3pp_gpu.h:7166
void ReleaseSampler(GPUSampler sampler)
Frees the given sampler as soon as it is safe to do so.
Definition: SDL3pp_gpu.h:6055
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8B8A8_UNORM
GPU_TEXTUREFORMAT_R8G8B8A8_UNORM.
Definition: SDL3pp_gpu.h:2694
SDL_GPUBufferLocation GPUBufferLocation
A structure specifying a location in a buffer.
Definition: SDL3pp_gpu.h:1729
GPUCommandBuffer AcquireGPUCommandBuffer(GPUDeviceParam device)
Acquire a command buffer.
Definition: SDL3pp_gpu.h:6189
SDL_GPUCopyPass * GPUCopyPassRaw
Alias to raw representation for GPUCopyPass.
Definition: SDL3pp_gpu.h:473
void GDKSuspendGPU()
Call this to suspend GPU operation on Xbox when you receive the EVENT_DID_ENTER_BACKGROUND event.
Definition: SDL3pp_gpu.h:8135
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8B8A8_INT
GPU_TEXTUREFORMAT_R8G8B8A8_INT.
Definition: SDL3pp_gpu.h:2817
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:7287
constexpr GPUTransferBufferUsage GPU_TRANSFERBUFFERUSAGE_UPLOAD
GPU_TRANSFERBUFFERUSAGE_UPLOAD.
Definition: SDL3pp_gpu.h:4366
SDL_GPUBufferCreateInfo GPUBufferCreateInfo
A structure specifying the parameters of a buffer.
Definition: SDL3pp_gpu.h:489
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT
GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT.
Definition: SDL3pp_gpu.h:2778
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:4284
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16_SNORM
GPU_TEXTUREFORMAT_R16_SNORM.
Definition: SDL3pp_gpu.h:2754
constexpr GPUPresentMode GPU_PRESENTMODE_VSYNC
GPU_PRESENTMODE_VSYNC.
Definition: SDL3pp_gpu.h:2586
SDL_GPUShader * GPUShaderRaw
Alias to raw representation for GPUShader.
Definition: SDL3pp_gpu.h:437
constexpr GPUSamplerAddressMode GPU_SAMPLERADDRESSMODE_REPEAT
Specifies that the coordinates will wrap around.
Definition: SDL3pp_gpu.h:4785
SDL_GPUBuffer * GPUBufferRaw
Alias to raw representation for GPUBuffer.
Definition: SDL3pp_gpu.h:413
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_HALF4
GPU_VERTEXELEMENTFORMAT_HALF4.
Definition: SDL3pp_gpu.h:4486
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UINT3
GPU_VERTEXELEMENTFORMAT_UINT3.
Definition: SDL3pp_gpu.h:4417
constexpr GPUCubeMapFace GPU_CUBEMAPFACE_NEGATIVEX
GPU_CUBEMAPFACE_NEGATIVEX.
Definition: SDL3pp_gpu.h:4299
void End()
Ends the current compute pass.
Definition: SDL3pp_gpu.h:7122
constexpr GPUShaderStage GPU_SHADERSTAGE_VERTEX
GPU_SHADERSTAGE_VERTEX.
Definition: SDL3pp_gpu.h:4381
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_D24_UNORM
GPU_TEXTUREFORMAT_D24_UNORM.
Definition: SDL3pp_gpu.h:2859
SDL_GPUCullMode GPUCullMode
Specifies the facing direction in which triangle faces will be culled.
Definition: SDL3pp_gpu.h:4528
void SetGPUStencilReference(GPURenderPass render_pass, Uint8 reference)
Sets the current stencil reference value on a command buffer.
Definition: SDL3pp_gpu.h:6430
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:6678
void WaitForSwapchain(WindowParam window)
Blocks the thread until a swapchain texture is available to be acquired.
Definition: SDL3pp_gpu.h:7747
constexpr GPUCompareOp GPU_COMPAREOP_LESS
The comparison evaluates reference < test.
Definition: SDL3pp_gpu.h:4574
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET
Texture is a depth stencil target.
Definition: SDL3pp_gpu.h:3049
void DispatchGPUCompute(GPUComputePass compute_pass, Uint32 groupcount_x, Uint32 groupcount_y, Uint32 groupcount_z)
Dispatches compute work.
Definition: SDL3pp_gpu.h:7061
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_INT2
GPU_VERTEXELEMENTFORMAT_INT2.
Definition: SDL3pp_gpu.h:4402
constexpr GPUPrimitiveType GPU_PRIMITIVETYPE_POINTLIST
A series of separate points.
Definition: SDL3pp_gpu.h:4228
constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR
1 - destination color
Definition: SDL3pp_gpu.h:4699
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC7_RGBA_UNORM
GPU_TEXTUREFORMAT_BC7_RGBA_UNORM.
Definition: SDL3pp_gpu.h:2736
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:6899
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:6608
GPUGraphicsPipeline CreateGPUGraphicsPipeline(GPUDeviceParam device, const GPUGraphicsPipelineCreateInfo &createinfo)
Creates a pipeline object to be used in a graphics workflow.
Definition: SDL3pp_gpu.h:5522
constexpr GPUVertexInputRate GPU_VERTEXINPUTRATE_INSTANCE
Attribute addressing is a function of the instance index.
Definition: SDL3pp_gpu.h:4503
SDL_GPUStencilOpState GPUStencilOpState
A structure specifying the stencil operation state of a graphics pipeline.
Definition: SDL3pp_gpu.h:4900
SDL_GPUVertexElementFormat GPUVertexElementFormat
Specifies the format of a vertex attribute.
Definition: SDL3pp_gpu.h:4394
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT
GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT.
Definition: SDL3pp_gpu.h:2739
constexpr GPUShaderStage GPU_SHADERSTAGE_FRAGMENT
GPU_SHADERSTAGE_FRAGMENT.
Definition: SDL3pp_gpu.h:4384
constexpr GPUCompareOp GPU_COMPAREOP_INVALID
GPU_COMPAREOP_INVALID.
Definition: SDL3pp_gpu.h:4568
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC5_RG_UNORM
GPU_TEXTUREFORMAT_BC5_RG_UNORM.
Definition: SDL3pp_gpu.h:2733
bool WindowSupportsSwapchainComposition(WindowParam window, GPUSwapchainComposition swapchain_composition)
Determines whether a swapchain composition is supported by the window.
Definition: SDL3pp_gpu.h:7464
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:6482
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:6575
void UnmapGPUTransferBuffer(GPUDeviceParam device, GPUTransferBuffer transfer_buffer)
Unmaps a previously mapped transfer buffer.
Definition: SDL3pp_gpu.h:7160
constexpr GPUCubeMapFace GPU_CUBEMAPFACE_NEGATIVEZ
GPU_CUBEMAPFACE_NEGATIVEZ.
Definition: SDL3pp_gpu.h:4311
constexpr GPUPrimitiveType GPU_PRIMITIVETYPE_LINESTRIP
A series of connected lines.
Definition: SDL3pp_gpu.h:4225
GPUBuffer CreateGPUBuffer(GPUDeviceParam device, const GPUBufferCreateInfo &createinfo)
Creates a buffer object to be used in graphics or compute workflows.
Definition: SDL3pp_gpu.h:5809
constexpr GPUStencilOp GPU_STENCILOP_DECREMENT_AND_WRAP
Decrements the current value and wraps to the maximum value.
Definition: SDL3pp_gpu.h:4635
void ReleaseWindow(WindowParam window)
Unclaims a window, destroying its swapchain structure.
Definition: SDL3pp_gpu.h:7550
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8_UINT
GPU_TEXTUREFORMAT_R8_UINT.
Definition: SDL3pp_gpu.h:2784
SDL_GPUTransferBuffer * GPUTransferBufferRaw
Alias to raw representation for GPUTransferBuffer.
Definition: SDL3pp_gpu.h:419
constexpr GPUSampleCount GPU_SAMPLECOUNT_4
MSAA 4x.
Definition: SDL3pp_gpu.h:3091
SDL_GPUTextureSamplerBinding GPUTextureSamplerBinding
A structure specifying parameters in a sampler binding call.
Definition: SDL3pp_gpu.h:1212
constexpr GPUTransferBufferUsage GPU_TRANSFERBUFFERUSAGE_DOWNLOAD
GPU_TRANSFERBUFFERUSAGE_DOWNLOAD.
Definition: SDL3pp_gpu.h:4369
void ReleaseGPUGraphicsPipeline(GPUDeviceParam device, GPUGraphicsPipeline graphics_pipeline)
Frees the given graphics pipeline as soon as it is safe to do so.
Definition: SDL3pp_gpu.h:6153
constexpr GPUStencilOp GPU_STENCILOP_INVALID
GPU_STENCILOP_INVALID.
Definition: SDL3pp_gpu.h:4607
constexpr GPUTextureType GPU_TEXTURETYPE_CUBE_ARRAY
The texture is a cube array image.
Definition: SDL3pp_gpu.h:3018
SDL_GPUTextureCreateInfo GPUTextureCreateInfo
A structure specifying the parameters of a texture.
Definition: SDL3pp_gpu.h:684
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32_INT
GPU_TEXTUREFORMAT_R32_INT.
Definition: SDL3pp_gpu.h:2829
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:7212
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:7371
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_5x4_FLOAT
GPU_TEXTUREFORMAT_ASTC_5x4_FLOAT.
Definition: SDL3pp_gpu.h:2958
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB
GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB.
Definition: SDL3pp_gpu.h:2844
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_12x10_FLOAT
GPU_TEXTUREFORMAT_ASTC_12x10_FLOAT.
Definition: SDL3pp_gpu.h:2991
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB
GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB.
Definition: SDL3pp_gpu.h:2841
constexpr GPUColorComponentFlags GPU_COLORCOMPONENT_B
the blue component
Definition: SDL3pp_gpu.h:4739
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x8_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_8x8_UNORM_SRGB.
Definition: SDL3pp_gpu.h:2934
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16B16A16_SNORM
GPU_TEXTUREFORMAT_R16G16B16A16_SNORM.
Definition: SDL3pp_gpu.h:2760
constexpr GPUSampleCount GPU_SAMPLECOUNT_8
MSAA 8x.
Definition: SDL3pp_gpu.h:3093
constexpr GPUTextureType GPU_TEXTURETYPE_3D
The texture is a 3-dimensional image.
Definition: SDL3pp_gpu.h:3012
bool SetSwapchainParameters(WindowParam window, GPUSwapchainComposition swapchain_composition, GPUPresentMode present_mode)
Changes the swapchain parameters for the given claimed window.
Definition: SDL3pp_gpu.h:7587
constexpr GPUBufferUsageFlags GPU_BUFFERUSAGE_INDEX
Buffer is an index buffer.
Definition: SDL3pp_gpu.h:4336
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT
GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT.
Definition: SDL3pp_gpu.h:2742
constexpr GPUIndexElementSize GPU_INDEXELEMENTSIZE_16BIT
The index elements are 16-bit.
Definition: SDL3pp_gpu.h:1196
constexpr GPUStencilOp GPU_STENCILOP_DECREMENT_AND_CLAMP
Decrements the current value and clamps to 0.
Definition: SDL3pp_gpu.h:4623
bool WindowSupportsGPUSwapchainComposition(GPUDeviceParam device, WindowParam window, GPUSwapchainComposition swapchain_composition)
Determines whether a swapchain composition is supported by the window.
Definition: SDL3pp_gpu.h:7455
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UINT4
GPU_VERTEXELEMENTFORMAT_UINT4.
Definition: SDL3pp_gpu.h:4420
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16_UINT
GPU_TEXTUREFORMAT_R16_UINT.
Definition: SDL3pp_gpu.h:2793
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16_FLOAT
GPU_TEXTUREFORMAT_R16G16_FLOAT.
Definition: SDL3pp_gpu.h:2766
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:6458
constexpr GPUSampleCount GPU_SAMPLECOUNT_2
MSAA 2x.
Definition: SDL3pp_gpu.h:3089
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE
Texture supports storage writes in the compute stage.
Definition: SDL3pp_gpu.h:3062
void End()
Ends the given render pass.
Definition: SDL3pp_gpu.h:6864
void BindVertexStorageBuffers(Uint32 first_slot, SpanRef< const GPUBufferRaw > storage_buffers)
Binds storage buffers for use on the vertex shader.
Definition: SDL3pp_gpu.h:6584
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:6911
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x5_UNORM
GPU_TEXTUREFORMAT_ASTC_8x5_UNORM.
Definition: SDL3pp_gpu.h:2886
void ReleaseTexture(GPUTexture texture)
Frees the given texture as soon as it is safe to do so.
Definition: SDL3pp_gpu.h:6035
constexpr GPUCullMode GPU_CULLMODE_FRONT
Front-facing triangles are culled.
Definition: SDL3pp_gpu.h:4533
constexpr GPUCubeMapFace GPU_CUBEMAPFACE_POSITIVEY
GPU_CUBEMAPFACE_POSITIVEY.
Definition: SDL3pp_gpu.h:4302
constexpr GPUCompareOp GPU_COMPAREOP_GREATER
The comparison evaluates reference > test.
Definition: SDL3pp_gpu.h:4584
SDL_GPUCubeMapFace GPUCubeMapFace
Specifies the face of a cube map.
Definition: SDL3pp_gpu.h:4294
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16_FLOAT
GPU_TEXTUREFORMAT_R16_FLOAT.
Definition: SDL3pp_gpu.h:2763
SDL_GPUSamplerCreateInfo GPUSamplerCreateInfo
A structure specifying the parameters of a sampler.
Definition: SDL3pp_gpu.h:804
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_12x12_FLOAT
GPU_TEXTUREFORMAT_ASTC_12x12_FLOAT.
Definition: SDL3pp_gpu.h:2994
void GenerateMipmapsForTexture(GPUTexture texture)
Generates mipmaps for the given texture.
Definition: SDL3pp_gpu.h:7415
constexpr GPUFrontFace GPU_FRONTFACE_COUNTER_CLOCKWISE
A triangle with counter-clockwise vertex winding will be considered front-facing.
Definition: SDL3pp_gpu.h:4553
SDL_GPUComputePipelineCreateInfo GPUComputePipelineCreateInfo
A structure specifying the parameters of a compute pipeline state.
Definition: SDL3pp_gpu.h:994
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:6217
GPUTexture CreateGPUTexture(GPUDeviceParam device, const GPUTextureCreateInfo &createinfo)
Creates a texture object to be used in graphics or compute workflows.
Definition: SDL3pp_gpu.h:5726
constexpr GPUColorComponentFlags GPU_COLORCOMPONENT_R
the red component
Definition: SDL3pp_gpu.h:4733
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x5_FLOAT
GPU_TEXTUREFORMAT_ASTC_10x5_FLOAT.
Definition: SDL3pp_gpu.h:2979
constexpr GPUSamplerMipmapMode GPU_SAMPLERMIPMAPMODE_NEAREST
Point filtering.
Definition: SDL3pp_gpu.h:4769
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_BYTE2_NORM
GPU_VERTEXELEMENTFORMAT_BYTE2_NORM.
Definition: SDL3pp_gpu.h:4447
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_HALF2
GPU_VERTEXELEMENTFORMAT_HALF2.
Definition: SDL3pp_gpu.h:4483
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_6x5_UNORM
GPU_TEXTUREFORMAT_ASTC_6x5_UNORM.
Definition: SDL3pp_gpu.h:2880
constexpr GPUCullMode GPU_CULLMODE_BACK
Back-facing triangles are culled.
Definition: SDL3pp_gpu.h:4536
GPUTransferBuffer CreateTransferBuffer(const GPUTransferBufferCreateInfo &createinfo)
Creates a transfer buffer to be used when uploading to or downloading from graphics resources.
Definition: SDL3pp_gpu.h:5860
void SetBufferName(GPUBuffer buffer, StringParam text)
Sets an arbitrary string constant to label a buffer.
Definition: SDL3pp_gpu.h:5897
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UINT2
GPU_VERTEXELEMENTFORMAT_UINT2.
Definition: SDL3pp_gpu.h:4414
SDL_GPUTransferBufferLocation GPUTransferBufferLocation
A structure specifying a location in a transfer buffer.
Definition: SDL3pp_gpu.h:1776
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x6_UNORM
GPU_TEXTUREFORMAT_ASTC_10x6_UNORM.
Definition: SDL3pp_gpu.h:2898
void ReleaseGPUTexture(GPUDeviceParam device, GPUTexture texture)
Frees the given texture as soon as it is safe to do so.
Definition: SDL3pp_gpu.h:6030
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8B8A8_SNORM
GPU_TEXTUREFORMAT_R8G8B8A8_SNORM.
Definition: SDL3pp_gpu.h:2751
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UBYTE4
GPU_VERTEXELEMENTFORMAT_UBYTE4.
Definition: SDL3pp_gpu.h:4444
GPUShader CreateGPUShader(GPUDeviceParam device, const GPUShaderCreateInfo &createinfo)
Creates a shader to be used when creating a graphics pipeline.
Definition: SDL3pp_gpu.h:5651
void PushFragmentUniformData(Uint32 slot_index, SourceBytes data)
Pushes data to a fragment uniform slot on the command buffer.
Definition: SDL3pp_gpu.h:6255
GPUComputePipeline CreateGPUComputePipeline(GPUDeviceParam device, const GPUComputePipelineCreateInfo &createinfo)
Creates a pipeline object to be used in a compute workflow.
Definition: SDL3pp_gpu.h:5481
void GDKResumeGPU(GPUDeviceParam device)
Call this to resume GPU operation on Xbox when you receive the EVENT_WILL_ENTER_FOREGROUND event.
Definition: SDL3pp_gpu.h:8150
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:7241
void PushGPUComputeUniformData(GPUCommandBuffer command_buffer, Uint32 slot_index, SourceBytes data)
Pushes data to a uniform slot on the command buffer.
Definition: SDL3pp_gpu.h:6277
constexpr GPUBlendFactor GPU_BLENDFACTOR_INVALID
GPU_BLENDFACTOR_INVALID.
Definition: SDL3pp_gpu.h:4683
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:8077
SDL_GPUStorageTextureReadWriteBinding GPUStorageTextureReadWriteBinding
A structure specifying parameters related to binding textures in a compute pass.
Definition: SDL3pp_gpu.h:2026
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_INVALID
GPU_VERTEXELEMENTFORMAT_INVALID.
Definition: SDL3pp_gpu.h:4396
SDL_GPUSwapchainComposition GPUSwapchainComposition
Specifies the texture format and colorspace of the swapchain textures.
Definition: SDL3pp_gpu.h:2545
SDL_GPUPrimitiveType GPUPrimitiveType
Specifies the primitive topology of a graphics pipeline.
Definition: SDL3pp_gpu.h:4214
void PushVertexUniformData(Uint32 slot_index, SourceBytes data)
Pushes data to a vertex uniform slot on the command buffer.
Definition: SDL3pp_gpu.h:6225
constexpr GPUStencilOp GPU_STENCILOP_INCREMENT_AND_CLAMP
Increments the current value and clamps to the maximum value.
Definition: SDL3pp_gpu.h:4620
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_SHORT4_NORM
GPU_VERTEXELEMENTFORMAT_SHORT4_NORM.
Definition: SDL3pp_gpu.h:4474
SDL_GPUTransferBufferUsage GPUTransferBufferUsage
Specifies how a transfer buffer is intended to be used by the client.
Definition: SDL3pp_gpu.h:4364
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT
GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT.
Definition: SDL3pp_gpu.h:2868
void GenerateMipmapsForGPUTexture(GPUCommandBuffer command_buffer, GPUTexture texture)
Generates mipmaps for the given texture.
Definition: SDL3pp_gpu.h:7409
constexpr GPUTextureType GPU_TEXTURETYPE_2D
The texture is a 2-dimensional image.
Definition: SDL3pp_gpu.h:3006
GPUTexture AcquireSwapchainTexture(WindowParam window, Uint32 *swapchain_texture_width=nullptr, Uint32 *swapchain_texture_height=nullptr)
Acquire a texture to use in presentation.
Definition: SDL3pp_gpu.h:7715
void CopyBufferToBuffer(const GPUBufferLocation &source, const GPUBufferLocation &destination, Uint32 size, bool cycle)
Performs a buffer-to-buffer copy.
Definition: SDL3pp_gpu.h:7323
constexpr GPUBlendFactor GPU_BLENDFACTOR_SRC_COLOR
source color
Definition: SDL3pp_gpu.h:4690
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC2_RGBA_UNORM
GPU_TEXTUREFORMAT_BC2_RGBA_UNORM.
Definition: SDL3pp_gpu.h:2724
void ReleaseGPUBuffer(GPUDeviceParam device, GPUBuffer buffer)
Frees the given buffer as soon as it is safe to do so.
Definition: SDL3pp_gpu.h:6070
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB
GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB.
Definition: SDL3pp_gpu.h:2838
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_B4G4R4A4_UNORM
GPU_TEXTUREFORMAT_B4G4R4A4_UNORM.
Definition: SDL3pp_gpu.h:2715
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_12x10_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_12x10_UNORM_SRGB.
Definition: SDL3pp_gpu.h:2949
void DestroyGPUDevice(GPUDeviceRaw device)
Destroys a GPU context previously returned by GPUDevice.GPUDevice.
Definition: SDL3pp_gpu.h:5246
SDL_GPUBlitInfo GPUBlitInfo
A structure containing parameters for a blit command.
Definition: SDL3pp_gpu.h:2045
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x10_UNORM
GPU_TEXTUREFORMAT_ASTC_10x10_UNORM.
Definition: SDL3pp_gpu.h:2904
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_5x4_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_5x4_UNORM_SRGB.
Definition: SDL3pp_gpu.h:2916
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:4261
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_12x10_UNORM
GPU_TEXTUREFORMAT_ASTC_12x10_UNORM.
Definition: SDL3pp_gpu.h:2907
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:6352
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_5x5_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_5x5_UNORM_SRGB.
Definition: SDL3pp_gpu.h:2919
constexpr GPUShaderFormat GPU_SHADERFORMAT_METALLIB
Precompiled metallib shaders for Metal.
Definition: SDL3pp_gpu.h:2517
constexpr GPUFillMode GPU_FILLMODE_LINE
Polygon edges will be drawn as line segments.
Definition: SDL3pp_gpu.h:4518
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:7314
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_4x4_UNORM
GPU_TEXTUREFORMAT_ASTC_4x4_UNORM.
Definition: SDL3pp_gpu.h:2871
void WaitForGPUSwapchain(GPUDeviceParam device, WindowParam window)
Blocks the thread until a swapchain texture is available to be acquired.
Definition: SDL3pp_gpu.h:7742
constexpr GPUPrimitiveType GPU_PRIMITIVETYPE_TRIANGLESTRIP
A series of connected triangles.
Definition: SDL3pp_gpu.h:4219
constexpr GPUShaderFormat GPU_SHADERFORMAT_MSL
MSL shaders for Metal.
Definition: SDL3pp_gpu.h:2514
void PopDebugGroup()
Ends the most-recently pushed debug group.
Definition: SDL3pp_gpu.h:6015
void UploadToTexture(const GPUTextureTransferInfo &source, const GPUTextureRegion &destination, bool cycle)
Uploads data from a transfer buffer to a texture.
Definition: SDL3pp_gpu.h:7220
void ReleaseBuffer(GPUBuffer buffer)
Frees the given buffer as soon as it is safe to do so.
Definition: SDL3pp_gpu.h:6075
void ReleaseGPUShader(GPUDeviceParam device, GPUShader shader)
Frees the given shader as soon as it is safe to do so.
Definition: SDL3pp_gpu.h:6133
constexpr GPUCompareOp GPU_COMPAREOP_NEVER
The comparison always evaluates false.
Definition: SDL3pp_gpu.h:4571
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16_SNORM
GPU_TEXTUREFORMAT_R16G16_SNORM.
Definition: SDL3pp_gpu.h:2757
void SetBlendConstants(FColorRaw blend_constants)
Sets the current blend constants on a command buffer.
Definition: SDL3pp_gpu.h:6417
constexpr GPUBlendFactor GPU_BLENDFACTOR_SRC_ALPHA
source alpha
Definition: SDL3pp_gpu.h:4702
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x5_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_8x5_UNORM_SRGB.
Definition: SDL3pp_gpu.h:2928
void SetTextureName(GPUTexture texture, StringParam text)
Sets an arbitrary string constant to label a texture.
Definition: SDL3pp_gpu.h:5926
GPUDevice CreateGPUDevice(GPUShaderFormat format_flags, bool debug_mode, StringParam name)
Creates a GPU context.
Definition: SDL3pp_gpu.h:5034
void * MapGPUTransferBuffer(GPUDeviceParam device, GPUTransferBuffer transfer_buffer, bool cycle)
Maps a transfer buffer into application address space.
Definition: SDL3pp_gpu.h:7139
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_6x6_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_6x6_UNORM_SRGB.
Definition: SDL3pp_gpu.h:2925
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R10G10B10A2_UNORM
GPU_TEXTUREFORMAT_R10G10B10A2_UNORM.
Definition: SDL3pp_gpu.h:2706
void BindPipeline(GPUGraphicsPipeline graphics_pipeline)
Binds a graphics pipeline on a render pass to be used in rendering.
Definition: SDL3pp_gpu.h:6358
void WaitForGPUFences(GPUDeviceParam device, bool wait_all, std::span< GPUFence *const > fences)
Blocks the thread until the given fences are signaled.
Definition: SDL3pp_gpu.h:7945
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_B8G8R8A8_UNORM
GPU_TEXTUREFORMAT_B8G8R8A8_UNORM.
Definition: SDL3pp_gpu.h:2718
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:6802
SDL_GPUTransferBufferCreateInfo GPUTransferBufferCreateInfo
A structure specifying the parameters of a transfer buffer.
Definition: SDL3pp_gpu.h:590
constexpr GPULoadOp GPU_LOADOP_DONT_CARE
The previous contents of the texture need not be preserved.
Definition: SDL3pp_gpu.h:4251
constexpr GPUBlendFactor GPU_BLENDFACTOR_ZERO
0
Definition: SDL3pp_gpu.h:4686
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8_SNORM
GPU_TEXTUREFORMAT_R8G8_SNORM.
Definition: SDL3pp_gpu.h:2748
SDL_GPURenderPass * GPURenderPassRaw
Alias to raw representation for GPURenderPass.
Definition: SDL3pp_gpu.h:461
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32G32B32A32_INT
GPU_TEXTUREFORMAT_R32G32B32A32_INT.
Definition: SDL3pp_gpu.h:2835
constexpr GPUBlendOp GPU_BLENDOP_MAX
max(source, destination)
Definition: SDL3pp_gpu.h:4667
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16_INT
GPU_TEXTUREFORMAT_R16G16_INT.
Definition: SDL3pp_gpu.h:2823
GPUTextureFormat GetGPUSwapchainTextureFormat(GPUDeviceParam device, WindowParam window)
Obtains the texture format of the swapchain for the given window.
Definition: SDL3pp_gpu.h:7643
SDL_GPUBufferRegion GPUBufferRegion
A structure specifying a region of a buffer.
Definition: SDL3pp_gpu.h:1707
GPUShader CreateShader(const GPUShaderCreateInfo &createinfo)
Creates a shader to be used when creating a graphics pipeline.
Definition: SDL3pp_gpu.h:5657
const char * GetGPUDriver(int index)
Get the name of a built in GPU driver.
Definition: SDL3pp_gpu.h:5281
SDL_GPUTextureFormat GPUTextureFormat
Specifies the pixel format of a texture.
Definition: SDL3pp_gpu.h:2680
constexpr GPUStoreOp GPU_STOREOP_STORE
The contents generated during the render pass will be written to memory.
Definition: SDL3pp_gpu.h:4264
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB
GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB.
Definition: SDL3pp_gpu.h:2847
void InsertDebugLabel(StringParam text)
Inserts an arbitrary string label into the command buffer callstream.
Definition: SDL3pp_gpu.h:5953
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB
GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB.
Definition: SDL3pp_gpu.h:2853
GPUTexture CreateTexture(const GPUTextureCreateInfo &createinfo)
Creates a texture object to be used in graphics or compute workflows.
Definition: SDL3pp_gpu.h:5732
constexpr GPUBlendFactor GPU_BLENDFACTOR_SRC_ALPHA_SATURATE
min(source alpha, 1 - destination alpha)
Definition: SDL3pp_gpu.h:4720
constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA
1 - destination alpha
Definition: SDL3pp_gpu.h:4711
void BindPipeline(GPUComputePipeline compute_pipeline)
Binds a compute pipeline on a command buffer for use in compute dispatch.
Definition: SDL3pp_gpu.h:6933
void GDKSuspendGPU(GPUDeviceParam device)
Call this to suspend GPU operation on Xbox when you receive the EVENT_DID_ENTER_BACKGROUND event.
Definition: SDL3pp_gpu.h:8133
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_BYTE2
GPU_VERTEXELEMENTFORMAT_BYTE2.
Definition: SDL3pp_gpu.h:4435
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x8_UNORM
GPU_TEXTUREFORMAT_ASTC_8x8_UNORM.
Definition: SDL3pp_gpu.h:2892
bool TextureSupportsSampleCount(GPUTextureFormat format, GPUSampleCount sample_count)
Determines if a sample count for a texture format is supported.
Definition: SDL3pp_gpu.h:8060
constexpr GPUStencilOp GPU_STENCILOP_KEEP
Keeps the current value.
Definition: SDL3pp_gpu.h:4610
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_INT3
GPU_VERTEXELEMENTFORMAT_INT3.
Definition: SDL3pp_gpu.h:4405
SDL_GPUDevice * GPUDeviceRaw
Alias to raw representation for GPUDevice.
Definition: SDL3pp_gpu.h:380
constexpr GPUBufferUsageFlags GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ
Buffer supports storage reads in the compute stage.
Definition: SDL3pp_gpu.h:4347
void ClaimWindow(WindowParam window)
Claims a window, creating a swapchain structure for it.
Definition: SDL3pp_gpu.h:7529
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:7378
const char * GetGPUDeviceDriver(GPUDeviceParam device)
Returns the name of the backend used to create this GPU context.
Definition: SDL3pp_gpu.h:5291
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x5_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_10x5_UNORM_SRGB.
Definition: SDL3pp_gpu.h:2937
void SetGPUBlendConstants(GPURenderPass render_pass, FColorRaw blend_constants)
Sets the current blend constants on a command buffer.
Definition: SDL3pp_gpu.h:6411
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16G16B16A16_UINT
GPU_TEXTUREFORMAT_R16G16B16A16_UINT.
Definition: SDL3pp_gpu.h:2799
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x8_FLOAT
GPU_TEXTUREFORMAT_ASTC_8x8_FLOAT.
Definition: SDL3pp_gpu.h:2976
SDL_GPUStorageBufferReadWriteBinding GPUStorageBufferReadWriteBinding
A structure specifying parameters related to binding buffers in a compute pass.
Definition: SDL3pp_gpu.h:2036
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_5x4_UNORM
GPU_TEXTUREFORMAT_ASTC_5x4_UNORM.
Definition: SDL3pp_gpu.h:2874
void End()
Ends the current copy pass.
Definition: SDL3pp_gpu.h:7397
void ReleaseGraphicsPipeline(GPUGraphicsPipeline graphics_pipeline)
Frees the given graphics pipeline as soon as it is safe to do so.
Definition: SDL3pp_gpu.h:6159
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_USHORT4
GPU_VERTEXELEMENTFORMAT_USHORT4.
Definition: SDL3pp_gpu.h:4468
GPUFence * SubmitAndAcquireFence()
Submits a command buffer so its commands can be processed on the GPU, and acquires a fence associated...
Definition: SDL3pp_gpu.h:7878
constexpr GPUShaderFormat GPU_SHADERFORMAT_INVALID
INVALID.
Definition: SDL3pp_gpu.h:2499
void WaitForIdle()
Blocks the thread until the GPU is completely idle.
Definition: SDL3pp_gpu.h:7929
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:7024
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_B5G6R5_UNORM
GPU_TEXTUREFORMAT_B5G6R5_UNORM.
Definition: SDL3pp_gpu.h:2709
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:7345
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8_UNORM
GPU_TEXTUREFORMAT_R8G8_UNORM.
Definition: SDL3pp_gpu.h:2691
bool WindowSupportsGPUPresentMode(GPUDeviceParam device, WindowParam window, GPUPresentMode present_mode)
Determines whether a presentation mode is supported by the window.
Definition: SDL3pp_gpu.h:7486
void EndGPURenderPass(GPURenderPass render_pass)
Ends the given render pass.
Definition: SDL3pp_gpu.h:6859
constexpr GPUBlendOp GPU_BLENDOP_REVERSE_SUBTRACT
(destination * destination_factor) - (source * source_factor)
Definition: SDL3pp_gpu.h:4661
constexpr GPUColorComponentFlags GPU_COLORCOMPONENT_G
the green component
Definition: SDL3pp_gpu.h:4736
constexpr GPUSwapchainComposition GPU_SWAPCHAINCOMPOSITION_SDR
GPU_SWAPCHAINCOMPOSITION_SDR.
Definition: SDL3pp_gpu.h:2547
constexpr GPUBufferUsageFlags GPU_BUFFERUSAGE_INDIRECT
Buffer is an indirect buffer.
Definition: SDL3pp_gpu.h:4339
SDL_GPURasterizerState GPURasterizerState
A structure specifying the parameters of the graphics pipeline rasterizer state.
Definition: SDL3pp_gpu.h:4930
void WaitForGPUIdle(GPUDeviceParam device)
Blocks the thread until the GPU is completely idle.
Definition: SDL3pp_gpu.h:7924
bool GPUSupportsProperties(PropertiesParam props)
Checks for GPU runtime support.
Definition: SDL3pp_gpu.h:5003
constexpr GPUTextureUsageFlags GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ
Texture supports storage reads in the compute stage.
Definition: SDL3pp_gpu.h:3058
constexpr GPUBlendOp GPU_BLENDOP_SUBTRACT
(source * source_factor) - (destination * destination_factor)
Definition: SDL3pp_gpu.h:4658
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8_INT
GPU_TEXTUREFORMAT_R8_INT.
Definition: SDL3pp_gpu.h:2811
void InsertGPUDebugLabel(GPUCommandBuffer command_buffer, StringParam text)
Inserts an arbitrary string label into the command buffer callstream.
Definition: SDL3pp_gpu.h:5947
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R16_UNORM
GPU_TEXTUREFORMAT_R16_UNORM.
Definition: SDL3pp_gpu.h:2697
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x10_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_10x10_UNORM_SRGB.
Definition: SDL3pp_gpu.h:2946
PropertiesRef GetGPUDeviceProperties(GPUDeviceParam device)
Get the properties associated with a GPU device.
Definition: SDL3pp_gpu.h:5424
void EndGPUCopyPass(GPUCopyPass copy_pass)
Ends the current copy pass.
Definition: SDL3pp_gpu.h:7392
SDL_GPUSamplerAddressMode GPUSamplerAddressMode
Specifies behavior of texture sampling when the coordinates exceed the 0-1 range.
Definition: SDL3pp_gpu.h:4783
void DispatchGPUComputeIndirect(GPUComputePass compute_pass, GPUBuffer buffer, Uint32 offset)
Dispatches compute work with parameters set from a buffer.
Definition: SDL3pp_gpu.h:7095
bool SetGPUAllowedFramesInFlight(GPUDeviceParam device, Uint32 allowed_frames_in_flight)
Configures the maximum allowed number of frames in flight.
Definition: SDL3pp_gpu.h:7621
constexpr GPUStoreOp GPU_STOREOP_DONT_CARE
The contents generated during the render pass are not needed and may be discarded.
Definition: SDL3pp_gpu.h:4270
constexpr GPULoadOp GPU_LOADOP_CLEAR
The contents of the texture will be cleared to a color.
Definition: SDL3pp_gpu.h:4245
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM
GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM.
Definition: SDL3pp_gpu.h:4456
GPUTexture WaitAndAcquireSwapchainTexture(WindowParam 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:7807
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R32G32B32A32_UINT
GPU_TEXTUREFORMAT_R32G32B32A32_UINT.
Definition: SDL3pp_gpu.h:2808
void GDKResumeGPU()
Call this to resume GPU operation on Xbox when you receive the EVENT_WILL_ENTER_FOREGROUND event.
Definition: SDL3pp_gpu.h:8152
constexpr GPUTextureType GPU_TEXTURETYPE_2D_ARRAY
The texture is a 2-dimensional array image.
Definition: SDL3pp_gpu.h:3009
SDL_GPUFrontFace GPUFrontFace
Specifies the vertex winding that will cause a triangle to be determined to be front-facing.
Definition: SDL3pp_gpu.h:4547
constexpr GPUPresentMode GPU_PRESENTMODE_MAILBOX
GPU_PRESENTMODE_MAILBOX.
Definition: SDL3pp_gpu.h:2592
constexpr GPUCubeMapFace GPU_CUBEMAPFACE_NEGATIVEY
GPU_CUBEMAPFACE_NEGATIVEY.
Definition: SDL3pp_gpu.h:4305
void PushDebugGroup(StringParam name)
Begins a debug group with an arbitrary name.
Definition: SDL3pp_gpu.h:5990
bool GPUSupportsShaderFormats(GPUShaderFormat format_flags, StringParam name)
Checks for GPU runtime support.
Definition: SDL3pp_gpu.h:4987
constexpr GPUShaderFormat GPU_SHADERFORMAT_SPIRV
SPIR-V shaders for Vulkan.
Definition: SDL3pp_gpu.h:2505
SDL_GPUStencilOp GPUStencilOp
Specifies what happens to a stored stencil value if stencil tests fail or pass.
Definition: SDL3pp_gpu.h:4605
bool WindowSupportsPresentMode(WindowParam window, GPUPresentMode present_mode)
Determines whether a presentation mode is supported by the window.
Definition: SDL3pp_gpu.h:7493
SDL_GPUFence GPUFence
An opaque handle representing a fence.
Definition: SDL3pp_gpu.h:2057
SDL_GPUComputePass * GPUComputePassRaw
Alias to raw representation for GPUComputePass.
Definition: SDL3pp_gpu.h:467
constexpr GPUSamplerAddressMode GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT
Specifies that the coordinates will wrap around mirrored.
Definition: SDL3pp_gpu.h:4790
void ReleaseGPUTransferBuffer(GPUDeviceParam device, GPUTransferBuffer transfer_buffer)
Frees the given transfer buffer as soon as it is safe to do so.
Definition: SDL3pp_gpu.h:6090
SDL_GPUIndexElementSize GPUIndexElementSize
Specifies the size of elements in an index buffer.
Definition: SDL3pp_gpu.h:1194
SDL_GPUShaderCreateInfo GPUShaderCreateInfo
A structure specifying code and metadata for creating a shader object.
Definition: SDL3pp_gpu.h:874
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:6450
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:6999
void DrawPrimitives(Uint32 num_vertices, Uint32 num_instances, Uint32 first_vertex, Uint32 first_instance)
Draws data using bound graphics state.
Definition: SDL3pp_gpu.h:6777
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_8x5_FLOAT
GPU_TEXTUREFORMAT_ASTC_8x5_FLOAT.
Definition: SDL3pp_gpu.h:2970
void SetGPUScissor(GPURenderPass render_pass, const RectRaw &scissor)
Sets the current scissor state on a command buffer.
Definition: SDL3pp_gpu.h:6390
SDL_GPUVertexInputState GPUVertexInputState
A structure specifying the parameters of a graphics pipeline vertex input state.
Definition: SDL3pp_gpu.h:4891
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_D16_UNORM
GPU_TEXTUREFORMAT_D16_UNORM.
Definition: SDL3pp_gpu.h:2856
void SubmitGPUCommandBuffer(GPUCommandBuffer command_buffer)
Submits a command buffer so its commands can be processed on the GPU.
Definition: SDL3pp_gpu.h:7838
SDL_GPUVertexInputRate GPUVertexInputRate
Specifies the rate at which vertex attributes are pulled from buffers.
Definition: SDL3pp_gpu.h:4496
constexpr GPUFilter GPU_FILTER_NEAREST
Point filtering.
Definition: SDL3pp_gpu.h:4754
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x6_UNORM_SRGB
GPU_TEXTUREFORMAT_ASTC_10x6_UNORM_SRGB.
Definition: SDL3pp_gpu.h:2940
constexpr GPUCubeMapFace GPU_CUBEMAPFACE_POSITIVEX
GPU_CUBEMAPFACE_POSITIVEX.
Definition: SDL3pp_gpu.h:4296
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:6954
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:6990
GPUCopyPass BeginGPUCopyPass(GPUCommandBuffer command_buffer)
Begins a copy pass on a command buffer.
Definition: SDL3pp_gpu.h:7185
constexpr GPUBlendOp GPU_BLENDOP_ADD
(source * source_factor) + (destination * destination_factor)
Definition: SDL3pp_gpu.h:4655
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:4239
constexpr GPUTextureType GPU_TEXTURETYPE_CUBE
The texture is a cube image.
Definition: SDL3pp_gpu.h:3015
SDL_GPUFilter GPUFilter
Specifies a filter operation used by a sampler.
Definition: SDL3pp_gpu.h:4752
constexpr GPUStencilOp GPU_STENCILOP_INCREMENT_AND_WRAP
Increments the current value and wraps back to 0.
Definition: SDL3pp_gpu.h:4630
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB
GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB.
Definition: SDL3pp_gpu.h:2850
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_INVALID
GPU_TEXTUREFORMAT_INVALID.
Definition: SDL3pp_gpu.h:2682
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_5x5_UNORM
GPU_TEXTUREFORMAT_ASTC_5x5_UNORM.
Definition: SDL3pp_gpu.h:2877
SDL_GPUBlitRegion GPUBlitRegion
A structure specifying a region of a texture used in the blit operation.
Definition: SDL3pp_gpu.h:4804
SDL_GPUViewport GPUViewport
A structure specifying a viewport.
Definition: SDL3pp_gpu.h:1175
GPUShaderFormat GetShaderFormats()
Returns the supported shader formats for this GPU context.
Definition: SDL3pp_gpu.h:5315
SDL_GPUComputePipeline * GPUComputePipelineRaw
Alias to raw representation for GPUComputePipeline.
Definition: SDL3pp_gpu.h:443
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_BYTE4_NORM
GPU_VERTEXELEMENTFORMAT_BYTE4_NORM.
Definition: SDL3pp_gpu.h:4450
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_FLOAT
GPU_VERTEXELEMENTFORMAT_FLOAT.
Definition: SDL3pp_gpu.h:4423
constexpr GPUSampleCount GPU_SAMPLECOUNT_1
No multisampling.
Definition: SDL3pp_gpu.h:3086
SDL_GPUIndirectDrawCommand GPUIndirectDrawCommand
A structure specifying the parameters of an indirect draw command.
Definition: SDL3pp_gpu.h:4820
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:6334
constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA
1 - source alpha
Definition: SDL3pp_gpu.h:4705
constexpr GPUBlendFactor GPU_BLENDFACTOR_ONE
1
Definition: SDL3pp_gpu.h:4688
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM
GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM.
Definition: SDL3pp_gpu.h:4453
constexpr GPUVertexElementFormat GPU_VERTEXELEMENTFORMAT_SHORT4
GPU_VERTEXELEMENTFORMAT_SHORT4.
Definition: SDL3pp_gpu.h:4462
void PopGPUDebugGroup(GPUCommandBuffer command_buffer)
Ends the most-recently pushed debug group.
Definition: SDL3pp_gpu.h:6010
constexpr GPULoadOp GPU_LOADOP_LOAD
The previous contents of the texture will be preserved.
Definition: SDL3pp_gpu.h:4242
constexpr GPUCullMode GPU_CULLMODE_NONE
No triangles are culled.
Definition: SDL3pp_gpu.h:4530
constexpr GPUBlendFactor GPU_BLENDFACTOR_DST_ALPHA
destination alpha
Definition: SDL3pp_gpu.h:4708
GPUSampler CreateGPUSampler(GPUDeviceParam device, const GPUSamplerCreateInfo &createinfo)
Creates a sampler object to be used when binding textures in a graphics workflow.
Definition: SDL3pp_gpu.h:5563
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:6841
void EndGPUComputePass(GPUComputePass compute_pass)
Ends the current compute pass.
Definition: SDL3pp_gpu.h:7117
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_ASTC_10x5_UNORM
GPU_TEXTUREFORMAT_ASTC_10x5_UNORM.
Definition: SDL3pp_gpu.h:2895
constexpr GPUTextureFormat GPU_TEXTUREFORMAT_R8G8_UINT
GPU_TEXTUREFORMAT_R8G8_UINT.
Definition: SDL3pp_gpu.h:2787
SDL_FColor FColorRaw
Alias to raw representation for FColor.
Definition: SDL3pp_pixels.h:89
SDL_Rect RectRaw
Alias to raw representation for Rect.
Definition: SDL3pp_rect.h:34
::Uint32 Uint32
An unsigned 32-bit integer type.
Definition: SDL3pp_stdinc.h:341
::Uint8 Uint8
An unsigned 8-bit integer type.
Definition: SDL3pp_stdinc.h:289
::Sint32 Sint32
A signed 32-bit integer type.
Definition: SDL3pp_stdinc.h:328
Main include header for the SDL3pp library.
Safely wrap GPUDevice for non owning parameters.
Definition: SDL3pp_gpu.h:387
GPUDeviceRaw value
parameter's GPUDeviceRaw
Definition: SDL3pp_gpu.h:388
constexpr GPUDeviceParam(std::nullptr_t=nullptr)
Constructs null/invalid.
Definition: SDL3pp_gpu.h:397
constexpr GPUDeviceParam(GPUDeviceRaw value)
Constructs from GPUDeviceRaw.
Definition: SDL3pp_gpu.h:391
constexpr auto operator<=>(const GPUDeviceParam &other) const =default
Comparison.
Semi-safe reference for GPUDevice.
Definition: SDL3pp_gpu.h:4160
GPUDeviceRef(GPUDeviceParam resource) noexcept
Constructs from GPUDeviceParam.
Definition: SDL3pp_gpu.h:4170
GPUDeviceRef(GPUDeviceRaw resource) noexcept
Constructs from GPUDeviceParam.
Definition: SDL3pp_gpu.h:4182
constexpr GPUDeviceRef(const GPUDeviceRef &other) noexcept=default
Copy constructor.
~GPUDeviceRef()
Destructor.
Definition: SDL3pp_gpu.h:4191
Safely wrap Properties for non owning parameters.
Definition: SDL3pp_properties.h:53
Semi-safe reference for Properties.
Definition: SDL3pp_properties.h:716
Safely wrap Window for non owning parameters.
Definition: SDL3pp_video.h:54