-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | WGPU -- -- A high-level binding to WGPU. @package wgpu-hs @version 0.2.0.1 -- | Layout of this module should be guided by the evolving WebGPU -- Specification. module WGPU -- | Instance of the WGPU API. -- -- An instance is loaded from a dynamic library using the -- withInstance function. data Instance -- | Load the WGPU API from a dynamic library and supply an Instance -- to a program. -- -- This is the same as withInstance, except that it uses a -- default, per-platform name for the library, based on the value -- returned by os. withPlatformInstance :: Maybe LogCallback -> (Instance -> IO a) -> IO a -- | Load the WGPU API from a dynamic library and supply an Instance -- to a program. withInstance :: FilePath -> Maybe LogCallback -> (Instance -> IO a) -> IO a -- | Handle to a presentable surface. -- -- A Surface presents a platform-specific surface (eg. a window) -- on to which rendered images may be presented. A Surface can be -- created for a GLFW window using createGLFWSurface. data Surface -- | Create a WGPU Surface for a GLFW Window. -- -- This function is not part of the wgpu-native API, but is part -- of the Haskell API until the native WGPU API has a better story around -- windowing. createGLFWSurface :: Instance -> Window -> IO Surface -- | Handle to a physical graphics and/or compute device. -- -- Request an Adapter for a Surface using the -- requestAdapter function. data Adapter -- | Request an Adapter that is compatible with a given -- Surface. -- -- This action blocks until an available adapter is returned. requestAdapter :: Surface -> IO (Maybe Adapter) -- | An open connection to a graphics and/or compute device. -- -- A Device may be created using the requestDevice -- function. data Device -- | Describes a Device. data DeviceDescriptor DeviceDescriptor :: !Text -> !Features -> !Limits -> DeviceDescriptor -- | Debug label for the device. [deviceLabel] :: DeviceDescriptor -> !Text -- | Features that the device should support. [features] :: DeviceDescriptor -> !Features -- | Limits that the device should support (minimum values). [limits] :: DeviceDescriptor -> !Limits -- | Device limits. -- -- Represents the set of limits an adapter/device supports. data Limits Limits :: !Word32 -> !Word32 -> !Word32 -> !Word32 -> !Word32 -> !Word32 -> !Word32 -> !Word32 -> Limits -- | Maximum allowed value for the width of a 1D texture. [maxTextureDimension1D] :: Limits -> !Word32 -- | Maximum allowed value for the width and height of a 2D texture. [maxTextureDimension2D] :: Limits -> !Word32 -- | Maximum allowed value for the width, height or depth of a 3D texture. [maxTextureDimension3D] :: Limits -> !Word32 -- | Maximum allowed value for the array layers of a texture. [maxTextureArrayLayers] :: Limits -> !Word32 -- | Amount of bind groups that can be attached to a pipeline at the same -- time. [maxBindGroups] :: Limits -> !Word32 -- | Amount of storage buffer bindings that can be dynamic in a single -- pipeline. [maxDynamicStorageBuffersPerPipelineLayout] :: Limits -> !Word32 -- | Amount of sampled textures visible in a single shader stage. [maxStorageBuffersPerShaderStage] :: Limits -> !Word32 -- | Maximum size in bytes of a binding to a uniform buffer. [maxStorageBufferBindingSize] :: Limits -> !Word32 -- | Device features that are not guaranteed to be supported. -- -- newtype Features Features :: Bool -> Features [textureAdapterSpecificFormatFeatures] :: Features -> Bool -- | Requests a connection to a physical device, creating a logical device. -- -- This action blocks until an available device is returned. requestDevice :: Adapter -> DeviceDescriptor -> IO (Maybe Device) -- | Handle to a texture view. -- -- A TextureView describes a texture and associated metadata -- needed by a rendering pipeline or bind group. data TextureView -- | Dimensions of a particular texture view. data TextureViewDimension TextureViewDimension1D :: TextureViewDimension TextureViewDimension2D :: TextureViewDimension TextureViewDimension2DArray :: TextureViewDimension TextureViewDimensionCube :: TextureViewDimension TextureViewDimensionCubeArray :: TextureViewDimension TextureViewDimension3D :: TextureViewDimension -- | Texture data format. data TextureFormat TextureFormatR8Unorm :: TextureFormat TextureFormatR8Snorm :: TextureFormat TextureFormatR8Uint :: TextureFormat TextureFormatR8Sint :: TextureFormat TextureFormatR16Uint :: TextureFormat TextureFormatR16Sint :: TextureFormat TextureFormatR16Float :: TextureFormat TextureFormatRG8Unorm :: TextureFormat TextureFormatRG8Snorm :: TextureFormat TextureFormatRG8Uint :: TextureFormat TextureFormatRG8Sint :: TextureFormat TextureFormatR32Float :: TextureFormat TextureFormatR32Uint :: TextureFormat TextureFormatR32Sint :: TextureFormat TextureFormatRG16Uint :: TextureFormat TextureFormatRG16Sint :: TextureFormat TextureFormatRG16Float :: TextureFormat TextureFormatRGBA8Unorm :: TextureFormat TextureFormatRGBA8UnormSrgb :: TextureFormat TextureFormatRGBA8Snorm :: TextureFormat TextureFormatRGBA8Uint :: TextureFormat TextureFormatRGBA8Sint :: TextureFormat TextureFormatBGRA8Unorm :: TextureFormat TextureFormatBGRA8UnormSrgb :: TextureFormat TextureFormatRGB10A2Unorm :: TextureFormat TextureFormatRG11B10Ufloat :: TextureFormat TextureFormatRGB9E5Ufloat :: TextureFormat TextureFormatRG32Float :: TextureFormat TextureFormatRG32Uint :: TextureFormat TextureFormatRG32Sint :: TextureFormat TextureFormatRGBA16Uint :: TextureFormat TextureFormatRGBA16Sint :: TextureFormat TextureFormatRGBA16Float :: TextureFormat TextureFormatRGBA32Float :: TextureFormat TextureFormatRGBA32Uint :: TextureFormat TextureFormatRGBA32Sint :: TextureFormat TextureFormatDepth32Float :: TextureFormat TextureFormatDepth24Plus :: TextureFormat TextureFormatDepth24PlusStencil8 :: TextureFormat TextureFormatStencil8 :: TextureFormat TextureFormatBC1RGBAUnorm :: TextureFormat TextureFormatBC1RGBAUnormSrgb :: TextureFormat TextureFormatBC2RGBAUnorm :: TextureFormat TextureFormatBC2RGBAUnormSrgb :: TextureFormat TextureFormatBC3RGBAUnorm :: TextureFormat TextureFormatBC3RGBAUnormSrgb :: TextureFormat TextureFormatBC4RUnorm :: TextureFormat TextureFormatBC4RSnorm :: TextureFormat TextureFormatBC5RGUnorm :: TextureFormat TextureFormatBC5RGSnorm :: TextureFormat TextureFormatBC6HRGBUfloat :: TextureFormat TextureFormatBC6HRGBFloat :: TextureFormat TextureFormatBC7RGBAUnorm :: TextureFormat TextureFormatBC7RGBAUnormSrgb :: TextureFormat -- | Different ways you can use a texture. -- -- The usages determine from what kind of memory the texture is -- allocated, and in what actions the texture can partake. data TextureUsage TextureUsageCopySrc :: TextureUsage TextureUsageCopyDst :: TextureUsage TextureUsageSampled :: TextureUsage TextureUsageStorage :: TextureUsage TextureUsageRenderAttachment :: TextureUsage data SwapChain -- | Describes a swapchain. data SwapChainDescriptor SwapChainDescriptor :: !Text -> !TextureUsage -> !TextureFormat -> !Word32 -> !Word32 -> !PresentMode -> SwapChainDescriptor -- | Debugging label for the swap chain. [swapChainLabel] :: SwapChainDescriptor -> !Text -- | The usage of the swap chain. The only supported usage is -- TextureUsageRenderAttachment. [usage] :: SwapChainDescriptor -> !TextureUsage -- | Texture format of the swap chain. The only guaranteed formats are -- TextureFormatBgra8Unorm and -- TextureFormatBgra8UnormSrgb. To determine the preferred -- texture format for a surface, use the -- getSwapChainPreferredFormat function. [swapChainFormat] :: SwapChainDescriptor -> !TextureFormat -- | Width of the swap chain. Must be the same size as the surface. [width] :: SwapChainDescriptor -> !Word32 -- | Height of the swap chain. Must be the same size as the surface. [height] :: SwapChainDescriptor -> !Word32 -- | Presentation mode of the swap chain. [presentMode] :: SwapChainDescriptor -> !PresentMode -- | Behaviour of the presentation engine based on frame rate. data PresentMode -- | The presentation engine does not wait for a vertical blanking -- period and the request is presented immediately. This is a low-latency -- presentation mode, but visible tearing may be observed. Will fallback -- to Fifo if unavailable on the selected platform and backend. -- Not optimal for mobile. PresentModeImmediate :: PresentMode -- | The presentation engine waits for the next vertical blanking period to -- update the current image, but frames may be submitted without delay. -- This is a low-latency presentation mode and visible tearing will not -- be observed. Will fallback to Fifo if unavailable on the selected -- platform and backend. Not optimal for mobile. PresentModeMailbox :: PresentMode -- | The presentation engine waits for the next vertical blanking period to -- update the current image. The framerate will be capped at the display -- refresh rate, corresponding to the VSync. Tearing cannot be observed. -- Optimal for mobile. PresentModeFifo :: PresentMode -- | Returns an optimal texture format to use for the swapchain with this -- adapter and surface. getSwapChainPreferredFormat :: Surface -> Adapter -> IO TextureFormat -- | Createa a new SwapChain which targets a Surface. -- -- To determine the preferred TextureFormat for the -- Surface, use the getSwapChainPreferredFormat function. createSwapChain :: Device -> Surface -> SwapChainDescriptor -> IO SwapChain -- | Get the TextureView for the current swap chain frame. getSwapChainCurrentTextureView :: SwapChain -> IO TextureView -- | Present the latest swap chain image. swapChainPresent :: SwapChain -> IO () -- | Handle to a binding group layout. -- -- A BindGroupLayout is a handle to the GPU-side layout of a -- binding group. data BindGroupLayout -- | Describes a BindGroupLayout. data BindGroupLayoutDescriptor BindGroupLayoutDescriptor :: !Text -> Vector BindGroupLayoutEntry -> BindGroupLayoutDescriptor -- | Debug label of the bind group layout. [bindGroupLabel] :: BindGroupLayoutDescriptor -> !Text -- | Sequence of entries in this bind group layout. [entries] :: BindGroupLayoutDescriptor -> Vector BindGroupLayoutEntry -- | Describes a single binding inside a bind group. data BindGroupLayoutEntry BindGroupLayoutEntry :: !Binding -> !ShaderStage -> !BindingType -> BindGroupLayoutEntry -- | Binding index. Must match a shader index, and be unique inside a bind -- group layout. [binding] :: BindGroupLayoutEntry -> !Binding -- | Which shader stages can see this binding. [visibility] :: BindGroupLayoutEntry -> !ShaderStage -- | Type of the binding. [bindGroupLayoutEntryType] :: BindGroupLayoutEntry -> !BindingType -- | Binding index. -- -- This must match a shader index, and be unique inside a binding group -- layout. newtype Binding Binding :: Word32 -> Binding [unBinding] :: Binding -> Word32 -- | Describes the shader stages from which a binding will be visible. data ShaderStage ShaderStage :: !Bool -> !Bool -> !Bool -> ShaderStage -- | Binding is visible from the vertex shader of a render pipeline. [stageVertex] :: ShaderStage -> !Bool -- | Binding is visible from the fragment shader of a render pipeline. [stageFragment] :: ShaderStage -> !Bool -- | Binding is visible from the compute shader of a compute pipeline. [stageCompute] :: ShaderStage -> !Bool -- | Specifies type of a binding. data BindingType -- | A buffer binding. BindingTypeBuffer :: !BufferBindingLayout -> BindingType -- | A sampler that can be used to sample a texture. BindingTypeSampler :: !SamplerBindingLayout -> BindingType -- | A texture binding. BindingTypeTexture :: !TextureBindingLayout -> BindingType -- | A storage texture. BindingTypeStorageTexture :: !StorageTextureBindingLayout -> BindingType -- | A buffer binding. data BufferBindingLayout BufferBindingLayout :: !BufferBindingType -> !Bool -> !SMaybe Word64 -> BufferBindingLayout -- | Sub-type of the buffer binding. [bindingBufferLayoutType] :: BufferBindingLayout -> !BufferBindingType -- | Indicates that the binding has a dynamic offset. One offset must be -- passed when setting the bind group in the render pass. [hasDynamicOffset] :: BufferBindingLayout -> !Bool -- | Minimum size of a corresponding buffer binding required to match this -- entry. [minBindingSize] :: BufferBindingLayout -> !SMaybe Word64 -- | A sampler binding that can be used to sample a texture. data SamplerBindingLayout SamplerBindingLayoutFiltering :: SamplerBindingLayout SamplerBindingLayoutNonFiltering :: SamplerBindingLayout SamplerBindingLayoutComparison :: SamplerBindingLayout -- | A texture binding. data TextureBindingLayout TextureBindingLayout :: !TextureSampleType -> !TextureViewDimension -> !Bool -> TextureBindingLayout -- | Sample type of the texture binding. [sampleType] :: TextureBindingLayout -> !TextureSampleType -- | Dimension of the texture view that is going to be sampled. [textureViewDimension] :: TextureBindingLayout -> !TextureViewDimension -- | True if the texture has a sample count greater than 1. [multiSampled] :: TextureBindingLayout -> !Bool -- | A storage texture binding. data StorageTextureBindingLayout StorageTextureBindingLayout :: !StorageTextureAccess -> !TextureFormat -> !TextureViewDimension -> StorageTextureBindingLayout -- | Permitted access to this texture. [access] :: StorageTextureBindingLayout -> !StorageTextureAccess -- | Format of the texture. [storageTextureFormat] :: StorageTextureBindingLayout -> !TextureFormat -- | Dimension of the texture view that is going to be sampled. [storageTextureViewDimension] :: StorageTextureBindingLayout -> !TextureViewDimension -- | Specific method of allowed access to a storage texture. data StorageTextureAccess StorageTextureAccessReadOnly :: StorageTextureAccess StorageTextureAccessWriteOnly :: StorageTextureAccess StorageTextureAccessReadWrite :: StorageTextureAccess -- | Specific type of a sample in a texture binding. data TextureSampleType TextureSampleTypeFloat :: !Bool -> TextureSampleType [filterable] :: TextureSampleType -> !Bool TextureSampleTypeDepth :: TextureSampleType TextureSampleTypeSignedInt :: TextureSampleType TextureSampleTypeUnsignedInt :: TextureSampleType -- | Specific type of a buffer binding. data BufferBindingType Uniform :: BufferBindingType Storage :: !Bool -> BufferBindingType [readOnly] :: BufferBindingType -> !Bool -- | Creates a BindGroupLayout. createBindGroupLayout :: Device -> BindGroupLayoutDescriptor -> IO BindGroupLayout -- | Handle to a compiled shader module. data ShaderModule -- | Descriptor for a shader module. data ShaderModuleDescriptor ShaderModuleDescriptor :: !Text -> !ShaderSource -> ShaderModuleDescriptor -- | Debug label of the shader module. [shaderLabel] :: ShaderModuleDescriptor -> !Text -- | Source code for the shader. [source] :: ShaderModuleDescriptor -> !ShaderSource -- | Source for a shader module. data ShaderSource -- | Use shader source from a SPIRV module (pre-compiled). ShaderSourceSPIRV :: !SPIRV -> ShaderSource -- | Use shader source from WGSL string. ShaderSourceWGSL :: !WGSL -> ShaderSource -- | Pre-compiled SPIRV module bytes. newtype SPIRV SPIRV :: ByteString -> SPIRV -- | WGSL shader source code. newtype WGSL WGSL :: Text -> WGSL -- | Name of a shader entry point. newtype ShaderEntryPoint ShaderEntryPoint :: Text -> ShaderEntryPoint [unShaderEntryPoint] :: ShaderEntryPoint -> Text -- | Create a shader module from either SPIR-V or WGSL source code. createShaderModule :: Device -> ShaderModuleDescriptor -> IO ShaderModule -- | Create a shader module from SPIR-V source code. createShaderModuleSPIRV :: Device -> Text -> SPIRV -> IO ShaderModule -- | Create a shader module from WGSL source code. createShaderModuleWGSL :: Device -> Text -> WGSL -> IO ShaderModule data PipelineLayout data RenderPipeline -- | Describes a pipeline layout. data PipelineLayoutDescriptor PipelineLayoutDescriptor :: !Text -> !Vector BindGroupLayout -> PipelineLayoutDescriptor -- | Debug label of the pipeline layout. [pipelineLabel] :: PipelineLayoutDescriptor -> !Text -- | Bind groups that this pipeline uses. [bindGroupLayouts] :: PipelineLayoutDescriptor -> !Vector BindGroupLayout -- | Describes a render (graphics) pipeline. data RenderPipelineDescriptor RenderPipelineDescriptor :: !Text -> !SMaybe PipelineLayout -> !VertexState -> !PrimitiveState -> !SMaybe DepthStencilState -> !MultisampleState -> !SMaybe FragmentState -> RenderPipelineDescriptor -- | Debug label of the pipeline. [renderPipelineLabel] :: RenderPipelineDescriptor -> !Text -- | The layout of bind groups for this pipeline. [layout] :: RenderPipelineDescriptor -> !SMaybe PipelineLayout -- | Vertex state. [vertex] :: RenderPipelineDescriptor -> !VertexState -- | Primitive state. [primitive] :: RenderPipelineDescriptor -> !PrimitiveState -- | Depth stencil state. [depthStencil] :: RenderPipelineDescriptor -> !SMaybe DepthStencilState -- | Multisample state. [multisample] :: RenderPipelineDescriptor -> !MultisampleState -- | Fragment state. [fragment] :: RenderPipelineDescriptor -> !SMaybe FragmentState -- | Vertex format for a vertex attribute. data VertexFormat VertexFormatUint8x2 :: VertexFormat VertexFormatUint8x4 :: VertexFormat VertexFormatSint8x2 :: VertexFormat VertexFormatSint8x4 :: VertexFormat VertexFormatUnorm8x2 :: VertexFormat VertexFormatUnorm8x4 :: VertexFormat VertexFormatSnorm8x2 :: VertexFormat VertexFormatSnorm8x4 :: VertexFormat VertexFormatUint16x2 :: VertexFormat VertexFormatUint16x4 :: VertexFormat VertexFormatSint16x2 :: VertexFormat VertexFormatSint16x4 :: VertexFormat VertexFormatUnorm16x2 :: VertexFormat VertexFormatUnorm16x4 :: VertexFormat VertexFormatSnorm16x2 :: VertexFormat VertexFormatSnorm16x4 :: VertexFormat VertexFormatFloat16x2 :: VertexFormat VertexFormatFloat16x4 :: VertexFormat VertexFormatFloat32 :: VertexFormat VertexFormatFloat32x2 :: VertexFormat VertexFormatFloat32x3 :: VertexFormat VertexFormatFloat32x4 :: VertexFormat VertexFormatUint32 :: VertexFormat VertexFormatUint32x2 :: VertexFormat VertexFormatUint32x3 :: VertexFormat VertexFormatUint32x4 :: VertexFormat VertexFormatSint32 :: VertexFormat VertexFormatSint32x2 :: VertexFormat VertexFormatSint32x3 :: VertexFormat VertexFormatSint32x4 :: VertexFormat -- | Vertex inputs (attributes) to shaders. data VertexAttribute VertexAttribute :: VertexFormat -> Word64 -> Word32 -> VertexAttribute -- | Format of the input. [vertexFormat] :: VertexAttribute -> VertexFormat -- | Byte offset of the start of the input. [offset] :: VertexAttribute -> Word64 -- | Location for this input. Must match the location in the shader. [shaderLocation] :: VertexAttribute -> Word32 -- | Determines when vertex data is advanced. data InputStepMode -- | Input data is advanced every vertex. InputStepModeVertex :: InputStepMode -- | Input data is advanced every instance. InputStepModeInstance :: InputStepMode -- | Describes how a vertex buffer is interpreted. data VertexBufferLayout VertexBufferLayout :: !Word64 -> !InputStepMode -> !Vector VertexAttribute -> VertexBufferLayout -- | The stride, in bytes, between elements of the buffer. [arrayStride] :: VertexBufferLayout -> !Word64 -- | How often the vertex buffer is stepped forward (per vertex or per -- instance). [stepMode] :: VertexBufferLayout -> !InputStepMode -- | List of attributes that comprise a single vertex. [attributes] :: VertexBufferLayout -> !Vector VertexAttribute -- | Describes the vertex process in a render pipeline. data VertexState VertexState :: !ShaderModule -> !ShaderEntryPoint -> !Vector VertexBufferLayout -> VertexState -- | The compiled shader module for this stage. [vertexShaderModule] :: VertexState -> !ShaderModule -- | The name of the entry point in the compiled shader. There must be a -- function that returns void with this name in the shader. [vertexEntryPoint] :: VertexState -> !ShaderEntryPoint -- | The format of any vertex buffers used with this pipeline. [buffers] :: VertexState -> !Vector VertexBufferLayout -- | Primitive type out of which an input mesh is composed. data PrimitiveTopology PrimitiveTopologyPointList :: PrimitiveTopology PrimitiveTopologyLineList :: PrimitiveTopology PrimitiveTopologyLineStrip :: PrimitiveTopology PrimitiveTopologyTriangleList :: PrimitiveTopology PrimitiveTopologyTriangleStrip :: PrimitiveTopology -- | Format of indices used within a pipeline. data IndexFormat -- | Indices are 16-bit unsigned integers (Word16) IndexFormatUint16 :: IndexFormat -- | Indices are 32-bit unsigned integers (Word32) IndexFormatUint32 :: IndexFormat -- | Winding order which classifies the "front" face. data FrontFace -- | Triangles with counter-clockwise vertices are the front face. FrontFaceCCW :: FrontFace -- | Triangles with clockwise vertices are the front face. FrontFaceCW :: FrontFace -- | Whether to cull the face of a vertex. data CullMode -- | Cull the front face. CullModeFront :: CullMode -- | Cull the back face. CullModeBack :: CullMode -- | Do not cull either face. CullModeNone :: CullMode -- | Describes the state of primitive assembly and rasterization in a -- render pipeline. -- -- Differences between this and the Rust API: - no clamp_depth -- member - no polygon_mode member - no conservative -- member data PrimitiveState PrimitiveState :: !PrimitiveTopology -> !SMaybe IndexFormat -> !FrontFace -> !CullMode -> PrimitiveState -- | The primitive topology used to interpret vertices. [topology] :: PrimitiveState -> !PrimitiveTopology -- | When drawing strip topologies with indices, this is the required -- format for the index buffer. This has no effect for non-indexed or -- non-strip draws. [stripIndexFormat] :: PrimitiveState -> !SMaybe IndexFormat -- | The face to consider the front for the purpose of culling and stencil -- operations. [frontFace] :: PrimitiveState -> !FrontFace -- | The face culling mode. [cullMode] :: PrimitiveState -> !CullMode -- | Operation to perform on a stencil value. data StencilOperation StencilOperationKeep :: StencilOperation StencilOperationZero :: StencilOperation StencilOperationReplace :: StencilOperation StencilOperationInvert :: StencilOperation StencilOperationIncrementClamp :: StencilOperation StencilOperationDecrementClamp :: StencilOperation StencilOperationIncrementWrap :: StencilOperation StencilOperationDecrementWrap :: StencilOperation -- | State of the stencil operation (fixed pipeline stage). data StencilState StencilState :: !StencilFaceState -> !StencilFaceState -> !Word8 -> !Word8 -> StencilState -- | Front face mode. [front] :: StencilState -> !StencilFaceState -- | Back face mode. [back] :: StencilState -> !StencilFaceState -- | Stencil values are AND-ed with this mask when reading and writing from -- the stencil buffer. [readMask] :: StencilState -> !Word8 -- | Stencil values are AND-ed with this mask when writing to the stencil -- buffer. [writeMask] :: StencilState -> !Word8 -- | Describes the biasing setting for the depth target. data DepthBiasState DepthBiasState :: !Int32 -> !Float -> !Float -> DepthBiasState [constant] :: DepthBiasState -> !Int32 -- | Slope depth biasing factor. [slopeScale] :: DepthBiasState -> !Float -- | Depth bias clamp value (absolute). [clamp] :: DepthBiasState -> !Float -- | Describes the depth / stencil state of a render pipeline. data DepthStencilState DepthStencilState :: !TextureFormat -> !Bool -> !CompareFunction -> !StencilState -> !DepthBiasState -> DepthStencilState -- | Format of the depth/stencil buffer. This must be a special depth -- format, and must match the format of the depth/stencil attachment in -- the command encoder. [depthStencilTextureFormat] :: DepthStencilState -> !TextureFormat -- | If disabled, depth will not be written to. [depthWriteEnabled] :: DepthStencilState -> !Bool -- | Comparison function used to compare depth values in the depth test. [depthCompare] :: DepthStencilState -> !CompareFunction -- | Stencil state. [stencil] :: DepthStencilState -> !StencilState -- | Depth bias state. [bias] :: DepthStencilState -> !DepthBiasState -- | Describes the multi-sampling state of a render pipeline. data MultisampleState MultisampleState :: Word32 -> Word32 -> Bool -> MultisampleState -- | Number of samples calculated per pixel (for MSAA). For -- non-multisampled textures, this should be 1. [count] :: MultisampleState -> Word32 -- | Bitmask that restricts the samples of a pixel modified by this -- pipeline. All samples can be enabled by using 0XFFFFFFFF (ie. -- zero complement). [mask] :: MultisampleState -> Word32 -- | When enabled, produces another sample mask per pixel based on the -- alpha output value, and that is AND-ed with the sample mask and the -- primitive coverage to restrict the set of samples affected by a -- primitive. [alphaToCoverageEnabled] :: MultisampleState -> Bool -- | Alpha blend factor. data BlendFactor BlendFactorZero :: BlendFactor BlendFactorOne :: BlendFactor BlendFactorSrc :: BlendFactor BlendFactorOneMinusSrc :: BlendFactor BlendFactorSrcAlpha :: BlendFactor BlendFactorOneMinusSrcAlpha :: BlendFactor BlendFactorDst :: BlendFactor BlendFactorOneMinusDst :: BlendFactor BlendFactorDstAlpha :: BlendFactor BlendFactorOneMinusDstAlpha :: BlendFactor BlendFactorSrcAlphaSaturated :: BlendFactor BlendFactorConstant :: BlendFactor BlendFactorOneMinusConstant :: BlendFactor -- | Alpha blending operation. data BlendOperation BlendOperationAdd :: BlendOperation BlendOperationSubtract :: BlendOperation BlendOperationReverseSubtract :: BlendOperation BlendOperationMin :: BlendOperation BlendOperationMax :: BlendOperation -- | Describes the blend component of a pipeline. data BlendComponent BlendComponent :: !BlendFactor -> !BlendFactor -> !BlendOperation -> BlendComponent -- | Multiplier for the source, which is produced by the fragment shader. [srcFactor] :: BlendComponent -> !BlendFactor -- | Multiplier for the destination, which is stored in the target. [dstFactor] :: BlendComponent -> !BlendFactor -- | Binary operation applied to the source and destination, multiplied by -- their respective factors. [operation] :: BlendComponent -> !BlendOperation -- | Describes the blend state of a render pipeline. data BlendState BlendState :: !BlendComponent -> !BlendComponent -> BlendState -- | Color equation. [blendColor] :: BlendState -> !BlendComponent -- | Alpha equation. [blendAlpha] :: BlendState -> !BlendComponent -- | Describes which color channels are written. data ColorWriteMask ColorWriteMask :: !Bool -> !Bool -> !Bool -> !Bool -> ColorWriteMask [maskRed] :: ColorWriteMask -> !Bool [maskGreen] :: ColorWriteMask -> !Bool [maskBlue] :: ColorWriteMask -> !Bool [maskAlpha] :: ColorWriteMask -> !Bool -- | Describes the color state of a render pipeline. data ColorTargetState ColorTargetState :: !TextureFormat -> !SMaybe BlendState -> !ColorWriteMask -> ColorTargetState -- | The texture format of the image that this pipeline will render to. -- Must match the format of the corresponding color attachment in the -- command encoder. [colorTextureFormat] :: ColorTargetState -> !TextureFormat -- | The blending that is used for this pipeline. [blend] :: ColorTargetState -> !SMaybe BlendState -- | Mask which enables or disables writes to different color/alpha -- channels. [colorWriteMask] :: ColorTargetState -> !ColorWriteMask -- | Describes the fragment processing in a render pipeline. data FragmentState FragmentState :: !ShaderModule -> !ShaderEntryPoint -> !Vector ColorTargetState -> FragmentState -- | The compiled shader module for this stage. [fragmentShaderModule] :: FragmentState -> !ShaderModule -- | The entry point in the compiled shader. There must be a function that -- returns void with this name in the shader. [fragmentEntryPoint] :: FragmentState -> !ShaderEntryPoint -- | The color state of the render targets. [targets] :: FragmentState -> !Vector ColorTargetState -- | Create a pipeline layout. createPipelineLayout :: Device -> PipelineLayoutDescriptor -> IO PipelineLayout createRenderPipeline :: Device -> RenderPipelineDescriptor -> IO RenderPipeline -- | A ColorWriteMask that writes all colors and the alpha value. colorWriteMaskAll :: ColorWriteMask data CommandBuffer -- | Handle to an encoder for a series of GPU operations. -- -- A command encoder can record render passes, compute passes, and -- transfer operations between driver-managed resources like buffers and -- textures. data CommandEncoder data RenderPassEncoder -- | RGBA double-precision color. data Color Color :: Double -> Double -> Double -> Double -> Color [red] :: Color -> Double [green] :: Color -> Double [blue] :: Color -> Double [alpha] :: Color -> Double -- | Operation to perform to the output attachment at the start of a render -- pass. data LoadOp a -- | Clear with the specified color value. LoadOpClear :: !a -> LoadOp a -- | Load from memory. LoadOpLoad :: LoadOp a -- | Operation to perform to the output attachment at the end of the render -- pass. data StoreOp -- | Store the result. StoreOpStore :: StoreOp -- | Discard the result. StoreOpClear :: StoreOp data Operations a Operations :: !LoadOp a -> StoreOp -> Operations a [load] :: Operations a -> !LoadOp a [store] :: Operations a -> StoreOp -- | Describes a color attachment to a render pass. data RenderPassColorAttachment RenderPassColorAttachment :: !TextureView -> !SMaybe TextureView -> !Operations Color -> RenderPassColorAttachment -- | The view to use as an attachment. [colorView] :: RenderPassColorAttachment -> !TextureView -- | The view that will receive output if multisampling is used. [resolveTarget] :: RenderPassColorAttachment -> !SMaybe TextureView -- | What operations will be performed on this color attachment. [operations] :: RenderPassColorAttachment -> !Operations Color -- | Describes a depth/stencil attachment to a render pass. data RenderPassDepthStencilAttachment RenderPassDepthStencilAttachment :: !TextureView -> !SMaybe (Operations Float) -> !SMaybe (Operations Word32) -> RenderPassDepthStencilAttachment -- | The view to use as an attachment. [depthStencilView] :: RenderPassDepthStencilAttachment -> !TextureView -- | What operations will be performed on the depth part. [depthOps] :: RenderPassDepthStencilAttachment -> !SMaybe (Operations Float) -- | What operations will be performed on the stencil part. [stencilOps] :: RenderPassDepthStencilAttachment -> !SMaybe (Operations Word32) -- | Describes the attachments of a render pass. data RenderPassDescriptor RenderPassDescriptor :: !Text -> !Vector RenderPassColorAttachment -> !SMaybe RenderPassDepthStencilAttachment -> RenderPassDescriptor -- | Debugging label for the render pass. [renderPassLabel] :: RenderPassDescriptor -> !Text -- | Color attachments of the render pass. [colorAttachments] :: RenderPassDescriptor -> !Vector RenderPassColorAttachment -- | Depth and stencil attachments of the render pass. [depthStencilAttachment] :: RenderPassDescriptor -> !SMaybe RenderPassDepthStencilAttachment -- | Half open range. It includes the start value but not the -- end value. data Range a Range :: !a -> !a -> Range a [rangeStart] :: Range a -> !a [rangeLength] :: Range a -> !a -- | Create an empty command encoder. createCommandEncoder :: Device -> Text -> IO CommandEncoder -- | Finish encoding commands, returning a command buffer. commandEncoderFinish :: CommandEncoder -> Text -> IO CommandBuffer -- | Begins recording of a render pass. beginRenderPass :: CommandEncoder -> RenderPassDescriptor -> IO RenderPassEncoder -- | Sets the active render pipeline. -- -- Subsequent draw calls will exhibit the behaviour defined by the -- pipeline. renderPassSetPipeline :: RenderPassEncoder -> RenderPipeline -> IO () -- | Draws primitives from the active vertex buffers. renderPassDraw :: RenderPassEncoder -> Range Word32 -> Range Word32 -> IO () -- | Finish recording of a render pass. endRenderPass :: RenderPassEncoder -> IO () data Queue -- | Get the queue for a device. getQueue :: Device -> IO Queue -- | Submit a list of command buffers to a device queue. queueSubmit :: Queue -> Vector CommandBuffer -> IO () -- | Version of WGPU native. data Version Version :: !Word8 -> !Word8 -> !Word8 -> !Word8 -> Version [major] :: Version -> !Word8 [minor] :: Version -> !Word8 [patch] :: Version -> !Word8 [subPatch] :: Version -> !Word8 -- | Return the exact version of the WGPU native instance. getVersion :: Instance -> IO Version -- | Convert a Version value to a text string. -- --
--   >>> versionToText (Version 0 9 2 2)
--   "v0.9.2.2"
--   
versionToText :: Version -> Text -- | Logging level. data LogLevel Trace :: LogLevel Debug :: LogLevel Info :: LogLevel Warn :: LogLevel Error :: LogLevel -- | Logging callback function. type LogCallback = LogLevel -> Text -> IO () -- | Set the current logging level for the instance. setLogLevel :: Instance -> LogLevel -> IO () -- | A logging function which prints to stdout. -- -- This logging function can be supplied to withInstance to print -- logging messages to stdout for debugging purposes. logStdout :: LogLevel -> Text -> IO () -- | Convert a LogLevel to a text string. logLevelToText :: LogLevel -> Text -- | Comparison function used for depth and stencil operations. data CompareFunction CompareFunctionNever :: CompareFunction CompareFunctionLess :: CompareFunction CompareFunctionEqual :: CompareFunction CompareFunctionLessEqual :: CompareFunction CompareFunctionGreater :: CompareFunction CompareFunctionNotEqual :: CompareFunction CompareFunctionGreaterEqual :: CompareFunction CompareFunctionAlways :: CompareFunction -- | Strict version of the Maybe type. data SMaybe a SNothing :: SMaybe a SJust :: !a -> SMaybe a