Courtney Goeltzenleuchter | 7087dde | 2014-08-11 18:19:35 -0600 | [diff] [blame] | 1 | // Copyright 2005, Google Inc. |
| 2 | // All rights reserved. |
| 3 | // |
| 4 | // Redistribution and use in source and binary forms, with or without |
| 5 | // modification, are permitted provided that the following conditions are |
| 6 | // met: |
| 7 | // |
| 8 | // * Redistributions of source code must retain the above copyright |
| 9 | // notice, this list of conditions and the following disclaimer. |
| 10 | // * Redistributions in binary form must reproduce the above |
| 11 | // copyright notice, this list of conditions and the following disclaimer |
| 12 | // in the documentation and/or other materials provided with the |
| 13 | // distribution. |
| 14 | // * Neither the name of Google Inc. nor the names of its |
| 15 | // contributors may be used to endorse or promote products derived from |
| 16 | // this software without specific prior written permission. |
| 17 | // |
| 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 | |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 30 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 31 | // VK tests |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 32 | // |
| 33 | // Copyright (C) 2014 LunarG, Inc. |
| 34 | // |
| 35 | // Permission is hereby granted, free of charge, to any person obtaining a |
| 36 | // copy of this software and associated documentation files (the "Software"), |
| 37 | // to deal in the Software without restriction, including without limitation |
| 38 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 39 | // and/or sell copies of the Software, and to permit persons to whom the |
| 40 | // Software is furnished to do so, subject to the following conditions: |
| 41 | // |
| 42 | // The above copyright notice and this permission notice shall be included |
| 43 | // in all copies or substantial portions of the Software. |
| 44 | // |
| 45 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 46 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 47 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 48 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 49 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 50 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 51 | // DEALINGS IN THE SOFTWARE. |
| 52 | |
| 53 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 54 | // Verify VK driver initialization |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 55 | |
Courtney Goeltzenleuchter | 7087dde | 2014-08-11 18:19:35 -0600 | [diff] [blame] | 56 | #include <stdlib.h> |
| 57 | #include <stdio.h> |
| 58 | #include <stdbool.h> |
| 59 | #include <string.h> |
| 60 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 61 | #include <vulkan.h> |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 62 | #include "gtest-1.7.0/include/gtest/gtest.h" |
Courtney Goeltzenleuchter | 7087dde | 2014-08-11 18:19:35 -0600 | [diff] [blame] | 63 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 64 | #include "vktestbinding.h" |
Chia-I Wu | 3b78d31 | 2014-12-29 15:39:23 +0800 | [diff] [blame] | 65 | #include "test_common.h" |
Cody Northrop | d4e020a | 2015-03-17 14:54:35 -0600 | [diff] [blame] | 66 | #include "icd-spv.h" |
Courtney Goeltzenleuchter | 7087dde | 2014-08-11 18:19:35 -0600 | [diff] [blame] | 67 | |
Jon Ashburn | 07b309a | 2015-04-15 11:31:12 -0600 | [diff] [blame] | 68 | #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) |
| 69 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 70 | class VkTest : public ::testing::Test { |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 71 | public: |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 72 | void CreateImageTest(); |
Courtney Goeltzenleuchter | 0842df7 | 2014-08-20 15:26:55 -0600 | [diff] [blame] | 73 | void CreateCommandBufferTest(); |
| 74 | void CreatePipelineTest(); |
| 75 | void CreateShaderTest(); |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 76 | void CreateShader(VkShader *pshader); |
Courtney Goeltzenleuchter | 7087dde | 2014-08-11 18:19:35 -0600 | [diff] [blame] | 77 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 78 | VkDevice device() {return m_device->obj();} |
Courtney Goeltzenleuchter | b85c581 | 2014-08-19 18:35:50 -0600 | [diff] [blame] | 79 | |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 80 | protected: |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 81 | VkApplicationInfo app_info; |
| 82 | VkInstance inst; |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 83 | VkPhysicalDevice objs[16]; |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 84 | uint32_t gpu_count; |
Chia-I Wu | 3b78d31 | 2014-12-29 15:39:23 +0800 | [diff] [blame] | 85 | |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 86 | uint32_t m_device_id; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 87 | vk_testing::Device *m_device; |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 88 | VkPhysicalDeviceProperties props; |
| 89 | std::vector<VkPhysicalDeviceQueueProperties> queue_props; |
Courtney Goeltzenleuchter | f316806 | 2015-03-05 18:09:39 -0700 | [diff] [blame] | 90 | uint32_t graphics_queue_node_index; |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 91 | |
| 92 | virtual void SetUp() { |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 93 | VkResult err; |
Courtney Goeltzenleuchter | f316806 | 2015-03-05 18:09:39 -0700 | [diff] [blame] | 94 | int i; |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 95 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 96 | this->app_info.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO; |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 97 | this->app_info.pNext = NULL; |
Chia-I Wu | 7461fcf | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 98 | this->app_info.pAppName = "base"; |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 99 | this->app_info.appVersion = 1; |
Chia-I Wu | 7461fcf | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 100 | this->app_info.pEngineName = "unittest"; |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 101 | this->app_info.engineVersion = 1; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 102 | this->app_info.apiVersion = VK_API_VERSION; |
Courtney Goeltzenleuchter | ddcb619 | 2015-04-14 18:48:46 -0600 | [diff] [blame] | 103 | VkInstanceCreateInfo inst_info = {}; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 104 | inst_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; |
Jon Ashburn | 29669a4 | 2015-04-04 14:52:07 -0600 | [diff] [blame] | 105 | inst_info.pNext = NULL; |
| 106 | inst_info.pAppInfo = &app_info; |
| 107 | inst_info.pAllocCb = NULL; |
| 108 | inst_info.extensionCount = 0; |
Courtney Goeltzenleuchter | 1c7c65d | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 109 | inst_info.pEnabledExtensions = NULL; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 110 | err = vkCreateInstance(&inst_info, &inst); |
| 111 | ASSERT_VK_SUCCESS(err); |
Jon Ashburn | 07b309a | 2015-04-15 11:31:12 -0600 | [diff] [blame] | 112 | err = vkEnumeratePhysicalDevices(inst, &this->gpu_count, NULL); |
| 113 | ASSERT_VK_SUCCESS(err); |
| 114 | ASSERT_LE(this->gpu_count, ARRAY_SIZE(objs)) << "Too many GPUs"; |
| 115 | err = vkEnumeratePhysicalDevices(inst, &this->gpu_count, objs); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 116 | ASSERT_VK_SUCCESS(err); |
Jon Ashburn | 19733c9 | 2014-11-26 11:06:49 -0700 | [diff] [blame] | 117 | ASSERT_GE(this->gpu_count, 1) << "No GPU available"; |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 118 | |
Chia-I Wu | 3b78d31 | 2014-12-29 15:39:23 +0800 | [diff] [blame] | 119 | m_device_id = 0; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 120 | this->m_device = new vk_testing::Device(objs[m_device_id]); |
Chia-I Wu | 3b78d31 | 2014-12-29 15:39:23 +0800 | [diff] [blame] | 121 | this->m_device->init(); |
| 122 | |
| 123 | props = m_device->gpu().properties(); |
Chia-I Wu | 3b78d31 | 2014-12-29 15:39:23 +0800 | [diff] [blame] | 124 | |
Courtney Goeltzenleuchter | f316806 | 2015-03-05 18:09:39 -0700 | [diff] [blame] | 125 | queue_props = this->m_device->gpu().queue_properties(); |
| 126 | for (i = 0; i < queue_props.size(); i++) { |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 127 | if (queue_props[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) { |
Courtney Goeltzenleuchter | f316806 | 2015-03-05 18:09:39 -0700 | [diff] [blame] | 128 | graphics_queue_node_index = i; |
| 129 | break; |
| 130 | } |
| 131 | } |
| 132 | ASSERT_LT(i, queue_props.size()) << "Could not find a Queue with Graphics support"; |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 133 | } |
| 134 | |
| 135 | virtual void TearDown() { |
Tony Barbour | 900ae86 | 2015-06-02 14:55:46 -0600 | [diff] [blame] | 136 | delete m_device; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 137 | vkDestroyInstance(inst); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 138 | } |
| 139 | }; |
| 140 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 141 | TEST_F(VkTest, AllocMemory) { |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 142 | VkResult err; |
Courtney Goeltzenleuchter | ddcb619 | 2015-04-14 18:48:46 -0600 | [diff] [blame] | 143 | VkMemoryAllocInfo alloc_info = {}; |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 144 | VkDeviceMemory gpu_mem; |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 145 | uint8_t *pData; |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 146 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 147 | alloc_info.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO; |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 148 | alloc_info.allocationSize = 1024 * 1024; // 1MB |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 149 | alloc_info.memProps = VK_MEMORY_PROPERTY_SHAREABLE_BIT | |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 150 | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT; |
Tony Barbour | fa6cac7 | 2015-01-16 14:27:35 -0700 | [diff] [blame] | 151 | |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 152 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 153 | err = vkAllocMemory(device(), &alloc_info, &gpu_mem); |
| 154 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | 7087dde | 2014-08-11 18:19:35 -0600 | [diff] [blame] | 155 | |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 156 | err = vkMapMemory(device(), gpu_mem, 0, 0, 0, (void **) &pData); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 157 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | 6b814b3 | 2014-08-12 09:59:36 -0600 | [diff] [blame] | 158 | |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 159 | memset(pData, 0x55, alloc_info.allocationSize); |
| 160 | EXPECT_EQ(0x55, pData[0]) << "Memory read not same a write"; |
| 161 | |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 162 | err = vkUnmapMemory(device(), gpu_mem); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 163 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | 6b814b3 | 2014-08-12 09:59:36 -0600 | [diff] [blame] | 164 | |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 165 | err = vkFreeMemory(device(), gpu_mem); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 166 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 167 | } |
Courtney Goeltzenleuchter | 6b814b3 | 2014-08-12 09:59:36 -0600 | [diff] [blame] | 168 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 169 | TEST_F(VkTest, Event) { |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 170 | VkEventCreateInfo event_info; |
| 171 | VkEvent event; |
| 172 | VkMemoryRequirements mem_req; |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 173 | size_t data_size; |
| 174 | VkDeviceMemory event_mem; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 175 | VkResult err; |
Courtney Goeltzenleuchter | 6b814b3 | 2014-08-12 09:59:36 -0600 | [diff] [blame] | 176 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 177 | // typedef struct VkEventCreateInfo_ |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 178 | // { |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 179 | // VkStructureType sType; // Must be VK_STRUCTURE_TYPE_EVENT_CREATE_INFO |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 180 | // const void* pNext; // Pointer to next structure |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 181 | // VkFlags flags; // Reserved |
| 182 | // } VkEventCreateInfo; |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 183 | memset(&event_info, 0, sizeof(event_info)); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 184 | event_info.sType = VK_STRUCTURE_TYPE_EVENT_CREATE_INFO; |
Courtney Goeltzenleuchter | 6b814b3 | 2014-08-12 09:59:36 -0600 | [diff] [blame] | 185 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 186 | err = vkCreateEvent(device(), &event_info, &event); |
| 187 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 188 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 189 | data_size = sizeof(mem_req); |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 190 | err = vkGetObjectInfo(device(), VK_OBJECT_TYPE_EVENT, event, VK_OBJECT_INFO_TYPE_MEMORY_REQUIREMENTS, |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 191 | &data_size, &mem_req); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 192 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 193 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 194 | if (mem_req.size) { |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 195 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 196 | // VkResult VKAPI vkAllocMemory( |
| 197 | // VkDevice device, |
| 198 | // const VkMemoryAllocInfo* pAllocInfo, |
| 199 | // VkDeviceMemory* pMem); |
| 200 | VkMemoryAllocInfo mem_info; |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 201 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 202 | memset(&mem_info, 0, sizeof(mem_info)); |
| 203 | mem_info.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO; |
| 204 | mem_info.allocationSize = mem_req.size; |
| 205 | mem_info.memProps = VK_MEMORY_PROPERTY_SHAREABLE_BIT; |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 206 | err = vkAllocMemory(device(), &mem_info, &event_mem); |
| 207 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 208 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 209 | err = vkBindObjectMemory(device(), VK_OBJECT_TYPE_EVENT, event, event_mem, 0); |
| 210 | ASSERT_VK_SUCCESS(err); |
| 211 | } |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 212 | err = vkResetEvent(device(), event); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 213 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 214 | |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 215 | err = vkGetEventStatus(device(), event); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 216 | ASSERT_EQ(VK_EVENT_RESET, err); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 217 | |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 218 | err = vkSetEvent(device(), event); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 219 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 220 | |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 221 | err = vkGetEventStatus(device(), event); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 222 | ASSERT_EQ(VK_EVENT_SET, err); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 223 | |
| 224 | // TODO: Test actual synchronization with command buffer event. |
| 225 | |
| 226 | // All done with event memory, clean up |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 227 | if (mem_req.size) { |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 228 | err = vkFreeMemory(device(), event_mem); |
| 229 | ASSERT_VK_SUCCESS(err); |
| 230 | } |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 231 | |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 232 | err = vkDestroyObject(device(), VK_OBJECT_TYPE_EVENT, event); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 233 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 234 | } |
| 235 | |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 236 | #define MAX_QUERY_SLOTS 10 |
| 237 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 238 | TEST_F(VkTest, Query) { |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 239 | VkQueryPoolCreateInfo query_info; |
| 240 | VkQueryPool query_pool; |
Chia-I Wu | 54ed079 | 2014-12-27 14:14:50 +0800 | [diff] [blame] | 241 | size_t data_size; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 242 | VkMemoryRequirements mem_req; |
Chia-I Wu | 54ed079 | 2014-12-27 14:14:50 +0800 | [diff] [blame] | 243 | size_t query_result_size; |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 244 | uint32_t *query_result_data; |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 245 | VkDeviceMemory query_mem; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 246 | VkResult err; |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 247 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 248 | // typedef enum VkQueryType_ |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 249 | // { |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 250 | // VK_QUERY_TYPE_OCCLUSION = 0x00000000, |
| 251 | // VK_QUERY_TYPE_PIPELINE_STATISTICS = 0x00000001, |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 252 | |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 253 | // VK_QUERY_TYPE_BEGIN_RANGE = VK_QUERY_TYPE_OCCLUSION, |
| 254 | // VK_QUERY_TYPE_END_RANGE = VK_QUERY_TYPE_PIPELINE_STATISTICS, |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 255 | // VK_NUM_QUERY_TYPE = (VK_QUERY_TYPE_END_RANGE - VK_QUERY_TYPE_BEGIN_RANGE + 1), |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 256 | // VK_MAX_ENUM(VkQueryType_) |
| 257 | // } VkQueryType; |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 258 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 259 | // typedef struct VkQueryPoolCreateInfo_ |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 260 | // { |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 261 | // VkStructureType sType; // Must be VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 262 | // const void* pNext; // Pointer to next structure |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 263 | // VkQueryType queryType; |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 264 | // uint32_t slots; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 265 | // } VkQueryPoolCreateInfo; |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 266 | |
| 267 | memset(&query_info, 0, sizeof(query_info)); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 268 | query_info.sType = VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO; |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 269 | query_info.queryType = VK_QUERY_TYPE_OCCLUSION; |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 270 | query_info.slots = MAX_QUERY_SLOTS; |
| 271 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 272 | // VkResult VKAPI vkCreateQueryPool( |
| 273 | // VkDevice device, |
| 274 | // const VkQueryPoolCreateInfo* pCreateInfo, |
| 275 | // VkQueryPool* pQueryPool); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 276 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 277 | err = vkCreateQueryPool(device(), &query_info, &query_pool); |
| 278 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 279 | |
Jon Ashburn | b8e4389 | 2014-09-25 14:36:58 -0600 | [diff] [blame] | 280 | data_size = sizeof(mem_req); |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 281 | err = vkGetObjectInfo(device(), VK_OBJECT_TYPE_QUERY_POOL, query_pool, VK_OBJECT_INFO_TYPE_MEMORY_REQUIREMENTS, |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 282 | &data_size, &mem_req); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 283 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 284 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 285 | if (mem_req.size) { |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 286 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 287 | // VkResult VKAPI vkAllocMemory( |
| 288 | // VkDevice device, |
| 289 | // const VkMemoryAllocInfo* pAllocInfo, |
| 290 | // VkDeviceMemory* pMem); |
| 291 | VkMemoryAllocInfo mem_info; |
| 292 | |
| 293 | memset(&mem_info, 0, sizeof(mem_info)); |
| 294 | mem_info.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO; |
| 295 | // TODO: Is a simple multiple all that's needed here? |
| 296 | mem_info.allocationSize = mem_req.size * MAX_QUERY_SLOTS; |
| 297 | mem_info.memProps = VK_MEMORY_PROPERTY_SHAREABLE_BIT; |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 298 | err = vkAllocMemory(device(), &mem_info, &query_mem); |
| 299 | ASSERT_VK_SUCCESS(err); |
| 300 | |
| 301 | err = vkBindObjectMemory(device(), VK_OBJECT_TYPE_QUERY_POOL, query_pool, query_mem, 0); |
| 302 | ASSERT_VK_SUCCESS(err); |
| 303 | } |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 304 | // TODO: Test actual synchronization with command buffer event. |
| 305 | // TODO: Create command buffer |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 306 | // TODO: vkCmdResetQueryPool |
| 307 | // TODO: vkCmdBeginQuery |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 308 | // TODO: commands |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 309 | // TOOD: vkCmdEndQuery |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 310 | |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 311 | err = vkGetQueryPoolResults(device(), query_pool, 0, MAX_QUERY_SLOTS, |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 312 | &query_result_size, VK_NULL_HANDLE, 0); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 313 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 314 | |
| 315 | if (query_result_size > 0) { |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 316 | query_result_data = new uint32_t [query_result_size]; |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 317 | err = vkGetQueryPoolResults(device(), query_pool, 0, MAX_QUERY_SLOTS, |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 318 | &query_result_size, query_result_data, 0); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 319 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 320 | |
| 321 | // TODO: Test Query result data. |
| 322 | |
| 323 | } |
| 324 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 325 | if (mem_req.size) { |
| 326 | // All done with QueryPool memory, clean up |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 327 | err = vkFreeMemory(device(), query_mem); |
| 328 | ASSERT_VK_SUCCESS(err); |
| 329 | } |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 330 | |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 331 | err = vkDestroyObject(device(), VK_OBJECT_TYPE_QUERY_POOL, query_pool); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 332 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 333 | } |
Courtney Goeltzenleuchter | 6b814b3 | 2014-08-12 09:59:36 -0600 | [diff] [blame] | 334 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 335 | void getQueue(vk_testing::Device *device, uint32_t queue_node_index, const char *qname) |
Courtney Goeltzenleuchter | cc32aa9 | 2014-08-14 10:15:09 -0600 | [diff] [blame] | 336 | { |
| 337 | int que_idx; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 338 | VkResult err; |
| 339 | VkQueue queue; |
Courtney Goeltzenleuchter | cc32aa9 | 2014-08-14 10:15:09 -0600 | [diff] [blame] | 340 | |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 341 | const VkPhysicalDeviceQueueProperties props = device->gpu().queue_properties()[queue_node_index]; |
Chia-I Wu | 3b78d31 | 2014-12-29 15:39:23 +0800 | [diff] [blame] | 342 | for (que_idx = 0; que_idx < props.queueCount; que_idx++) { |
Mark Lobodzinski | cf26e07 | 2015-04-16 11:44:05 -0500 | [diff] [blame] | 343 | // TODO: Need to add support for separate MEMMGR and work queues, including synchronization |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 344 | err = vkGetDeviceQueue(device->obj(), queue_node_index, que_idx, &queue); |
| 345 | ASSERT_EQ(VK_SUCCESS, err) << "vkGetDeviceQueue: " << qname << " queue #" << que_idx << ": Failed with error: " << vk_result_string(err); |
Courtney Goeltzenleuchter | cc32aa9 | 2014-08-14 10:15:09 -0600 | [diff] [blame] | 346 | } |
| 347 | } |
| 348 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 349 | void VkTest::CreateImageTest() |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 350 | { |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 351 | VkResult err; |
| 352 | VkImage image; |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 353 | uint32_t w, h, mipCount; |
| 354 | size_t size; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 355 | VkFormat fmt; |
| 356 | VkFormatProperties image_fmt; |
Chia-I Wu | 54ed079 | 2014-12-27 14:14:50 +0800 | [diff] [blame] | 357 | size_t data_size; |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 358 | |
| 359 | w =512; |
| 360 | h = 256; |
| 361 | mipCount = 0; |
| 362 | |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 363 | uint32_t _w = w; |
| 364 | uint32_t _h = h; |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 365 | while( ( _w > 0 ) || ( _h > 0 ) ) |
| 366 | { |
| 367 | _w >>= 1; |
| 368 | _h >>= 1; |
| 369 | mipCount++; |
| 370 | } |
| 371 | |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 372 | fmt = VK_FORMAT_R8G8B8A8_UINT; |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 373 | // TODO: Pick known good format rather than just expect common format |
| 374 | /* |
| 375 | * XXX: What should happen if given NULL HANDLE for the pData argument? |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 376 | * We're not requesting VK_OBJECT_INFO_TYPE_MEMORY_REQUIREMENTS so there is |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 377 | * an expectation that pData is a valid pointer. |
| 378 | * However, why include a returned size value? That implies that the |
| 379 | * amount of data may vary and that doesn't work well for using a |
| 380 | * fixed structure. |
| 381 | */ |
| 382 | |
Jon Ashburn | b8e4389 | 2014-09-25 14:36:58 -0600 | [diff] [blame] | 383 | size = sizeof(image_fmt); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 384 | err = vkGetFormatInfo(device(), fmt, |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 385 | VK_FORMAT_INFO_TYPE_PROPERTIES, |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 386 | &size, &image_fmt); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 387 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 388 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 389 | // typedef struct VkImageCreateInfo_ |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 390 | // { |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 391 | // VkStructureType sType; // Must be VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 392 | // const void* pNext; // Pointer to next structure. |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 393 | // VkImageType imageType; |
| 394 | // VkFormat format; |
| 395 | // VkExtent3D extent; |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 396 | // uint32_t mipLevels; |
| 397 | // uint32_t arraySize; |
| 398 | // uint32_t samples; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 399 | // VkImageTiling tiling; |
| 400 | // VkFlags usage; // VkImageUsageFlags |
| 401 | // VkFlags flags; // VkImageCreateFlags |
| 402 | // } VkImageCreateInfo; |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 403 | |
| 404 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 405 | VkImageCreateInfo imageCreateInfo = {}; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 406 | imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 407 | imageCreateInfo.imageType = VK_IMAGE_TYPE_2D; |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 408 | imageCreateInfo.format = fmt; |
| 409 | imageCreateInfo.arraySize = 1; |
| 410 | imageCreateInfo.extent.width = w; |
| 411 | imageCreateInfo.extent.height = h; |
| 412 | imageCreateInfo.extent.depth = 1; |
| 413 | imageCreateInfo.mipLevels = mipCount; |
| 414 | imageCreateInfo.samples = 1; |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 415 | if (image_fmt.linearTilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) { |
| 416 | imageCreateInfo.tiling = VK_IMAGE_TILING_LINEAR; |
| 417 | } |
| 418 | else if (image_fmt.optimalTilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) { |
| 419 | imageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL; |
| 420 | } |
| 421 | else { |
| 422 | FAIL() << "Neither Linear nor Optimal allowed for color attachment"; |
| 423 | } |
Courtney Goeltzenleuchter | ad87081 | 2015-04-15 15:29:59 -0600 | [diff] [blame] | 424 | imageCreateInfo.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 425 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 426 | // VkResult VKAPI vkCreateImage( |
| 427 | // VkDevice device, |
| 428 | // const VkImageCreateInfo* pCreateInfo, |
| 429 | // VkImage* pImage); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 430 | err = vkCreateImage(device(), &imageCreateInfo, &image); |
| 431 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 432 | |
Courtney Goeltzenleuchter | ac3b73a | 2014-08-14 17:40:57 -0600 | [diff] [blame] | 433 | // Verify image resources |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 434 | // VkResult VKAPI vkGetImageSubresourceInfo( |
| 435 | // VkImage image, |
| 436 | // const VkImageSubresource* pSubresource, |
| 437 | // VkSubresourceInfoType infoType, |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 438 | // size_t* pDataSize, |
| 439 | // void* pData); |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 440 | // typedef struct VkSubresourceLayout_ |
Courtney Goeltzenleuchter | ac3b73a | 2014-08-14 17:40:57 -0600 | [diff] [blame] | 441 | // { |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 442 | // VkDeviceSize offset; // Specified in bytes |
| 443 | // VkDeviceSize size; // Specified in bytes |
| 444 | // VkDeviceSize rowPitch; // Specified in bytes |
| 445 | // VkDeviceSize depthPitch; // Specified in bytes |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 446 | // } VkSubresourceLayout; |
Courtney Goeltzenleuchter | ac3b73a | 2014-08-14 17:40:57 -0600 | [diff] [blame] | 447 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 448 | // typedef struct VkImageSubresource_ |
Courtney Goeltzenleuchter | ac3b73a | 2014-08-14 17:40:57 -0600 | [diff] [blame] | 449 | // { |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 450 | // VkImageAspect aspect; |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 451 | // uint32_t mipLevel; |
| 452 | // uint32_t arraySlice; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 453 | // } VkImageSubresource; |
| 454 | // typedef enum VkSubresourceInfoType_ |
Courtney Goeltzenleuchter | ac3b73a | 2014-08-14 17:40:57 -0600 | [diff] [blame] | 455 | // { |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 456 | // // Info type for vkGetImageSubresourceInfo() |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 457 | // VK_SUBRESOURCE_INFO_TYPE_LAYOUT = 0x00000000, |
Courtney Goeltzenleuchter | ac3b73a | 2014-08-14 17:40:57 -0600 | [diff] [blame] | 458 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 459 | // VK_MAX_ENUM(VkSubresourceInfoType_) |
| 460 | // } VkSubresourceInfoType; |
Courtney Goeltzenleuchter | ac3b73a | 2014-08-14 17:40:57 -0600 | [diff] [blame] | 461 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 462 | if (image_fmt.linearTilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) { |
| 463 | VkImageSubresource subresource = {}; |
| 464 | subresource.aspect = VK_IMAGE_ASPECT_COLOR; |
| 465 | subresource.arraySlice = 0; |
Courtney Goeltzenleuchter | ac3b73a | 2014-08-14 17:40:57 -0600 | [diff] [blame] | 466 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 467 | _w = w; |
| 468 | _h = h; |
| 469 | while ((_w > 0) || (_h > 0)) |
| 470 | { |
| 471 | VkSubresourceLayout layout = {}; |
| 472 | data_size = sizeof(layout); |
| 473 | err = vkGetImageSubresourceInfo(device(), image, &subresource, VK_SUBRESOURCE_INFO_TYPE_LAYOUT, |
| 474 | &data_size, &layout); |
| 475 | ASSERT_VK_SUCCESS(err); |
| 476 | ASSERT_EQ(sizeof(VkSubresourceLayout), data_size) << "Invalid structure (VkSubresourceLayout) size"; |
Courtney Goeltzenleuchter | ac3b73a | 2014-08-14 17:40:57 -0600 | [diff] [blame] | 477 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 478 | // TODO: 4 should be replaced with pixel size for given format |
| 479 | EXPECT_LE(_w * 4, layout.rowPitch) << "Pitch does not match expected image pitch"; |
| 480 | _w >>= 1; |
| 481 | _h >>= 1; |
| 482 | |
| 483 | subresource.mipLevel++; |
| 484 | } |
Courtney Goeltzenleuchter | ac3b73a | 2014-08-14 17:40:57 -0600 | [diff] [blame] | 485 | } |
| 486 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 487 | VkMemoryRequirements mem_req; |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 488 | VkDeviceMemory image_mem; |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 489 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 490 | data_size = sizeof(mem_req); |
| 491 | err = vkGetObjectInfo(device(), VK_OBJECT_TYPE_IMAGE, image, VK_OBJECT_INFO_TYPE_MEMORY_REQUIREMENTS, |
| 492 | &data_size, &mem_req); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 493 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 494 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 495 | if (mem_req.size) { |
| 496 | |
| 497 | // VkResult VKAPI vkAllocMemory( |
| 498 | // VkDevice device, |
| 499 | // const VkMemoryAllocInfo* pAllocInfo, |
| 500 | // VkDeviceMemory* pMem); |
| 501 | VkMemoryAllocInfo mem_info = {}; |
| 502 | |
| 503 | mem_info.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO; |
| 504 | mem_info.pNext = NULL; |
| 505 | mem_info.allocationSize = mem_req.size; |
| 506 | mem_info.memProps = VK_MEMORY_PROPERTY_SHAREABLE_BIT; |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 507 | err = vkAllocMemory(device(), &mem_info, &image_mem); |
| 508 | ASSERT_VK_SUCCESS(err); |
| 509 | |
| 510 | err = vkBindObjectMemory(device(), VK_OBJECT_TYPE_IMAGE, image, image_mem, 0); |
| 511 | ASSERT_VK_SUCCESS(err); |
| 512 | } |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 513 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 514 | // typedef struct VkImageViewCreateInfo_ |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 515 | // { |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 516 | // VkStructureType sType; // Must be VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 517 | // const void* pNext; // Pointer to next structure |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 518 | // VkImage image; |
| 519 | // VkImageViewType viewType; |
| 520 | // VkFormat format; |
| 521 | // VkChannelMapping channels; |
| 522 | // VkImageSubresourceRange subresourceRange; |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 523 | // float minLod; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 524 | // } VkImageViewCreateInfo; |
| 525 | VkImageViewCreateInfo viewInfo = {}; |
| 526 | VkImageView view; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 527 | viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 528 | viewInfo.image = image; |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 529 | viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D; |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 530 | viewInfo.format = fmt; |
| 531 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 532 | viewInfo.channels.r = VK_CHANNEL_SWIZZLE_R; |
| 533 | viewInfo.channels.g = VK_CHANNEL_SWIZZLE_G; |
| 534 | viewInfo.channels.b = VK_CHANNEL_SWIZZLE_B; |
| 535 | viewInfo.channels.a = VK_CHANNEL_SWIZZLE_A; |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 536 | |
| 537 | viewInfo.subresourceRange.baseArraySlice = 0; |
| 538 | viewInfo.subresourceRange.arraySize = 1; |
| 539 | viewInfo.subresourceRange.baseMipLevel = 0; |
| 540 | viewInfo.subresourceRange.mipLevels = 1; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 541 | viewInfo.subresourceRange.aspect = VK_IMAGE_ASPECT_COLOR; |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 542 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 543 | // VkResult VKAPI vkCreateImageView( |
| 544 | // VkDevice device, |
| 545 | // const VkImageViewCreateInfo* pCreateInfo, |
| 546 | // VkImageView* pView); |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 547 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 548 | err = vkCreateImageView(device(), &viewInfo, &view); |
| 549 | ASSERT_VK_SUCCESS(err) << "vkCreateImageView failed"; |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 550 | |
| 551 | // TODO: Test image memory. |
| 552 | |
| 553 | // All done with image memory, clean up |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 554 | if (mem_req.size) { |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 555 | ASSERT_VK_SUCCESS(vkFreeMemory(device(), image_mem)); |
| 556 | } |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 557 | |
Tony Barbour | b689eef | 2015-06-03 11:40:51 -0600 | [diff] [blame] | 558 | ASSERT_VK_SUCCESS(vkDestroyObject(device(), VK_OBJECT_TYPE_IMAGE_VIEW, view)); |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 559 | ASSERT_VK_SUCCESS(vkDestroyObject(device(), VK_OBJECT_TYPE_IMAGE, image)); |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 560 | } |
| 561 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 562 | TEST_F(VkTest, CreateImage) { |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 563 | CreateImageTest(); |
Courtney Goeltzenleuchter | 6b814b3 | 2014-08-12 09:59:36 -0600 | [diff] [blame] | 564 | } |
| 565 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 566 | void VkTest::CreateCommandBufferTest() |
Courtney Goeltzenleuchter | 0842df7 | 2014-08-20 15:26:55 -0600 | [diff] [blame] | 567 | { |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 568 | VkResult err; |
| 569 | VkCmdBufferCreateInfo info = {}; |
| 570 | VkCmdBuffer cmdBuffer; |
Courtney Goeltzenleuchter | 0842df7 | 2014-08-20 15:26:55 -0600 | [diff] [blame] | 571 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 572 | // typedef struct VkCmdBufferCreateInfo_ |
Courtney Goeltzenleuchter | 0842df7 | 2014-08-20 15:26:55 -0600 | [diff] [blame] | 573 | // { |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 574 | // VkStructureType sType; // Must be VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 575 | // const void* pNext; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 576 | // VK_QUEUE_TYPE queueType; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 577 | // VkFlags flags; |
| 578 | // } VkCmdBufferCreateInfo; |
Courtney Goeltzenleuchter | 0842df7 | 2014-08-20 15:26:55 -0600 | [diff] [blame] | 579 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 580 | info.sType = VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO; |
Courtney Goeltzenleuchter | f316806 | 2015-03-05 18:09:39 -0700 | [diff] [blame] | 581 | info.queueNodeIndex = graphics_queue_node_index; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 582 | err = vkCreateCommandBuffer(device(), &info, &cmdBuffer); |
| 583 | ASSERT_VK_SUCCESS(err) << "vkCreateCommandBuffer failed"; |
Courtney Goeltzenleuchter | 0842df7 | 2014-08-20 15:26:55 -0600 | [diff] [blame] | 584 | |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 585 | ASSERT_VK_SUCCESS(vkDestroyObject(device(), VK_OBJECT_TYPE_COMMAND_BUFFER, cmdBuffer)); |
Courtney Goeltzenleuchter | 0842df7 | 2014-08-20 15:26:55 -0600 | [diff] [blame] | 586 | } |
| 587 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 588 | TEST_F(VkTest, TestCommandBuffer) { |
Courtney Goeltzenleuchter | 0842df7 | 2014-08-20 15:26:55 -0600 | [diff] [blame] | 589 | CreateCommandBufferTest(); |
| 590 | } |
| 591 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame] | 592 | void VkTest::CreateShader(VkShader *pshader) |
Courtney Goeltzenleuchter | 0842df7 | 2014-08-20 15:26:55 -0600 | [diff] [blame] | 593 | { |
Courtney Goeltzenleuchter | a693ed2 | 2014-08-19 13:34:28 -0600 | [diff] [blame] | 594 | void *code; |
| 595 | uint32_t codeSize; |
Cody Northrop | acfb049 | 2015-03-17 15:55:58 -0600 | [diff] [blame] | 596 | struct icd_spv_header *pSPV; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 597 | VkResult err; |
Courtney Goeltzenleuchter | a693ed2 | 2014-08-19 13:34:28 -0600 | [diff] [blame] | 598 | |
Cody Northrop | acfb049 | 2015-03-17 15:55:58 -0600 | [diff] [blame] | 599 | codeSize = sizeof(struct icd_spv_header) + 100; |
Courtney Goeltzenleuchter | a693ed2 | 2014-08-19 13:34:28 -0600 | [diff] [blame] | 600 | code = malloc(codeSize); |
| 601 | ASSERT_TRUE(NULL != code) << "malloc failed!"; |
| 602 | |
| 603 | memset(code, 0, codeSize); |
| 604 | |
Cody Northrop | acfb049 | 2015-03-17 15:55:58 -0600 | [diff] [blame] | 605 | // Indicate that this is SPV data. |
| 606 | pSPV = (struct icd_spv_header *) code; |
| 607 | pSPV->magic = ICD_SPV_MAGIC; |
| 608 | pSPV->version = ICD_SPV_VERSION; |
Courtney Goeltzenleuchter | a693ed2 | 2014-08-19 13:34:28 -0600 | [diff] [blame] | 609 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 610 | // typedef struct VkShaderCreateInfo_ |
Courtney Goeltzenleuchter | a693ed2 | 2014-08-19 13:34:28 -0600 | [diff] [blame] | 611 | // { |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 612 | // VkStructureType sType; // Must be VK_STRUCTURE_TYPE_SHADER_CREATE_INFO |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 613 | // const void* pNext; // Pointer to next structure |
| 614 | // size_t codeSize; // Specified in bytes |
| 615 | // const void* pCode; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 616 | // VkFlags flags; // Reserved |
| 617 | // } VkShaderCreateInfo; |
Courtney Goeltzenleuchter | a693ed2 | 2014-08-19 13:34:28 -0600 | [diff] [blame] | 618 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 619 | VkShaderCreateInfo createInfo; |
| 620 | VkShader shader; |
Courtney Goeltzenleuchter | a693ed2 | 2014-08-19 13:34:28 -0600 | [diff] [blame] | 621 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 622 | createInfo.sType = VK_STRUCTURE_TYPE_SHADER_CREATE_INFO; |
Courtney Goeltzenleuchter | a693ed2 | 2014-08-19 13:34:28 -0600 | [diff] [blame] | 623 | createInfo.pNext = NULL; |
| 624 | createInfo.pCode = code; |
| 625 | createInfo.codeSize = codeSize; |
| 626 | createInfo.flags = 0; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 627 | err = vkCreateShader(device(), &createInfo, &shader); |
| 628 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | a693ed2 | 2014-08-19 13:34:28 -0600 | [diff] [blame] | 629 | |
Courtney Goeltzenleuchter | 0842df7 | 2014-08-20 15:26:55 -0600 | [diff] [blame] | 630 | *pshader = shader; |
| 631 | } |
| 632 | |
Courtney Goeltzenleuchter | 6b814b3 | 2014-08-12 09:59:36 -0600 | [diff] [blame] | 633 | int main(int argc, char **argv) { |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 634 | ::testing::InitGoogleTest(&argc, argv); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 635 | vk_testing::set_error_callback(test_error_callback); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 636 | return RUN_ALL_TESTS(); |
Courtney Goeltzenleuchter | 7087dde | 2014-08-11 18:19:35 -0600 | [diff] [blame] | 637 | } |