adjust buffer size and poke stride to make things finally work
This commit is contained in:
parent
139f208377
commit
4f2ab52fa7
1 changed files with 3 additions and 2 deletions
|
@ -36,7 +36,8 @@ uploadMesh
|
||||||
-> m Mesh
|
-> m Mesh
|
||||||
uploadMesh vertices allocator = do
|
uploadMesh vertices allocator = do
|
||||||
let bufferCreateInfo = Vk.zero
|
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
|
, Vk.usage = Vk.BUFFER_USAGE_VERTEX_BUFFER_BIT
|
||||||
}
|
}
|
||||||
allocationCreateInfo = Vk.zero
|
allocationCreateInfo = Vk.zero
|
||||||
|
@ -57,7 +58,7 @@ uploadMesh vertices allocator = do
|
||||||
(\_ -> VMA.unmapMemory allocator (bufferAllocation $ meshBuffer mesh))
|
(\_ -> VMA.unmapMemory allocator (bufferAllocation $ meshBuffer mesh))
|
||||||
|
|
||||||
liftIO $ mapM_ (\(idx, vertex) ->
|
liftIO $ mapM_ (\(idx, vertex) ->
|
||||||
poke (castPtr (dataPtr `plusPtr` idx)) vertex
|
poke (castPtr (dataPtr `plusPtr` (idx * sizeOf vertex))) vertex
|
||||||
)
|
)
|
||||||
(zip [0..] (V.toList vertices))
|
(zip [0..] (V.toList vertices))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue