{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE DataKinds #-}
module Image where

import qualified Vulkan as Vk
import qualified Vulkan.Zero as Vk

imageCreate
  :: Vk.Format
  -> Vk.Extent3D
  -> Vk.ImageUsageFlags
  -> Vk.ImageCreateInfo '[]
imageCreate format extent usageFlags =
  let imageCreateInfo = Vk.zero
        { Vk.imageType   = Vk.IMAGE_TYPE_2D
        , Vk.format      = format
        , Vk.extent      = extent
        , Vk.mipLevels   = 1
        , Vk.arrayLayers = 1
        , Vk.samples     = Vk.SAMPLE_COUNT_1_BIT
        , Vk.tiling      = Vk.IMAGE_TILING_OPTIMAL
        , Vk.usage       = usageFlags
        }

  in imageCreateInfo

imageviewCreate
  :: Vk.Image
  -> Vk.Format
  -> Vk.ImageAspectFlags
  -> Vk.ImageViewCreateInfo '[]
imageviewCreate image format aspectFlags =
  let imageviewCreateInfo = Vk.zero
        { Vk.viewType = Vk.IMAGE_VIEW_TYPE_2D
        , Vk.image = image
        , Vk.format   = format
        , Vk.subresourceRange = Vk.zero
          { Vk.baseMipLevel   = 0
          , Vk.levelCount     = 1
          , Vk.baseArrayLayer = 0
          , Vk.layerCount     = 1
          , Vk.aspectMask     = aspectFlags
          }
        }

  in imageviewCreateInfo

