pub const c = @import("c.zig").c; pub const FColor = extern struct { r: f32, g: f32, b: f32, a: f32, }; pub const PropertiesID = u32; pub const Window = opaque {}; pub const Rect = extern struct { x: c_int, y: c_int, w: c_int, h: c_int, }; pub const GPUDevice = opaque { pub inline fn destroyGPUDevice(gpudevice: *GPUDevice) void { return c.SDL_DestroyGPUDevice(gpudevice); } pub inline fn getGPUDeviceDriver(gpudevice: *GPUDevice) [*c]const u8 { return c.SDL_GetGPUDeviceDriver(gpudevice); } pub inline fn getGPUShaderFormats(gpudevice: *GPUDevice) GPUShaderFormat { return @bitCast(c.SDL_GetGPUShaderFormats(gpudevice)); } pub inline fn createGPUComputePipeline(gpudevice: *GPUDevice, createinfo: *const GPUComputePipelineCreateInfo) ?*GPUComputePipeline { return c.SDL_CreateGPUComputePipeline(gpudevice, @ptrCast(createinfo)); } pub inline fn createGPUGraphicsPipeline(gpudevice: *GPUDevice, createinfo: *const GPUGraphicsPipelineCreateInfo) ?*GPUGraphicsPipeline { return c.SDL_CreateGPUGraphicsPipeline(gpudevice, @ptrCast(createinfo)); } pub inline fn createGPUSampler(gpudevice: *GPUDevice, createinfo: *const GPUSamplerCreateInfo) ?*GPUSampler { return c.SDL_CreateGPUSampler(gpudevice, @ptrCast(createinfo)); } pub inline fn createGPUShader(gpudevice: *GPUDevice, createinfo: *const GPUShaderCreateInfo) ?*GPUShader { return c.SDL_CreateGPUShader(gpudevice, @ptrCast(createinfo)); } pub inline fn createGPUTexture(gpudevice: *GPUDevice, createinfo: *const GPUTextureCreateInfo) ?*GPUTexture { return c.SDL_CreateGPUTexture(gpudevice, @ptrCast(createinfo)); } pub inline fn createGPUBuffer(gpudevice: *GPUDevice, createinfo: *const GPUBufferCreateInfo) ?*GPUBuffer { return c.SDL_CreateGPUBuffer(gpudevice, @ptrCast(createinfo)); } pub inline fn createGPUTransferBuffer(gpudevice: *GPUDevice, createinfo: *const GPUTransferBufferCreateInfo) ?*GPUTransferBuffer { return c.SDL_CreateGPUTransferBuffer(gpudevice, @ptrCast(createinfo)); } pub inline fn setGPUBufferName(gpudevice: *GPUDevice, buffer: ?*GPUBuffer, text: [*c]const u8) void { return c.SDL_SetGPUBufferName(gpudevice, buffer, text); } pub inline fn setGPUTextureName(gpudevice: *GPUDevice, texture: ?*GPUTexture, text: [*c]const u8) void { return c.SDL_SetGPUTextureName(gpudevice, texture, text); } pub inline fn releaseGPUTexture(gpudevice: *GPUDevice, texture: ?*GPUTexture) void { return c.SDL_ReleaseGPUTexture(gpudevice, texture); } pub inline fn releaseGPUSampler(gpudevice: *GPUDevice, sampler: ?*GPUSampler) void { return c.SDL_ReleaseGPUSampler(gpudevice, sampler); } pub inline fn releaseGPUBuffer(gpudevice: *GPUDevice, buffer: ?*GPUBuffer) void { return c.SDL_ReleaseGPUBuffer(gpudevice, buffer); } pub inline fn releaseGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer) void { return c.SDL_ReleaseGPUTransferBuffer(gpudevice, transfer_buffer); } pub inline fn releaseGPUComputePipeline(gpudevice: *GPUDevice, compute_pipeline: ?*GPUComputePipeline) void { return c.SDL_ReleaseGPUComputePipeline(gpudevice, compute_pipeline); } pub inline fn releaseGPUShader(gpudevice: *GPUDevice, shader: ?*GPUShader) void { return c.SDL_ReleaseGPUShader(gpudevice, shader); } pub inline fn releaseGPUGraphicsPipeline(gpudevice: *GPUDevice, graphics_pipeline: ?*GPUGraphicsPipeline) void { return c.SDL_ReleaseGPUGraphicsPipeline(gpudevice, graphics_pipeline); } pub inline fn acquireGPUCommandBuffer(gpudevice: *GPUDevice) ?*GPUCommandBuffer { return c.SDL_AcquireGPUCommandBuffer(gpudevice); } pub inline fn mapGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer, cycle: bool) ?*anyopaque { return c.SDL_MapGPUTransferBuffer(gpudevice, transfer_buffer, cycle); } pub inline fn unmapGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer) void { return c.SDL_UnmapGPUTransferBuffer(gpudevice, transfer_buffer); } pub inline fn windowSupportsGPUSwapchainComposition(gpudevice: *GPUDevice, window: ?*Window, swapchain_composition: GPUSwapchainComposition) bool { return c.SDL_WindowSupportsGPUSwapchainComposition(gpudevice, window, swapchain_composition); } pub inline fn windowSupportsGPUPresentMode(gpudevice: *GPUDevice, window: ?*Window, present_mode: GPUPresentMode) bool { return c.SDL_WindowSupportsGPUPresentMode(gpudevice, window, @intFromEnum(present_mode)); } pub inline fn claimWindowForGPUDevice(gpudevice: *GPUDevice, window: ?*Window) bool { return c.SDL_ClaimWindowForGPUDevice(gpudevice, window); } pub inline fn releaseWindowFromGPUDevice(gpudevice: *GPUDevice, window: ?*Window) void { return c.SDL_ReleaseWindowFromGPUDevice(gpudevice, window); } pub inline fn setGPUSwapchainParameters( gpudevice: *GPUDevice, window: ?*Window, swapchain_composition: GPUSwapchainComposition, present_mode: GPUPresentMode, ) bool { return c.SDL_SetGPUSwapchainParameters(gpudevice, window, swapchain_composition, @intFromEnum(present_mode)); } pub inline fn setGPUAllowedFramesInFlight(gpudevice: *GPUDevice, allowed_frames_in_flight: u32) bool { return c.SDL_SetGPUAllowedFramesInFlight(gpudevice, allowed_frames_in_flight); } pub inline fn getGPUSwapchainTextureFormat(gpudevice: *GPUDevice, window: ?*Window) GPUTextureFormat { return @bitCast(c.SDL_GetGPUSwapchainTextureFormat(gpudevice, window)); } pub inline fn waitForGPUSwapchain(gpudevice: *GPUDevice, window: ?*Window) bool { return c.SDL_WaitForGPUSwapchain(gpudevice, window); } pub inline fn waitForGPUIdle(gpudevice: *GPUDevice) bool { return c.SDL_WaitForGPUIdle(gpudevice); } pub inline fn waitForGPUFences( gpudevice: *GPUDevice, wait_all: bool, fences: [*c]*const GPUFence, num_fences: u32, ) bool { return c.SDL_WaitForGPUFences(gpudevice, wait_all, fences, num_fences); } pub inline fn queryGPUFence(gpudevice: *GPUDevice, fence: ?*GPUFence) bool { return c.SDL_QueryGPUFence(gpudevice, fence); } pub inline fn releaseGPUFence(gpudevice: *GPUDevice, fence: ?*GPUFence) void { return c.SDL_ReleaseGPUFence(gpudevice, fence); } pub inline fn gpuTextureSupportsFormat( gpudevice: *GPUDevice, format: GPUTextureFormat, type: GPUTextureType, usage: GPUTextureUsageFlags, ) bool { return c.SDL_GPUTextureSupportsFormat(gpudevice, @bitCast(format), @intFromEnum(type), @bitCast(usage)); } pub inline fn gpuTextureSupportsSampleCount(gpudevice: *GPUDevice, format: GPUTextureFormat, sample_count: GPUSampleCount) bool { return c.SDL_GPUTextureSupportsSampleCount(gpudevice, @bitCast(format), sample_count); } pub inline fn gdkSuspendGPU(gpudevice: *GPUDevice) void { return c.SDL_GDKSuspendGPU(gpudevice); } pub inline fn gdkResumeGPU(gpudevice: *GPUDevice) void { return c.SDL_GDKResumeGPU(gpudevice); } }; pub const GPUBuffer = opaque {}; pub const GPUTransferBuffer = opaque {}; pub const GPUTexture = opaque {}; pub const GPUSampler = opaque {}; pub const GPUShader = opaque {}; pub const GPUComputePipeline = opaque {}; pub const GPUGraphicsPipeline = opaque {}; pub const GPUCommandBuffer = opaque { pub inline fn insertGPUDebugLabel(gpucommandbuffer: *GPUCommandBuffer, text: [*c]const u8) void { return c.SDL_InsertGPUDebugLabel(gpucommandbuffer, text); } pub inline fn pushGPUDebugGroup(gpucommandbuffer: *GPUCommandBuffer, name: [*c]const u8) void { return c.SDL_PushGPUDebugGroup(gpucommandbuffer, name); } pub inline fn popGPUDebugGroup(gpucommandbuffer: *GPUCommandBuffer) void { return c.SDL_PopGPUDebugGroup(gpucommandbuffer); } pub inline fn pushGPUVertexUniformData( gpucommandbuffer: *GPUCommandBuffer, slot_index: u32, data: ?*const anyopaque, length: u32, ) void { return c.SDL_PushGPUVertexUniformData(gpucommandbuffer, slot_index, data, length); } pub inline fn pushGPUFragmentUniformData( gpucommandbuffer: *GPUCommandBuffer, slot_index: u32, data: ?*const anyopaque, length: u32, ) void { return c.SDL_PushGPUFragmentUniformData(gpucommandbuffer, slot_index, data, length); } pub inline fn pushGPUComputeUniformData( gpucommandbuffer: *GPUCommandBuffer, slot_index: u32, data: ?*const anyopaque, length: u32, ) void { return c.SDL_PushGPUComputeUniformData(gpucommandbuffer, slot_index, data, length); } pub inline fn beginGPURenderPass( gpucommandbuffer: *GPUCommandBuffer, color_target_infos: *const GPUColorTargetInfo, num_color_targets: u32, depth_stencil_target_info: *const GPUDepthStencilTargetInfo, ) ?*GPURenderPass { return c.SDL_BeginGPURenderPass(gpucommandbuffer, @ptrCast(color_target_infos), num_color_targets, @ptrCast(depth_stencil_target_info)); } pub inline fn beginGPUComputePass( gpucommandbuffer: *GPUCommandBuffer, storage_texture_bindings: *const GPUStorageTextureReadWriteBinding, num_storage_texture_bindings: u32, storage_buffer_bindings: *const GPUStorageBufferReadWriteBinding, num_storage_buffer_bindings: u32, ) ?*GPUComputePass { return c.SDL_BeginGPUComputePass(gpucommandbuffer, @ptrCast(storage_texture_bindings), num_storage_texture_bindings, @ptrCast(storage_buffer_bindings), num_storage_buffer_bindings); } pub inline fn beginGPUCopyPass(gpucommandbuffer: *GPUCommandBuffer) ?*GPUCopyPass { return c.SDL_BeginGPUCopyPass(gpucommandbuffer); } pub inline fn generateMipmapsForGPUTexture(gpucommandbuffer: *GPUCommandBuffer, texture: ?*GPUTexture) void { return c.SDL_GenerateMipmapsForGPUTexture(gpucommandbuffer, texture); } pub inline fn blitGPUTexture(gpucommandbuffer: *GPUCommandBuffer, info: *const GPUBlitInfo) void { return c.SDL_BlitGPUTexture(gpucommandbuffer, @ptrCast(info)); } pub inline fn acquireGPUSwapchainTexture( gpucommandbuffer: *GPUCommandBuffer, window: ?*Window, swapchain_texture: ?*?*GPUTexture, swapchain_texture_width: *u32, swapchain_texture_height: *u32, ) bool { return c.SDL_AcquireGPUSwapchainTexture(gpucommandbuffer, window, swapchain_texture, @ptrCast(swapchain_texture_width), @ptrCast(swapchain_texture_height)); } pub inline fn waitAndAcquireGPUSwapchainTexture( gpucommandbuffer: *GPUCommandBuffer, window: ?*Window, swapchain_texture: ?*?*GPUTexture, swapchain_texture_width: *u32, swapchain_texture_height: *u32, ) bool { return c.SDL_WaitAndAcquireGPUSwapchainTexture(gpucommandbuffer, window, swapchain_texture, @ptrCast(swapchain_texture_width), @ptrCast(swapchain_texture_height)); } pub inline fn submitGPUCommandBuffer(gpucommandbuffer: *GPUCommandBuffer) bool { return c.SDL_SubmitGPUCommandBuffer(gpucommandbuffer); } pub inline fn submitGPUCommandBufferAndAcquireFence(gpucommandbuffer: *GPUCommandBuffer) ?*GPUFence { return c.SDL_SubmitGPUCommandBufferAndAcquireFence(gpucommandbuffer); } pub inline fn cancelGPUCommandBuffer(gpucommandbuffer: *GPUCommandBuffer) bool { return c.SDL_CancelGPUCommandBuffer(gpucommandbuffer); } }; pub const GPURenderPass = opaque { pub inline fn bindGPUGraphicsPipeline(gpurenderpass: *GPURenderPass, graphics_pipeline: ?*GPUGraphicsPipeline) void { return c.SDL_BindGPUGraphicsPipeline(gpurenderpass, graphics_pipeline); } pub inline fn setGPUViewport(gpurenderpass: *GPURenderPass, viewport: *const GPUViewport) void { return c.SDL_SetGPUViewport(gpurenderpass, @ptrCast(viewport)); } pub inline fn setGPUScissor(gpurenderpass: *GPURenderPass, scissor: *const Rect) void { return c.SDL_SetGPUScissor(gpurenderpass, @ptrCast(scissor)); } pub inline fn setGPUBlendConstants(gpurenderpass: *GPURenderPass, blend_constants: FColor) void { return c.SDL_SetGPUBlendConstants(gpurenderpass, blend_constants); } pub inline fn setGPUStencilReference(gpurenderpass: *GPURenderPass, reference: u8) void { return c.SDL_SetGPUStencilReference(gpurenderpass, reference); } pub inline fn bindGPUVertexBuffers( gpurenderpass: *GPURenderPass, first_slot: u32, bindings: *const GPUBufferBinding, num_bindings: u32, ) void { return c.SDL_BindGPUVertexBuffers(gpurenderpass, first_slot, @ptrCast(bindings), num_bindings); } pub inline fn bindGPUIndexBuffer(gpurenderpass: *GPURenderPass, binding: *const GPUBufferBinding, index_element_size: GPUIndexElementSize) void { return c.SDL_BindGPUIndexBuffer(gpurenderpass, @ptrCast(binding), index_element_size); } pub inline fn bindGPUVertexSamplers( gpurenderpass: *GPURenderPass, first_slot: u32, texture_sampler_bindings: *const GPUTextureSamplerBinding, num_bindings: u32, ) void { return c.SDL_BindGPUVertexSamplers(gpurenderpass, first_slot, @ptrCast(texture_sampler_bindings), num_bindings); } pub inline fn bindGPUVertexStorageTextures( gpurenderpass: *GPURenderPass, first_slot: u32, storage_textures: [*c]*const GPUTexture, num_bindings: u32, ) void { return c.SDL_BindGPUVertexStorageTextures(gpurenderpass, first_slot, storage_textures, num_bindings); } pub inline fn bindGPUVertexStorageBuffers( gpurenderpass: *GPURenderPass, first_slot: u32, storage_buffers: [*c]*const GPUBuffer, num_bindings: u32, ) void { return c.SDL_BindGPUVertexStorageBuffers(gpurenderpass, first_slot, storage_buffers, num_bindings); } pub inline fn bindGPUFragmentSamplers( gpurenderpass: *GPURenderPass, first_slot: u32, texture_sampler_bindings: *const GPUTextureSamplerBinding, num_bindings: u32, ) void { return c.SDL_BindGPUFragmentSamplers(gpurenderpass, first_slot, @ptrCast(texture_sampler_bindings), num_bindings); } pub inline fn bindGPUFragmentStorageTextures( gpurenderpass: *GPURenderPass, first_slot: u32, storage_textures: [*c]*const GPUTexture, num_bindings: u32, ) void { return c.SDL_BindGPUFragmentStorageTextures(gpurenderpass, first_slot, storage_textures, num_bindings); } pub inline fn bindGPUFragmentStorageBuffers( gpurenderpass: *GPURenderPass, first_slot: u32, storage_buffers: [*c]*const GPUBuffer, num_bindings: u32, ) void { return c.SDL_BindGPUFragmentStorageBuffers(gpurenderpass, first_slot, storage_buffers, num_bindings); } pub inline fn drawGPUIndexedPrimitives( gpurenderpass: *GPURenderPass, num_indices: u32, num_instances: u32, first_index: u32, vertex_offset: i32, first_instance: u32, ) void { return c.SDL_DrawGPUIndexedPrimitives(gpurenderpass, num_indices, num_instances, first_index, vertex_offset, first_instance); } pub inline fn drawGPUPrimitives( gpurenderpass: *GPURenderPass, num_vertices: u32, num_instances: u32, first_vertex: u32, first_instance: u32, ) void { return c.SDL_DrawGPUPrimitives(gpurenderpass, num_vertices, num_instances, first_vertex, first_instance); } pub inline fn drawGPUPrimitivesIndirect( gpurenderpass: *GPURenderPass, buffer: ?*GPUBuffer, offset: u32, draw_count: u32, ) void { return c.SDL_DrawGPUPrimitivesIndirect(gpurenderpass, buffer, offset, draw_count); } pub inline fn drawGPUIndexedPrimitivesIndirect( gpurenderpass: *GPURenderPass, buffer: ?*GPUBuffer, offset: u32, draw_count: u32, ) void { return c.SDL_DrawGPUIndexedPrimitivesIndirect(gpurenderpass, buffer, offset, draw_count); } pub inline fn endGPURenderPass(gpurenderpass: *GPURenderPass) void { return c.SDL_EndGPURenderPass(gpurenderpass); } }; pub const GPUComputePass = opaque { pub inline fn bindGPUComputePipeline(gpucomputepass: *GPUComputePass, compute_pipeline: ?*GPUComputePipeline) void { return c.SDL_BindGPUComputePipeline(gpucomputepass, compute_pipeline); } pub inline fn bindGPUComputeSamplers( gpucomputepass: *GPUComputePass, first_slot: u32, texture_sampler_bindings: *const GPUTextureSamplerBinding, num_bindings: u32, ) void { return c.SDL_BindGPUComputeSamplers(gpucomputepass, first_slot, @ptrCast(texture_sampler_bindings), num_bindings); } pub inline fn bindGPUComputeStorageTextures( gpucomputepass: *GPUComputePass, first_slot: u32, storage_textures: [*c]*const GPUTexture, num_bindings: u32, ) void { return c.SDL_BindGPUComputeStorageTextures(gpucomputepass, first_slot, storage_textures, num_bindings); } pub inline fn bindGPUComputeStorageBuffers( gpucomputepass: *GPUComputePass, first_slot: u32, storage_buffers: [*c]*const GPUBuffer, num_bindings: u32, ) void { return c.SDL_BindGPUComputeStorageBuffers(gpucomputepass, first_slot, storage_buffers, num_bindings); } pub inline fn dispatchGPUCompute( gpucomputepass: *GPUComputePass, groupcount_x: u32, groupcount_y: u32, groupcount_z: u32, ) void { return c.SDL_DispatchGPUCompute(gpucomputepass, groupcount_x, groupcount_y, groupcount_z); } pub inline fn dispatchGPUComputeIndirect(gpucomputepass: *GPUComputePass, buffer: ?*GPUBuffer, offset: u32) void { return c.SDL_DispatchGPUComputeIndirect(gpucomputepass, buffer, offset); } pub inline fn endGPUComputePass(gpucomputepass: *GPUComputePass) void { return c.SDL_EndGPUComputePass(gpucomputepass); } }; pub const GPUCopyPass = opaque { pub inline fn uploadToGPUTexture( gpucopypass: *GPUCopyPass, source: *const GPUTextureTransferInfo, destination: *const GPUTextureRegion, cycle: bool, ) void { return c.SDL_UploadToGPUTexture(gpucopypass, @ptrCast(source), @ptrCast(destination), cycle); } pub inline fn uploadToGPUBuffer( gpucopypass: *GPUCopyPass, source: *const GPUTransferBufferLocation, destination: *const GPUBufferRegion, cycle: bool, ) void { return c.SDL_UploadToGPUBuffer(gpucopypass, @ptrCast(source), @ptrCast(destination), cycle); } pub inline fn copyGPUTextureToTexture( gpucopypass: *GPUCopyPass, source: *const GPUTextureLocation, destination: *const GPUTextureLocation, w: u32, h: u32, d: u32, cycle: bool, ) void { return c.SDL_CopyGPUTextureToTexture(gpucopypass, @ptrCast(source), @ptrCast(destination), w, h, d, cycle); } pub inline fn copyGPUBufferToBuffer( gpucopypass: *GPUCopyPass, source: *const GPUBufferLocation, destination: *const GPUBufferLocation, size: u32, cycle: bool, ) void { return c.SDL_CopyGPUBufferToBuffer(gpucopypass, @ptrCast(source), @ptrCast(destination), size, cycle); } pub inline fn downloadFromGPUTexture(gpucopypass: *GPUCopyPass, source: *const GPUTextureRegion, destination: *const GPUTextureTransferInfo) void { return c.SDL_DownloadFromGPUTexture(gpucopypass, @ptrCast(source), @ptrCast(destination)); } pub inline fn downloadFromGPUBuffer(gpucopypass: *GPUCopyPass, source: *const GPUBufferRegion, destination: *const GPUTransferBufferLocation) void { return c.SDL_DownloadFromGPUBuffer(gpucopypass, @ptrCast(source), @ptrCast(destination)); } pub inline fn endGPUCopyPass(gpucopypass: *GPUCopyPass) void { return c.SDL_EndGPUCopyPass(gpucopypass); } }; pub const GPUFence = opaque {}; pub const GPUPrimitiveType = enum(c_int) {}; pub const GPULoadOp = enum(c_int) {}; pub const GPUStoreOp = enum(c_int) {}; pub const GPUIndexElementSize = enum(c_int) {}; pub const GPUTextureFormat = enum(c_int) { textureformatInvalid, textureformatA8Unorm, textureformatR8Unorm, textureformatR8g8Unorm, textureformatR8g8b8a8Unorm, textureformatR16Unorm, textureformatR16g16Unorm, textureformatR16g16b16a16Unorm, textureformatR10g10b10a2Unorm, textureformatB5g6r5Unorm, textureformatB5g5r5a1Unorm, textureformatB4g4r4a4Unorm, textureformatB8g8r8a8Unorm, textureformatBc1RgbaUnorm, textureformatBc2RgbaUnorm, textureformatBc3RgbaUnorm, textureformatBc4RUnorm, textureformatBc5RgUnorm, textureformatBc7RgbaUnorm, textureformatBc6hRgbFloat, textureformatBc6hRgbUfloat, textureformatR8Snorm, textureformatR8g8Snorm, textureformatR8g8b8a8Snorm, textureformatR16Snorm, textureformatR16g16Snorm, textureformatR16g16b16a16Snorm, textureformatR16Float, textureformatR16g16Float, textureformatR16g16b16a16Float, textureformatR32Float, textureformatR32g32Float, textureformatR32g32b32a32Float, textureformatR11g11b10Ufloat, textureformatR8Uint, textureformatR8g8Uint, textureformatR8g8b8a8Uint, textureformatR16Uint, textureformatR16g16Uint, textureformatR16g16b16a16Uint, textureformatR32Uint, textureformatR32g32Uint, textureformatR32g32b32a32Uint, textureformatR8Int, textureformatR8g8Int, textureformatR8g8b8a8Int, textureformatR16Int, textureformatR16g16Int, textureformatR16g16b16a16Int, textureformatR32Int, textureformatR32g32Int, textureformatR32g32b32a32Int, textureformatR8g8b8a8UnormSrgb, textureformatB8g8r8a8UnormSrgb, textureformatBc1RgbaUnormSrgb, textureformatBc2RgbaUnormSrgb, textureformatBc3RgbaUnormSrgb, textureformatBc7RgbaUnormSrgb, textureformatD16Unorm, textureformatD24Unorm, textureformatD32Float, textureformatD24UnormS8Uint, textureformatD32FloatS8Uint, textureformatAstc4x4Unorm, textureformatAstc5x4Unorm, textureformatAstc5x5Unorm, textureformatAstc6x5Unorm, textureformatAstc6x6Unorm, textureformatAstc8x5Unorm, textureformatAstc8x6Unorm, textureformatAstc8x8Unorm, textureformatAstc10x5Unorm, textureformatAstc10x6Unorm, textureformatAstc10x8Unorm, textureformatAstc10x10Unorm, textureformatAstc12x10Unorm, textureformatAstc12x12Unorm, textureformatAstc4x4UnormSrgb, textureformatAstc5x4UnormSrgb, textureformatAstc5x5UnormSrgb, textureformatAstc6x5UnormSrgb, textureformatAstc6x6UnormSrgb, textureformatAstc8x5UnormSrgb, textureformatAstc8x6UnormSrgb, textureformatAstc8x8UnormSrgb, textureformatAstc10x5UnormSrgb, textureformatAstc10x6UnormSrgb, textureformatAstc10x8UnormSrgb, textureformatAstc10x10UnormSrgb, textureformatAstc12x10UnormSrgb, textureformatAstc12x12UnormSrgb, textureformatAstc4x4Float, textureformatAstc5x4Float, textureformatAstc5x5Float, textureformatAstc6x5Float, textureformatAstc6x6Float, textureformatAstc8x5Float, textureformatAstc8x6Float, textureformatAstc8x8Float, textureformatAstc10x5Float, textureformatAstc10x6Float, textureformatAstc10x8Float, textureformatAstc10x10Float, textureformatAstc12x10Float, textureformatAstc12x12Float, }; pub const GPUTextureUsageFlags = packed struct(u32) { textureusageSampler: bool = false, // Texture supports sampling. textureusageColorTarget: bool = false, // Texture is a color render target. textureusageDepthStencilTarget: bool = false, // Texture is a depth stencil target. textureusageGraphicsStorageRead: bool = false, // Texture supports storage reads in graphics stages. textureusageComputeStorageRead: bool = false, // Texture supports storage reads in the compute stage. textureusageComputeStorageWrite: bool = false, // Texture supports storage writes in the compute stage. textureusageComputeStorageSimultaneousReadWrite: bool = false, // Texture supports reads and writes in the same compute shader. This is NOT equivalent to READ | WRITE. pad0: u24 = 0, rsvd: bool = false, }; pub const GPUTextureType = enum(c_int) {}; pub const GPUSampleCount = enum(c_int) {}; pub const GPUCubeMapFace = enum(c_int) { cubemapfacePositivex, cubemapfaceNegativex, cubemapfacePositivey, cubemapfaceNegativey, cubemapfacePositivez, cubemapfaceNegativez, }; pub const GPUBufferUsageFlags = packed struct(u32) { bufferusageVertex: bool = false, // Buffer is a vertex buffer. bufferusageIndex: bool = false, // Buffer is an index buffer. bufferusageIndirect: bool = false, // Buffer is an indirect buffer. bufferusageGraphicsStorageRead: bool = false, // Buffer supports storage reads in graphics stages. bufferusageComputeStorageRead: bool = false, // Buffer supports storage reads in the compute stage. bufferusageComputeStorageWrite: bool = false, // Buffer supports storage writes in the compute stage. pad0: u25 = 0, rsvd: bool = false, }; pub const GPUTransferBufferUsage = enum(c_int) { transferbufferusageUpload, transferbufferusageDownload, }; pub const GPUShaderStage = enum(c_int) { shaderstageVertex, shaderstageFragment, }; pub const GPUShaderFormat = u32; pub const GPUVertexElementFormat = enum(c_int) { vertexelementformatInvalid, vertexelementformatInt, vertexelementformatInt2, vertexelementformatInt3, vertexelementformatInt4, vertexelementformatUint, vertexelementformatUint2, vertexelementformatUint3, vertexelementformatUint4, vertexelementformatFloat, vertexelementformatFloat2, vertexelementformatFloat3, vertexelementformatFloat4, vertexelementformatByte2, vertexelementformatByte4, vertexelementformatUbyte2, vertexelementformatUbyte4, vertexelementformatByte2Norm, vertexelementformatByte4Norm, vertexelementformatUbyte2Norm, vertexelementformatUbyte4Norm, vertexelementformatShort2, vertexelementformatShort4, vertexelementformatUshort2, vertexelementformatUshort4, vertexelementformatShort2Norm, vertexelementformatShort4Norm, vertexelementformatUshort2Norm, vertexelementformatUshort4Norm, vertexelementformatHalf2, vertexelementformatHalf4, }; pub const GPUVertexInputRate = enum(c_int) {}; pub const GPUFillMode = enum(c_int) {}; pub const GPUCullMode = enum(c_int) {}; pub const GPUFrontFace = enum(c_int) {}; pub const GPUCompareOp = enum(c_int) { compareopInvalid, }; pub const GPUStencilOp = enum(c_int) { stencilopInvalid, }; pub const GPUBlendOp = enum(c_int) { blendopInvalid, }; pub const GPUBlendFactor = enum(c_int) { blendfactorInvalid, }; pub const GPUColorComponentFlags = packed struct(u8) { colorcomponentR: bool = false, // the red component colorcomponentG: bool = false, // the green component colorcomponentB: bool = false, // the blue component colorcomponentA: bool = false, // the alpha component pad0: u3 = 0, rsvd: bool = false, }; pub const GPUFilter = enum(c_int) {}; pub const GPUSamplerMipmapMode = enum(c_int) {}; pub const GPUSamplerAddressMode = enum(c_int) {}; pub const GPUPresentMode = enum(c_int) { presentmodeVsync, presentmodeImmediate, presentmodeMailbox, }; pub const GPUSwapchainComposition = enum(c_int) { swapchaincompositionSdr, swapchaincompositionSdrLinear, swapchaincompositionHdrExtendedLinear, swapchaincompositionHdr10St2084, }; pub const GPUViewport = extern struct {}; pub const GPUTextureTransferInfo = extern struct {}; pub const GPUTransferBufferLocation = extern struct {}; pub const GPUTextureLocation = extern struct {}; pub const GPUTextureRegion = extern struct {}; pub const GPUBlitRegion = extern struct {}; pub const GPUBufferLocation = extern struct {}; pub const GPUBufferRegion = extern struct {}; pub const GPUIndirectDrawCommand = extern struct {}; pub const GPUIndexedIndirectDrawCommand = extern struct {}; pub const GPUIndirectDispatchCommand = extern struct {}; pub const GPUSamplerCreateInfo = extern struct { padding1: u8, padding2: u8, }; pub const GPUVertexBufferDescription = extern struct {}; pub const GPUVertexAttribute = extern struct {}; pub const GPUVertexInputState = extern struct {}; pub const GPUStencilOpState = extern struct {}; pub const GPUColorTargetBlendState = extern struct { padding1: u8, padding2: u8, }; pub const GPUShaderCreateInfo = extern struct {}; pub const GPUTextureCreateInfo = extern struct {}; pub const GPUBufferCreateInfo = extern struct {}; pub const GPUTransferBufferCreateInfo = extern struct {}; pub const GPURasterizerState = extern struct { padding1: u8, padding2: u8, }; pub const GPUMultisampleState = extern struct { padding1: u8, padding2: u8, padding3: u8, }; pub const GPUDepthStencilState = extern struct { padding1: u8, padding2: u8, padding3: u8, }; pub const GPUColorTargetDescription = extern struct {}; pub const GPUGraphicsPipelineTargetInfo = extern struct { padding1: u8, padding2: u8, padding3: u8, }; pub const GPUGraphicsPipelineCreateInfo = extern struct {}; pub const GPUComputePipelineCreateInfo = extern struct {}; pub const GPUColorTargetInfo = extern struct { padding1: u8, padding2: u8, }; pub const GPUDepthStencilTargetInfo = extern struct { padding1: u8, padding2: u8, }; pub const GPUBlitInfo = extern struct { padding1: u8, padding2: u8, padding3: u8, }; pub const GPUBufferBinding = extern struct {}; pub const GPUTextureSamplerBinding = extern struct {}; pub const GPUStorageBufferReadWriteBinding = extern struct { padding1: u8, padding2: u8, padding3: u8, }; pub const GPUStorageTextureReadWriteBinding = extern struct { padding1: u8, padding2: u8, padding3: u8, }; pub inline fn gpuSupportsShaderFormats(format_flags: GPUShaderFormat, name: [*c]const u8) bool { return c.SDL_GPUSupportsShaderFormats(@bitCast(format_flags), name); } pub inline fn gpuSupportsProperties(props: PropertiesID) bool { return c.SDL_GPUSupportsProperties(props); } pub inline fn createGPUDevice(format_flags: GPUShaderFormat, debug_mode: bool, name: [*c]const u8) ?*GPUDevice { return c.SDL_CreateGPUDevice(@bitCast(format_flags), debug_mode, name); } pub inline fn createGPUDeviceWithProperties(props: PropertiesID) ?*GPUDevice { return c.SDL_CreateGPUDeviceWithProperties(props); } pub inline fn getNumGPUDrivers() c_int { return c.SDL_GetNumGPUDrivers(); } pub inline fn getGPUDriver(index: c_int) [*c]const u8 { return c.SDL_GetGPUDriver(index); } pub inline fn gpuTextureFormatTexelBlockSize(format: GPUTextureFormat) u32 { return c.SDL_GPUTextureFormatTexelBlockSize(@bitCast(format)); } pub inline fn calculateGPUTextureFormatSize( format: GPUTextureFormat, width: u32, height: u32, depth_or_layer_count: u32, ) u32 { return c.SDL_CalculateGPUTextureFormatSize(@bitCast(format), width, height, depth_or_layer_count); }