diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7ccef46f81f22bbc27289ceaf99152d982e65c94..646f5cde6f3c81b736fd6ff4d60285476235d353 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ~~~
-cmake_minimum_required(VERSION 3.17.2)
+cmake_minimum_required(VERSION 3.16.5)
project(VVL LANGUAGES CXX)
@@ -36,7 +36,9 @@ include(GNUInstallDirs)
set_property(GLOBAL PROPERTY USE_FOLDERS ON) # Remove when min is 3.26, see CMP0143
add_compile_definitions(VK_ENABLE_BETA_EXTENSIONS)
-if(WIN32)
+if(OHOS)
+ add_compile_definitions(VK_USE_PLATFORM_OHOS)
+elseif(WIN32)
add_compile_definitions(VK_USE_PLATFORM_WIN32_KHR)
# Allow usage of unsafe CRT functions and minimize what Windows.h leaks
diff --git a/OAT.xml b/OAT.xml
index 6ac6eb7bc0dd30c480c2d06f9e769cf27707f75e..3e34271f6d23ce49b38571f15543afcc6b75527b 100644
--- a/OAT.xml
+++ b/OAT.xml
@@ -22,7 +22,9 @@
LICENSE.txt
-
+
+
+
diff --git a/README_OpenHarmony.md b/README_OpenHarmony.md
index c7763a982b06e9eee70af791277aebe371bf0229..44d0ba694d0f19f216b017bd8019c08ea5a2230f 100644
--- a/README_OpenHarmony.md
+++ b/README_OpenHarmony.md
@@ -2,68 +2,188 @@
本仓库包含开源软件Vulkan-ValidationLayers,为OpenHarmony提供了Vulkan验证层,Vulkan验证层可以在应用程序开发期间为开发者提供一些错误检查,帮助开发者正确使用Vulkan API。Vulkan-ValidationLayers的功能请参考[Vulkan-ValidationLayers](docs/khronos_validation_layer.md)
-## Vulkan-ValidationLayers的实现方式
+## Vulkan-ValidationLayers在系统中的位置
Vulkan-ValidationLayers被实现为一个Vulkan Layer,由Vulkan-Loader加载并使用,Vulkan-Loader的功能请参考[Vulkan-Loader](https://gitee.com/openharmony/third_party_vulkan-loader/blob/master/README_OpenHarmony.md)。

-## Vulkan-Loader加载验证层的方式
+## Vulkan-ValidationLayers的使用方式
-### 系统侧
-Vulkan-ValidationLayers在系统目录下会提供一个json配置文件`VkLayer_khronos_validation.json`和一个so文件`libVkLayer_khronos_validation.so`。
+本项目提供一个json配置文件`VkLayer_khronos_validation.json`和一个动态连接库二进制文件`libVkLayer_khronos_validation.so`。
[Vulkan-Loader](https://gitee.com/openharmony/third_party_vulkan-loader/blob/master/README_OpenHarmony.md)会扫描指定目录下的json配置文件,解析出so的位置并加载对应的so文件。

-### 应用侧
+### 系统应用
+
+系统应用采用隐式层(implicity layer)默认加载的方式
+
+```
+ hdc target mount #root模式下,开启权限
+ hdc shell mkdir /system/etc/vulkan/implicity.d/ #为隐式层创建文件夹
+ hdc file push VkLayer_khronos_validation.json /system/etc/vulkan/implicity.d/ #推送json文件到隐式层下
+ hdc file push libVkLayer_khronos_validation.so /system/lib{64}
+ hdc shell reboot #重启设备
+```
+### 三方应用
+
`在调试过程中开启ValidationLayers, 正式版本请不要开启。`
-开启ValidationLayers的示例代码如下
+#### 隐式层方式
+
+##### 1. json文件中指定so的位置
+
+将[VkLayer_khronos_validation.json](scripts/ohos-patches/VkLayer_khronos_validation.json)中的`library_path`修改为`/data/storage/el1/bundle/lib/arm64/libVkLayer_khronos_validation.so`
+
+
+
+
+
+##### 2. 将json文件打包到hap中
+
+
+
+工程中路径:{your_project}\entry\src\main\resources\rawfile\VkLayer_khronos_validation.json
+
+hdc开发视角下json文件的路径:/data/app/el2/100/base/{your_pakage_name}/file/VkLayer_khronos_validation.json
+
+[应用视角](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/file-management/send-file-to-app-sandbox.md#%E5%88%87%E6%8D%A2%E5%BA%94%E7%94%A8%E6%B2%99%E7%AE%B1%E8%A7%86%E8%A7%92)下json文件的路径:/data/storage/el2/base/haps/entry/files/VkLayer_khronos_validation.json
+##### 3. 将so文件打包到hap中
+
+
+
+工程中路径:{your_project}\entry\libs\arm64-v8a\libVkLayer_khronos_validation.so
+
+hdc开发视角下so文件的路径:/data/app/el1/bundle/public/{your_pakage_name}/libs/arm64/libVkLayer_khronos_validation.so
+
+[应用视角](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/file-management/send-file-to-app-sandbox.md#%E5%88%87%E6%8D%A2%E5%BA%94%E7%94%A8%E6%B2%99%E7%AE%B1%E8%A7%86%E8%A7%92)下json文件的路径:/data/storage/el1/bundle/libs/arm64/libVkLayer_khronos_validation.so
+
+应用视角下的so的路径与json文件中描述的路径一致
+
+##### 4. 运行前设置环境变量
+
+开启layer: 需要`同时`设置两个参数
+
+```
+ hdc shell param set debug.graphic.debug_layer VkLayer_khronos_validation #与json文件的名字一致
+ hdc shell param set debug.graphic.debug_hap {your_pakage_name} #包名
```
- // Check if this layer is available at instance level
- const char* validationLayerName = "VK_LAYER_KHRONOS_validation";
- uint32_t instanceLayerCount;
- vkEnumerateInstanceLayerProperties(&instanceLayerCount, nullptr);
- std::vector instanceLayerProperties(instanceLayerCount);
- vkEnumerateInstanceLayerProperties(&instanceLayerCount, instanceLayerProperties.data());
- bool validationLayerPresent = false;
- for (VkLayerProperties layer : instanceLayerProperties) {
- if (strcmp(layer.layerName, validationLayerName) == 0) {
- validationLayerPresent = true;
- break;
- }
- }
- if (validationLayerPresent) {
- instanceCreateInfo.ppEnabledLayerNames = &validationLayerName;
- instanceCreateInfo.enabledLayerCount = 1;
- } else {
- std::cerr << "Validation layer VK_LAYER_KHRONOS_validation not present, validation is disabled";
- }
-
- VkResult result = vkCreateInstance(&instanceCreateInfo, nullptr, &instance);
+
+关闭layer: 将两个变量设置成空字符
+
```
+ hdc shell param set debug.graphic.debug_layer ''
+ hdc shell param set debug.graphic.debug_hap ''
+```
+
+
## 构建指导
-适配OpenHarmony平台的编译脚本请见:[build-openharmony/BUILD.gn](build-openharmony/BUILD.gn)
+适配OpenHarmony平台的编译脚本请参考:[compile.bat](scripts/ohos-patches/compile.bat)
-由于graphic_2d模块的编译脚本中包含了Vulkan-ValidationLayers(详见:[bundle.json](https://gitee.com/openharmony/graphic_graphic_2d/blob/master/bundle.json)),所以编译graphic_2d模块可以将Vulkan-ValidationLayers同时编译出来,以rk3568平台为例,编译命令:
+### 环境要求
-```shell
-./build.sh --product-name rk3568 --ccache --build-target graphic_2d
+- Windows 10+
+- Python 3.11+
+- OpenHarmony SDK
+
+### 编译步骤
+
+##### 1. 下载源码到`VVL_DIR`
+
+[third_party_vulkan-validationlayers](https://gitee.com/openharmony-sig/third_party_vulkan-validationlayers)
+
+##### 2. 下载OpenHarmony SDK到`OHOS_SDK`
+
+可使用DevEco Studio NEXT Developer [下载](https://developer.huawei.com/consumer/cn/download/ )
+
+##### 3. 配置cmd环境变量
+
+e.g.:
+```
+ set OHOS_SDK=C:/Users/Administrator/AppData/Local/OpenHarmony/Sdk/12/native
+ set VVL_DIR=E:/WorkSpace/Vulkan/VVL/third_party_vulkan-validationlayers
+ set BUILD_THREADS=8
+ set buildDir=%VVL_DIR%/build-ohos/intermediate
+ set libDir=%VVL_DIR%/build-ohos/libs
+ set PATH=%OHOS_SDK%/build-tools/cmake/bin;%PATH%
```
-也可以单独编译Vulkan-ValidationLayers:
+##### 4. 下载依赖仓并打补丁
-```shell
-./build.sh --product-name rk3568 --ccache --build-target VkLayer_khronos_validation
+使用下述命令下载依赖仓
+
+```
+ cd /d %VVL_DIR%
+
+ cmake -S . ^
+ -B %buildDir% ^
+ -G Ninja ^
+ -D OHOS_STL=c++_static ^
+ -D CMAKE_INSTALL_LIBDIR=%libDir% ^
+ -D CMAKE_TOOLCHAIN_FILE=%OHOS_SDK%/build/cmake/ohos.toolchain.cmake ^
+ -D CMAKE_BUILD_TYPE=Release ^
+ -D VVL_CODEGEN=OFF ^
+ -D UPDATE_DEPS=ON ^
+ -D UPDATE_DEPS_DIR=%buildDir%
```
-编译完成后会在`out/rk3568/graphic/graphic_2d`目录下生成`libVkLayer_khronos_validation.so`
+将[patches](scripts/ohos-patches)逐一应用到对应的依赖仓中
+
+e.g.:
+```
+ cd build-ohos\intermediate\Vulkan-Headers
+ git apply Vulkan-Headers.patch
+```
+
+
+
+##### 5. 编译得到so文件
+
+so生成位置:build-ohos\libs
+
+```
+ cmake ^
+ -S . ^
+ -B %buildDir% ^
+ -G Ninja ^
+ -D OHOS_STL=c++_static ^
+ -D CMAKE_INSTALL_LIBDIR=%libDir% ^
+ -D CMAKE_TOOLCHAIN_FILE=%OHOS_SDK%/build/cmake/ohos.toolchain.cmake ^
+ -D CMAKE_BUILD_TYPE=Release ^
+ -D VVL_CODEGEN=OFF ^
+ -D UPDATE_DEPS=ON ^
+ -D UPDATE_DEPS_DIR=%buildDir%
+
+
+ cmake ^
+ --build %buildDir% ^
+ --target vvl_codegen
+
+
+ cmake ^
+ --build %buildDir% ^
+ --parallel %BUILD_THREADS%
+
+
+ if not exist "%libDir%" (
+ mkdir "%libDir%"
+ )
+
+ cd /d %OHOS_SDK%/llvm/bin
+
+ llvm-strip ^
+ -d ^
+ -s ^
+ -o "%libDir%/libVkLayer_khronos_validation.so" ^
+ "%buildDir%/layers/libVkLayer_khronos_validation.so"
+
+```
## License
diff --git a/build.patch b/build.patch
deleted file mode 100644
index 488f0e19c335205e547b521484740e3830b1d8d3..0000000000000000000000000000000000000000
--- a/build.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/compile_standard_whitelist.json b/compile_standard_whitelist.json
-index b0bee416..e1177539 100644
---- a/compile_standard_whitelist.json
-+++ b/compile_standard_whitelist.json
-@@ -692,6 +692,8 @@
- "//third_party/vk-gl-cts/modules/gles3:libdeqp-gles3",
- "//third_party/vk-gl-cts/modules/glshared:deqp-gl-shared_source",
- "//third_party/vk-gl-cts/modules/glshared:libdeqp-gl-shared",
-+ "//third_party/vulkan-validationlayers:VkLayer_khronos_validation",
-+ "//third_party/vulkan-validationlayers:vulkan_layer_utils",
- "//third_party/rust/crates/rust-openssl/openssl-sys:lib"
- ]
- }
diff --git a/docs/images/usermode-use-debug-layer-1.jpg b/docs/images/usermode-use-debug-layer-1.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..6e1cd4c9c3ddcd7412157f8e8e3f03fe9df6a0f4
Binary files /dev/null and b/docs/images/usermode-use-debug-layer-1.jpg differ
diff --git a/docs/images/usermode-use-debug-layer-2.jpg b/docs/images/usermode-use-debug-layer-2.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..67a24fae4afdae780b14df247692ac0cedc68932
Binary files /dev/null and b/docs/images/usermode-use-debug-layer-2.jpg differ
diff --git a/docs/images/usermode-use-debug-layer-3.jpg b/docs/images/usermode-use-debug-layer-3.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..28463cc43effc99e805bbd1fab8d95f07c4f7707
Binary files /dev/null and b/docs/images/usermode-use-debug-layer-3.jpg differ
diff --git a/docs/images/vulkan-validationlayers_architecture_in_OH.png b/docs/images/vulkan-validationlayers_architecture_in_OH.png
index c32d6be35785db3beb749edfa3daef7926e5a526..ccc1760fe46d516315614401ca4d8854676ddc66 100644
Binary files a/docs/images/vulkan-validationlayers_architecture_in_OH.png and b/docs/images/vulkan-validationlayers_architecture_in_OH.png differ
diff --git a/docs/images/vulkan-validationlayers_load_way_in_OH.png b/docs/images/vulkan-validationlayers_load_way_in_OH.png
index 20802703063bda0fa5118fa40f93ea53291b06ec..30bc153d9a088b9695145d57870986130e2107de 100644
Binary files a/docs/images/vulkan-validationlayers_load_way_in_OH.png and b/docs/images/vulkan-validationlayers_load_way_in_OH.png differ
diff --git a/graphic_2d.patch b/graphic_2d.patch
deleted file mode 100644
index 4cd33f06d7ba36fc4dc34ebc4f65865b6423d03f..0000000000000000000000000000000000000000
--- a/graphic_2d.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-diff --git a/bundle.json b/bundle.json
-index 3c54d54bb1..f6f0e08efb 100644
---- a/bundle.json
-+++ b/bundle.json
-@@ -113,7 +113,8 @@
- "egl",
- "opengles",
- "vulkan-headers",
-- "vulkan-loader"
-+ "vulkan-loader",
-+ "vulkan-validationlayers"
- ]
- },
- "build": {
-@@ -138,7 +139,8 @@
- "//foundation/graphic/graphic_2d/rosen/modules/texgine:libtexgine",
- "//foundation/graphic/graphic_2d/frameworks/vulkan_layers:vulkan_swapchain_layer",
- "//foundation/graphic/graphic_2d/frameworks/vulkan_layers:vulkan_swapchain_layer_json",
-- "//foundation/graphic/graphic_2d/rosen/modules/graphics_effect:libgraphics_effect"
-+ "//foundation/graphic/graphic_2d/rosen/modules/graphics_effect:libgraphics_effect",
-+ "//third_party/vulkan-validationlayers:VkLayer_khronos_validation"
- ],
- "fwk_group": [
- "//foundation/graphic/graphic_2d/rosen/modules/render_service_base:librender_service_base",
diff --git a/layers/CMakeLists.txt b/layers/CMakeLists.txt
index 55ad677749acbd22005646789f0fa96576ec8387..372f02b9a91aeb8079248f337f33b96ed342fe53 100644
--- a/layers/CMakeLists.txt
+++ b/layers/CMakeLists.txt
@@ -322,6 +322,8 @@ elseif(MINGW)
elseif(APPLE)
set_target_properties(vvl PROPERTIES SUFFIX ".dylib")
target_link_options(vvl PRIVATE -exported_symbols_list ${CMAKE_CURRENT_SOURCE_DIR}/${LAYER_NAME}.exp)
+elseif(OHOS)
+ target_link_options(vvl PRIVATE LINKER:--version-script=${CMAKE_CURRENT_SOURCE_DIR}/${LAYER_NAME}-ohos.map)
elseif(ANDROID)
target_link_options(vvl PRIVATE LINKER:--version-script=${CMAKE_CURRENT_SOURCE_DIR}/${LAYER_NAME}-android.map)
else()
@@ -356,6 +358,12 @@ target_link_libraries(vvl PRIVATE
target_include_directories(vvl SYSTEM PRIVATE external)
+if (OHOS)
+ # Required for OH_LOG_Print. Marking as PUBLIC since the tests use OH_LOG_Print as well.
+ target_link_libraries(VkLayer_utils PUBLIC hilog_ndk.z)
+ return()
+endif()
+
if (ANDROID)
# https://gitlab.kitware.com/cmake/cmake/issues/18787
# https://github.com/android-ndk/ndk/issues/463
diff --git a/layers/VkLayer_khronos_validation-ohos.map b/layers/VkLayer_khronos_validation-ohos.map
new file mode 100644
index 0000000000000000000000000000000000000000..1f8fe1918ac613c023362ce51e96d127ee12a82c
--- /dev/null
+++ b/layers/VkLayer_khronos_validation-ohos.map
@@ -0,0 +1,12 @@
+{
+ global:
+ vkGetInstanceProcAddr;
+ vkGetDeviceProcAddr;
+ vkEnumerateInstanceLayerProperties;
+ vkEnumerateInstanceExtensionProperties;
+ vkNegotiateLoaderLayerInterfaceVersion;
+ vkEnumerateDeviceLayerProperties;
+ vkEnumerateDeviceExtensionProperties;
+ local:
+ *;
+};
diff --git a/layers/error_message/logging.cpp b/layers/error_message/logging.cpp
index d3e83cf000486394a46fc778a4cc7642273a4a40..1fb0324093a36640f9d6006d08ef58bc9046c85d 100644
--- a/layers/error_message/logging.cpp
+++ b/layers/error_message/logging.cpp
@@ -186,6 +186,7 @@ static bool debug_log_msg(const debug_report_data *debug_data, VkFlags msg_flags
}
oss << "| MessageID = 0x" << std::hex << message_id_number << " | " << message;
std::string composite = oss.str();
+ VVL_LOGE("%{public}s", composite.c_str());
const auto callback_list = &debug_data->debug_callback_list;
// We only output to default callbacks if there are no non-default callbacks
diff --git a/layers/error_message/logging.h b/layers/error_message/logging.h
index ce31564a94fca7c355762fc640ef809a3bc8320f..857ec77b44fd7a9c94ebdad8b91bf9ad492e0d97 100644
--- a/layers/error_message/logging.h
+++ b/layers/error_message/logging.h
@@ -39,6 +39,10 @@
[[maybe_unused]] static const char *kForceDefaultCallbackKey = "debug.vvl.forcelayerlog";
#endif
+#if defined(__OHOS__)
+#include "ohos_log.h"
+#endif
+
extern const char *kVUIDUndefined;
typedef enum DebugCallbackStatusBits {
diff --git a/layers/error_message/ohos_log.h b/layers/error_message/ohos_log.h
new file mode 100644
index 0000000000000000000000000000000000000000..0a5cad4874be5fe581feea4dfd1100c55658e11c
--- /dev/null
+++ b/layers/error_message/ohos_log.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef VVL_HILOG_H
+#define VVL_HILOG_H
+
+#include
+#include
+
+#undef LOG_DOMAIN
+#undef LOG_TAG
+#define LOG_DOMAIN 0xD001405
+#define LOG_TAG "VulkanValidationLayer"
+
+#define VVL_LOGE(...) \
+ do { \
+ OH_LOG_ERROR(LOG_APP, __VA_ARGS__); \
+ } while (0)
+
+#endif // VVL_HILOG_H
diff --git a/layers/state_tracker/state_tracker.cpp b/layers/state_tracker/state_tracker.cpp
index 4edbd112e9592e9f1ccc6fdf3dd87f8c20734c9f..db57b55682c8edec46c8ca626857299e603c3085 100644
--- a/layers/state_tracker/state_tracker.cpp
+++ b/layers/state_tracker/state_tracker.cpp
@@ -3946,6 +3946,15 @@ void ValidationStateTracker::PostCallRecordCreateHeadlessSurfaceEXT(VkInstance i
RecordVulkanSurface(pSurface);
}
+#ifdef VK_USE_PLATFORM_OHOS
+void ValidationStateTracker::PostCallRecordCreateSurfaceOHOS(VkInstance instance, const VkSurfaceCreateInfoOHOS *pCreateInfo,
+ const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface,
+ const RecordObject &record_obj) {
+ if (VK_SUCCESS != record_obj.result) return;
+ RecordVulkanSurface(pSurface);
+}
+#endif // VK_USE_PLATFORM_OHOS
+
void ValidationStateTracker::PostCallRecordGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice,
VkSurfaceKHR surface,
VkSurfaceCapabilitiesKHR *pSurfaceCapabilities,
diff --git a/layers/state_tracker/state_tracker.h b/layers/state_tracker/state_tracker.h
index 9596614d68602eeccc27261771955dc6b1e58238..668e75c9fa5c8f691eb3669d0e5b9b681514560c 100644
--- a/layers/state_tracker/state_tracker.h
+++ b/layers/state_tracker/state_tracker.h
@@ -1499,7 +1499,11 @@ class ValidationStateTracker : public ValidationObject {
void PostCallRecordCreateHeadlessSurfaceEXT(VkInstance instance, const VkHeadlessSurfaceCreateInfoEXT* pCreateInfo,
const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface,
const RecordObject& record_obj) override;
-
+#ifdef VK_USE_PLATFORM_OHOS
+ void PostCallRecordCreateSurfaceOHOS(VkInstance instance, const VkSurfaceCreateInfoOHOS* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface,
+ const RecordObject& record_obj) override;
+#endif // VK_USE_PLATFORM_OHOS
// State Utilty functions
std::vector> GetAttachmentViews(const VkRenderPassBeginInfo& rp_begin,
const vvl::Framebuffer& fb_state) const;
diff --git a/layers/vulkan/generated/chassis.cpp b/layers/vulkan/generated/chassis.cpp
index 461d8e76835580ee3fb3e62a9dd3839b995ce64a..7ebeadbc0fec031a5d36881c84f3af8e0f8da328 100644
--- a/layers/vulkan/generated/chassis.cpp
+++ b/layers/vulkan/generated/chassis.cpp
@@ -17172,6 +17172,11 @@ VKAPI_ATTR void VKAPI_CALL CmdDrawMeshTasksIndirectCountEXT(VkCommandBuffer comm
}
}
+VKAPI_ATTR void VKAPI_CALL CmdDrawBlurImageHUAWEI(VkCommandBuffer commandBuffer,
+ const VkDrawBlurImageInfoHUAWEI* drawBlurImageInfo) {
+ DispatchCmdDrawBlurImageHUAWEI(commandBuffer, drawBlurImageInfo);
+}
+
// Map of intercepted ApiName to its associated function data
#ifdef _MSC_VER
#pragma warning(suppress : 6262) // VS analysis: this uses more than 16 kiB, which is fine here at global scope
@@ -17913,6 +17918,7 @@ const vvl::unordered_map name_to_funcptr_map = {
{"vkCmdDrawMeshTasksEXT", {kFuncTypeDev, (void*)CmdDrawMeshTasksEXT}},
{"vkCmdDrawMeshTasksIndirectEXT", {kFuncTypeDev, (void*)CmdDrawMeshTasksIndirectEXT}},
{"vkCmdDrawMeshTasksIndirectCountEXT", {kFuncTypeDev, (void*)CmdDrawMeshTasksIndirectCountEXT}},
+ {"vkCmdDrawBlurImageHUAWEI", {kFuncTypeDev, (void*)CmdDrawBlurImageHUAWEI}},
};
} // namespace vulkan_layer_chassis
// clang-format on
diff --git a/layers/vulkan/generated/layer_chassis_dispatch.cpp b/layers/vulkan/generated/layer_chassis_dispatch.cpp
index 2d33b68c81aa9ee0250d01aa8d1c975da600e23c..45dfad194610f5c6af03e8fc0c326014eddec9ea 100644
--- a/layers/vulkan/generated/layer_chassis_dispatch.cpp
+++ b/layers/vulkan/generated/layer_chassis_dispatch.cpp
@@ -9284,4 +9284,22 @@ void DispatchCmdDrawMeshTasksIndirectCountEXT(VkCommandBuffer commandBuffer, VkB
countBufferOffset, maxDrawCount, stride);
}
+void DispatchCmdDrawBlurImageHUAWEI(VkCommandBuffer commandBuffer, const VkDrawBlurImageInfoHUAWEI* drawBlurImageInfo) {
+ auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map);
+ if (!wrap_handles) return layer_data->device_dispatch_table.CmdDrawBlurImageHUAWEI(commandBuffer, drawBlurImageInfo);
+ safe_VkDrawBlurImageInfoHUAWEI var_local_drawBlurImageInfo;
+ safe_VkDrawBlurImageInfoHUAWEI* local_drawBlurImageInfo = nullptr;
+ {
+ if (drawBlurImageInfo) {
+ local_drawBlurImageInfo = &var_local_drawBlurImageInfo;
+ local_drawBlurImageInfo->initialize(drawBlurImageInfo);
+ if (drawBlurImageInfo->srcImageView) {
+ local_drawBlurImageInfo->srcImageView = layer_data->Unwrap(drawBlurImageInfo->srcImageView);
+ }
+ }
+ }
+ layer_data->device_dispatch_table.CmdDrawBlurImageHUAWEI(commandBuffer,
+ (const VkDrawBlurImageInfoHUAWEI*)local_drawBlurImageInfo);
+}
+
// NOLINTEND
diff --git a/layers/vulkan/generated/layer_chassis_dispatch.h b/layers/vulkan/generated/layer_chassis_dispatch.h
index aedacd02f6520d1436a2487527c6cd5761566961..220cc09cfd18367b004ae5d4e3e0513220d31f0a 100644
--- a/layers/vulkan/generated/layer_chassis_dispatch.h
+++ b/layers/vulkan/generated/layer_chassis_dispatch.h
@@ -1246,5 +1246,5 @@ void DispatchCmdDrawMeshTasksIndirectEXT(VkCommandBuffer commandBuffer, VkBuffer
void DispatchCmdDrawMeshTasksIndirectCountEXT(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
uint32_t stride);
-
+void DispatchCmdDrawBlurImageHUAWEI(VkCommandBuffer commandBuffer, const VkDrawBlurImageInfoHUAWEI* drawBlurImageInfo);
// NOLINTEND
diff --git a/layers/vulkan/generated/vk_dispatch_table_helper.h b/layers/vulkan/generated/vk_dispatch_table_helper.h
index 97ed3b17aff7d482908d43f81a6133684cb6ef5d..23c6879b52b5cc79682dce300f07de72077d64c1 100644
--- a/layers/vulkan/generated/vk_dispatch_table_helper.h
+++ b/layers/vulkan/generated/vk_dispatch_table_helper.h
@@ -1813,6 +1813,8 @@ static VKAPI_ATTR void VKAPI_CALL StubCmdDrawMeshTasksIndirectCountEXT(VkCommand
VkDeviceSize offset, VkBuffer countBuffer,
VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
uint32_t stride) {}
+static VKAPI_ATTR void VKAPI_CALL StubCmdDrawBlurImageHUAWEI(VkCommandBuffer commandBuffer,
+ const VkDrawBlurImageInfoHUAWEI* drawBlurImageInfo) {}
const vvl::unordered_map> api_extension_map{
{"vkBindBufferMemory2", {"VK_VERSION_1_1"}},
@@ -4464,6 +4466,10 @@ static inline void layer_init_device_dispatch_table(VkDevice device, VkLayerDisp
if (table->CmdDrawMeshTasksIndirectCountEXT == nullptr) {
table->CmdDrawMeshTasksIndirectCountEXT = (PFN_vkCmdDrawMeshTasksIndirectCountEXT)StubCmdDrawMeshTasksIndirectCountEXT;
}
+ table->CmdDrawBlurImageHUAWEI = (PFN_vkCmdDrawBlurImageHUAWEI)gpa(device, "vkCmdDrawBlurImageHUAWEI");
+ if (table->CmdDrawBlurImageHUAWEI == nullptr) {
+ table->CmdDrawBlurImageHUAWEI = (PFN_vkCmdDrawBlurImageHUAWEI)StubCmdDrawBlurImageHUAWEI;
+ }
}
static inline void layer_init_instance_dispatch_table(VkInstance instance, VkLayerInstanceDispatchTable* table,
diff --git a/layers/vulkan/generated/vk_layer_dispatch_table.h b/layers/vulkan/generated/vk_layer_dispatch_table.h
index ff815d5dda0ed797e25732705143838135a7f668..73dd8085506e515a6eb528b9c4d4ab9df7fff238 100644
--- a/layers/vulkan/generated/vk_layer_dispatch_table.h
+++ b/layers/vulkan/generated/vk_layer_dispatch_table.h
@@ -774,5 +774,6 @@ typedef struct VkLayerDispatchTable_ {
PFN_vkCmdDrawMeshTasksEXT CmdDrawMeshTasksEXT;
PFN_vkCmdDrawMeshTasksIndirectEXT CmdDrawMeshTasksIndirectEXT;
PFN_vkCmdDrawMeshTasksIndirectCountEXT CmdDrawMeshTasksIndirectCountEXT;
+ PFN_vkCmdDrawBlurImageHUAWEI CmdDrawBlurImageHUAWEI;
} VkLayerDispatchTable;
// clang-format on// NOLINTEND
diff --git a/layers/vulkan/generated/vk_safe_struct.h b/layers/vulkan/generated/vk_safe_struct.h
index 1d310529dfeb8feb8d28642ec0fc85ffbfa21b87..e5c38b51ef6a6c85987bba2d589b79e382721ce2 100644
--- a/layers/vulkan/generated/vk_safe_struct.h
+++ b/layers/vulkan/generated/vk_safe_struct.h
@@ -17708,7 +17708,7 @@ struct safe_VkSurfaceCreateInfoOHOS {
struct safe_VkNativeBufferOHOS {
VkStructureType sType;
const void* pNext{};
- BufferHandle* handle{};
+ OHBufferHandle* handle{};
safe_VkNativeBufferOHOS(const VkNativeBufferOHOS* in_struct, PNextCopyState* copy_state = {}, bool copy_pnext = true);
safe_VkNativeBufferOHOS(const safe_VkNativeBufferOHOS& copy_src);
@@ -18416,4 +18416,24 @@ struct safe_VkPhysicalDeviceMeshShaderPropertiesEXT {
}
};
+struct safe_VkDrawBlurImageInfoHUAWEI {
+ VkStructureTypeHUAWEI sType;
+ const void* pNext{};
+ float sigma;
+ VkRect2D srcRegion;
+ VkRect2D dstRegion;
+ VkImageView srcImageView;
+
+ safe_VkDrawBlurImageInfoHUAWEI(const VkDrawBlurImageInfoHUAWEI* in_struct, PNextCopyState* copy_state = {},
+ bool copy_pnext = true);
+ safe_VkDrawBlurImageInfoHUAWEI(const safe_VkDrawBlurImageInfoHUAWEI& copy_src);
+ safe_VkDrawBlurImageInfoHUAWEI& operator=(const safe_VkDrawBlurImageInfoHUAWEI& copy_src);
+ safe_VkDrawBlurImageInfoHUAWEI();
+ ~safe_VkDrawBlurImageInfoHUAWEI();
+ void initialize(const VkDrawBlurImageInfoHUAWEI* in_struct, PNextCopyState* copy_state = {});
+ void initialize(const safe_VkDrawBlurImageInfoHUAWEI* copy_src, PNextCopyState* copy_state = {});
+ VkDrawBlurImageInfoHUAWEI* ptr() { return reinterpret_cast(this); }
+ VkDrawBlurImageInfoHUAWEI const* ptr() const { return reinterpret_cast(this); }
+};
+
// NOLINTEND
diff --git a/layers/vulkan/generated/vk_safe_struct_core.cpp b/layers/vulkan/generated/vk_safe_struct_core.cpp
index 63a54377a6f08f27de32c96f405dcc9ea472b00a..f31172a8545d1dbf376dedc56e2a798b8db6c587 100644
--- a/layers/vulkan/generated/vk_safe_struct_core.cpp
+++ b/layers/vulkan/generated/vk_safe_struct_core.cpp
@@ -19396,4 +19396,35 @@ void safe_VkDeviceImageMemoryRequirements::initialize(const safe_VkDeviceImageMe
if (copy_src->pCreateInfo) pCreateInfo = new safe_VkImageCreateInfo(*copy_src->pCreateInfo);
}
+safe_VkDrawBlurImageInfoHUAWEI::safe_VkDrawBlurImageInfoHUAWEI()
+ : sType(VK_STRUCTURE_TYPE_DRAW_BLUR_IMAGE_INFO_HUAWEI), pNext(nullptr), sigma(), srcRegion(), dstRegion(), srcImageView() {}
+
+safe_VkDrawBlurImageInfoHUAWEI& safe_VkDrawBlurImageInfoHUAWEI::operator=(const safe_VkDrawBlurImageInfoHUAWEI& copy_src) {
+ if (©_src == this) return *this;
+
+ FreePnextChain(pNext);
+
+ sType = copy_src.sType;
+ sigma = copy_src.sigma;
+ srcRegion = copy_src.srcRegion;
+ dstRegion = copy_src.dstRegion;
+ srcImageView = copy_src.srcImageView;
+ pNext = SafePnextCopy(copy_src.pNext);
+
+ return *this;
+}
+
+safe_VkDrawBlurImageInfoHUAWEI::~safe_VkDrawBlurImageInfoHUAWEI() { FreePnextChain(pNext); }
+
+void safe_VkDrawBlurImageInfoHUAWEI::initialize(const VkDrawBlurImageInfoHUAWEI* in_struct,
+ [[maybe_unused]] PNextCopyState* copy_state) {
+ FreePnextChain(pNext);
+ sType = in_struct->sType;
+ sigma = in_struct->sigma;
+ srcRegion = in_struct->srcRegion;
+ dstRegion = in_struct->dstRegion;
+ srcImageView = in_struct->srcImageView;
+ pNext = SafePnextCopy(in_struct->pNext, copy_state);
+}
+
// NOLINTEND
diff --git a/layers/vulkan/generated/vk_safe_struct_vendor.cpp b/layers/vulkan/generated/vk_safe_struct_vendor.cpp
index 1ab3731455d7870b8168c10c8c35430dcc245cf5..530d87824039a9889b45ae503502a58815ae51b3 100644
--- a/layers/vulkan/generated/vk_safe_struct_vendor.cpp
+++ b/layers/vulkan/generated/vk_safe_struct_vendor.cpp
@@ -15264,7 +15264,6 @@ void safe_VkPhysicalDeviceDescriptorPoolOverallocationFeaturesNV::initialize(
pNext = SafePnextCopy(copy_src->pNext);
}
#ifdef VK_USE_PLATFORM_OHOS
-
safe_VkSurfaceCreateInfoOHOS::safe_VkSurfaceCreateInfoOHOS(const VkSurfaceCreateInfoOHOS* in_struct,
[[maybe_unused]] PNextCopyState* copy_state, bool copy_pnext)
: sType(in_struct->sType), flags(in_struct->flags), window(nullptr) {
@@ -15272,7 +15271,7 @@ safe_VkSurfaceCreateInfoOHOS::safe_VkSurfaceCreateInfoOHOS(const VkSurfaceCreate
pNext = SafePnextCopy(in_struct->pNext, copy_state);
}
if (in_struct->window) {
- window = new OHNativeWindow(*in_struct->window);
+ window = in_struct->window;
}
}
@@ -15286,14 +15285,13 @@ safe_VkSurfaceCreateInfoOHOS::safe_VkSurfaceCreateInfoOHOS(const safe_VkSurfaceC
pNext = SafePnextCopy(copy_src.pNext);
if (copy_src.window) {
- window = new OHNativeWindow(*copy_src.window);
+ window = copy_src.window;
}
}
safe_VkSurfaceCreateInfoOHOS& safe_VkSurfaceCreateInfoOHOS::operator=(const safe_VkSurfaceCreateInfoOHOS& copy_src) {
if (©_src == this) return *this;
- if (window) delete window;
FreePnextChain(pNext);
sType = copy_src.sType;
@@ -15302,20 +15300,18 @@ safe_VkSurfaceCreateInfoOHOS& safe_VkSurfaceCreateInfoOHOS::operator=(const safe
pNext = SafePnextCopy(copy_src.pNext);
if (copy_src.window) {
- window = new OHNativeWindow(*copy_src.window);
+ window = copy_src.window;
}
return *this;
}
safe_VkSurfaceCreateInfoOHOS::~safe_VkSurfaceCreateInfoOHOS() {
- if (window) delete window;
FreePnextChain(pNext);
}
void safe_VkSurfaceCreateInfoOHOS::initialize(const VkSurfaceCreateInfoOHOS* in_struct,
[[maybe_unused]] PNextCopyState* copy_state) {
- if (window) delete window;
FreePnextChain(pNext);
sType = in_struct->sType;
flags = in_struct->flags;
@@ -15323,7 +15319,7 @@ void safe_VkSurfaceCreateInfoOHOS::initialize(const VkSurfaceCreateInfoOHOS* in_
pNext = SafePnextCopy(in_struct->pNext, copy_state);
if (in_struct->window) {
- window = new OHNativeWindow(*in_struct->window);
+ window = in_struct->window;
}
}
@@ -15335,7 +15331,7 @@ void safe_VkSurfaceCreateInfoOHOS::initialize(const safe_VkSurfaceCreateInfoOHOS
pNext = SafePnextCopy(copy_src->pNext);
if (copy_src->window) {
- window = new OHNativeWindow(*copy_src->window);
+ window = copy_src->window;
}
}
@@ -15346,7 +15342,7 @@ safe_VkNativeBufferOHOS::safe_VkNativeBufferOHOS(const VkNativeBufferOHOS* in_st
pNext = SafePnextCopy(in_struct->pNext, copy_state);
}
if (in_struct->handle) {
- handle = new BufferHandle(*in_struct->handle);
+ handle = in_struct->handle;
}
}
@@ -15358,14 +15354,13 @@ safe_VkNativeBufferOHOS::safe_VkNativeBufferOHOS(const safe_VkNativeBufferOHOS&
pNext = SafePnextCopy(copy_src.pNext);
if (copy_src.handle) {
- handle = new BufferHandle(*copy_src.handle);
+ handle = copy_src.handle;
}
}
safe_VkNativeBufferOHOS& safe_VkNativeBufferOHOS::operator=(const safe_VkNativeBufferOHOS& copy_src) {
if (©_src == this) return *this;
- if (handle) delete handle;
FreePnextChain(pNext);
sType = copy_src.sType;
@@ -15373,26 +15368,24 @@ safe_VkNativeBufferOHOS& safe_VkNativeBufferOHOS::operator=(const safe_VkNativeB
pNext = SafePnextCopy(copy_src.pNext);
if (copy_src.handle) {
- handle = new BufferHandle(*copy_src.handle);
+ handle = copy_src.handle;
}
return *this;
}
safe_VkNativeBufferOHOS::~safe_VkNativeBufferOHOS() {
- if (handle) delete handle;
FreePnextChain(pNext);
}
void safe_VkNativeBufferOHOS::initialize(const VkNativeBufferOHOS* in_struct, [[maybe_unused]] PNextCopyState* copy_state) {
- if (handle) delete handle;
FreePnextChain(pNext);
sType = in_struct->sType;
handle = nullptr;
pNext = SafePnextCopy(in_struct->pNext, copy_state);
if (in_struct->handle) {
- handle = new BufferHandle(*in_struct->handle);
+ handle = in_struct->handle;
}
}
@@ -15402,10 +15395,9 @@ void safe_VkNativeBufferOHOS::initialize(const safe_VkNativeBufferOHOS* copy_src
pNext = SafePnextCopy(copy_src->pNext);
if (copy_src->handle) {
- handle = new BufferHandle(*copy_src->handle);
+ handle = copy_src->handle;
}
}
-
safe_VkSwapchainImageCreateInfoOHOS::safe_VkSwapchainImageCreateInfoOHOS(const VkSwapchainImageCreateInfoOHOS* in_struct,
[[maybe_unused]] PNextCopyState* copy_state,
bool copy_pnext)
@@ -15698,7 +15690,7 @@ safe_VkImportNativeBufferInfoOHOS::safe_VkImportNativeBufferInfoOHOS(const VkImp
pNext = SafePnextCopy(in_struct->pNext, copy_state);
}
if (in_struct->buffer) {
- buffer = new OH_NativeBuffer(*in_struct->buffer);
+ buffer = in_struct->buffer;
}
}
@@ -15709,44 +15701,38 @@ safe_VkImportNativeBufferInfoOHOS::safe_VkImportNativeBufferInfoOHOS(const safe_
sType = copy_src.sType;
buffer = nullptr;
pNext = SafePnextCopy(copy_src.pNext);
-
if (copy_src.buffer) {
- buffer = new OH_NativeBuffer(*copy_src.buffer);
+ buffer = copy_src.buffer;
}
}
safe_VkImportNativeBufferInfoOHOS& safe_VkImportNativeBufferInfoOHOS::operator=(const safe_VkImportNativeBufferInfoOHOS& copy_src) {
if (©_src == this) return *this;
- if (buffer) delete buffer;
FreePnextChain(pNext);
sType = copy_src.sType;
buffer = nullptr;
pNext = SafePnextCopy(copy_src.pNext);
-
if (copy_src.buffer) {
- buffer = new OH_NativeBuffer(*copy_src.buffer);
+ buffer = copy_src.buffer;
}
return *this;
}
safe_VkImportNativeBufferInfoOHOS::~safe_VkImportNativeBufferInfoOHOS() {
- if (buffer) delete buffer;
FreePnextChain(pNext);
}
void safe_VkImportNativeBufferInfoOHOS::initialize(const VkImportNativeBufferInfoOHOS* in_struct,
[[maybe_unused]] PNextCopyState* copy_state) {
- if (buffer) delete buffer;
FreePnextChain(pNext);
sType = in_struct->sType;
buffer = nullptr;
pNext = SafePnextCopy(in_struct->pNext, copy_state);
-
if (in_struct->buffer) {
- buffer = new OH_NativeBuffer(*in_struct->buffer);
+ buffer = in_struct->buffer;
}
}
@@ -15755,9 +15741,8 @@ void safe_VkImportNativeBufferInfoOHOS::initialize(const safe_VkImportNativeBuff
sType = copy_src->sType;
buffer = nullptr;
pNext = SafePnextCopy(copy_src->pNext);
-
if (copy_src->buffer) {
- buffer = new OH_NativeBuffer(*copy_src->buffer);
+ buffer = copy_src->buffer;
}
}
diff --git a/scripts/known_good.json b/scripts/known_good.json
index a009dfb883627dc1a68981a5a9627713954f8ab4..ed07ddc9f5f14f6d509622169571786b2bb744f9 100755
--- a/scripts/known_good.json
+++ b/scripts/known_good.json
@@ -3,11 +3,11 @@
{
"name": "Vulkan-Headers",
"api": "vulkan",
- "url": "https://github.com/KhronosGroup/Vulkan-Headers.git",
+ "url": "https://gitee.com/openharmony/third_party_vulkan-headers.git",
"sub_dir": "Vulkan-Headers",
"build_dir": "Vulkan-Headers/build",
"install_dir": "Vulkan-Headers/build/install",
- "commit": "v1.3.275"
+ "commit": "de4b2f2aa09145801017580787d5090f6d24d9f5"
},
{
"name": "Vulkan-Utility-Libraries",
diff --git a/scripts/ohos-patches/SPIRV-Tools.patch b/scripts/ohos-patches/SPIRV-Tools.patch
new file mode 100644
index 0000000000000000000000000000000000000000..94d138a47bf53b5d89fda3a266a325c24ca8fbb8
--- /dev/null
+++ b/scripts/ohos-patches/SPIRV-Tools.patch
@@ -0,0 +1,32 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 07be2dfc..ca0630ff 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -12,7 +12,7 @@
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+
+-cmake_minimum_required(VERSION 3.17.2)
++cmake_minimum_required(VERSION 3.16.5)
+
+ project(spirv-tools)
+
+@@ -78,6 +78,9 @@ elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "GNU")
+ add_definitions(-DSPIRV_GNU)
+ elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "QNX")
+ add_definitions(-DSPIRV_QNX)
++elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "OHOS")
++ add_definitions(-DSPIRV_ANDROID)
++ set(SPIRV_TIMER_ENABLED ${SPIRV_ALLOW_TIMERS})
+ else()
+ message(FATAL_ERROR "Your platform '${CMAKE_SYSTEM_NAME}' is not supported!")
+ endif()
+@@ -312,7 +315,7 @@ endif()
+ # libraries (either STATIC or SHARED).
+ #
+ # Furthermore testing is equally problematic.
+-if (IOS OR ANDROID)
++if (IOS OR ANDROID OR OHOS)
+ set(SPIRV_SKIP_EXECUTABLES ON)
+ endif()
+
diff --git a/scripts/ohos-patches/VkLayer_khronos_validation.json b/scripts/ohos-patches/VkLayer_khronos_validation.json
new file mode 100644
index 0000000000000000000000000000000000000000..6f8ff1a424edf1bc057d4957ddc7c55498b04a72
--- /dev/null
+++ b/scripts/ohos-patches/VkLayer_khronos_validation.json
@@ -0,0 +1,1429 @@
+{
+ "file_format_version": "1.2.0",
+ "layer": {
+ "name": "VK_LAYER_KHRONOS_validation",
+ "type": "GLOBAL",
+ "library_path": "/data/storage/el1/bundle/lib/arm64/libVkLayer_khronos_validation.so",
+ "api_version": "1.3.275",
+ "implementation_version": "1",
+ "description": "Khronos Validation Layer",
+ "disable_environment": {
+ "DISBALE_OHOS_VALIDATION_LAYER": "1"
+ },
+ "introduction": "The main, comprehensive Khronos validation layer.\n\nVulkan is an Explicit API, enabling direct control over how GPUs actually work. By design, minimal error checking is done inside a Vulkan driver. Applications have full control and responsibility for correct operation. Any errors in how Vulkan is used can result in a crash. \n\nThe Khronos Valiation Layer can be enabled to assist development by enabling developers to verify their applications correctly use the Vulkan API.",
+ "platforms": [
+ "WINDOWS",
+ "LINUX",
+ "ANDROID",
+ "MACOS",
+ "OHOS"
+ ],
+ "url": "https://vulkan.lunarg.com/doc/sdk/latest/windows/khronos_validation_layer.html",
+ "instance_extensions": [
+ {
+ "name": "VK_EXT_debug_report",
+ "spec_version": "9"
+ },
+ {
+ "name": "VK_EXT_debug_utils",
+ "spec_version": "1"
+ },
+ {
+ "name": "VK_EXT_validation_features",
+ "spec_version": "2"
+ }
+ ],
+ "device_extensions": [
+ {
+ "name": "VK_EXT_debug_marker",
+ "spec_version": "4",
+ "entrypoints": [
+ "vkDebugMarkerSetObjectTagEXT",
+ "vkDebugMarkerSetObjectNameEXT",
+ "vkCmdDebugMarkerBeginEXT",
+ "vkCmdDebugMarkerEndEXT",
+ "vkCmdDebugMarkerInsertEXT"
+ ]
+ },
+ {
+ "name": "VK_EXT_validation_cache",
+ "spec_version": "1",
+ "entrypoints": [
+ "vkCreateValidationCacheEXT",
+ "vkDestroyValidationCacheEXT",
+ "vkGetValidationCacheDataEXT",
+ "vkMergeValidationCachesEXT"
+ ]
+ },
+ {
+ "name": "VK_EXT_tooling_info",
+ "spec_version": "1",
+ "entrypoints": [
+ "vkGetPhysicalDeviceToolPropertiesEXT"
+ ]
+ }
+ ],
+ "features": {
+ "presets": [
+ {
+ "label": "Standard",
+ "description": "Good default validation setup that balance validation coverage and performance.",
+ "platforms": [
+ "WINDOWS",
+ "LINUX",
+ "MACOS",
+ "ANDROID",
+ "OHOS"
+ ],
+ "status": "STABLE",
+ "settings": [
+ {
+ "key": "validate_core",
+ "value": true
+ },
+ {
+ "key": "check_image_layout",
+ "value": true
+ },
+ {
+ "key": "check_command_buffer",
+ "value": true
+ },
+ {
+ "key": "check_object_in_use",
+ "value": true
+ },
+ {
+ "key": "check_query",
+ "value": true
+ },
+ {
+ "key": "check_shaders",
+ "value": true
+ },
+ {
+ "key": "check_shaders_caching",
+ "value": true
+ },
+ {
+ "key": "unique_handles",
+ "value": true
+ },
+ {
+ "key": "object_lifetime",
+ "value": true
+ },
+ {
+ "key": "stateless_param",
+ "value": true
+ },
+ {
+ "key": "thread_safety",
+ "value": false
+ },
+ {
+ "key": "validate_sync",
+ "value": false
+ },
+ {
+ "key": "validate_gpu_based",
+ "value": "GPU_BASED_NONE"
+ },
+ {
+ "key": "validate_best_practices",
+ "value": false
+ }
+ ]
+ },
+ {
+ "label": "Reduced-Overhead",
+ "description": "Disables some checks in the interest of better performance.",
+ "platforms": [
+ "WINDOWS",
+ "LINUX",
+ "MACOS"
+ ],
+ "status": "STABLE",
+ "settings": [
+ {
+ "key": "validate_core",
+ "value": true
+ },
+ {
+ "key": "check_image_layout",
+ "value": false
+ },
+ {
+ "key": "check_command_buffer",
+ "value": false
+ },
+ {
+ "key": "check_object_in_use",
+ "value": false
+ },
+ {
+ "key": "check_query",
+ "value": false
+ },
+ {
+ "key": "check_shaders",
+ "value": true
+ },
+ {
+ "key": "check_shaders_caching",
+ "value": true
+ },
+ {
+ "key": "unique_handles",
+ "value": false
+ },
+ {
+ "key": "object_lifetime",
+ "value": true
+ },
+ {
+ "key": "stateless_param",
+ "value": true
+ },
+ {
+ "key": "thread_safety",
+ "value": false
+ },
+ {
+ "key": "validate_sync",
+ "value": false
+ },
+ {
+ "key": "validate_gpu_based",
+ "value": "GPU_BASED_NONE"
+ },
+ {
+ "key": "validate_best_practices",
+ "value": false
+ }
+ ]
+ },
+ {
+ "label": "Best Practices",
+ "description": "Provides warnings on valid API usage that is potential API misuse.",
+ "platforms": [
+ "WINDOWS",
+ "LINUX",
+ "MACOS",
+ "ANDROID",
+ "OHOS"
+ ],
+ "status": "STABLE",
+ "settings": [
+ {
+ "key": "validate_core",
+ "value": false
+ },
+ {
+ "key": "check_image_layout",
+ "value": false
+ },
+ {
+ "key": "check_command_buffer",
+ "value": false
+ },
+ {
+ "key": "check_object_in_use",
+ "value": false
+ },
+ {
+ "key": "check_query",
+ "value": false
+ },
+ {
+ "key": "check_shaders",
+ "value": false
+ },
+ {
+ "key": "check_shaders_caching",
+ "value": false
+ },
+ {
+ "key": "unique_handles",
+ "value": false
+ },
+ {
+ "key": "object_lifetime",
+ "value": false
+ },
+ {
+ "key": "stateless_param",
+ "value": false
+ },
+ {
+ "key": "thread_safety",
+ "value": false
+ },
+ {
+ "key": "validate_sync",
+ "value": false
+ },
+ {
+ "key": "validate_gpu_based",
+ "value": "GPU_BASED_NONE"
+ },
+ {
+ "key": "validate_best_practices",
+ "value": true
+ }
+ ]
+ },
+ {
+ "label": "Synchronization",
+ "description": "Identify resource access conflicts due to missing or incorrect synchronization operations between actions reading or writing the same regions of memory.",
+ "platforms": [
+ "WINDOWS",
+ "LINUX",
+ "MACOS",
+ "ANDROID",
+ "OHOS"
+ ],
+ "status": "STABLE",
+ "settings": [
+ {
+ "key": "validate_core",
+ "value": false
+ },
+ {
+ "key": "check_image_layout",
+ "value": false
+ },
+ {
+ "key": "check_command_buffer",
+ "value": false
+ },
+ {
+ "key": "check_object_in_use",
+ "value": false
+ },
+ {
+ "key": "check_query",
+ "value": false
+ },
+ {
+ "key": "check_shaders",
+ "value": false
+ },
+ {
+ "key": "check_shaders_caching",
+ "value": false
+ },
+ {
+ "key": "unique_handles",
+ "value": false
+ },
+ {
+ "key": "object_lifetime",
+ "value": false
+ },
+ {
+ "key": "stateless_param",
+ "value": false
+ },
+ {
+ "key": "thread_safety",
+ "value": true
+ },
+ {
+ "key": "validate_sync",
+ "value": true
+ },
+ {
+ "key": "validate_gpu_based",
+ "value": "GPU_BASED_NONE"
+ },
+ {
+ "key": "validate_best_practices",
+ "value": false
+ }
+ ]
+ },
+ {
+ "label": "GPU-Assisted",
+ "description": "Check for API usage errors at shader execution time.",
+ "platforms": [
+ "WINDOWS",
+ "LINUX"
+ ],
+ "status": "STABLE",
+ "settings": [
+ {
+ "key": "validate_core",
+ "value": false
+ },
+ {
+ "key": "check_image_layout",
+ "value": false
+ },
+ {
+ "key": "check_command_buffer",
+ "value": false
+ },
+ {
+ "key": "check_object_in_use",
+ "value": false
+ },
+ {
+ "key": "check_query",
+ "value": false
+ },
+ {
+ "key": "check_shaders",
+ "value": false
+ },
+ {
+ "key": "check_shaders_caching",
+ "value": false
+ },
+ {
+ "key": "unique_handles",
+ "value": false
+ },
+ {
+ "key": "object_lifetime",
+ "value": false
+ },
+ {
+ "key": "stateless_param",
+ "value": false
+ },
+ {
+ "key": "thread_safety",
+ "value": false
+ },
+ {
+ "key": "validate_sync",
+ "value": false
+ },
+ {
+ "key": "validate_gpu_based",
+ "value": "GPU_BASED_GPU_ASSISTED"
+ },
+ {
+ "key": "reserve_binding_slot",
+ "value": true
+ },
+ {
+ "key": "validate_best_practices",
+ "value": false
+ }
+ ]
+ },
+ {
+ "label": "Debug Printf",
+ "description": "Debug shader code by \"printing\" any values of interest to the debug callback or stdout.",
+ "platforms": [
+ "WINDOWS",
+ "LINUX"
+ ],
+ "status": "STABLE",
+ "settings": [
+ {
+ "key": "validate_core",
+ "value": false
+ },
+ {
+ "key": "check_image_layout",
+ "value": false
+ },
+ {
+ "key": "check_command_buffer",
+ "value": false
+ },
+ {
+ "key": "check_object_in_use",
+ "value": false
+ },
+ {
+ "key": "check_query",
+ "value": false
+ },
+ {
+ "key": "check_shaders",
+ "value": false
+ },
+ {
+ "key": "check_shaders_caching",
+ "value": false
+ },
+ {
+ "key": "unique_handles",
+ "value": false
+ },
+ {
+ "key": "object_lifetime",
+ "value": false
+ },
+ {
+ "key": "stateless_param",
+ "value": false
+ },
+ {
+ "key": "thread_safety",
+ "value": false
+ },
+ {
+ "key": "validate_sync",
+ "value": false
+ },
+ {
+ "key": "validate_gpu_based",
+ "value": "GPU_BASED_DEBUG_PRINTF"
+ },
+ {
+ "key": "validate_best_practices",
+ "value": false
+ }
+ ]
+ }
+ ],
+ "settings": [
+ {
+ "key": "validation_control",
+ "label": "Validation Areas",
+ "description": "Control of the Validation layer validation",
+ "type": "GROUP",
+ "expanded": true,
+ "settings": [
+ {
+ "key": "fine_grained_locking",
+ "env": "VK_LAYER_FINE_GRAINED_LOCKING",
+ "label": "Fine Grained Locking",
+ "description": "Enable fine grained locking for Core Validation, which should improve performance in multithreaded applications. This setting allows the optimization to be disabled for debugging.",
+ "type": "BOOL",
+ "default": true,
+ "platforms": [
+ "WINDOWS",
+ "LINUX",
+ "MACOS",
+ "ANDROID",
+ "OHOS"
+ ]
+ },
+ {
+ "key": "validate_core",
+ "label": "Core",
+ "description": "The main, heavy-duty validation checks. This may be valuable early in the development cycle to reduce validation output while correcting parameter/object usage errors.",
+ "type": "BOOL",
+ "default": true,
+ "settings": [
+ {
+ "key": "check_image_layout",
+ "label": "Image Layout",
+ "description": "Check that the layout of each image subresource is correct whenever it is used by a command buffer. These checks are very CPU intensive for some applications.",
+ "type": "BOOL",
+ "default": true,
+ "dependence": {
+ "mode": "ALL",
+ "settings": [
+ {
+ "key": "validate_core",
+ "value": true
+ }
+ ]
+ }
+ },
+ {
+ "key": "check_command_buffer",
+ "label": "Command Buffer State",
+ "description": "Check that all Vulkan objects used by a command buffer have not been destroyed. These checks can be CPU intensive for some applications.",
+ "type": "BOOL",
+ "default": true,
+ "dependence": {
+ "mode": "ALL",
+ "settings": [
+ {
+ "key": "validate_core",
+ "value": true
+ }
+ ]
+ }
+ },
+ {
+ "key": "check_object_in_use",
+ "label": "Object in Use",
+ "description": "Check that Vulkan objects are not in use by a command buffer when they are destroyed.",
+ "type": "BOOL",
+ "default": true,
+ "dependence": {
+ "mode": "ALL",
+ "settings": [
+ {
+ "key": "validate_core",
+ "value": true
+ }
+ ]
+ }
+ },
+ {
+ "key": "check_query",
+ "label": "Query",
+ "description": "Checks for commands that use VkQueryPool objects.",
+ "type": "BOOL",
+ "default": true,
+ "dependence": {
+ "mode": "ALL",
+ "settings": [
+ {
+ "key": "validate_core",
+ "value": true
+ }
+ ]
+ }
+ },
+ {
+ "key": "check_shaders",
+ "label": "Shader",
+ "description": "Shader checks. These checks can be CPU intensive during application start up, especially if Shader Validation Caching is also disabled.",
+ "type": "BOOL",
+ "default": true,
+ "expanded": true,
+ "dependence": {
+ "mode": "ALL",
+ "settings": [
+ {
+ "key": "validate_core",
+ "value": true
+ }
+ ]
+ },
+ "settings": [
+ {
+ "key": "check_shaders_caching",
+ "label": "Caching",
+ "description": "Enable caching of shader validation results.",
+ "type": "BOOL",
+ "default": true,
+ "dependence": {
+ "mode": "ALL",
+ "settings": [
+ {
+ "key": "validate_core",
+ "value": true
+ },
+ {
+ "key": "check_shaders",
+ "value": true
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "key": "unique_handles",
+ "label": "Handle Wrapping",
+ "description": "Handle wrapping checks. Disable this feature if you are exerience crashes when creating new extensions or developing new Vulkan objects/structures.",
+ "type": "BOOL",
+ "default": true,
+ "status": "STABLE",
+ "platforms": [
+ "WINDOWS",
+ "LINUX",
+ "MACOS",
+ "ANDROID",
+ "OHOS"
+ ]
+ },
+ {
+ "key": "object_lifetime",
+ "label": "Object Lifetime",
+ "description": "Object tracking checks. This may not always be necessary late in a development cycle.",
+ "type": "BOOL",
+ "default": true,
+ "status": "STABLE",
+ "platforms": [
+ "WINDOWS",
+ "LINUX",
+ "MACOS",
+ "ANDROID",
+ "OHOS"
+ ]
+ },
+ {
+ "key": "stateless_param",
+ "label": "Stateless Parameter",
+ "description": "Stateless parameter checks. This may not always be necessary late in a development cycle.",
+ "type": "BOOL",
+ "default": true,
+ "status": "STABLE",
+ "platforms": [
+ "WINDOWS",
+ "LINUX",
+ "MACOS",
+ "ANDROID",
+ "OHOS"
+ ]
+ },
+ {
+ "key": "thread_safety",
+ "label": "Thread Safety",
+ "description": "Thread checks. In order to not degrade performance, it might be best to run your program with thread-checking disabled most of the time, enabling it occasionally for a quick sanity check or when debugging difficult application behaviors.",
+ "type": "BOOL",
+ "default": true,
+ "status": "STABLE",
+ "platforms": [
+ "WINDOWS",
+ "LINUX",
+ "MACOS",
+ "ANDROID",
+ "OHOS"
+ ]
+ },
+ {
+ "key": "validate_sync",
+ "label": "Synchronization",
+ "description": "Enable synchronization validation during command buffers recording. This feature reports resource access conflicts due to missing or incorrect synchronization operations between actions (Draw, Copy, Dispatch, Blit) reading or writing the same regions of memory.",
+ "url": "${LUNARG_SDK}/synchronization_usage.html",
+ "type": "BOOL",
+ "default": false,
+ "expanded": true,
+ "status": "STABLE",
+ "platforms": [
+ "WINDOWS",
+ "LINUX",
+ "MACOS",
+ "ANDROID",
+ "OHOS"
+ ],
+ "settings": [
+ {
+ "key": "sync_queue_submit",
+ "label": "QueueSubmit Synchronization Validation",
+ "description": "Enable synchronization validation between submitted command buffers when Synchronization Validation is enabled. This option will increase the synchronization performance cost.",
+ "type": "BOOL",
+ "default": true,
+ "status": "STABLE",
+ "dependence": {
+ "mode": "ALL",
+ "settings": [
+ {
+ "key": "validate_sync",
+ "value": true
+ }
+ ]
+ }
+ }
+ ]
+ },
+ {
+ "key": "validate_gpu_based",
+ "label": "GPU Base",
+ "description": "Setting an option here will enable specialized areas of validation",
+ "type": "ENUM",
+ "default": "GPU_BASED_NONE",
+ "expanded": true,
+ "status": "STABLE",
+ "platforms": [
+ "WINDOWS",
+ "LINUX"
+ ],
+ "flags": [
+ {
+ "key": "GPU_BASED_NONE",
+ "label": "None",
+ "description": "No GPU-based validation."
+ },
+ {
+ "key": "GPU_BASED_DEBUG_PRINTF",
+ "label": "Debug Printf",
+ "description": "Enables processing of debug printf instructions in shaders and sending debug strings to the debug callback.",
+ "url": "${LUNARG_SDK}/debug_printf.html",
+ "status": "STABLE",
+ "platforms": [
+ "WINDOWS",
+ "LINUX"
+ ],
+ "settings": [
+ {
+ "key": "printf_to_stdout",
+ "label": "Redirect Printf messages to stdout",
+ "description": "Enable redirection of Debug Printf messages from the debug callback to stdout",
+ "type": "BOOL",
+ "default": true,
+ "platforms": [
+ "WINDOWS",
+ "LINUX"
+ ],
+ "dependence": {
+ "mode": "ALL",
+ "settings": [
+ {
+ "key": "validate_gpu_based",
+ "value": "GPU_BASED_DEBUG_PRINTF"
+ }
+ ]
+ }
+ },
+ {
+ "key": "printf_verbose",
+ "label": "Printf verbose",
+ "description": "Set the verbosity of debug printf messages",
+ "type": "BOOL",
+ "default": false,
+ "platforms": [
+ "WINDOWS",
+ "LINUX"
+ ],
+ "dependence": {
+ "mode": "ALL",
+ "settings": [
+ {
+ "key": "validate_gpu_based",
+ "value": "GPU_BASED_DEBUG_PRINTF"
+ }
+ ]
+ }
+ },
+ {
+ "key": "printf_buffer_size",
+ "label": "Printf buffer size",
+ "description": "Set the size in bytes of the buffer used by debug printf",
+ "type": "INT",
+ "default": 1024,
+ "range": {
+ "min": 128,
+ "max": 1048576
+ },
+ "unit": "bytes",
+ "platforms": [
+ "WINDOWS",
+ "LINUX"
+ ],
+ "dependence": {
+ "mode": "ALL",
+ "settings": [
+ {
+ "key": "validate_gpu_based",
+ "value": "GPU_BASED_DEBUG_PRINTF"
+ }
+ ]
+ }
+ }
+ ]
+ },
+ {
+ "key": "GPU_BASED_GPU_ASSISTED",
+ "label": "GPU-Assisted",
+ "description": "Check for API usage errors at shader execution time.",
+ "url": "${LUNARG_SDK}/gpu_validation.html",
+ "platforms": [
+ "WINDOWS",
+ "LINUX"
+ ],
+ "settings": [
+ {
+ "key": "reserve_binding_slot",
+ "label": "Reserve Descriptor Set Binding Slot",
+ "type": "BOOL",
+ "default": true,
+ "description": "Specifies that the validation layers reserve a descriptor set binding slot for their own use. The layer reports a value for VkPhysicalDeviceLimits::maxBoundDescriptorSets that is one less than the value reported by the device. If the device supports the binding of only one descriptor set, the validation layer does not perform GPU-assisted validation.",
+ "platforms": [
+ "WINDOWS",
+ "LINUX"
+ ],
+ "dependence": {
+ "mode": "ALL",
+ "settings": [
+ {
+ "key": "validate_gpu_based",
+ "value": "GPU_BASED_GPU_ASSISTED"
+ }
+ ]
+ }
+ },
+ {
+ "key": "vma_linear_output",
+ "label": "Linear Memory Allocation Mode",
+ "description": "Use VMA linear memory allocations for GPU-AV output buffers instead of finding best place for new allocations among free regions to optimize memory usage. Enabling this setting reduces performance cost but disabling this method minimizes memory usage.",
+ "type": "BOOL",
+ "default": true,
+ "platforms": [
+ "WINDOWS",
+ "LINUX"
+ ],
+ "status": "STABLE",
+ "dependence": {
+ "mode": "ALL",
+ "settings": [
+ {
+ "key": "validate_gpu_based",
+ "value": "GPU_BASED_GPU_ASSISTED"
+ }
+ ]
+ }
+ },
+ {
+ "key": "gpuav_descriptor_checks",
+ "label": "Descriptor and OOB Checks",
+ "description": "Enable descriptor and buffer out of bounds checking",
+ "type": "BOOL",
+ "default": true,
+ "platforms": [
+ "WINDOWS",
+ "LINUX"
+ ],
+ "dependence": {
+ "mode": "ALL",
+ "settings": [
+ {
+ "key": "validate_gpu_based",
+ "value": "GPU_BASED_GPU_ASSISTED"
+ }
+ ]
+ },
+ "settings": [
+ {
+ "key": "warn_on_robust_oob",
+ "label": "Generate warning on out of bounds accesses even if buffer robustness is enabled",
+ "description": "Warn on out of bounds accesses even if robustness is enabled",
+ "type": "BOOL",
+ "default": true,
+ "platforms": [
+ "WINDOWS",
+ "LINUX"
+ ],
+ "dependence": {
+ "mode": "ALL",
+ "settings": [
+ {
+ "key": "gpuav_descriptor_checks",
+ "value": true
+ }
+ ]
+ }
+ }
+ ]
+ },
+ {
+ "key": "validate_indirect_buffer",
+ "label": "Check Draw/Dispatch/TraceRays Indirect buffers",
+ "description": "Enable draw/dispatch/traceRays indirect checking",
+ "type": "BOOL",
+ "default": true,
+ "platforms": [
+ "WINDOWS",
+ "LINUX"
+ ],
+ "dependence": {
+ "mode": "ALL",
+ "settings": [
+ {
+ "key": "validate_gpu_based",
+ "value": "GPU_BASED_GPU_ASSISTED"
+ }
+ ]
+ }
+ },
+ {
+ "key": "use_instrumented_shader_cache",
+ "label": "Cache instrumented shaders rather than instrumenting them on every run",
+ "description": "Enable instrumented shader caching",
+ "type": "BOOL",
+ "default": true,
+ "platforms": [
+ "WINDOWS",
+ "LINUX"
+ ],
+ "dependence": {
+ "mode": "ALL",
+ "settings": [
+ {
+ "key": "validate_gpu_based",
+ "value": "GPU_BASED_GPU_ASSISTED"
+ }
+ ]
+ }
+ },
+ {
+ "key": "select_instrumented_shaders",
+ "label": "Enable instrumenting shaders selectively",
+ "description": "Select which shaders to instrument passing a VkValidationFeaturesEXT struct with GPU-AV enabled in the VkShaderModuleCreateInfo pNext",
+ "type": "BOOL",
+ "default": false,
+ "platforms": [
+ "WINDOWS",
+ "LINUX"
+ ],
+ "dependence": {
+ "mode": "ALL",
+ "settings": [
+ {
+ "key": "validate_gpu_based",
+ "value": "GPU_BASED_GPU_ASSISTED"
+ }
+ ]
+ }
+ },
+ {
+ "key": "gpuav_max_buffer_device_addresses",
+ "label": "Specify the maximum number of buffer device addresses in use at one time",
+ "description": "Specify maximum number of buffer device addresses",
+ "type": "INT",
+ "default": 10000,
+ "platforms": [
+ "WINDOWS",
+ "LINUX"
+ ],
+ "dependence": {
+ "mode": "ALL",
+ "settings": [
+ {
+ "key": "validate_gpu_based",
+ "value": "GPU_BASED_GPU_ASSISTED"
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "key": "validate_best_practices",
+ "label": "Best Practices",
+ "description": "Outputs warnings related to common misuse of the API, but which are not explicitly prohibited by the specification.",
+ "url": "${LUNARG_SDK}/best_practices.html",
+ "type": "BOOL",
+ "default": false,
+ "expanded": true,
+ "status": "STABLE",
+ "platforms": [
+ "WINDOWS",
+ "LINUX",
+ "MACOS",
+ "ANDROID",
+ "OHOS"
+ ],
+ "settings": [
+ {
+ "key": "validate_best_practices_arm",
+ "label": "ARM-specific best practices",
+ "description": "Outputs warnings for spec-conforming but non-ideal code on ARM GPUs.",
+ "type": "BOOL",
+ "default": false,
+ "platforms": [
+ "WINDOWS",
+ "LINUX",
+ "MACOS",
+ "ANDROID",
+ "OHOS"
+ ],
+ "dependence": {
+ "mode": "ALL",
+ "settings": [
+ {
+ "key": "validate_best_practices",
+ "value": true
+ }
+ ]
+ }
+ },
+ {
+ "key": "validate_best_practices_amd",
+ "label": "AMD-specific best practices",
+ "description": "Outputs warnings for spec-conforming but non-ideal code on AMD GPUs.",
+ "type": "BOOL",
+ "default": false,
+ "platforms": [
+ "WINDOWS",
+ "LINUX",
+ "MACOS"
+ ],
+ "dependence": {
+ "mode": "ALL",
+ "settings": [
+ {
+ "key": "validate_best_practices",
+ "value": true
+ }
+ ]
+ }
+ },
+ {
+ "key": "validate_best_practices_img",
+ "label": "IMG-specific best practices",
+ "description": "Outputs warnings for spec-conforming but non-ideal code on Imagination GPUs.",
+ "type": "BOOL",
+ "default": false,
+ "platforms": [
+ "WINDOWS",
+ "LINUX",
+ "MACOS"
+ ],
+ "dependence": {
+ "mode": "ALL",
+ "settings": [
+ {
+ "key": "validate_best_practices",
+ "value": true
+ }
+ ]
+ }
+ },
+ {
+ "key": "validate_best_practices_nvidia",
+ "label": "NVIDIA-specific best practices",
+ "description": "Outputs warnings for spec-conforming but non-ideal code on NVIDIA GPUs.",
+ "type": "BOOL",
+ "default": false,
+ "platforms": [
+ "WINDOWS",
+ "LINUX",
+ "ANDROID",
+ "OHOS"
+ ],
+ "dependence": {
+ "mode": "ALL",
+ "settings": [
+ {
+ "key": "validate_best_practices",
+ "value": true
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "key": "debug_action",
+ "label": "Debug Action",
+ "description": "Specifies what action is to be taken when a layer reports information",
+ "type": "FLAGS",
+ "flags": [
+ {
+ "key": "VK_DBG_LAYER_ACTION_LOG_MSG",
+ "label": "Log Message",
+ "description": "Log a txt message to stdout or to a log filename.",
+ "settings": [
+ {
+ "key": "log_filename",
+ "label": "Log Filename",
+ "description": "Specifies the output filename",
+ "type": "SAVE_FILE",
+ "default": "stdout",
+ "dependence": {
+ "mode": "ALL",
+ "settings": [
+ {
+ "key": "debug_action",
+ "value": [
+ "VK_DBG_LAYER_ACTION_LOG_MSG"
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ },
+ {
+ "key": "VK_DBG_LAYER_ACTION_CALLBACK",
+ "label": "Callback",
+ "description": "Call user defined callback function(s) that have been registered via the VK_EXT_debug_report extension. Since application must register callback, this is a NOOP for the settings file.",
+ "view": "HIDDEN"
+ },
+ {
+ "key": "VK_DBG_LAYER_ACTION_DEBUG_OUTPUT",
+ "label": "Debug Output",
+ "description": "Log a txt message using the Windows OutputDebugString function.",
+ "platforms": [
+ "WINDOWS"
+ ]
+ },
+ {
+ "key": "VK_DBG_LAYER_ACTION_BREAK",
+ "label": "Break",
+ "description": "Trigger a breakpoint if a debugger is in use."
+ }
+ ],
+ "default": [
+ "VK_DBG_LAYER_ACTION_LOG_MSG"
+ ]
+ },
+ {
+ "key": "report_flags",
+ "label": "Message Severity",
+ "description": "Comma-delineated list of options specifying the types of messages to be reported",
+ "type": "FLAGS",
+ "flags": [
+ {
+ "key": "info",
+ "label": "Info",
+ "description": "Report informational messages."
+ },
+ {
+ "key": "warn",
+ "label": "Warning",
+ "description": "Report warnings from using the API in a manner which may lead to undefined behavior or to warn the user of common trouble spots. A warning does NOT necessarily signify illegal application behavior."
+ },
+ {
+ "key": "perf",
+ "label": "Performance",
+ "description": "Report usage of the API that may cause suboptimal performance."
+ },
+ {
+ "key": "error",
+ "label": "Error",
+ "description": "Report errors in API usage."
+ },
+ {
+ "key": "debug",
+ "label": "Debug",
+ "description": "For layer development. Report messages for debugging layer behavior.",
+ "view": "HIDDEN"
+ }
+ ],
+ "default": [
+ "error"
+ ]
+ },
+ {
+ "key": "enable_message_limit",
+ "label": "Limit Duplicated Messages",
+ "description": "Enable limiting of duplicate messages.",
+ "type": "BOOL",
+ "default": true,
+ "settings": [
+ {
+ "key": "duplicate_message_limit",
+ "env": "VK_LAYER_DUPLICATE_MESSAGE_LIMIT",
+ "label": "Max Duplicated Messages",
+ "description": "Maximum number of times any single validation message should be reported.",
+ "type": "INT",
+ "default": 10,
+ "range": {
+ "min": 1
+ },
+ "dependence": {
+ "mode": "ALL",
+ "settings": [
+ {
+ "key": "enable_message_limit",
+ "value": true
+ }
+ ]
+ }
+ }
+ ]
+ },
+ {
+ "key": "message_id_filter",
+ "label": "Mute Message VUIDs",
+ "description": "List of VUIDs and VUID identifers which are to be IGNORED by the validation layer",
+ "type": "LIST",
+ "env": "VK_LAYER_MESSAGE_ID_FILTER",
+ "default": []
+ },
+ {
+ "key": "disables",
+ "label": "Disables",
+ "description": "Specify areas of validation to be disabled",
+ "type": "FLAGS",
+ "env": "VK_LAYER_DISABLES",
+ "flags": [
+ {
+ "key": "VK_VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT",
+ "label": "Thread Safety",
+ "description": "Thread checks. In order to not degrade performance, it might be best to run your program with thread-checking disabled most of the time, enabling it occasionally for a quick sanity check or when debugging difficult application behaviors."
+ },
+ {
+ "key": "VK_VALIDATION_FEATURE_DISABLE_API_PARAMETERS_EXT",
+ "label": "Stateless Parameter",
+ "description": "Stateless parameter checks. This may not always be necessary late in a development cycle."
+ },
+ {
+ "key": "VK_VALIDATION_FEATURE_DISABLE_OBJECT_LIFETIMES_EXT",
+ "label": "Object Lifetime",
+ "description": "Object tracking checks. This may not always be necessary late in a development cycle."
+ },
+ {
+ "key": "VK_VALIDATION_FEATURE_DISABLE_CORE_CHECKS_EXT",
+ "label": "Core",
+ "description": "The main, heavy-duty validation checks. This may be valuable early in the development cycle to reduce validation output while correcting parameter/object usage errors."
+ },
+ {
+ "key": "VK_VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT",
+ "label": "Handle Wrapping",
+ "description": "Handle wrapping checks. Disable this feature if you are exerience crashes when creating new extensions or developing new Vulkan objects/structures."
+ },
+ {
+ "key": "VK_VALIDATION_FEATURE_DISABLE_SHADERS_EXT",
+ "label": "Shader Validation",
+ "description": "Shader checks. These checks can be CPU intensive during application start up, especially if Shader Validation Caching is also disabled.",
+ "view": "ADVANCED"
+ },
+ {
+ "key": "VALIDATION_CHECK_DISABLE_COMMAND_BUFFER_STATE",
+ "label": "Command Buffer State",
+ "description": "Check that all Vulkan objects used by a command buffer have not been destroyed. These checks can be CPU intensive for some applications.",
+ "view": "ADVANCED"
+ },
+ {
+ "key": "VALIDATION_CHECK_DISABLE_IMAGE_LAYOUT_VALIDATION",
+ "label": "Image Layout",
+ "description": "Check that the layout of each image subresource is correct whenever it is used by a command buffer. These checks are very CPU intensive for some applications.",
+ "view": "ADVANCED"
+ },
+ {
+ "key": "VALIDATION_CHECK_DISABLE_QUERY_VALIDATION",
+ "label": "Query",
+ "description": "Checks for commands that use VkQueryPool objects.",
+ "view": "ADVANCED"
+ },
+ {
+ "key": "VALIDATION_CHECK_DISABLE_OBJECT_IN_USE",
+ "label": "Object in Use",
+ "description": "Check that Vulkan objects are not in use by a command buffer when they are destroyed.",
+ "view": "ADVANCED"
+ },
+ {
+ "key": "VALIDATION_CHECK_DISABLE_SYNCHRONIZATION_VALIDATION_QUEUE_SUBMIT",
+ "label": "QueueSubmit Synchronization Validation",
+ "description": "Check synchronization validation between submitted command buffers when Synchronization Validation is enabled.",
+ "view": "ADVANCED"
+ },
+ {
+ "key": "VK_VALIDATION_FEATURE_DISABLE_SHADER_VALIDATION_CACHE_EXT",
+ "label": "Shader Validation Caching",
+ "description": "Disable caching of shader validation results.",
+ "view": "ADVANCED"
+ }
+ ],
+ "default": [
+ "VK_VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT"
+ ]
+ },
+ {
+ "key": "enables",
+ "label": "Enables",
+ "description": "Setting an option here will enable specialized areas of validation",
+ "type": "FLAGS",
+ "env": "VK_LAYER_ENABLES",
+ "flags": [
+ {
+ "key": "VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT",
+ "label": "Synchronization",
+ "description": "This feature reports resource access conflicts due to missing or incorrect synchronization operations between actions (Draw, Copy, Dispatch, Blit) reading or writing the same regions of memory.",
+ "url": "${LUNARG_SDK}/synchronization_usage.html",
+ "status": "STABLE",
+ "platforms": [
+ "WINDOWS",
+ "LINUX",
+ "MACOS",
+ "ANDROID",
+ "OHOS"
+ ]
+ },
+ {
+ "key": "VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT",
+ "label": "Debug Printf",
+ "description": "Enables processing of debug printf instructions in shaders and sending debug strings to the debug callback.",
+ "url": "${LUNARG_SDK}/debug_printf.html",
+ "status": "STABLE",
+ "platforms": [
+ "WINDOWS",
+ "LINUX"
+ ]
+ },
+ {
+ "key": "VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT",
+ "label": "GPU-Assisted",
+ "description": "Check for API usage errors at shader execution time.",
+ "url": "${LUNARG_SDK}/gpu_validation.html",
+ "platforms": [
+ "WINDOWS",
+ "LINUX"
+ ]
+ },
+ {
+ "key": "VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT",
+ "label": "Reserve Descriptor Set Binding Slot",
+ "description": "Specifies that the validation layers reserve a descriptor set binding slot for their own use. The layer reports a value for VkPhysicalDeviceLimits::maxBoundDescriptorSets that is one less than the value reported by the device. If the device supports the binding of only one descriptor set, the validation layer does not perform GPU-assisted validation.",
+ "platforms": [
+ "WINDOWS",
+ "LINUX"
+ ]
+ },
+ {
+ "key": "VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT",
+ "label": "Best Practices",
+ "description": "Activating this feature enables the output of warnings related to common misuse of the API, but which are not explicitly prohibited by the specification.",
+ "url": "${LUNARG_SDK}/best_practices.html",
+ "platforms": [
+ "WINDOWS",
+ "LINUX",
+ "MACOS",
+ "ANDROID",
+ "OHOS"
+ ]
+ },
+ {
+ "key": "VALIDATION_CHECK_ENABLE_VENDOR_SPECIFIC_ARM",
+ "label": "ARM-specific best practices",
+ "description": "Activating this feature enables the output of warnings related to ARM-specific misuse of the API, but which are not explicitly prohibited by the specification.",
+ "platforms": [
+ "WINDOWS",
+ "LINUX",
+ "MACOS",
+ "ANDROID",
+ "OHOS"
+ ]
+ },
+ {
+ "key": "VALIDATION_CHECK_ENABLE_VENDOR_SPECIFIC_AMD",
+ "label": "AMD-specific best practices",
+ "description": "Adds check for spec-conforming but non-ideal code on AMD GPUs.",
+ "platforms": [
+ "WINDOWS",
+ "LINUX",
+ "MACOS"
+ ]
+ },
+ {
+ "key": "VALIDATION_CHECK_ENABLE_VENDOR_SPECIFIC_IMG",
+ "label": "IMG-specific best practices",
+ "description": "Adds check for spec-conforming but non-ideal code on Imagination GPUs.",
+ "platforms": [
+ "WINDOWS",
+ "LINUX",
+ "MACOS"
+ ]
+ },
+ {
+ "key": "VALIDATION_CHECK_ENABLE_VENDOR_SPECIFIC_NVIDIA",
+ "label": "NVIDIA-specific best practices",
+ "description": "Activating this feature enables the output of warnings related to NVIDIA-specific misuse of the API, but which are not explicitly prohibited by the specification.",
+ "platforms": [
+ "WINDOWS",
+ "LINUX",
+ "ANDROID",
+ "OHOS"
+ ]
+ },
+ {
+ "key": "VALIDATION_CHECK_ENABLE_VENDOR_SPECIFIC_ALL",
+ "label": "Hardware specific best practices",
+ "description": "Activating this feature enables all vendor specific best practices.",
+ "platforms": [
+ "WINDOWS",
+ "LINUX",
+ "ANDROID",
+ "OHOS"
+ ]
+ }
+ ],
+ "default": []
+ }
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/scripts/ohos-patches/Vulkan-Headers.patch b/scripts/ohos-patches/Vulkan-Headers.patch
new file mode 100644
index 0000000000000000000000000000000000000000..7a5adaaa45d272bcaa37e4145020fe8aa16d5748
Binary files /dev/null and b/scripts/ohos-patches/Vulkan-Headers.patch differ
diff --git a/scripts/ohos-patches/Vulkan-Utility-Libraries.patch b/scripts/ohos-patches/Vulkan-Utility-Libraries.patch
new file mode 100644
index 0000000000000000000000000000000000000000..5d233eaa748aa6f922e2c6ef39aafce6e60b066f
Binary files /dev/null and b/scripts/ohos-patches/Vulkan-Utility-Libraries.patch differ
diff --git a/scripts/ohos-patches/compile.bat b/scripts/ohos-patches/compile.bat
new file mode 100644
index 0000000000000000000000000000000000000000..4dd3082b9b3731e9fe16547e5753a5e62e6b2961
--- /dev/null
+++ b/scripts/ohos-patches/compile.bat
@@ -0,0 +1,73 @@
+REM Copyright (c) 2024 Huawei Device Co., Ltd.
+REM Licensed under the Apache License, Version 2.0 (the "License");
+REM you may not use this file except in compliance with the License.
+REM You may obtain a copy of the License at
+REM
+REM http://www.apache.org/licenses/LICENSE-2.0
+REM
+REM Unless required by applicable law or agreed to in writing, software
+REM distributed under the License is distributed on an "AS IS" BASIS,
+REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+REM See the License for the specific language governing permissions and
+REM limitations under the License.
+
+
+@echo off
+cls
+
+set OHOS_SDK=C:/Users/Administrator/AppData/Local/OpenHarmony/Sdk/12/native
+set VVL_DIR=E:/WorkSpace/Vulkan/VVL/third_party_vulkan-validationlayers
+set BUILD_THREADS=8
+
+REM -----------------------------------------------------------------------------------------------------
+
+set buildDir=%VVL_DIR%/build-ohos/intermediate
+set libDir=%VVL_DIR%/build-ohos/libs
+
+REM Using CMake from OHOS SDK...
+
+set PATH=%OHOS_SDK%/build-tools/cmake/bin;%PATH%
+
+REM Making project files...
+
+cd /d %VVL_DIR%
+
+cmake ^
+ -S . ^
+ -B %buildDir% ^
+ -G Ninja ^
+ -D OHOS_STL=c++_static ^
+ -D CMAKE_INSTALL_LIBDIR=%libDir% ^
+ -D CMAKE_TOOLCHAIN_FILE=%OHOS_SDK%/build/cmake/ohos.toolchain.cmake ^
+ -D CMAKE_BUILD_TYPE=Release ^
+ -D VVL_CODEGEN=OFF ^
+ -D UPDATE_DEPS=ON ^
+ -D UPDATE_DEPS_DIR=%buildDir%
+
+REM Codegen boilerplate code from Vulkan registry (vk.xml from Vulkan-Headers)...
+
+cmake ^
+ --build %buildDir% ^
+ --target vvl_codegen
+
+REM Building projects...
+
+cmake ^
+ --build %buildDir% ^
+ --parallel %BUILD_THREADS%
+
+REM Stripping binaries and copying them into final directory...
+
+if not exist "%libDir%" (
+ mkdir "%libDir%"
+)
+
+cd /d %OHOS_SDK%/llvm/bin
+
+llvm-strip ^
+ -d ^
+ -s ^
+ -o "%libDir%/libVkLayer_khronos_validation.so" ^
+ "%buildDir%/layers/libVkLayer_khronos_validation.so"
+
+echo Done.
diff --git a/scripts/ohos-patches/glslang.patch b/scripts/ohos-patches/glslang.patch
new file mode 100644
index 0000000000000000000000000000000000000000..b63c9bbe4563ebe0c9aa412b9910e9a5b61a4152
--- /dev/null
+++ b/scripts/ohos-patches/glslang.patch
@@ -0,0 +1,13 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 5cdd3e31..6931b850 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -30,7 +30,7 @@
+ # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ # POSSIBILITY OF SUCH DAMAGE.
+-cmake_minimum_required(VERSION 3.17.2)
++cmake_minimum_required(VERSION 3.16.5)
+ project(glslang)
+
+ if (CMAKE_VERSION VERSION_LESS "3.21")