-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | WGPU -- -- A high-level binding to WGPU. @package wgpu-hs @version 0.3.0.0 -- | 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 :: MonadIO m => (m Instance -> (Instance -> m ()) -> r) -> r -- | Load the WGPU API from a dynamic library and supply an Instance -- to a program. withInstance :: MonadIO m => FilePath -> (m Instance -> (Instance -> m ()) -> r) -> r -- | 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 -- | Handle to a physical graphics and/or compute device. -- -- Request an Adapter for a Surface using the -- requestAdapter function. data Adapter -- | Physical device type. data AdapterType AdapterTypeDiscreteGPU :: AdapterType AdapterTypeIntegratedGPU :: AdapterType AdapterTypeCPU :: AdapterType AdapterTypeUnknown :: AdapterType -- | Backends supported by WGPU. data BackendType BackendTypeNull :: BackendType BackendTypeD3D11 :: BackendType BackendTypeD3D12 :: BackendType BackendTypeMetal :: BackendType BackendTypeVulkan :: BackendType BackendTypeOpenGL :: BackendType BackendTypeOpenGLES :: BackendType data AdapterProperties AdapterProperties :: !Word32 -> !Word32 -> !Text -> !Text -> !AdapterType -> !BackendType -> AdapterProperties [deviceID] :: AdapterProperties -> !Word32 [vendorID] :: AdapterProperties -> !Word32 [adapterName] :: AdapterProperties -> !Text [driverDescription] :: AdapterProperties -> !Text [adapterType] :: AdapterProperties -> !AdapterType [backendType] :: AdapterProperties -> !BackendType -- | Request an Adapter that is compatible with a given -- Surface. -- -- This action blocks until an available adapter is returned. requestAdapter :: MonadIO m => Surface -> m (Maybe Adapter) -- | Get information about an adapter. getAdapterProperties :: MonadIO m => Adapter -> m AdapterProperties -- | Format adapter properties into a multi-line block of text. -- -- This can be useful for debugging purposes. adapterPropertiesToText :: AdapterProperties -> Text -- | 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 :: MonadIO m => Adapter -> DeviceDescriptor -> m (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 :: MonadIO m => Surface -> Adapter -> m TextureFormat -- | Createa a new SwapChain which targets a Surface. -- -- To determine the preferred TextureFormat for the -- Surface, use the getSwapChainPreferredFormat function. createSwapChain :: MonadIO m => Device -> Surface -> SwapChainDescriptor -> m SwapChain -- | Get the TextureView for the current swap chain frame. getSwapChainCurrentTextureView :: MonadIO m => SwapChain -> m TextureView -- | Present the latest swap chain image. swapChainPresent :: MonadIO m => SwapChain -> m () -- | 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 :: MonadIO m => Device -> BindGroupLayoutDescriptor -> m 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 :: MonadIO m => Device -> ShaderModuleDescriptor -> m ShaderModule -- | Create a shader module from SPIR-V source code. createShaderModuleSPIRV :: MonadIO m => Device -> Text -> SPIRV -> m ShaderModule -- | Create a shader module from WGSL source code. createShaderModuleWGSL :: MonadIO m => Device -> Text -> WGSL -> m 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 :: MonadIO m => Device -> PipelineLayoutDescriptor -> m PipelineLayout createRenderPipeline :: MonadIO m => Device -> RenderPipelineDescriptor -> m 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 :: {-# UNPACK #-} !Double -> {-# UNPACK #-} !Double -> {-# UNPACK #-} !Double -> {-# UNPACK #-} !Double -> Color [red] :: Color -> {-# UNPACK #-} !Double [green] :: Color -> {-# UNPACK #-} !Double [blue] :: Color -> {-# UNPACK #-} !Double [alpha] :: Color -> {-# UNPACK #-} !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 :: MonadIO m => Device -> Text -> m CommandEncoder -- | Finish encoding commands, returning a command buffer. commandEncoderFinish :: MonadIO m => CommandEncoder -> Text -> m CommandBuffer -- | Begins recording of a render pass. beginRenderPass :: MonadIO m => CommandEncoder -> RenderPassDescriptor -> m RenderPassEncoder -- | Sets the active render pipeline. -- -- Subsequent draw calls will exhibit the behaviour defined by the -- pipeline. renderPassSetPipeline :: MonadIO m => RenderPassEncoder -> RenderPipeline -> m () -- | Draws primitives from the active vertex buffers. renderPassDraw :: MonadIO m => RenderPassEncoder -> Range Word32 -> Range Word32 -> m () -- | Finish recording of a render pass. endRenderPass :: MonadIO m => RenderPassEncoder -> m () data Queue -- | Get the queue for a device. getQueue :: MonadIO m => Device -> m Queue -- | Submit a list of command buffers to a device queue. queueSubmit :: MonadIO m => Queue -> Vector CommandBuffer -> m () -- | 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 :: MonadIO m => Instance -> m 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 -- | Connect a stdout logger to the instance. connectLog :: MonadIO m => Instance -> m () -- | Disconnect a stdout logger from the instance. disconnectLog :: MonadIO m => Instance -> m () -- | Set the current logging level for the instance. setLogLevel :: MonadIO m => Instance -> LogLevel -> m () -- | 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 -- | Return a value from an SMaybe with a default. -- -- This function returns the SJust value from an SMaybe, or -- the default value if the SMaybe is SNothing. fromSMaybe :: a -> SMaybe a -> a -- | WGPU commands commonly take parameters such as the Instance, -- Device, etc, which are relatively unchanged across multiple -- commands. This module provides a way to supply those parameters from a -- MonadReader. Useful for the truly lazy among us. module WGPU.Classy type HasInstance r m = (RIO r m, Has Instance r) type HasSurface r m = (RIO r m, Has Surface r) type HasAdapter r m = (RIO r m, Has Adapter r) type HasDevice r m = (RIO r m, Has Device r) type HasSwapChain r m = (RIO r m, Has SwapChain r) type HasCommandEncoder r m = (RIO r m, Has CommandEncoder r) type HasRenderPassEncoder r m = (RIO r m, Has RenderPassEncoder r) type HasQueue r m = (RIO r m, Has Queue r) requestAdapter :: HasSurface r m => m (Maybe Adapter) getAdapterProperties :: HasAdapter r m => m AdapterProperties requestDevice :: HasAdapter r m => DeviceDescriptor -> m (Maybe Device) getSwapChainPreferredFormat :: (HasSurface r m, HasAdapter r m) => m TextureFormat createSwapChain :: (HasDevice r m, HasSurface r m) => SwapChainDescriptor -> m SwapChain getSwapChainCurrentTextureView :: HasSwapChain r m => m TextureView swapChainPresent :: HasSwapChain r m => m () createBindGroupLayout :: HasDevice r m => BindGroupLayoutDescriptor -> m BindGroupLayout createShaderModule :: HasDevice r m => ShaderModuleDescriptor -> m ShaderModule createShaderModuleSPIRV :: HasDevice r m => Text -> SPIRV -> m ShaderModule createShaderModuleWGSL :: HasDevice r m => Text -> WGSL -> m ShaderModule createPipelineLayout :: HasDevice r m => PipelineLayoutDescriptor -> m PipelineLayout createRenderPipeline :: HasDevice r m => RenderPipelineDescriptor -> m RenderPipeline createCommandEncoder :: HasDevice r m => Text -> m CommandEncoder commandEncoderFinish :: HasCommandEncoder r m => Text -> m CommandBuffer beginRenderPass :: HasCommandEncoder r m => RenderPassDescriptor -> m RenderPassEncoder renderPassSetPipeline :: HasRenderPassEncoder r m => RenderPipeline -> m () renderPassDraw :: HasRenderPassEncoder r m => Range Word32 -> Range Word32 -> m () endRenderPass :: HasRenderPassEncoder r m => m () getQueue :: HasDevice r m => m Queue queueSubmit :: HasQueue r m => Vector CommandBuffer -> m () -- | Fetch the queue from a device and submit command buffers to it. queueSubmit' :: HasDevice r m => Vector CommandBuffer -> m () getVersion :: HasInstance r m => m Version connectLog :: HasInstance r m => m () disconnectLog :: HasInstance r m => m () setLogLevel :: HasInstance r m => LogLevel -> m () -- | Add q into the reader environment. addEnv :: MonadReader r m => q -> ReaderT (q, r) m a -> m a -- | Build a CommandBuffer by running actions in an environment that -- has access to a CommandEncoder. buildCommandBuffer :: forall r m. HasDevice r m => Text -> Text -> ReaderT (CommandEncoder, r) m () -> m CommandBuffer -- | Build a render pass by running actions in an environment that has -- access to a RenderPassEncoder. buildRenderPass :: forall r m. HasCommandEncoder r m => RenderPassDescriptor -> ReaderT (RenderPassEncoder, r) m () -> m () module WGPU.GLFW.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. createSurface :: MonadIO m => Instance -> Window -> m Surface module WGPU.SDL.Surface createSurface :: MonadIO m => Instance -> Window -> m Surface -- | This is a kind of skeleton for a very simple SDL app. It is intended -- for bootstrapping development. A common use case is when you want a -- window to draw in with everything configured. This provides a version -- of that functionality that can later be replaced or refined (easily) -- by the app developer if necessary. module WGPU.BoneYard.SimpleSDL -- | Contains mutable state to manage the swap chain. data SwapChainState -- | Initialize a new SwapChainState. emptySwapChainState :: MonadResource m => m SwapChainState -- | Provide a ReaderT with a properly-configured SwapChain. withSwapChain :: forall r m a. (HasDevice r m, HasSurface r m, HasAdapter r m, Has Window r, Has SwapChainState r) => ReaderT (SwapChain, r) m a -> m a -- | Name of a render pipeline. data RenderPipelineName -- | Container for mutable state that contains a map of render pipelines. data RenderPipelines -- | Create an empty RenderPipelines. emptyRenderPipelines :: MonadResource m => m RenderPipelines -- | Create a RenderPipeline, storing it in the -- RenderPipelines map. -- -- A RenderPipeline created this way can be fetched using -- getRenderPipeline. This calls createRenderPipeline under -- the hood. createRenderPipeline :: (MonadIO m, HasDevice r m, Has RenderPipelines r) => RenderPipelineName -> RenderPipelineDescriptor -> m RenderPipeline -- | Fetch a render pipeline that was previously created using -- createRenderPipeline. -- -- If the render pipeline is not available, this function throws an -- exception of type AppException. getRenderPipeline :: (Has RenderPipelines r, MonadReader r m, MonadIO m, MonadThrow m) => RenderPipelineName -> m RenderPipeline -- | Name of a shader. data ShaderName -- | Container for mutable state that contains a map of shaders. data Shaders -- | Create an empty Shaders. emptyShaders :: MonadResource m => m Shaders -- | Compile a WGSL shader, adding it to the Shaders map, and -- returning the compiled ShaderModule. compileWGSL :: (Has Device r, Has Shaders r, MonadReader r m, MonadResource m) => ShaderName -> WGSL -> m ShaderModule -- | Compile a WGSL shader, adding it to the Shaders map. compileWGSL_ :: (Has Device r, Has Shaders r, MonadReader r m, MonadResource m) => ShaderName -> WGSL -> m () -- | Fetch a shader that was previously compiled. -- -- If the shader is not available, this function throws an exception of -- type AppException. getShader :: (Has Shaders r, MonadReader r m, MonadIO m, MonadThrow m) => ShaderName -> m ShaderModule -- | Parameters for initialization. data Params Params :: !Text -> !SMaybe DeviceDescriptor -> Params -- | Title of the window. [title] :: Params -> !Text -- | Optional device descriptor. [mDeviceDescriptor] :: Params -> !SMaybe DeviceDescriptor -- | Resources for the app. data Resources Resources :: !Instance -> !Window -> !Surface -> !Adapter -> !Device -> !Queue -> Resources [inst] :: Resources -> !Instance [window] :: Resources -> !Window [surface] :: Resources -> !Surface [adapter] :: Resources -> !Adapter [device] :: Resources -> !Device [queue] :: Resources -> !Queue -- | Load the resources for an application. -- -- This creates: - Instance, - SDL Window (which is shown) -- - Surface for the SDL window - Adapter - Device - -- Queue loadResources :: forall m. (MonadResource m, MonadThrow m) => Params -> m Resources -- | Exceptions from SimpleSDL. data AppException -- | Requesting an adapter failed. AdapterRequestFailed :: AppException -- | Requesting a device failed. DeviceRequestFailed :: AppException -- | Requesting a shader failed. UnknownShaderName :: ShaderName -> AppException -- | Requesting a render pipeline failed. UnknownRenderPipelineName :: RenderPipelineName -> AppException instance GHC.Show.Show WGPU.BoneYard.SimpleSDL.RenderPipelineName instance Data.String.IsString WGPU.BoneYard.SimpleSDL.RenderPipelineName instance GHC.Classes.Ord WGPU.BoneYard.SimpleSDL.RenderPipelineName instance GHC.Classes.Eq WGPU.BoneYard.SimpleSDL.RenderPipelineName instance GHC.Show.Show WGPU.BoneYard.SimpleSDL.ShaderName instance Data.String.IsString WGPU.BoneYard.SimpleSDL.ShaderName instance GHC.Classes.Ord WGPU.BoneYard.SimpleSDL.ShaderName instance GHC.Classes.Eq WGPU.BoneYard.SimpleSDL.ShaderName instance GHC.Generics.Generic WGPU.BoneYard.SimpleSDL.Resources instance GHC.Show.Show WGPU.BoneYard.SimpleSDL.AppException instance GHC.Exception.Type.Exception WGPU.BoneYard.SimpleSDL.AppException instance Data.Has.Has WGPU.Internal.Instance.Instance WGPU.BoneYard.SimpleSDL.Resources instance Data.Has.Has SDL.Internal.Types.Window WGPU.BoneYard.SimpleSDL.Resources instance Data.Has.Has WGPU.Internal.Surface.Surface WGPU.BoneYard.SimpleSDL.Resources instance Data.Has.Has WGPU.Internal.Adapter.Adapter WGPU.BoneYard.SimpleSDL.Resources instance Data.Has.Has WGPU.Internal.Device.Device WGPU.BoneYard.SimpleSDL.Resources instance Data.Has.Has WGPU.Internal.Queue.Queue WGPU.BoneYard.SimpleSDL.Resources