Mercurial > games > semicongine
comparison src/zamikongine/buffer.nim @ 32:9edca5dc4e93
add: working implementation of uniforms
author | Sam <sam@basx.dev> |
---|---|
date | Sat, 14 Jan 2023 23:34:50 +0700 |
parents | b1b05d4efb52 |
children | 94c38e4b5782 |
comparison
equal
deleted
inserted
replaced
31:0996104ad066 | 32:9edca5dc4e93 |
---|---|
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 |