diff --git a/flake.nix b/flake.nix index 3320da9..7c9b3f2 100644 --- a/flake.nix +++ b/flake.nix @@ -33,6 +33,7 @@ haskell-language-server ghcid cabal-install + (jailbreakUnbreak wavefront) ]) ++ (with pkgs; [ shaderc vulkan-loader diff --git a/src/Devices.hs b/src/Devices.hs index 63cbd08..3e2f202 100644 --- a/src/Devices.hs +++ b/src/Devices.hs @@ -1,6 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE DataKinds #-} +{-# LANGUAGE OverloadedRecordDot #-} module Devices where import Control.Monad @@ -140,9 +141,9 @@ createSwapchain surface surfaceFormats windowDimension logicalDevice allocator = if V.any (\a -> - (Vk.format :: Vk.SurfaceFormatKHR -> Vk.Format) a == + a.format == Vk.FORMAT_B8G8R8A8_SRGB - && (Vk.colorSpace :: Vk.SurfaceFormatKHR -> Vk.ColorSpaceKHR) a == + && a.colorSpace == Vk.COLOR_SPACE_SRGB_NONLINEAR_KHR) surfaceFormats then @@ -219,7 +220,7 @@ getImageViewHandles swapchain surfaceFormat logicalDevice = do let createInfo = Vk.zero { Vk.image = tmpImage , Vk.viewType = Vk.IMAGE_VIEW_TYPE_2D - , Vk.format = (Vk.format :: Vk.SurfaceFormatKHR -> Vk.Format) surfaceFormat + , Vk.format = surfaceFormat.format , Vk.components = Vk.ComponentMapping { Vk.r = Vk.COMPONENT_SWIZZLE_IDENTITY , Vk.g = Vk.COMPONENT_SWIZZLE_IDENTITY diff --git a/src/Main.hs b/src/Main.hs index db8d643..74fe74d 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -1,4 +1,5 @@ {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE OverloadedRecordDot #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE DataKinds #-} module Main where @@ -11,7 +12,6 @@ import Control.Monad.Trans.Resource import Data.Bits import qualified Data.Map.Strict as M import qualified Data.Vector as V -import Data.Word import qualified SDL hiding (V2) import System.Mem import qualified Vulkan as Vk @@ -103,7 +103,7 @@ allocateMemory logicalDevice buffer = do memoryRequirements <- Vk.getBufferMemoryRequirements logicalDevice buffer let memoryAllocateInfo = Vk.zero - { Vk.allocationSize = (Vk.size :: Vk.MemoryRequirements -> Word64) memoryRequirements + { Vk.allocationSize = memoryRequirements.size , Vk.memoryTypeIndex = error ("createBuffer: TODO: populate memoryTypeIndex!" :: String) } diff --git a/src/Memory.hs b/src/Memory.hs index 90a6458..052d7c1 100644 --- a/src/Memory.hs +++ b/src/Memory.hs @@ -1,6 +1,8 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE DataKinds #-} +{-# LANGUAGE OverloadedRecordDot #-} + module Memory where import Control.Monad.IO.Class @@ -27,9 +29,9 @@ initAllocator -> m VMA.Allocator initAllocator physicalDevice device instance' = do let instanceProcAddr = castFunPtr $ - Vk.pVkGetInstanceProcAddr ((Vk.instanceCmds :: Vk.Instance -> Vk.InstanceCmds) instance') + Vk.pVkGetInstanceProcAddr (instance'.instanceCmds) deviceProcAddr = castFunPtr $ - Vk.pVkGetDeviceProcAddr ((Vk.deviceCmds :: Vk.Device -> Vk.DeviceCmds) device) + Vk.pVkGetDeviceProcAddr (device.deviceCmds) let allocatorInfo = Vk.zero { VMA.physicalDevice = Vk.physicalDeviceHandle physicalDevice , VMA.device = Vk.deviceHandle device