fix ambiguous record updates
This commit is contained in:
parent
6d625cabf6
commit
06e3d5c2ec
4 changed files with 11 additions and 10 deletions
|
@ -1,6 +1,7 @@
|
|||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DuplicateRecordFields #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE OverloadedRecordDot #-}
|
||||
module Devices where
|
||||
|
||||
import Control.Monad
|
||||
|
@ -38,7 +39,7 @@ pickPhysicalDevice vkInstance = do
|
|||
physDevices
|
||||
|
||||
let discretePhysDevices = V.filter
|
||||
(\(_, devProps, devFeatures) ->
|
||||
(\(_, _, devFeatures) ->
|
||||
-- Vk.deviceType devProps == Vk.PHYSICAL_DEVICE_TYPE_DISCRETE_GPU &&
|
||||
Vk.geometryShader devFeatures
|
||||
)
|
||||
|
@ -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
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DuplicateRecordFields #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE OverloadedRecordDot #-}
|
||||
module Main where
|
||||
|
||||
import qualified Control.Concurrent.STM as STM
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DuplicateRecordFields #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE OverloadedRecordDot #-}
|
||||
module Memory where
|
||||
|
||||
import Control.Monad.IO.Class
|
||||
|
@ -27,9 +27,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
|
||||
|
|
|
@ -41,7 +41,7 @@ executable vulkan-tutorial
|
|||
|
||||
-- LANGUAGE extensions used by modules in this package.
|
||||
-- other-extensions:
|
||||
build-depends: base >=4.14.3.0
|
||||
build-depends: base
|
||||
, sdl2
|
||||
, vulkan
|
||||
, vulkan-utils
|
||||
|
|
Loading…
Reference in a new issue