{-# LINE 1 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}

{-# LINE 2 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}

{-# LANGUAGE DataKinds             #-}
{-# LANGUAGE FlexibleInstances     #-}
{-# LANGUAGE MagicHash             #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE Strict                #-}
{-# LANGUAGE TypeApplications      #-}
{-# LANGUAGE TypeFamilies          #-}
module Graphics.Vulkan.Types.Struct.Extent
       (VkExtent2D(..), VkExtent3D(..)) where
import           Foreign.Storable                 (Storable (..))
import           GHC.Base                         (Addr#, ByteArray#,
                                                   byteArrayContents#,
                                                   plusAddr#)
import           Graphics.Vulkan.Marshal
import           Graphics.Vulkan.Marshal.Internal
import           System.IO.Unsafe                 (unsafeDupablePerformIO)

-- | > typedef struct VkExtent2D {
--   >     uint32_t        width;
--   >     uint32_t        height;
--   > } VkExtent2D;
--
--   <https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VkExtent2D VkExtent2D registry at www.khronos.org>
data VkExtent2D = VkExtent2D# Addr# ByteArray#

instance Eq VkExtent2D where
        (VkExtent2D# a _) == x@(VkExtent2D# b _)
          = EQ == cmpBytes# (sizeOf x) a b

        {-# INLINE (==) #-}

instance Ord VkExtent2D where
        (VkExtent2D# a _) `compare` x@(VkExtent2D# b _)
          = cmpBytes# (sizeOf x) a b

        {-# INLINE compare #-}

instance Storable VkExtent2D where
        sizeOf ~_ = (8)
{-# LINE 42 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}

        {-# INLINE sizeOf #-}
        alignment ~_ = (4)
{-# LINE 45 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}

        {-# INLINE alignment #-}
        peek = peekVkData#

        {-# INLINE peek #-}
        poke = pokeVkData#

        {-# INLINE poke #-}

instance VulkanMarshalPrim VkExtent2D where
        unsafeAddr (VkExtent2D# a _) = a

        {-# INLINE unsafeAddr #-}
        unsafeByteArray (VkExtent2D# _ b) = b

        {-# INLINE unsafeByteArray #-}
        unsafeFromByteArrayOffset off b
          = VkExtent2D# (plusAddr# (byteArrayContents# b) off) b

        {-# INLINE unsafeFromByteArrayOffset #-}

instance VulkanMarshal VkExtent2D where
        type StructFields VkExtent2D = '["width", "height"] -- ' closing tick for hsc2hs
        type CUnionType VkExtent2D = 'False -- ' closing tick for hsc2hs
        type ReturnedOnly VkExtent2D = 'False -- ' closing tick for hsc2hs
        type StructExtends VkExtent2D = '[] -- ' closing tick for hsc2hs

instance {-# OVERLAPPING #-} HasField "width" VkExtent2D where
        type FieldType "width" VkExtent2D = Word32
        type FieldOptional "width" VkExtent2D = 'False -- ' closing tick for hsc2hs
        type FieldOffset "width" VkExtent2D =
             (0)
{-# LINE 77 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}
        type FieldIsArray "width" VkExtent2D = 'False -- ' closing tick for hsc2hs

        {-# INLINE fieldOptional #-}
        fieldOptional = False

        {-# INLINE fieldOffset #-}
        fieldOffset = (0)
{-# LINE 84 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}

instance {-# OVERLAPPING #-} CanReadField "width" VkExtent2D where
        {-# NOINLINE getField #-}
        getField x
          = unsafeDupablePerformIO
              (peekByteOff (unsafePtr x) (0))
{-# LINE 90 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}

        {-# INLINE readField #-}
        readField p = peekByteOff p (0)
{-# LINE 93 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}

instance {-# OVERLAPPING #-} CanWriteField "width" VkExtent2D where
        {-# INLINE writeField #-}
        writeField p
          = pokeByteOff p (0)
{-# LINE 98 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}

instance {-# OVERLAPPING #-} HasField "height" VkExtent2D where
        type FieldType "height" VkExtent2D = Word32
        type FieldOptional "height" VkExtent2D = 'False -- ' closing tick for hsc2hs
        type FieldOffset "height" VkExtent2D =
             (4)
{-# LINE 104 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}
        type FieldIsArray "height" VkExtent2D = 'False -- ' closing tick for hsc2hs

        {-# INLINE fieldOptional #-}
        fieldOptional = False

        {-# INLINE fieldOffset #-}
        fieldOffset = (4)
{-# LINE 111 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}

instance {-# OVERLAPPING #-} CanReadField "height" VkExtent2D where
        {-# NOINLINE getField #-}
        getField x
          = unsafeDupablePerformIO
              (peekByteOff (unsafePtr x) (4))
{-# LINE 117 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}

        {-# INLINE readField #-}
        readField p
          = peekByteOff p (4)
{-# LINE 121 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}

instance {-# OVERLAPPING #-} CanWriteField "height" VkExtent2D
         where
        {-# INLINE writeField #-}
        writeField p
          = pokeByteOff p (4)
{-# LINE 127 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}

instance Show VkExtent2D where
        showsPrec d x
          = showString "VkExtent2D {" .
              showString "width = " .
                showsPrec d (getField @"width" x) .
                  showString ", " .
                    showString "height = " .
                      showsPrec d (getField @"height" x) . showChar '}'

-- | > typedef struct VkExtent3D {
--   >     uint32_t        width;
--   >     uint32_t        height;
--   >     uint32_t        depth;
--   > } VkExtent3D;
--
--   <https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VkExtent3D VkExtent3D registry at www.khronos.org>
data VkExtent3D = VkExtent3D# Addr# ByteArray#

instance Eq VkExtent3D where
        (VkExtent3D# a _) == x@(VkExtent3D# b _)
          = EQ == cmpBytes# (sizeOf x) a b

        {-# INLINE (==) #-}

instance Ord VkExtent3D where
        (VkExtent3D# a _) `compare` x@(VkExtent3D# b _)
          = cmpBytes# (sizeOf x) a b

        {-# INLINE compare #-}

instance Storable VkExtent3D where
        sizeOf ~_ = (12)
{-# LINE 160 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}

        {-# INLINE sizeOf #-}
        alignment ~_ = (4)
{-# LINE 163 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}

        {-# INLINE alignment #-}
        peek = peekVkData#

        {-# INLINE peek #-}
        poke = pokeVkData#

        {-# INLINE poke #-}

instance VulkanMarshalPrim VkExtent3D where
        unsafeAddr (VkExtent3D# a _) = a

        {-# INLINE unsafeAddr #-}
        unsafeByteArray (VkExtent3D# _ b) = b

        {-# INLINE unsafeByteArray #-}
        unsafeFromByteArrayOffset off b
          = VkExtent3D# (plusAddr# (byteArrayContents# b) off) b

        {-# INLINE unsafeFromByteArrayOffset #-}

instance VulkanMarshal VkExtent3D where
        type StructFields VkExtent3D = '["width", "height", "depth"] -- ' closing tick for hsc2hs
        type CUnionType VkExtent3D = 'False -- ' closing tick for hsc2hs
        type ReturnedOnly VkExtent3D = 'False -- ' closing tick for hsc2hs
        type StructExtends VkExtent3D = '[] -- ' closing tick for hsc2hs

instance {-# OVERLAPPING #-} HasField "width" VkExtent3D where
        type FieldType "width" VkExtent3D = Word32
        type FieldOptional "width" VkExtent3D = 'False -- ' closing tick for hsc2hs
        type FieldOffset "width" VkExtent3D =
             (0)
{-# LINE 195 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}
        type FieldIsArray "width" VkExtent3D = 'False -- ' closing tick for hsc2hs

        {-# INLINE fieldOptional #-}
        fieldOptional = False

        {-# INLINE fieldOffset #-}
        fieldOffset = (0)
{-# LINE 202 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}

instance {-# OVERLAPPING #-} CanReadField "width" VkExtent3D where
        {-# NOINLINE getField #-}
        getField x
          = unsafeDupablePerformIO
              (peekByteOff (unsafePtr x) (0))
{-# LINE 208 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}

        {-# INLINE readField #-}
        readField p = peekByteOff p (0)
{-# LINE 211 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}

instance {-# OVERLAPPING #-} CanWriteField "width" VkExtent3D where
        {-# INLINE writeField #-}
        writeField p
          = pokeByteOff p (0)
{-# LINE 216 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}

instance {-# OVERLAPPING #-} HasField "height" VkExtent3D where
        type FieldType "height" VkExtent3D = Word32
        type FieldOptional "height" VkExtent3D = 'False -- ' closing tick for hsc2hs
        type FieldOffset "height" VkExtent3D =
             (4)
{-# LINE 222 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}
        type FieldIsArray "height" VkExtent3D = 'False -- ' closing tick for hsc2hs

        {-# INLINE fieldOptional #-}
        fieldOptional = False

        {-# INLINE fieldOffset #-}
        fieldOffset = (4)
{-# LINE 229 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}

instance {-# OVERLAPPING #-} CanReadField "height" VkExtent3D where
        {-# NOINLINE getField #-}
        getField x
          = unsafeDupablePerformIO
              (peekByteOff (unsafePtr x) (4))
{-# LINE 235 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}

        {-# INLINE readField #-}
        readField p
          = peekByteOff p (4)
{-# LINE 239 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}

instance {-# OVERLAPPING #-} CanWriteField "height" VkExtent3D
         where
        {-# INLINE writeField #-}
        writeField p
          = pokeByteOff p (4)
{-# LINE 245 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}

instance {-# OVERLAPPING #-} HasField "depth" VkExtent3D where
        type FieldType "depth" VkExtent3D = Word32
        type FieldOptional "depth" VkExtent3D = 'False -- ' closing tick for hsc2hs
        type FieldOffset "depth" VkExtent3D =
             (8)
{-# LINE 251 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}
        type FieldIsArray "depth" VkExtent3D = 'False -- ' closing tick for hsc2hs

        {-# INLINE fieldOptional #-}
        fieldOptional = False

        {-# INLINE fieldOffset #-}
        fieldOffset = (8)
{-# LINE 258 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}

instance {-# OVERLAPPING #-} CanReadField "depth" VkExtent3D where
        {-# NOINLINE getField #-}
        getField x
          = unsafeDupablePerformIO
              (peekByteOff (unsafePtr x) (8))
{-# LINE 264 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}

        {-# INLINE readField #-}
        readField p = peekByteOff p (8)
{-# LINE 267 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}

instance {-# OVERLAPPING #-} CanWriteField "depth" VkExtent3D where
        {-# INLINE writeField #-}
        writeField p
          = pokeByteOff p (8)
{-# LINE 272 "src-gen/Graphics/Vulkan/Types/Struct/Extent.hsc" #-}

instance Show VkExtent3D where
        showsPrec d x
          = showString "VkExtent3D {" .
              showString "width = " .
                showsPrec d (getField @"width" x) .
                  showString ", " .
                    showString "height = " .
                      showsPrec d (getField @"height" x) .
                        showString ", " .
                          showString "depth = " .
                            showsPrec d (getField @"depth" x) . showChar '}'