diff --git a/changelog.md b/changelog.md index 15c35d73a..2c4edb54b 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,7 @@ # Change Log ## WIP +- Bump API version to v1.3.269 ## [3.26.1] - 2023-10-21 - Bump API version to v1.3.269 diff --git a/generate-new/Vulkan-Docs b/generate-new/Vulkan-Docs index c8fff68b3..463f8c616 160000 --- a/generate-new/Vulkan-Docs +++ b/generate-new/Vulkan-Docs @@ -1 +1 @@ -Subproject commit c8fff68b3d3be212db0c73b0e31a845294e249ab +Subproject commit 463f8c616f49fb83ae4736de0d84b0048a7c76e2 diff --git a/src/Vulkan/Extensions/VK_NV_cuda_kernel_launch.hs b/src/Vulkan/Extensions/VK_NV_cuda_kernel_launch.hs index 7f1555ec1..4f8e78d36 100644 --- a/src/Vulkan/Extensions/VK_NV_cuda_kernel_launch.hs +++ b/src/Vulkan/Extensions/VK_NV_cuda_kernel_launch.hs @@ -918,12 +918,12 @@ instance Zero CudaFunctionCreateInfoNV where -- valid 'Vulkan.Extensions.Handles.CudaFunctionNV' handle -- -- - #VUID-VkCudaLaunchInfoNV-pParams-parameter# If @paramCount@ is not --- @0@, @pParams@ /must/ be a valid pointer to an array of @paramCount@ --- bytes +-- @0@, and @pParams@ is not @NULL@, @pParams@ /must/ be a valid +-- pointer to an array of @paramCount@ bytes -- -- - #VUID-VkCudaLaunchInfoNV-pExtras-parameter# If @extraCount@ is not --- @0@, @pExtras@ /must/ be a valid pointer to an array of @extraCount@ --- bytes +-- @0@, and @pExtras@ is not @NULL@, @pExtras@ /must/ be a valid +-- pointer to an array of @extraCount@ bytes -- -- = See Also -- @@ -955,9 +955,13 @@ data CudaLaunchInfoNV = CudaLaunchInfoNV , -- | @sharedMemBytes@ is the dynamic shared-memory size per thread block in -- bytes. sharedMemBytes :: Word32 + , -- | @paramCount@ is the length of the @pParams@ table. + paramCount :: Word64 , -- | @pParams@ is a pointer to an array of @paramCount@ pointers, -- corresponding to the arguments of @function@. params :: Vector (Ptr ()) + , -- | @extraCount@ is reserved for future use. + extraCount :: Word64 , -- | @pExtras@ is reserved for future use. extras :: Vector (Ptr ()) } @@ -980,11 +984,25 @@ instance ToCStruct CudaLaunchInfoNV where lift $ poke ((p `plusPtr` 40 :: Ptr Word32)) (blockDimY) lift $ poke ((p `plusPtr` 44 :: Ptr Word32)) (blockDimZ) lift $ poke ((p `plusPtr` 48 :: Ptr Word32)) (sharedMemBytes) - lift $ poke ((p `plusPtr` 56 :: Ptr CSize)) ((fromIntegral (Data.Vector.length $ (params)) :: CSize)) + let pParamsLength = Data.Vector.length $ (params) + paramCount'' <- lift $ if (paramCount) == 0 + then pure $ fromIntegral pParamsLength + else do + unless (fromIntegral pParamsLength == (paramCount) || pParamsLength == 0) $ + throwIO $ IOError Nothing InvalidArgument "" "pParams must be empty or have 'paramCount' elements" Nothing Nothing + pure (paramCount) + lift $ poke ((p `plusPtr` 56 :: Ptr CSize)) (paramCount'') pPParams' <- ContT $ allocaBytes @(Ptr ()) ((Data.Vector.length (params)) * 8) lift $ Data.Vector.imapM_ (\i e -> poke (pPParams' `plusPtr` (8 * (i)) :: Ptr (Ptr ())) (e)) (params) lift $ poke ((p `plusPtr` 64 :: Ptr (Ptr (Ptr ())))) (pPParams') - lift $ poke ((p `plusPtr` 72 :: Ptr CSize)) ((fromIntegral (Data.Vector.length $ (extras)) :: CSize)) + let pExtrasLength = Data.Vector.length $ (extras) + extraCount'' <- lift $ if (extraCount) == 0 + then pure $ fromIntegral pExtrasLength + else do + unless (fromIntegral pExtrasLength == (extraCount) || pExtrasLength == 0) $ + throwIO $ IOError Nothing InvalidArgument "" "pExtras must be empty or have 'extraCount' elements" Nothing Nothing + pure (extraCount) + lift $ poke ((p `plusPtr` 72 :: Ptr CSize)) (extraCount'') pPExtras' <- ContT $ allocaBytes @(Ptr ()) ((Data.Vector.length (extras)) * 8) lift $ Data.Vector.imapM_ (\i e -> poke (pPExtras' `plusPtr` (8 * (i)) :: Ptr (Ptr ())) (e)) (extras) lift $ poke ((p `plusPtr` 80 :: Ptr (Ptr (Ptr ())))) (pPExtras') @@ -1015,11 +1033,13 @@ instance FromCStruct CudaLaunchInfoNV where blockDimZ <- peek @Word32 ((p `plusPtr` 44 :: Ptr Word32)) sharedMemBytes <- peek @Word32 ((p `plusPtr` 48 :: Ptr Word32)) paramCount <- peek @CSize ((p `plusPtr` 56 :: Ptr CSize)) + let paramCount' = coerce @CSize @Word64 paramCount pParams <- peek @(Ptr (Ptr ())) ((p `plusPtr` 64 :: Ptr (Ptr (Ptr ())))) - pParams' <- generateM (fromIntegral (coerce @CSize @Word64 paramCount)) (\i -> peek @(Ptr ()) ((pParams `advancePtrBytes` (8 * (i)) :: Ptr (Ptr ())))) + pParams' <- generateM (fromIntegral paramCount') (\i -> peek @(Ptr ()) ((pParams `advancePtrBytes` (8 * (i)) :: Ptr (Ptr ())))) extraCount <- peek @CSize ((p `plusPtr` 72 :: Ptr CSize)) + let extraCount' = coerce @CSize @Word64 extraCount pExtras <- peek @(Ptr (Ptr ())) ((p `plusPtr` 80 :: Ptr (Ptr (Ptr ())))) - pExtras' <- generateM (fromIntegral (coerce @CSize @Word64 extraCount)) (\i -> peek @(Ptr ()) ((pExtras `advancePtrBytes` (8 * (i)) :: Ptr (Ptr ())))) + pExtras' <- generateM (fromIntegral extraCount') (\i -> peek @(Ptr ()) ((pExtras `advancePtrBytes` (8 * (i)) :: Ptr (Ptr ())))) pure $ CudaLaunchInfoNV function gridDimX @@ -1029,7 +1049,9 @@ instance FromCStruct CudaLaunchInfoNV where blockDimY blockDimZ sharedMemBytes + paramCount' pParams' + extraCount' pExtras' instance Zero CudaLaunchInfoNV where @@ -1042,7 +1064,9 @@ instance Zero CudaLaunchInfoNV where zero zero zero + zero mempty + zero mempty