test: Add test framekwork layer utility

At the present moment, this change is to define simple layer
utilities that tests in the future may use.

Change-Id: I9ab5e1950da64061997891a0527d0f70a49e41e7
This commit is contained in:
Charles Giessen
2021-04-23 12:01:07 -06:00
committed by Charles Giessen
parent 9423452b70
commit 2a75a4e2f9
2 changed files with 88 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
# ~~~
# Copyright (c) 2021 Valve Corporation
# Copyright (c) 2021 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.
# ~~~
add_library(test_layer_util INTERFACE)
target_include_directories(test_layer_util INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR})
target_link_libraries(test_layer_util INTERFACE testing_framework_util)
add_library(test_layer_deps INTERFACE)
target_compile_options(test_layer_deps INTERFACE
$<$<PLATFORM_ID:WIN32>:${MSVC_LOADER_COMPILE_OPTIONS},/permissive->)
target_compile_definitions(test_layer_deps INTERFACE
# Workaround for TR1 deprecation in Visual Studio 15.5 until Google Test is updated
$<$<PLATFORM_ID:WIN32>:-DWIN32_LEAN_AND_MEAN,-D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING>
VK_NO_PROTOTYPES)
target_link_libraries(test_layer_deps INTERFACE Vulkan::Headers testing_framework_util test_layer_util)
+56
View File
@@ -0,0 +1,56 @@
/*
* Copyright (c) 2021 The Khronos Group Inc.
* Copyright (c) 2021 Valve Corporation
* Copyright (c) 2021 LunarG, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and/or associated documentation files (the "Materials"), to
* deal in the Materials without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Materials, and to permit persons to whom the Materials are
* furnished to do so, subject to the following conditions:
*
* The above copyright notice(s) and this permission notice shall be included in
* all copies or substantial portions of the Materials.
*
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
*
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
* USE OR OTHER DEALINGS IN THE MATERIALS.
*
* Author: Charles Giessen <charles@lunarg.com>
*/
#pragma once
#include "test_util.h"
struct Layer {
std::string layerName;
uint32_t specVersion = VK_MAKE_VERSION(1, 0, 0);
uint32_t implementationVersion = VK_MAKE_VERSION(1, 0, 0);
std::string description;
std::vector<Extension> extensions;
Layer(std::string layerName, uint32_t specVersion = VK_MAKE_VERSION(1, 0, 0),
uint32_t implementationVersion = VK_MAKE_VERSION(1, 0, 0), std::string description = "",
std::vector<Extension> extensions = {})
: layerName(layerName),
specVersion(specVersion),
implementationVersion(implementationVersion),
description(description),
extensions(extensions) {}
VkLayerProperties get() const noexcept {
VkLayerProperties props{};
std::strncpy(props.layerName, layerName.data(), VK_MAX_EXTENSION_NAME_SIZE);
props.specVersion = specVersion;
props.implementationVersion = implementationVersion;
std::strncpy(props.description, layerName.data(), VK_MAX_DESCRIPTION_SIZE);
return props;
}
};