Vulkan: Show supported device extensions in system-info output #128658

Merged
Jeroen Bakker merged 1 commits from Lalit-Shankar-Chowdhury/blender:show-vulkan-extensions into main 2024-11-14 13:15:29 +01:00

When --gpu-backend is Vulkan, the system info output is like this:

Screenshot 2024-10-06 130136.png

The PR fixes this to show Vulkan extensions supported by the device instead of OpenGL ones.

Screenshot 2024-10-06 125939.png

When `--gpu-backend` is Vulkan, the system info output is like this: ![Screenshot 2024-10-06 130136.png](/attachments/90f6aedd-30a2-4f2f-bc28-71fd8ff40a11) The PR fixes this to show Vulkan extensions supported by the device instead of OpenGL ones. ![Screenshot 2024-10-06 125939.png](/attachments/8097f63b-42b9-4f0d-b59d-e129264953b3)
Lalit Shankar Chowdhury added 1 commit 2024-10-06 10:13:08 +02:00
Iliya Katushenock added this to the Viewport & EEVEE project 2024-10-06 12:51:23 +02:00
Iliya Katushenock added the
Interest
Triaging
label 2024-10-06 12:51:36 +02:00
Jeroen Bakker requested changes 2024-10-11 16:01:59 +02:00
Dismissed
Jeroen Bakker left a comment
Member

Nice that you wanted to work on this. There is quite a lot in place already, which we should reuse.

