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; |
| 109 | inst_info.ppEnabledExtensionNames = 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() { |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 136 | vkDestroyInstance(inst); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 137 | } |
| 138 | }; |
| 139 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame^] | 140 | TEST_F(VkTest, AllocMemory) { |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 141 | VkResult err; |
Courtney Goeltzenleuchter | ddcb619 | 2015-04-14 18:48:46 -0600 | [diff] [blame] | 142 | VkMemoryAllocInfo alloc_info = {}; |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 143 | VkDeviceMemory gpu_mem; |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 144 | uint8_t *pData; |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 145 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 146 | alloc_info.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO; |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 147 | alloc_info.allocationSize = 1024 * 1024; // 1MB |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 148 | alloc_info.memProps = VK_MEMORY_PROPERTY_SHAREABLE_BIT | |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 149 | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT; |
Tony Barbour | fa6cac7 | 2015-01-16 14:27:35 -0700 | [diff] [blame] | 150 | |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 151 | |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 152 | // TODO: Try variety of memory priorities |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 153 | alloc_info.memPriority = VK_MEMORY_PRIORITY_NORMAL; |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 154 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 155 | err = vkAllocMemory(device(), &alloc_info, &gpu_mem); |
| 156 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | 7087dde | 2014-08-11 18:19:35 -0600 | [diff] [blame] | 157 | |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 158 | err = vkMapMemory(device(), gpu_mem, 0, 0, 0, (void **) &pData); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 159 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | 6b814b3 | 2014-08-12 09:59:36 -0600 | [diff] [blame] | 160 | |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 161 | memset(pData, 0x55, alloc_info.allocationSize); |
| 162 | EXPECT_EQ(0x55, pData[0]) << "Memory read not same a write"; |
| 163 | |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 164 | err = vkUnmapMemory(device(), gpu_mem); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 165 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | 6b814b3 | 2014-08-12 09:59:36 -0600 | [diff] [blame] | 166 | |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 167 | err = vkFreeMemory(device(), gpu_mem); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 168 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 169 | } |
Courtney Goeltzenleuchter | 6b814b3 | 2014-08-12 09:59:36 -0600 | [diff] [blame] | 170 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame^] | 171 | TEST_F(VkTest, Event) { |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 172 | VkEventCreateInfo event_info; |
| 173 | VkEvent event; |
| 174 | VkMemoryRequirements mem_req; |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame^] | 175 | size_t data_size; |
| 176 | VkDeviceMemory event_mem; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 177 | VkResult err; |
Courtney Goeltzenleuchter | 6b814b3 | 2014-08-12 09:59:36 -0600 | [diff] [blame] | 178 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 179 | // typedef struct VkEventCreateInfo_ |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 180 | // { |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 181 | // VkStructureType sType; // Must be VK_STRUCTURE_TYPE_EVENT_CREATE_INFO |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 182 | // const void* pNext; // Pointer to next structure |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 183 | // VkFlags flags; // Reserved |
| 184 | // } VkEventCreateInfo; |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 185 | memset(&event_info, 0, sizeof(event_info)); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 186 | event_info.sType = VK_STRUCTURE_TYPE_EVENT_CREATE_INFO; |
Courtney Goeltzenleuchter | 6b814b3 | 2014-08-12 09:59:36 -0600 | [diff] [blame] | 187 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 188 | err = vkCreateEvent(device(), &event_info, &event); |
| 189 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 190 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame^] | 191 | data_size = sizeof(mem_req); |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 192 | 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^] | 193 | &data_size, &mem_req); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 194 | ASSERT_VK_SUCCESS(err); |
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 | if (mem_req.size) { |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 197 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame^] | 198 | // VkResult VKAPI vkAllocMemory( |
| 199 | // VkDevice device, |
| 200 | // const VkMemoryAllocInfo* pAllocInfo, |
| 201 | // VkDeviceMemory* pMem); |
| 202 | VkMemoryAllocInfo mem_info; |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 203 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame^] | 204 | memset(&mem_info, 0, sizeof(mem_info)); |
| 205 | mem_info.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO; |
| 206 | mem_info.allocationSize = mem_req.size; |
| 207 | mem_info.memProps = VK_MEMORY_PROPERTY_SHAREABLE_BIT; |
| 208 | mem_info.memPriority = VK_MEMORY_PRIORITY_NORMAL; |
| 209 | err = vkAllocMemory(device(), &mem_info, &event_mem); |
| 210 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 211 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame^] | 212 | err = vkBindObjectMemory(device(), VK_OBJECT_TYPE_EVENT, event, event_mem, 0); |
| 213 | ASSERT_VK_SUCCESS(err); |
| 214 | } |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 215 | err = vkResetEvent(device(), event); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 216 | ASSERT_VK_SUCCESS(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 = vkGetEventStatus(device(), event); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 219 | ASSERT_EQ(VK_EVENT_RESET, 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 = vkSetEvent(device(), event); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 222 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 223 | |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 224 | err = vkGetEventStatus(device(), event); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 225 | ASSERT_EQ(VK_EVENT_SET, err); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 226 | |
| 227 | // TODO: Test actual synchronization with command buffer event. |
| 228 | |
| 229 | // All done with event memory, clean up |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame^] | 230 | if (mem_req.size) { |
| 231 | err = vkBindObjectMemory(device(), VK_OBJECT_TYPE_EVENT, event, VK_NULL_HANDLE, 0); |
| 232 | ASSERT_VK_SUCCESS(err); |
| 233 | err = vkFreeMemory(device(), event_mem); |
| 234 | ASSERT_VK_SUCCESS(err); |
| 235 | } |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 236 | |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 237 | err = vkDestroyObject(device(), VK_OBJECT_TYPE_EVENT, event); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 238 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 239 | } |
| 240 | |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 241 | #define MAX_QUERY_SLOTS 10 |
| 242 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame^] | 243 | TEST_F(VkTest, Query) { |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 244 | VkQueryPoolCreateInfo query_info; |
| 245 | VkQueryPool query_pool; |
Chia-I Wu | 54ed079 | 2014-12-27 14:14:50 +0800 | [diff] [blame] | 246 | size_t data_size; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 247 | VkMemoryRequirements mem_req; |
Chia-I Wu | 54ed079 | 2014-12-27 14:14:50 +0800 | [diff] [blame] | 248 | size_t query_result_size; |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 249 | uint32_t *query_result_data; |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame^] | 250 | VkDeviceMemory query_mem; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 251 | VkResult err; |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 252 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 253 | // typedef enum VkQueryType_ |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 254 | // { |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 255 | // VK_QUERY_TYPE_OCCLUSION = 0x00000000, |
| 256 | // VK_QUERY_TYPE_PIPELINE_STATISTICS = 0x00000001, |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 257 | |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 258 | // VK_QUERY_TYPE_BEGIN_RANGE = VK_QUERY_TYPE_OCCLUSION, |
| 259 | // VK_QUERY_TYPE_END_RANGE = VK_QUERY_TYPE_PIPELINE_STATISTICS, |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 260 | // 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] | 261 | // VK_MAX_ENUM(VkQueryType_) |
| 262 | // } VkQueryType; |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 263 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 264 | // typedef struct VkQueryPoolCreateInfo_ |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 265 | // { |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 266 | // VkStructureType sType; // Must be VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 267 | // const void* pNext; // Pointer to next structure |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 268 | // VkQueryType queryType; |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 269 | // uint32_t slots; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 270 | // } VkQueryPoolCreateInfo; |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 271 | |
| 272 | memset(&query_info, 0, sizeof(query_info)); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 273 | query_info.sType = VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO; |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 274 | query_info.queryType = VK_QUERY_TYPE_OCCLUSION; |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 275 | query_info.slots = MAX_QUERY_SLOTS; |
| 276 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 277 | // VkResult VKAPI vkCreateQueryPool( |
| 278 | // VkDevice device, |
| 279 | // const VkQueryPoolCreateInfo* pCreateInfo, |
| 280 | // VkQueryPool* pQueryPool); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 281 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 282 | err = vkCreateQueryPool(device(), &query_info, &query_pool); |
| 283 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 284 | |
Jon Ashburn | b8e4389 | 2014-09-25 14:36:58 -0600 | [diff] [blame] | 285 | data_size = sizeof(mem_req); |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 286 | 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^] | 287 | &data_size, &mem_req); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 288 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 289 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame^] | 290 | if (mem_req.size) { |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 291 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame^] | 292 | // VkResult VKAPI vkAllocMemory( |
| 293 | // VkDevice device, |
| 294 | // const VkMemoryAllocInfo* pAllocInfo, |
| 295 | // VkDeviceMemory* pMem); |
| 296 | VkMemoryAllocInfo mem_info; |
| 297 | |
| 298 | memset(&mem_info, 0, sizeof(mem_info)); |
| 299 | mem_info.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO; |
| 300 | // TODO: Is a simple multiple all that's needed here? |
| 301 | mem_info.allocationSize = mem_req.size * MAX_QUERY_SLOTS; |
| 302 | mem_info.memProps = VK_MEMORY_PROPERTY_SHAREABLE_BIT; |
| 303 | mem_info.memPriority = VK_MEMORY_PRIORITY_NORMAL; |
| 304 | // TODO: Should this be pinned? Or maybe a separate test with pinned. |
| 305 | err = vkAllocMemory(device(), &mem_info, &query_mem); |
| 306 | ASSERT_VK_SUCCESS(err); |
| 307 | |
| 308 | err = vkBindObjectMemory(device(), VK_OBJECT_TYPE_QUERY_POOL, query_pool, query_mem, 0); |
| 309 | ASSERT_VK_SUCCESS(err); |
| 310 | } |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 311 | // TODO: Test actual synchronization with command buffer event. |
| 312 | // TODO: Create command buffer |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 313 | // TODO: vkCmdResetQueryPool |
| 314 | // TODO: vkCmdBeginQuery |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 315 | // TODO: commands |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 316 | // TOOD: vkCmdEndQuery |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 317 | |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 318 | err = vkGetQueryPoolResults(device(), query_pool, 0, MAX_QUERY_SLOTS, |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 319 | &query_result_size, VK_NULL_HANDLE, 0); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 320 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 321 | |
| 322 | if (query_result_size > 0) { |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 323 | query_result_data = new uint32_t [query_result_size]; |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 324 | err = vkGetQueryPoolResults(device(), query_pool, 0, MAX_QUERY_SLOTS, |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 325 | &query_result_size, query_result_data, 0); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 326 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 327 | |
| 328 | // TODO: Test Query result data. |
| 329 | |
| 330 | } |
| 331 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame^] | 332 | if (mem_req.size) { |
| 333 | // All done with QueryPool memory, clean up |
| 334 | err = vkBindObjectMemory(device(), VK_OBJECT_TYPE_QUERY_POOL, query_pool, VK_NULL_HANDLE, 0); |
| 335 | ASSERT_VK_SUCCESS(err); |
| 336 | err = vkFreeMemory(device(), query_mem); |
| 337 | ASSERT_VK_SUCCESS(err); |
| 338 | } |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 339 | |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 340 | err = vkDestroyObject(device(), VK_OBJECT_TYPE_QUERY_POOL, query_pool); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 341 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 342 | } |
Courtney Goeltzenleuchter | 6b814b3 | 2014-08-12 09:59:36 -0600 | [diff] [blame] | 343 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 344 | 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] | 345 | { |
| 346 | int que_idx; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 347 | VkResult err; |
| 348 | VkQueue queue; |
Courtney Goeltzenleuchter | cc32aa9 | 2014-08-14 10:15:09 -0600 | [diff] [blame] | 349 | |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 350 | const VkPhysicalDeviceQueueProperties props = device->gpu().queue_properties()[queue_node_index]; |
Chia-I Wu | 3b78d31 | 2014-12-29 15:39:23 +0800 | [diff] [blame] | 351 | for (que_idx = 0; que_idx < props.queueCount; que_idx++) { |
Mark Lobodzinski | cf26e07 | 2015-04-16 11:44:05 -0500 | [diff] [blame] | 352 | // 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] | 353 | err = vkGetDeviceQueue(device->obj(), queue_node_index, que_idx, &queue); |
| 354 | 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] | 355 | } |
| 356 | } |
| 357 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame^] | 358 | void VkTest::CreateImageTest() |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 359 | { |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 360 | VkResult err; |
| 361 | VkImage image; |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 362 | uint32_t w, h, mipCount; |
| 363 | size_t size; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 364 | VkFormat fmt; |
| 365 | VkFormatProperties image_fmt; |
Chia-I Wu | 54ed079 | 2014-12-27 14:14:50 +0800 | [diff] [blame] | 366 | size_t data_size; |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 367 | |
| 368 | w =512; |
| 369 | h = 256; |
| 370 | mipCount = 0; |
| 371 | |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 372 | uint32_t _w = w; |
| 373 | uint32_t _h = h; |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 374 | while( ( _w > 0 ) || ( _h > 0 ) ) |
| 375 | { |
| 376 | _w >>= 1; |
| 377 | _h >>= 1; |
| 378 | mipCount++; |
| 379 | } |
| 380 | |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 381 | fmt = VK_FORMAT_R8G8B8A8_UINT; |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 382 | // TODO: Pick known good format rather than just expect common format |
| 383 | /* |
| 384 | * XXX: What should happen if given NULL HANDLE for the pData argument? |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 385 | * 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] | 386 | * an expectation that pData is a valid pointer. |
| 387 | * However, why include a returned size value? That implies that the |
| 388 | * amount of data may vary and that doesn't work well for using a |
| 389 | * fixed structure. |
| 390 | */ |
| 391 | |
Jon Ashburn | b8e4389 | 2014-09-25 14:36:58 -0600 | [diff] [blame] | 392 | size = sizeof(image_fmt); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 393 | err = vkGetFormatInfo(device(), fmt, |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 394 | VK_FORMAT_INFO_TYPE_PROPERTIES, |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 395 | &size, &image_fmt); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 396 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 397 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 398 | // typedef struct VkImageCreateInfo_ |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 399 | // { |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 400 | // VkStructureType sType; // Must be VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 401 | // const void* pNext; // Pointer to next structure. |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 402 | // VkImageType imageType; |
| 403 | // VkFormat format; |
| 404 | // VkExtent3D extent; |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 405 | // uint32_t mipLevels; |
| 406 | // uint32_t arraySize; |
| 407 | // uint32_t samples; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 408 | // VkImageTiling tiling; |
| 409 | // VkFlags usage; // VkImageUsageFlags |
| 410 | // VkFlags flags; // VkImageCreateFlags |
| 411 | // } VkImageCreateInfo; |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 412 | |
| 413 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 414 | VkImageCreateInfo imageCreateInfo = {}; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 415 | imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 416 | imageCreateInfo.imageType = VK_IMAGE_TYPE_2D; |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 417 | imageCreateInfo.format = fmt; |
| 418 | imageCreateInfo.arraySize = 1; |
| 419 | imageCreateInfo.extent.width = w; |
| 420 | imageCreateInfo.extent.height = h; |
| 421 | imageCreateInfo.extent.depth = 1; |
| 422 | imageCreateInfo.mipLevels = mipCount; |
| 423 | imageCreateInfo.samples = 1; |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame^] | 424 | if (image_fmt.linearTilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) { |
| 425 | imageCreateInfo.tiling = VK_IMAGE_TILING_LINEAR; |
| 426 | } |
| 427 | else if (image_fmt.optimalTilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) { |
| 428 | imageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL; |
| 429 | } |
| 430 | else { |
| 431 | FAIL() << "Neither Linear nor Optimal allowed for color attachment"; |
| 432 | } |
Courtney Goeltzenleuchter | ad87081 | 2015-04-15 15:29:59 -0600 | [diff] [blame] | 433 | imageCreateInfo.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 434 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 435 | // VkResult VKAPI vkCreateImage( |
| 436 | // VkDevice device, |
| 437 | // const VkImageCreateInfo* pCreateInfo, |
| 438 | // VkImage* pImage); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 439 | err = vkCreateImage(device(), &imageCreateInfo, &image); |
| 440 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 441 | |
Courtney Goeltzenleuchter | ac3b73a | 2014-08-14 17:40:57 -0600 | [diff] [blame] | 442 | // Verify image resources |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 443 | // VkResult VKAPI vkGetImageSubresourceInfo( |
| 444 | // VkImage image, |
| 445 | // const VkImageSubresource* pSubresource, |
| 446 | // VkSubresourceInfoType infoType, |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 447 | // size_t* pDataSize, |
| 448 | // void* pData); |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 449 | // typedef struct VkSubresourceLayout_ |
Courtney Goeltzenleuchter | ac3b73a | 2014-08-14 17:40:57 -0600 | [diff] [blame] | 450 | // { |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 451 | // VkDeviceSize offset; // Specified in bytes |
| 452 | // VkDeviceSize size; // Specified in bytes |
| 453 | // VkDeviceSize rowPitch; // Specified in bytes |
| 454 | // VkDeviceSize depthPitch; // Specified in bytes |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 455 | // } VkSubresourceLayout; |
Courtney Goeltzenleuchter | ac3b73a | 2014-08-14 17:40:57 -0600 | [diff] [blame] | 456 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 457 | // typedef struct VkImageSubresource_ |
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 | // VkImageAspect aspect; |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 460 | // uint32_t mipLevel; |
| 461 | // uint32_t arraySlice; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 462 | // } VkImageSubresource; |
| 463 | // typedef enum VkSubresourceInfoType_ |
Courtney Goeltzenleuchter | ac3b73a | 2014-08-14 17:40:57 -0600 | [diff] [blame] | 464 | // { |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 465 | // // Info type for vkGetImageSubresourceInfo() |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 466 | // VK_SUBRESOURCE_INFO_TYPE_LAYOUT = 0x00000000, |
Courtney Goeltzenleuchter | ac3b73a | 2014-08-14 17:40:57 -0600 | [diff] [blame] | 467 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 468 | // VK_MAX_ENUM(VkSubresourceInfoType_) |
| 469 | // } VkSubresourceInfoType; |
Courtney Goeltzenleuchter | ac3b73a | 2014-08-14 17:40:57 -0600 | [diff] [blame] | 470 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame^] | 471 | if (image_fmt.linearTilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) { |
| 472 | VkImageSubresource subresource = {}; |
| 473 | subresource.aspect = VK_IMAGE_ASPECT_COLOR; |
| 474 | subresource.arraySlice = 0; |
Courtney Goeltzenleuchter | ac3b73a | 2014-08-14 17:40:57 -0600 | [diff] [blame] | 475 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame^] | 476 | _w = w; |
| 477 | _h = h; |
| 478 | while ((_w > 0) || (_h > 0)) |
| 479 | { |
| 480 | VkSubresourceLayout layout = {}; |
| 481 | data_size = sizeof(layout); |
| 482 | err = vkGetImageSubresourceInfo(device(), image, &subresource, VK_SUBRESOURCE_INFO_TYPE_LAYOUT, |
| 483 | &data_size, &layout); |
| 484 | ASSERT_VK_SUCCESS(err); |
| 485 | ASSERT_EQ(sizeof(VkSubresourceLayout), data_size) << "Invalid structure (VkSubresourceLayout) size"; |
Courtney Goeltzenleuchter | ac3b73a | 2014-08-14 17:40:57 -0600 | [diff] [blame] | 486 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame^] | 487 | // TODO: 4 should be replaced with pixel size for given format |
| 488 | EXPECT_LE(_w * 4, layout.rowPitch) << "Pitch does not match expected image pitch"; |
| 489 | _w >>= 1; |
| 490 | _h >>= 1; |
| 491 | |
| 492 | subresource.mipLevel++; |
| 493 | } |
Courtney Goeltzenleuchter | ac3b73a | 2014-08-14 17:40:57 -0600 | [diff] [blame] | 494 | } |
| 495 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 496 | VkMemoryRequirements mem_req; |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 497 | VkDeviceMemory image_mem; |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 498 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame^] | 499 | data_size = sizeof(mem_req); |
| 500 | err = vkGetObjectInfo(device(), VK_OBJECT_TYPE_IMAGE, image, VK_OBJECT_INFO_TYPE_MEMORY_REQUIREMENTS, |
| 501 | &data_size, &mem_req); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 502 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 503 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame^] | 504 | if (mem_req.size) { |
| 505 | |
| 506 | // VkResult VKAPI vkAllocMemory( |
| 507 | // VkDevice device, |
| 508 | // const VkMemoryAllocInfo* pAllocInfo, |
| 509 | // VkDeviceMemory* pMem); |
| 510 | VkMemoryAllocInfo mem_info = {}; |
| 511 | |
| 512 | mem_info.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO; |
| 513 | mem_info.pNext = NULL; |
| 514 | mem_info.allocationSize = mem_req.size; |
| 515 | mem_info.memProps = VK_MEMORY_PROPERTY_SHAREABLE_BIT; |
| 516 | mem_info.memPriority = VK_MEMORY_PRIORITY_NORMAL; |
| 517 | err = vkAllocMemory(device(), &mem_info, &image_mem); |
| 518 | ASSERT_VK_SUCCESS(err); |
| 519 | |
| 520 | err = vkBindObjectMemory(device(), VK_OBJECT_TYPE_IMAGE, image, image_mem, 0); |
| 521 | ASSERT_VK_SUCCESS(err); |
| 522 | } |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 523 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 524 | // typedef struct VkImageViewCreateInfo_ |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 525 | // { |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 526 | // VkStructureType sType; // Must be VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 527 | // const void* pNext; // Pointer to next structure |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 528 | // VkImage image; |
| 529 | // VkImageViewType viewType; |
| 530 | // VkFormat format; |
| 531 | // VkChannelMapping channels; |
| 532 | // VkImageSubresourceRange subresourceRange; |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 533 | // float minLod; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 534 | // } VkImageViewCreateInfo; |
| 535 | VkImageViewCreateInfo viewInfo = {}; |
| 536 | VkImageView view; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 537 | viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 538 | viewInfo.image = image; |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 539 | viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D; |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 540 | viewInfo.format = fmt; |
| 541 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 542 | viewInfo.channels.r = VK_CHANNEL_SWIZZLE_R; |
| 543 | viewInfo.channels.g = VK_CHANNEL_SWIZZLE_G; |
| 544 | viewInfo.channels.b = VK_CHANNEL_SWIZZLE_B; |
| 545 | viewInfo.channels.a = VK_CHANNEL_SWIZZLE_A; |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 546 | |
| 547 | viewInfo.subresourceRange.baseArraySlice = 0; |
| 548 | viewInfo.subresourceRange.arraySize = 1; |
| 549 | viewInfo.subresourceRange.baseMipLevel = 0; |
| 550 | viewInfo.subresourceRange.mipLevels = 1; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 551 | viewInfo.subresourceRange.aspect = VK_IMAGE_ASPECT_COLOR; |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 552 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 553 | // VkResult VKAPI vkCreateImageView( |
| 554 | // VkDevice device, |
| 555 | // const VkImageViewCreateInfo* pCreateInfo, |
| 556 | // VkImageView* pView); |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 557 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 558 | err = vkCreateImageView(device(), &viewInfo, &view); |
| 559 | ASSERT_VK_SUCCESS(err) << "vkCreateImageView failed"; |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 560 | |
| 561 | // TODO: Test image memory. |
| 562 | |
| 563 | // All done with image memory, clean up |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame^] | 564 | if (mem_req.size) { |
| 565 | ASSERT_VK_SUCCESS(vkBindObjectMemory(device(), VK_OBJECT_TYPE_IMAGE, image, VK_NULL_HANDLE, 0)); |
| 566 | ASSERT_VK_SUCCESS(vkFreeMemory(device(), image_mem)); |
| 567 | } |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 568 | |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 569 | ASSERT_VK_SUCCESS(vkDestroyObject(device(), VK_OBJECT_TYPE_IMAGE, image)); |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 570 | } |
| 571 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame^] | 572 | TEST_F(VkTest, CreateImage) { |
Courtney Goeltzenleuchter | 9c3aad0 | 2014-08-13 17:55:12 -0600 | [diff] [blame] | 573 | CreateImageTest(); |
Courtney Goeltzenleuchter | 6b814b3 | 2014-08-12 09:59:36 -0600 | [diff] [blame] | 574 | } |
| 575 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame^] | 576 | void VkTest::CreateCommandBufferTest() |
Courtney Goeltzenleuchter | 0842df7 | 2014-08-20 15:26:55 -0600 | [diff] [blame] | 577 | { |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 578 | VkResult err; |
| 579 | VkCmdBufferCreateInfo info = {}; |
| 580 | VkCmdBuffer cmdBuffer; |
Courtney Goeltzenleuchter | 0842df7 | 2014-08-20 15:26:55 -0600 | [diff] [blame] | 581 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 582 | // typedef struct VkCmdBufferCreateInfo_ |
Courtney Goeltzenleuchter | 0842df7 | 2014-08-20 15:26:55 -0600 | [diff] [blame] | 583 | // { |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 584 | // VkStructureType sType; // Must be VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 585 | // const void* pNext; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 586 | // VK_QUEUE_TYPE queueType; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 587 | // VkFlags flags; |
| 588 | // } VkCmdBufferCreateInfo; |
Courtney Goeltzenleuchter | 0842df7 | 2014-08-20 15:26:55 -0600 | [diff] [blame] | 589 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 590 | info.sType = VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO; |
Courtney Goeltzenleuchter | f316806 | 2015-03-05 18:09:39 -0700 | [diff] [blame] | 591 | info.queueNodeIndex = graphics_queue_node_index; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 592 | err = vkCreateCommandBuffer(device(), &info, &cmdBuffer); |
| 593 | ASSERT_VK_SUCCESS(err) << "vkCreateCommandBuffer failed"; |
Courtney Goeltzenleuchter | 0842df7 | 2014-08-20 15:26:55 -0600 | [diff] [blame] | 594 | |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 595 | ASSERT_VK_SUCCESS(vkDestroyObject(device(), VK_OBJECT_TYPE_COMMAND_BUFFER, cmdBuffer)); |
Courtney Goeltzenleuchter | 0842df7 | 2014-08-20 15:26:55 -0600 | [diff] [blame] | 596 | } |
| 597 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame^] | 598 | TEST_F(VkTest, TestCommandBuffer) { |
Courtney Goeltzenleuchter | 0842df7 | 2014-08-20 15:26:55 -0600 | [diff] [blame] | 599 | CreateCommandBufferTest(); |
| 600 | } |
| 601 | |
Tony-LunarG | e4fe315 | 2015-05-15 12:42:49 -0600 | [diff] [blame^] | 602 | void VkTest::CreateShader(VkShader *pshader) |
Courtney Goeltzenleuchter | 0842df7 | 2014-08-20 15:26:55 -0600 | [diff] [blame] | 603 | { |
Courtney Goeltzenleuchter | a693ed2 | 2014-08-19 13:34:28 -0600 | [diff] [blame] | 604 | void *code; |
| 605 | uint32_t codeSize; |
Cody Northrop | acfb049 | 2015-03-17 15:55:58 -0600 | [diff] [blame] | 606 | struct icd_spv_header *pSPV; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 607 | VkResult err; |
Courtney Goeltzenleuchter | a693ed2 | 2014-08-19 13:34:28 -0600 | [diff] [blame] | 608 | |
Cody Northrop | acfb049 | 2015-03-17 15:55:58 -0600 | [diff] [blame] | 609 | codeSize = sizeof(struct icd_spv_header) + 100; |
Courtney Goeltzenleuchter | a693ed2 | 2014-08-19 13:34:28 -0600 | [diff] [blame] | 610 | code = malloc(codeSize); |
| 611 | ASSERT_TRUE(NULL != code) << "malloc failed!"; |
| 612 | |
| 613 | memset(code, 0, codeSize); |
| 614 | |
Cody Northrop | acfb049 | 2015-03-17 15:55:58 -0600 | [diff] [blame] | 615 | // Indicate that this is SPV data. |
| 616 | pSPV = (struct icd_spv_header *) code; |
| 617 | pSPV->magic = ICD_SPV_MAGIC; |
| 618 | pSPV->version = ICD_SPV_VERSION; |
Courtney Goeltzenleuchter | a693ed2 | 2014-08-19 13:34:28 -0600 | [diff] [blame] | 619 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 620 | // typedef struct VkShaderCreateInfo_ |
Courtney Goeltzenleuchter | a693ed2 | 2014-08-19 13:34:28 -0600 | [diff] [blame] | 621 | // { |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 622 | // VkStructureType sType; // Must be VK_STRUCTURE_TYPE_SHADER_CREATE_INFO |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 623 | // const void* pNext; // Pointer to next structure |
| 624 | // size_t codeSize; // Specified in bytes |
| 625 | // const void* pCode; |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 626 | // VkFlags flags; // Reserved |
| 627 | // } VkShaderCreateInfo; |
Courtney Goeltzenleuchter | a693ed2 | 2014-08-19 13:34:28 -0600 | [diff] [blame] | 628 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 629 | VkShaderCreateInfo createInfo; |
| 630 | VkShader shader; |
Courtney Goeltzenleuchter | a693ed2 | 2014-08-19 13:34:28 -0600 | [diff] [blame] | 631 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 632 | createInfo.sType = VK_STRUCTURE_TYPE_SHADER_CREATE_INFO; |
Courtney Goeltzenleuchter | a693ed2 | 2014-08-19 13:34:28 -0600 | [diff] [blame] | 633 | createInfo.pNext = NULL; |
| 634 | createInfo.pCode = code; |
| 635 | createInfo.codeSize = codeSize; |
| 636 | createInfo.flags = 0; |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 637 | err = vkCreateShader(device(), &createInfo, &shader); |
| 638 | ASSERT_VK_SUCCESS(err); |
Courtney Goeltzenleuchter | a693ed2 | 2014-08-19 13:34:28 -0600 | [diff] [blame] | 639 | |
Courtney Goeltzenleuchter | 0842df7 | 2014-08-20 15:26:55 -0600 | [diff] [blame] | 640 | *pshader = shader; |
| 641 | } |
| 642 | |
Courtney Goeltzenleuchter | 6b814b3 | 2014-08-12 09:59:36 -0600 | [diff] [blame] | 643 | int main(int argc, char **argv) { |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 644 | ::testing::InitGoogleTest(&argc, argv); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 645 | vk_testing::set_error_callback(test_error_callback); |
Courtney Goeltzenleuchter | ed56abc | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 646 | return RUN_ALL_TESTS(); |
Courtney Goeltzenleuchter | 7087dde | 2014-08-11 18:19:35 -0600 | [diff] [blame] | 647 | } |