changeset 1328:a53a31b6e027

did: make renderdata referencable
author sam <sam@basx.dev>
date Sat, 17 Aug 2024 15:09:01 +0700
parents 373a4888f6ac
children ad09d41abd1e
files semicongine/rendering.nim semicongine/rendering/renderer.nim
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/semicongine/rendering.nim	Sat Aug 17 13:54:22 2024 +0700
+++ b/semicongine/rendering.nim	Sat Aug 17 15:09:01 2024 +0700
@@ -140,19 +140,20 @@
     offset: uint64
   GPUData* = GPUArray | GPUValue
 
-  RenderData* = object
+  RenderDataObject = object
     descriptorPool: VkDescriptorPool
     memory: array[VK_MAX_MEMORY_TYPES.int, seq[MemoryBlock]]
     buffers: array[BufferType, seq[Buffer]]
     images: seq[VkImage]
     imageViews: seq[VkImageView]
     samplers: seq[VkSampler]
+  RenderData* = ref RenderDataObject
 
 var vulkan* = VulkanGlobals()
 var fullscreen_internal: bool
 
 proc `=copy`(dest: var VulkanGlobals; source: VulkanGlobals) {.error.}
-proc `=copy`(dest: var RenderData; source: RenderData) {.error.}
+proc `=copy`(dest: var RenderDataObject; source: RenderDataObject) {.error.}
 proc `=copy`[T, S](dest: var GPUValue[T, S]; source: GPUValue[T, S]) {.error.}
 proc `=copy`[T, S](dest: var GPUArray[T, S]; source: GPUArray[T, S]) {.error.}
 proc `=copy`(dest: var MemoryBlock; source: MemoryBlock) {.error.}
--- a/semicongine/rendering/renderer.nim	Sat Aug 17 13:54:22 2024 +0700
+++ b/semicongine/rendering/renderer.nim	Sat Aug 17 15:09:01 2024 +0700
@@ -357,6 +357,7 @@
   assignBuffers(renderdata, descriptorSet.data, uploadData = uploadData)
 
 proc initRenderData*(descriptorPoolLimit = 1024'u32): RenderData =
+  result = RenderData()
   # allocate descriptor pools
   var poolSizes = [
     VkDescriptorPoolSize(thetype: VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, descriptorCount: descriptorPoolLimit),