Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
elect86 committed May 15, 2018
1 parent 4277df0 commit 77c7e99
Show file tree
Hide file tree
Showing 4 changed files with 922 additions and 280 deletions.
10 changes: 5 additions & 5 deletions src/main/kotlin/vulkan/base/Vulkan Buffer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Buffer {
val descriptor: VkDescriptorBufferInfo = VkDescriptorBufferInfo.calloc()
var size: VkDeviceSize = 0
var alignment: VkDeviceSize = 0
var mapped: PointerBuffer = memCallocPointer(1)
var mapped = NULL

/** @brief Usage flags to be filled by external source at buffer creation (to query at some later point) */
var usageFlags: VkBufferUsageFlags = 0
Expand All @@ -46,12 +46,12 @@ class Buffer {
* @return VkResult of the buffer mapping call
*/
fun map(size: VkDeviceSize = VK_WHOLE_SIZE, offset: VkDeviceSize = 0) {
device.mapMemory(memory, offset, size, 0, mapped.adr)
mapped = device.mapMemory(memory, offset, size)
}

fun mapping(size: VkDeviceSize = VK_WHOLE_SIZE, offset: VkDeviceSize = 0, block: (Long) -> Unit) {
map(size, offset)
block(mapped[0])
block(mapped)
unmap()
}

Expand All @@ -61,9 +61,9 @@ class Buffer {
* @note Does not return a result as vkUnmapMemory can't fail
*/
fun unmap() {
if (mapped[0] != NULL) {
if (mapped != NULL) {
device unmapMemory memory
mapped[0] = NULL
mapped = NULL
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/vulkan/basics/11 Model Rendering.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fun main(args: Array<String>) {
}


class ModelRendering : VulkanExampleBase() {
private class ModelRendering : VulkanExampleBase() {

var wireframe = false

Expand Down
Loading

0 comments on commit 77c7e99

Please sign in to comment.