{-# LANGUAGE MultiParamTypeClasses #-}
module WGPU.Internal.Surface
(
Surface (..),
)
where
import WGPU.Internal.Instance (Instance)
import WGPU.Internal.Memory (ToRaw, raw, showWithPtr)
import WGPU.Raw.Types (WGPUSurface (WGPUSurface))
data Surface = Surface
{ Surface -> Instance
surfaceInst :: !Instance,
Surface -> WGPUSurface
wgpuSurface :: !WGPUSurface
}
instance Show Surface where
show :: Surface -> String
show Surface
s =
let Surface Instance
_ (WGPUSurface Ptr ()
ptr) = Surface
s
in String -> Ptr () -> String
forall a. String -> Ptr a -> String
showWithPtr String
"Surface" Ptr ()
ptr
instance Eq Surface where
== :: Surface -> Surface -> Bool
(==) Surface
s1 Surface
s2 =
let Surface Instance
_ (WGPUSurface Ptr ()
s1_ptr) = Surface
s1
Surface Instance
_ (WGPUSurface Ptr ()
s2_ptr) = Surface
s2
in Ptr ()
s1_ptr Ptr () -> Ptr () -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr ()
s2_ptr
instance ToRaw Surface WGPUSurface where
raw :: Surface -> ContT r IO WGPUSurface
raw = WGPUSurface -> ContT r IO WGPUSurface
forall (f :: * -> *) a. Applicative f => a -> f a
pure (WGPUSurface -> ContT r IO WGPUSurface)
-> (Surface -> WGPUSurface) -> Surface -> ContT r IO WGPUSurface
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Surface -> WGPUSurface
wgpuSurface