vulkan-3.1.0.0: Bindings to the Vulkan graphics API.

Safe HaskellNone
LanguageHaskell2010

Graphics.Vulkan.CStruct.Utils

Synopsis

Documentation

withVec :: forall a b d. Storable b => (a -> (b -> IO d) -> IO d) -> Vector a -> (Ptr b -> IO d) -> IO d Source #

withArray :: forall a b d. (a -> (b -> IO d) -> IO d) -> Vector a -> (Vector b -> IO d) -> IO d Source #

withSizedArray :: forall a b d n. (a -> (b -> IO d) -> IO d) -> Vector n a -> (Vector n b -> IO d) -> IO d Source #

byteStringToSizedVector :: forall n v. (KnownNat n, Vector v Word8) => ByteString -> Vector v n Word8 Source #

Convert a bytestring to a sized vector. If the bytestring is too long it will be truncated. If it is too short it will be zero padded

byteStringToNullTerminatedSizedVector :: forall n v. (KnownNat n, 1 <= n, Vector v CChar) => ByteString -> Vector v n CChar Source #

Convert a bytestring to a null terminated sized vector. If the bytestring is too long it will be truncated.

padSized Source #

Arguments

:: (KnownNat n, Vector v a) 
=> a

The value with which to pad if the given vector is too short

-> v a

The vector to pad or truncate

-> Vector v n a 

Pad or truncate a vector so that it has the required size

padVector :: Vector v a => a -> Int -> v a -> v a Source #

Make sure a vector is at least a certain length

pokeFixedLengthByteString :: forall n. KnownNat n => Ptr (Vector n Word8) -> ByteString -> IO () Source #

Store a ByteString in a fixed amount of space, truncating if necessary.

If the ByteString is not long enough to fill the space the remaining bytes are unchanged

pokeFixedLengthNullTerminatedByteString :: forall n. KnownNat n => Ptr (Vector n CChar) -> ByteString -> IO () Source #

Store a ByteString in a fixed amount of space inserting a null character at the end and truncating if necessary.

If the ByteString is not long enough to fill the space the remaining bytes are unchanged

Note that if the ByteString is exactly long enough the last byte will still be replaced with 0

lowerArrayPtr :: forall a n. Ptr (Vector n a) -> Ptr a Source #

Get the pointer to the first element in the array

advancePtrBytes :: Ptr a -> Int -> Ptr a Source #

A type restricted plusPtr