mirror of
https://github.com/Drezil/dear-imgui.hs.git
synced 2024-11-22 16:57:00 +00:00
Fix GHC-9.2 build (#145)
This commit is contained in:
parent
7d4f3a8b93
commit
08d4b423ad
@ -374,11 +374,10 @@ chooseSwapchainFormat
|
|||||||
|
|
||||||
case sortOn ( Down . score ) ( Boxed.Vector.toList surfaceFormats ) of
|
case sortOn ( Down . score ) ( Boxed.Vector.toList surfaceFormats ) of
|
||||||
[] -> error "No formats found."
|
[] -> error "No formats found."
|
||||||
( best : _ )
|
Vulkan.SurfaceFormatKHR{format=Vulkan.FORMAT_UNDEFINED} : _rest ->
|
||||||
| Vulkan.FORMAT_UNDEFINED <- ( Vulkan.format :: Vulkan.SurfaceFormatKHR -> Vulkan.Format ) best
|
pure preferredFormat
|
||||||
-> pure preferredFormat
|
best : _rest
|
||||||
| otherwise
|
-> pure best
|
||||||
-> pure best
|
|
||||||
|
|
||||||
where
|
where
|
||||||
match :: Eq a => a -> a -> Int
|
match :: Eq a => a -> a -> Int
|
||||||
@ -415,11 +414,8 @@ createSwapchain physicalDevice device surface surfaceFormat imageUsage imageCoun
|
|||||||
| otherwise
|
| otherwise
|
||||||
= Vulkan.PRESENT_MODE_FIFO_KHR
|
= Vulkan.PRESENT_MODE_FIFO_KHR
|
||||||
|
|
||||||
currentExtent :: Vulkan.Extent2D
|
Vulkan.SurfaceCapabilitiesKHR{currentExtent, currentTransform} = surfaceCapabilities
|
||||||
currentExtent = ( Vulkan.currentExtent :: Vulkan.SurfaceCapabilitiesKHR -> Vulkan.Extent2D ) surfaceCapabilities
|
Vulkan.SurfaceFormatKHR{format=fmt, colorSpace=csp} = surfaceFormat
|
||||||
|
|
||||||
currentTransform :: Vulkan.SurfaceTransformFlagBitsKHR
|
|
||||||
currentTransform = ( Vulkan.currentTransform :: Vulkan.SurfaceCapabilitiesKHR -> Vulkan.SurfaceTransformFlagBitsKHR ) surfaceCapabilities
|
|
||||||
|
|
||||||
swapchainCreateInfo :: Vulkan.SwapchainCreateInfoKHR '[]
|
swapchainCreateInfo :: Vulkan.SwapchainCreateInfoKHR '[]
|
||||||
swapchainCreateInfo =
|
swapchainCreateInfo =
|
||||||
@ -428,8 +424,8 @@ createSwapchain physicalDevice device surface surfaceFormat imageUsage imageCoun
|
|||||||
, Vulkan.flags = Vulkan.zero
|
, Vulkan.flags = Vulkan.zero
|
||||||
, Vulkan.surface = Vulkan.SurfaceKHR surface
|
, Vulkan.surface = Vulkan.SurfaceKHR surface
|
||||||
, Vulkan.minImageCount = imageCount
|
, Vulkan.minImageCount = imageCount
|
||||||
, Vulkan.imageFormat = ( Vulkan.format :: Vulkan.SurfaceFormatKHR -> Vulkan.Format ) surfaceFormat
|
, Vulkan.imageFormat = fmt
|
||||||
, Vulkan.imageColorSpace = ( Vulkan.colorSpace :: Vulkan.SurfaceFormatKHR -> Vulkan.ColorSpaceKHR ) surfaceFormat
|
, Vulkan.imageColorSpace = csp
|
||||||
, Vulkan.imageExtent = currentExtent
|
, Vulkan.imageExtent = currentExtent
|
||||||
, Vulkan.imageArrayLayers = 1
|
, Vulkan.imageArrayLayers = 1
|
||||||
, Vulkan.imageUsage = imageUsage
|
, Vulkan.imageUsage = imageUsage
|
||||||
@ -591,7 +587,7 @@ createFramebuffer
|
|||||||
-> Vulkan.Extent2D
|
-> Vulkan.Extent2D
|
||||||
-> f Vulkan.ImageView
|
-> f Vulkan.ImageView
|
||||||
-> m ( ResourceT.ReleaseKey, Vulkan.Framebuffer )
|
-> m ( ResourceT.ReleaseKey, Vulkan.Framebuffer )
|
||||||
createFramebuffer dev renderPass extent attachments = Vulkan.withFramebuffer dev createInfo Nothing ResourceT.allocate
|
createFramebuffer dev renderPass Vulkan.Extent2D{width, height} attachments = Vulkan.withFramebuffer dev createInfo Nothing ResourceT.allocate
|
||||||
where
|
where
|
||||||
createInfo :: Vulkan.FramebufferCreateInfo '[]
|
createInfo :: Vulkan.FramebufferCreateInfo '[]
|
||||||
createInfo =
|
createInfo =
|
||||||
@ -600,8 +596,8 @@ createFramebuffer dev renderPass extent attachments = Vulkan.withFramebuffer dev
|
|||||||
, Vulkan.flags = Vulkan.zero
|
, Vulkan.flags = Vulkan.zero
|
||||||
, Vulkan.renderPass = renderPass
|
, Vulkan.renderPass = renderPass
|
||||||
, Vulkan.attachments = Boxed.Vector.fromList . toList $ attachments
|
, Vulkan.attachments = Boxed.Vector.fromList . toList $ attachments
|
||||||
, Vulkan.width = ( Vulkan.width :: Vulkan.Extent2D -> Word32 ) extent
|
, Vulkan.width = width
|
||||||
, Vulkan.height = ( Vulkan.height :: Vulkan.Extent2D -> Word32 ) extent
|
, Vulkan.height = height
|
||||||
, Vulkan.layers = 1
|
, Vulkan.layers = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,9 +201,7 @@ app = do
|
|||||||
surfaceCapabilities <- Vulkan.getPhysicalDeviceSurfaceCapabilitiesKHR physicalDevice ( Vulkan.SurfaceKHR surface )
|
surfaceCapabilities <- Vulkan.getPhysicalDeviceSurfaceCapabilitiesKHR physicalDevice ( Vulkan.SurfaceKHR surface )
|
||||||
|
|
||||||
let
|
let
|
||||||
minImageCount, maxImageCount, imageCount :: Word32
|
Vulkan.SurfaceCapabilitiesKHR{minImageCount, maxImageCount} = surfaceCapabilities
|
||||||
minImageCount = ( Vulkan.minImageCount :: Vulkan.SurfaceCapabilitiesKHR -> Word32 ) surfaceCapabilities
|
|
||||||
maxImageCount = ( Vulkan.maxImageCount :: Vulkan.SurfaceCapabilitiesKHR -> Word32 ) surfaceCapabilities
|
|
||||||
imageCount
|
imageCount
|
||||||
| maxImageCount == 0 = minImageCount + 1
|
| maxImageCount == 0 = minImageCount + 1
|
||||||
| otherwise = ( minImageCount + 1 ) `min` maxImageCount
|
| otherwise = ( minImageCount + 1 ) `min` maxImageCount
|
||||||
@ -213,31 +211,30 @@ app = do
|
|||||||
|
|
||||||
swapchainResources :: Maybe SwapchainResources -> m ( m (), SwapchainResources )
|
swapchainResources :: Maybe SwapchainResources -> m ( m (), SwapchainResources )
|
||||||
swapchainResources mbOldResources = do
|
swapchainResources mbOldResources = do
|
||||||
( surfaceFormat, imGuiRenderPass ) <- case mbOldResources of
|
( colFmt, surfaceFormat, imGuiRenderPass ) <- case mbOldResources of
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
logDebug "Choosing swapchain format & color space"
|
logDebug "Choosing swapchain format & color space"
|
||||||
surfaceFormat <- chooseSwapchainFormat preferredFormat physicalDevice surface
|
surfaceFormat <- chooseSwapchainFormat preferredFormat physicalDevice surface
|
||||||
let
|
let Vulkan.SurfaceFormatKHR{format=colFmt} = surfaceFormat
|
||||||
colFmt :: Vulkan.Format
|
|
||||||
colFmt = ( Vulkan.format :: Vulkan.SurfaceFormatKHR -> Vulkan.Format ) surfaceFormat
|
|
||||||
logDebug "Creating Dear ImGui render pass"
|
logDebug "Creating Dear ImGui render pass"
|
||||||
( _, imGuiRenderPass ) <-
|
( _, imGuiRenderPass ) <-
|
||||||
simpleRenderPass device
|
simpleRenderPass device
|
||||||
( noAttachments
|
( noAttachments
|
||||||
{ colorAttachments = Boxed.Vector.singleton $ presentableColorAttachmentDescription colFmt }
|
{ colorAttachments = Boxed.Vector.singleton $ presentableColorAttachmentDescription colFmt }
|
||||||
)
|
)
|
||||||
pure ( surfaceFormat, imGuiRenderPass )
|
pure ( colFmt, surfaceFormat, imGuiRenderPass )
|
||||||
Just oldResources -> pure ( surfaceFormat oldResources, imGuiRenderPass oldResources )
|
Just oldResources -> do
|
||||||
|
let surFmt = surfaceFormat oldResources
|
||||||
let
|
let Vulkan.SurfaceFormatKHR{format=colFmt} = surFmt
|
||||||
colFmt :: Vulkan.Format
|
pure ( colFmt, surFmt, imGuiRenderPass oldResources )
|
||||||
colFmt = ( Vulkan.format :: Vulkan.SurfaceFormatKHR -> Vulkan.Format ) surfaceFormat
|
|
||||||
|
|
||||||
logDebug "Creating swapchain"
|
logDebug "Creating swapchain"
|
||||||
( swapchainKey, swapchain, swapchainExtent ) <-
|
( swapchainKey, swapchain, swapchainExtent ) <-
|
||||||
createSwapchain
|
createSwapchain
|
||||||
physicalDevice device
|
physicalDevice
|
||||||
surface surfaceFormat
|
device
|
||||||
|
surface
|
||||||
|
surfaceFormat
|
||||||
surfaceUsage
|
surfaceUsage
|
||||||
imageCount
|
imageCount
|
||||||
( swapchain <$> mbOldResources )
|
( swapchain <$> mbOldResources )
|
||||||
|
@ -24,6 +24,10 @@ import Data.Traversable
|
|||||||
( for )
|
( for )
|
||||||
import Foreign.Storable
|
import Foreign.Storable
|
||||||
( Storable )
|
( Storable )
|
||||||
|
#if MIN_VERSION_template_haskell(2,18,0)
|
||||||
|
import Data.Coerce
|
||||||
|
( coerce )
|
||||||
|
#endif
|
||||||
|
|
||||||
-- containers
|
-- containers
|
||||||
import Data.Map.Strict
|
import Data.Map.Strict
|
||||||
@ -171,7 +175,7 @@ declareEnumeration finiteEnumName countName ( Enumeration {..} ) = do
|
|||||||
else
|
else
|
||||||
\ nm args dir pat ->
|
\ nm args dir pat ->
|
||||||
TH.patSynD_doc nm args dir pat
|
TH.patSynD_doc nm args dir pat
|
||||||
( Just $ Text.unpack patDoc ) []
|
( Just $ Text.unpack _patDoc ) []
|
||||||
)
|
)
|
||||||
#else
|
#else
|
||||||
TH.patSynD
|
TH.patSynD
|
||||||
|
Loading…
Reference in New Issue
Block a user