From 39e7c4a9b2daff1756697db81f11c4bbdc7efb94 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 3 Apr 2022 11:47:53 +0900 Subject: [PATCH] [vulkan] Use a template for the deferred image views That certainly makes it nicer to work with large sets, and shows one way to be careful with allocated resources: don't allocate them in the inherited data and use a template that needs a few things filled in to be valid. Also, it seems that overriding values in sub-structures "just works" :) --- libs/video/renderer/vulkan/deferred.plist | 102 +++++----------------- 1 file changed, 21 insertions(+), 81 deletions(-) diff --git a/libs/video/renderer/vulkan/deferred.plist b/libs/video/renderer/vulkan/deferred.plist index c5ce13c0f..ad1d7df68 100644 --- a/libs/video/renderer/vulkan/deferred.plist +++ b/libs/video/renderer/vulkan/deferred.plist @@ -106,118 +106,58 @@ initialLayout = undefined; }; }; + flat_color_view_template = { + viewType = VK_IMAGE_VIEW_TYPE_2D; + components = { + r = identity; + g = identity; + b = identity; + a = identity; + }; + subresourceRange = { + aspectMask = color; + levelCount = 1; + layerCount = 1; + }; + }; imageViews = { depth = { + @inherit = $properties.flat_color_view_template; image = depth; - viewType = VK_IMAGE_VIEW_TYPE_2D; format = $properties.images.depth.format; - components = { - r = identity; - g = identity; - b = identity; - a = identity; - }; subresourceRange = { aspectMask = depth; - levelCount = 1; - layerCount = 1; }; }; color = { + @inherit = $properties.flat_color_view_template; image = color; - viewType = VK_IMAGE_VIEW_TYPE_2D; format = $properties.images.color.format; - components = { - r = identity; - g = identity; - b = identity; - a = identity; - }; - subresourceRange = { - aspectMask = color; - levelCount = 1; - layerCount = 1; - }; }; emission = { + @inherit = $properties.flat_color_view_template; image = emission; - viewType = VK_IMAGE_VIEW_TYPE_2D; format = $properties.images.emission.format; - components = { - r = identity; - g = identity; - b = identity; - a = identity; - }; - subresourceRange = { - aspectMask = color; - levelCount = 1; - layerCount = 1; - }; }; normal = { + @inherit = $properties.flat_color_view_template; image = normal; - viewType = VK_IMAGE_VIEW_TYPE_2D; format = $properties.images.normal.format; - components = { - r = identity; - g = identity; - b = identity; - a = identity; - }; - subresourceRange = { - aspectMask = color; - levelCount = 1; - layerCount = 1; - }; }; position = { + @inherit = $properties.flat_color_view_template; image = position; - viewType = VK_IMAGE_VIEW_TYPE_2D; format = $properties.images.position.format; - components = { - r = identity; - g = identity; - b = identity; - a = identity; - }; - subresourceRange = { - aspectMask = color; - levelCount = 1; - layerCount = 1; - }; }; opaque = { + @inherit = $properties.flat_color_view_template; image = opaque; - viewType = VK_IMAGE_VIEW_TYPE_2D; format = $properties.images.opaque.format; - components = { - r = identity; - g = identity; - b = identity; - a = identity; - }; - subresourceRange = { - aspectMask = color; - levelCount = 1; - layerCount = 1; - }; }; translucent = { + @inherit = $properties.flat_color_view_template; image = translucent; - viewType = VK_IMAGE_VIEW_TYPE_2D; format = $properties.images.translucent.format; - components = { - r = identity; - g = identity; - b = identity; - a = identity; - }; - subresourceRange = { - aspectMask = color; - levelCount = 1; - layerCount = 1; - }; }; }; framebuffer = {