{-# LANGUAGE MultiParamTypeClasses #-}
module WGPU.Internal.CommandBuffer
(
CommandBuffer (..),
)
where
import WGPU.Internal.Memory (ToRaw, raw, showWithPtr)
import WGPU.Raw.Types (WGPUCommandBuffer (WGPUCommandBuffer))
newtype CommandBuffer = CommandBuffer {CommandBuffer -> WGPUCommandBuffer
wgpuCommandBuffer :: WGPUCommandBuffer}
instance Show CommandBuffer where
show :: CommandBuffer -> String
show CommandBuffer
b =
let CommandBuffer (WGPUCommandBuffer Ptr ()
ptr) = CommandBuffer
b
in String -> Ptr () -> String
forall a. String -> Ptr a -> String
showWithPtr String
"CommandBuffer" Ptr ()
ptr
instance Eq CommandBuffer where
== :: CommandBuffer -> CommandBuffer -> Bool
(==) CommandBuffer
b1 CommandBuffer
b2 =
let CommandBuffer (WGPUCommandBuffer Ptr ()
b1_ptr) = CommandBuffer
b1
CommandBuffer (WGPUCommandBuffer Ptr ()
b2_ptr) = CommandBuffer
b2
in Ptr ()
b1_ptr Ptr () -> Ptr () -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr ()
b2_ptr
instance ToRaw CommandBuffer WGPUCommandBuffer where
raw :: CommandBuffer -> ContT r IO WGPUCommandBuffer
raw = WGPUCommandBuffer -> ContT r IO WGPUCommandBuffer
forall (f :: * -> *) a. Applicative f => a -> f a
pure (WGPUCommandBuffer -> ContT r IO WGPUCommandBuffer)
-> (CommandBuffer -> WGPUCommandBuffer)
-> CommandBuffer
-> ContT r IO WGPUCommandBuffer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CommandBuffer -> WGPUCommandBuffer
wgpuCommandBuffer