1 #ifndef _VKTSPVASMUTILS_HPP
2 #define _VKTSPVASMUTILS_HPP
3 /*-------------------------------------------------------------------------
4 * Vulkan Conformance Tests
5 * ------------------------
7 * Copyright (c) 2017 Google Inc.
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
23 * \brief Utilities for Vulkan SPIR-V assembly tests
24 *//*--------------------------------------------------------------------*/
27 #include "vkMemUtil.hpp"
29 #include "vkTypeUtil.hpp"
30 #include "vktTestCase.hpp"
37 namespace SpirVAssembly
40 enum Extension16BitStorageFeatureBits
42 EXT16BITSTORAGEFEATURES_UNIFORM_BUFFER_BLOCK = (1u << 1),
43 EXT16BITSTORAGEFEATURES_UNIFORM = (1u << 2),
44 EXT16BITSTORAGEFEATURES_PUSH_CONSTANT = (1u << 3),
45 EXT16BITSTORAGEFEATURES_INPUT_OUTPUT = (1u << 4),
47 typedef deUint32 Extension16BitStorageFeatures;
49 struct ExtensionFeatures
51 Extension16BitStorageFeatures ext16BitStorage;
53 ExtensionFeatures (void)
56 explicit ExtensionFeatures (Extension16BitStorageFeatures ext16BitStorage_)
57 : ext16BitStorage (ext16BitStorage_)
61 // Returns true if the given 16bit storage extension features in `toCheck` are all supported.
62 bool is16BitStorageFeaturesSupported (const vk::InstanceInterface& vkInstance,
63 vk::VkPhysicalDevice device,
64 const std::vector<std::string>& instanceExtensions,
65 Extension16BitStorageFeatures toCheck);
67 // Creates a Vulkan logical device with the requiredExtensions enabled and all other extensions disabled.
68 // The logical device will be created from the instance and physical device in the given context.
69 // A single queue will be created from the given queue family.
70 vk::Move<vk::VkDevice> createDeviceWithExtensions (Context& context,
71 deUint32 queueFamilyIndex,
72 const std::vector<std::string>& supportedExtensions,
73 const std::vector<std::string>& requiredExtensions);
75 // Creates a SimpleAllocator on the given device.
76 vk::Allocator* createAllocator (const vk::InstanceInterface& instanceInterface,
77 const vk::VkPhysicalDevice physicalDevice,
78 const vk::DeviceInterface& deviceInterface,
79 const vk::VkDevice device);
84 #endif // _VKTSPVASMUTILS_HPP