Blender V5.0
vk_device.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <fmt/format.h>
10#include <sstream>
11
12#include "CLG_log.h"
13
14#include "vk_backend.hh"
15#include "vk_context.hh"
16#include "vk_device.hh"
17#include "vk_state_manager.hh"
18#include "vk_storage_buffer.hh"
19#include "vk_texture.hh"
20#include "vk_vertex_buffer.hh"
21
23
24#include "GPU_capabilities.hh"
25
27
28#include "GHOST_C-api.h"
29
30static CLG_LogRef LOG = {"gpu.vulkan"};
31
32namespace blender::gpu {
33
35{
37 "Device features\n"
38 " - [%c] shader output viewport index\n"
39 " - [%c] shader output layer\n"
40 " - [%c] fragment shader barycentric\n"
41 " - [%c] wide lines\n"
42 "Device extensions\n"
43 " - [%c] descriptor buffer\n"
44 " - [%c] dynamic rendering local read\n"
45 " - [%c] dynamic rendering unused attachments\n"
46 " - [%c] external memory\n"
47 " - [%c] maintenance4\n"
48 " - [%c] memory priority\n"
49 " - [%c] pageable device local memory\n"
50 " - [%c] shader stencil export",
52 shader_output_layer ? 'X' : ' ',
54 wide_lines ? 'X' : ' ',
55 descriptor_buffer ? 'X' : ' ',
58 external_memory ? 'X' : ' ',
59 maintenance4 ? 'X' : ' ',
60 memory_priority ? 'X' : ' ',
62 GPU_stencil_export_support() ? 'X' : ' ');
63}
64
66{
67 samplers_.free();
68 samplers_.init();
69}
70
72{
73 if (!is_initialized()) {
74 return;
75 }
76
77 deinit_submission_pool();
78
79 dummy_buffer.free();
80 samplers_.free();
81 GPU_SHADER_FREE_SAFE(vk_backbuffer_blit_sh_);
82
83 orphaned_data_render.deinit(*this);
84 orphaned_data.deinit(*this);
85 {
86 while (!thread_data_.is_empty()) {
87 VKThreadData *thread_data = thread_data_.pop_last();
88 delete thread_data;
89 }
90 thread_data_.clear();
91 }
92 pipelines.write_to_disk();
93 pipelines.free_data();
94 descriptor_set_layouts_.deinit();
95 vma_pools.deinit(*this);
96 mem_allocator_ = VK_NULL_HANDLE;
97
98 while (!render_graphs_.is_empty()) {
99 render_graph::VKRenderGraph *render_graph = render_graphs_.pop_last();
100 MEM_delete<render_graph::VKRenderGraph>(render_graph);
101 }
102
103 debugging_tools_.deinit(vk_instance_);
104
105 vk_instance_ = VK_NULL_HANDLE;
106 vk_physical_device_ = VK_NULL_HANDLE;
107 vk_device_ = VK_NULL_HANDLE;
108 vk_queue_family_ = 0;
109 vk_queue_ = VK_NULL_HANDLE;
110 vk_physical_device_properties_ = {};
111 glsl_vert_patch_.clear();
112 glsl_frag_patch_.clear();
113 glsl_geom_patch_.clear();
114 glsl_comp_patch_.clear();
115 is_initialized_ = false;
116}
117
118void VKDevice::init(void *ghost_context)
119{
121 GHOST_VulkanHandles handles = {};
122 GHOST_GetVulkanHandles((GHOST_ContextHandle)ghost_context, &handles);
123 vk_instance_ = handles.instance;
124 vk_physical_device_ = handles.physical_device;
125 vk_device_ = handles.device;
126 vk_queue_family_ = handles.graphic_queue_family;
127 vk_queue_ = handles.queue;
128 mem_allocator_ = handles.vma_allocator;
129 queue_mutex_ = static_cast<std::mutex *>(handles.queue_mutex);
130
131 init_physical_device_extensions();
132 init_physical_device_properties();
133 init_physical_device_memory_properties();
134 init_physical_device_features();
137 init_functions();
138 init_debug_callbacks();
139 vma_pools.init(*this);
140 pipelines.init();
141 pipelines.read_from_disk();
142
143 samplers_.init();
144 init_dummy_buffer();
145
146 debug::object_label(vk_handle(), "LogicalDevice");
147 debug::object_label(vk_queue_, "GenericQueue");
148
149 resources.use_dynamic_rendering_local_read = extensions_.dynamic_rendering_local_read;
150 orphaned_data.timeline_ = 0;
151
152 init_submission_pool();
153 is_initialized_ = true;
154}
155
156void VKDevice::init_functions()
157{
158#define LOAD_FUNCTION(name) (PFN_##name) vkGetInstanceProcAddr(vk_instance_, STRINGIFY(name))
159 /* VK_KHR_dynamic_rendering */
160 functions.vkCmdBeginRendering = LOAD_FUNCTION(vkCmdBeginRenderingKHR);
161 functions.vkCmdEndRendering = LOAD_FUNCTION(vkCmdEndRenderingKHR);
162
163 /* VK_EXT_debug_utils */
164 functions.vkCmdBeginDebugUtilsLabel = LOAD_FUNCTION(vkCmdBeginDebugUtilsLabelEXT);
165 functions.vkCmdEndDebugUtilsLabel = LOAD_FUNCTION(vkCmdEndDebugUtilsLabelEXT);
166 functions.vkSetDebugUtilsObjectName = LOAD_FUNCTION(vkSetDebugUtilsObjectNameEXT);
167 functions.vkCreateDebugUtilsMessenger = LOAD_FUNCTION(vkCreateDebugUtilsMessengerEXT);
168 functions.vkDestroyDebugUtilsMessenger = LOAD_FUNCTION(vkDestroyDebugUtilsMessengerEXT);
169
170 if (extensions_.external_memory) {
171#ifdef _WIN32
172 /* VK_KHR_external_memory_win32 */
173 functions.vkGetMemoryWin32Handle = LOAD_FUNCTION(vkGetMemoryWin32HandleKHR);
174#elif not defined(__APPLE__)
175 /* VK_KHR_external_memory_fd */
176 functions.vkGetMemoryFd = LOAD_FUNCTION(vkGetMemoryFdKHR);
177#endif
178 }
179
180 /* VK_EXT_descriptor_buffer */
181 functions.vkGetDescriptorSetLayoutSize = LOAD_FUNCTION(vkGetDescriptorSetLayoutSizeEXT);
182 functions.vkGetDescriptorSetLayoutBindingOffset = LOAD_FUNCTION(
183 vkGetDescriptorSetLayoutBindingOffsetEXT);
184 functions.vkGetDescriptor = LOAD_FUNCTION(vkGetDescriptorEXT);
185 functions.vkCmdBindDescriptorBuffers = LOAD_FUNCTION(vkCmdBindDescriptorBuffersEXT);
186 functions.vkCmdSetDescriptorBufferOffsets = LOAD_FUNCTION(vkCmdSetDescriptorBufferOffsetsEXT);
187
188#undef LOAD_FUNCTION
189}
190
191void VKDevice::init_debug_callbacks()
192{
193 debugging_tools_.init(vk_instance_);
194}
195
196void VKDevice::init_physical_device_properties()
197{
198 BLI_assert(vk_physical_device_ != VK_NULL_HANDLE);
199
200 VkPhysicalDeviceProperties2 vk_physical_device_properties = {};
201 vk_physical_device_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
202 vk_physical_device_driver_properties_.sType =
203 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES;
204 vk_physical_device_id_properties_.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES;
205 vk_physical_device_properties.pNext = &vk_physical_device_driver_properties_;
206 vk_physical_device_driver_properties_.pNext = &vk_physical_device_id_properties_;
207
208 if (supports_extension(VK_EXT_DESCRIPTOR_BUFFER_EXTENSION_NAME)) {
209 vk_physical_device_descriptor_buffer_properties_ = {
210 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_PROPERTIES_EXT};
211 vk_physical_device_descriptor_buffer_properties_.pNext =
212 vk_physical_device_driver_properties_.pNext;
213 vk_physical_device_driver_properties_.pNext =
214 &vk_physical_device_descriptor_buffer_properties_;
215 }
216
217 if (supports_extension(VK_KHR_MAINTENANCE_4_EXTENSION_NAME)) {
218 vk_physical_device_maintenance4_properties_.pNext = vk_physical_device_properties.pNext;
219 vk_physical_device_properties.pNext = &vk_physical_device_maintenance4_properties_;
220 }
221
222 vkGetPhysicalDeviceProperties2(vk_physical_device_, &vk_physical_device_properties);
223 vk_physical_device_properties_ = vk_physical_device_properties.properties;
224}
225
226void VKDevice::init_physical_device_memory_properties()
227{
228 BLI_assert(vk_physical_device_ != VK_NULL_HANDLE);
229 vkGetPhysicalDeviceMemoryProperties(vk_physical_device_, &vk_physical_device_memory_properties_);
230}
231
232void VKDevice::init_physical_device_features()
233{
234 BLI_assert(vk_physical_device_ != VK_NULL_HANDLE);
235
236 VkPhysicalDeviceFeatures2 features = {};
237 features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
238 vk_physical_device_vulkan_11_features_.sType =
239 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES;
240 vk_physical_device_vulkan_12_features_.sType =
241 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES;
242
243 features.pNext = &vk_physical_device_vulkan_11_features_;
244 vk_physical_device_vulkan_11_features_.pNext = &vk_physical_device_vulkan_12_features_;
245
246 vkGetPhysicalDeviceFeatures2(vk_physical_device_, &features);
247 vk_physical_device_features_ = features.features;
248}
249
250void VKDevice::init_physical_device_extensions()
251{
252 uint32_t count = 0;
253 vkEnumerateDeviceExtensionProperties(vk_physical_device_, nullptr, &count, nullptr);
254 device_extensions_ = Array<VkExtensionProperties>(count);
255 vkEnumerateDeviceExtensionProperties(
256 vk_physical_device_, nullptr, &count, device_extensions_.data());
257}
258
259bool VKDevice::supports_extension(const char *extension_name) const
260{
261 for (const VkExtensionProperties &vk_extension_properties : device_extensions_) {
262 if (STREQ(vk_extension_properties.extensionName, extension_name)) {
263 return true;
264 }
265 }
266 return false;
267}
268
269void VKDevice::init_dummy_buffer()
270{
272 VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT,
273 VMA_MEMORY_USAGE_AUTO_PREFER_HOST,
274 VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT,
275 1.0f);
277 /* Default dummy buffer. Set the 4th element to 1 to fix missing orcos. */
278 float data[16] = {
279 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
280 dummy_buffer.update_immediately(static_cast<void *>(data));
281}
282
284{
285 std::stringstream ss;
286
287 ss << "#version 450\n";
288 {
289 /* Required extension. */
290 ss << "#extension GL_ARB_shader_draw_parameters : enable\n";
291 ss << "#define GPU_ARB_shader_draw_parameters\n";
292 ss << "#define gpu_BaseInstance (gl_BaseInstanceARB)\n";
293 }
294 ss << "#define GPU_ARB_clip_control\n";
295
296 ss << "#define gl_VertexID gl_VertexIndex\n";
297 ss << "#define gpu_InstanceIndex (gl_InstanceIndex)\n";
298 ss << "#define gl_InstanceID (gpu_InstanceIndex - gpu_BaseInstance)\n";
299
300 ss << "#extension GL_ARB_shader_viewport_layer_array: enable\n";
302 ss << "#extension GL_ARB_shader_stencil_export: enable\n";
303 ss << "#define GPU_ARB_shader_stencil_export 1\n";
304 }
305 if (extensions_.fragment_shader_barycentric) {
306 ss << "#extension GL_EXT_fragment_shader_barycentric : require\n";
307 ss << "#define gpu_BaryCoord gl_BaryCoordEXT\n";
308 ss << "#define gpu_BaryCoordNoPersp gl_BaryCoordNoPerspEXT\n";
309 }
310 ss << stage_define;
311
312 return shader::GeneratedSource{"gpu_shader_glsl_extension.glsl", {}, ss.str()};
313}
314
316{
317 shader::GeneratedSourceList sources{extensions_define("#define GPU_VERTEX_SHADER\n")};
318 return fmt::to_string(fmt::join(
319 gpu_shader_dependency_get_resolved_source("gpu_shader_compat_glsl.glsl", sources), ""));
320}
321
323{
324 shader::GeneratedSourceList sources{extensions_define("#define GPU_GEOMETRY_SHADER\n")};
325 return fmt::to_string(fmt::join(
326 gpu_shader_dependency_get_resolved_source("gpu_shader_compat_glsl.glsl", sources), ""));
327}
328
330{
331 shader::GeneratedSourceList sources{extensions_define("#define GPU_FRAGMENT_SHADER\n")};
332 return fmt::to_string(fmt::join(
333 gpu_shader_dependency_get_resolved_source("gpu_shader_compat_glsl.glsl", sources), ""));
334}
335
337{
338 shader::GeneratedSourceList sources{extensions_define("#define GPU_COMPUTE_SHADER\n")};
339 return fmt::to_string(fmt::join(
340 gpu_shader_dependency_get_resolved_source("gpu_shader_compat_glsl.glsl", sources), ""));
341}
342
343/* -------------------------------------------------------------------- */
346
347constexpr int32_t PCI_ID_NVIDIA = 0x10de;
348constexpr int32_t PCI_ID_INTEL = 0x8086;
349constexpr int32_t PCI_ID_AMD = 0x1002;
350constexpr int32_t PCI_ID_ATI = 0x1022;
351constexpr int32_t PCI_ID_APPLE = 0x106b;
352
354{
355 switch (vk_physical_device_driver_properties_.driverID) {
356 case VK_DRIVER_ID_AMD_PROPRIETARY:
357 case VK_DRIVER_ID_AMD_OPEN_SOURCE:
358 case VK_DRIVER_ID_MESA_RADV:
359 return GPU_DEVICE_ATI;
360
361 case VK_DRIVER_ID_NVIDIA_PROPRIETARY:
362 case VK_DRIVER_ID_MESA_NVK:
363 return GPU_DEVICE_NVIDIA;
364
365 case VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS:
366 case VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA:
367 return GPU_DEVICE_INTEL;
368
369 case VK_DRIVER_ID_QUALCOMM_PROPRIETARY:
370 return GPU_DEVICE_QUALCOMM;
371
372 case VK_DRIVER_ID_MOLTENVK:
373 return GPU_DEVICE_APPLE;
374
375 case VK_DRIVER_ID_MESA_LLVMPIPE:
376 return GPU_DEVICE_SOFTWARE;
377
378 default:
379 return GPU_DEVICE_UNKNOWN;
380 }
381
382 return GPU_DEVICE_UNKNOWN;
383}
384
386{
387 switch (vk_physical_device_driver_properties_.driverID) {
388 case VK_DRIVER_ID_AMD_PROPRIETARY:
389 case VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS:
390 case VK_DRIVER_ID_NVIDIA_PROPRIETARY:
391 case VK_DRIVER_ID_QUALCOMM_PROPRIETARY:
392 return GPU_DRIVER_OFFICIAL;
393
394 case VK_DRIVER_ID_MOLTENVK:
395 case VK_DRIVER_ID_AMD_OPEN_SOURCE:
396 case VK_DRIVER_ID_MESA_RADV:
397 case VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA:
398 case VK_DRIVER_ID_MESA_NVK:
400
401 case VK_DRIVER_ID_MESA_LLVMPIPE:
402 return GPU_DRIVER_SOFTWARE;
403
404 default:
405 return GPU_DRIVER_ANY;
406 }
407
408 return GPU_DRIVER_ANY;
409}
410
411std::string VKDevice::vendor_name() const
412{
413 /* Below 0x10000 are the PCI vendor IDs (https://pcisig.com/membership/member-companies) */
414 if (vk_physical_device_properties_.vendorID < 0x10000) {
415 switch (vk_physical_device_properties_.vendorID) {
416 case PCI_ID_AMD:
417 case PCI_ID_ATI:
418 return "Advanced Micro Devices";
419 case PCI_ID_NVIDIA:
420 return "NVIDIA Corporation";
421 case PCI_ID_INTEL:
422 return "Intel Corporation";
423 case PCI_ID_APPLE:
424 return "Apple";
425 default:
426 return std::to_string(vk_physical_device_properties_.vendorID);
427 }
428 }
429 else {
430 /* above 0x10000 should be vkVendorIDs
431 * NOTE: When debug_messaging landed we can use something similar to
432 * vk::to_string(vk::VendorId(properties.vendorID));
433 */
434 return std::to_string(vk_physical_device_properties_.vendorID);
435 }
436}
437
438std::string VKDevice::driver_version() const
439{
440 return StringRefNull(vk_physical_device_driver_properties_.driverName) + " " +
441 StringRefNull(vk_physical_device_driver_properties_.driverInfo);
442}
443
445
446/* -------------------------------------------------------------------- */
449
451{
452 descriptor_pools.init(device);
453}
454
456
457/* -------------------------------------------------------------------- */
460
462{
463 std::scoped_lock mutex(resources.mutex);
464 pthread_t current_thread_id = pthread_self();
465
466 for (VKThreadData *thread_data : thread_data_) {
467 if (pthread_equal(thread_data->thread_id, current_thread_id)) {
468 return *thread_data;
469 }
470 }
471
472 VKThreadData *thread_data = new VKThreadData(*this, current_thread_id);
473 thread_data_.append(thread_data);
474 return *thread_data;
475}
476
478{
479 contexts_.append(std::reference_wrapper(context));
480}
481
483{
484 if (context.render_graph_.has_value()) {
485 render_graph::VKRenderGraph &render_graph = context.render_graph();
486 context.render_graph_.reset();
487 BLI_assert_msg(render_graph.is_empty(),
488 "Unregistering a context that still has an unsubmitted render graph.");
489 render_graph.reset();
491 unused_render_graphs_, &render_graph, BLI_THREAD_QUEUE_WORK_PRIORITY_NORMAL);
492 }
493 {
494 std::scoped_lock lock(orphaned_data.mutex_get());
495 orphaned_data.move_data(context.discard_pool, timeline_value_ + 1);
496 }
497
498 contexts_.remove(contexts_.first_index_of(std::reference_wrapper(context)));
499}
501{
502 return contexts_;
503};
504
505void VKDevice::memory_statistics_get(int *r_total_mem_kb, int *r_free_mem_kb) const
506{
507 VmaBudget budgets[VK_MAX_MEMORY_HEAPS];
508 vmaGetHeapBudgets(mem_allocator_get(), budgets);
509 VkDeviceSize total_mem = 0;
510 VkDeviceSize used_mem = 0;
511
512 for (int memory_heap_index : IndexRange(vk_physical_device_memory_properties_.memoryHeapCount)) {
513 const VkMemoryHeap &memory_heap =
514 vk_physical_device_memory_properties_.memoryHeaps[memory_heap_index];
515 const VmaBudget &budget = budgets[memory_heap_index];
516
517 /* Skip host memory-heaps. */
518 if (!bool(memory_heap.flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT)) {
519 continue;
520 }
521
522 total_mem += memory_heap.size;
523 used_mem += budget.usage;
524 }
525
526 *r_total_mem_kb = int(total_mem / 1024);
527 *r_free_mem_kb = int((total_mem - used_mem) / 1024);
528}
529
531
532/* -------------------------------------------------------------------- */
535
536void VKDevice::debug_print(std::ostream &os, const VKDiscardPool &discard_pool)
537{
538 if (discard_pool.images_.is_empty() && discard_pool.buffers_.is_empty() &&
539 discard_pool.image_views_.is_empty() && discard_pool.buffer_views_.is_empty() &&
540 discard_pool.shader_modules_.is_empty() && discard_pool.pipeline_layouts_.is_empty() &&
541 discard_pool.descriptor_pools_.is_empty())
542 {
543 return;
544 }
545 os << " Discardable resources: ";
546 if (!discard_pool.images_.is_empty()) {
547 os << "VkImage=" << discard_pool.images_.size() << " ";
548 }
549 if (!discard_pool.image_views_.is_empty()) {
550 os << "VkImageView=" << discard_pool.image_views_.size() << " ";
551 }
552 if (!discard_pool.buffers_.is_empty()) {
553 os << "VkBuffer=" << discard_pool.buffers_.size() << " ";
554 }
555 if (!discard_pool.buffer_views_.is_empty()) {
556 os << "VkBufferViews=" << discard_pool.buffer_views_.size() << " ";
557 }
558 if (!discard_pool.shader_modules_.is_empty()) {
559 os << "VkShaderModule=" << discard_pool.shader_modules_.size() << " ";
560 }
561 if (!discard_pool.pipeline_layouts_.is_empty()) {
562 os << "VkPipelineLayout=" << discard_pool.pipeline_layouts_.size() << " ";
563 }
564 if (!discard_pool.descriptor_pools_.is_empty()) {
565 os << "VkDescriptorPool=" << discard_pool.descriptor_pools_.size();
566 }
567 os << "\n";
568}
569
571{
573 "VKDevice::debug_print can only be called from the main thread.");
574
575 resources.debug_print();
576 std::ostream &os = std::cout;
577 os << "Pipelines\n";
578 os << " Graphics: " << pipelines.graphic_pipelines_.size() << "\n";
579 os << " Compute: " << pipelines.compute_pipelines_.size() << "\n";
580 os << "Descriptor sets\n";
581 os << " VkDescriptorSetLayouts: " << descriptor_set_layouts_.size() << "\n";
582 for (const VKThreadData *thread_data : thread_data_) {
583 /* NOTE: Assumption that this is always called form the main thread. This could be solved by
584 * keeping track of the main thread inside the thread data. */
585 const bool is_main = pthread_equal(thread_data->thread_id, pthread_self());
586 os << "ThreadData" << (is_main ? " (main-thread)" : "") << ")\n";
587 os << " Rendering_depth: " << thread_data->rendering_depth << "\n";
588 }
589 os << "Discard pool\n";
591 os << "Discard pool (render)\n";
593 os << "\n";
594
595 for (const std::reference_wrapper<VKContext> &context : contexts_) {
596 os << " VKContext \n";
597 debug_print(os, context.get().discard_pool);
598 }
599
600 int total_mem_kb;
601 int free_mem_kb;
602 memory_statistics_get(&total_mem_kb, &free_mem_kb);
603 os << "\nMemory: total=" << total_mem_kb << ", free=" << free_mem_kb << "\n";
604}
605
607
608} // namespace blender::gpu
#define BLI_assert(a)
Definition BLI_assert.h:46
#define BLI_assert_msg(a, msg)
Definition BLI_assert.h:53
@ BLI_THREAD_QUEUE_WORK_PRIORITY_NORMAL
uint64_t BLI_thread_queue_push(ThreadQueue *queue, void *work, ThreadQueueWorkPriority priority)
Definition threads.cc:645
int BLI_thread_is_main(void)
Definition threads.cc:179
#define STREQ(a, b)
#define CLOG_DEBUG(clg_ref,...)
Definition CLG_log.h:191
GHOST C-API function and type declarations.
bool GPU_stencil_export_support()
GPUDeviceType
@ GPU_DEVICE_UNKNOWN
@ GPU_DEVICE_ATI
@ GPU_DEVICE_QUALCOMM
@ GPU_DEVICE_SOFTWARE
@ GPU_DEVICE_NVIDIA
@ GPU_DEVICE_APPLE
@ GPU_DEVICE_INTEL
GPUDriverType
@ GPU_DRIVER_ANY
@ GPU_DRIVER_OFFICIAL
@ GPU_DRIVER_OPENSOURCE
@ GPU_DRIVER_SOFTWARE
#define GPU_SHADER_FREE_SAFE(shader)
volatile int lock
BMesh const char void * data
static void capabilities_init(VKDevice &device)
static void platform_init(const VKDevice &device)
void update_immediately(const void *data) const
Definition vk_buffer.cc:123
VkBuffer vk_handle() const
Definition vk_buffer.hh:101
bool create(size_t size, VkBufferUsageFlags buffer_usage, VmaMemoryUsage vma_memory_usage, VmaAllocationCreateFlags vma_allocation_flags, float priority, bool export_memory=false)
Definition vk_buffer.cc:27
VKPipelinePool pipelines
Definition vk_device.hh:221
void init(void *ghost_context)
Definition vk_device.cc:118
render_graph::VKResourceStateTracker resources
Definition vk_device.hh:217
GPUDriverType driver_type() const
Definition vk_device.cc:385
VmaAllocator mem_allocator_get() const
Definition vk_device.hh:321
VkDevice vk_handle() const
Definition vk_device.hh:311
VKMemoryPools vma_pools
Definition vk_device.hh:257
bool supports_extension(const char *extension_name) const
Definition vk_device.cc:259
std::string vendor_name() const
Definition vk_device.cc:411
std::string driver_version() const
Definition vk_device.cc:438
std::string glsl_fragment_patch_get() const
Definition vk_device.cc:329
VKDiscardPool orphaned_data
Definition vk_device.hh:218
GPUDeviceType device_type() const
Definition vk_device.cc:353
VKThreadData & current_thread_data()
Definition vk_device.cc:461
void context_register(VKContext &context)
Definition vk_device.cc:477
bool is_initialized() const
Definition vk_device.hh:349
shader::GeneratedSource extensions_define(StringRefNull stage_define) const
Definition vk_device.cc:283
std::string glsl_vertex_patch_get() const
Definition vk_device.cc:315
void context_unregister(VKContext &context)
Definition vk_device.cc:482
void memory_statistics_get(int *r_total_mem_kb, int *r_free_mem_kb) const
Definition vk_device.cc:505
std::string glsl_geometry_patch_get() const
Definition vk_device.cc:322
std::string glsl_compute_patch_get() const
Definition vk_device.cc:336
Span< std::reference_wrapper< VKContext > > contexts_get() const
Definition vk_device.cc:500
struct blender::gpu::VKDevice::@152120360333013146246346216002113345357100126073 functions
VKDiscardPool orphaned_data_render
Definition vk_device.hh:220
VKThreadData(VKDevice &device, pthread_t thread_id)
Definition vk_device.cc:450
VKDescriptorPools descriptor_pools
Definition vk_device.hh:119
void init(VkInstance vk_instance)
Definition vk_debug.cc:162
ThreadMutex mutex
int count
#define LOG(level)
Definition log.h:97
void object_label(GLenum type, GLuint object, const char *name)
Definition gl_debug.cc:329
Vector< shader::GeneratedSource, 0 > GeneratedSourceList
constexpr int32_t PCI_ID_NVIDIA
Definition vk_device.cc:347
constexpr int32_t PCI_ID_INTEL
Definition vk_device.cc:348
static CLG_LogRef LOG
constexpr int32_t PCI_ID_ATI
Definition vk_device.cc:350
constexpr int32_t PCI_ID_AMD
Definition vk_device.cc:349
constexpr int32_t PCI_ID_APPLE
Definition vk_device.cc:351
MatBase< float, 4, 4 > float4x4
ParamHandle ** handles
#define LOAD_FUNCTION(name)