[Bf-blender-cvs] [e17eb27747b] temp-vulkan-descriptor-sets: Doing more test to see how vma works.

Jeroen Bakker noreply at git.blender.org
Fri Feb 3 15:23:46 CET 2023


Commit: e17eb27747bbd2b38078d2d8756289c7a7fdf8b4
Author: Jeroen Bakker
Date:   Fri Feb 3 15:23:20 2023 +0100
Branches: temp-vulkan-descriptor-sets
https://developer.blender.org/rBe17eb27747bbd2b38078d2d8756289c7a7fdf8b4

Doing more test to see how vma works.

===================================================================

M	source/blender/gpu/tests/gpu_storage_buffer_test.cc
M	source/blender/gpu/tests/gpu_testing.cc
M	source/blender/gpu/vulkan/vk_buffer.cc
M	source/blender/gpu/vulkan/vk_shader.cc

===================================================================

diff --git a/source/blender/gpu/tests/gpu_storage_buffer_test.cc b/source/blender/gpu/tests/gpu_storage_buffer_test.cc
index e9e8efb1dc7..82a0f162e96 100644
--- a/source/blender/gpu/tests/gpu_storage_buffer_test.cc
+++ b/source/blender/gpu/tests/gpu_storage_buffer_test.cc
@@ -13,6 +13,15 @@ namespace blender::gpu::tests {
 constexpr size_t SIZE = 128;
 constexpr size_t SIZE_IN_BYTES = SIZE * sizeof(int);
 
+static Vector<int32_t> test_data()
+{
+  Vector<int32_t> data;
+  for (int i : IndexRange(SIZE)) {
+    data.append(i);
+  }
+  return data;
+}
+
 static void test_gpu_storage_buffer_create_update_read()
 {
   GPUStorageBuf *ssbo = GPU_storagebuf_create_ex(
@@ -20,11 +29,9 @@ static void test_gpu_storage_buffer_create_update_read()
   EXPECT_NE(ssbo, nullptr);
 
   /* Upload some dummy data. */
-  int data[SIZE];
-  for (int i : IndexRange(SIZE)) {
-    data[i] = i;
-  }
-  GPU_storagebuf_update(ssbo, data);
+  const Vector<int32_t> data = test_data();
+
+  GPU_storagebuf_update(ssbo, data.data());
 
   GPU_storagebuf_free(ssbo);
 }
diff --git a/source/blender/gpu/tests/gpu_testing.cc b/source/blender/gpu/tests/gpu_testing.cc
index 1f54837cca3..d55dda75a50 100644
--- a/source/blender/gpu/tests/gpu_testing.cc
+++ b/source/blender/gpu/tests/gpu_testing.cc
@@ -15,8 +15,9 @@ namespace blender::gpu {
 void GPUTest::SetUp()
 {
   GPU_backend_type_selection_set(gpu_backend_type);
-  GHOST_GLSettings glSettings = {0};
+  GHOST_GLSettings glSettings = {};
   glSettings.context_type = draw_context_type;
+  glSettings.flags = GHOST_glDebugContext;
   CLG_init();
   ghost_system = GHOST_CreateSystem();
   ghost_context = GHOST_CreateOpenGLContext(ghost_system, glSettings);
diff --git a/source/blender/gpu/vulkan/vk_buffer.cc b/source/blender/gpu/vulkan/vk_buffer.cc
index ff12d153702..66eec891046 100644
--- a/source/blender/gpu/vulkan/vk_buffer.cc
+++ b/source/blender/gpu/vulkan/vk_buffer.cc
@@ -62,9 +62,12 @@ bool VKBuffer::create(VKContext &context,
   create_info.pQueueFamilyIndices = context.queue_family_ptr_get();
 
   VmaAllocationCreateInfo vma_create_info = {};
+  /*
   vma_create_info.flags = vma_allocation_flags(usage);
   vma_create_info.priority = 1.0f;
   vma_create_info.usage = VMA_MEMORY_USAGE_AUTO;
+  vma_create_inf
+  */
 
   VkResult result = vmaCreateBuffer(
       allocator, &create_info, &vma_create_info, &vk_buffer_, &allocation_, nullptr);
diff --git a/source/blender/gpu/vulkan/vk_shader.cc b/source/blender/gpu/vulkan/vk_shader.cc
index 67d60780b44..8297041ea08 100644
--- a/source/blender/gpu/vulkan/vk_shader.cc
+++ b/source/blender/gpu/vulkan/vk_shader.cc
@@ -605,6 +605,9 @@ VKShader::~VKShader()
   for (VkDescriptorSetLayout &layout : layouts_) {
     vkDestroyDescriptorSetLayout(device, layout, nullptr);
   }
+  if (pipeline_ != VK_NULL_HANDLE) {
+    vkDestroyPipeline(device, pipeline_, nullptr);
+  }
 }
 
 void VKShader::build_shader_module(MutableSpan<const char *> sources,



More information about the Bf-blender-cvs mailing list