From 7843711ad25bf5b66762ea5f0a4e248a04892b59 Mon Sep 17 00:00:00 2001 From: Daniel Rakos Date: Tue, 16 Jun 2026 11:17:29 +0200 Subject: [PATCH] devsim: Enable basic settings --- devsim/CMakeLists.txt | 3 + ...kSCLayer_khronos_device_simulation.json.in | 89 ++++++++++++++++++- devsim/profiles_generated.cpp | 6 -- devsim/profiles_settings.cpp | 9 +- scripts/known_good.json | 1 - 5 files changed, 94 insertions(+), 14 deletions(-) diff --git a/devsim/CMakeLists.txt b/devsim/CMakeLists.txt index b4675f56..e31c7075 100644 --- a/devsim/CMakeLists.txt +++ b/devsim/CMakeLists.txt @@ -102,6 +102,9 @@ add_library(DevSimLayer MODULE) set_target_properties(DevSimLayer PROPERTIES FOLDER "Vulkan SC device simulation layer") set_target_properties(DevSimLayer PROPERTIES OUTPUT_NAME ${LAYER_NAME}) +# Force dynamic MSVC runtime +set_property(TARGET DevSimLayer PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") + if (MSVC) target_compile_options(DevSimLayer PRIVATE "$<$:/Zi>") target_link_options(DevSimLayer PRIVATE /DEF:${CMAKE_CURRENT_SOURCE_DIR}/${LAYER_NAME}.def) diff --git a/devsim/VkSCLayer_khronos_device_simulation.json.in b/devsim/VkSCLayer_khronos_device_simulation.json.in index 9b2fee65..bf580353 100644 --- a/devsim/VkSCLayer_khronos_device_simulation.json.in +++ b/devsim/VkSCLayer_khronos_device_simulation.json.in @@ -8,6 +8,93 @@ "implementation_version": "1.0.0", "status": "STABLE", "description": "Khronos Vulkan SC device simulation layer", - "introduction": "The Khronos device simulation layer helps test across a wide range of hardware capabilities without requiring a physical copy of every device." + "introduction": "The Khronos device simulation layer helps test across a wide range of hardware capabilities without requiring a physical copy of every device.", + "instance_extensions": [ + { + "name": "VK_EXT_layer_settings", + "spec_version": "2" + } + ], + "features": { + "settings": [ + { + "key": "simulate_capabilities", + "label": "Simulate Profile Capabilities", + "description": "Control of the simulated capabilities of the Vulkan SC physical device from the selected Vulkan SC Profile.", + "status": "STABLE", + "type": "FLAGS", + "flags": [ + { + "key": "SIMULATE_API_VERSION_BIT", + "label": "Version", + "description": "The Vulkan SC device will report the API version from the selected Profile. It also overrides the `api-version` set in VkPhysicalDeviceProperties." + }, + { + "key": "SIMULATE_FEATURES_BIT", + "label": "Features", + "description": "The Vulkan SC device will report the features from the selected Profile.", + "settings": [ + { + "key": "default_feature_values", + "label": "Unspecified Features", + "description": "Feature values when not specified in the select Vulkan SC profiles.", + "status": "STABLE", + "type": "ENUM", + "default": "DEFAULT_FEATURE_VALUES_DEVICE", + "flags": [ + { + "key": "DEFAULT_FEATURE_VALUES_DEVICE", + "label": "Use Device Values", + "description": "When a feature is not mentioned in the select Vulkan SC profiles, set is to the physical device value." + }, + { + "key": "DEFAULT_FEATURE_VALUES_FALSE", + "label": "Use False", + "description": "When a feature is not mentioned in the select Vulkan SC profiles, set it to false." + } + ] + }, + { + "key": "unknown_feature_values", + "label": "Unknown Features", + "description": "Feature values when unrecongnized by Vulkan SC profiles.", + "status": "STABLE", + "type": "ENUM", + "default": "UNKNOWN_FEATURE_VALUES_UNCHANGED", + "flags": [ + { + "key": "UNKNOWN_FEATURE_VALUES_UNCHANGED", + "label": "Unmodified", + "description": "When a feature is not recognized by Vulkan SC profiles, skip it." + }, + { + "key": "UNKNOWN_FEATURE_VALUES_DEVICE", + "label": "Use Device Values", + "description": "When a feature is not recognized by Vulkan SC profiles, attempt to load device values." + } + ] + } + ] + }, + { + "key": "SIMULATE_PROPERTIES_BIT", + "label": "Properties", + "description": "The Vulkan SC device will report the properties from the selected Profile." + }, + { + "key": "SIMULATE_EXTENSIONS_BIT", + "label": "Device Extensions", + "description": "The Vulkan SC device will report the extensions from the selected Profile." + }, + { + "key": "SIMULATE_FORMATS_BIT", + "label": "Formats", + "description": "The Vulkan SC device will report the formats from the selected Profile." + } + ], + "default": [ "SIMULATE_API_VERSION_BIT", "SIMULATE_FEATURES_BIT", "SIMULATE_PROPERTIES_BIT" ] + } + ] + } } } diff --git a/devsim/profiles_generated.cpp b/devsim/profiles_generated.cpp index baf597f9..745f3e84 100644 --- a/devsim/profiles_generated.cpp +++ b/devsim/profiles_generated.cpp @@ -1637,12 +1637,10 @@ const VkLayerProperties kLayerProperties[] = {{ }}; const uint32_t kLayerPropertiesCount = (sizeof(kLayerProperties) / sizeof(kLayerProperties[0])); -#ifndef VULKANSC // Instance extensions that this layer provides: const VkExtensionProperties kInstanceExtensionProperties[] = { VkExtensionProperties{VK_EXT_LAYER_SETTINGS_EXTENSION_NAME, VK_EXT_LAYER_SETTINGS_SPEC_VERSION}}; const uint32_t kInstanceExtensionPropertiesCount = static_cast(std::size(kInstanceExtensionProperties)); -#endif // Device extensions that this layer provides: #ifdef VULKANSC @@ -8222,11 +8220,7 @@ VKAPI_ATTR VkResult VKAPI_CALL EnumerateInstanceLayerProperties(uint32_t *pCount VKAPI_ATTR VkResult VKAPI_CALL EnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pCount, VkExtensionProperties *pProperties) { if (pLayerName && !strcmp(pLayerName, kLayerName)) { -#ifdef VULKANSC - return EnumerateProperties(0, (VkExtensionProperties*)nullptr, pCount, pProperties); -#else return EnumerateProperties(kInstanceExtensionPropertiesCount, kInstanceExtensionProperties, pCount, pProperties); -#endif } return VK_ERROR_LAYER_NOT_PRESENT; } diff --git a/devsim/profiles_settings.cpp b/devsim/profiles_settings.cpp index 6c10e6ca..22614c98 100644 --- a/devsim/profiles_settings.cpp +++ b/devsim/profiles_settings.cpp @@ -195,10 +195,7 @@ void InitProfilesLayerSettings(const VkInstanceCreateInfo *pCreateInfo, const Vk ProfileLayerSettings *layer_settings) { assert(layer_settings != nullptr); -#ifdef VULKANSC // We use a simplified configuration interface for Vulkan SC - (void)pCreateInfo; - (void)pAllocator; - +#ifdef VULKANSC // We provide a simplified configuration interface for Vulkan SC const char *devsim_profile_file = std::getenv("VKSC_DEVSIM_PROFILE_FILE"); if (devsim_profile_file) { @@ -213,7 +210,8 @@ void InitProfilesLayerSettings(const VkInstanceCreateInfo *pCreateInfo, const Vk layer_settings->simulate.emulate_portability = false; layer_settings->log.debug_reports = DEBUG_REPORT_ERROR_BIT; } -#else +#endif // VULKANSC + const VkLayerSettingsCreateInfoEXT *create_info = vkuFindLayerSettingsCreateInfo(pCreateInfo); VkuLayerSettingSet layerSettingSet = VK_NULL_HANDLE; @@ -519,5 +517,4 @@ void InitProfilesLayerSettings(const VkInstanceCreateInfo *pCreateInfo, const Vk LogMessage(layer_settings, DEBUG_REPORT_NOTIFICATION_BIT, "Profile Layers Settings: {\n%s}\n", settings_log.c_str()); vkuDestroyLayerSettingSet(layerSettingSet, pAllocator); -#endif // VULKANSC } diff --git a/scripts/known_good.json b/scripts/known_good.json index 86f9a675..93c765a7 100644 --- a/scripts/known_good.json +++ b/scripts/known_good.json @@ -87,7 +87,6 @@ "-DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF", "-DJSONCPP_WITH_WARNING_AS_ERROR=OFF", "-DJSONCPP_WITH_PKGCONFIG_SUPPORT=OFF", - "-DJSONCPP_STATIC_WINDOWS_RUNTIME=ON", "-DBUILD_SHARED_LIBS=OFF", "-DBUILD_STATIC_LIBS=ON", "-DBUILD_OBJECT_LIBS=OFF"