[Bf-blender-cvs] [40db778de3c] soc-2019-openxr: Add sources for OpenXR core API validation layer

Julian Eisel noreply at git.blender.org
Thu Aug 1 00:58:27 CEST 2019


Commit: 40db778de3c146539d6b3ecab4497e3ac5a2d158
Author: Julian Eisel
Date:   Thu Aug 1 00:25:55 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rB40db778de3c146539d6b3ecab4497e3ac5a2d158

Add sources for OpenXR core API validation layer

Had to do quite some changes to CMakeLists.txt from the SDK this time.

===================================================================

A	extern/openxr/src/api_layers/CMakeLists.txt
A	extern/openxr/src/api_layers/XrApiLayer_core_validation.def
A	extern/openxr/src/api_layers/XrApiLayer_core_validation.json
A	extern/openxr/src/api_layers/api_layer_platform_defines.h
A	extern/openxr/src/api_layers/core_validation.cpp
A	extern/openxr/src/api_layers/validation_utils.h
A	extern/openxr/src/api_layers/xr_generated_core_validation.cpp
A	extern/openxr/src/api_layers/xr_generated_core_validation.hpp

===================================================================

diff --git a/extern/openxr/src/api_layers/CMakeLists.txt b/extern/openxr/src/api_layers/CMakeLists.txt
new file mode 100644
index 00000000000..86e95e92a8c
--- /dev/null
+++ b/extern/openxr/src/api_layers/CMakeLists.txt
@@ -0,0 +1,104 @@
+# Copyright (c) 2017-2019 The Khronos Group Inc.
+#
+# 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.
+#
+# Author:
+#
+
+# Force all compilers to output to binary folder without additional output (like Windows adds "Debug" and "Release" folders)
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
+    string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG)
+    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_CURRENT_BINARY_DIR})
+    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_CURRENT_BINARY_DIR})
+    set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_CURRENT_BINARY_DIR})
+endforeach(OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES)
+
+# Copy the api_layer_platform_defines.h file and place it in the binary (build) directory.
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/api_layer_platform_defines.h ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
+
+# Basics for core_validation API Layer
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/XrApiLayer_core_validation.json ${CMAKE_CURRENT_BINARY_DIR}/XrApiLayer_core_validation.json COPYONLY)
+
+add_library(XrApiLayer_core_validation SHARED
+    core_validation.cpp
+    ${OPENXR_ROOT_DIR}/src/common/hex_and_handles.cpp
+    ${OPENXR_ROOT_DIR}/src/common/hex_and_handles.h
+    ${OPENXR_ROOT_DIR}/src/xr_generated_dispatch_table.c
+    ${OPENXR_ROOT_DIR}/src/api_layers/xr_generated_core_validation.cpp
+    ${OPENXR_ROOT_DIR}/src/api_layers/xr_generated_core_validation.hpp
+    # Included in this list to force generation
+    ${CMAKE_CURRENT_BINARY_DIR}/XrApiLayer_core_validation.json
+)
+set_target_properties(XrApiLayer_core_validation PROPERTIES FOLDER ${API_LAYERS_FOLDER})
+
+add_dependencies(XrApiLayer_core_validation
+    generate_openxr_header
+    xr_global_generated_files
+)
+target_include_directories(XrApiLayer_core_validation
+    PRIVATE ${OPENXR_ROOT_DIR}/src/common
+    PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
+    PRIVATE ${CMAKE_BINARY_DIR}/include
+    PRIVATE ${CMAKE_BINARY_DIR}/src
+    PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
+)
+if(VulkanHeaders_FOUND)
+    target_include_directories(XrApiLayer_core_validation
+        PRIVATE ${Vulkan_INCLUDE_DIRS}
+    )
+endif()
+
+# Flag generated files
+set_source_files_properties(
+    ${CMAKE_BINARY_DIR}/src/xr_generated_dispatch_table.c
+    PROPERTIES GENERATED TRUE
+)
+
+if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+    # Windows core_validation-specific information
+    target_compile_definitions(XrApiLayer_core_validation PRIVATE _CRT_SECURE_NO_WARNINGS)
+    # Turn off transitional "changed behavior" warning message for Visual Studio versions prior to 2015.
+    # The changed behavior is that constructor initializers are now fixed to clear the struct members.
+    target_compile_options(XrApiLayer_core_validation PRIVATE "$<$<AND:$<CXX_COMPILER_ID:MSVC>,$<VERSION_LESS:$<CXX_COMPILER_VERSION>,19>>:/wd4351>")
+
+    FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/XrApiLayer_core_validation.def DEF_FILE)
+    add_custom_target(copy-core_validation-def-file ALL
+        COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DEF_FILE} ${CMAKE_CURRENT_BINARY_DIR}/XrApiLayer_core_validation.def
+        VERBATIM
+    )
+	set_target_properties(copy-core_validation-def-file PROPERTIES FOLDER ${HELPER_FOLDER})
+elseif(APPLE)
+    # Apple core_validation-specific information
+    target_compile_options(XrApiLayer_core_validation PRIVATE -Wpointer-arith -Wno-unused-function -Wno-sign-compare)
+    set_target_properties(XrApiLayer_core_validation PROPERTIES LINK_FLAGS "-Wl")
+
+else()
+    # Linux core_validation-specific information
+    target_compile_options(XrApiLayer_core_validation PRIVATE -Wpointer-arith -Wno-unused-function -Wno-sign-compare)
+    set_target_properties(XrApiLayer_core_validation PROPERTIES LINK_FLAGS "-Wl,-Bsymbolic,--exclude-libs,ALL")
+endif()
+
+# Install explicit layers on Linux
+set(TARGET_NAMES
+    XrApiLayer_api_dump
+    XrApiLayer_core_validation)
+if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+    foreach(TARGET_NAME ${TARGET_NAMES})
+        install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.json DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/openxr/${MAJOR}/api_layers/explicit.d)
+        install(TARGETS ${TARGET_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
+    endforeach()
+endif()
diff --git a/extern/openxr/src/api_layers/XrApiLayer_core_validation.def b/extern/openxr/src/api_layers/XrApiLayer_core_validation.def
new file mode 100644
index 00000000000..668aafcc7a2
--- /dev/null
+++ b/extern/openxr/src/api_layers/XrApiLayer_core_validation.def
@@ -0,0 +1,27 @@
+
+;;;; Begin Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;
+; Copyright (c) 2017-2019 The Khronos Group Inc.
+; Copyright (c) 2017-2019 Valve Corporation
+; Copyright (c) 2017-2019 LunarG, Inc.
+;
+; 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.
+;
+;  Author: Mark Young <marky at lunarg.com>
+;
+;;;;  End Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+LIBRARY XrApiLayer_core_validation
+EXPORTS
+xrNegotiateLoaderApiLayerInterface
+
diff --git a/extern/openxr/src/api_layers/XrApiLayer_core_validation.json b/extern/openxr/src/api_layers/XrApiLayer_core_validation.json
new file mode 100644
index 00000000000..f0d7a6974a1
--- /dev/null
+++ b/extern/openxr/src/api_layers/XrApiLayer_core_validation.json
@@ -0,0 +1,10 @@
+{
+    "file_format_version": "1.0.0",
+    "api_layer": {
+        "name": "XR_APILAYER_LUNARG_core_validation",
+        "library_path": "libXrApiLayer_core_validation.dll",
+        "api_version": "1.0",
+        "implementation_version": "1",
+        "description": "API Layer to perform validation of api calls and parameters as they occur"
+    }
+}
diff --git a/extern/openxr/src/api_layers/api_layer_platform_defines.h b/extern/openxr/src/api_layers/api_layer_platform_defines.h
new file mode 100644
index 00000000000..fc247d16f9a
--- /dev/null
+++ b/extern/openxr/src/api_layers/api_layer_platform_defines.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2018-2019 The Khronos Group Inc.
+// Copyright (c) 2018-2019 Valve Corporation
+// Copyright (c) 2018-2019 LunarG, Inc.
+//
+// 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.
+//
+// Author: Mark Young <marky at lunarg.com>
+//
+
+#ifndef API_LAYER_PLATFORM_DEFINES_H_
+#define API_LAYER_PLATFORM_DEFINES_H_ 1
+
+#ifdef _WIN32
+#define XR_USE_PLATFORM_WIN32 1  // Win32 platform
+#endif                           // _WIN32
+#if defined(OS_LINUX_XLIB)
+#define XR_USE_PLATFORM_XLIB 1  // Xlib platform
+#endif                          // OS_LINUX_XLIB
+#if defined(OS_LINUX_XCB) || defined(OS_LINUX_XCB_GLX)
+#define XR_USE_PLATFORM_XCB 1  // Xcb platform
+#endif                         // OS_LINUX_XCB || OS_LINUX_XCB_GLX
+#if defined(OS_LINUX_WAYLAND)
+#define XR_USE_PLATFORM_WAYLAND 1  // Wayland platform
+#endif                             // OS_LINUX_WAYLAND
+#if defined(XR_OS_APPLE_IOS)
+#define XR_USE_PLATFORM_IOS 1            // iOS platform
+#define XR_USE_GRAPHICS_API_OPENGL_ES 1  // OpenGLES exists
+#define XR_USE_GRAPHICS_API_METAL 1      // Metal exists
+#endif                                   // XR_OS_APPLE_IOS
+#if defined(XR_OS_APPLE_MACOS)
+#define XR_USE_PLATFORM_MACOS 1       // MacOS platform
+#define XR_USE_GRAPHICS_API_OPENGL 1  // OpenGL exists
+#define XR_USE_GRAPHICS_API_METAL 1   // Metal exists
+#endif                                // XR_OS_APPLE_MACOS
+
+#include "xr_dependencies.h"  // IWYU pragma: export
+
+#endif  // API_LAYER_PLATFORM_DEFINES_H_
diff --git a/extern/openxr/src/api_layers/core_validation.cpp b/extern/openxr/src/api_layers/core_validation.cpp
new file mode 100644
index 00000000000..388359a83e6
--- /dev/null
+++ b/extern/openxr/src/api_layers/core_validation.cpp
@@ -0,0 +1,932 @@
+// Copyright (c) 2017-2019 The Khronos Group Inc.
+// Copyright (c) 2017-2019 Valve Corporation
+// Copyright (c) 2017-2019 LunarG, Inc.
+//
+// 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,

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list