{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE ScopedTypeVariables #-}
module WGPU.Classy
(
HasInstance,
HasSurface,
HasAdapter,
HasDevice,
HasSwapChain,
HasCommandEncoder,
HasRenderPassEncoder,
HasQueue,
requestAdapter,
getAdapterProperties,
requestDevice,
getSwapChainPreferredFormat,
createSwapChain,
getSwapChainCurrentTextureView,
swapChainPresent,
createBindGroupLayout,
createShaderModule,
createShaderModuleSPIRV,
createShaderModuleWGSL,
createPipelineLayout,
createRenderPipeline,
createCommandEncoder,
commandEncoderFinish,
beginRenderPass,
renderPassSetPipeline,
renderPassDraw,
endRenderPass,
getQueue,
queueSubmit,
queueSubmit',
getVersion,
connectLog,
disconnectLog,
setLogLevel,
addEnv,
buildCommandBuffer,
buildRenderPass,
)
where
import Control.Monad.IO.Class (MonadIO)
import Control.Monad.Reader (MonadReader, ReaderT, ask, asks, runReaderT)
import Data.Has (Has, getter)
import Data.Text (Text)
import Data.Vector (Vector)
import Data.Word (Word32)
import WGPU
( Adapter,
AdapterProperties,
BindGroupLayout,
BindGroupLayoutDescriptor,
CommandBuffer,
CommandEncoder,
Device,
DeviceDescriptor,
Instance,
LogLevel,
PipelineLayout,
PipelineLayoutDescriptor,
Queue,
Range,
RenderPassDescriptor,
RenderPassEncoder,
RenderPipeline,
RenderPipelineDescriptor,
SPIRV,
ShaderModule,
ShaderModuleDescriptor,
Surface,
SwapChain,
SwapChainDescriptor,
TextureFormat,
TextureView,
Version,
WGSL,
)
import qualified WGPU
type RIO r m = (MonadIO m, MonadReader r m)
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)
access :: (Has q r, MonadReader r m) => (q -> m a) -> m a
access :: (q -> m a) -> m a
access q -> m a
action = (r -> q) -> m q
forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks r -> q
forall a t. Has a t => t -> a
getter m q -> (q -> m a) -> m a
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= q -> m a
action
{-# INLINEABLE access #-}
access2 :: (Has q r, MonadReader r m) => (q -> b -> m a) -> b -> m a
access2 :: (q -> b -> m a) -> b -> m a
access2 q -> b -> m a
action b
y = (r -> q) -> m q
forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks r -> q
forall a t. Has a t => t -> a
getter m q -> (q -> m a) -> m a
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \q
x -> q -> b -> m a
action q
x b
y
{-# INLINEABLE access2 #-}
access3 :: (Has q r, MonadReader r m) => (q -> b -> c -> m a) -> b -> c -> m a
access3 :: (q -> b -> c -> m a) -> b -> c -> m a
access3 q -> b -> c -> m a
action b
y c
z = (r -> q) -> m q
forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks r -> q
forall a t. Has a t => t -> a
getter m q -> (q -> m a) -> m a
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \q
x -> q -> b -> c -> m a
action q
x b
y c
z
{-# INLINEABLE access3 #-}
requestAdapter :: HasSurface r m => m (Maybe Adapter)
requestAdapter :: m (Maybe Adapter)
requestAdapter = (Surface -> m (Maybe Adapter)) -> m (Maybe Adapter)
forall q r (m :: * -> *) a.
(Has q r, MonadReader r m) =>
(q -> m a) -> m a
access Surface -> m (Maybe Adapter)
forall (m :: * -> *). MonadIO m => Surface -> m (Maybe Adapter)
WGPU.requestAdapter
{-# INLINEABLE requestAdapter #-}
getAdapterProperties :: HasAdapter r m => m AdapterProperties
getAdapterProperties :: m AdapterProperties
getAdapterProperties = (Adapter -> m AdapterProperties) -> m AdapterProperties
forall q r (m :: * -> *) a.
(Has q r, MonadReader r m) =>
(q -> m a) -> m a
access Adapter -> m AdapterProperties
forall (m :: * -> *). MonadIO m => Adapter -> m AdapterProperties
WGPU.getAdapterProperties
{-# INLINEABLE getAdapterProperties #-}
requestDevice :: HasAdapter r m => DeviceDescriptor -> m (Maybe Device)
requestDevice :: DeviceDescriptor -> m (Maybe Device)
requestDevice = (Adapter -> DeviceDescriptor -> m (Maybe Device))
-> DeviceDescriptor -> m (Maybe Device)
forall q r (m :: * -> *) b a.
(Has q r, MonadReader r m) =>
(q -> b -> m a) -> b -> m a
access2 Adapter -> DeviceDescriptor -> m (Maybe Device)
forall (m :: * -> *).
MonadIO m =>
Adapter -> DeviceDescriptor -> m (Maybe Device)
WGPU.requestDevice
{-# INLINEABLE requestDevice #-}
getSwapChainPreferredFormat ::
(HasSurface r m, HasAdapter r m) =>
m TextureFormat
getSwapChainPreferredFormat :: m TextureFormat
getSwapChainPreferredFormat =
(Adapter -> m TextureFormat) -> m TextureFormat
forall q r (m :: * -> *) a.
(Has q r, MonadReader r m) =>
(q -> m a) -> m a
access ((Adapter -> m TextureFormat) -> m TextureFormat)
-> ((Surface -> Adapter -> m TextureFormat)
-> Adapter -> m TextureFormat)
-> (Surface -> Adapter -> m TextureFormat)
-> m TextureFormat
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Surface -> Adapter -> m TextureFormat)
-> Adapter -> m TextureFormat
forall q r (m :: * -> *) b a.
(Has q r, MonadReader r m) =>
(q -> b -> m a) -> b -> m a
access2 ((Surface -> Adapter -> m TextureFormat) -> m TextureFormat)
-> (Surface -> Adapter -> m TextureFormat) -> m TextureFormat
forall a b. (a -> b) -> a -> b
$ Surface -> Adapter -> m TextureFormat
forall (m :: * -> *).
MonadIO m =>
Surface -> Adapter -> m TextureFormat
WGPU.getSwapChainPreferredFormat
{-# INLINEABLE getSwapChainPreferredFormat #-}
createSwapChain ::
(HasDevice r m, HasSurface r m) =>
SwapChainDescriptor ->
m SwapChain
createSwapChain :: SwapChainDescriptor -> m SwapChain
createSwapChain = (Surface -> SwapChainDescriptor -> m SwapChain)
-> SwapChainDescriptor -> m SwapChain
forall q r (m :: * -> *) b a.
(Has q r, MonadReader r m) =>
(q -> b -> m a) -> b -> m a
access2 ((Surface -> SwapChainDescriptor -> m SwapChain)
-> SwapChainDescriptor -> m SwapChain)
-> ((Device -> Surface -> SwapChainDescriptor -> m SwapChain)
-> Surface -> SwapChainDescriptor -> m SwapChain)
-> (Device -> Surface -> SwapChainDescriptor -> m SwapChain)
-> SwapChainDescriptor
-> m SwapChain
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Device -> Surface -> SwapChainDescriptor -> m SwapChain)
-> Surface -> SwapChainDescriptor -> m SwapChain
forall q r (m :: * -> *) b c a.
(Has q r, MonadReader r m) =>
(q -> b -> c -> m a) -> b -> c -> m a
access3 ((Device -> Surface -> SwapChainDescriptor -> m SwapChain)
-> SwapChainDescriptor -> m SwapChain)
-> (Device -> Surface -> SwapChainDescriptor -> m SwapChain)
-> SwapChainDescriptor
-> m SwapChain
forall a b. (a -> b) -> a -> b
$ Device -> Surface -> SwapChainDescriptor -> m SwapChain
forall (m :: * -> *).
MonadIO m =>
Device -> Surface -> SwapChainDescriptor -> m SwapChain
WGPU.createSwapChain
{-# INLINEABLE createSwapChain #-}
getSwapChainCurrentTextureView :: HasSwapChain r m => m TextureView
getSwapChainCurrentTextureView :: m TextureView
getSwapChainCurrentTextureView = (SwapChain -> m TextureView) -> m TextureView
forall q r (m :: * -> *) a.
(Has q r, MonadReader r m) =>
(q -> m a) -> m a
access SwapChain -> m TextureView
forall (m :: * -> *). MonadIO m => SwapChain -> m TextureView
WGPU.getSwapChainCurrentTextureView
{-# INLINEABLE getSwapChainCurrentTextureView #-}
swapChainPresent :: HasSwapChain r m => m ()
swapChainPresent :: m ()
swapChainPresent = (SwapChain -> m ()) -> m ()
forall q r (m :: * -> *) a.
(Has q r, MonadReader r m) =>
(q -> m a) -> m a
access SwapChain -> m ()
forall (m :: * -> *). MonadIO m => SwapChain -> m ()
WGPU.swapChainPresent
{-# INLINEABLE swapChainPresent #-}
createBindGroupLayout ::
HasDevice r m =>
BindGroupLayoutDescriptor ->
m BindGroupLayout
createBindGroupLayout :: BindGroupLayoutDescriptor -> m BindGroupLayout
createBindGroupLayout = (Device -> BindGroupLayoutDescriptor -> m BindGroupLayout)
-> BindGroupLayoutDescriptor -> m BindGroupLayout
forall q r (m :: * -> *) b a.
(Has q r, MonadReader r m) =>
(q -> b -> m a) -> b -> m a
access2 Device -> BindGroupLayoutDescriptor -> m BindGroupLayout
forall (m :: * -> *).
MonadIO m =>
Device -> BindGroupLayoutDescriptor -> m BindGroupLayout
WGPU.createBindGroupLayout
{-# INLINEABLE createBindGroupLayout #-}
createShaderModule :: HasDevice r m => ShaderModuleDescriptor -> m ShaderModule
createShaderModule :: ShaderModuleDescriptor -> m ShaderModule
createShaderModule = (Device -> ShaderModuleDescriptor -> m ShaderModule)
-> ShaderModuleDescriptor -> m ShaderModule
forall q r (m :: * -> *) b a.
(Has q r, MonadReader r m) =>
(q -> b -> m a) -> b -> m a
access2 Device -> ShaderModuleDescriptor -> m ShaderModule
forall (m :: * -> *).
MonadIO m =>
Device -> ShaderModuleDescriptor -> m ShaderModule
WGPU.createShaderModule
{-# INLINEABLE createShaderModule #-}
createShaderModuleSPIRV :: HasDevice r m => Text -> SPIRV -> m ShaderModule
createShaderModuleSPIRV :: Text -> SPIRV -> m ShaderModule
createShaderModuleSPIRV = (Device -> Text -> SPIRV -> m ShaderModule)
-> Text -> SPIRV -> m ShaderModule
forall q r (m :: * -> *) b c a.
(Has q r, MonadReader r m) =>
(q -> b -> c -> m a) -> b -> c -> m a
access3 Device -> Text -> SPIRV -> m ShaderModule
forall (m :: * -> *).
MonadIO m =>
Device -> Text -> SPIRV -> m ShaderModule
WGPU.createShaderModuleSPIRV
{-# INLINEABLE createShaderModuleSPIRV #-}
createShaderModuleWGSL :: HasDevice r m => Text -> WGSL -> m ShaderModule
createShaderModuleWGSL :: Text -> WGSL -> m ShaderModule
createShaderModuleWGSL = (Device -> Text -> WGSL -> m ShaderModule)
-> Text -> WGSL -> m ShaderModule
forall q r (m :: * -> *) b c a.
(Has q r, MonadReader r m) =>
(q -> b -> c -> m a) -> b -> c -> m a
access3 Device -> Text -> WGSL -> m ShaderModule
forall (m :: * -> *).
MonadIO m =>
Device -> Text -> WGSL -> m ShaderModule
WGPU.createShaderModuleWGSL
{-# INLINEABLE createShaderModuleWGSL #-}
createPipelineLayout ::
HasDevice r m =>
PipelineLayoutDescriptor ->
m PipelineLayout
createPipelineLayout :: PipelineLayoutDescriptor -> m PipelineLayout
createPipelineLayout = (Device -> PipelineLayoutDescriptor -> m PipelineLayout)
-> PipelineLayoutDescriptor -> m PipelineLayout
forall q r (m :: * -> *) b a.
(Has q r, MonadReader r m) =>
(q -> b -> m a) -> b -> m a
access2 Device -> PipelineLayoutDescriptor -> m PipelineLayout
forall (m :: * -> *).
MonadIO m =>
Device -> PipelineLayoutDescriptor -> m PipelineLayout
WGPU.createPipelineLayout
{-# INLINEABLE createPipelineLayout #-}
createRenderPipeline ::
HasDevice r m =>
RenderPipelineDescriptor ->
m RenderPipeline
createRenderPipeline :: RenderPipelineDescriptor -> m RenderPipeline
createRenderPipeline = (Device -> RenderPipelineDescriptor -> m RenderPipeline)
-> RenderPipelineDescriptor -> m RenderPipeline
forall q r (m :: * -> *) b a.
(Has q r, MonadReader r m) =>
(q -> b -> m a) -> b -> m a
access2 Device -> RenderPipelineDescriptor -> m RenderPipeline
forall (m :: * -> *).
MonadIO m =>
Device -> RenderPipelineDescriptor -> m RenderPipeline
WGPU.createRenderPipeline
{-# INLINEABLE createRenderPipeline #-}
createCommandEncoder :: HasDevice r m => Text -> m CommandEncoder
createCommandEncoder :: Text -> m CommandEncoder
createCommandEncoder = (Device -> Text -> m CommandEncoder) -> Text -> m CommandEncoder
forall q r (m :: * -> *) b a.
(Has q r, MonadReader r m) =>
(q -> b -> m a) -> b -> m a
access2 Device -> Text -> m CommandEncoder
forall (m :: * -> *).
MonadIO m =>
Device -> Text -> m CommandEncoder
WGPU.createCommandEncoder
{-# INLINEABLE createCommandEncoder #-}
commandEncoderFinish :: HasCommandEncoder r m => Text -> m CommandBuffer
commandEncoderFinish :: Text -> m CommandBuffer
commandEncoderFinish = (CommandEncoder -> Text -> m CommandBuffer)
-> Text -> m CommandBuffer
forall q r (m :: * -> *) b a.
(Has q r, MonadReader r m) =>
(q -> b -> m a) -> b -> m a
access2 CommandEncoder -> Text -> m CommandBuffer
forall (m :: * -> *).
MonadIO m =>
CommandEncoder -> Text -> m CommandBuffer
WGPU.commandEncoderFinish
{-# INLINEABLE commandEncoderFinish #-}
beginRenderPass ::
HasCommandEncoder r m =>
RenderPassDescriptor ->
m RenderPassEncoder
beginRenderPass :: RenderPassDescriptor -> m RenderPassEncoder
beginRenderPass = (CommandEncoder -> RenderPassDescriptor -> m RenderPassEncoder)
-> RenderPassDescriptor -> m RenderPassEncoder
forall q r (m :: * -> *) b a.
(Has q r, MonadReader r m) =>
(q -> b -> m a) -> b -> m a
access2 CommandEncoder -> RenderPassDescriptor -> m RenderPassEncoder
forall (m :: * -> *).
MonadIO m =>
CommandEncoder -> RenderPassDescriptor -> m RenderPassEncoder
WGPU.beginRenderPass
{-# INLINEABLE beginRenderPass #-}
renderPassSetPipeline :: HasRenderPassEncoder r m => RenderPipeline -> m ()
renderPassSetPipeline :: RenderPipeline -> m ()
renderPassSetPipeline = (RenderPassEncoder -> RenderPipeline -> m ())
-> RenderPipeline -> m ()
forall q r (m :: * -> *) b a.
(Has q r, MonadReader r m) =>
(q -> b -> m a) -> b -> m a
access2 RenderPassEncoder -> RenderPipeline -> m ()
forall (m :: * -> *).
MonadIO m =>
RenderPassEncoder -> RenderPipeline -> m ()
WGPU.renderPassSetPipeline
{-# INLINEABLE renderPassSetPipeline #-}
renderPassDraw ::
HasRenderPassEncoder r m =>
Range Word32 ->
Range Word32 ->
m ()
renderPassDraw :: Range Word32 -> Range Word32 -> m ()
renderPassDraw = (RenderPassEncoder -> Range Word32 -> Range Word32 -> m ())
-> Range Word32 -> Range Word32 -> m ()
forall q r (m :: * -> *) b c a.
(Has q r, MonadReader r m) =>
(q -> b -> c -> m a) -> b -> c -> m a
access3 RenderPassEncoder -> Range Word32 -> Range Word32 -> m ()
forall (m :: * -> *).
MonadIO m =>
RenderPassEncoder -> Range Word32 -> Range Word32 -> m ()
WGPU.renderPassDraw
{-# INLINEABLE renderPassDraw #-}
endRenderPass :: HasRenderPassEncoder r m => m ()
endRenderPass :: m ()
endRenderPass = (RenderPassEncoder -> m ()) -> m ()
forall q r (m :: * -> *) a.
(Has q r, MonadReader r m) =>
(q -> m a) -> m a
access RenderPassEncoder -> m ()
forall (m :: * -> *). MonadIO m => RenderPassEncoder -> m ()
WGPU.endRenderPass
{-# INLINEABLE endRenderPass #-}
getQueue :: HasDevice r m => m Queue
getQueue :: m Queue
getQueue = (Device -> m Queue) -> m Queue
forall q r (m :: * -> *) a.
(Has q r, MonadReader r m) =>
(q -> m a) -> m a
access Device -> m Queue
forall (m :: * -> *). MonadIO m => Device -> m Queue
WGPU.getQueue
{-# INLINEABLE getQueue #-}
queueSubmit :: HasQueue r m => Vector CommandBuffer -> m ()
queueSubmit :: Vector CommandBuffer -> m ()
queueSubmit = (Queue -> Vector CommandBuffer -> m ())
-> Vector CommandBuffer -> m ()
forall q r (m :: * -> *) b a.
(Has q r, MonadReader r m) =>
(q -> b -> m a) -> b -> m a
access2 Queue -> Vector CommandBuffer -> m ()
forall (m :: * -> *).
MonadIO m =>
Queue -> Vector CommandBuffer -> m ()
WGPU.queueSubmit
{-# INLINEABLE queueSubmit #-}
queueSubmit' :: HasDevice r m => Vector CommandBuffer -> m ()
queueSubmit' :: Vector CommandBuffer -> m ()
queueSubmit' = ReaderT (Queue, r) m () -> m ()
forall r (m :: * -> *).
HasDevice r m =>
ReaderT (Queue, r) m () -> m ()
buildQueue (ReaderT (Queue, r) m () -> m ())
-> (Vector CommandBuffer -> ReaderT (Queue, r) m ())
-> Vector CommandBuffer
-> m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector CommandBuffer -> ReaderT (Queue, r) m ()
forall r (m :: * -> *).
HasQueue r m =>
Vector CommandBuffer -> m ()
queueSubmit
{-# INLINEABLE queueSubmit' #-}
getVersion :: HasInstance r m => m Version
getVersion :: m Version
getVersion = (Instance -> m Version) -> m Version
forall q r (m :: * -> *) a.
(Has q r, MonadReader r m) =>
(q -> m a) -> m a
access Instance -> m Version
forall (m :: * -> *). MonadIO m => Instance -> m Version
WGPU.getVersion
connectLog :: HasInstance r m => m ()
connectLog :: m ()
connectLog = (Instance -> m ()) -> m ()
forall q r (m :: * -> *) a.
(Has q r, MonadReader r m) =>
(q -> m a) -> m a
access Instance -> m ()
forall (m :: * -> *). MonadIO m => Instance -> m ()
WGPU.connectLog
{-# INLINEABLE connectLog #-}
disconnectLog :: HasInstance r m => m ()
disconnectLog :: m ()
disconnectLog = (Instance -> m ()) -> m ()
forall q r (m :: * -> *) a.
(Has q r, MonadReader r m) =>
(q -> m a) -> m a
access Instance -> m ()
forall (m :: * -> *). MonadIO m => Instance -> m ()
WGPU.disconnectLog
{-# INLINEABLE disconnectLog #-}
setLogLevel :: HasInstance r m => LogLevel -> m ()
setLogLevel :: LogLevel -> m ()
setLogLevel = (Instance -> LogLevel -> m ()) -> LogLevel -> m ()
forall q r (m :: * -> *) b a.
(Has q r, MonadReader r m) =>
(q -> b -> m a) -> b -> m a
access2 Instance -> LogLevel -> m ()
forall (m :: * -> *). MonadIO m => Instance -> LogLevel -> m ()
WGPU.setLogLevel
{-# INLINEABLE setLogLevel #-}
addEnv :: MonadReader r m => q -> ReaderT (q, r) m a -> m a
addEnv :: q -> ReaderT (q, r) m a -> m a
addEnv q
x ReaderT (q, r) m a
action = m r
forall r (m :: * -> *). MonadReader r m => m r
ask m r -> (r -> m a) -> m a
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \r
env -> ReaderT (q, r) m a -> (q, r) -> m a
forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
runReaderT ReaderT (q, r) m a
action (q
x, r
env)
{-# INLINEABLE addEnv #-}
buildCommandBuffer ::
forall r m.
HasDevice r m =>
Text ->
Text ->
ReaderT (CommandEncoder, r) m () ->
m CommandBuffer
buildCommandBuffer :: Text -> Text -> ReaderT (CommandEncoder, r) m () -> m CommandBuffer
buildCommandBuffer Text
commandEncoderLabel Text
commandBufferLabel ReaderT (CommandEncoder, r) m ()
build = do
CommandEncoder
commandEncoder <- Text -> m CommandEncoder
forall r (m :: * -> *). HasDevice r m => Text -> m CommandEncoder
createCommandEncoder Text
commandEncoderLabel
CommandEncoder
-> ReaderT (CommandEncoder, r) m CommandBuffer -> m CommandBuffer
forall r (m :: * -> *) q a.
MonadReader r m =>
q -> ReaderT (q, r) m a -> m a
addEnv CommandEncoder
commandEncoder (ReaderT (CommandEncoder, r) m ()
build ReaderT (CommandEncoder, r) m ()
-> ReaderT (CommandEncoder, r) m CommandBuffer
-> ReaderT (CommandEncoder, r) m CommandBuffer
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Text -> ReaderT (CommandEncoder, r) m CommandBuffer
forall r (m :: * -> *).
HasCommandEncoder r m =>
Text -> m CommandBuffer
commandEncoderFinish Text
commandBufferLabel)
{-# INLINEABLE buildCommandBuffer #-}
buildRenderPass ::
forall r m.
HasCommandEncoder r m =>
RenderPassDescriptor ->
ReaderT (RenderPassEncoder, r) m () ->
m ()
buildRenderPass :: RenderPassDescriptor -> ReaderT (RenderPassEncoder, r) m () -> m ()
buildRenderPass RenderPassDescriptor
renderPassDescriptor ReaderT (RenderPassEncoder, r) m ()
build = do
RenderPassEncoder
renderPassEncoder <- RenderPassDescriptor -> m RenderPassEncoder
forall r (m :: * -> *).
HasCommandEncoder r m =>
RenderPassDescriptor -> m RenderPassEncoder
beginRenderPass RenderPassDescriptor
renderPassDescriptor
RenderPassEncoder -> ReaderT (RenderPassEncoder, r) m () -> m ()
forall r (m :: * -> *) q a.
MonadReader r m =>
q -> ReaderT (q, r) m a -> m a
addEnv RenderPassEncoder
renderPassEncoder (ReaderT (RenderPassEncoder, r) m ()
build ReaderT (RenderPassEncoder, r) m ()
-> ReaderT (RenderPassEncoder, r) m ()
-> ReaderT (RenderPassEncoder, r) m ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> ReaderT (RenderPassEncoder, r) m ()
forall r (m :: * -> *). HasRenderPassEncoder r m => m ()
endRenderPass)
{-# INLINEABLE buildRenderPass #-}
buildQueue :: HasDevice r m => ReaderT (Queue, r) m () -> m ()
buildQueue :: ReaderT (Queue, r) m () -> m ()
buildQueue ReaderT (Queue, r) m ()
action = m Queue
forall r (m :: * -> *). HasDevice r m => m Queue
getQueue m Queue -> (Queue -> m ()) -> m ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Queue
queue -> Queue -> ReaderT (Queue, r) m () -> m ()
forall r (m :: * -> *) q a.
MonadReader r m =>
q -> ReaderT (q, r) m a -> m a
addEnv Queue
queue ReaderT (Queue, r) m ()
action
{-# INLINEABLE buildQueue #-}