From f5abb144223a38b034f9f644261c8ee1dd7d142b Mon Sep 17 00:00:00 2001 From: Christoph Haag Date: Wed, 3 Feb 2021 02:24:35 +0100 Subject: [PATCH] comp: Don't allocate ubos with VK_MEMORY_PROPERTY_HOST_CACHED_BIT On Tegra the only supported combinations for VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT are * VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT * VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT * VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_CACHED_BIT This article agrees that we do not need host cached memory here: https://zeux.io/2020/02/27/writing-an-efficient-vulkan-renderer/ --- src/xrt/compositor/main/comp_layer.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/xrt/compositor/main/comp_layer.c b/src/xrt/compositor/main/comp_layer.c index 83e82fe84..bb57ca70f 100644 --- a/src/xrt/compositor/main/comp_layer.c +++ b/src/xrt/compositor/main/comp_layer.c @@ -52,8 +52,7 @@ static bool _init_ubos(struct comp_render_layer *self) { VkBufferUsageFlags usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT; - VkMemoryPropertyFlags properties = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | - VK_MEMORY_PROPERTY_HOST_CACHED_BIT; + VkMemoryPropertyFlags properties = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT; for (uint32_t i = 0; i < 2; i++) { math_matrix_4x4_identity(&self->transformation[i].mvp); @@ -77,8 +76,7 @@ static bool _init_equirect1_ubo(struct comp_render_layer *self) { VkBufferUsageFlags usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT; - VkMemoryPropertyFlags properties = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | - VK_MEMORY_PROPERTY_HOST_CACHED_BIT; + VkMemoryPropertyFlags properties = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT; if (!vk_buffer_init(self->vk, sizeof(struct layer_transformation), usage, properties, &self->equirect1_ubo.handle, &self->equirect1_ubo.memory)) @@ -98,8 +96,7 @@ static bool _init_equirect2_ubo(struct comp_render_layer *self) { VkBufferUsageFlags usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT; - VkMemoryPropertyFlags properties = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | - VK_MEMORY_PROPERTY_HOST_CACHED_BIT; + VkMemoryPropertyFlags properties = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT; if (!vk_buffer_init(self->vk, sizeof(struct layer_transformation), usage, properties, &self->equirect2_ubo.handle, &self->equirect2_ubo.memory))