changeset 1337:164276e8697f

did: small fix with image arrays
author sam <sam@basx.dev>
date Sat, 24 Aug 2024 14:10:21 +0700
parents 5ca89802a746
children 1d77dfecdabe
files semicongine/core/vector.nim semicongine/rendering/renderer.nim semicongine/rendering/vulkan_wrappers.nim
diffstat 3 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/semicongine/core/vector.nim	Sat Aug 24 12:33:46 2024 +0700
+++ b/semicongine/core/vector.nim	Sat Aug 24 14:10:21 2024 +0700
@@ -137,6 +137,7 @@
   G* = vec4(1, 0, 0, 1)
   B* = vec4(1, 0, 0, 1)
 
+  O* = vec3(0, 0, 0)
   X* = vec3(1, 0, 0)
   Y* = vec3(0, 1, 0)
   Z* = vec3(0, 0, 1)
@@ -145,6 +146,7 @@
   YZ* = vec3(0, 1, 1)
   XYZ* = vec3(1, 1, 1)
 
+  Oi* = vec3i(0, 0, 0)
   Xi* = vec3i(1, 0, 0)
   Yi* = vec3i(0, 1, 0)
   Zi* = vec3i(0, 0, 1)
@@ -153,6 +155,7 @@
   YZi* = vec3i(0, 1, 1)
   XYZi* = vec3i(1, 1, 1)
 
+  Oi8* = vec3i8(0, 0, 0)
   Xi8* = vec3i8(1, 0, 0)
   Yi8* = vec3i8(0, 1, 0)
   Zi8* = vec3i8(0, 0, 1)
--- a/semicongine/rendering/renderer.nim	Sat Aug 24 12:33:46 2024 +0700
+++ b/semicongine/rendering/renderer.nim	Sat Aug 24 14:10:21 2024 +0700
@@ -554,7 +554,7 @@
   renderData.memory[memoryType][selectedBlockI].offsetNextFree += memoryRequirements.size
 
   # imageview can only be created after memory is bound
-  image.imageview = svkCreate2DImageView(image.vk, format, nLayers = image.nLayers)
+  image.imageview = svkCreate2DImageView(image.vk, format, nLayers = image.nLayers, isArray = typeof(image) is ImageArray)
   renderData.imageViews.add image.imageview
 
   # data transfer and layout transition
--- a/semicongine/rendering/vulkan_wrappers.nim	Sat Aug 24 12:33:46 2024 +0700
+++ b/semicongine/rendering/vulkan_wrappers.nim	Sat Aug 24 14:10:21 2024 +0700
@@ -143,11 +143,12 @@
     format: VkFormat,
     aspect = VK_IMAGE_ASPECT_COLOR_BIT,
     nLayers = 1'u32,
+    isArray = false
 ): VkImageView =
   var createInfo = VkImageViewCreateInfo(
     sType: VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
     image: image,
-    viewType: if nLayers == 1: VK_IMAGE_VIEW_TYPE_2D else: VK_IMAGE_VIEW_TYPE_2D_ARRAY,
+    viewType: if isArray: VK_IMAGE_VIEW_TYPE_2D_ARRAY else: VK_IMAGE_VIEW_TYPE_2D,
     format: format,
     components: VkComponentMapping(
       r: VK_COMPONENT_SWIZZLE_IDENTITY,