From 90f08d32e5ce7be8b5f3c272bcd9a2773cd134ae Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 2 Oct 2024 21:22:19 -0400 Subject: First commit! --- sdl3/bindings/gpu.scm | 1202 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1202 insertions(+) create mode 100644 sdl3/bindings/gpu.scm (limited to 'sdl3/bindings/gpu.scm') diff --git a/sdl3/bindings/gpu.scm b/sdl3/bindings/gpu.scm new file mode 100644 index 0000000..0c83405 --- /dev/null +++ b/sdl3/bindings/gpu.scm @@ -0,0 +1,1202 @@ +;;; guile-sdl3 -- Scheme bindings for SDL3 +;;; Copyright © 2024 David Thompson +;;; +;;; Licensed under the Apache License, Version 2.0 (the "License"); +;;; you may not use this file except in compliance with the License. +;;; You may obtain a copy of the License at +;;; +;;; http://www.apache.org/licenses/LICENSE-2.0 +;;; +;;; Unless required by applicable law or agreed to in writing, software +;;; distributed under the License is distributed on an "AS IS" BASIS, +;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +;;; See the License for the specific language governing permissions and +;;; limitations under the License. + +;;; Commentary: +;; +;; Low-level bindings for SDL_gpu.h. +;; +;;; Code: + +(define-module (sdl3 bindings gpu) + #:use-module (bstruct) + #:use-module (sdl3 bindings utils) + #:use-module (sdl3 bindings pixels) + #:use-module (sdl3 bindings surface) + #:use-module (system foreign) + #:export (SDL_GPUPrimitiveType + symbol->gpu-primitive-type + primitive-type->symbol + SDL_GPU_PRIMITIVETYPE_TRIANGLELIST + SDL_GPU_PRIMITIVETYPE_TRIANGLESTRIP + SDL_GPU_PRIMITIVETYPE_LINELIST + SDL_GPU_PRIMITIVETYPE_LINESTRIP + SDL_GPU_PRIMITIVETYPE_POINTLIST + + SDL_GPULoadOp + symbol->gpu-load-op + gpu-load-op->symbol + SDL_GPU_LOADOP_LOAD + SDL_GPU_LOADOP_CLEAR + SDL_GPU_LOADOP_DONT_CARE + + SDL_GPUStoreOp + symbol->gpu-store-op + gpu-store-op->symbol + SDL_GPU_STOREOP_STORE + SDL_GPU_STOREOP_DONT_CARE + SDL_GPU_STOREOP_RESOLVE + SDL_GPU_STOREOP_RESOLVE_AND_STORE + + SDL_GPUIndexElementSize + symbol->gpu-index-element-size + gpu-index-element-size->symbol + SDL_GPU_INDEXELEMENTSIZE_16BIT + SDL_GPU_INDEXELEMENTSIZE_32BIT + + SDL_GPUTextureFormat + symbol->gpu-texture-format + gpu-texture-format->symbol + SDL_GPU_TEXTUREFORMAT_INVALID + SDL_GPU_TEXTUREFORMAT_A8_UNORM + SDL_GPU_TEXTUREFORMAT_R8_UNORM + SDL_GPU_TEXTUREFORMAT_R8G8_UNORM + SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM + SDL_GPU_TEXTUREFORMAT_R16_UNORM + SDL_GPU_TEXTUREFORMAT_R16G16_UNORM + SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UNORM + SDL_GPU_TEXTUREFORMAT_R10G10B10A2_UNORM + SDL_GPU_TEXTUREFORMAT_B5G6R5_UNORM + SDL_GPU_TEXTUREFORMAT_B5G5R5A1_UNORM + SDL_GPU_TEXTUREFORMAT_B4G4R4A4_UNORM + SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM + SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM + SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM + SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM + SDL_GPU_TEXTUREFORMAT_BC4_R_UNORM + SDL_GPU_TEXTUREFORMAT_BC5_RG_UNORM + SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM + SDL_GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT + SDL_GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT + SDL_GPU_TEXTUREFORMAT_R8_SNORM + SDL_GPU_TEXTUREFORMAT_R8G8_SNORM + SDL_GPU_TEXTUREFORMAT_R8G8B8A8_SNORM + SDL_GPU_TEXTUREFORMAT_R16_SNORM + SDL_GPU_TEXTUREFORMAT_R16G16_SNORM + SDL_GPU_TEXTUREFORMAT_R16G16B16A16_SNORM + SDL_GPU_TEXTUREFORMAT_R16_FLOAT + SDL_GPU_TEXTUREFORMAT_R16G16_FLOAT + SDL_GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT + SDL_GPU_TEXTUREFORMAT_R32_FLOAT + SDL_GPU_TEXTUREFORMAT_R32G32_FLOAT + SDL_GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT + SDL_GPU_TEXTUREFORMAT_R11G11B10_UFLOAT + SDL_GPU_TEXTUREFORMAT_R8_UINT + SDL_GPU_TEXTUREFORMAT_R8G8_UINT + SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UINT + SDL_GPU_TEXTUREFORMAT_R16_UINT + SDL_GPU_TEXTUREFORMAT_R16G16_UINT + SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UINT + SDL_GPU_TEXTUREFORMAT_R32_UINT + SDL_GPU_TEXTUREFORMAT_R32G32_UINT + SDL_GPU_TEXTUREFORMAT_R32G32B32A32_UINT + SDL_GPU_TEXTUREFORMAT_R8_INT + SDL_GPU_TEXTUREFORMAT_R8G8_INT + SDL_GPU_TEXTUREFORMAT_R8G8B8A8_INT + SDL_GPU_TEXTUREFORMAT_R16_INT + SDL_GPU_TEXTUREFORMAT_R16G16_INT + SDL_GPU_TEXTUREFORMAT_R16G16B16A16_INT + SDL_GPU_TEXTUREFORMAT_R32_INT + SDL_GPU_TEXTUREFORMAT_R32G32_INT + SDL_GPU_TEXTUREFORMAT_R32G32B32A32_INT + SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB + SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB + SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB + SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB + SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB + SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB + SDL_GPU_TEXTUREFORMAT_D16_UNORM + SDL_GPU_TEXTUREFORMAT_D24_UNORM + SDL_GPU_TEXTUREFORMAT_D32_FLOAT + SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT + SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT + + SDL_GPUTextureUsageFlags + symbols->gpu-texture-usage-flags + gpu-texture-usage-flags->symbols + SDL_GPU_TEXTUREUSAGE_SAMPLER + SDL_GPU_TEXTUREUSAGE_COLOR_TARGET + SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET + SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ + SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ + SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE + SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE + + SDL_GPUTextureType + symbol->gpu-texture-type + gpu-texture-type->symbol + SDL_GPU_TEXTURETYPE_2D + SDL_GPU_TEXTURETYPE_2D_ARRAY + SDL_GPU_TEXTURETYPE_3D + SDL_GPU_TEXTURETYPE_CUBE + SDL_GPU_TEXTURETYPE_CUBE_ARRAY + + SDL_GPUSampleCount + int->gpu-sample-count + gpu-sample-count->int + SDL_GPU_SAMPLECOUNT_1 + SDL_GPU_SAMPLECOUNT_2 + SDL_GPU_SAMPLECOUNT_4 + SDL_GPU_SAMPLECOUNT_8 + + SDL_GPUCubeMapFace + symbol->gpu-cube-map-face + gpu-cube-map-face->symbol + SDL_GPU_CUBEMAPFACE_POSITIVEX + SDL_GPU_CUBEMAPFACE_NEGATIVEX + SDL_GPU_CUBEMAPFACE_POSITIVEY + SDL_GPU_CUBEMAPFACE_NEGATIVEY + SDL_GPU_CUBEMAPFACE_POSITIVEZ + SDL_GPU_CUBEMAPFACE_NEGATIVEZ + + SDL_GPUBufferUsageFlags + symbols->gpu-buffer-usage-flags + gpu-buffer-usage-flags->symbols + SDL_GPU_BUFFERUSAGE_VERTEX + SDL_GPU_BUFFERUSAGE_INDEX + SDL_GPU_BUFFERUSAGE_INDIRECT + SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ + SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ + SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE + + SDL_GPUTransferBufferUsage + symbol->gpu-transfer-buffer-usage + gpu-transfer-buffer-usage->symbol + SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD + SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD + + SDL_GPUShaderStage + symbol->gpu-shader-stage + gpu-shader-stage->symbol + SDL_GPU_SHADERSTAGE_VERTEX + SDL_GPU_SHADERSTAGE_FRAGMENT + + SDL_GPUShaderFormat + symbols->gpu-shader-format + gpu-shader-format->symbols + SDL_GPU_SHADERFORMAT_INVALID + SDL_GPU_SHADERFORMAT_PRIVATE + SDL_GPU_SHADERFORMAT_SPIRV + SDL_GPU_SHADERFORMAT_DXBC + SDL_GPU_SHADERFORMAT_DXIL + SDL_GPU_SHADERFORMAT_MSL + SDL_GPU_SHADERFORMAT_METALLIB + + SDL_GPUVertexElementFormat + symbol->gpu-vertex-element-format + gpu-vertex-element-format->symbol + SDL_GPU_VERTEXELEMENTFORMAT_INVALID + SDL_GPU_VERTEXELEMENTFORMAT_INT + SDL_GPU_VERTEXELEMENTFORMAT_INT2 + SDL_GPU_VERTEXELEMENTFORMAT_INT3 + SDL_GPU_VERTEXELEMENTFORMAT_INT4 + SDL_GPU_VERTEXELEMENTFORMAT_UINT + SDL_GPU_VERTEXELEMENTFORMAT_UINT2 + SDL_GPU_VERTEXELEMENTFORMAT_UINT3 + SDL_GPU_VERTEXELEMENTFORMAT_UINT4 + SDL_GPU_VERTEXELEMENTFORMAT_FLOAT + SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2 + SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3 + SDL_GPU_VERTEXELEMENTFORMAT_FLOAT4 + SDL_GPU_VERTEXELEMENTFORMAT_BYTE2 + SDL_GPU_VERTEXELEMENTFORMAT_BYTE4 + SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2 + SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4 + SDL_GPU_VERTEXELEMENTFORMAT_BYTE2_NORM + SDL_GPU_VERTEXELEMENTFORMAT_BYTE4_NORM + SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM + SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM + SDL_GPU_VERTEXELEMENTFORMAT_SHORT2 + SDL_GPU_VERTEXELEMENTFORMAT_SHORT4 + SDL_GPU_VERTEXELEMENTFORMAT_USHORT2 + SDL_GPU_VERTEXELEMENTFORMAT_USHORT4 + SDL_GPU_VERTEXELEMENTFORMAT_SHORT2_NORM + SDL_GPU_VERTEXELEMENTFORMAT_SHORT4_NORM + SDL_GPU_VERTEXELEMENTFORMAT_USHORT2_NORM + SDL_GPU_VERTEXELEMENTFORMAT_USHORT4_NORM + SDL_GPU_VERTEXELEMENTFORMAT_HALF2 + SDL_GPU_VERTEXELEMENTFORMAT_HALF4 + + SDL_GPUVertexInputRate + symbol->gpu-vertex-input-rate + gpu-vertex-input-rate->symbol + SDL_GPU_VERTEXINPUTRATE_VERTEX + SDL_GPU_VERTEXINPUTRATE_INSTANCE + + SDL_GPUFillMode + symbol->gpu-fill-mode + gpu-fill-mode->symbol + SDL_GPU_FILLMODE_FILL + SDL_GPU_FILLMODE_LINE + + SDL_GPUCullMode + symbol->gpu-cull-mode + gpu-cull-mode->symbol + SDL_GPU_CULLMODE_NONE + SDL_GPU_CULLMODE_FRONT + SDL_GPU_CULLMODE_BACK + + SDL_GPUFrontFace + symbol->gpu-front-face + gpu-front-face->symbol + SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE + SDL_GPU_FRONTFACE_CLOCKWISE + + SDL_GPUCompareOp + symbol->gpu-compare-op + gpu-compare-op->symbol + SDL_GPU_COMPAREOP_INVALID + SDL_GPU_COMPAREOP_NEVER + SDL_GPU_COMPAREOP_LESS + SDL_GPU_COMPAREOP_EQUAL + SDL_GPU_COMPAREOP_LESS_OR_EQUAL + SDL_GPU_COMPAREOP_GREATER + SDL_GPU_COMPAREOP_NOT_EQUAL + SDL_GPU_COMPAREOP_GREATER_OR_EQUAL + SDL_GPU_COMPAREOP_ALWAYS + + SDL_GPUStencilOp + symbol->gpu-stencil-op + gpu-stencil-op->symbol + SDL_GPU_STENCILOP_INVALID + SDL_GPU_STENCILOP_KEEP + SDL_GPU_STENCILOP_ZERO + SDL_GPU_STENCILOP_REPLACE + SDL_GPU_STENCILOP_INCREMENT_AND_CLAMP + SDL_GPU_STENCILOP_DECREMENT_AND_CLAMP + SDL_GPU_STENCILOP_INVERT + SDL_GPU_STENCILOP_INCREMENT_AND_WRAP + SDL_GPU_STENCILOP_DECREMENT_AND_WRAP + + SDL_GPUBlendOp + symbol->gpu-blend-op + gpu-blend-op->symbol + SDL_GPU_BLENDOP_INVALID + SDL_GPU_BLENDOP_ADD + SDL_GPU_BLENDOP_SUBTRACT + SDL_GPU_BLENDOP_REVERSE_SUBTRACT + SDL_GPU_BLENDOP_MIN + SDL_GPU_BLENDOP_MAX + + SDL_GPUBlendFactor + symbol->gpu-blend-factor + gpu-blend-factor->symbol + SDL_GPU_BLENDFACTOR_INVALID + SDL_GPU_BLENDFACTOR_ZERO + SDL_GPU_BLENDFACTOR_ONE + SDL_GPU_BLENDFACTOR_SRC_COLOR + SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR + SDL_GPU_BLENDFACTOR_DST_COLOR + SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR + SDL_GPU_BLENDFACTOR_SRC_ALPHA + SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA + SDL_GPU_BLENDFACTOR_DST_ALPHA + SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA + SDL_GPU_BLENDFACTOR_CONSTANT_COLOR + SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR + SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE + + SDL_GPUColorComponentFlags + symbols->gpu-color-component-flags + gpu-color-component-flags->symbols + SDL_GPU_COLORCOMPONENT_R + SDL_GPU_COLORCOMPONENT_G + SDL_GPU_COLORCOMPONENT_B + SDL_GPU_COLORCOMPONENT_A + + SDL_GPUFilter + symbol->gpu-filter + gpu-filter->symbol + SDL_GPU_FILTER_NEAREST + SDL_GPU_FILTER_LINEAR + + SDL_GPUSamplerMipmapMode + symbol->gpu-sampler-mipmap-mode + gpu-sampler-mipmap-mode->symbol + SDL_GPU_SAMPLERMIPMAPMODE_NEAREST + SDL_GPU_SAMPLERMIPMAPMODE_LINEAR + + SDL_GPUSamplerAddressMode + symbol->gpu-sampler-address-mode + gpu-sampler-address-mode->symbol + SDL_GPU_SAMPLERADDRESSMODE_REPEAT + SDL_GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT + SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE + + SDL_GPUPresentMode + symbol->gpu-present-mode + gpu-present-mode->symbol + SDL_GPU_PRESENTMODE_VSYNC + SDL_GPU_PRESENTMODE_IMMEDIATE + SDL_GPU_PRESENTMODE_MAILBOX + + SDL_GPUSwapchainComposition + symbol->gpu-swapchain-composition + gpu-swapchain-composition->symbol + SDL_GPU_SWAPCHAINCOMPOSITION_SDR + SDL_GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR + SDL_GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR + SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2048 + + SDL_GPUViewport + SDL_GPUTextureTransferInfo + SDL_GPUTransferBufferLocation + SDL_GPUTextureLocation + SDL_GPUTextureRegion + SDL_GPUBlitRegion + SDL_GPUBufferLocation + SDL_GPUBufferRegion + SDL_GPUVertexBufferDescription + SDL_GPUVertexAttribute + SDL_GPUVertexInputState + SDL_GPUStencilOpState + SDL_GPUColorTargetBlendState + SDL_GPUShaderCreateInfo + SDL_GPUTextureCreateInfo + SDL_GPUBufferCreateInfo + SDL_GPUTransferBufferCreateInfo + SDL_GPURasterizerState + SDL_GPUMultisampleState + SDL_GPUDepthStencilState + SDL_GPUColorTargetDescription + SDL_GPUGraphicsPipelineTargetInfo + SDL_GPUGraphicsPipelineCreateInfo + SDL_GPUComputePipelineCreateInfo + SDL_GPUColorTargetInfo + SDL_GPUDepthStencilTargetInfo + SDL_GPUBlitInfo + SDL_GPUBufferBinding + SDL_GPUTextureSamplerBinding + SDL_GPUStorageBufferReadWriteBinding + SDL_GPUStorageTextureReadWriteBinding + + gpu-device? + wrap-gpu-device + unwrap-gpu-device + gpu-device-destroyed? + set-gpu-device-destroyed! + + gpu-buffer? + wrap-gpu-buffer + unwrap-gpu-buffer + gpu-buffer-released? + set-gpu-buffer-released! + + gpu-transfer-buffer? + wrap-gpu-transfer-buffer + unwrap-gpu-transfer-buffer + gpu-transfer-buffer-released? + set-gpu-transfer-buffer-released! + + gpu-shader? + wrap-gpu-shader + unwrap-gpu-shader + gpu-shader-released? + set-gpu-shader-released! + + gpu-texture? + wrap-gpu-texture + unwrap-gpu-texture + gpu-texture-released? + set-gpu-texture-released! + + gpu-graphics-pipeline? + wrap-gpu-graphics-pipeline + unwrap-gpu-graphics-pipeline + gpu-graphics-pipeline-released? + set-gpu-graphics-pipeline-released! + + gpu-command-buffer? + wrap-gpu-command-buffer + unwrap-gpu-command-buffer + + gpu-copy-pass? + wrap-gpu-copy-pass + unwrap-gpu-copy-pass + + gpu-render-pass? + wrap-gpu-render-pass + unwrap-gpu-render-pass + + gpu-compute-pass? + wrap-gpu-compute-pass + unwrap-gpu-compute-pass + + SDL_AcquireGPUCommandBuffer + SDL_AcquireGPUSwapchainTexture + SDL_BeginGPUCopyPass + SDL_BeginGPURenderPass + SDL_BindGPUGraphicsPipeline + SDL_BindGPUVertexBuffers + SDL_BlitGPUTexture + SDL_CreateGPUBuffer + SDL_CreateGPUDevice + SDL_CreateGPUGraphicsPipeline + SDL_CreateGPUShader + SDL_CreateGPUTexture + SDL_CreateGPUTransferBuffer + SDL_ClaimWindowForGPUDevice + SDL_DestroyGPUDevice + SDL_DrawGPUPrimitives + SDL_EndGPUCopyPass + SDL_EndGPURenderPass + SDL_GetGPUDeviceDriver + SDL_GetGPUDriver + SDL_GetGPUSwapchainTextureFormat + SDL_GetNumGPUDrivers + SDL_GPUTextureSupportsSampleCount + SDL_MapGPUTransferBuffer + SDL_PushGPUVertexUniformData + SDL_PushGPUFragmentUniformData + SDL_ReleaseGPUBuffer + SDL_ReleaseGPUGraphicsPipeline + SDL_ReleaseGPUShader + SDL_ReleaseGPUTexture + SDL_ReleaseGPUTransferBuffer + SDL_ReleaseWindowFromGPUDevice + SDL_SetGPUBufferName + SDL_SubmitGPUCommandBuffer + SDL_UnmapGPUTransferBuffer + SDL_UploadToGPUBuffer)) + +(define-bstruct SDL_GPUDevice) +(define-sdl-pointer-type + gpu-device? wrap-gpu-device unwrap-gpu-device + gpu-device-destroyed? set-gpu-device-destroyed! + (lambda (device port) + (display "#" port))) + +(define-bstruct SDL_GPUBuffer) +(define-sdl-pointer-type + gpu-buffer? wrap-gpu-buffer unwrap-gpu-buffer + gpu-buffer-released? set-gpu-buffer-released! + (lambda (buffer port) + (display "#" port))) + +(define-bstruct SDL_GPUTransferBuffer) +(define-sdl-pointer-type + gpu-transfer-buffer? wrap-gpu-transfer-buffer unwrap-gpu-transfer-buffer + gpu-transfer-buffer-released? set-gpu-transfer-buffer-released! + (lambda (transfer-buffer port) + (display "#" port))) + +(define-bstruct SDL_GPUShader) +(define-sdl-pointer-type + gpu-shader? wrap-gpu-shader unwrap-gpu-shader + gpu-shader-released? set-gpu-shader-released! + (lambda (shader port) + (display "#" port))) + +(define-bstruct SDL_GPUTexture) +(define-sdl-pointer-type + gpu-texture? wrap-gpu-texture unwrap-gpu-texture + gpu-texture-released? set-gpu-texture-released! + (lambda (texture port) + (format port "#" + (pointer-address (unwrap-gpu-texture texture))))) + +(define-bstruct SDL_GPUSampler) +(define-sdl-pointer-type + gpu-sampler? wrap-gpu-sampler unwrap-gpu-sampler + gpu-sampler-released? set-gpu-sampler-released! + (lambda (sampler port) + (format port "#" + (pointer-address (unwrap-gpu-sampler sampler))))) + +(define-sdl-pointer-type + gpu-graphics-pipeline? wrap-gpu-graphics-pipeline unwrap-gpu-graphics-pipeline + gpu-graphics-pipeline-released? set-gpu-graphics-pipeline-released! + (lambda (graphics-pipeline port) + (display "#" port))) + +(define-wrapped-pointer-type + gpu-command-buffer? wrap-gpu-command-buffer unwrap-gpu-command-buffer + (lambda (command-buffer port) + (display "#" port))) + +(define-wrapped-pointer-type + gpu-copy-pass? wrap-gpu-copy-pass unwrap-gpu-copy-pass + (lambda (copy-pass port) + (display "#" port))) + +(define-wrapped-pointer-type + gpu-render-pass? wrap-gpu-render-pass unwrap-gpu-render-pass + (lambda (render-pass port) + (display "#" port))) + +(define-wrapped-pointer-type + gpu-compute-pass? wrap-gpu-compute-pass unwrap-gpu-compute-pass + (lambda (compute-pass port) + (display "#" port))) + +(define-enum SDL_GPUPrimitiveType + symbol->gpu-primitive-type + primitive-type->symbol + (triangle-list SDL_GPU_PRIMITIVETYPE_TRIANGLELIST) + (triangle-strip SDL_GPU_PRIMITIVETYPE_TRIANGLESTRIP) + (line-list SDL_GPU_PRIMITIVETYPE_LINELIST) + (line-strip SDL_GPU_PRIMITIVETYPE_LINESTRIP) + (point-list SDL_GPU_PRIMITIVETYPE_POINTLIST)) + +(define-enum SDL_GPULoadOp + symbol->gpu-load-op + gpu-load-op->symbol + (load SDL_GPU_LOADOP_LOAD) + (clear SDL_GPU_LOADOP_CLEAR) + (dont-care SDL_GPU_LOADOP_DONT_CARE)) + +(define-enum SDL_GPUStoreOp + symbol->gpu-store-op + gpu-store-op->symbol + (store SDL_GPU_STOREOP_STORE) + (dont-care SDL_GPU_STOREOP_DONT_CARE) + (resolve SDL_GPU_STOREOP_RESOLVE) + (resolve-and-store SDL_GPU_STOREOP_RESOLVE_AND_STORE)) + +(define-enum SDL_GPUIndexElementSize + symbol->gpu-index-element-size + gpu-index-element-size->symbol + (16-bit SDL_GPU_INDEXELEMENTSIZE_16BIT) + (32-bit SDL_GPU_INDEXELEMENTSIZE_32BIT)) + +(define-enum SDL_GPUTextureFormat + symbol->gpu-texture-format + gpu-texture-format->symbol + (invalid SDL_GPU_TEXTUREFORMAT_INVALID) + (a8-unorm SDL_GPU_TEXTUREFORMAT_A8_UNORM) + (r8-unorm SDL_GPU_TEXTUREFORMAT_R8_UNORM) + (r8g8-unorm SDL_GPU_TEXTUREFORMAT_R8G8_UNORM) + (r8g8b8a8-unorm SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM) + (r16-unorm SDL_GPU_TEXTUREFORMAT_R16_UNORM) + (r16g16-unorm SDL_GPU_TEXTUREFORMAT_R16G16_UNORM) + (r16g16b16a16-unorm SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UNORM) + (r10g10b10a2-unorm SDL_GPU_TEXTUREFORMAT_R10G10B10A2_UNORM) + (b5g6r5-unorm SDL_GPU_TEXTUREFORMAT_B5G6R5_UNORM) + (b5g5r5a1-unorm SDL_GPU_TEXTUREFORMAT_B5G5R5A1_UNORM) + (b4g4r4a4-unorm SDL_GPU_TEXTUREFORMAT_B4G4R4A4_UNORM) + (b8g8r8a8-unorm SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM) + (bc1-rbga-unorm SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM) + (bc2-rgba-unorm SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM) + (bc3-rgba-unorm SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM) + (bc4-r-unorm SDL_GPU_TEXTUREFORMAT_BC4_R_UNORM) + (bc5-rg-unorm SDL_GPU_TEXTUREFORMAT_BC5_RG_UNORM) + (bc7-rgba-unorm SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM) + (bc6h-rgb-float SDL_GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT) + (bc6h-rgb-float SDL_GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT) + (r8-snorm SDL_GPU_TEXTUREFORMAT_R8_SNORM) + (r8g8-snorm SDL_GPU_TEXTUREFORMAT_R8G8_SNORM) + (r8g8b8a8-snorm SDL_GPU_TEXTUREFORMAT_R8G8B8A8_SNORM) + (r16-snorm SDL_GPU_TEXTUREFORMAT_R16_SNORM) + (r16g16-snorm SDL_GPU_TEXTUREFORMAT_R16G16_SNORM) + (r16g16b16a16-snorm SDL_GPU_TEXTUREFORMAT_R16G16B16A16_SNORM) + (r16-float SDL_GPU_TEXTUREFORMAT_R16_FLOAT) + (r16g16-float SDL_GPU_TEXTUREFORMAT_R16G16_FLOAT) + (r16g16b16a16-float SDL_GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT) + (r32-float SDL_GPU_TEXTUREFORMAT_R32_FLOAT) + (r32g32-float SDL_GPU_TEXTUREFORMAT_R32G32_FLOAT) + (r32g32b32a32-float SDL_GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT) + (r11g11b10-ufloat SDL_GPU_TEXTUREFORMAT_R11G11B10_UFLOAT) + (r8-uint SDL_GPU_TEXTUREFORMAT_R8_UINT) + (r8g8-uint SDL_GPU_TEXTUREFORMAT_R8G8_UINT) + (r8g8b8a8-uint SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UINT) + (r16-uint SDL_GPU_TEXTUREFORMAT_R16_UINT) + (r16g16-uint SDL_GPU_TEXTUREFORMAT_R16G16_UINT) + (r16g16b16a16-uint SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UINT) + (r32-uint SDL_GPU_TEXTUREFORMAT_R32_UINT) + (r32g32-uint SDL_GPU_TEXTUREFORMAT_R32G32_UINT) + (r32g32b32a32-uint SDL_GPU_TEXTUREFORMAT_R32G32B32A32_UINT) + (r8-int SDL_GPU_TEXTUREFORMAT_R8_INT) + (r8g8-int SDL_GPU_TEXTUREFORMAT_R8G8_INT) + (r8g8b8a8-int SDL_GPU_TEXTUREFORMAT_R8G8B8A8_INT) + (r16-int SDL_GPU_TEXTUREFORMAT_R16_INT) + (r16g16-int SDL_GPU_TEXTUREFORMAT_R16G16_INT) + (r16g16b16a16-int SDL_GPU_TEXTUREFORMAT_R16G16B16A16_INT) + (r32-int SDL_GPU_TEXTUREFORMAT_R32_INT) + (r32g32-int SDL_GPU_TEXTUREFORMAT_R32G32_INT) + (r32g32b32a32-int SDL_GPU_TEXTUREFORMAT_R32G32B32A32_INT) + (r8g8b8a8-unorm-srgb SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB) + (b8g8r8a8-unorm-srgb SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB) + (bc1-unorm-srgb SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB) + (bc2-unorm-srgb SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB) + (bc3-unorm-srgb SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB) + (bc7-unorm-srgb SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB) + (d16-unorm SDL_GPU_TEXTUREFORMAT_D16_UNORM) + (d24-unorm SDL_GPU_TEXTUREFORMAT_D24_UNORM) + (d32-float SDL_GPU_TEXTUREFORMAT_D32_FLOAT) + (d24-unorm-s8-uint SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT) + (d32-float-s8-uint SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT)) + +(define-bitmask (SDL_GPUTextureUsageFlags uint32) + symbols->gpu-texture-usage-flags + gpu-texture-usage-flags->symbols + (sampler SDL_GPU_TEXTUREUSAGE_SAMPLER) + (color-target SDL_GPU_TEXTUREUSAGE_COLOR_TARGET) + (depth-stencil-target SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET) + (graphics-storage-read SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ) + (compute-storage-read SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ) + (compute-storage-write SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE) + (compute-storage-simultaneous-read-write + SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE)) + +(define-enum SDL_GPUTextureType + symbol->gpu-texture-type + gpu-texture-type->symbol + (2d SDL_GPU_TEXTURETYPE_2D) + (2d-array SDL_GPU_TEXTURETYPE_2D_ARRAY) + (3d SDL_GPU_TEXTURETYPE_3D) + (cube SDL_GPU_TEXTURETYPE_CUBE) + (cube-array SDL_GPU_TEXTURETYPE_CUBE_ARRAY)) + +(define-enum SDL_GPUSampleCount + int->gpu-sample-count + gpu-sample-count->int + (1 SDL_GPU_SAMPLECOUNT_1) + (2 SDL_GPU_SAMPLECOUNT_2) + (4 SDL_GPU_SAMPLECOUNT_4) + (8 SDL_GPU_SAMPLECOUNT_8)) + +(define-enum SDL_GPUCubeMapFace + symbol->gpu-cube-map-face + gpu-cube-map-face->symbol + (positive-x SDL_GPU_CUBEMAPFACE_POSITIVEX) + (negative-x SDL_GPU_CUBEMAPFACE_NEGATIVEX) + (positive-y SDL_GPU_CUBEMAPFACE_POSITIVEY) + (negative-y SDL_GPU_CUBEMAPFACE_NEGATIVEY) + (positive-z SDL_GPU_CUBEMAPFACE_POSITIVEZ) + (negative-z SDL_GPU_CUBEMAPFACE_NEGATIVEZ)) + +(define-bitmask (SDL_GPUBufferUsageFlags uint32) + symbols->gpu-buffer-usage-flags + gpu-buffer-usage-flags->symbols + (vertex SDL_GPU_BUFFERUSAGE_VERTEX) + (index SDL_GPU_BUFFERUSAGE_INDEX) + (indirect SDL_GPU_BUFFERUSAGE_INDIRECT) + (graphics-storage-read SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ) + (compute-storage-read SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ) + (compute-storage-write SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE)) + +(define-enum SDL_GPUTransferBufferUsage + symbol->gpu-transfer-buffer-usage + gpu-transfer-buffer-usage->symbol + (upload SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD) + (download SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD)) + +(define-enum SDL_GPUShaderStage + symbol->gpu-shader-stage + gpu-shader-stage->symbol + (vertex SDL_GPU_SHADERSTAGE_VERTEX) + (fragment SDL_GPU_SHADERSTAGE_FRAGMENT)) + +(define-bitmask (SDL_GPUShaderFormat uint32) + symbols->gpu-shader-format + gpu-shader-format->symbols + (private SDL_GPU_SHADERFORMAT_PRIVATE) + (spirv SDL_GPU_SHADERFORMAT_SPIRV) + (dxbc SDL_GPU_SHADERFORMAT_DXBC) + (dxil SDL_GPU_SHADERFORMAT_DXIL) + (msl SDL_GPU_SHADERFORMAT_MSL) + (metallib SDL_GPU_SHADERFORMAT_METALLIB)) +(define SDL_GPU_SHADERFORMAT_INVALID 0) + +(define-enum SDL_GPUVertexElementFormat + symbol->gpu-vertex-element-format + gpu-vertex-element-format->symbol + (invalid SDL_GPU_VERTEXELEMENTFORMAT_INVALID) + (int SDL_GPU_VERTEXELEMENTFORMAT_INT) + (int2 SDL_GPU_VERTEXELEMENTFORMAT_INT2) + (int3 SDL_GPU_VERTEXELEMENTFORMAT_INT3) + (int4 SDL_GPU_VERTEXELEMENTFORMAT_INT4) + (uint SDL_GPU_VERTEXELEMENTFORMAT_UINT) + (uint2 SDL_GPU_VERTEXELEMENTFORMAT_UINT2) + (uint3 SDL_GPU_VERTEXELEMENTFORMAT_UINT3) + (uint4 SDL_GPU_VERTEXELEMENTFORMAT_UINT4) + (float SDL_GPU_VERTEXELEMENTFORMAT_FLOAT) + (float2 SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2) + (float3 SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3) + (float4 SDL_GPU_VERTEXELEMENTFORMAT_FLOAT4) + (byte2 SDL_GPU_VERTEXELEMENTFORMAT_BYTE2) + (byte4 SDL_GPU_VERTEXELEMENTFORMAT_BYTE4) + (ubyte2 SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2) + (ubyte4 SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4) + (byte2-norm SDL_GPU_VERTEXELEMENTFORMAT_BYTE2_NORM) + (byte4-norm SDL_GPU_VERTEXELEMENTFORMAT_BYTE4_NORM) + (ubyte2-norm SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM) + (ubyte4-norm SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM) + (short2 SDL_GPU_VERTEXELEMENTFORMAT_SHORT2) + (short4 SDL_GPU_VERTEXELEMENTFORMAT_SHORT4) + (ushort2 SDL_GPU_VERTEXELEMENTFORMAT_USHORT2) + (ushort4 SDL_GPU_VERTEXELEMENTFORMAT_USHORT4) + (short2-norm SDL_GPU_VERTEXELEMENTFORMAT_SHORT2_NORM) + (short4-norm SDL_GPU_VERTEXELEMENTFORMAT_SHORT4_NORM) + (ushort2-norm SDL_GPU_VERTEXELEMENTFORMAT_USHORT2_NORM) + (ushort4-norm SDL_GPU_VERTEXELEMENTFORMAT_USHORT4_NORM) + (half2 SDL_GPU_VERTEXELEMENTFORMAT_HALF2) + (half4 SDL_GPU_VERTEXELEMENTFORMAT_HALF4)) + +(define-enum SDL_GPUVertexInputRate + symbol->gpu-vertex-input-rate + gpu-vertex-input-rate->symbol + (vertex SDL_GPU_VERTEXINPUTRATE_VERTEX) + (instance SDL_GPU_VERTEXINPUTRATE_INSTANCE)) + +(define-enum SDL_GPUFillMode + symbol->gpu-fill-mode + gpu-fill-mode->symbol + (fill SDL_GPU_FILLMODE_FILL) + (line SDL_GPU_FILLMODE_LINE)) + +(define-enum SDL_GPUCullMode + symbol->gpu-cull-mode + gpu-cull-mode->symbol + (none SDL_GPU_CULLMODE_NONE) + (front SDL_GPU_CULLMODE_FRONT) + (back SDL_GPU_CULLMODE_BACK)) + +(define-enum SDL_GPUFrontFace + symbol->gpu-front-face + gpu-front-face->symbol + (counter-clockwise SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE) + (clockwise SDL_GPU_FRONTFACE_CLOCKWISE)) + +(define-enum SDL_GPUCompareOp + symbol->gpu-compare-op + gpu-compare-op->symbol + (invalid SDL_GPU_COMPAREOP_INVALID) + (never SDL_GPU_COMPAREOP_NEVER) + (less SDL_GPU_COMPAREOP_LESS) + (equal SDL_GPU_COMPAREOP_EQUAL) + (less-or-equal SDL_GPU_COMPAREOP_LESS_OR_EQUAL) + (greater SDL_GPU_COMPAREOP_GREATER) + (not-equal SDL_GPU_COMPAREOP_NOT_EQUAL) + (greater-or-equal SDL_GPU_COMPAREOP_GREATER_OR_EQUAL) + (always SDL_GPU_COMPAREOP_ALWAYS)) + +(define-enum SDL_GPUStencilOp + symbol->gpu-stencil-op + gpu-stencil-op->symbol + (invalid SDL_GPU_STENCILOP_INVALID) + (keep SDL_GPU_STENCILOP_KEEP) + (zero SDL_GPU_STENCILOP_ZERO) + (replace SDL_GPU_STENCILOP_REPLACE) + (increment-and-clamp SDL_GPU_STENCILOP_INCREMENT_AND_CLAMP) + (decrement-and-clamp SDL_GPU_STENCILOP_DECREMENT_AND_CLAMP) + (invert SDL_GPU_STENCILOP_INVERT) + (increment-and-wrap SDL_GPU_STENCILOP_INCREMENT_AND_WRAP) + (decrement-and-wrap SDL_GPU_STENCILOP_DECREMENT_AND_WRAP)) + +(define-enum SDL_GPUBlendOp + symbol->gpu-blend-op + gpu-blend-op->symbol + (invalid SDL_GPU_BLENDOP_INVALID) + (add SDL_GPU_BLENDOP_ADD) + (subtract SDL_GPU_BLENDOP_SUBTRACT) + (reverse-subtract SDL_GPU_BLENDOP_REVERSE_SUBTRACT) + (min SDL_GPU_BLENDOP_MIN) + (max SDL_GPU_BLENDOP_MAX)) + +(define-enum SDL_GPUBlendFactor + symbol->gpu-blend-factor + gpu-blend-factor->symbol + (invalid SDL_GPU_BLENDFACTOR_INVALID) + (zero SDL_GPU_BLENDFACTOR_ZERO) + (one SDL_GPU_BLENDFACTOR_ONE) + (src-color SDL_GPU_BLENDFACTOR_SRC_COLOR) + (one-minus-src-color SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR) + (dst-color SDL_GPU_BLENDFACTOR_DST_COLOR) + (one-minus-dst-color SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR) + (src-alpha SDL_GPU_BLENDFACTOR_SRC_ALPHA) + (one-minus-src-alpha SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA) + (dst-alpha SDL_GPU_BLENDFACTOR_DST_ALPHA) + (one-minus-dst-alpha SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA) + (constant-color SDL_GPU_BLENDFACTOR_CONSTANT_COLOR) + (one-minus-constant-color SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR) + (alpha-saturate SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE)) + +(define-bitmask (SDL_GPUColorComponentFlags uint8) + symbols->gpu-color-component-flags + gpu-color-component-flags->symbols + (r SDL_GPU_COLORCOMPONENT_R) + (g SDL_GPU_COLORCOMPONENT_G) + (b SDL_GPU_COLORCOMPONENT_B) + (a SDL_GPU_COLORCOMPONENT_A)) + +(define-enum SDL_GPUFilter + symbol->gpu-filter + gpu-filter->symbol + (nearest SDL_GPU_FILTER_NEAREST) + (linear SDL_GPU_FILTER_LINEAR)) + +(define-enum SDL_GPUSamplerMipmapMode + symbol->gpu-sampler-mipmap-mode + gpu-sampler-mipmap-mode->symbol + (nearest SDL_GPU_SAMPLERMIPMAPMODE_NEAREST) + (linear SDL_GPU_SAMPLERMIPMAPMODE_LINEAR)) + +(define-enum SDL_GPUSamplerAddressMode + symbol->gpu-sampler-address-mode + gpu-sampler-address-mode->symbol + (repease SDL_GPU_SAMPLERADDRESSMODE_REPEAT) + (mirrored-repeat SDL_GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT) + (clamp-to-edge SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE)) + +(define-enum SDL_GPUPresentMode + symbol->gpu-present-mode + gpu-present-mode->symbol + (vsync SDL_GPU_PRESENTMODE_VSYNC) + (immediate SDL_GPU_PRESENTMODE_IMMEDIATE) + (mailbox SDL_GPU_PRESENTMODE_MAILBOX)) + +(define-enum SDL_GPUSwapchainComposition + symbol->gpu-swapchain-composition + gpu-swapchain-composition->symbol + (sdr SDL_GPU_SWAPCHAINCOMPOSITION_SDR) + (sdr-linear SDL_GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR) + (hdr-extended-linear SDL_GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR) + (hdr10-st2048 SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2048)) + +(define-bstruct SDL_GPUViewport + (struct + (x float) + (y float) + (w float) + (h float) + (min_depth float) + (max_depth float))) + +(define-bstruct SDL_GPUTextureTransferInfo + (struct + (transfer_buffer (* SDL_GPUTransferBuffer)) + (offset uint32) + (pixels_per_row uint32) + (rows_per_layer uint32))) + +(define-bstruct SDL_GPUTransferBufferLocation + (struct + (transfer_buffer (* SDL_GPUTransferBuffer)) + (offset uint32))) + +(define-bstruct SDL_GPUTextureLocation + (struct + (texture (* SDL_GPUTexture)) + (mip_level uint32) + (layer uint32) + (x uint32) + (y uint32) + (z uint32))) + +(define-bstruct SDL_GPUTextureRegion + (struct + (texture (* SDL_GPUTexture)) + (mip_level uint32) + (layer uint32) + (x uint32) + (y uint32) + (z uint32) + (w uint32) + (h uint32) + (d uint32))) + +(define-bstruct SDL_GPUBlitRegion + (struct + (texture (* SDL_GPUTexture)) + (mip_level uint32) + (layer_or_depth_plane uint32) + (x uint32) + (y uint32) + (w uint32) + (h uint32))) + +(define-bstruct SDL_GPUBufferLocation + (struct + (buffer (* SDL_GPUBuffer)) + (offset uint32))) + +(define-bstruct SDL_GPUBufferRegion + (struct + (buffer (* SDL_GPUBuffer)) + (offset uint32) + (size uint32))) + +(define-bstruct SDL_GPUVertexBufferDescription + (struct + (slot uint32) + (pitch uint32) + (input_rate int) ; SDL_GPUVertexInputRate + (instance_step_rate uint32))) + +(define-bstruct SDL_GPUVertexAttribute + (struct + (location uint32) + (buffer_slot uint32) + (format int) ; SDL_GPUVertexElementFormat + (offset uint32))) + +(define-bstruct SDL_GPUVertexInputState + (struct + (vertex_buffer_descriptions (* SDL_GPUVertexBufferDescription)) + (num_vertex_buffers uint32) + (vertex_attributes (* SDL_GPUVertexAttribute)) + (num_vertex_attributes uint32))) + +(define-bstruct SDL_GPUStencilOpState + (struct + (fail_op int) ; SDL_GPUStencilOp + (pass_op int) ; SDL_GPUStencilOp + (depth_fail_op int) ; SDL_GPUStencilOp + (compare_op int) ; SDL_GPUCompareOp + )) + +(define-bstruct SDL_GPUColorTargetBlendState + (struct + (src_color_blendfactor int) ; SDL_GPUBlendFactor + (dst_color_blendfactor int) ; SDL_GPUBlendFactor + (color_blend_op int) ; SDL_GPUBlendOp + (src_alpha_blendfactor int) ; SDL_GPUBlendFactor + (dst_alpha_blendfactor int) ; SDL_GPUBlendFactor + (alpha_blend_op int) ; SDL_GPUBlendOp + (color_write_mask uint8) ; SDL_GPUColorComponentFlags + (enable_blend uint8) ; bool + (enable_color_write_mask uint8) ; bool + (_ uint8) + (_ uint8))) + +(define-bstruct SDL_GPUShaderCreateInfo + (struct + (code_size size_t) + (code (* uint8)) + (entrypoint (* uint8)) ; char* + (format uint32) ; SDL_GPUShaderFormat + (stage int) ; SDL_GPUShaderStage + (num_samplers uint32) + (num_storage_textures uint32) + (num_storage_buffers uint32) + (num_uniform_buffers uint32) + (props uint32) ; SDL_PropertiesID + )) + +(define-bstruct SDL_GPUTextureCreateInfo + (struct + (type int) ; SDL_GPUTextureType + (format int) ; SDL_GPUTextureFormat + (usage uint32) ; SDL_GPUTextureUsageFlags + (width uint32) + (height uint32) + (layer_count_or_depth uint32) + (num_levels uint32) + (sample_count int) ; SDL_GPUSampleCount + (props uint32) ; SDL_PropertiesID + )) + +(define-bstruct SDL_GPUBufferCreateInfo + (struct + (usage uint32) ; SDL_GPUBufferUsageFlags + (size uint32) + (props uint32) ; SDL_PropertiesID + )) + +(define-bstruct SDL_GPUTransferBufferCreateInfo + (struct + (usage uint32) ; SDL_GPUTransferBufferUsage + (size uint32) + (props uint32) ; SDL_PropertiesID + )) + +(define-bstruct SDL_GPURasterizerState + (struct + (fill_mode int) ; SDL_GPUFillMode + (cull_mode int) ; SDL_GPUCullMode + (front_face int) ; SDL_GPUFrontFace + (depth_bias_constant_factor float) + (depth_bias_clamp float) + (depth_bias_slope_factor float) + (enable_depth_bias uint8) ; bool + (enable_depth_clip uint8) ; bool + (_ uint8) + (_ uint8))) + +(define-bstruct SDL_GPUMultisampleState + (struct + (sample_count int) ; SDL_GPUSampleCount + (sample_mask uint32) + (enable_mask uint8) ; bool + (_ uint8) + (_ uint8) + (_ uint8))) + +(define-bstruct SDL_GPUDepthStencilState + (struct + (compare_op uint32) ; SDL_GPUCompareOp + (back_stencil_state SDL_GPUStencilOpState) + (front_stencil_state SDL_GPUStencilOpState) + (compare_mask uint8) + (write_mask uint8) + (enable_depth_test uint8) ; bool + (enable_depth_write uint8) ; bool + (enable_stencil_test uint8) ; bool + (_ uint8) + (_ uint8) + (_ uint8))) + +(define-bstruct SDL_GPUColorTargetDescription + (struct + (format uint32) ; SDL_GPUTextureFormat + (blend_state SDL_GPUColorTargetBlendState))) + +(define-bstruct SDL_GPUGraphicsPipelineTargetInfo + (struct + (color_target_descriptions (* SDL_GPUColorTargetDescription)) + (num_color_targets uint32) + (depth_stencil_format uint32) ; SDL_GPUTextureFormat + (has_depth_stencil_target uint8) ; bool + (_ uint8) + (_ uint8) + (_ uint8))) + +(define-bstruct SDL_GPUGraphicsPipelineCreateInfo + (struct + (vertex_shader (* SDL_GPUShader)) + (fragment_shader (* SDL_GPUShader)) + (vertex_input_state SDL_GPUVertexInputState) + (primitive_type int) ; SDL_GPUPrimitiveType + (rasterizer_state SDL_GPURasterizerState) + (multisample_state SDL_GPUMultisampleState) + (depth_stencil_state SDL_GPUDepthStencilState) + (target_info SDL_GPUGraphicsPipelineTargetInfo) + (props uint32) ; SDL_PropertiesID + )) + +(define-bstruct SDL_GPUComputePipelineCreateInfo + (struct + (code_size size_t) + (code (* uint8)) + (entrypoint (* uint8)) ; char + (format int) ; SDL_GPUShaderFormat + (num_samplers uint32) + (num_readonly_storage_textures uint32) + (num_readonly_storage_buffers uint32) + (num_readwrite_storage_textures uint32) + (num_readwrite_storage_buffers uint32) + (num_uniform_buffers uint32) + (threadcount_x uint32) + (threadcount_y uint32) + (threadcount_z uint32) + (props uint32) ; SDL_PropertiesID + )) + +(define-bstruct SDL_GPUColorTargetInfo + (struct + (texture (* SDL_GPUTexture)) + (mip_level uint32) + (layer_or_depth_plane uint32) + (clear_color SDL_FColor) + (load_op int) ; SDL_GPULoadOp + (store_op int) ; SDL_GPUStoreOp + (resolve_texture (* SDL_GPUTexture)) + (resolve_mip_level uint32) + (resolve_layer uint32) + (cycle uint8) ; bool + (cycle_resolve_texture uint8) ; bool + (_ uint8) + (_ uint8))) + +(define-bstruct SDL_GPUDepthStencilTargetInfo + (struct + (texture (* SDL_GPUTexture)) + (clear_depth float) + (load_op int) ; SDL_GPULoadOp + (store_op int) ; SDL_GPUStoreOp + (stencil_load_op int) ; SDL_GPULoadOp + (stencil_store_op int) ; SDL_GPUStoreOp + (cycle uint8) ; bool + (clear_stencil uint8) + (_ uint8) + (_ uint8))) + +(define-bstruct SDL_GPUBlitInfo + (struct + (source SDL_GPUBlitRegion) + (destination SDL_GPUBlitRegion) + (load_op int) ; SDL_GPULoadOp + (clear_color SDL_FColor) + (flip_mode int) ; SDL_FlipMode + (filter int) ; SDL_GPUFilter + (cycle uint8) ; bool + (_ uint8) + (_ uint8) + (_ uint8))) + +(define-bstruct SDL_GPUBufferBinding + (struct + (buffer (* SDL_GPUBuffer)) + (offset uint32))) + +(define-bstruct SDL_GPUTextureSamplerBinding + (struct + (texture (* SDL_GPUTexture)) + (sampler (* SDL_GPUSampler)))) + +(define-bstruct SDL_GPUStorageBufferReadWriteBinding + (struct + (buffer (* SDL_GPUBuffer)) + (cycle uint8) ; bool + (_ uint8) + (_ uint8) + (_ uint8))) + +(define-bstruct SDL_GPUStorageTextureReadWriteBinding + (struct + (texture (* SDL_GPUTexture)) + (mip_level uint32) + (layer uint32) + (cycle uint8) + (_ uint8) + (_ uint8) + (_ uint8))) + +(define-sdl SDL_AcquireGPUCommandBuffer '* -> '*) +(define-sdl SDL_AcquireGPUSwapchainTexture '* '* '* '* '* -> bool) +(define-sdl SDL_BeginGPUCopyPass '* -> '*) +(define-sdl SDL_BeginGPURenderPass '* '* uint32 '* -> '*) +(define-sdl SDL_BindGPUGraphicsPipeline '* '*) +(define-sdl SDL_BindGPUVertexBuffers '* uint32 '* uint32) +(define-sdl SDL_BlitGPUTexture '* '*) +(define-sdl SDL_CreateGPUBuffer '* '* -> '*) +(define-sdl SDL_CreateGPUDevice SDL_GPUShaderFormat bool '* -> '*) +(define-sdl SDL_CreateGPUGraphicsPipeline '* '* -> '*) +(define-sdl SDL_CreateGPUShader '* '* -> '*) +(define-sdl SDL_CreateGPUTexture '* '* -> '*) +(define-sdl SDL_CreateGPUTransferBuffer '* '* -> '*) +(define-sdl SDL_ClaimWindowForGPUDevice '* '* -> bool) +(define-sdl SDL_DestroyGPUDevice '*) +(define-sdl SDL_DrawGPUPrimitives '* uint32 uint32 uint32 uint32) +(define-sdl SDL_EndGPUCopyPass '*) +(define-sdl SDL_EndGPURenderPass '*) +(define-sdl SDL_GetGPUDeviceDriver '* -> '*) +(define-sdl SDL_GetGPUDriver int -> '*) +(define-sdl SDL_GetGPUSwapchainTextureFormat '* '* -> SDL_GPUTextureFormat) +(define-sdl SDL_GetNumGPUDrivers -> int) +(define-sdl SDL_GPUTextureSupportsSampleCount '* SDL_GPUTextureFormat SDL_GPUSampleCount -> bool) +(define-sdl SDL_MapGPUTransferBuffer '* '* bool -> '*) +(define-sdl SDL_PushGPUFragmentUniformData '* uint32 '* uint32) +(define-sdl SDL_PushGPUVertexUniformData '* uint32 '* uint32) +(define-sdl SDL_ReleaseGPUBuffer '* '*) +(define-sdl SDL_ReleaseGPUGraphicsPipeline '* '*) +(define-sdl SDL_ReleaseGPUShader '* '*) +(define-sdl SDL_ReleaseGPUTexture '* '*) +(define-sdl SDL_ReleaseGPUTransferBuffer '* '*) +(define-sdl SDL_ReleaseWindowFromGPUDevice '* '*) +(define-sdl SDL_SetGPUBufferName '* '* '*) +(define-sdl SDL_SubmitGPUCommandBuffer '* -> bool) +(define-sdl SDL_UnmapGPUTransferBuffer '* '*) +(define-sdl SDL_UploadToGPUBuffer '* '* '* bool) -- cgit v1.2.3