Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 796662

Summary: media-libs/vulkan-layers-1.2.179 reports that it is in debug mode
Product: Gentoo Linux Reporter: ashpil <ashpil>
Component: Current packagesAssignee: Nick Sarnie <sarnex>
Status: RESOLVED FIXED    
Severity: normal CC: sam, sarnex
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://archives.gentoo.org/gentoo-dev/message/bc32af2490406f68f3e5cfd34c503e02
See Also: https://bugs.gentoo.org/show_bug.cgi?id=822249
https://bugs.gentoo.org/show_bug.cgi?id=884791
Whiteboard:
Package list:
Runtime testing required: ---

Description ashpil@pm.me 2021-06-19 02:35:10 UTC
When developing using Vulkan, I can instruct it to let me know of any potential performance issues. This is the one thing that appears in my log:
```
Validation Performance Warning: [ UNASSIGNED-khronos-Validation-debug-build-warning-message ] Object 0: handle = 0x37fec0, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0x26ac7233 | VALIDATION LAYERS WARNING: Using debug builds of the validation layers *will* adversely affect performance.
```
This indicates that `vulkan-layers` is either in debug mode, or it thinks that it is. I suspect then the same happens with `vulkan-tools` and `vulkan-loader` as well, even though there's no message. 

Reproducible: Always

Steps to Reproduce:
1. Run a Vulkan application that utilizes the `VK_EXT_debug_utils` extension, and debugs instance creation. This can be achieved by following `vulkan-tutorial.com` up to the end of this stage: https://vulkan-tutorial.com/Drawing_a_triangle/Setup/Validation_layers (code at bottom)
2. Look at console
Actual Results:  
Get a warning informing me `vulkan-layers` is in debug mode

Expected Results:  
No such warning

The severity of this bug greatly depends on whether it is actually debug, or it just thinks it is debug.

According to the `vulkan-layers` `BUILD.md`, by default, it decides its build is debug.
Comment 1 Nick Sarnie gentoo-dev 2021-08-06 21:17:18 UTC
The warning is thrown when the target application is compiled in debug, not layers. You can fix this by defining NDEBUG when compiling.
Comment 2 ashpil@pm.me 2021-08-07 14:24:23 UTC
Well, no. When running the same application with validation layer binaries provided by LunarG, this warning does not appear. 

See here in their source, a file that is compiled when the `vulkan-layers` package is installed in Gentoo: https://github.com/KhronosGroup/Vulkan-ValidationLayers/blob/22e2b2784b04eed6f503e4f127e1d6a62d154397/scripts/layer_chassis_generator.py#L816

Furthermore, compiling the target application in release mode does not remove the warning.
Comment 3 Nick Sarnie gentoo-dev 2021-08-07 15:00:21 UTC
Sorry, you're right. The ebuild was doing the wrong thing to set NDEBUG. While you can fix this by compiling the target application with NDEBUG, obviously the ebuild should set it too
Comment 4 Larry the Git Cow gentoo-dev 2021-08-07 15:04:12 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d52e6e589ebd7b0f5abc4b700c95a99b67a32776

commit d52e6e589ebd7b0f5abc4b700c95a99b67a32776
Author:     Nick Sarnie <sarnex@gentoo.org>
AuthorDate: 2021-08-07 15:01:48 +0000
Commit:     Nick Sarnie <sarnex@gentoo.org>
CommitDate: 2021-08-07 15:03:58 +0000

    media-libs/vulkan-layers: Make sure NDEBUG is set
    
    Closes: https://bugs.gentoo.org/796662
    Package-Manager: Portage-3.0.20, Repoman-3.0.3
    Signed-off-by: Nick Sarnie <sarnex@gentoo.org>

 .../vulkan-layers/vulkan-layers-1.2.182-r1.ebuild  | 60 ++++++++++++++++++++++
 .../vulkan-layers/vulkan-layers-1.2.182.ebuildu    | 57 ++++++++++++++++++++
 media-libs/vulkan-layers/vulkan-layers-9999.ebuild | 13 +++--
 3 files changed, 126 insertions(+), 4 deletions(-)
Comment 5 ashpil@pm.me 2021-08-07 16:08:31 UTC
Might be worth investigating whether the same issue occurs with `vulkan-tools` and `vulkan-loader`, but they just lack an avenue to report it.
Comment 6 Larry the Git Cow gentoo-dev 2021-08-07 19:37:14 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=296a7e3ebc72720e8bf385b2a2508b099245df44

commit 296a7e3ebc72720e8bf385b2a2508b099245df44
Author:     Nick Sarnie <sarnex@gentoo.org>
AuthorDate: 2021-08-07 19:35:35 +0000
Commit:     Nick Sarnie <sarnex@gentoo.org>
CommitDate: 2021-08-07 19:36:26 +0000

    dev-util/vulkan-tools: Make sure NDEBUG is set
    
    Bug: https://bugs.gentoo.org/796662
    Package-Manager: Portage-3.0.20, Repoman-3.0.3
    Signed-off-by: Nick Sarnie <sarnex@gentoo.org>

 .../vulkan-tools/vulkan-tools-1.2.182-r1.ebuild    | 86 ++++++++++++++++++++++
 dev-util/vulkan-tools/vulkan-tools-9999.ebuild     | 15 ++--
 2 files changed, 96 insertions(+), 5 deletions(-)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f417aa0799113b639784eb3e7409e66da76e582f

commit f417aa0799113b639784eb3e7409e66da76e582f
Author:     Nick Sarnie <sarnex@gentoo.org>
AuthorDate: 2021-08-07 19:32:31 +0000
Commit:     Nick Sarnie <sarnex@gentoo.org>
CommitDate: 2021-08-07 19:36:22 +0000

    media-libs/vulkan-loader: Make sure NDEBUG is set
    
    Bug: https://bugs.gentoo.org/796662
    Package-Manager: Portage-3.0.20, Repoman-3.0.3
    Signed-off-by: Nick Sarnie <sarnex@gentoo.org>

 .../vulkan-loader/vulkan-loader-1.2.182-r1.ebuild  | 70 ++++++++++++++++++++++
 media-libs/vulkan-loader/vulkan-loader-9999.ebuild | 15 +++--
 2 files changed, 80 insertions(+), 5 deletions(-)
Comment 7 Andreas Sturmlechner gentoo-dev 2021-11-07 08:15:17 UTC
The chosen fix to this was suboptimal.