Copyright | Copyright (C) Jonathan Merritt 2021 |
---|---|
License | BSD-3-Clause |
Maintainer | Jonathan Merritt <j.s.merritt@gmail.com> |
Stability | experimental |
Portability | macOS, Linux, Windows |
Safe Haskell | None |
Language | Haskell2010 |
Layout of this module should be guided by the evolving WebGPU Specification.
Synopsis
- data Instance
- withPlatformInstance :: MonadIO m => (m Instance -> (Instance -> m ()) -> r) -> r
- withInstance :: MonadIO m => FilePath -> (m Instance -> (Instance -> m ()) -> r) -> r
- data Surface
- data Adapter
- data AdapterType
- data BackendType
- data AdapterProperties = AdapterProperties {
- deviceID :: !Word32
- vendorID :: !Word32
- adapterName :: !Text
- driverDescription :: !Text
- adapterType :: !AdapterType
- backendType :: !BackendType
- requestAdapter :: MonadIO m => Surface -> m (Maybe Adapter)
- getAdapterProperties :: MonadIO m => Adapter -> m AdapterProperties
- adapterPropertiesToText :: AdapterProperties -> Text
- data Device
- data DeviceDescriptor = DeviceDescriptor {}
- data Limits = Limits {}
- newtype Features = Features {}
- requestDevice :: MonadIO m => Adapter -> DeviceDescriptor -> m (Maybe Device)
- data TextureView
- data TextureViewDimension
- data TextureFormat
- = TextureFormatR8Unorm
- | TextureFormatR8Snorm
- | TextureFormatR8Uint
- | TextureFormatR8Sint
- | TextureFormatR16Uint
- | TextureFormatR16Sint
- | TextureFormatR16Float
- | TextureFormatRG8Unorm
- | TextureFormatRG8Snorm
- | TextureFormatRG8Uint
- | TextureFormatRG8Sint
- | TextureFormatR32Float
- | TextureFormatR32Uint
- | TextureFormatR32Sint
- | TextureFormatRG16Uint
- | TextureFormatRG16Sint
- | TextureFormatRG16Float
- | TextureFormatRGBA8Unorm
- | TextureFormatRGBA8UnormSrgb
- | TextureFormatRGBA8Snorm
- | TextureFormatRGBA8Uint
- | TextureFormatRGBA8Sint
- | TextureFormatBGRA8Unorm
- | TextureFormatBGRA8UnormSrgb
- | TextureFormatRGB10A2Unorm
- | TextureFormatRG11B10Ufloat
- | TextureFormatRGB9E5Ufloat
- | TextureFormatRG32Float
- | TextureFormatRG32Uint
- | TextureFormatRG32Sint
- | TextureFormatRGBA16Uint
- | TextureFormatRGBA16Sint
- | TextureFormatRGBA16Float
- | TextureFormatRGBA32Float
- | TextureFormatRGBA32Uint
- | TextureFormatRGBA32Sint
- | TextureFormatDepth32Float
- | TextureFormatDepth24Plus
- | TextureFormatDepth24PlusStencil8
- | TextureFormatStencil8
- | TextureFormatBC1RGBAUnorm
- | TextureFormatBC1RGBAUnormSrgb
- | TextureFormatBC2RGBAUnorm
- | TextureFormatBC2RGBAUnormSrgb
- | TextureFormatBC3RGBAUnorm
- | TextureFormatBC3RGBAUnormSrgb
- | TextureFormatBC4RUnorm
- | TextureFormatBC4RSnorm
- | TextureFormatBC5RGUnorm
- | TextureFormatBC5RGSnorm
- | TextureFormatBC6HRGBUfloat
- | TextureFormatBC6HRGBFloat
- | TextureFormatBC7RGBAUnorm
- | TextureFormatBC7RGBAUnormSrgb
- data TextureUsage
- data SwapChain
- data SwapChainDescriptor = SwapChainDescriptor {
- swapChainLabel :: !Text
- usage :: !TextureUsage
- swapChainFormat :: !TextureFormat
- width :: !Word32
- height :: !Word32
- presentMode :: !PresentMode
- data PresentMode
- getSwapChainPreferredFormat :: MonadIO m => Surface -> Adapter -> m TextureFormat
- createSwapChain :: MonadIO m => Device -> Surface -> SwapChainDescriptor -> m SwapChain
- getSwapChainCurrentTextureView :: MonadIO m => SwapChain -> m TextureView
- swapChainPresent :: MonadIO m => SwapChain -> m ()
- data BindGroupLayout
- data BindGroupLayoutDescriptor = BindGroupLayoutDescriptor {
- bindGroupLabel :: !Text
- entries :: !(Vector BindGroupLayoutEntry)
- data BindGroupLayoutEntry = BindGroupLayoutEntry {}
- newtype Binding = Binding {}
- data ShaderStage = ShaderStage {
- stageVertex :: !Bool
- stageFragment :: !Bool
- stageCompute :: !Bool
- data BindingType
- data BufferBindingLayout = BufferBindingLayout {}
- data SamplerBindingLayout
- data TextureBindingLayout = TextureBindingLayout {}
- data StorageTextureBindingLayout = StorageTextureBindingLayout {}
- data StorageTextureAccess
- data TextureSampleType
- data BufferBindingType
- createBindGroupLayout :: MonadIO m => Device -> BindGroupLayoutDescriptor -> m BindGroupLayout
- data ShaderModule
- data ShaderModuleDescriptor = ShaderModuleDescriptor {
- shaderLabel :: !Text
- source :: !ShaderSource
- data ShaderSource
- newtype SPIRV = SPIRV ByteString
- newtype WGSL = WGSL Text
- newtype ShaderEntryPoint = ShaderEntryPoint {}
- createShaderModule :: MonadIO m => Device -> ShaderModuleDescriptor -> m ShaderModule
- createShaderModuleSPIRV :: MonadIO m => Device -> Text -> SPIRV -> m ShaderModule
- createShaderModuleWGSL :: MonadIO m => Device -> Text -> WGSL -> m ShaderModule
- data PipelineLayout
- data RenderPipeline
- data PipelineLayoutDescriptor = PipelineLayoutDescriptor {}
- data RenderPipelineDescriptor = RenderPipelineDescriptor {}
- data VertexFormat
- = VertexFormatUint8x2
- | VertexFormatUint8x4
- | VertexFormatSint8x2
- | VertexFormatSint8x4
- | VertexFormatUnorm8x2
- | VertexFormatUnorm8x4
- | VertexFormatSnorm8x2
- | VertexFormatSnorm8x4
- | VertexFormatUint16x2
- | VertexFormatUint16x4
- | VertexFormatSint16x2
- | VertexFormatSint16x4
- | VertexFormatUnorm16x2
- | VertexFormatUnorm16x4
- | VertexFormatSnorm16x2
- | VertexFormatSnorm16x4
- | VertexFormatFloat16x2
- | VertexFormatFloat16x4
- | VertexFormatFloat32
- | VertexFormatFloat32x2
- | VertexFormatFloat32x3
- | VertexFormatFloat32x4
- | VertexFormatUint32
- | VertexFormatUint32x2
- | VertexFormatUint32x3
- | VertexFormatUint32x4
- | VertexFormatSint32
- | VertexFormatSint32x2
- | VertexFormatSint32x3
- | VertexFormatSint32x4
- data VertexAttribute = VertexAttribute {
- vertexFormat :: !VertexFormat
- offset :: !Word64
- shaderLocation :: !Word32
- data InputStepMode
- data VertexBufferLayout = VertexBufferLayout {
- arrayStride :: !Word64
- stepMode :: !InputStepMode
- attributes :: !(Vector VertexAttribute)
- data VertexState = VertexState {}
- data PrimitiveTopology
- data IndexFormat
- data FrontFace
- data CullMode
- data PrimitiveState = PrimitiveState {
- topology :: !PrimitiveTopology
- stripIndexFormat :: !(SMaybe IndexFormat)
- frontFace :: !FrontFace
- cullMode :: !CullMode
- data StencilOperation
- data StencilState = StencilState {
- front :: !StencilFaceState
- back :: !StencilFaceState
- readMask :: !Word8
- writeMask :: !Word8
- data DepthBiasState = DepthBiasState {}
- data DepthStencilState = DepthStencilState {}
- data MultisampleState = MultisampleState {}
- data BlendFactor
- data BlendOperation
- data BlendComponent = BlendComponent {}
- data BlendState = BlendState {}
- data ColorWriteMask = ColorWriteMask {}
- data ColorTargetState = ColorTargetState {}
- data FragmentState = FragmentState {}
- createPipelineLayout :: MonadIO m => Device -> PipelineLayoutDescriptor -> m PipelineLayout
- createRenderPipeline :: MonadIO m => Device -> RenderPipelineDescriptor -> m RenderPipeline
- colorWriteMaskAll :: ColorWriteMask
- data CommandBuffer
- data CommandEncoder
- data RenderPassEncoder
- data Color = Color {}
- data LoadOp a
- = LoadOpClear !a
- | LoadOpLoad
- data StoreOp
- data Operations a = Operations {}
- data RenderPassColorAttachment = RenderPassColorAttachment {
- colorView :: !TextureView
- resolveTarget :: !(SMaybe TextureView)
- operations :: !(Operations Color)
- data RenderPassDepthStencilAttachment = RenderPassDepthStencilAttachment {
- depthStencilView :: !TextureView
- depthOps :: !(SMaybe (Operations Float))
- stencilOps :: !(SMaybe (Operations Word32))
- data RenderPassDescriptor = RenderPassDescriptor {}
- data Range a = Range {
- rangeStart :: !a
- rangeLength :: !a
- createCommandEncoder :: MonadIO m => Device -> Text -> m CommandEncoder
- commandEncoderFinish :: MonadIO m => CommandEncoder -> Text -> m CommandBuffer
- beginRenderPass :: MonadIO m => CommandEncoder -> RenderPassDescriptor -> m RenderPassEncoder
- renderPassSetPipeline :: MonadIO m => RenderPassEncoder -> RenderPipeline -> m ()
- renderPassDraw :: MonadIO m => RenderPassEncoder -> Range Word32 -> Range Word32 -> m ()
- endRenderPass :: MonadIO m => RenderPassEncoder -> m ()
- data Queue
- getQueue :: MonadIO m => Device -> m Queue
- queueSubmit :: MonadIO m => Queue -> Vector CommandBuffer -> m ()
- data Version = Version {}
- getVersion :: MonadIO m => Instance -> m Version
- versionToText :: Version -> Text
- data LogLevel
- connectLog :: MonadIO m => Instance -> m ()
- disconnectLog :: MonadIO m => Instance -> m ()
- setLogLevel :: MonadIO m => Instance -> LogLevel -> m ()
- data CompareFunction
- data SMaybe a
- fromSMaybe :: a -> SMaybe a -> a
Introduction
Introduction to WebGPU
WebGPU is a future web standard for graphics and compute, developed by the W3C. It is currently (August 2021) an emerging technology, and not yet stable. In addition to its JavaScript API, there are also early attempts to create a native binding (ie. a C language binding). Two implementations of the native binding are:
- wgpu-native: a Rust implementation used in the Firefox web browser.
- dawn: a C++ implementation,used in the Chrome web browser.
The native bindings to WebGPU have the potential to become a portable, next-generation GPU API which is easy to use. Vulkan is also currently available across platforms, but it is very low-level. In the opinion of the author of this package, Vulkan is very difficult to use directly from Haskell. It would benefit greatly from a shim layer which performs common tasks and streamlines many operations. Not unexpectedly, that is exactly the role that WebGPU native can play.
Platform Support
Currently, macOS (Metal), Windows and Linux are supported.
Windowing System Support
The bindings support both GLFW-b and SDL as windowing systems on macOS, Windows and Linux. The windowing system bindings are somewhat hacky (due to the early stage of WebGPU Native), but they work.
Structure of Bindings
The bindings to wgpu-native
are structured in three packages:
- The
wgpu-raw-hs-codegen
package is a code generator for the raw bindings. It creates all the packages namedWGPU.Raw.Generated.*
(without exception!). - The wgpu-raw-hs
package provides raw bindings to
wgpu-native
. They are "raw" in the sense that they contain raw pointers and are not usable without manual construction of the C structs that must be passed to the API. The
wgpu-hs
package (this one) provides high-level bindings. These bindings are written manually. They are improvements on the raw bindings in the following ways:- There are no more raw
Ptr
types. - There are no callbacks.
- Several parts of the API are tweaked slightly to more closely resemble the Rust API.
- Names are de-duplicated.
- There are no more raw
Native Library Handling
The native library for wgpu-native
is not required at compile-time for this
package. The library is loaded dynamically at runtime.
Initialization
The first step in using these Haskell bindings is to obtain an Instance
.
This acts as a handle to the rest of the API. An Instance
is obtained at
runtime by loading a dynamic library containing the WGPU binding symbols.
Currently, only the C/Rust library from
wgpu-native is supported.
To load the dynamic library and obtain an instance, use the
withPlatformInstance
or withInstance
bracketing functions. These
functions take a function that performs bracketing.
withPlatformInstance
bracket
$ inst -> do -- attach the logger and set the logging level (optional)connectLog
instsetLogLevel
instWarn
-- run the rest of the program...
After creating an Instance
, you may next want to
create a surface.
Instance of the WGPU API.
An instance is loaded from a dynamic library using the withInstance
function.
:: MonadIO m | |
=> (m Instance -> (Instance -> m ()) -> r) | Bracketing function.
This can (for example) be something like |
-> r | Usage or action component of the bracketing function. |
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
.
:: MonadIO m | |
=> FilePath | Name of the |
-> (m Instance -> (Instance -> m ()) -> r) | Bracketing function.
This can (for example) be something like |
-> r | Usage or action component of the bracketing function. |
Load the WGPU API from a dynamic library and supply an Instance
to a
program.
Surface
A Surface
is a handle to a platform-specific presentable surface, like a
window. First, create either a GLFW or SDL window, and then create a surface
using either createGLFWSurface
or createSDLSurface
.
Once you have a Surface
, the next step is usually to
request an adapter that is compatible with it.
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
.
Adapter
An Adapter
is a handle to a physical device. For example, a physical
display adaptor (GPU) or a software renderer. Currently you obtain an adapter
using requestAdapter
, which requests an adapter that is compatible with an
existing Surface
.
After obtaining an adapter, you will typically want to request a device.
Handle to a physical graphics and/or compute device.
Request an Adapter
for a Surface
using the requestAdapter
function.
data AdapterType #
Physical device type.
Instances
Eq AdapterType | |
Defined in WGPU.Internal.Adapter (==) :: AdapterType -> AdapterType -> Bool # (/=) :: AdapterType -> AdapterType -> Bool # | |
Show AdapterType | |
Defined in WGPU.Internal.Adapter showsPrec :: Int -> AdapterType -> ShowS # show :: AdapterType -> String # showList :: [AdapterType] -> ShowS # | |
ToRaw AdapterType WGPUAdapterType | |
Defined in WGPU.Internal.Adapter raw :: AdapterType -> ContT r IO WGPUAdapterType # | |
FromRaw WGPUAdapterType AdapterType | |
Defined in WGPU.Internal.Adapter fromRaw :: MonadIO m => WGPUAdapterType -> m AdapterType # |
data BackendType #
Backends supported by WGPU.
BackendTypeNull | |
BackendTypeD3D11 | |
BackendTypeD3D12 | |
BackendTypeMetal | |
BackendTypeVulkan | |
BackendTypeOpenGL | |
BackendTypeOpenGLES |
Instances
Eq BackendType | |
Defined in WGPU.Internal.Adapter (==) :: BackendType -> BackendType -> Bool # (/=) :: BackendType -> BackendType -> Bool # | |
Show BackendType | |
Defined in WGPU.Internal.Adapter showsPrec :: Int -> BackendType -> ShowS # show :: BackendType -> String # showList :: [BackendType] -> ShowS # | |
ToRaw BackendType WGPUBackendType | |
Defined in WGPU.Internal.Adapter raw :: BackendType -> ContT r IO WGPUBackendType # | |
FromRaw WGPUBackendType BackendType | |
Defined in WGPU.Internal.Adapter fromRaw :: MonadIO m => WGPUBackendType -> m BackendType # |
data AdapterProperties #
AdapterProperties | |
|
Instances
Eq AdapterProperties | |
Defined in WGPU.Internal.Adapter (==) :: AdapterProperties -> AdapterProperties -> Bool # (/=) :: AdapterProperties -> AdapterProperties -> Bool # | |
Show AdapterProperties | |
Defined in WGPU.Internal.Adapter showsPrec :: Int -> AdapterProperties -> ShowS # show :: AdapterProperties -> String # showList :: [AdapterProperties] -> ShowS # | |
ToRaw AdapterProperties WGPUAdapterProperties | |
Defined in WGPU.Internal.Adapter raw :: AdapterProperties -> ContT r IO WGPUAdapterProperties # | |
FromRaw WGPUAdapterProperties AdapterProperties | |
Defined in WGPU.Internal.Adapter fromRaw :: MonadIO m => WGPUAdapterProperties -> m AdapterProperties # |
getAdapterProperties :: MonadIO m => Adapter -> m AdapterProperties #
Get information about an adapter.
adapterPropertiesToText :: AdapterProperties -> Text #
Format adapter properties into a multi-line block of text.
This can be useful for debugging purposes.
Device
A Device
is an open connection to a graphics and/or compute device. A
Device
is created using the requestDevice
function.
(According to the WebGPU API documentation, a Device
may also be "lost".
However, it's not yet clear how that event will be signalled to the C API,
nor how to handle it.)
An open connection to a graphics and/or compute device.
A Device
may be created using the requestDevice
function.
data DeviceDescriptor #
Describes a Device
.
Instances
Eq DeviceDescriptor | |
Defined in WGPU.Internal.Device (==) :: DeviceDescriptor -> DeviceDescriptor -> Bool # (/=) :: DeviceDescriptor -> DeviceDescriptor -> Bool # | |
Show DeviceDescriptor | |
Defined in WGPU.Internal.Device showsPrec :: Int -> DeviceDescriptor -> ShowS # show :: DeviceDescriptor -> String # showList :: [DeviceDescriptor] -> ShowS # | |
Default DeviceDescriptor | |
Defined in WGPU.Internal.Device def :: DeviceDescriptor # | |
ToRaw DeviceDescriptor WGPUDeviceExtras | |
Defined in WGPU.Internal.Device raw :: DeviceDescriptor -> ContT r IO WGPUDeviceExtras # |
Device limits.
Represents the set of limits an adapter/device supports.
Limits | |
|
Device features that are not guaranteed to be supported.
- NOTE: The Rust API currently has far more extensive
Features
. Perhaps they have not yet been ported to the C API? https://docs.rs/wgpu-types/0.9.0/wgpu_types/struct.Features.html
Instances
Eq Features | |
Show Features | |
Default Features | |
Defined in WGPU.Internal.Device | |
ToRaw Features WGPUNativeFeature | |
Defined in WGPU.Internal.Device |
:: MonadIO m | |
=> Adapter |
|
-> DeviceDescriptor | The features and limits requested for the device. |
-> m (Maybe Device) | The returned |
Requests a connection to a physical device, creating a logical device.
This action blocks until an available device is returned.
Textures and Views
data TextureView #
Handle to a texture view.
A TextureView
describes a texture and associated metadata needed by a
rendering pipeline or bind group.
Instances
Eq TextureView | |
Defined in WGPU.Internal.Texture (==) :: TextureView -> TextureView -> Bool # (/=) :: TextureView -> TextureView -> Bool # | |
Show TextureView | |
Defined in WGPU.Internal.Texture showsPrec :: Int -> TextureView -> ShowS # show :: TextureView -> String # showList :: [TextureView] -> ShowS # | |
ToRaw TextureView WGPUTextureView | |
Defined in WGPU.Internal.Texture raw :: TextureView -> ContT r IO WGPUTextureView # |
data TextureViewDimension #
Dimensions of a particular texture view.
TextureViewDimension1D | |
TextureViewDimension2D | |
TextureViewDimension2DArray | |
TextureViewDimensionCube | |
TextureViewDimensionCubeArray | |
TextureViewDimension3D |
Instances
Eq TextureViewDimension | |
Defined in WGPU.Internal.Texture (==) :: TextureViewDimension -> TextureViewDimension -> Bool # (/=) :: TextureViewDimension -> TextureViewDimension -> Bool # | |
Show TextureViewDimension | |
Defined in WGPU.Internal.Texture showsPrec :: Int -> TextureViewDimension -> ShowS # show :: TextureViewDimension -> String # showList :: [TextureViewDimension] -> ShowS # | |
ToRaw TextureViewDimension WGPUTextureViewDimension | |
Defined in WGPU.Internal.Texture |
data TextureFormat #
Texture data format.
Instances
Eq TextureFormat | |
Defined in WGPU.Internal.Texture (==) :: TextureFormat -> TextureFormat -> Bool # (/=) :: TextureFormat -> TextureFormat -> Bool # | |
Show TextureFormat | |
Defined in WGPU.Internal.Texture showsPrec :: Int -> TextureFormat -> ShowS # show :: TextureFormat -> String # showList :: [TextureFormat] -> ShowS # | |
ToRaw TextureFormat WGPUTextureFormat | |
Defined in WGPU.Internal.Texture raw :: TextureFormat -> ContT r IO WGPUTextureFormat # |
data TextureUsage #
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.
TextureUsageCopySrc | |
TextureUsageCopyDst | |
TextureUsageSampled | |
TextureUsageStorage | |
TextureUsageRenderAttachment |
Instances
Eq TextureUsage | |
Defined in WGPU.Internal.Texture (==) :: TextureUsage -> TextureUsage -> Bool # (/=) :: TextureUsage -> TextureUsage -> Bool # | |
Show TextureUsage | |
Defined in WGPU.Internal.Texture showsPrec :: Int -> TextureUsage -> ShowS # show :: TextureUsage -> String # showList :: [TextureUsage] -> ShowS # | |
ToRaw TextureUsage WGPUTextureUsage | |
Defined in WGPU.Internal.Texture raw :: TextureUsage -> ContT r IO WGPUTextureUsage # |
Swapchain
Instances
data SwapChainDescriptor #
Describes a swapchain.
SwapChainDescriptor | |
|
Instances
Eq SwapChainDescriptor | |
Defined in WGPU.Internal.SwapChain (==) :: SwapChainDescriptor -> SwapChainDescriptor -> Bool # (/=) :: SwapChainDescriptor -> SwapChainDescriptor -> Bool # | |
Show SwapChainDescriptor | |
Defined in WGPU.Internal.SwapChain showsPrec :: Int -> SwapChainDescriptor -> ShowS # show :: SwapChainDescriptor -> String # showList :: [SwapChainDescriptor] -> ShowS # | |
ToRaw SwapChainDescriptor WGPUSwapChainDescriptor | |
Defined in WGPU.Internal.SwapChain |
data PresentMode #
Behaviour of the presentation engine based on frame rate.
PresentModeImmediate | 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
|
PresentModeMailbox | 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. |
PresentModeFifo | 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. |
Instances
Eq PresentMode | |
Defined in WGPU.Internal.SwapChain (==) :: PresentMode -> PresentMode -> Bool # (/=) :: PresentMode -> PresentMode -> Bool # | |
Show PresentMode | |
Defined in WGPU.Internal.SwapChain showsPrec :: Int -> PresentMode -> ShowS # show :: PresentMode -> String # showList :: [PresentMode] -> ShowS # | |
ToRaw PresentMode WGPUPresentMode | |
Defined in WGPU.Internal.SwapChain raw :: PresentMode -> ContT r IO WGPUPresentMode # |
:: MonadIO m | |
=> Surface |
|
-> Adapter |
|
-> m TextureFormat | IO action which returns the optimal texture format. |
Returns an optimal texture format to use for the swapchain with this adapter and surface.
:: MonadIO m | |
=> Device |
|
-> Surface |
|
-> SwapChainDescriptor | Description of the |
-> m SwapChain | IO action which creates the swap chain. |
Createa a new SwapChain
which targets a Surface
.
To determine the preferred TextureFormat
for the Surface
, use the
getSwapChainPreferredFormat
function.
getSwapChainCurrentTextureView #
:: MonadIO m | |
=> SwapChain | Swap chain from which to fetch the current texture view. |
-> m TextureView | IO action which returns the current swap chain texture view. |
Get the TextureView
for the current swap chain frame.
:: MonadIO m | |
=> SwapChain | Swap chain to present. |
-> m () | IO action which presents the swap chain image. |
Present the latest swap chain image.
Samplers
Resource Binding
data BindGroupLayout #
Handle to a binding group layout.
A BindGroupLayout
is a handle to the GPU-side layout of a binding group.
Instances
Eq BindGroupLayout | |
Defined in WGPU.Internal.Binding (==) :: BindGroupLayout -> BindGroupLayout -> Bool # (/=) :: BindGroupLayout -> BindGroupLayout -> Bool # | |
Show BindGroupLayout | |
Defined in WGPU.Internal.Binding showsPrec :: Int -> BindGroupLayout -> ShowS # show :: BindGroupLayout -> String # showList :: [BindGroupLayout] -> ShowS # | |
ToRaw BindGroupLayout WGPUBindGroupLayout | |
Defined in WGPU.Internal.Binding raw :: BindGroupLayout -> ContT r IO WGPUBindGroupLayout # |
data BindGroupLayoutDescriptor #
Describes a BindGroupLayout
.
BindGroupLayoutDescriptor | |
|
Instances
Eq BindGroupLayoutDescriptor | |
Defined in WGPU.Internal.Binding | |
Show BindGroupLayoutDescriptor | |
Defined in WGPU.Internal.Binding showsPrec :: Int -> BindGroupLayoutDescriptor -> ShowS # show :: BindGroupLayoutDescriptor -> String # showList :: [BindGroupLayoutDescriptor] -> ShowS # | |
ToRaw BindGroupLayoutDescriptor WGPUBindGroupLayoutDescriptor | |
Defined in WGPU.Internal.Binding |
data BindGroupLayoutEntry #
Describes a single binding inside a bind group.
BindGroupLayoutEntry | |
|
Instances
Eq BindGroupLayoutEntry | |
Defined in WGPU.Internal.Binding (==) :: BindGroupLayoutEntry -> BindGroupLayoutEntry -> Bool # (/=) :: BindGroupLayoutEntry -> BindGroupLayoutEntry -> Bool # | |
Show BindGroupLayoutEntry | |
Defined in WGPU.Internal.Binding showsPrec :: Int -> BindGroupLayoutEntry -> ShowS # show :: BindGroupLayoutEntry -> String # showList :: [BindGroupLayoutEntry] -> ShowS # | |
ToRaw BindGroupLayoutEntry WGPUBindGroupLayoutEntry | |
Defined in WGPU.Internal.Binding |
Binding index.
This must match a shader index, and be unique inside a binding group layout.
data ShaderStage #
Describes the shader stages from which a binding will be visible.
ShaderStage | |
|
Instances
Eq ShaderStage | |
Defined in WGPU.Internal.Binding (==) :: ShaderStage -> ShaderStage -> Bool # (/=) :: ShaderStage -> ShaderStage -> Bool # | |
Show ShaderStage | |
Defined in WGPU.Internal.Binding showsPrec :: Int -> ShaderStage -> ShowS # show :: ShaderStage -> String # showList :: [ShaderStage] -> ShowS # | |
ToRaw ShaderStage WGPUShaderStageFlags | |
Defined in WGPU.Internal.Binding raw :: ShaderStage -> ContT r IO WGPUShaderStageFlags # |
data BindingType #
Specifies type of a binding.
BindingTypeBuffer !BufferBindingLayout | A buffer binding. |
BindingTypeSampler !SamplerBindingLayout | A sampler that can be used to sample a texture. |
BindingTypeTexture !TextureBindingLayout | A texture binding. |
BindingTypeStorageTexture !StorageTextureBindingLayout | A storage texture. |
Instances
Eq BindingType | |
Defined in WGPU.Internal.Binding (==) :: BindingType -> BindingType -> Bool # (/=) :: BindingType -> BindingType -> Bool # | |
Show BindingType | |
Defined in WGPU.Internal.Binding showsPrec :: Int -> BindingType -> ShowS # show :: BindingType -> String # showList :: [BindingType] -> ShowS # |
data BufferBindingLayout #
A buffer binding.
BufferBindingLayout | |
|
Instances
Eq BufferBindingLayout | |
Defined in WGPU.Internal.Binding (==) :: BufferBindingLayout -> BufferBindingLayout -> Bool # (/=) :: BufferBindingLayout -> BufferBindingLayout -> Bool # | |
Show BufferBindingLayout | |
Defined in WGPU.Internal.Binding showsPrec :: Int -> BufferBindingLayout -> ShowS # show :: BufferBindingLayout -> String # showList :: [BufferBindingLayout] -> ShowS # | |
ToRaw BufferBindingLayout WGPUBufferBindingLayout | |
Defined in WGPU.Internal.Binding |
data SamplerBindingLayout #
A sampler binding that can be used to sample a texture.
Instances
Eq SamplerBindingLayout | |
Defined in WGPU.Internal.Binding (==) :: SamplerBindingLayout -> SamplerBindingLayout -> Bool # (/=) :: SamplerBindingLayout -> SamplerBindingLayout -> Bool # | |
Show SamplerBindingLayout | |
Defined in WGPU.Internal.Binding showsPrec :: Int -> SamplerBindingLayout -> ShowS # show :: SamplerBindingLayout -> String # showList :: [SamplerBindingLayout] -> ShowS # | |
ToRaw SamplerBindingLayout WGPUSamplerBindingLayout | |
Defined in WGPU.Internal.Binding |
data TextureBindingLayout #
A texture binding.
TextureBindingLayout | |
|
Instances
Eq TextureBindingLayout | |
Defined in WGPU.Internal.Binding (==) :: TextureBindingLayout -> TextureBindingLayout -> Bool # (/=) :: TextureBindingLayout -> TextureBindingLayout -> Bool # | |
Show TextureBindingLayout | |
Defined in WGPU.Internal.Binding showsPrec :: Int -> TextureBindingLayout -> ShowS # show :: TextureBindingLayout -> String # showList :: [TextureBindingLayout] -> ShowS # | |
ToRaw TextureBindingLayout WGPUTextureBindingLayout | |
Defined in WGPU.Internal.Binding |
data StorageTextureBindingLayout #
A storage texture binding.
StorageTextureBindingLayout | |
|
Instances
data StorageTextureAccess #
Specific method of allowed access to a storage texture.
Instances
Eq StorageTextureAccess | |
Defined in WGPU.Internal.Binding (==) :: StorageTextureAccess -> StorageTextureAccess -> Bool # (/=) :: StorageTextureAccess -> StorageTextureAccess -> Bool # | |
Show StorageTextureAccess | |
Defined in WGPU.Internal.Binding showsPrec :: Int -> StorageTextureAccess -> ShowS # show :: StorageTextureAccess -> String # showList :: [StorageTextureAccess] -> ShowS # | |
ToRaw StorageTextureAccess WGPUStorageTextureAccess | |
Defined in WGPU.Internal.Binding |
data TextureSampleType #
Specific type of a sample in a texture binding.
TextureSampleTypeFloat | |
| |
TextureSampleTypeDepth | |
TextureSampleTypeSignedInt | |
TextureSampleTypeUnsignedInt |
Instances
Eq TextureSampleType | |
Defined in WGPU.Internal.Binding (==) :: TextureSampleType -> TextureSampleType -> Bool # (/=) :: TextureSampleType -> TextureSampleType -> Bool # | |
Show TextureSampleType | |
Defined in WGPU.Internal.Binding showsPrec :: Int -> TextureSampleType -> ShowS # show :: TextureSampleType -> String # showList :: [TextureSampleType] -> ShowS # | |
ToRaw TextureSampleType WGPUTextureSampleType | |
Defined in WGPU.Internal.Binding raw :: TextureSampleType -> ContT r IO WGPUTextureSampleType # |
data BufferBindingType #
Specific type of a buffer binding.
Instances
Eq BufferBindingType | |
Defined in WGPU.Internal.Binding (==) :: BufferBindingType -> BufferBindingType -> Bool # (/=) :: BufferBindingType -> BufferBindingType -> Bool # | |
Show BufferBindingType | |
Defined in WGPU.Internal.Binding showsPrec :: Int -> BufferBindingType -> ShowS # show :: BufferBindingType -> String # showList :: [BufferBindingType] -> ShowS # | |
ToRaw BufferBindingType WGPUBufferBindingType | |
Defined in WGPU.Internal.Binding raw :: BufferBindingType -> ContT r IO WGPUBufferBindingType # |
:: MonadIO m | |
=> Device | The device for which the bind group layout will be created. |
-> BindGroupLayoutDescriptor | Description of the bind group layout. |
-> m BindGroupLayout | MonadIO action that creates a bind group layout. |
Creates a BindGroupLayout
.
Shader Modules
data ShaderModule #
Handle to a compiled shader module.
Instances
Eq ShaderModule | |
Defined in WGPU.Internal.Shader (==) :: ShaderModule -> ShaderModule -> Bool # (/=) :: ShaderModule -> ShaderModule -> Bool # | |
Show ShaderModule | |
Defined in WGPU.Internal.Shader showsPrec :: Int -> ShaderModule -> ShowS # show :: ShaderModule -> String # showList :: [ShaderModule] -> ShowS # | |
ToRaw ShaderModule WGPUShaderModule | |
Defined in WGPU.Internal.Shader raw :: ShaderModule -> ContT r IO WGPUShaderModule # |
data ShaderModuleDescriptor #
Descriptor for a shader module.
ShaderModuleDescriptor | |
|
Instances
Eq ShaderModuleDescriptor | |
Defined in WGPU.Internal.Shader | |
Show ShaderModuleDescriptor | |
Defined in WGPU.Internal.Shader showsPrec :: Int -> ShaderModuleDescriptor -> ShowS # show :: ShaderModuleDescriptor -> String # showList :: [ShaderModuleDescriptor] -> ShowS # | |
ToRaw ShaderModuleDescriptor WGPUShaderModuleDescriptor | |
Defined in WGPU.Internal.Shader |
data ShaderSource #
Source for a shader module.
ShaderSourceSPIRV !SPIRV | Use shader source from a SPIRV module (pre-compiled). |
ShaderSourceWGSL !WGSL | Use shader source from WGSL string. |
Instances
Eq ShaderSource | |
Defined in WGPU.Internal.Shader (==) :: ShaderSource -> ShaderSource -> Bool # (/=) :: ShaderSource -> ShaderSource -> Bool # | |
Show ShaderSource | |
Defined in WGPU.Internal.Shader showsPrec :: Int -> ShaderSource -> ShowS # show :: ShaderSource -> String # showList :: [ShaderSource] -> ShowS # |
Pre-compiled SPIRV module bytes.
Instances
WGSL shader source code.
Instances
newtype ShaderEntryPoint #
Name of a shader entry point.
Instances
Eq ShaderEntryPoint | |
Defined in WGPU.Internal.Shader (==) :: ShaderEntryPoint -> ShaderEntryPoint -> Bool # (/=) :: ShaderEntryPoint -> ShaderEntryPoint -> Bool # | |
Show ShaderEntryPoint | |
Defined in WGPU.Internal.Shader showsPrec :: Int -> ShaderEntryPoint -> ShowS # show :: ShaderEntryPoint -> String # showList :: [ShaderEntryPoint] -> ShowS # | |
IsString ShaderEntryPoint | |
Defined in WGPU.Internal.Shader fromString :: String -> ShaderEntryPoint # | |
ToRawPtr ShaderEntryPoint CChar | |
Defined in WGPU.Internal.Shader |
:: MonadIO m | |
=> Device | Device for the shader. |
-> ShaderModuleDescriptor | Descriptor of the shader module. |
-> m ShaderModule | IO action producing the shader module. |
Create a shader module from either SPIR-V or WGSL source code.
:: MonadIO m | |
=> Device | Device for which the shader should be created. |
-> Text | Debugging label for the shader. |
-> SPIRV | Shader source code (SPIR-V bytestring). |
-> m ShaderModule | IO action creating the shader module. |
Create a shader module from SPIR-V source code.
:: MonadIO m | |
=> Device | Device for which the shader should be created. |
-> Text | Debugging label for the shader. |
-> WGSL | Shader source code (WGSL source string). |
-> m ShaderModule | IO action creating the shader module. |
Create a shader module from WGSL source code.
Pipelines
Compute
Render
data PipelineLayout #
Instances
Eq PipelineLayout | |
Defined in WGPU.Internal.Pipeline (==) :: PipelineLayout -> PipelineLayout -> Bool # (/=) :: PipelineLayout -> PipelineLayout -> Bool # | |
Show PipelineLayout | |
Defined in WGPU.Internal.Pipeline showsPrec :: Int -> PipelineLayout -> ShowS # show :: PipelineLayout -> String # showList :: [PipelineLayout] -> ShowS # | |
ToRaw PipelineLayout WGPUPipelineLayout | |
Defined in WGPU.Internal.Pipeline raw :: PipelineLayout -> ContT r IO WGPUPipelineLayout # |
data RenderPipeline #
Instances
Eq RenderPipeline | |
Defined in WGPU.Internal.RenderPass (==) :: RenderPipeline -> RenderPipeline -> Bool # (/=) :: RenderPipeline -> RenderPipeline -> Bool # | |
Show RenderPipeline | |
Defined in WGPU.Internal.RenderPass showsPrec :: Int -> RenderPipeline -> ShowS # show :: RenderPipeline -> String # showList :: [RenderPipeline] -> ShowS # | |
ToRaw RenderPipeline WGPURenderPipeline | |
Defined in WGPU.Internal.RenderPass raw :: RenderPipeline -> ContT r IO WGPURenderPipeline # |
data PipelineLayoutDescriptor #
Describes a pipeline layout.
PipelineLayoutDescriptor | |
|
Instances
Eq PipelineLayoutDescriptor | |
Defined in WGPU.Internal.Pipeline | |
Show PipelineLayoutDescriptor | |
Defined in WGPU.Internal.Pipeline showsPrec :: Int -> PipelineLayoutDescriptor -> ShowS # show :: PipelineLayoutDescriptor -> String # showList :: [PipelineLayoutDescriptor] -> ShowS # | |
ToRaw PipelineLayoutDescriptor WGPUPipelineLayoutDescriptor | |
Defined in WGPU.Internal.Pipeline |
data RenderPipelineDescriptor #
Describes a render (graphics) pipeline.
RenderPipelineDescriptor | |
|
Instances
Eq RenderPipelineDescriptor | |
Defined in WGPU.Internal.Pipeline | |
Show RenderPipelineDescriptor | |
Defined in WGPU.Internal.Pipeline showsPrec :: Int -> RenderPipelineDescriptor -> ShowS # show :: RenderPipelineDescriptor -> String # showList :: [RenderPipelineDescriptor] -> ShowS # | |
ToRaw RenderPipelineDescriptor WGPURenderPipelineDescriptor | |
Defined in WGPU.Internal.Pipeline |
data VertexFormat #
Vertex format for a vertex attribute.
Instances
Eq VertexFormat | |
Defined in WGPU.Internal.Pipeline (==) :: VertexFormat -> VertexFormat -> Bool # (/=) :: VertexFormat -> VertexFormat -> Bool # | |
Show VertexFormat | |
Defined in WGPU.Internal.Pipeline showsPrec :: Int -> VertexFormat -> ShowS # show :: VertexFormat -> String # showList :: [VertexFormat] -> ShowS # | |
ToRaw VertexFormat WGPUVertexFormat | Convert a |
Defined in WGPU.Internal.Pipeline raw :: VertexFormat -> ContT r IO WGPUVertexFormat # |
data VertexAttribute #
Vertex inputs (attributes) to shaders.
VertexAttribute | |
|
Instances
Eq VertexAttribute | |
Defined in WGPU.Internal.Pipeline (==) :: VertexAttribute -> VertexAttribute -> Bool # (/=) :: VertexAttribute -> VertexAttribute -> Bool # | |
Show VertexAttribute | |
Defined in WGPU.Internal.Pipeline showsPrec :: Int -> VertexAttribute -> ShowS # show :: VertexAttribute -> String # showList :: [VertexAttribute] -> ShowS # | |
ToRaw VertexAttribute WGPUVertexAttribute | |
Defined in WGPU.Internal.Pipeline raw :: VertexAttribute -> ContT r IO WGPUVertexAttribute # |
data InputStepMode #
Determines when vertex data is advanced.
InputStepModeVertex | Input data is advanced every vertex. |
InputStepModeInstance | Input data is advanced every instance. |
Instances
Eq InputStepMode | |
Defined in WGPU.Internal.Pipeline (==) :: InputStepMode -> InputStepMode -> Bool # (/=) :: InputStepMode -> InputStepMode -> Bool # | |
Show InputStepMode | |
Defined in WGPU.Internal.Pipeline showsPrec :: Int -> InputStepMode -> ShowS # show :: InputStepMode -> String # showList :: [InputStepMode] -> ShowS # | |
ToRaw InputStepMode WGPUInputStepMode | Convert an |
Defined in WGPU.Internal.Pipeline raw :: InputStepMode -> ContT r IO WGPUInputStepMode # |
data VertexBufferLayout #
Describes how a vertex buffer is interpreted.
VertexBufferLayout | |
|
Instances
Eq VertexBufferLayout | |
Defined in WGPU.Internal.Pipeline (==) :: VertexBufferLayout -> VertexBufferLayout -> Bool # (/=) :: VertexBufferLayout -> VertexBufferLayout -> Bool # | |
Show VertexBufferLayout | |
Defined in WGPU.Internal.Pipeline showsPrec :: Int -> VertexBufferLayout -> ShowS # show :: VertexBufferLayout -> String # showList :: [VertexBufferLayout] -> ShowS # | |
ToRaw VertexBufferLayout WGPUVertexBufferLayout | |
Defined in WGPU.Internal.Pipeline raw :: VertexBufferLayout -> ContT r IO WGPUVertexBufferLayout # |
data VertexState #
Describes the vertex process in a render pipeline.
VertexState | |
|
Instances
Eq VertexState | |
Defined in WGPU.Internal.Pipeline (==) :: VertexState -> VertexState -> Bool # (/=) :: VertexState -> VertexState -> Bool # | |
Show VertexState | |
Defined in WGPU.Internal.Pipeline showsPrec :: Int -> VertexState -> ShowS # show :: VertexState -> String # showList :: [VertexState] -> ShowS # | |
ToRaw VertexState WGPUVertexState | |
Defined in WGPU.Internal.Pipeline raw :: VertexState -> ContT r IO WGPUVertexState # |
data PrimitiveTopology #
Primitive type out of which an input mesh is composed.
PrimitiveTopologyPointList | |
PrimitiveTopologyLineList | |
PrimitiveTopologyLineStrip | |
PrimitiveTopologyTriangleList | |
PrimitiveTopologyTriangleStrip |
Instances
Eq PrimitiveTopology | |
Defined in WGPU.Internal.Pipeline (==) :: PrimitiveTopology -> PrimitiveTopology -> Bool # (/=) :: PrimitiveTopology -> PrimitiveTopology -> Bool # | |
Show PrimitiveTopology | |
Defined in WGPU.Internal.Pipeline showsPrec :: Int -> PrimitiveTopology -> ShowS # show :: PrimitiveTopology -> String # showList :: [PrimitiveTopology] -> ShowS # | |
Default PrimitiveTopology | |
Defined in WGPU.Internal.Pipeline | |
ToRaw PrimitiveTopology WGPUPrimitiveTopology | Convert a |
Defined in WGPU.Internal.Pipeline raw :: PrimitiveTopology -> ContT r IO WGPUPrimitiveTopology # |
data IndexFormat #
Format of indices used within a pipeline.
IndexFormatUint16 | Indices are 16-bit unsigned integers ( |
IndexFormatUint32 | Indices are 32-bit unsigned integers ( |
Instances
Eq IndexFormat | |
Defined in WGPU.Internal.Pipeline (==) :: IndexFormat -> IndexFormat -> Bool # (/=) :: IndexFormat -> IndexFormat -> Bool # | |
Show IndexFormat | |
Defined in WGPU.Internal.Pipeline showsPrec :: Int -> IndexFormat -> ShowS # show :: IndexFormat -> String # showList :: [IndexFormat] -> ShowS # | |
ToRaw IndexFormat WGPUIndexFormat | Convert an |
Defined in WGPU.Internal.Pipeline raw :: IndexFormat -> ContT r IO WGPUIndexFormat # |
Winding order which classifies the "front" face.
FrontFaceCCW | Triangles with counter-clockwise vertices are the front face. |
FrontFaceCW | Triangles with clockwise vertices are the front face. |
Instances
Eq FrontFace | |
Show FrontFace | |
Default FrontFace | |
Defined in WGPU.Internal.Pipeline | |
ToRaw FrontFace WGPUFrontFace | Convert a |
Defined in WGPU.Internal.Pipeline |
Whether to cull the face of a vertex.
CullModeFront | Cull the front face. |
CullModeBack | Cull the back face. |
CullModeNone | Do not cull either face. |
Instances
Eq CullMode | |
Show CullMode | |
Default CullMode | |
Defined in WGPU.Internal.Pipeline | |
ToRaw CullMode WGPUCullMode | Convert a |
Defined in WGPU.Internal.Pipeline |
data PrimitiveState #
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
PrimitiveState | |
|
Instances
Eq PrimitiveState | |
Defined in WGPU.Internal.Pipeline (==) :: PrimitiveState -> PrimitiveState -> Bool # (/=) :: PrimitiveState -> PrimitiveState -> Bool # | |
Show PrimitiveState | |
Defined in WGPU.Internal.Pipeline showsPrec :: Int -> PrimitiveState -> ShowS # show :: PrimitiveState -> String # showList :: [PrimitiveState] -> ShowS # | |
Default PrimitiveState | |
Defined in WGPU.Internal.Pipeline def :: PrimitiveState # | |
ToRaw PrimitiveState WGPUPrimitiveState | |
Defined in WGPU.Internal.Pipeline raw :: PrimitiveState -> ContT r IO WGPUPrimitiveState # |
data StencilOperation #
Operation to perform on a stencil value.
Instances
Eq StencilOperation | |
Defined in WGPU.Internal.Pipeline (==) :: StencilOperation -> StencilOperation -> Bool # (/=) :: StencilOperation -> StencilOperation -> Bool # | |
Show StencilOperation | |
Defined in WGPU.Internal.Pipeline showsPrec :: Int -> StencilOperation -> ShowS # show :: StencilOperation -> String # showList :: [StencilOperation] -> ShowS # | |
ToRaw StencilOperation WGPUStencilOperation | Convert a |
Defined in WGPU.Internal.Pipeline raw :: StencilOperation -> ContT r IO WGPUStencilOperation # |
data StencilState #
State of the stencil operation (fixed pipeline stage).
StencilState | |
|
Instances
Eq StencilState | |
Defined in WGPU.Internal.Pipeline (==) :: StencilState -> StencilState -> Bool # (/=) :: StencilState -> StencilState -> Bool # | |
Show StencilState | |
Defined in WGPU.Internal.Pipeline showsPrec :: Int -> StencilState -> ShowS # show :: StencilState -> String # showList :: [StencilState] -> ShowS # |
data DepthBiasState #
Describes the biasing setting for the depth target.
Instances
Eq DepthBiasState | |
Defined in WGPU.Internal.Pipeline (==) :: DepthBiasState -> DepthBiasState -> Bool # (/=) :: DepthBiasState -> DepthBiasState -> Bool # | |
Show DepthBiasState | |
Defined in WGPU.Internal.Pipeline showsPrec :: Int -> DepthBiasState -> ShowS # show :: DepthBiasState -> String # showList :: [DepthBiasState] -> ShowS # |
data DepthStencilState #
Describes the depth / stencil state of a render pipeline.
DepthStencilState | |
|
Instances
Eq DepthStencilState | |
Defined in WGPU.Internal.Pipeline (==) :: DepthStencilState -> DepthStencilState -> Bool # (/=) :: DepthStencilState -> DepthStencilState -> Bool # | |
Show DepthStencilState | |
Defined in WGPU.Internal.Pipeline showsPrec :: Int -> DepthStencilState -> ShowS # show :: DepthStencilState -> String # showList :: [DepthStencilState] -> ShowS # | |
ToRaw DepthStencilState WGPUDepthStencilState | |
Defined in WGPU.Internal.Pipeline raw :: DepthStencilState -> ContT r IO WGPUDepthStencilState # |
data MultisampleState #
Describes the multi-sampling state of a render pipeline.
MultisampleState | |
|
Instances
Eq MultisampleState | |
Defined in WGPU.Internal.Pipeline (==) :: MultisampleState -> MultisampleState -> Bool # (/=) :: MultisampleState -> MultisampleState -> Bool # | |
Show MultisampleState | |
Defined in WGPU.Internal.Pipeline showsPrec :: Int -> MultisampleState -> ShowS # show :: MultisampleState -> String # showList :: [MultisampleState] -> ShowS # | |
ToRaw MultisampleState WGPUMultisampleState | |
Defined in WGPU.Internal.Pipeline raw :: MultisampleState -> ContT r IO WGPUMultisampleState # |
data BlendFactor #
Alpha blend factor.
Instances
Eq BlendFactor | |
Defined in WGPU.Internal.Pipeline (==) :: BlendFactor -> BlendFactor -> Bool # (/=) :: BlendFactor -> BlendFactor -> Bool # | |
Show BlendFactor | |
Defined in WGPU.Internal.Pipeline showsPrec :: Int -> BlendFactor -> ShowS # show :: BlendFactor -> String # showList :: [BlendFactor] -> ShowS # | |
ToRaw BlendFactor WGPUBlendFactor | Convert a |
Defined in WGPU.Internal.Pipeline raw :: BlendFactor -> ContT r IO WGPUBlendFactor # |
data BlendOperation #
Alpha blending operation.
BlendOperationAdd | |
BlendOperationSubtract | |
BlendOperationReverseSubtract | |
BlendOperationMin | |
BlendOperationMax |
Instances
Eq BlendOperation | |
Defined in WGPU.Internal.Pipeline (==) :: BlendOperation -> BlendOperation -> Bool # (/=) :: BlendOperation -> BlendOperation -> Bool # | |
Show BlendOperation | |
Defined in WGPU.Internal.Pipeline showsPrec :: Int -> BlendOperation -> ShowS # show :: BlendOperation -> String # showList :: [BlendOperation] -> ShowS # | |
ToRaw BlendOperation WGPUBlendOperation | Convert a |
Defined in WGPU.Internal.Pipeline raw :: BlendOperation -> ContT r IO WGPUBlendOperation # |
data BlendComponent #
Describes the blend component of a pipeline.
BlendComponent | |
|
Instances
Eq BlendComponent | |
Defined in WGPU.Internal.Pipeline (==) :: BlendComponent -> BlendComponent -> Bool # (/=) :: BlendComponent -> BlendComponent -> Bool # | |
Show BlendComponent | |
Defined in WGPU.Internal.Pipeline showsPrec :: Int -> BlendComponent -> ShowS # show :: BlendComponent -> String # showList :: [BlendComponent] -> ShowS # | |
Default BlendComponent | |
Defined in WGPU.Internal.Pipeline def :: BlendComponent # | |
ToRaw BlendComponent WGPUBlendComponent | |
Defined in WGPU.Internal.Pipeline raw :: BlendComponent -> ContT r IO WGPUBlendComponent # |
data BlendState #
Describes the blend state of a render pipeline.
BlendState | |
|
Instances
Eq BlendState | |
Defined in WGPU.Internal.Pipeline (==) :: BlendState -> BlendState -> Bool # (/=) :: BlendState -> BlendState -> Bool # | |
Show BlendState | |
Defined in WGPU.Internal.Pipeline showsPrec :: Int -> BlendState -> ShowS # show :: BlendState -> String # showList :: [BlendState] -> ShowS # | |
ToRaw BlendState WGPUBlendState | |
Defined in WGPU.Internal.Pipeline raw :: BlendState -> ContT r IO WGPUBlendState # |
data ColorWriteMask #
Describes which color channels are written.
Instances
Eq ColorWriteMask | |
Defined in WGPU.Internal.Pipeline (==) :: ColorWriteMask -> ColorWriteMask -> Bool # (/=) :: ColorWriteMask -> ColorWriteMask -> Bool # | |
Show ColorWriteMask | |
Defined in WGPU.Internal.Pipeline showsPrec :: Int -> ColorWriteMask -> ShowS # show :: ColorWriteMask -> String # showList :: [ColorWriteMask] -> ShowS # | |
ToRaw ColorWriteMask WGPUColorWriteMask | |
Defined in WGPU.Internal.Pipeline raw :: ColorWriteMask -> ContT r IO WGPUColorWriteMask # |
data ColorTargetState #
Describes the color state of a render pipeline.
ColorTargetState | |
|
Instances
Eq ColorTargetState | |
Defined in WGPU.Internal.Pipeline (==) :: ColorTargetState -> ColorTargetState -> Bool # (/=) :: ColorTargetState -> ColorTargetState -> Bool # | |
Show ColorTargetState | |
Defined in WGPU.Internal.Pipeline showsPrec :: Int -> ColorTargetState -> ShowS # show :: ColorTargetState -> String # showList :: [ColorTargetState] -> ShowS # | |
ToRaw ColorTargetState WGPUColorTargetState | |
Defined in WGPU.Internal.Pipeline raw :: ColorTargetState -> ContT r IO WGPUColorTargetState # |
data FragmentState #
Describes the fragment processing in a render pipeline.
FragmentState | |
|
Instances
Eq FragmentState | |
Defined in WGPU.Internal.Pipeline (==) :: FragmentState -> FragmentState -> Bool # (/=) :: FragmentState -> FragmentState -> Bool # | |
Show FragmentState | |
Defined in WGPU.Internal.Pipeline showsPrec :: Int -> FragmentState -> ShowS # show :: FragmentState -> String # showList :: [FragmentState] -> ShowS # | |
ToRaw FragmentState WGPUFragmentState | |
Defined in WGPU.Internal.Pipeline raw :: FragmentState -> ContT r IO WGPUFragmentState # |
:: MonadIO m | |
=> Device | The device for which the pipeline layout will be created. |
-> PipelineLayoutDescriptor | Descriptor of the pipeline. |
-> m PipelineLayout |
Create a pipeline layout.
createRenderPipeline :: MonadIO m => Device -> RenderPipelineDescriptor -> m RenderPipeline #
colorWriteMaskAll :: ColorWriteMask #
A ColorWriteMask
that writes all colors and the alpha value.
Command Buffers
data CommandBuffer #
Instances
Eq CommandBuffer | |
Defined in WGPU.Internal.CommandBuffer (==) :: CommandBuffer -> CommandBuffer -> Bool # (/=) :: CommandBuffer -> CommandBuffer -> Bool # | |
Show CommandBuffer | |
Defined in WGPU.Internal.CommandBuffer showsPrec :: Int -> CommandBuffer -> ShowS # show :: CommandBuffer -> String # showList :: [CommandBuffer] -> ShowS # | |
ToRaw CommandBuffer WGPUCommandBuffer | |
Defined in WGPU.Internal.CommandBuffer raw :: CommandBuffer -> ContT r IO WGPUCommandBuffer # |
Command Encoding
data CommandEncoder #
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.
Instances
Eq CommandEncoder | |
Defined in WGPU.Internal.CommandEncoder (==) :: CommandEncoder -> CommandEncoder -> Bool # (/=) :: CommandEncoder -> CommandEncoder -> Bool # | |
Show CommandEncoder | |
Defined in WGPU.Internal.CommandEncoder showsPrec :: Int -> CommandEncoder -> ShowS # show :: CommandEncoder -> String # showList :: [CommandEncoder] -> ShowS # | |
ToRaw CommandEncoder WGPUCommandEncoder | |
Defined in WGPU.Internal.CommandEncoder raw :: CommandEncoder -> ContT r IO WGPUCommandEncoder # |
data RenderPassEncoder #
Instances
Eq RenderPassEncoder | |
Defined in WGPU.Internal.RenderPass (==) :: RenderPassEncoder -> RenderPassEncoder -> Bool # (/=) :: RenderPassEncoder -> RenderPassEncoder -> Bool # | |
Show RenderPassEncoder | |
Defined in WGPU.Internal.RenderPass showsPrec :: Int -> RenderPassEncoder -> ShowS # show :: RenderPassEncoder -> String # showList :: [RenderPassEncoder] -> ShowS # | |
ToRaw RenderPassEncoder WGPURenderPassEncoder | |
Defined in WGPU.Internal.RenderPass raw :: RenderPassEncoder -> ContT r IO WGPURenderPassEncoder # |
Operation to perform to the output attachment at the start of a render pass.
LoadOpClear !a | Clear with the specified color value. |
LoadOpLoad | Load from memory. |
Instances
Operation to perform to the output attachment at the end of the render pass.
StoreOpStore | Store the result. |
StoreOpClear | Discard the result. |
Instances
Eq StoreOp | |
Show StoreOp | |
ToRaw StoreOp WGPUStoreOp | |
Defined in WGPU.Internal.RenderPass |
data Operations a #
Instances
Eq a => Eq (Operations a) | |
Defined in WGPU.Internal.RenderPass (==) :: Operations a -> Operations a -> Bool # (/=) :: Operations a -> Operations a -> Bool # | |
Show a => Show (Operations a) | |
Defined in WGPU.Internal.RenderPass showsPrec :: Int -> Operations a -> ShowS # show :: Operations a -> String # showList :: [Operations a] -> ShowS # |
data RenderPassColorAttachment #
Describes a color attachment to a render pass.
RenderPassColorAttachment | |
|
Instances
data RenderPassDepthStencilAttachment #
Describes a depth/stencil attachment to a render pass.
RenderPassDepthStencilAttachment | |
|
data RenderPassDescriptor #
Describes the attachments of a render pass.
RenderPassDescriptor | |
|
Instances
Eq RenderPassDescriptor | |
Defined in WGPU.Internal.RenderPass (==) :: RenderPassDescriptor -> RenderPassDescriptor -> Bool # (/=) :: RenderPassDescriptor -> RenderPassDescriptor -> Bool # | |
Show RenderPassDescriptor | |
Defined in WGPU.Internal.RenderPass showsPrec :: Int -> RenderPassDescriptor -> ShowS # show :: RenderPassDescriptor -> String # showList :: [RenderPassDescriptor] -> ShowS # | |
ToRaw RenderPassDescriptor WGPURenderPassDescriptor | |
Defined in WGPU.Internal.RenderPass |
Half open range. It includes the start
value but not the end
value.
Range | |
|
:: MonadIO m | |
=> Device | Device for which to create the command encoder. |
-> Text | Debug label for the command encoder. |
-> m CommandEncoder | IO action that returns the command encoder. |
Create an empty command encoder.
:: MonadIO m | |
=> CommandEncoder | Command encoder to finish. |
-> Text | Debugging label for the command buffer. |
-> m CommandBuffer | IO action which returns the command buffer. |
Finish encoding commands, returning a command buffer.
:: MonadIO m | |
=> CommandEncoder |
|
-> RenderPassDescriptor | Description of the render pass. |
-> m RenderPassEncoder | IO action which returns the render pass encoder. |
Begins recording of a render pass.
:: MonadIO m | |
=> RenderPassEncoder | Render pass encoder on which to act. |
-> RenderPipeline | Render pipeline to set active. |
-> m () | IO action which sets the active render pipeline. |
Sets the active render pipeline.
Subsequent draw calls will exhibit the behaviour defined by the pipeline.
:: MonadIO m | |
=> RenderPassEncoder | Render pass encoder on which to act. |
-> Range Word32 | Range of vertices to draw. |
-> Range Word32 | Range of instances to draw. |
-> m () | IO action which stores the draw command. |
Draws primitives from the active vertex buffers.
:: MonadIO m | |
=> RenderPassEncoder | Render pass encoder on which to finish recording. |
-> m () | IO action that finishes recording. |
Finish recording of a render pass.
Queue
queueSubmit :: MonadIO m => Queue -> Vector CommandBuffer -> m () #
Submit a list of command buffers to a device queue.
Version
Version of WGPU native.
getVersion :: MonadIO m => Instance -> m Version #
Return the exact version of the WGPU native instance.
versionToText :: Version -> Text #
Convert a Version
value to a text string.
>>>
versionToText (Version 0 9 2 2)
"v0.9.2.2"
Logging
Logging level.
connectLog :: MonadIO m => Instance -> m () #
Connect a stdout logger to the instance.
disconnectLog :: MonadIO m => Instance -> m () #
Disconnect a stdout logger from the instance.
setLogLevel :: MonadIO m => Instance -> LogLevel -> m () #
Set the current logging level for the instance.
Multipurpose
data CompareFunction #
Comparison function used for depth and stencil operations.
CompareFunctionNever | |
CompareFunctionLess | |
CompareFunctionEqual | |
CompareFunctionLessEqual | |
CompareFunctionGreater | |
CompareFunctionNotEqual | |
CompareFunctionGreaterEqual | |
CompareFunctionAlways |
Instances
Eq CompareFunction | |
Defined in WGPU.Internal.Multipurpose (==) :: CompareFunction -> CompareFunction -> Bool # (/=) :: CompareFunction -> CompareFunction -> Bool # | |
Show CompareFunction | |
Defined in WGPU.Internal.Multipurpose showsPrec :: Int -> CompareFunction -> ShowS # show :: CompareFunction -> String # showList :: [CompareFunction] -> ShowS # | |
ToRaw CompareFunction WGPUCompareFunction | Convert a |
Defined in WGPU.Internal.Multipurpose raw :: CompareFunction -> ContT r IO WGPUCompareFunction # |
Extras
Strict Maybe
Strict version of the Maybe
type.