WIP: Add SPIR-V reflect to vulkan-utils#270
Conversation
|
I haven't kept up with the other issue, I'll take a look at it this weekend! |
|
@expipiplus1 it's still work in progress and not ready for merge |
|
@expipiplus1 do you use code formatters by any means? You could commit its config for the rest of us to follow. |
I use Brittany with the default settings, good idea. I guess I could add an empty |
|
With all the code set in place it is the time to add more |
|
nice.
makeDescriptorPoolCreateInfo :: Word32 -> V.Vector (DescriptorSetLayoutCreateInfo '[]) -> DescriptorPoolCreateInfo '[]
makeDescriptorPoolCreateInfo maxSets infos = zero
{ poolSizes = V.fromList
[ zero
{ type' = t
, descriptorCount = fromIntegral n
}
| (t, n) <- analyse infos ]
, maxSets = maxSets
, flags = DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT -- VUID-vkFreeDescriptorSets-descriptorPool-00312: descriptorPool must have been created with the VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT flag
}
where
analyse :: V.Vector (DescriptorSetLayoutCreateInfo '[]) -> [(DescriptorType, Int)]
analyse = map calculate . groupBy ((==) `on` fst) . sortOn fst . extract
extract :: V.Vector (DescriptorSetLayoutCreateInfo '[]) -> [(DescriptorType, Int)]
extract = map (liftA2 (,) tname (fromIntegral . dcount)) . V.toList . (bindings =<<)
calculate :: [(DescriptorType, Int)] -> (DescriptorType, Int)
calculate = liftA2 (,) (fst . head) (sum . (snd <$>))
tname = descriptorType :: DescriptorSetLayoutBinding -> DescriptorType
dcount = descriptorCount :: DescriptorSetLayoutBinding -> Word32
|
|
If |
|
support more descriptor types.(I thought these has been all) here comes the layout(set = 0, binding = 1) uniform textureBuffer texBuf;...
"separate_images" : [
{
"type" : "samplerBuffer",
"name" : "texBuf",
"set" : 0,
"binding" : 1
}
...now the
|
relate #260