From a140881427ef6f20c58b31c120eb1b53d36eb3bd Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Fri, 22 Dec 2023 21:23:31 -0600 Subject: [PATCH] OpenXR CTS 1.0.32.1 (2023-12-14) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A notable change in this release, is that the build system now checks for git commit/tag information at configure time and reports this information in the CTS logs. If you have taken any porting steps that involve changing the build system, be sure to update your changes accordingly. See the README for more information. There is one known issue with the new PBR rendering subsystem, but it only affects running a self test under Vulkan, which is not required for conformance submissions. It will be fixed in the next release. - Conformance Tests - Fix: Handle the loader passing xrInitializeLoaderKHR calls to enabled API layers if XR_KHR_loader_init is enabled, per ratified update to that extension. (internal MR 2703, internal MR 3033) - Fix: comment typo in environment source. (internal MR 2991) - Fix: Correct linking to GLX when glvnd is not found on the system. (internal MR 3000) - Fix: Warning/build fix (internal MR 3008) - Fix: Correct the object naming of command lists on D3D12. (internal MR 3066) - Improvement: Add PBR rendering subsystem for loading and rendering of glTF assets. (internal MR 2501, internal issue 1726, internal MR 2758, internal MR 3038, internal MR 3081) - Improvement: Clean up our CMake build substantially, correcting dependencies and narrowing the scope of includes. (internal MR 2886) - Improvement: Include git revision information in all reports, and generate test warnings in case of not matching a release tag, etc. (internal MR 2964, internal issue 2041) - Improvement: Build system cleanup. (internal MR 2987) - Improvement: Update configuration for Doxygen source-code documentation generator/extractor. (internal MR 2988) - Improvement: Use “matchers” rather than STL algorithms to verify that supported environment blend modes do not include an invalid value. (internal MR 2994) - New test: Interactive (rendering) test of XR_MSFT_controller_model as an initial usage of the glTF/PBR rendering. (internal MR 2501, internal issue 1726, internal MR 2758, internal MR 3038, internal MR 3081) - New test: Try zero XrTime values in hand tracking joints test. (internal MR 2951) GitOrigin-RevId: d3f6efc6549af9cc244e28ac66c622a7b3411e12 --- CHANGELOG.CTS.md | 58 ++++ README.md | 16 + changes/conformance/mr.2501.gl.md | 7 - changes/conformance/mr.2703.gl.md | 5 - changes/conformance/mr.2886.gl.md | 1 - changes/conformance/mr.2951.gl.md | 1 - changes/conformance/mr.2987.gl.md | 1 - changes/conformance/mr.2988.gl.md | 1 - changes/conformance/mr.2991.gl.md | 1 - changes/conformance/mr.2994.gl.md | 1 - changes/conformance/mr.3000.gl.md | 1 - changes/conformance/mr.3008.gl.md | 4 - src/cmake/GetGitRevisionDescription.cmake | 285 ++++++++++++++++++ src/cmake/GetGitRevisionDescription.cmake.in | 46 +++ .../conformance_test/conformance_test.cpp | 35 ++- src/conformance/conformance_test/readme.md | 16 + src/conformance/ctsxml.rnc | 11 + .../framework/graphics_plugin_d3d11_gltf.cpp | 6 +- .../framework/graphics_plugin_d3d12.cpp | 2 +- src/conformance/framework/pbr/PbrModel.h | 6 +- .../framework/xml_test_environment.cpp | 13 + src/conformance/utilities/CMakeLists.txt | 41 +++ src/conformance/utilities/git_revision.cpp.in | 36 +++ src/conformance/utilities/git_revision.h | 24 ++ 24 files changed, 585 insertions(+), 33 deletions(-) delete mode 100644 changes/conformance/mr.2501.gl.md delete mode 100644 changes/conformance/mr.2703.gl.md delete mode 100644 changes/conformance/mr.2886.gl.md delete mode 100644 changes/conformance/mr.2951.gl.md delete mode 100644 changes/conformance/mr.2987.gl.md delete mode 100644 changes/conformance/mr.2988.gl.md delete mode 100644 changes/conformance/mr.2991.gl.md delete mode 100644 changes/conformance/mr.2994.gl.md delete mode 100644 changes/conformance/mr.3000.gl.md delete mode 100644 changes/conformance/mr.3008.gl.md create mode 100644 src/cmake/GetGitRevisionDescription.cmake create mode 100644 src/cmake/GetGitRevisionDescription.cmake.in create mode 100644 src/conformance/utilities/git_revision.cpp.in create mode 100644 src/conformance/utilities/git_revision.h diff --git a/CHANGELOG.CTS.md b/CHANGELOG.CTS.md index f0856a21..a0c65b64 100644 --- a/CHANGELOG.CTS.md +++ b/CHANGELOG.CTS.md @@ -17,6 +17,64 @@ particular, since it is primarily software, pull requests may be integrated as they are accepted even between periodic updates. However, versions that are not signed tags on the `approved` branch are not valid for conformance submission. +## OpenXR CTS 1.0.32.1 (2023-12-14) + +A notable change in this release, is that the build system now checks for git +commit/tag information at configure time and reports this information in the CTS +logs. If you have taken any porting steps that involve changing the build +system, be sure to update your changes accordingly. See the README for more +information. + +There is one known issue with the new PBR rendering subsystem, but it only +affects running a self test under Vulkan, which is not required for conformance +submissions. It will be fixed in the next release. + +- Conformance Tests + - Fix: Handle the loader passing `xrInitializeLoaderKHR` calls to enabled API + layers if `XR_KHR_loader_init` is enabled, per ratified update to that + extension. + ([internal MR 2703](https://gitlab.khronos.org/openxr/openxr/merge_requests/2703), + [internal MR 3033](https://gitlab.khronos.org/openxr/openxr/merge_requests/3033)) + - Fix: comment typo in environment source. + ([internal MR 2991](https://gitlab.khronos.org/openxr/openxr/merge_requests/2991)) + - Fix: Correct linking to GLX when glvnd is not found on the system. + ([internal MR 3000](https://gitlab.khronos.org/openxr/openxr/merge_requests/3000)) + - Fix: Warning/build fix + ([internal MR 3008](https://gitlab.khronos.org/openxr/openxr/merge_requests/3008)) + - Fix: Correct the object naming of command lists on D3D12. + ([internal MR 3066](https://gitlab.khronos.org/openxr/openxr/merge_requests/3066)) + - Improvement: Add PBR rendering subsystem for loading and rendering of glTF + assets. + ([internal MR 2501](https://gitlab.khronos.org/openxr/openxr/merge_requests/2501), + [internal issue 1726](https://gitlab.khronos.org/openxr/openxr/issues/1726), + [internal MR 2758](https://gitlab.khronos.org/openxr/openxr/merge_requests/2758), + [internal MR 3038](https://gitlab.khronos.org/openxr/openxr/merge_requests/3038), + [internal MR 3081](https://gitlab.khronos.org/openxr/openxr/merge_requests/3081)) + - Improvement: Clean up our CMake build substantially, correcting dependencies + and narrowing the scope of includes. + ([internal MR 2886](https://gitlab.khronos.org/openxr/openxr/merge_requests/2886)) + - Improvement: Include git revision information in all reports, and generate test + warnings in case of not matching a release tag, etc. + ([internal MR 2964](https://gitlab.khronos.org/openxr/openxr/merge_requests/2964), + [internal issue 2041](https://gitlab.khronos.org/openxr/openxr/issues/2041)) + - Improvement: Build system cleanup. + ([internal MR 2987](https://gitlab.khronos.org/openxr/openxr/merge_requests/2987)) + - Improvement: Update configuration for Doxygen source-code documentation + generator/extractor. + ([internal MR 2988](https://gitlab.khronos.org/openxr/openxr/merge_requests/2988)) + - Improvement: Use "matchers" rather than STL algorithms to verify that supported + environment blend modes do not include an invalid value. + ([internal MR 2994](https://gitlab.khronos.org/openxr/openxr/merge_requests/2994)) + - New test: Interactive (rendering) test of `XR_MSFT_controller_model` as an + initial usage of the glTF/PBR rendering. + ([internal MR 2501](https://gitlab.khronos.org/openxr/openxr/merge_requests/2501), + [internal issue 1726](https://gitlab.khronos.org/openxr/openxr/issues/1726), + [internal MR 2758](https://gitlab.khronos.org/openxr/openxr/merge_requests/2758), + [internal MR 3038](https://gitlab.khronos.org/openxr/openxr/merge_requests/3038), + [internal MR 3081](https://gitlab.khronos.org/openxr/openxr/merge_requests/3081)) + - New test: Try zero XrTime values in hand tracking joints test. + ([internal MR 2951](https://gitlab.khronos.org/openxr/openxr/merge_requests/2951)) + ## OpenXR CTS 1.0.30.0 (2023-10-12) - Conformance Tests diff --git a/README.md b/README.md index 41497546..1884334d 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,22 @@ does not support a command-line interface, a host application must be built for the device which the OpenXR runtime will run on. The conformance host must invoke `conformance_test`, the test suite shared library. +When you plan to submit for conformance, you must observe a few considerations +to ensure that the build system has accurate source code revision information +available to embed in the test suite and output reports. You must build from a +git repo (forked from either the internal Gitlab or public GitHub) with tags +available (a full clone, not shallow). You also must either perform a clean +build, from an empty binary tree, or at least run `cmake` immediately before +building to pick up current source tree status. If your "porting" process (as +described by the conformance process documents) involves replacing the build +system, you must populate the revision data constants in +`utilities/git_revision.cpp.in` accurately. The contents of that file affect all +"ctsxml" format outputs, as well as an automated "SourceCodeRevision" test that +warns if it cannot identify an approved release. (It only checks for the +presence of an appropriately-named tag: it does not check for a signature on the +tag, so if you have added tags to your repo it may not warn if you are not on a +release.) + Running CTS ----------- diff --git a/changes/conformance/mr.2501.gl.md b/changes/conformance/mr.2501.gl.md deleted file mode 100644 index 43cd559d..00000000 --- a/changes/conformance/mr.2501.gl.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -- issue.1726.gl -- mr.2758.gl -- mr.3038.gl ---- -- Improvement: Add PBR rendering subsystem for loading and rendering of glTF assets. -- New test: Interactive (rendering) test of `XR_MSFT_controller_model` as an initial usage of the glTF/PBR rendering. diff --git a/changes/conformance/mr.2703.gl.md b/changes/conformance/mr.2703.gl.md deleted file mode 100644 index 0adbda69..00000000 --- a/changes/conformance/mr.2703.gl.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -- mr.2703.gl -- mr.3033.gl ---- -Improvement: Handle the loader passing `xrInitializeLoaderKHR` calls to enabled API layers if `XR_KHR_loader_init` is enabled, per ratified update to that extension. diff --git a/changes/conformance/mr.2886.gl.md b/changes/conformance/mr.2886.gl.md deleted file mode 100644 index b746ca59..00000000 --- a/changes/conformance/mr.2886.gl.md +++ /dev/null @@ -1 +0,0 @@ -Improvement: Clean up our CMake build substantially, correcting dependencies and narrowing the scope of includes. diff --git a/changes/conformance/mr.2951.gl.md b/changes/conformance/mr.2951.gl.md deleted file mode 100644 index 0045fa48..00000000 --- a/changes/conformance/mr.2951.gl.md +++ /dev/null @@ -1 +0,0 @@ -- New test: Try zero XrTime values in hand tracking joints test. diff --git a/changes/conformance/mr.2987.gl.md b/changes/conformance/mr.2987.gl.md deleted file mode 100644 index 7e09407b..00000000 --- a/changes/conformance/mr.2987.gl.md +++ /dev/null @@ -1 +0,0 @@ -Improvement: Build system cleanup. diff --git a/changes/conformance/mr.2988.gl.md b/changes/conformance/mr.2988.gl.md deleted file mode 100644 index bd61c8a0..00000000 --- a/changes/conformance/mr.2988.gl.md +++ /dev/null @@ -1 +0,0 @@ -Improvement: Update configuration for Doxygen source-code documentation generator/extractor. diff --git a/changes/conformance/mr.2991.gl.md b/changes/conformance/mr.2991.gl.md deleted file mode 100644 index c6d5e973..00000000 --- a/changes/conformance/mr.2991.gl.md +++ /dev/null @@ -1 +0,0 @@ -Fix: comment typo in environment source. diff --git a/changes/conformance/mr.2994.gl.md b/changes/conformance/mr.2994.gl.md deleted file mode 100644 index eca0f9ef..00000000 --- a/changes/conformance/mr.2994.gl.md +++ /dev/null @@ -1 +0,0 @@ -Improvement: Use "matchers" rather than STL algorithms to verify that supported environment blend modes do not include an invalid value. diff --git a/changes/conformance/mr.3000.gl.md b/changes/conformance/mr.3000.gl.md deleted file mode 100644 index 75502bef..00000000 --- a/changes/conformance/mr.3000.gl.md +++ /dev/null @@ -1 +0,0 @@ -Fix: Correct linking to GLX when glvnd is not found on the system. diff --git a/changes/conformance/mr.3008.gl.md b/changes/conformance/mr.3008.gl.md deleted file mode 100644 index bbb0334f..00000000 --- a/changes/conformance/mr.3008.gl.md +++ /dev/null @@ -1,4 +0,0 @@ ---- -- mr.3008.gl ---- -- Fix: Warning/build fix diff --git a/src/cmake/GetGitRevisionDescription.cmake b/src/cmake/GetGitRevisionDescription.cmake new file mode 100644 index 00000000..bee0fba5 --- /dev/null +++ b/src/cmake/GetGitRevisionDescription.cmake @@ -0,0 +1,285 @@ +# - Returns a version string from Git +# +# These functions force a re-configure on each git commit so that you can +# trust the values of the variables in your build system. +# +# get_git_head_revision( [ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR]) +# +# Returns the refspec and sha hash of the current head revision +# +# git_describe( [ ...]) +# +# Returns the results of git describe on the source tree, and adjusting +# the output so that it tests false if an error occurs. +# +# git_describe_working_tree( [ ...]) +# +# Returns the results of git describe on the working tree (--dirty option), +# and adjusting the output so that it tests false if an error occurs. +# +# git_get_exact_tag( [ ...]) +# +# Returns the results of git describe --exact-match on the source tree, +# and adjusting the output so that it tests false if there was no exact +# matching tag. +# +# git_local_changes() +# +# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes. +# Uses the return code of "git diff-index --quiet HEAD --". +# Does not regard untracked files. +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2020 Ryan Pavlik +# http://academic.cleardefinition.com +# +# Copyright 2009-2013, Iowa State University. +# Copyright 2013-2020, Ryan Pavlik +# Copyright 2013-2020, Contributors +# SPDX-License-Identifier: BSL-1.0 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__get_git_revision_description) + return() +endif() +set(__get_git_revision_description YES) + +# We must run the following at "include" time, not at function call time, +# to find the path to this module rather than the path to a calling list file +get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH) + +# Function _git_find_closest_git_dir finds the next closest .git directory +# that is part of any directory in the path defined by _start_dir. +# The result is returned in the parent scope variable whose name is passed +# as variable _git_dir_var. If no .git directory can be found, the +# function returns an empty string via _git_dir_var. +# +# Example: Given a path C:/bla/foo/bar and assuming C:/bla/.git exists and +# neither foo nor bar contain a file/directory .git. This will return +# C:/bla/.git +# +function(_git_find_closest_git_dir _start_dir _git_dir_var) + set(cur_dir "${_start_dir}") + set(git_dir "${_start_dir}/.git") + while(NOT EXISTS "${git_dir}") + # .git dir not found, search parent directories + set(git_previous_parent "${cur_dir}") + get_filename_component(cur_dir "${cur_dir}" DIRECTORY) + if(cur_dir STREQUAL git_previous_parent) + # We have reached the root directory, we are not in git + set(${_git_dir_var} + "" + PARENT_SCOPE) + return() + endif() + set(git_dir "${cur_dir}/.git") + endwhile() + set(${_git_dir_var} + "${git_dir}" + PARENT_SCOPE) +endfunction() + +function(get_git_head_revision _refspecvar _hashvar) + _git_find_closest_git_dir("${CMAKE_CURRENT_SOURCE_DIR}" GIT_DIR) + + if("${ARGN}" STREQUAL "ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR") + set(ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR TRUE) + else() + set(ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR FALSE) + endif() + if(NOT "${GIT_DIR}" STREQUAL "") + file(RELATIVE_PATH _relative_to_source_dir "${CMAKE_SOURCE_DIR}" + "${GIT_DIR}") + if("${_relative_to_source_dir}" MATCHES "[.][.]" + AND NOT ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR) + # We've gone above the CMake root dir. + set(GIT_DIR "") + endif() + endif() + if("${GIT_DIR}" STREQUAL "") + set(${_refspecvar} + "GITDIR-NOTFOUND" + PARENT_SCOPE) + set(${_hashvar} + "GITDIR-NOTFOUND" + PARENT_SCOPE) + return() + endif() + + # Check if the current source dir is a git submodule or a worktree. + # In both cases .git is a file instead of a directory. + # + if(NOT IS_DIRECTORY ${GIT_DIR}) + # The following git command will return a non empty string that + # points to the super project working tree if the current + # source dir is inside a git submodule. + # Otherwise the command will return an empty string. + # + execute_process( + COMMAND "${GIT_EXECUTABLE}" rev-parse + --show-superproject-working-tree + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + OUTPUT_VARIABLE out + ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT "${out}" STREQUAL "") + # If out is empty, GIT_DIR/CMAKE_CURRENT_SOURCE_DIR is in a submodule + file(READ ${GIT_DIR} submodule) + string(REGEX REPLACE "gitdir: (.*)$" "\\1" GIT_DIR_RELATIVE + ${submodule}) + string(STRIP ${GIT_DIR_RELATIVE} GIT_DIR_RELATIVE) + get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH) + get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} + ABSOLUTE) + set(HEAD_SOURCE_FILE "${GIT_DIR}/HEAD") + else() + # GIT_DIR/CMAKE_CURRENT_SOURCE_DIR is in a worktree + file(READ ${GIT_DIR} worktree_ref) + # The .git directory contains a path to the worktree information directory + # inside the parent git repo of the worktree. + # + string(REGEX REPLACE "gitdir: (.*)$" "\\1" git_worktree_dir + ${worktree_ref}) + string(STRIP ${git_worktree_dir} git_worktree_dir) + _git_find_closest_git_dir("${git_worktree_dir}" GIT_DIR) + set(HEAD_SOURCE_FILE "${git_worktree_dir}/HEAD") + endif() + else() + set(HEAD_SOURCE_FILE "${GIT_DIR}/HEAD") + endif() + set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data") + if(NOT EXISTS "${GIT_DATA}") + file(MAKE_DIRECTORY "${GIT_DATA}") + endif() + + if(NOT EXISTS "${HEAD_SOURCE_FILE}") + return() + endif() + set(HEAD_FILE "${GIT_DATA}/HEAD") + configure_file("${HEAD_SOURCE_FILE}" "${HEAD_FILE}" COPYONLY) + + configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in" + "${GIT_DATA}/grabRef.cmake" @ONLY) + include("${GIT_DATA}/grabRef.cmake") + + set(${_refspecvar} + "${HEAD_REF}" + PARENT_SCOPE) + set(${_hashvar} + "${HEAD_HASH}" + PARENT_SCOPE) +endfunction() + +function(git_describe _var) + if(NOT GIT_FOUND) + find_package(Git QUIET) + endif() + get_git_head_revision(refspec hash) + if(NOT GIT_FOUND) + set(${_var} + "GIT-NOTFOUND" + PARENT_SCOPE) + return() + endif() + if(NOT hash) + set(${_var} + "HEAD-HASH-NOTFOUND" + PARENT_SCOPE) + return() + endif() + + # TODO sanitize + #if((${ARGN}" MATCHES "&&") OR + # (ARGN MATCHES "||") OR + # (ARGN MATCHES "\\;")) + # message("Please report the following error to the project!") + # message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}") + #endif() + + #message(STATUS "Arguments to execute_process: ${ARGN}") + + execute_process( + COMMAND "${GIT_EXECUTABLE}" describe --tags --always ${hash} ${ARGN} + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + RESULT_VARIABLE res + OUTPUT_VARIABLE out + ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT res EQUAL 0) + set(out "${out}-${res}-NOTFOUND") + endif() + + set(${_var} + "${out}" + PARENT_SCOPE) +endfunction() + +function(git_describe_working_tree _var) + if(NOT GIT_FOUND) + find_package(Git QUIET) + endif() + if(NOT GIT_FOUND) + set(${_var} + "GIT-NOTFOUND" + PARENT_SCOPE) + return() + endif() + + execute_process( + COMMAND "${GIT_EXECUTABLE}" describe --dirty ${ARGN} + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + RESULT_VARIABLE res + OUTPUT_VARIABLE out + ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT res EQUAL 0) + set(out "${out}-${res}-NOTFOUND") + endif() + + set(${_var} + "${out}" + PARENT_SCOPE) +endfunction() + +function(git_get_exact_tag _var) + git_describe(out --exact-match ${ARGN}) + set(${_var} + "${out}" + PARENT_SCOPE) +endfunction() + +function(git_local_changes _var) + if(NOT GIT_FOUND) + find_package(Git QUIET) + endif() + get_git_head_revision(refspec hash) + if(NOT GIT_FOUND) + set(${_var} + "GIT-NOTFOUND" + PARENT_SCOPE) + return() + endif() + if(NOT hash) + set(${_var} + "HEAD-HASH-NOTFOUND" + PARENT_SCOPE) + return() + endif() + + execute_process( + COMMAND "${GIT_EXECUTABLE}" diff-index --quiet HEAD -- + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + RESULT_VARIABLE res + OUTPUT_VARIABLE out + ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) + if(res EQUAL 0) + set(${_var} + "CLEAN" + PARENT_SCOPE) + else() + set(${_var} + "DIRTY" + PARENT_SCOPE) + endif() +endfunction() diff --git a/src/cmake/GetGitRevisionDescription.cmake.in b/src/cmake/GetGitRevisionDescription.cmake.in new file mode 100644 index 00000000..462edb68 --- /dev/null +++ b/src/cmake/GetGitRevisionDescription.cmake.in @@ -0,0 +1,46 @@ +# +# Internal file for GetGitRevisionDescription.cmake +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2023 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright 2009-2012, Iowa State University +# Copyright 2011-2023, Contributors +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) +# SPDX-License-Identifier: BSL-1.0 + +set(HEAD_HASH) + +file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024) + +string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS) +if(HEAD_CONTENTS MATCHES "ref") + # named branch + string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}") + if(EXISTS "@GIT_DIR@/${HEAD_REF}") + configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) + else() + if(EXISTS "@GIT_DIR@/packed-refs") + configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" + COPYONLY) + file(READ "@GIT_DATA@/packed-refs" PACKED_REFS) + if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}") + set(HEAD_HASH "${CMAKE_MATCH_1}") + endif() + endif() + endif() +else() + # detached HEAD + configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY) +endif() + +if(NOT HEAD_HASH) + file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024) + string(STRIP "${HEAD_HASH}" HEAD_HASH) +endif() diff --git a/src/conformance/conformance_test/conformance_test.cpp b/src/conformance/conformance_test/conformance_test.cpp index eb826d55..36781f99 100644 --- a/src/conformance/conformance_test/conformance_test.cpp +++ b/src/conformance/conformance_test/conformance_test.cpp @@ -14,7 +14,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #define CATCH_CONFIG_NOSTDOUT #include "conformance_framework.h" @@ -24,12 +23,12 @@ #include "graphics_plugin.h" #include "platform_utils.hpp" // for OPENXR_API_LAYER_PATH_ENV_VAR #include "report.h" +#include "utilities/git_revision.h" #include "utilities/utils.h" -#include - #include "catch_reporter_cts.h" +#include #include #include #include @@ -38,6 +37,7 @@ #include #include "common/xr_dependencies.h" +#include #include #include @@ -148,6 +148,35 @@ namespace } } + // Ensure this is a git checkout and that it is clean (all changes committed) + // and add a warning that will show in the output + TEST_CASE("SourceCodeRevision", "") + { + + CAPTURE(kGitRevisionSucceeded); + CAPTURE(kGitRevisionString); + CAPTURE(kGitRevisionLocalChanges); + CAPTURE(kGitRevisionExactTag); + if (kGitRevisionSucceeded) { + if (kGitRevisionLocalChanges) { + WARN( + "Uncommitted changes found in the source code working tree. " + "Recommend committing changes to a local branch. " + "Conformance packages must include diff(s) from the latest approved CTS release tag."); + } + if (!kGitRevisionExactTag) { + WARN( + "Source does not match an exact git tag: " + "Conformance packages must include a diff(s) from the latest approved CTS release tag."); + } + } + else { + WARN( + "Build system could not use git to describe the source tree with respect to a release tag. " + "Please be sure to build the conformance package in a full git clone with tags."); + } + } + // Ensure conformance is configured correctly. TEST_CASE("ValidateEnvironment") { diff --git a/src/conformance/conformance_test/readme.md b/src/conformance/conformance_test/readme.md index 41497546..1884334d 100644 --- a/src/conformance/conformance_test/readme.md +++ b/src/conformance/conformance_test/readme.md @@ -24,6 +24,22 @@ does not support a command-line interface, a host application must be built for the device which the OpenXR runtime will run on. The conformance host must invoke `conformance_test`, the test suite shared library. +When you plan to submit for conformance, you must observe a few considerations +to ensure that the build system has accurate source code revision information +available to embed in the test suite and output reports. You must build from a +git repo (forked from either the internal Gitlab or public GitHub) with tags +available (a full clone, not shallow). You also must either perform a clean +build, from an empty binary tree, or at least run `cmake` immediately before +building to pick up current source tree status. If your "porting" process (as +described by the conformance process documents) involves replacing the build +system, you must populate the revision data constants in +`utilities/git_revision.cpp.in` accurately. The contents of that file affect all +"ctsxml" format outputs, as well as an automated "SourceCodeRevision" test that +warns if it cannot identify an approved release. (It only checks for the +presence of an appropriately-named tag: it does not check for a signature on the +tag, so if you have added tags to your repo it may not warn if you are not on a +release.) + Running CTS ----------- diff --git a/src/conformance/ctsxml.rnc b/src/conformance/ctsxml.rnc index 401abb27..5bcb827f 100644 --- a/src/conformance/ctsxml.rnc +++ b/src/conformance/ctsxml.rnc @@ -123,6 +123,7 @@ TestOptions = TestEnvironment = element ctsTestEnvironment { + RevisionInfo, InstanceProperties, TestOptions, AvailableApiLayers, @@ -130,6 +131,16 @@ TestEnvironment = element graphicsPluginDescription { text }? } +RevisionInfo = + element revisionData { + attribute revision { xsd:string }, + attribute localChanges { xsd:boolean } + } + | element revisionData { + attribute gitDescribeSucceeded { "false" }, + attribute revision { xsd:string } + } + # These are the layers and extensions enabled by the tests, as well as those specified in the options. ActiveLayersAndExtensions = element activeAPILayersAndExtensions { diff --git a/src/conformance/framework/graphics_plugin_d3d11_gltf.cpp b/src/conformance/framework/graphics_plugin_d3d11_gltf.cpp index 2fd697e2..a3e9bacd 100644 --- a/src/conformance/framework/graphics_plugin_d3d11_gltf.cpp +++ b/src/conformance/framework/graphics_plugin_d3d11_gltf.cpp @@ -1,15 +1,15 @@ // Copyright (c) 2022-2023, The Khronos Group Inc. // // SPDX-License-Identifier: MIT -#if defined(XR_USE_GRAPHICS_API_D3D12) && !defined(MISSING_DIRECTX_COLORS) +#if defined(XR_USE_GRAPHICS_API_D3D11) && !defined(MISSING_DIRECTX_COLORS) #include "graphics_plugin_d3d11_gltf.h" #include "conformance_framework.h" #include "report.h" -#include "pbr/D3D12/D3D12Primitive.h" -#include "pbr/D3D12/D3D12Resources.h" +#include "pbr/D3D11/D3D11Primitive.h" +#include "pbr/D3D11/D3D11Resources.h" #include "pbr/GltfLoader.h" #include "utilities/d3d_common.h" #include "utilities/throw_helpers.h" diff --git a/src/conformance/framework/graphics_plugin_d3d12.cpp b/src/conformance/framework/graphics_plugin_d3d12.cpp index 6c4ce4fe..9a722be6 100644 --- a/src/conformance/framework/graphics_plugin_d3d12.cpp +++ b/src/conformance/framework/graphics_plugin_d3d12.cpp @@ -744,7 +744,7 @@ namespace Conformance XRC_CHECK_THROW_HRCMD(d3d12Device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, commandAllocator.Get(), nullptr, __uuidof(ID3D12GraphicsCommandList), reinterpret_cast(cmdList.ReleaseAndGetAddressOf()))); - XRC_CHECK_THROW_HRCMD(commandAllocator->SetName(L"CTS ValidateSwapchainImageState cmd list")); + XRC_CHECK_THROW_HRCMD(cmdList->SetName(L"CTS ValidateSwapchainImageState cmd list")); const XrSwapchainImageD3D12KHR& image = swapchainImageVector[index]; const bool isColorFormat = GetDxgiSwapchainTestMap()[imageFormat].colorFormat; diff --git a/src/conformance/framework/pbr/PbrModel.h b/src/conformance/framework/pbr/PbrModel.h index 747dbfa2..9cd42892 100644 --- a/src/conformance/framework/pbr/PbrModel.h +++ b/src/conformance/framework/pbr/PbrModel.h @@ -73,10 +73,10 @@ namespace Pbr Model(bool createRootNode = true); - // Add a node to the model. + /// Add a node to the model. NodeIndex_t AddNode(const XrMatrix4x4f& transform, NodeIndex_t parentIndex, std::string name = ""); - // Add a primitive to the model. + /// Add a primitive to the model. void AddPrimitive(PrimitiveHandle primitive); // Remove all primitives. @@ -104,7 +104,7 @@ namespace Pbr return m_primitives[index]; } - // Find the first node which matches a given name. + /// Find the first node (after an optional parent node) which matches a given name. bool FindFirstNode(NodeIndex_t* outNodeIndex, const char* name, const NodeIndex_t* parentNodeIndex = nullptr) const; protected: diff --git a/src/conformance/framework/xml_test_environment.cpp b/src/conformance/framework/xml_test_environment.cpp index d7064d98..ff48f858 100644 --- a/src/conformance/framework/xml_test_environment.cpp +++ b/src/conformance/framework/xml_test_environment.cpp @@ -7,6 +7,7 @@ #include "conformance_framework.h" #include "common/hex_and_handles.h" +#include "utilities/git_revision.h" #include @@ -170,6 +171,18 @@ namespace Conformance { auto e = xml.scopedElement(CTS_XML_NS_PREFIX_QUALIFIER "ctsTestEnvironment"); + // Report the git info + if (kGitRevisionSucceeded) { + xml.scopedElement(CTS_XML_NS_PREFIX_QUALIFIER "revisionData") + .writeAttribute("revision", kGitRevisionString) + .writeAttribute("localChanges", kGitRevisionLocalChanges); + } + else { + xml.scopedElement(CTS_XML_NS_PREFIX_QUALIFIER "revisionData") + .writeAttribute("gitDescribeSucceeded", false) + .writeAttribute("revision", kGitRevisionString); + } + // Report the runtime name and info. WriteInstanceProperties(xml, globalData.GetInstanceProperties()); diff --git a/src/conformance/utilities/CMakeLists.txt b/src/conformance/utilities/CMakeLists.txt index 3e9aa45e..f8b4e075 100644 --- a/src/conformance/utilities/CMakeLists.txt +++ b/src/conformance/utilities/CMakeLists.txt @@ -2,6 +2,46 @@ # # SPDX-License-Identifier: Apache-2.0 +include(GetGitRevisionDescription) + +# Pattern restricts naming to CTS tags in gitlab and github +git_describe_working_tree(CTS_GIT_REV --match "*cts-*") +git_get_exact_tag(CTS_EXACT_TAG_REV --match "*cts-*") +git_local_changes(CTS_GIT_DIRTY_STRING) + +if(CTS_GIT_REV) + set(CTS_GIT_SUCCEEDED TRUE) + if(CTS_EXACT_TAG_REV) + set(CTS_EXACT_TAG TRUE) + else() + message( + STATUS + "Not an exact release tag: conformance package must include diff(s) from the latest approved CTS release tag." + ) + set(CTS_EXACT_TAG FALSE) + endif() +else() + message( + STATUS + "Could not describe git revision relative to a CTS release tag - do not use binaries for CTS submission" + ) + # Try to get something at least. + get_git_head_revision(CTS_REFSPEC CTS_GIT_HASH) + set(CTS_GIT_REV "refspec:${CTS_REFSPEC} hash:${CTS_GIT_HASH}") + set(CTS_GIT_SUCCEEDED FALSE) +endif() +if(CTS_GIT_DIRTY_STRING STREQUAL "DIRTY") + set(CTS_GIT_DIRTY TRUE) + message(STATUS "Git revision: ${CTS_GIT_REV} - local tree has changes!") +else() + set(CTS_GIT_DIRTY FALSE) + message(STATUS "Git revision: ${CTS_GIT_REV} - local tree clean") +endif() + +configure_file( + git_revision.cpp.in "${CMAKE_CURRENT_BINARY_DIR}/git_revision.cpp" +) + add_library( conformance_utilities STATIC bitmask_generator.cpp @@ -17,6 +57,7 @@ add_library( throw_helpers.cpp types_and_constants.cpp utils.cpp + "${CMAKE_CURRENT_BINARY_DIR}/git_revision.cpp" ) target_include_directories( diff --git a/src/conformance/utilities/git_revision.cpp.in b/src/conformance/utilities/git_revision.cpp.in new file mode 100644 index 00000000..6cd51fa6 --- /dev/null +++ b/src/conformance/utilities/git_revision.cpp.in @@ -0,0 +1,36 @@ +// Copyright (c) 2023, The Khronos Group Inc. +// +// SPDX-License-Identifier: Apache-2.0 + +#include "utilities/git_revision.h" + +namespace Conformance +{ + const char* kGitRevisionString = "@CTS_GIT_REV@"; + +#cmakedefine CTS_GIT_SUCCEEDED + +#ifdef CTS_GIT_SUCCEEDED + const bool kGitRevisionSucceeded = true; +#else + const bool kGitRevisionSucceeded = false; +#endif + +#cmakedefine CTS_EXACT_TAG + +#ifdef CTS_EXACT_TAG + const bool kGitRevisionExactTag = true; +#else + const bool kGitRevisionExactTag = false; +#endif + +#cmakedefine CTS_GIT_DIRTY + +#ifdef CTS_GIT_DIRTY + const bool kGitRevisionLocalChanges = true; +#else + const bool kGitRevisionLocalChanges = false; +#endif + + +} // namespace Conformance diff --git a/src/conformance/utilities/git_revision.h b/src/conformance/utilities/git_revision.h new file mode 100644 index 00000000..1d40bd11 --- /dev/null +++ b/src/conformance/utilities/git_revision.h @@ -0,0 +1,24 @@ +// Copyright (c) 2017-2023, The Khronos Group Inc. +// +// SPDX-License-Identifier: Apache-2.0 + +#pragma once + +namespace Conformance +{ + /// A string usable to describe the git revision. + /// Should be `git describe --dirty "*cts-*"` output for a proper submission. + extern const char* kGitRevisionString; + + /// Whether the build process successfully queried git for version info relative to a release tag. + /// Should be true for a proper submission. + extern const bool kGitRevisionSucceeded; + + /// Whether the revision is exactly a CTS release tag (based on the name). + extern const bool kGitRevisionExactTag; + + /// Whether the working tree had local changes ("dirty"). + /// Should be false for a proper submission + extern const bool kGitRevisionLocalChanges; + +} // namespace Conformance