[Bf-blender-cvs] [8a3329e72b5] temp-vulkan-shader: Initialize GCaps from VKContext.

Jeroen Bakker noreply at git.blender.org
Fri Nov 25 10:05:01 CET 2022


Commit: 8a3329e72b588fe22cf314f5b3d2d5ae128072b4
Author: Jeroen Bakker
Date:   Fri Nov 25 10:00:31 2022 +0100
Branches: temp-vulkan-shader
https://developer.blender.org/rB8a3329e72b588fe22cf314f5b3d2d5ae128072b4

Initialize GCaps from VKContext.

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

M	source/blender/gpu/vulkan/vk_backend.cc
M	source/blender/gpu/vulkan/vk_backend.hh
M	source/blender/gpu/vulkan/vk_context.cc

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

diff --git a/source/blender/gpu/vulkan/vk_backend.cc b/source/blender/gpu/vulkan/vk_backend.cc
index 040ca6083bf..993f7822496 100644
--- a/source/blender/gpu/vulkan/vk_backend.cc
+++ b/source/blender/gpu/vulkan/vk_backend.cc
@@ -5,6 +5,7 @@
  * \ingroup gpu
  */
 
+#include "gpu_capabilities_private.hh"
 #include "gpu_platform_private.hh"
 
 #include "vk_batch.hh"
@@ -137,4 +138,11 @@ shaderc::Compiler &VKBackend::get_shaderc_compiler()
   return shaderc_compiler_;
 }
 
+void VKBackend::capabilities_init(VKContext &context)
+{
+  /* Reset all capabilities from previous context. */
+  GCaps = {};
+  GCaps.compute_shader_support = true;
+}
+
 }  // namespace blender::gpu
\ No newline at end of file
diff --git a/source/blender/gpu/vulkan/vk_backend.hh b/source/blender/gpu/vulkan/vk_backend.hh
index d4ceb3dcd9d..f883c06ff60 100644
--- a/source/blender/gpu/vulkan/vk_backend.hh
+++ b/source/blender/gpu/vulkan/vk_backend.hh
@@ -18,6 +18,8 @@
 
 namespace blender::gpu {
 
+class VKContext;
+
 class VKBackend : public GPUBackend {
  private:
   shaderc::Compiler shaderc_compiler_;
@@ -60,6 +62,8 @@ class VKBackend : public GPUBackend {
 
   shaderc::Compiler &get_shaderc_compiler();
 
+  static void capabilities_init(VKContext &context);
+
  private:
   static void init_platform();
   static void platform_exit();
diff --git a/source/blender/gpu/vulkan/vk_context.cc b/source/blender/gpu/vulkan/vk_context.cc
index 0bf2d29e124..6013b5eb95c 100644
--- a/source/blender/gpu/vulkan/vk_context.cc
+++ b/source/blender/gpu/vulkan/vk_context.cc
@@ -7,6 +7,8 @@
 
 #include "vk_context.hh"
 
+#include "vk_backend.hh"
+
 #include "GHOST_C-api.h"
 
 namespace blender::gpu {
@@ -32,6 +34,8 @@ VKContext::VKContext(void *ghost_window, void *ghost_context)
   info.device = device_;
   info.instance = instance_;
   vmaCreateAllocator(&info, &mem_allocator_);
+
+  VKBackend::capabilities_init(*this);
 }
 
 VKContext::~VKContext()



More information about the Bf-blender-cvs mailing list