small-ish fixes

This commit is contained in:
nek0 2023-08-24 03:54:57 +02:00
parent acd8fe16c6
commit b416f83eec

View file

@ -103,8 +103,11 @@ createFrames
indirectBuffer <- createAllocatedBuffer indirectBuffer <- createAllocatedBuffer
allocator allocator
(sizeOf maxObjects) (sizeOf (undefined :: Vk.DrawIndirectCommand))
Vk.BUFFER_USAGE_STORAGE_BUFFER_BIT (Vk.BUFFER_USAGE_TRANSFER_DST_BIT .|.
Vk.BUFFER_USAGE_STORAGE_BUFFER_BIT .|.
Vk.BUFFER_USAGE_INDIRECT_BUFFER_BIT
)
VMA.MEMORY_USAGE_CPU_TO_GPU VMA.MEMORY_USAGE_CPU_TO_GPU
let allocationInfo = Vk.zero let allocationInfo = Vk.zero
@ -285,7 +288,7 @@ recordCommandBuffer
(V.fromList [ allocatedBuffer $ meshBuffer mesh ]) (V.fromList [ allocatedBuffer $ meshBuffer mesh ])
(V.fromList [ 0 ]) (V.fromList [ 0 ])
let indirectOffset = fromIntegral $ let indirectOffset = fromIntegral $
first * fromIntegral ( sizeOf (undefined :: Vk.DrawIndirectCommand)) first * fromIntegral ( sizeOf (undefined :: Vk.DrawIndirectCommand))
drawStride = fromIntegral $ sizeOf (undefined :: Vk.DrawIndirectCommand) drawStride = fromIntegral $ sizeOf (undefined :: Vk.DrawIndirectCommand)
@ -298,49 +301,49 @@ recordCommandBuffer
) )
draws draws
V.mapM_ -- V.mapM_
(\(IndirectBatch mesh material first count) -> do -- (\(IndirectBatch mesh material first count) -> do
when -- when
(materialTextureSet material /= Vk.NULL_HANDLE) -- (materialTextureSet material /= Vk.NULL_HANDLE)
(Vk.cmdBindDescriptorSets -- (Vk.cmdBindDescriptorSets
commandBuffer -- commandBuffer
Vk.PIPELINE_BIND_POINT_GRAPHICS -- Vk.PIPELINE_BIND_POINT_GRAPHICS
(materialPipelineLayout material) -- (materialPipelineLayout material)
2 -- 2
(V.singleton $ materialTextureSet material) -- (V.singleton $ materialTextureSet material)
V.empty -- V.empty
) -- )
Vk.cmdBindPipeline commandBuffer Vk.PIPELINE_BIND_POINT_GRAPHICS (materialPipeline material) -- Vk.cmdBindPipeline commandBuffer Vk.PIPELINE_BIND_POINT_GRAPHICS (materialPipeline material)
Vk.cmdBindDescriptorSets -- Vk.cmdBindDescriptorSets
commandBuffer -- commandBuffer
Vk.PIPELINE_BIND_POINT_GRAPHICS -- Vk.PIPELINE_BIND_POINT_GRAPHICS
(materialPipelineLayout material) -- (materialPipelineLayout material)
0 -- 0
(V.singleton $ frameGlobalDescriptor frame) -- (V.singleton $ frameGlobalDescriptor frame)
V.empty -- V.empty
Vk.cmdBindDescriptorSets -- Vk.cmdBindDescriptorSets
commandBuffer -- commandBuffer
Vk.PIPELINE_BIND_POINT_GRAPHICS -- Vk.PIPELINE_BIND_POINT_GRAPHICS
(materialPipelineLayout material) -- (materialPipelineLayout material)
1 -- 1
(V.singleton $ frameObjectDescriptor frame) -- (V.singleton $ frameObjectDescriptor frame)
V.empty -- V.empty
Vk.cmdBindVertexBuffers -- Vk.cmdBindVertexBuffers
commandBuffer -- commandBuffer
0 -- 0
(V.fromList [ allocatedBuffer $ meshBuffer mesh ]) -- (V.fromList [ allocatedBuffer $ meshBuffer mesh ])
(V.fromList [ 0 ]) -- (V.fromList [ 0 ])
mapM_ -- mapM_
(Vk.cmdDraw commandBuffer (fromIntegral $ V.length $ meshVertices mesh) 1 0) -- (Vk.cmdDraw commandBuffer (fromIntegral $ V.length $ meshVertices mesh) 1 0)
[first .. (count - 1)] -- [first .. (count - 1)]
) -- )
draws -- draws
prepareRecording prepareRecording
:: V2 CInt :: V2 CInt