adjust buffer size and poke stride to make things finally work

This commit is contained in:
nek0 2022-12-08 04:22:24 +01:00
parent 139f208377
commit 4f2ab52fa7

View file

@ -36,7 +36,8 @@ uploadMesh
-> m Mesh
uploadMesh vertices allocator = do
let bufferCreateInfo = Vk.zero
{ Vk.size = fromIntegral $ sizeOf (Vertex (V3 0 0 0) (V3 0 0 0 ) (V4 0 0 0 0))
{ Vk.size = fromIntegral $
V.length loadMeshes * sizeOf (Vertex (V3 0 0 0) (V3 0 0 0 ) (V4 0 0 0 0))
, Vk.usage = Vk.BUFFER_USAGE_VERTEX_BUFFER_BIT
}
allocationCreateInfo = Vk.zero
@ -57,7 +58,7 @@ uploadMesh vertices allocator = do
(\_ -> VMA.unmapMemory allocator (bufferAllocation $ meshBuffer mesh))
liftIO $ mapM_ (\(idx, vertex) ->
poke (castPtr (dataPtr `plusPtr` idx)) vertex
poke (castPtr (dataPtr `plusPtr` (idx * sizeOf vertex))) vertex
)
(zip [0..] (V.toList vertices))