comparison src/zamikongine/buffer.nim @ 493:680c4b8ca28a

add: working implementation of uniforms
author Sam <sam@basx.dev>
date Sat, 14 Jan 2023 23:34:50 +0700
parents 54a1f8ee208e
children 94c38e4b5782
comparison
equal deleted inserted replaced
492:d63d980fa3bb 493:680c4b8ca28a
82 assert not buffer.persistentMapping 82 assert not buffer.persistentMapping
83 checkVkResult vkMapMemory(buffer.device, buffer.memory, offset=VkDeviceSize(0), VkDeviceSize(buffer.size), VkMemoryMapFlags(0), addr(data)) 83 checkVkResult vkMapMemory(buffer.device, buffer.memory, offset=VkDeviceSize(0), VkDeviceSize(buffer.size), VkMemoryMapFlags(0), addr(data))
84 body 84 body
85 vkUnmapMemory(buffer.device, buffer.memory) 85 vkUnmapMemory(buffer.device, buffer.memory)
86 86
87 # note: does not work with seq 87 # note: does not work with seq, because of sizeof
88 proc updateData*[T](buffer: Buffer, data: var T) = 88 proc updateData*[T](buffer: Buffer, data: var T) =
89 if buffer.persistentMapping: 89 if buffer.persistentMapping:
90 copyMem(buffer.mapped, addr(data), sizeof(T)) 90 copyMem(buffer.mapped, addr(data), sizeof(T))
91 else: 91 else:
92 var p: pointer 92 var p: pointer