~/bend-docscommunity

Vulkan.bend source

Vulkan.bend on the hub · documented module

import Baseimport ./src/core.bend as Coreimport ./deps/bend-collections/src/math/u64.bend as W# Handles carry checked registry keys, never native pointers.type Entry is Data:  Entry{key: U32}type Instance is Data:  Instance{key: U32}type PhysicalDevice is Data:  PhysicalDevice{key: U32}type Device is Data:  Device{key: U32}type Buffer is Data:  Buffer{key: U32}type DeviceMemory is Data:  DeviceMemory{key: U32}type CommandPool is Data:  CommandPool{key: U32}type CommandBuffer is Data:  CommandBuffer{key: U32}type Fence is Data:  Fence{key: U32}type NativeWindow is Data:  NativeWindow{key: U32}type Surface is Data:  Surface{key: U32}type Swapchain is Data:  Swapchain{key: U32}type Acquisition is Data:  Acquisition{swapchain: Swapchain, serial: W.U64}type QueryPool is Data:  QueryPool{key: U32}type TimestampProperties is Data:  TimestampProperties{valid_bits: U32, period_ns: F32}type Timestamp is Data:  Timestamp{value: W.U64, available: Bool}type Semaphore is Data:  Semaphore{key: U32}type WindowSnapshot is Type:  WindowSnapshot{width: U32, height: U32, mapped: Bool, focused: Bool, captured: Bool, events: List<Event>}type SurfaceCapabilities is Data:  SurfaceCapabilities{min_images: U32, max_images: U32, width: U32, height: U32, min_width: U32, min_height: U32, max_width: U32, max_height: U32, transforms: U32, transform: U32, alpha: U32, usage: U32}type PresentationDeviceInfo is Data:  PresentationDeviceInfo{graphics_family: U32, present_family: U32, surface: Surface}type SwapchainCreateInfo is Data:  SwapchainCreateInfo{surface: Surface, image_count: U32, format: U32, color_space: U32, extent: Extent2D, usage: U32, transform: U32, alpha: U32, present_mode: U32}type AcquireOutcome is Data:  Acquired{acquisition: Acquisition, index: U32, suboptimal: Bool}  AcquireOutOfDate{}  AcquireNotReady{}  AcquireTimeout{}  AcquireSurfaceLost{}type PresentOutcome is Data:  Presented{}  PresentSuboptimal{}  PresentOutOfDate{}  PresentSurfaceLost{}type SemaphoreWait is Data:  SemaphoreWait{semaphore: Semaphore, stages: U32}type ImageHandle is Data:  ImageHandle{key: U32}type ImageView is Data:  ImageView{key: U32}type RenderPass is Data:  RenderPass{key: U32}type Framebuffer is Data:  Framebuffer{key: U32}type ShaderModule is Data:  ShaderModule{key: U32}type PipelineLayout is Data:  PipelineLayout{key: U32}type GraphicsPipeline is Data:  GraphicsPipeline{key: U32}type PushConstantRange is Data:  PushConstantRange{stages: U32, bytes: U32}type DescriptorSetLayout is Data:  DescriptorSetLayout{key: U32}type DescriptorPool is Data:  DescriptorPool{key: U32}type DescriptorSet is Data:  DescriptorSet{key: U32}type Sampler is Data:  Sampler{key: U32}type DescriptorKind is Data:  UniformDescriptor{}  SampledDescriptor{}type DescriptorBinding is Data:  DescriptorBinding{binding: U32, kind: DescriptorKind, count: U32, stages: U32}type DescriptorSetLayoutCreateInfo is Type:  DescriptorSetLayoutCreateInfo{bindings: List<DescriptorBinding>}type DescriptorPoolSize is Data:  DescriptorPoolSize{kind: DescriptorKind, count: U32}type DescriptorPoolCreateInfo is Type:  DescriptorPoolCreateInfo{max_sets: U32, sizes: List<DescriptorPoolSize>}type DescriptorBuffer is Data:  DescriptorBuffer{buffer: Buffer, offset: W.U64, range: W.U64}type DescriptorImage is Data:  DescriptorImage{view: ImageView, sampler: Sampler, layout: U32}type DescriptorWrite is Type:  UniformWrite{binding: U32, first: U32, values: List<DescriptorBuffer>}  SampledWrite{binding: U32, first: U32, values: List<DescriptorImage>}type SamplerCreateInfo is Data:  SamplerCreateInfo{min_filter: U32, mag_filter: U32, mipmap_mode: U32, address_u: U32, address_v: U32, address_w: U32, min_lod: F32, max_lod: F32, border_color: U32}type PipelineLayoutCreateInfo is Type:  PipelineLayoutCreateInfo{sets: List<DescriptorSetLayout>, push: Maybe<&2, PushConstantRange>}def descriptor_number(binding: DescriptorBinding) -> U32:  DescriptorBinding{number,kind,count,stages} = binding  numberdef descriptor_schema(bindings: List<DescriptorBinding>) -> List<DescriptorBinding>:  Core.descriptor_schema(~DescriptorBinding,~descriptor_number,bindings)def Device.create_descriptor_set_layout(device: Device, info: DescriptorSetLayoutCreateInfo) -> IO(VkResult(DescriptorSetLayout)):  DescriptorSetLayoutCreateInfo{bindings} = info  Device.descriptor_set_layout_raw(device,DescriptorSetLayoutCreateInfo{descriptor_schema(bindings)})type VertexInputBinding is Data:  VertexInputBinding{binding: U32, stride: U32, input_rate: U32}type VertexInputAttribute is Data:  VertexInputAttribute{location: U32, binding: U32, format: U32, offset: U32}type RasterState is Data:  RasterState{cull_mode: U32, front_face: U32}type DepthState is Data:  DepthState{test: Bool, write: Bool, compare: U32}type GraphicsPipelineCreateInfo is Type:  GraphicsPipelineCreateInfo{layout: PipelineLayout, render_pass: RenderPass, vertex: ShaderModule, fragment: ShaderModule, bindings: List<VertexInputBinding>, attributes: List<VertexInputAttribute>, topology: U32, raster: RasterState, depth: Maybe<&2, DepthState>, color_write_mask: U32}type Viewport is Data:  Viewport{x: F32, y: F32, width: F32, height: F32, min_depth: F32, max_depth: F32}# The word preserves an int32 vertexOffset in two's-complement form.type BaseVertex is Data:  BaseVertex{bits: U32}type IndexedDraw is Data:  IndexedDraw{index_count: U32, instance_count: U32, first_index: U32, base_vertex: BaseVertex, first_instance: U32}type Extent2D is Data:  Extent2D{width: U32, height: U32}type Offset2D is Data:  Offset2D{x: U32, y: U32}type RenderArea is Data:  RenderArea{offset: Offset2D, extent: Extent2D}type ImageFormatInfo is Data:  ImageFormatInfo{format: U32, image_type: U32, tiling: U32, usage: U32, flags: U32}type ImageFormatProperties is Data:  ImageFormatProperties{max_width: U32, max_height: U32, max_depth: U32, max_mip_levels: U32, max_array_layers: U32, sample_counts: U32, max_resource_size: W.U64}type ImageCreateInfo is Data:  ImageCreateInfo{format: U32, extent: Extent2D, mip_levels: U32, array_layers: U32, usage: U32}type ImageSubresourceRange is Data:  ImageSubresourceRange{aspect_mask: U32, base_mip_level: U32, level_count: U32, base_array_layer: U32, layer_count: U32}type ImageSubresourceLayers is Data:  ImageSubresourceLayers{aspect_mask: U32, mip_level: U32, base_array_layer: U32, layer_count: U32}type ImageViewCreateInfo is Data:  ImageViewCreateInfo{image: ImageHandle, view_type: U32, range: ImageSubresourceRange}type ImageMemoryBarrier is Data:  ImageMemoryBarrier{image: ImageHandle, range: ImageSubresourceRange, old_layout: U32, new_layout: U32, src_access: U32, dst_access: U32}type BufferImageCopy is Data:  BufferImageCopy{buffer_offset: W.U64, buffer_row_length: U32, buffer_image_height: U32, image_subresource: ImageSubresourceLayers, image_offset: Offset2D, image_extent: Extent2D}type ClearColor is Data:  ClearColor{r: F32, g: F32, b: F32, a: F32}type ClearValue is Data:  ColorClear{value: ClearColor}  DepthClear{depth: F32}  UnusedClear{}type AttachmentInfo is Data:  AttachmentInfo{format: U32, load_op: U32, store_op: U32}type RenderPassCreateInfo is Type:  RenderPassCreateInfo{colors: List<AttachmentInfo>, depth: Maybe<AttachmentInfo>}type FramebufferCreateInfo is Type:  FramebufferCreateInfo{render_pass: RenderPass, attachments: List<ImageView>, extent: Extent2D}type BufferCopy is Data:  BufferCopy{src_offset: W.U64, dst_offset: W.U64, size: W.U64}type MemoryBarrier is Data:  MemoryBarrier{src_access: U32, dst_access: U32}type BufferMemoryBarrier is Data:  BufferMemoryBarrier{buffer: Buffer, offset: W.U64, size: W.U64, src_access: U32, dst_access: U32}type InstanceCreateInfo is Type:  InstanceCreateInfo{application_name: String, api_version: U32, layers: List<String>, extensions: List<String>}def InstanceCreateInfo.default() -> InstanceCreateInfo:  InstanceCreateInfo{"Bend Vulkan", Core.make_api_version(0, 1, 0, 0), [], []}type DeviceCreateInfo is Type:  DeviceCreateInfo{queue_family_index: U32, extensions: List<String>}type BufferCreateInfo is Data:  BufferCreateInfo{size: W.U64, usage: U32}type PhysicalDeviceProperties is Data:  PhysicalDeviceProperties{device_name: String, api_version: U32, driver_version: U32, vendor_id: U32, device_id: U32, device_type: U32}type LayerProperties is Data:  LayerProperties{name: String, spec_version: U32, implementation_version: U32, description: String}type ExtensionProperties is Data:  ExtensionProperties{name: String, spec_version: U32}type MemoryHeap is Data:  MemoryHeap{size: W.U64, flags: U32}type FormatProperties is Data:  FormatProperties{linear_tiling_features: U32, optimal_tiling_features: U32, buffer_features: U32}type PhysicalDeviceLimits is Data:  PhysicalDeviceLimits{max_image_dimension_2d: U32, max_framebuffer_width: U32, max_framebuffer_height: U32, max_color_attachments: U32, max_push_constants_size: U32, max_vertex_input_attributes: U32, max_vertex_input_bindings: U32, max_vertex_input_attribute_offset: U32, max_vertex_input_binding_stride: U32, max_memory_allocation_count: U32, non_coherent_atom_size: W.U64, optimal_buffer_copy_offset_alignment: W.U64, optimal_buffer_copy_row_pitch_alignment: W.U64, buffer_image_granularity: W.U64}def LimitsWords() -> Type:  (U32 & (U32 & (U32 & (U32 & (U32 & (U32 & (U32 & (U32 & (U32 & (U32 & ((U32 & U32) & ((U32 & U32) & ((U32 & U32) & (U32 & U32))))))))))))))type MemoryRequirements is Data:  MemoryRequirements{size: W.U64, alignment: W.U64, memory_type_bits: U32}# Negative VkResult values retain their exact two's-complement U32 bits.# Wrapper failures occupy 0x60000000..0x600000ff and include a message.def VkResult(-A: Type) -> Type:  Result<&1, &1, (U32 & String), A>def or_exit(-A: Type, result: VkResult(A)) -> IO(A):  match result:    case Done{value}:      IO.pure(A, value)    case Fail{(code, message)}:      IO.die(A, 1, "Vulkan error " ++ U32.show(code) ++ ": " ++ message)# A Result-returning IO monad: Fail skips the remaining actions, then Entry.with cleans up.def Action(-A: Type) -> Type:  IO(VkResult(A))def Action.pure(-A: Type, value: A) -> Action(A):  IO.pure(VkResult(A), Done{value})def Action.next(-A: Type, -B: Type, next: A -> Action(B), result: VkResult(A)) -> Action(B):  match result:    case Done{value}:      next(value)    case Fail{error}:      IO.pure(VkResult(B), Fail{error})def Action.bind(-A: Type, -B: Type, action: Action(A), next: A -> Action(B)) -> Action(B):  IO.bind(VkResult(A), VkResult(B), action, Action.next(A, B, next))def Action.lift(-A: Type, action: IO(A)) -> Action(A):  IO.bind(A, VkResult(A), action, value => IO.pure(VkResult(A), Done{value}))# BEGIN GENERATED EFFECTSdef Entry.load() -> IO(VkResult(Entry)):  import "./src/native.c"  import "./src/native.js"def Entry.close(entry: Entry) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Entry.enumerate_instance_version(entry: Entry) -> IO(VkResult(U32)):  import "./src/native.c"  import "./src/native.js"def Entry.create_instance(entry: Entry, info: InstanceCreateInfo) -> IO(VkResult(Instance)):  import "./src/native.c"  import "./src/native.js"def Instance.destroy(instance: Instance) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Instance.enumerate_physical_devices(instance: Instance) -> IO(VkResult(List<PhysicalDevice>)):  import "./src/native.c"  import "./src/native.js"def Instance.get_physical_device_properties(instance: Instance, physical: PhysicalDevice) -> IO(VkResult(PhysicalDeviceProperties)):  import "./src/native.c"  import "./src/native.js"def Instance.get_physical_device_queue_family_properties(instance: Instance, physical: PhysicalDevice) -> IO(VkResult(List<(U32 & U32)>)):  import "./src/native.c"  import "./src/native.js"def Instance.memory_types_raw(instance: Instance, physical: PhysicalDevice) -> IO(VkResult(List<(U32 & U32)>)):  import "./src/native.c"  import "./src/native.js"def Instance.create_device(instance: Instance, physical: PhysicalDevice, info: DeviceCreateInfo) -> IO(VkResult(Device)):  import "./src/native.c"  import "./src/native.js"def Device.destroy(device: Device) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.wait_idle(device: Device) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.create_buffer(device: Device, info: BufferCreateInfo) -> IO(VkResult(Buffer)):  import "./src/native.c"  import "./src/native.js"def Device.destroy_buffer(device: Device, buffer: Buffer) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.retire_buffers(device: Device, allocations: List<(Buffer & DeviceMemory)>) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.collect_retired(device: Device) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.buffer_requirements_raw(device: Device, buffer: Buffer) -> IO(VkResult(((U32 & U32) & ((U32 & U32) & U32)))):  import "./src/native.c"  import "./src/native.js"def Device.allocate_memory(device: Device, size: W.U64, memory_type_index: U32) -> IO(VkResult(DeviceMemory)):  import "./src/native.c"  import "./src/native.js"def Device.free_memory(device: Device, memory: DeviceMemory) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.bind_buffer_memory(device: Device, buffer: Buffer, memory: DeviceMemory, offset: W.U64) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.write_memory(device: Device, memory: DeviceMemory, offset: W.U64, bytes: List<U32>) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.write_memory_words(device: Device, memory: DeviceMemory, offset: W.U64, source_byte: W.U64, byte_length: W.U64, words: Array<U32>) -> IO(Array<U32> & VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.read_memory(device: Device, memory: DeviceMemory, offset: W.U64, count: U32) -> IO(VkResult(List<U32>)):  import "./src/native.c"  import "./src/native.js"def Device.create_command_pool(device: Device) -> IO(VkResult(CommandPool)):  import "./src/native.c"  import "./src/native.js"def Device.destroy_command_pool(device: Device, pool: CommandPool) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.allocate_command_buffer(device: Device, pool: CommandPool) -> IO(VkResult(CommandBuffer)):  import "./src/native.c"  import "./src/native.js"def CommandBuffer.begin(command: CommandBuffer) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def CommandBuffer.fill_buffer(command: CommandBuffer, buffer: Buffer, offset: W.U64, size: W.U64, data: U32) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def CommandBuffer.copy_buffer(command: CommandBuffer, src: Buffer, dst: Buffer, regions: List<BufferCopy>) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def CommandBuffer.pipeline_barrier(command: CommandBuffer, src_stage: U32, dst_stage: U32, memory: List<MemoryBarrier>, buffers: List<BufferMemoryBarrier>, images: List<ImageMemoryBarrier>) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def CommandBuffer.end(command: CommandBuffer) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.submit_and_wait(device: Device, command: CommandBuffer) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def debug_live_objects() -> IO(VkResult(U32)):  import "./src/native.c"  import "./src/native.js"def debug_u64_roundtrip(value: W.U64) -> IO(VkResult((U32 & U32))):  import "./src/native.c"  import "./src/native.js"def Device.create_fence(device: Device, signaled: Bool) -> IO(VkResult(Fence)):  import "./src/native.c"  import "./src/native.js"def Device.destroy_fence(device: Device, fence: Fence) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.submit(device: Device, command: CommandBuffer, fence: Fence) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Fence.status(fence: Fence) -> IO(VkResult(U32)):  import "./src/native.c"  import "./src/native.js"def Fence.wait(fence: Fence, timeout_ns: W.U64) -> IO(VkResult(U32)):  import "./src/native.c"  import "./src/native.js"def Fence.reset(fence: Fence) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def CommandBuffer.reset(command: CommandBuffer) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Entry.enumerate_instance_layers(entry: Entry) -> IO(VkResult(List<LayerProperties>)):  import "./src/native.c"  import "./src/native.js"def Entry.enumerate_instance_extensions(entry: Entry, layer: Maybe<String>) -> IO(VkResult(List<ExtensionProperties>)):  import "./src/native.c"  import "./src/native.js"def Instance.enumerate_device_extensions(instance: Instance, physical: PhysicalDevice, layer: Maybe<String>) -> IO(VkResult(List<ExtensionProperties>)):  import "./src/native.c"  import "./src/native.js"def Instance.memory_heaps_raw(instance: Instance, physical: PhysicalDevice) -> IO(VkResult(List<((U32 & U32) & U32)>)):  import "./src/native.c"  import "./src/native.js"def Instance.get_physical_device_format_properties(instance: Instance, physical: PhysicalDevice, format: U32) -> IO(VkResult(FormatProperties)):  import "./src/native.c"  import "./src/native.js"def Instance.limits_raw(instance: Instance, physical: PhysicalDevice) -> IO(VkResult(LimitsWords())):  import "./src/native.c"  import "./src/native.js"def Instance.image_format_properties_raw(instance: Instance, physical: PhysicalDevice, info: ImageFormatInfo) -> IO(VkResult(ImageFormatWords())):  import "./src/native.c"  import "./src/native.js"def Device.create_image(device: Device, info: ImageCreateInfo) -> IO(VkResult(ImageHandle)):  import "./src/native.c"  import "./src/native.js"def Device.destroy_image(device: Device, image: ImageHandle) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.image_requirements_raw(device: Device, image: ImageHandle) -> IO(VkResult(((U32 & U32) & ((U32 & U32) & U32)))):  import "./src/native.c"  import "./src/native.js"def Device.bind_image_memory(device: Device, image: ImageHandle, memory: DeviceMemory, offset: W.U64) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.create_image_view(device: Device, info: ImageViewCreateInfo) -> IO(VkResult(ImageView)):  import "./src/native.c"  import "./src/native.js"def Device.destroy_image_view(device: Device, view: ImageView) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def CommandBuffer.clear_color_image(command: CommandBuffer, image: ImageHandle, layout: U32, value: ClearColor, ranges: List<ImageSubresourceRange>) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def CommandBuffer.clear_depth_image(command: CommandBuffer, image: ImageHandle, layout: U32, depth: F32, ranges: List<ImageSubresourceRange>) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def CommandBuffer.copy_buffer_to_image(command: CommandBuffer, src: Buffer, dst: ImageHandle, layout: U32, regions: List<BufferImageCopy>) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def CommandBuffer.copy_image_to_buffer(command: CommandBuffer, src: ImageHandle, layout: U32, dst: Buffer, regions: List<BufferImageCopy>) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.create_render_pass(device: Device, info: RenderPassCreateInfo) -> IO(VkResult(RenderPass)):  import "./src/native.c"  import "./src/native.js"def Device.destroy_render_pass(device: Device, render_pass: RenderPass) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.create_framebuffer(device: Device, info: FramebufferCreateInfo) -> IO(VkResult(Framebuffer)):  import "./src/native.c"  import "./src/native.js"def Device.destroy_framebuffer(device: Device, framebuffer: Framebuffer) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def CommandBuffer.begin_render_pass(command: CommandBuffer, framebuffer: Framebuffer, area: RenderArea, clears: List<ClearValue>) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def CommandBuffer.end_render_pass(command: CommandBuffer) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.create_shader_module(device: Device, words: List<U32>) -> IO(VkResult(ShaderModule)):  import "./src/native.c"  import "./src/native.js"def Device.destroy_shader_module(device: Device, shader: ShaderModule) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.create_pipeline_layout(device: Device, info: PipelineLayoutCreateInfo) -> IO(VkResult(PipelineLayout)):  import "./src/native.c"  import "./src/native.js"def Device.destroy_pipeline_layout(device: Device, layout: PipelineLayout) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.create_graphics_pipeline(device: Device, info: GraphicsPipelineCreateInfo) -> IO(VkResult(GraphicsPipeline)):  import "./src/native.c"  import "./src/native.js"def Device.destroy_graphics_pipeline(device: Device, pipeline: GraphicsPipeline) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def CommandBuffer.bind_graphics_pipeline(command: CommandBuffer, pipeline: GraphicsPipeline) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def CommandBuffer.set_viewport(command: CommandBuffer, viewport: Viewport) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def CommandBuffer.set_scissor(command: CommandBuffer, area: RenderArea) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def CommandBuffer.bind_vertex_buffer(command: CommandBuffer, binding: U32, buffer: Buffer, offset: W.U64) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def CommandBuffer.bind_index_buffer(command: CommandBuffer, buffer: Buffer, offset: W.U64, index_type: U32) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def CommandBuffer.push_constants(command: CommandBuffer, words: List<U32>) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def CommandBuffer.draw_indexed(command: CommandBuffer, draw: IndexedDraw) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Entry.open_window(entry: Entry, title: String, width: U32, height: U32) -> IO(VkResult(NativeWindow)):  import "./src/window.c"  import "./src/native.js"def NativeWindow.poll(window: NativeWindow, timeout_ms: U32) -> IO(VkResult(WindowSnapshot)):  import "./src/window.c"  import "./src/native.js"def NativeWindow.capture(window: NativeWindow, capture: Bool) -> IO(VkResult(Bool)):  import "./src/window.c"  import "./src/native.js"def NativeWindow.close(window: NativeWindow) -> IO(VkResult(Unit)):  import "./src/window.c"  import "./src/native.js"def Instance.create_surface(instance: Instance, window: NativeWindow) -> IO(VkResult(Surface)):  import "./src/window.c"  import "./src/native.js"def Instance.destroy_surface(instance: Instance, surface: Surface) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Instance.surface_capabilities(instance: Instance, physical: PhysicalDevice, surface: Surface) -> IO(VkResult(SurfaceCapabilities)):  import "./src/native.c"  import "./src/native.js"def Instance.surface_formats(instance: Instance, physical: PhysicalDevice, surface: Surface) -> IO(VkResult(List<(U32 & U32)>)):  import "./src/native.c"  import "./src/native.js"def Instance.present_modes(instance: Instance, physical: PhysicalDevice, surface: Surface) -> IO(VkResult(List<U32>)):  import "./src/native.c"  import "./src/native.js"def Instance.present_support(instance: Instance, physical: PhysicalDevice, surface: Surface, family: U32) -> IO(VkResult(Bool)):  import "./src/native.c"  import "./src/native.js"def Instance.presentation_supported(instance: Instance, physical: PhysicalDevice) -> IO(VkResult(Bool)):  import "./src/native.c"  import "./src/native.js"def Instance.create_presentation_device(instance: Instance, physical: PhysicalDevice, info: PresentationDeviceInfo) -> IO(VkResult(Device)):  import "./src/native.c"  import "./src/native.js"def Device.create_swapchain(device: Device, info: SwapchainCreateInfo) -> IO(VkResult(Swapchain)):  import "./src/native.c"  import "./src/native.js"def Device.swapchain_images(device: Device, swapchain: Swapchain) -> IO(VkResult(List<ImageHandle>)):  import "./src/native.c"  import "./src/native.js"def Device.destroy_swapchain(device: Device, swapchain: Swapchain) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.acquire(device: Device, swapchain: Swapchain, fence: Fence, timeout_ns: W.U64) -> IO(VkResult(AcquireOutcome)):  import "./src/native.c"  import "./src/native.js"def Device.release_acquired(device: Device, acquisition: Acquisition) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.create_semaphore(device: Device) -> IO(VkResult(Semaphore)):  import "./src/native.c"  import "./src/native.js"def Device.destroy_semaphore(device: Device, semaphore: Semaphore) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.submit_synced(device: Device, command: CommandBuffer, fence: Fence, waits: List<SemaphoreWait>, signals: List<Semaphore>) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.present(device: Device, acquisition: Acquisition, wait: Semaphore, fence: Fence) -> IO(VkResult(PresentOutcome)):  import "./src/native.c"  import "./src/native.js"def Device.descriptor_set_layout_raw(device: Device, info: DescriptorSetLayoutCreateInfo) -> IO(VkResult(DescriptorSetLayout)):  import "./src/native.c"  import "./src/native.js"def Device.destroy_descriptor_set_layout(device: Device, layout: DescriptorSetLayout) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.create_descriptor_pool(device: Device, info: DescriptorPoolCreateInfo) -> IO(VkResult(DescriptorPool)):  import "./src/native.c"  import "./src/native.js"def Device.destroy_descriptor_pool(device: Device, pool: DescriptorPool) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.reset_descriptor_pool(device: Device, pool: DescriptorPool) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.allocate_descriptor_set(device: Device, pool: DescriptorPool, layout: DescriptorSetLayout) -> IO(VkResult(DescriptorSet)):  import "./src/native.c"  import "./src/native.js"def Device.free_descriptor_set(device: Device, set: DescriptorSet) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.update_descriptor_set(device: Device, set: DescriptorSet, writes: List<DescriptorWrite>) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.create_sampler(device: Device, info: SamplerCreateInfo) -> IO(VkResult(Sampler)):  import "./src/native.c"  import "./src/native.js"def Device.destroy_sampler(device: Device, sampler: Sampler) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def CommandBuffer.bind_descriptor_sets(command: CommandBuffer, first: U32, sets: List<DescriptorSet>) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def CommandBuffer.use_acquisition(command: CommandBuffer, acquisition: Acquisition) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.timestamp_properties(device: Device) -> IO(VkResult(TimestampProperties)):  import "./src/native.c"  import "./src/native.js"def Device.create_timestamp_pool(device: Device, count: U32) -> IO(VkResult(QueryPool)):  import "./src/native.c"  import "./src/native.js"def Device.destroy_query_pool(device: Device, pool: QueryPool) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def CommandBuffer.reset_timestamp_queries(command: CommandBuffer, pool: QueryPool, first: U32, count: U32) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def CommandBuffer.write_timestamp(command: CommandBuffer, pool: QueryPool, query: U32, stage: U32) -> IO(VkResult(Unit)):  import "./src/native.c"  import "./src/native.js"def Device.timestamp_results(device: Device, pool: QueryPool, first: U32, count: U32) -> IO(VkResult(List<Timestamp>)):  import "./src/native.c"  import "./src/native.js"def Device.timestamp_duration(device: Device, start: W.U64, end: W.U64, cpu_bound_ns: W.U64) -> IO(VkResult(F32)):  import "./src/native.c"  import "./src/native.js"def monotonic_ns() -> IO(VkResult(W.U64)):  import "./src/native.c"  import "./src/native.js"# END GENERATED EFFECTSdef requirements_from_words(words: (U32 & U32) & ((U32 & U32) & U32)) -> MemoryRequirements:  (size, (alignment, bits)) = words  MemoryRequirements{Core.size_from_words(size), Core.size_from_words(alignment), bits}def requirements_result(result: VkResult(((U32 & U32) & ((U32 & U32) & U32)))) -> VkResult(MemoryRequirements):  match result:    case Fail{error}:      Fail{error}    case Done{words}:      Done{requirements_from_words(words)}def Device.get_buffer_memory_requirements(device: Device, buffer: Buffer) -> IO(VkResult(MemoryRequirements)):  do IO<VkResult(MemoryRequirements)>:    result : VkResult(((U32 & U32) & ((U32 & U32) & U32))) <- Device.buffer_requirements_raw(device, buffer)    return requirements_result(result)def memory_types_from_words(words: List<(U32 & U32)>) -> List<Core.MemoryType>:  match words:    case Nil{}:      Nil{}    case Con{(flags, heap), rest}:      Core.MemoryType{flags, heap} <> memory_types_from_words(rest)def memory_types_result(result: VkResult(List<(U32 & U32)>)) -> VkResult(List<Core.MemoryType>):  match result:    case Fail{error}:      Fail{error}    case Done{words}:      Done{memory_types_from_words(words)}def Instance.get_physical_device_memory_properties(instance: Instance, physical: PhysicalDevice) -> IO(VkResult(List<Core.MemoryType>)):  do IO<VkResult(List<Core.MemoryType>)>:    result : VkResult(List<(U32 & U32)>) <- Instance.memory_types_raw(instance, physical)    return memory_types_result(result)def heaps_from_words(words: List<((U32 & U32) & U32)>) -> List<MemoryHeap>:  match words:    case Nil{}:      Nil{}    case Con{(size, flags), rest}:      MemoryHeap{Core.size_from_words(size), flags} <> heaps_from_words(rest)def heaps_result(result: VkResult(List<((U32 & U32) & U32)>)) -> VkResult(List<MemoryHeap>):  match result:    case Fail{error}:      Fail{error}    case Done{words}:      Done{heaps_from_words(words)}def Instance.get_physical_device_memory_heaps(instance: Instance, physical: PhysicalDevice) -> IO(VkResult(List<MemoryHeap>)):  do IO<VkResult(List<MemoryHeap>)>:    result : VkResult(List<((U32 & U32) & U32)>) <- Instance.memory_heaps_raw(instance, physical)    return heaps_result(result)def limits_from_words(words: LimitsWords()) -> PhysicalDeviceLimits:  (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (atom, (offset, (row, granularity))))))))))))) = words  PhysicalDeviceLimits{a,b,c,d,e,f,g,h,i,j,Core.size_from_words(atom),Core.size_from_words(offset),Core.size_from_words(row),Core.size_from_words(granularity)}def limits_result(result: VkResult(LimitsWords())) -> VkResult(PhysicalDeviceLimits):  match result:    case Fail{error}:      Fail{error}    case Done{words}:      Done{limits_from_words(words)}def Instance.get_physical_device_limits(instance: Instance, physical: PhysicalDevice) -> IO(VkResult(PhysicalDeviceLimits)):  do IO<VkResult(PhysicalDeviceLimits)>:    result : VkResult(LimitsWords()) <- Instance.limits_raw(instance, physical)    return limits_result(result)def Entry.finish(-A: Type, result: VkResult(A), cleanup: VkResult(Unit)) -> VkResult(A):  match result cleanup:    case Fail{(code, message)} Fail{(cleanup_code, cleanup_message)}:      Fail{(code, message ++ "; cleanup error " ++ U32.show(cleanup_code) ++ ": " ++ cleanup_message)}    case Fail{error} Done{unit}:      Fail{error}    case Done{value} Done{unit}:      Done{value}    case Done{value} Fail{error}:      Fail{error}def Entry.run_loaded(-A: Type, body: Entry -> IO(VkResult(A)), loaded: VkResult(Entry)) -> IO(VkResult(A)):  match loaded:    case Fail{error}:      IO.pure(VkResult(A), Fail{error})    case Done{+entry}:      do IO<VkResult(A)>:        result : VkResult(A) <- body(entry)        cleanup : VkResult(Unit) <- Entry.close(entry)        return Entry.finish(A, result, cleanup)def Entry.with(-A: Type, body: Entry -> IO(VkResult(A))) -> IO(VkResult(A)):  do IO<VkResult(A)>:    loaded : VkResult(Entry) <- Entry.load()    Entry.run_loaded(A, body, loaded)def ImageFormatWords() -> Type:  (U32 & U32) & ((U32 & U32) & ((U32 & U32) & (U32 & U32)))def image_format_from_words(words: ImageFormatWords()) -> ImageFormatProperties:  ((width,height),((depth,mips),((layers,samples),size))) = words  ImageFormatProperties{width,height,depth,mips,layers,samples,Core.size_from_words(size)}def image_format_result(result: VkResult(ImageFormatWords())) -> VkResult(ImageFormatProperties):  match result:    case Fail{error}:      Fail{error}    case Done{words}:      Done{image_format_from_words(words)}def Instance.get_physical_device_image_format_properties(instance: Instance, physical: PhysicalDevice, info: ImageFormatInfo) -> IO(VkResult(ImageFormatProperties)):  do IO<VkResult(ImageFormatProperties)>:    result : VkResult(ImageFormatWords()) <- Instance.image_format_properties_raw(instance,physical,info)    return image_format_result(result)def Device.get_image_memory_requirements(device: Device, image: ImageHandle) -> IO(VkResult(MemoryRequirements)):  do IO<VkResult(MemoryRequirements)>:    result : VkResult(((U32 & U32) & ((U32 & U32) & U32))) <- Device.image_requirements_raw(device,image)    return requirements_result(result)