-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add OpenXR CTS test for API layer pre-create operations
OpenXR API Layers may need to query other layers or the runtime before the instance has been created - add an explicit test for this case.
- Loading branch information
1 parent
477fae4
commit 8f3b9d9
Showing
15 changed files
with
486 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
- mr.3415.gl | ||
- issues.2333.gl | ||
--- | ||
Add conformance test to validate xrCreateInstance patterns required by API layers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...oid_assets/openxr/1/api_layers/explicit.d/XR_APILAYER_KHRONOS_conformance_test_layer.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"file_format_version": "1.0.0", | ||
"api_layer": { | ||
"name": "XR_APILAYER_KHRONOS_conformance_test_layer", | ||
"library_path": "libXrApiLayer_conformance_test_layer.so", | ||
"api_version": "1.1", | ||
"implementation_version": "1", | ||
"description": "API Layer to validate OpenXR runtime conformance", | ||
"disable_environment": "KHRONOS_conformance_test_layer_disabled" | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...ts/openxr/1/api_layers/explicit.d/XR_APILAYER_KHRONOS_conformance_test_layer.json.license
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
SPDX-FileCopyrightText: 2019-2024, The Khronos Group Inc. | ||
|
||
SPDX-License-Identifier: Apache-2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// Copyright (c) 2019-2024, The Khronos Group Inc. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
// 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. | ||
|
||
#include "conformance_framework.h" | ||
#include "conformance_utils.h" | ||
#include "utilities/types_and_constants.h" | ||
#include "utilities/utils.h" | ||
|
||
#include <catch2/catch_test_macros.hpp> | ||
#include <openxr/openxr.h> | ||
|
||
#include <cstring> | ||
#include <string> | ||
#include <thread> | ||
|
||
namespace Conformance | ||
{ | ||
TEST_CASE("validApiLayer", "") | ||
{ | ||
GlobalData& globalData = GetGlobalData(); | ||
|
||
// Layer for run-time conformance (and anything else global) | ||
StringVec enabledApiLayers = globalData.enabledAPILayerNames; | ||
// plus our test layer | ||
enabledApiLayers.push_back("XR_APILAYER_KHRONOS_conformance_test_layer"); | ||
|
||
// Enable only the required platform extensions by default | ||
auto enabledExtensions = StringVec(globalData.requiredPlatformInstanceExtensions); | ||
|
||
XrInstance instance = XR_NULL_HANDLE_CPP; | ||
CleanupInstanceOnScopeExit cleanup(instance); | ||
|
||
XrInstanceCreateInfo createInfo{XR_TYPE_INSTANCE_CREATE_INFO}; | ||
|
||
strcpy(createInfo.applicationInfo.applicationName, "conformance test"); | ||
createInfo.applicationInfo.applicationVersion = 1; | ||
// Leave engineName and engineVersion empty, which is valid usage. | ||
createInfo.applicationInfo.apiVersion = globalData.options.desiredApiVersionValue; | ||
|
||
if (globalData.requiredPlatformInstanceCreateStruct) { | ||
createInfo.next = globalData.requiredPlatformInstanceCreateStruct; | ||
} | ||
|
||
createInfo.enabledApiLayerCount = (uint32_t)enabledApiLayers.size(); | ||
createInfo.enabledApiLayerNames = enabledApiLayers.data(); | ||
createInfo.enabledExtensionCount = (uint32_t)enabledExtensions.size(); | ||
createInfo.enabledExtensionNames = enabledExtensions.data(); | ||
|
||
SECTION("XR_SUCCESS, only platform-required extensions enabled") | ||
{ | ||
REQUIRE(XR_SUCCESS == xrCreateInstance(&createInfo, &instance)); | ||
} | ||
} | ||
|
||
} // namespace Conformance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
# Copyright (c) 2019-2024, The Khronos Group Inc. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# 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. | ||
|
||
file( | ||
GLOB | ||
LOCAL_HEADERS | ||
CONFIGURE_DEPENDS | ||
"*.h" | ||
) | ||
file( | ||
GLOB | ||
LOCAL_SOURCE | ||
CONFIGURE_DEPENDS | ||
"*.cpp" | ||
) | ||
|
||
configure_file( | ||
conformance_test_layer.json | ||
${CMAKE_CURRENT_BINARY_DIR}/XrApiLayer_conformance_test_layer.json @ONLY | ||
) | ||
|
||
add_library( | ||
XrApiLayer_conformance_test_layer MODULE | ||
${LOCAL_SOURCE} | ||
${LOCAL_HEADERS} | ||
) | ||
target_link_libraries( | ||
XrApiLayer_conformance_test_layer PRIVATE OpenXR::headers | ||
) | ||
|
||
source_group("Headers" FILES ${LOCAL_HEADERS}) | ||
|
||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux") | ||
target_compile_options(XrApiLayer_conformance_test_layer PRIVATE -Wall) | ||
target_link_libraries(XrApiLayer_conformance_test_layer PRIVATE m) | ||
endif() | ||
|
||
if(ANDROID) | ||
target_link_libraries( | ||
XrApiLayer_conformance_test_layer PRIVATE ${ANDROID_LOG_LIBRARY} | ||
) | ||
endif() | ||
|
||
# Dynamic Library: | ||
# - Make build depend on the module definition/version script/export map | ||
# - Add the linker flag (except windows) | ||
if(WIN32) | ||
target_sources( | ||
XrApiLayer_conformance_test_layer | ||
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/XrApiLayer_conformance_test_layer.def" | ||
) | ||
elseif(APPLE) | ||
set_target_properties( | ||
XrApiLayer_conformance_test_layer | ||
PROPERTIES | ||
LINK_FLAGS | ||
"-Wl,-exported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/XrApiLayer_conformance_test_layer.expsym" | ||
) | ||
target_sources( | ||
XrApiLayer_conformance_test_layer | ||
PRIVATE | ||
"${CMAKE_CURRENT_SOURCE_DIR}/XrApiLayer_conformance_test_layer.expsym" | ||
) | ||
else() | ||
set_target_properties( | ||
XrApiLayer_conformance_test_layer | ||
PROPERTIES | ||
LINK_FLAGS | ||
"-Wl,--version-script=\"${CMAKE_CURRENT_SOURCE_DIR}/XrApiLayer_conformance_test_layer.map\"" | ||
) | ||
target_sources( | ||
XrApiLayer_conformance_test_layer | ||
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/XrApiLayer_conformance_test_layer.map" | ||
) | ||
endif() | ||
|
||
if(BUILD_CONFORMANCE_CLI) | ||
# Copy conformance layer files to conformance_cli binary folder | ||
add_custom_command( | ||
TARGET XrApiLayer_conformance_test_layer | ||
POST_BUILD | ||
COMMAND | ||
${CMAKE_COMMAND} -E copy | ||
$<TARGET_FILE:XrApiLayer_conformance_test_layer> | ||
$<TARGET_PROPERTY:conformance_cli,BINARY_DIR> | ||
COMMAND | ||
${CMAKE_COMMAND} -E copy | ||
${CMAKE_CURRENT_BINARY_DIR}/XrApiLayer_conformance_test_layer.json | ||
$<TARGET_PROPERTY:conformance_cli,BINARY_DIR> | ||
) | ||
endif() | ||
|
||
set_target_properties( | ||
XrApiLayer_conformance_test_layer PROPERTIES FOLDER | ||
${CONFORMANCE_TESTS_FOLDER} | ||
) | ||
|
||
install( | ||
FILES ${CMAKE_CURRENT_BINARY_DIR}/XrApiLayer_conformance_test_layer.json | ||
DESTINATION conformance | ||
) | ||
|
||
install( | ||
TARGETS XrApiLayer_conformance_test_layer | ||
LIBRARY DESTINATION conformance | ||
ARCHIVE DESTINATION conformance | ||
RUNTIME DESTINATION conformance | ||
) | ||
|
||
if(MSVC) | ||
install( | ||
FILES $<TARGET_PDB_FILE:XrApiLayer_conformance_test_layer> | ||
DESTINATION conformance | ||
OPTIONAL | ||
) | ||
endif() |
Oops, something went wrong.