Skip to content

Commit

Permalink
Merge pull request #274 from expipiplus1/fix-generate
Browse files Browse the repository at this point in the history
Bump vulkan to 1.2.174
  • Loading branch information
expipiplus1 authored Mar 31, 2021
2 parents 74dc6b4 + adb27d3 commit b62efdd
Show file tree
Hide file tree
Showing 116 changed files with 3,935 additions and 1,557 deletions.
2 changes: 1 addition & 1 deletion VulkanMemoryAllocator/VulkanMemoryAllocator
Submodule VulkanMemoryAllocator updated 52 files
+6 −5 .travis.yml
+ bin/VmaReplay_Release_vs2019.exe
+ bin/VulkanSample_Release_vs2019.exe
+9 −9 docs/html/defragmentation.html
+2 −4 docs/html/deprecated.html
+0 −3 docs/html/globals.html
+0 −3 docs/html/globals_func.html
+13 −14 docs/html/search/all_11.js
+21 −21 docs/html/search/classes_0.js
+8 −8 docs/html/search/defines_0.js
+6 −6 docs/html/search/enums_0.js
+42 −42 docs/html/search/enumvalues_0.js
+1 −1 docs/html/search/files_0.js
+51 −52 docs/html/search/functions_0.js
+1 −1 docs/html/search/pages_0.js
+3 −3 docs/html/search/pages_1.js
+3 −3 docs/html/search/pages_2.js
+1 −1 docs/html/search/pages_3.js
+1 −1 docs/html/search/pages_4.js
+1 −1 docs/html/search/pages_5.js
+1 −1 docs/html/search/pages_6.js
+1 −1 docs/html/search/pages_7.js
+3 −3 docs/html/search/pages_8.js
+2 −2 docs/html/search/pages_9.js
+3 −3 docs/html/search/pages_a.js
+2 −2 docs/html/search/typedefs_0.js
+28 −28 docs/html/search/typedefs_1.js
+7 −7 docs/html/search/variables_0.js
+6 −6 docs/html/search/variables_1.js
+1 −1 docs/html/search/variables_2.js
+3 −3 docs/html/search/variables_3.js
+2 −2 docs/html/search/variables_4.js
+1 −1 docs/html/search/variables_5.js
+14 −14 docs/html/search/variables_6.js
+1 −1 docs/html/search/variables_7.js
+20 −20 docs/html/search/variables_8.js
+1 −1 docs/html/search/variables_9.js
+1 −1 docs/html/search/variables_a.js
+1 −1 docs/html/search/variables_b.js
+8 −8 docs/html/search/variables_c.js
+18 −18 docs/html/search/variables_d.js
+1 −1 docs/html/struct_vma_defragmentation_info.html
+2 −42 docs/html/vk__mem__alloc_8h.html
+15,379 −15,118 docs/html/vk__mem__alloc_8h_source.html
+1 −2 premake/premake5.lua
+148 −0 src/Common.cpp
+27 −15 src/Common.h
+8 −4 src/SparseBindingTest.cpp
+162 −70 src/Tests.cpp
+2 −1 src/VmaReplay/VmaReplay.cpp
+731 −210 src/VulkanSample.cpp
+385 −129 src/vk_mem_alloc.h
2 changes: 1 addition & 1 deletion VulkanMemoryAllocator/VulkanMemoryAllocator.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cabal-version: 2.2
-- see: https://github.com/sol/hpack

name: VulkanMemoryAllocator
version: 0.4
version: 0.5
synopsis: Bindings to the VulkanMemoryAllocator library
category: Graphics
homepage: https://github.com/expipiplus1/vulkan#readme
Expand Down
3 changes: 3 additions & 0 deletions VulkanMemoryAllocator/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## WIP

## [0.5] - 2021-03-31
- Bump VMA, deprecates resizeAllocation

## [0.4] - 2021-02-18
- Bump VMA, support for VK_EXT_memory_priority

