1 #ifndef _VKTSPARSERESOURCESBASE_HPP 2 #define _VKTSPARSERESOURCESBASE_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 vktSparseResourcesBase.hpp 23 * \brief Sparse Resources Base Instance 24 *//*--------------------------------------------------------------------*/ 25 26 #include "vkDefs.hpp" 27 #include "vktTestCase.hpp" 28 #include "vkRef.hpp" 29 #include "vkPlatform.hpp" 30 #include "deUniquePtr.hpp" 31 32 #include <map> 33 #include <vector> 34 35 namespace vkt 36 { 37 namespace sparse 38 { 39 40 struct Queue 41 { 42 vk::VkQueue queueHandle; 43 deUint32 queueFamilyIndex; 44 deUint32 queueIndex; 45 }; 46 47 struct QueueRequirements 48 { 49 QueueRequirements(const vk::VkQueueFlags qFlags, const deUint32 qCount) 50 : queueFlags(qFlags) 51 , queueCount(qCount) 52 {} 53 54 vk::VkQueueFlags queueFlags; 55 deUint32 queueCount; 56 }; 57 58 class SparseResourcesBaseInstance : public TestInstance 59 { 60 public: 61 SparseResourcesBaseInstance (Context &context) : TestInstance(context) {} 62 63 protected: 64 typedef std::vector<QueueRequirements> QueueRequirementsVec; 65 66 void createDeviceSupportingQueues (const QueueRequirementsVec& queueRequirements); 67 const Queue& getQueue (const vk::VkQueueFlags queueFlags, const deUint32 queueIndex) const; 68 const vk::DeviceInterface& getDeviceInterface (void) const { return *m_deviceDriver; } 69 vk::VkDevice getDevice (void) const { return *m_logicalDevice; } 70 vk::Allocator& getAllocator (void) { return *m_allocator; } 71 72 private: 73 std::map<vk::VkQueueFlags, std::vector<Queue> > m_queues; 74 de::MovePtr<vk::DeviceDriver> m_deviceDriver; 75 vk::Move<vk::VkDevice> m_logicalDevice; 76 de::MovePtr<vk::Allocator> m_allocator; 77 }; 78 79 } // sparse 80 } // vkt 81 82 #endif // _VKTSPARSERESOURCESBASE_HPP 83