1 #ifndef _VKTPIPELINESPECCONSTANTUTIL_HPP
2 #define _VKTPIPELINESPECCONSTANTUTIL_HPP
3 /*------------------------------------------------------------------------
4 * Vulkan Conformance Tests
5 * ------------------------
6 *
7 * Copyright (c) 2016 The Khronos Group Inc.
8 *
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 *
21 *//*!
22 * \file
23 * \brief Pipeline specialization constants test utilities
24 *//*--------------------------------------------------------------------*/
25
26 #include "vkDefs.hpp"
27 #include "vkRef.hpp"
28 #include "vkPrograms.hpp"
29 #include "vkMemUtil.hpp"
30 #include "vkRefUtil.hpp"
31 #include "vkQueryUtil.hpp"
32 #include "vktTestCase.hpp"
33
34 namespace vkt
35 {
36 namespace pipeline
37 {
38
39 enum FeatureFlagBits
40 {
41 FEATURE_TESSELLATION_SHADER = 1u << 0,
42 FEATURE_GEOMETRY_SHADER = 1u << 1,
43 FEATURE_SHADER_FLOAT_64 = 1u << 2,
44 FEATURE_VERTEX_PIPELINE_STORES_AND_ATOMICS = 1u << 3,
45 FEATURE_FRAGMENT_STORES_AND_ATOMICS = 1u << 4,
46 FEATURE_SHADER_INT_64 = 1u << 5,
47 FEATURE_SHADER_INT_16 = 1u << 6,
48 FEATURE_SHADER_FLOAT_16 = 1u << 7,
49 FEATURE_SHADER_INT_8 = 1u << 8,
50 };
51 typedef deUint32 FeatureFlags;
52
53 vk::VkImageCreateInfo makeImageCreateInfo (const tcu::IVec2& size, const vk::VkFormat format, const vk::VkImageUsageFlags usage);
54 void requireFeatures (vkt::Context& context, const FeatureFlags flags);
55
56 // Ugly, brute-force replacement for the initializer list
57
58 template<typename T>
makeVector(const T & o1)59 std::vector<T> makeVector (const T& o1)
60 {
61 std::vector<T> vec;
62 vec.reserve(1);
63 vec.push_back(o1);
64 return vec;
65 }
66
67 template<typename T>
makeVector(const T & o1,const T & o2)68 std::vector<T> makeVector (const T& o1, const T& o2)
69 {
70 std::vector<T> vec;
71 vec.reserve(2);
72 vec.push_back(o1);
73 vec.push_back(o2);
74 return vec;
75 }
76
77 template<typename T>
makeVector(const T & o1,const T & o2,const T & o3)78 std::vector<T> makeVector (const T& o1, const T& o2, const T& o3)
79 {
80 std::vector<T> vec;
81 vec.reserve(3);
82 vec.push_back(o1);
83 vec.push_back(o2);
84 vec.push_back(o3);
85 return vec;
86 }
87
88 template<typename T>
makeVector(const T & o1,const T & o2,const T & o3,const T & o4)89 std::vector<T> makeVector (const T& o1, const T& o2, const T& o3, const T& o4)
90 {
91 std::vector<T> vec;
92 vec.reserve(4);
93 vec.push_back(o1);
94 vec.push_back(o2);
95 vec.push_back(o3);
96 vec.push_back(o4);
97 return vec;
98 }
99
100 } // pipeline
101 } // vkt
102
103 #endif // _VKTPIPELINESPECCONSTANTUTIL_HPP
104