• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 The Khronos Group Inc.
3  * Copyright (c) 2021 Valve Corporation
4  * Copyright (c) 2021 LunarG, Inc.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and/or associated documentation files (the "Materials"), to
8  * deal in the Materials without restriction, including without limitation the
9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  * sell copies of the Materials, and to permit persons to whom the Materials are
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice(s) and this permission notice shall be included in
14  * all copies or substantial portions of the Materials.
15  *
16  * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19  *
20  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
21  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
23  * USE OR OTHER DEALINGS IN THE MATERIALS.
24  *
25  * Author: Charles Giessen <charles@lunarg.com>
26  */
27 
28 #pragma once
29 
30 #include "test_util.h"
31 
32 struct LayerDefinition {
33     BUILDER_VALUE(LayerDefinition, std::string, layerName, {})
BUILDER_VALUELayerDefinition34     BUILDER_VALUE(LayerDefinition, uint32_t, specVersion, VK_API_VERSION_1_0)
35     BUILDER_VALUE(LayerDefinition, uint32_t, implementationVersion, VK_API_VERSION_1_0)
36     BUILDER_VALUE(LayerDefinition, std::string, description, {})
37     BUILDER_VECTOR(LayerDefinition, Extension, extensions, extension)
38 
39     LayerDefinition(std::string layerName, uint32_t specVersion = VK_API_VERSION_1_0,
40                     uint32_t implementationVersion = VK_API_VERSION_1_0, std::string description = "",
41                     std::vector<Extension> extensions = {})
42         : layerName(layerName),
43           specVersion(specVersion),
44           implementationVersion(implementationVersion),
45           description(description),
46           extensions(extensions) {}
47 
getLayerDefinition48     VkLayerProperties get() const noexcept {
49         VkLayerProperties props{};
50         copy_string_to_char_array(layerName, &props.layerName[0], VK_MAX_EXTENSION_NAME_SIZE);
51         props.specVersion = specVersion;
52         props.implementationVersion = implementationVersion;
53         copy_string_to_char_array(description, &props.description[0], VK_MAX_DESCRIPTION_SIZE);
54         return props;
55     }
56 };
57