You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Admittedly I don't know very much about haskell, so I apologize if the solution is obvious, but I can't seem to figure out how to read from an array which has a variable length.
The best I could come up with is this (for reading the memoryTypes from the "vkGetPhysicalDeviceMemoryProperties" function)
memTypes <- case memTypeIndex of
0 -> Just <$> readFieldArray @"memoryTypes" @0 memPropPtr
1 -> Just <$> readFieldArray @"memoryTypes" @1 memPropPtr
2 -> Just <$> readFieldArray @"memoryTypes" @2 memPropPtr
3 -> Just <$> readFieldArray @"memoryTypes" @3 memPropPtr
4 -> Just <$> readFieldArray @"memoryTypes" @4 memPropPtr
5 -> Just <$> readFieldArray @"memoryTypes" @5 memPropPtr
6 -> Just <$> readFieldArray @"memoryTypes" @6 memPropPtr
7 -> Just <$> readFieldArray @"memoryTypes" @7 memPropPtr
...
I can't find any example or code anywhere that uses readFieldArray with a variable length, so with my limited knowledge of Haskell, I'm not sure if there is a better way.
Would it be possible to describe how this is done in some documentation somewhere or in an example?
The text was updated successfully, but these errors were encountered:
In your case (since you check the length anyway), the best way is to use readFieldArrayUnsafe (which takes Int index), which I added just couple days ago (soon will be on hackage).
But probably I should add a tutorial on how to use type-level Nats with vulkan-api. Thanks for reporting! Let's keep this issue open for now.
Admittedly I don't know very much about haskell, so I apologize if the solution is obvious, but I can't seem to figure out how to read from an array which has a variable length.
The best I could come up with is this (for reading the memoryTypes from the "vkGetPhysicalDeviceMemoryProperties" function)
I can't find any example or code anywhere that uses readFieldArray with a variable length, so with my limited knowledge of Haskell, I'm not sure if there is a better way.
Would it be possible to describe how this is done in some documentation somewhere or in an example?
The text was updated successfully, but these errors were encountered: