-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
layer: Add minimum setting reflection
- Loading branch information
1 parent
79d5fb1
commit 117bb9a
Showing
8 changed files
with
102 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2023 The Khronos Group Inc. | ||
// Copyright 2023 Valve Corporation | ||
// Copyright 2023 LunarG, Inc. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
// Author(s): | ||
// - Christophe Riccio <[email protected]> | ||
|
||
#include "vulkan/layer/vk_layer_settings_ext.h" | ||
#include <cassert> | ||
#include <cstring> | ||
#include <string> | ||
#include <unordered_map> | ||
|
||
#if defined(__GNUC__) && __GNUC__ >= 4 | ||
#define LAYER_EXPORT __attribute__((visibility("default"))) | ||
#else | ||
#define LAYER_EXPORT | ||
#endif | ||
|
||
extern std::unordered_map<std::string, std::pair<uint32_t, VkLayerSettingPropertiesEXT*> > layer_settings_properties; | ||
|
||
// Keep synchronized with VkLayer_khronos_profiles.def / VkLayer_khronos_profiles.map | ||
extern "C" { | ||
|
||
LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerSettingsEXT( | ||
const char* pLayerName, uint32_t* pPropertyCount, VkLayerSettingPropertiesEXT* pProperties) { | ||
|
||
assert(pPropertyCount != nullptr); | ||
|
||
if (*pPropertyCount > 0 && pProperties != nullptr) { | ||
*pPropertyCount = std::min(*pPropertyCount, layer_settings_properties[pLayerName].first); | ||
memcpy(pProperties, layer_settings_properties[pLayerName].second, sizeof(VkLayerSettingPropertiesEXT) * *pPropertyCount); | ||
} else { | ||
*pPropertyCount = layer_settings_properties[pLayerName].first; | ||
} | ||
|
||
return VK_SUCCESS; | ||
} | ||
|
||
} // extern "C" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters