Skip to content

Commit 8bb89ab

Browse files
committed
Make dispatch optimization configurable
1 parent a89e926 commit 8bb89ab

File tree

7 files changed

+35
-16
lines changed

7 files changed

+35
-16
lines changed

generator/vk_codegen/root_CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ project({PROJECT_NAME} VERSION 1.0.0)
3030

3131
# Common configuration
3232
set(LGL_LOG_TAG "{LAYER_NAME}")
33-
set(LGL_CONFIG_TRACE 0)
34-
set(LGL_CONFIG_LOG 1)
33+
34+
option(LGL_CONFIG_TRACE "Enable Vulkan entrypoint logging")
35+
option(LGL_CONFIG_OPTIMIZE_DISPATCH "Enable Vulkan entrypoint dispatch optimization" ON)
36+
option(LGL_CONFIG_LOG "Enable general layer logging" ON)
3537

3638
include(../source_common/compiler_helper.cmake)
3739
include(../cmake/clang-tools.cmake)

layer_example/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ project(VkLayerExample VERSION 1.0.0)
3030

3131
# Common configuration
3232
set(LGL_LOG_TAG "VkLayerExample")
33-
set(LGL_CONFIG_TRACE 0)
34-
set(LGL_CONFIG_LOG 1)
33+
34+
option(LGL_CONFIG_TRACE "Enable Vulkan entrypoint logging")
35+
option(LGL_CONFIG_OPTIMIZE_DISPATCH "Enable Vulkan entrypoint dispatch optimization" ON)
36+
option(LGL_CONFIG_LOG "Enable general layer logging" ON)
37+
3538

3639
include(../source_common/compiler_helper.cmake)
3740
include(../cmake/clang-tools.cmake)

layer_gpu_profile/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ project(VkLayerGPUProfile VERSION 1.0.0)
3030

3131
# Common configuration
3232
set(LGL_LOG_TAG "VkLayerGPUProfile")
33-
set(LGL_CONFIG_TRACE 0)
34-
set(LGL_CONFIG_LOG 1)
33+
34+
option(LGL_CONFIG_TRACE "Enable Vulkan entrypoint logging")
35+
option(LGL_CONFIG_OPTIMIZE_DISPATCH "Enable Vulkan entrypoint dispatch optimization" ON)
36+
option(LGL_CONFIG_LOG "Enable general layer logging" ON)
3537

3638
include(../source_common/compiler_helper.cmake)
3739
include(../cmake/clang-tools.cmake)

layer_gpu_support/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ project(VkLayerGPUSupport VERSION 1.0.0)
3030

3131
# Common configuration
3232
set(LGL_LOG_TAG "VkLayerGPUSupport")
33-
set(LGL_CONFIG_TRACE 0)
34-
set(LGL_CONFIG_LOG 1)
33+
34+
option(LGL_CONFIG_TRACE "Enable Vulkan entrypoint logging")
35+
option(LGL_CONFIG_OPTIMIZE_DISPATCH "Enable Vulkan entrypoint dispatch optimization" ON)
36+
option(LGL_CONFIG_LOG "Enable general layer logging" ON)
3537

3638
include(../source_common/compiler_helper.cmake)
3739
include(../cmake/clang-tools.cmake)

layer_gpu_timeline/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ project(VkLayerGPUTimeline VERSION 1.0.0)
3030

3131
# Common configuration
3232
set(LGL_LOG_TAG "VkLayerGPUTimeline")
33-
set(LGL_CONFIG_TRACE 0)
34-
set(LGL_CONFIG_LOG 1)
33+
34+
option(LGL_CONFIG_TRACE "Enable Vulkan entrypoint logging")
35+
option(LGL_CONFIG_OPTIMIZE_DISPATCH "Enable Vulkan entrypoint dispatch optimization" ON)
36+
option(LGL_CONFIG_LOG "Enable general layer logging" ON)
3537

3638
include(../source_common/compiler_helper.cmake)
3739
include(../cmake/clang-tools.cmake)

source_common/compiler_helper.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ macro(lgl_set_build_options BUILD_TARGET_NAME)
7272
${BUILD_TARGET_NAME} PRIVATE
7373
$<$<PLATFORM_ID:Android>:VK_USE_PLATFORM_ANDROID_KHR=1>
7474
$<$<PLATFORM_ID:Android>:LGL_LOG_TAG="${LGL_LOG_TAG}">
75-
CONFIG_TRACE=${LGL_CONFIG_TRACE}
76-
CONFIG_LOG=${LGL_CONFIG_LOG})
75+
CONFIG_TRACE=$<BOOL:${LGL_CONFIG_TRACE}>
76+
CONFIG_LOG=$<BOOL:${LGL_CONFIG_LOG}>
77+
CONFIG_OPTIMIZE_DISPATCH=$<BOOL:${LGL_CONFIG_OPTIMIZE_DISPATCH}>)
78+
7779
endmacro()

source_common/framework/manual_functions.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -540,9 +540,12 @@ PFN_vkVoidFunction layer_vkGetInstanceProcAddr_default(VkInstance instance, cons
540540
bool exportLayerFunction { layerFunction != nullptr };
541541

542542
// Function is not exported because layer doesn't specialize a user_tag version
543-
if (!isFunctionAlwaysExported(pName) && layerFunction == layerDefaultFunction)
543+
if constexpr(CONFIG_OPTIMIZE_DISPATCH)
544544
{
545-
exportLayerFunction = false;
545+
if (!isFunctionAlwaysExported(pName) && layerFunction == layerDefaultFunction)
546+
{
547+
exportLayerFunction = false;
548+
}
546549
}
547550

548551
// For other functions, only expose functions that the driver exposes to
@@ -586,9 +589,12 @@ PFN_vkVoidFunction layer_vkGetDeviceProcAddr_default(VkDevice device, const char
586589
bool exportLayerFunction { layerFunction != nullptr };
587590

588591
// Function is not exported because layer doesn't specialize a user_tag version
589-
if (!isFunctionAlwaysExported(pName) && layerFunction == layerDefaultFunction)
592+
if constexpr(CONFIG_OPTIMIZE_DISPATCH)
590593
{
591-
exportLayerFunction = false;
594+
if (!isFunctionAlwaysExported(pName) && layerFunction == layerDefaultFunction)
595+
{
596+
exportLayerFunction = false;
597+
}
592598
}
593599

594600
// If driver exposes it and the layer has one, use the layer function

0 commit comments

Comments
 (0)