Expand Down
2 changes: 1 addition & 1 deletion VulkanMemoryAllocator/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: VulkanMemoryAllocator
version: "0.4"
version: "0.5"
synopsis: Bindings to the VulkanMemoryAllocator library
category: Graphics
maintainer: Joe Hermaszewski <[email protected]>
Expand Down
31 changes: 0 additions & 31 deletions VulkanMemoryAllocator/src/VulkanMemoryAllocator.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ module VulkanMemoryAllocator ( createAllocator
, withMemoryForImage
, freeMemory
, freeMemoryPages
, resizeAllocation
, getAllocationInfo
, touchAllocation
, setAllocationUserData
Expand Down Expand Up @@ -1193,36 +1192,6 @@ freeMemoryPages allocator allocations = liftIO . evalContT $ do
pure $ ()


foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"vmaResizeAllocation" ffiVmaResizeAllocation
:: Allocator -> Allocation -> DeviceSize -> IO Result

-- | Deprecated.
--
-- /Deprecated/
--
-- In version 2.2.0 it used to try to change allocation\'s size without
-- moving or reallocating it. In current version it returns @VK_SUCCESS@
-- only if @newSize@ equals current allocation\'s size. Otherwise returns
-- @VK_ERROR_OUT_OF_POOL_MEMORY@, indicating that allocation\'s size could
-- not be changed.
resizeAllocation :: forall io
. (MonadIO io)
=> -- No documentation found for Nested "vmaResizeAllocation" "allocator"
Allocator
-> -- No documentation found for Nested "vmaResizeAllocation" "allocation"
Allocation
-> -- No documentation found for Nested "vmaResizeAllocation" "newSize"
("newSize" ::: DeviceSize)
-> io ()
resizeAllocation allocator allocation newSize = liftIO $ do
r <- traceAroundEvent "vmaResizeAllocation" ((ffiVmaResizeAllocation) (allocator) (allocation) (newSize))
when (r < SUCCESS) (throwIO (VulkanException r))


foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
Expand Down
2 changes: 0 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ packages:
./utils
./examples
./generate-new/

allow-newer: strict Cabal
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## WIP

## [3.10.1] - 2021-03-31
- Bump API version to v1.2.174
- Fix https://github.com/expipiplus1/vulkan/issues/266

## [3.10] - 2021-02-18
- Bump API version to v1.2.170

Expand Down
2 changes: 1 addition & 1 deletion generate-new/Vulkan-Docs
Submodule Vulkan-Docs updated 72 files
+53 −0 .github/ISSUE_TEMPLATE/template-for-release-task-list.md
+100 −0 .github/workflows/CI.yml
+4 −4 .gitlab-ci.yml
+4 −0 .reuse/dep5
+33 −30 BUILD.adoc
+0 −1 CODE_OF_CONDUCT.adoc
+0 −1 CONTRIBUTING.adoc
+9 −0 COPYING.adoc
+219 −0 ChangeLog.txt
+3 −0 LICENSE.adoc
+16 −7 Makefile
+0 −1 README.adoc
+9 −0 appendices/VK_EXT_calibrated_timestamps.txt
+2 −2 appendices/VK_EXT_debug_utils.txt
+1 −1 appendices/VK_EXT_shader_image_atomic_int64.txt
+37 −0 appendices/VK_FUCHSIA_external_memory.txt
+43 −0 appendices/VK_FUCHSIA_external_semaphore.txt
+1 −1 appendices/VK_KHR_timeline_semaphore.txt
+29 −0 appendices/VK_QNX_screen_surface.txt
+36 −0 appendices/boilerplate.txt
+2 −2 appendices/glossary.txt
+46 −41 appendices/spirvenv.txt
+0 −48 azure-pipelines.yml
+6 −2 chapters/VK_EXT_debug_utils.txt
+165 −0 chapters/VK_FUCHSIA_external_memory/device_memory.txt
+1 −5 chapters/VK_KHR_pipeline_executable_properties/pipelines.txt
+7 −0 chapters/VK_KHR_surface/wsi.txt
+5 −8 chapters/VK_KHR_swapchain/wsi.txt
+62 −0 chapters/VK_QNX_screen_surface/platformCreateSurface_screen.txt
+33 −0 chapters/VK_QNX_screen_surface/platformQuerySupport_screen.txt
+4 −0 chapters/accelstructures.txt
+17 −0 chapters/capabilities.txt
+2 −1 chapters/commonvalidity/access_mask_2_common.txt
+7 −0 chapters/commonvalidity/draw_common.txt
+8 −1 chapters/commonvalidity/draw_dispatch_common.txt
+1 −1 chapters/commonvalidity/image_memory_barrier_common.txt
+0 −4 chapters/commonvalidity/query_begin_common.txt
+2 −2 chapters/copies.txt
+11 −5 chapters/devsandqueues.txt
+3 −3 chapters/extensions.txt
+16 −17 chapters/features.txt
+12 −12 chapters/fragops.txt
+8 −5 chapters/interfaces.txt
+49 −8 chapters/memory.txt
+9 −9 chapters/pipelines.txt
+26 −22 chapters/primsrast.txt
+9 −0 chapters/queries.txt
+29 −19 chapters/raytraversal.txt
+33 −7 chapters/renderpass.txt
+20 −14 chapters/resources.txt
+219 −20 chapters/synchronization.txt
+7 −2 chapters/vertexpostproc.txt
+4 −2 config/vu-to-json/extension.rb
+45 −0 images/ray_intersection_candidate.svg
+6 −0 include/vulkan/vulkan.h
+54 −26 registry.txt
+21 −0 scripts/asciidoctor-chunker/LICENSE
+91 −0 scripts/asciidoctor-chunker/README.md
+1 −0 scripts/asciidoctor-chunker/asciidoctor-chunker.js
+34 −3 scripts/cgenerator.py
+158 −31 scripts/generator.py
+26 −5 scripts/genvk.py
+1 −1 scripts/reflow.py
+9 −3 scripts/reg.py
+59 −0 style/extensions.txt
+3 −0 styleguide.txt
+3 −3 tests/README.adoc
+2 −0 tests/htest.c
+8 −0 tests/screen/screen.h
+1 −0 xml/Makefile
+6 −1 xml/registry.rnc
+228 −72 xml/vk.xml
9 changes: 7 additions & 2 deletions generate-new/src/Bespoke.hs
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,7 @@ bespokeElements = \case
$ shared
<> [ baseType "VkSampleMask" ''Word32
, baseType "VkFlags" ''Word32
, baseType "VkFlags64" ''Word64
, baseType "VkDeviceSize" ''Word64
, baseType "VkDeviceAddress" ''Word64
]
Expand Down Expand Up @@ -902,8 +903,9 @@ boolConversion = genRe "Bool conversion" $ do
wsiTypes
:: (HasErr r, HasRenderParams r) => SpecFlavor -> [Sem r RenderElement]
wsiTypes = \case
SpecVk -> (snd <$> concat [win32, x11Shared, x11, xcb2, zircon, ggp])
<> concat [win32', xcb1, waylandShared, wayland, metal, android, directfb]
SpecVk ->
(snd <$> concat [win32, x11Shared, x11, xcb2, zircon, ggp]) <> concat
[win32', xcb1, waylandShared, wayland, metal, android, directfb, screen]
SpecXr -> (snd <$> concat [win32Xr, x11Shared, xcb2Xr, egl, gl, d3d])
<> concat [win32Xr', xcb1, waylandShared, d3d', jni, timespec]

Expand Down Expand Up @@ -1055,6 +1057,9 @@ android = [voidData "AHardwareBuffer", voidData "ANativeWindow"]
directfb :: HasRenderParams r => [Sem r RenderElement]
directfb = [voidData "IDirectFB", voidData "IDirectFBSurface"]

screen :: HasRenderParams r => [Sem r RenderElement]
screen = [voidData "_screen_window", voidData "screen_context"]

----------------------------------------------------------------
-- OpenXR platform stuff
----------------------------------------------------------------
Expand Down
10 changes: 7 additions & 3 deletions generate-new/src/Bespoke/MarshalParams.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ marshalParams spec@Spec {..} = do
bitmaskNames :: HashSet CName
bitmaskNames = fromList
[ n
| Enum {..} <- toList specEnums
, ABitmask flags <- pure eType
, n <- [eName, flags]
| Enum {..} <- toList specEnums
, ABitmask flags _ <- pure eType
, n <- [eName, flags]
]
isBitmask = (`member` bitmaskNames)
isBitmaskType = \case
Expand Down Expand Up @@ -114,13 +114,15 @@ isIntegral =
isFloating :: CType -> Bool
isFloating = (`elem` [Float, Double])

-- | Foreign handles
isDefaultableForeignType :: CType -> Bool
isDefaultableForeignType t =
( t
`elem` [ TypeName "HANDLE"
, TypeName "DWORD"
, TypeName "LPCWSTR"
, Ptr CType.Const (TypeName "SECURITY_ATTRIBUTES")
, TypeName "zx_handle_t"
]
)
|| case t of
Expand Down Expand Up @@ -149,6 +151,8 @@ isPassAsPointerType' = \case
, "IDirectFBSurface"
, "IUnknown"
, "jobject"
, "_screen_window"
, "_screen_context"
-- TODO: remove these
, "VkInstanceCreateInfo"
, "VkAllocationCallbacks"
Expand Down
2 changes: 2 additions & 0 deletions generate-new/src/Bespoke/RenderParams.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import Render.Stmts.Poke ( CmdsDoc(..) )
import Render.Type.Preserve
import Spec.Parse

-- This is in `src` rather than `vk` as it's also used by the xr and vma generators
renderParams :: V.Vector Handle -> RenderParams
renderParams handles = r
where
Expand Down Expand Up @@ -64,6 +65,7 @@ renderParams handles = r
, lowerPrefix = "vk"
, upperPrefix = "VK"
, flagsTypeName = "VkFlags"
, flags64TypeName = "VkFlags64"
, alwaysQualifiedNames = mempty
, extraNewtypes = mempty
, mkIdiomaticType =
Expand Down
2 changes: 1 addition & 1 deletion generate-new/src/Data/Text/Extra.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ lowerCaseFirst :: Text -> Text
lowerCaseFirst = onFirst Data.Char.toLower

upperCaseFirst :: Text -> Text
upperCaseFirst = onFirst Data.Char.toUpper
upperCaseFirst = onFirst Data.Char.toUpper . T.dropWhile (not . isAlpha)

onFirst :: (Char -> Char) -> Text -> Text
onFirst f = \case
Expand Down
4 changes: 3 additions & 1 deletion generate-new/src/Render/Element.hs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,9 @@ data RenderParams = RenderParams
, upperPrefix :: Text
-- ^ "VK" or "XR" or "VMA"
, flagsTypeName :: CName
-- ^ "VkFlags" or "XrFlags64"
-- ^ 32 bit flag type
, flags64TypeName :: CName
-- ^ 64 bit flag type
, alwaysQualifiedNames :: Vector Name
, extraNewtypes :: Vector Name
, mkIdiomaticType :: Type -> Maybe IdiomaticType
Expand Down
4 changes: 2 additions & 2 deletions generate-new/src/Render/Element/Write.hs
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,8 @@ specTypeInfo Spec {..} = do
[ (mkConName eExportedName evName, mkTyName eExportedName)
| Enum {..} <- V.toList specEnums
, let eExportedName = case eType of
AnEnum -> eName
ABitmask flags -> flags
AnEnum -> eName
ABitmask flags _ -> flags
, EnumValue {..} <- V.toList eValues
]
pure $ TypeInfo (`Map.lookup` tyMap)
Expand Down
23 changes: 13 additions & 10 deletions generate-new/src/Render/Enum.hs
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,18 @@ renderEnum e@Enum {..} = do
tellCanFormat

innerTy <- case eType of
AnEnum -> pure $ ConT ''Int32
ABitmask _ -> cToHsType DoNotPreserve (TypeName flagsTypeName)
AnEnum -> pure $ ConT ''Int32
ABitmask _ Bitmask32 -> cToHsType DoNotPreserve (TypeName flagsTypeName)
ABitmask _ Bitmask64 ->
cToHsType DoNotPreserve (TypeName flags64TypeName)
let n = mkTyName eName
conName = mkConName eName eName

-- Export the type cinnamon first so that it appears above the Flags in the
-- Haddocks, this means when viewing the page there, the user will also
-- have the flags visible
case eType of
ABitmask flags | flags /= eName -> do
ABitmask flags _ | flags /= eName -> do
let flagsName = mkTyName flags
let syn :: HasRenderElem r => Sem r ()
syn = do
Expand All @@ -64,15 +66,15 @@ renderEnum e@Enum {..} = do
tellDoc $ "data" <+> pretty n
tDoc <- renderType innerTy
let complete = case eType of
AnEnum -> completePragma n (mkPatternName . evName <$> eValues)
ABitmask _ -> Nothing
AnEnum -> completePragma n (mkPatternName . evName <$> eValues)
ABitmask _ _ -> Nothing
tellImport (TyConName "Zero")
derivedClasses <- do
tellImport ''Storable
let always = ["Eq", "Ord", "Storable", "Zero"]
special <- case eType of
AnEnum -> pure []
ABitmask _ -> do
AnEnum -> pure []
ABitmask _ _ -> do
tellImport ''Bits
tellImport ''FiniteBits
pure ["Bits", "FiniteBits"]
Expand Down Expand Up @@ -124,8 +126,9 @@ renderEnumValue eName conName enumType EnumValue {..} = do
RenderParams {..} <- input
let n = mkPatternName evName
v = case enumType of
AnEnum -> showsPrec 9 evValue ""
ABitmask _ -> printf "0x%08x" evValue
AnEnum -> showsPrec 9 evValue ""
ABitmask _ Bitmask32 -> printf "0x%08x" evValue
ABitmask _ Bitmask64 -> printf "0x%016x" evValue
pure
( \getDoc -> vsep
[ getDoc (Nested eName evName)
Expand Down Expand Up @@ -204,7 +207,7 @@ renderShowInstance prefixString showTableName conNameName Enum {..} = do
AnEnum -> do
tellImport 'showsPrec
pure ("(showsPrec 11)" :: Text)
ABitmask _ -> do
ABitmask _ _ -> do
tellImport 'showString
tellImport 'showHex
pure "(\\x -> showString \"0x\" . showHex x)"
Expand Down
6 changes: 3 additions & 3 deletions generate-new/src/Render/Names.hs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ specRenderedNames Spec {..} = do
rnEnums = Set.fromList
[ mkTyName n
| Enum {..} <- toList specEnums
, n <- eName : [ flags | ABitmask flags <- pure eType ]
, n <- eName : [ flags | ABitmask flags _ <- pure eType ]
]
(dispHandles, nonDispHandles) =
partition ((== Dispatchable) . hDispatchable) $ toList specHandles
Expand All @@ -72,8 +72,8 @@ specRenderedNames Spec {..} = do
, TypeAlias == aType
]
<> [ (mkTyName flags, mkTyName eName)
| Enum {..} <- toList specEnums
, ABitmask flags <- pure eType
| Enum {..} <- toList specEnums
, ABitmask flags _ <- pure eType
, flags /= eName
]
)
Expand Down
2 changes: 1 addition & 1 deletion generate-new/src/Spec/APIConstant.hs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ int64 :: HasErr r => RE Char (Sem r Int64)
int64 = readSpec <$> digits <* "LL"

float :: HasErr r => RE Char (Sem r Float)
float = readSpec <$> (fmap concat . sequenceA $ [digits, ".", digits]) <* "f"
float = readSpec <$> (fmap concat . sequenceA $ [digits, ".", digits]) <* ("F" <|> "f")

digits :: RE Char String
digits = many (psym isDigit) <|> ((<>) <$> "0x" <*> many (psym isHexDigit))
Expand Down
Loading

0 comments on commit b62efdd

Please sign in to comment.