Copyright | (C) 2015 Dimitri Sabadie |
---|---|
License | BSD3 |
Maintainer | Dimitri Sabadie <dimitri.sabadie@gmail.com> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
- data Buffer
- bufferID :: Buffer -> GLuint
- createBuffer :: forall a m rw. (BufferRW rw, MonadIO m, MonadResource m) => BuildRegion rw a -> m a
- createBuffer_ :: forall a m rw. (BufferRW rw, MonadIO m, MonadResource m) => BuildRegion rw a -> m (a, Buffer)
- class BufferRW rw
- data Region rw a
- data BuildRegion rw a
- newRegion :: forall rw a. Storable a => Word32 -> BuildRegion rw (Region rw a)
- readWhole :: (MonadIO m, Readable r, Storable a) => Region r a -> m [a]
- writeWhole :: (Foldable f, MonadIO m, Storable a, Writable w) => Region w a -> f a -> m ()
- fill :: (MonadIO m, Storable a, Writable w) => Region w a -> a -> m ()
- (@?) :: (MonadIO m, Storable a, Readable r) => Region r a -> Word32 -> m (Maybe a)
- (@!) :: (MonadIO m, Storable a, Readable r) => Region r a -> Word32 -> m a
- writeAt :: (MonadIO m, Storable a, Writable w) => Region w a -> Word32 -> a -> m ()
- writeAt' :: (MonadIO m, Storable a, Writable w) => Region w a -> Word32 -> a -> m ()
Buffer creation
A Buffer
is an opaque and untyped region of abstract GPU memory. You cannot do much with it
and you might even not see the type in the user interface as it’s not really needed. It’s shown
for informational purposes only.
createBuffer :: forall a m rw. (BufferRW rw, MonadIO m, MonadResource m) => BuildRegion rw a -> m a Source
Create a new Buffer
and expose Region
s. Through the BuildRegion
type, you can yield new
regions and embed them in the type of your choice. The function returns that type.
createBuffer_ :: forall a m rw. (BufferRW rw, MonadIO m, MonadResource m) => BuildRegion rw a -> m (a, Buffer) Source
Buffer access
bufferFlagsFromRW
Buffer regions
A Region
is a GPU typed memory area. It can be pictured as a GPU array.
data BuildRegion rw a Source
Convenient type to build Region
s.
Monad (BuildRegion rw) Source | |
Functor (BuildRegion rw) Source | |
Applicative (BuildRegion rw) Source |
newRegion :: forall rw a. Storable a => Word32 -> BuildRegion rw (Region rw a) Source
Create a new Region
by providing the number of wished elements.
Operations on buffer regions
fill :: (MonadIO m, Storable a, Writable w) => Region w a -> a -> m () Source
Fill a Region
with a value.
(@?) :: (MonadIO m, Storable a, Readable r) => Region r a -> Word32 -> m (Maybe a) Source
Index getter. Bounds checking is performed and returns Nothing
if out of bounds.
(@!) :: (MonadIO m, Storable a, Readable r) => Region r a -> Word32 -> m a Source
Index getter. Unsafe version of '(@?)'.