Nice that you wanted to work on this. There is quite a lot in place already, which we should reuse.
@ -38,6 +38,13 @@ static CLG_LogRef LOG = {"gpu.vulkan"};
namespace blender::gpu {
static Vector<std::string> vk_extension_list;
Member

This is already stored in VKDevice::device_extensions_ Just access it from here.
VKBackend::get().device.extension_name_get()
VKBackend::capabilities_init would be a better place to set the GCaps function pointer.

This is already stored in `VKDevice::device_extensions_` Just access it from here. `VKBackend::get().device.extension_name_get()` `VKBackend::capabilities_init` would be a better place to set the GCaps function pointer.
Lalit-Shankar-Chowdhury marked this conversation as resolved
@ -41,0 +42,4 @@
static const char *vk_extension_get(int i)
{
return vk_extension_list[i].c_str();
Member

This could lead to an out of bounds read when i is outside the number of elements stored in the list.

This could lead to an out of bounds read when i is outside the number of elements stored in the list.
Lalit-Shankar-Chowdhury marked this conversation as resolved
@ -41,1 +45,4 @@
return vk_extension_list[i].c_str();
}
static Vector<StringRefNull> missing_capabilities_get(VkPhysicalDevice vk_physical_device)
Member

This function is called from multiple places and might not work when using multiple devices. Better just access the extensions from the device being used.

This function is called from multiple places and might not work when using multiple devices. Better just access the extensions from the device being used.
Lalit-Shankar-Chowdhury marked this conversation as resolved
Jeroen Bakker added the
Module
Viewport & EEVEE
Interest
Vulkan
labels 2024-10-11 16:02:29 +02:00
Jeroen Bakker added this to the 4.4 milestone 2024-10-11 16:02:47 +02:00
Lalit Shankar Chowdhury force-pushed show-vulkan-extensions from 0db3fbb4c0 to 42f93a8851 2024-11-10 19:05:23 +01:00 Compare
Lalit Shankar Chowdhury requested review from Jeroen Bakker 2024-11-10 19:06:30 +01:00
Jeroen Bakker requested changes 2024-11-11 08:03:46 +01:00
Dismissed
@ -39,6 +39,11 @@ static CLG_LogRef LOG = {"gpu.vulkan"};
namespace blender::gpu {
static const char *KNOWN_CRASHING_DRIVER = "unstable driver";
static const char *vk_extension_get(int i)
Member

use a better name than i just use index in this case

use a better name than `i` just use `index` in this case
Lalit-Shankar-Chowdhury marked this conversation as resolved
@ -191,6 +191,11 @@ class VKDevice : public NonCopyable {
PFN_vkDestroyDebugUtilsMessengerEXT vkDestroyDebugUtilsMessenger = nullptr;
} functions;
const char* extension_name_get(int i) const
Member

No need to create a function for this. Just combine with vk_extension_get

No need to create a function for this. Just combine with vk_extension_get
Author
Contributor

device_extensions_ is a private member of VKDevice hence the getter.

`device_extensions_` is a private member of `VKDevice` hence the getter.
Jeroen-Bakker marked this conversation as resolved
@ -193,1 +193,4 @@
const char* extension_name_get(int i) const
{
return (i >= 0 && i < device_extensions_.size()) ? device_extensions_[i].extensionName : "INVALID_EXTENSION_INDEX";
Member

device_extensions_ is an Array no need to add bound checks.

This is different than previous implementation where there were no bounds check at all.

device_extensions_ is an Array no need to add bound checks. This is different than previous implementation where there were no bounds check at all.
Lalit-Shankar-Chowdhury marked this conversation as resolved
Member

Almost there. Just some small adjustments.

I didn't noticed the extension_len during the previous review what lead to an incorrect advice from my side.

Almost there. Just some small adjustments. I didn't noticed the extension_len during the previous review what lead to an incorrect advice from my side.
Lalit Shankar Chowdhury force-pushed show-vulkan-extensions from 42f93a8851 to 842ee19603 2024-11-11 12:57:16 +01:00 Compare
Lalit Shankar Chowdhury force-pushed show-vulkan-extensions from 842ee19603 to 8ecce332a7 2024-11-11 12:58:45 +01:00 Compare
Lalit Shankar Chowdhury requested review from Jeroen Bakker 2024-11-11 13:02:30 +01:00
Member

@blender-bot build

@blender-bot build
Jeroen Bakker requested changes 2024-11-12 08:37:06 +01:00
Dismissed
Jeroen Bakker left a comment
Member

Just run make(.bat) format in where you checked out Blender to ensure our code style.

Just run `make(.bat) format` in where you checked out Blender to ensure our code style.
@ -555,2 +560,4 @@
GCaps.mem_stats_support = true;
uint32_t vk_extension_count;
vkEnumerateDeviceExtensionProperties(device.physical_device_get(), nullptr, &vk_extension_count, nullptr);
Member

Code style is incorrect.

Please run make format before committing to ensure the correct code style is applied.

diff --git a/source/blender/gpu/vulkan/vk_backend.cc b/source/blender/gpu/vulkan/vk_backend.cc
index b97d13933de..3b8227203eb 100644
--- a/source/blender/gpu/vulkan/vk_backend.cc
+++ b/source/blender/gpu/vulkan/vk_backend.cc
@@ -560,7 +560,8 @@ void VKBackend::capabilities_init(VKDevice &device)
   GCaps.mem_stats_support = true;
 
   uint32_t vk_extension_count;
-  vkEnumerateDeviceExtensionProperties(device.physical_device_get(), nullptr, &vk_extension_count, nullptr);
+  vkEnumerateDeviceExtensionProperties(
+      device.physical_device_get(), nullptr, &vk_extension_count, nullptr);
   GCaps.extensions_len = vk_extension_count;
   GCaps.extension_get = vk_extension_get;
Code style is incorrect. Please run `make format` before committing to ensure the correct code style is applied. ```diff diff --git a/source/blender/gpu/vulkan/vk_backend.cc b/source/blender/gpu/vulkan/vk_backend.cc index b97d13933de..3b8227203eb 100644 --- a/source/blender/gpu/vulkan/vk_backend.cc +++ b/source/blender/gpu/vulkan/vk_backend.cc @@ -560,7 +560,8 @@ void VKBackend::capabilities_init(VKDevice &device) GCaps.mem_stats_support = true; uint32_t vk_extension_count; - vkEnumerateDeviceExtensionProperties(device.physical_device_get(), nullptr, &vk_extension_count, nullptr); + vkEnumerateDeviceExtensionProperties( + device.physical_device_get(), nullptr, &vk_extension_count, nullptr); GCaps.extensions_len = vk_extension_count; GCaps.extension_get = vk_extension_get; ```
Lalit-Shankar-Chowdhury marked this conversation as resolved
@ -192,2 +192,4 @@
} functions;
const char* extension_name_get(int index) const
{
Member

Code style

diff --git a/source/blender/gpu/vulkan/vk_device.hh b/source/blender/gpu/vulkan/vk_device.hh
index 3e0f09cd91b..bc3535da3c4 100644
--- a/source/blender/gpu/vulkan/vk_device.hh
+++ b/source/blender/gpu/vulkan/vk_device.hh
@@ -191,7 +191,7 @@ class VKDevice : public NonCopyable {
     PFN_vkDestroyDebugUtilsMessengerEXT vkDestroyDebugUtilsMessenger = nullptr;
   } functions;
 
-  const char* extension_name_get(int index) const
+  const char *extension_name_get(int index) const
   {
     return device_extensions_[index].extensionName;
   }
Code style ```diff diff --git a/source/blender/gpu/vulkan/vk_device.hh b/source/blender/gpu/vulkan/vk_device.hh index 3e0f09cd91b..bc3535da3c4 100644 --- a/source/blender/gpu/vulkan/vk_device.hh +++ b/source/blender/gpu/vulkan/vk_device.hh @@ -191,7 +191,7 @@ class VKDevice : public NonCopyable { PFN_vkDestroyDebugUtilsMessengerEXT vkDestroyDebugUtilsMessenger = nullptr; } functions; - const char* extension_name_get(int index) const + const char *extension_name_get(int index) const { return device_extensions_[index].extensionName; } ```
Lalit-Shankar-Chowdhury marked this conversation as resolved
Lalit Shankar Chowdhury force-pushed show-vulkan-extensions from 8ecce332a7 to 4b167f0bd1 2024-11-12 15:18:43 +01:00 Compare
Author
Contributor

@blender-bot build

@blender-bot build
Member

Only blender organization members with write access can start builds. See documentation for details.

Only blender organization members with write access can start builds. See [documentation](https://projects.blender.org/infrastructure/blender-bot/src/branch/main/README.md) for details.
Lalit Shankar Chowdhury requested review from Jeroen Bakker 2024-11-12 15:22:35 +01:00
Member

@blender-bot build

@blender-bot build
Jeroen Bakker approved these changes 2024-11-14 11:59:19 +01:00
Member

Thanks for the PR. I will commit it and check later if we clean it up (moving fully inside VKDevice)

Thanks for the PR. I will commit it and check later if we clean it up (moving fully inside VKDevice)
Jeroen Bakker merged commit 6e49acb655 into main 2024-11-14 13:15:29 +01:00
Lalit Shankar Chowdhury deleted branch show-vulkan-extensions 2024-11-14 18:48:34 +01:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#128658
No description provided.