blob: 0c058ea00263ed935784c30425f0ee42ae342c61 [file] [log] [blame]
Courtney Goeltzenleuchter7087dde2014-08-11 18:19:35 -06001// 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 Goeltzenleuchtered56abc2014-08-12 14:12:22 -060030
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060031// VK tests
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -060032//
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 Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060054// Verify VK driver initialization
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -060055
Courtney Goeltzenleuchter7087dde2014-08-11 18:19:35 -060056#include <stdlib.h>
57#include <stdio.h>
58#include <stdbool.h>
59#include <string.h>
60
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060061#include <vulkan.h>
Courtney Goeltzenleuchter7087dde2014-08-11 18:19:35 -060062
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060063#include "vktestbinding.h"
Chia-I Wu3b78d312014-12-29 15:39:23 +080064#include "test_common.h"
Cody Northropd4e020a2015-03-17 14:54:35 -060065#include "icd-spv.h"
Courtney Goeltzenleuchter7087dde2014-08-11 18:19:35 -060066
Jon Ashburn07b309a2015-04-15 11:31:12 -060067#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
68
Tony-LunarGe4fe3152015-05-15 12:42:49 -060069class VkTest : public ::testing::Test {
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -060070public:
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -060071 void CreateImageTest();
Courtney Goeltzenleuchter0842df72014-08-20 15:26:55 -060072 void CreateCommandBufferTest();
73 void CreatePipelineTest();
74 void CreateShaderTest();
Cody Northrop87ae5e12015-08-24 15:11:10 -060075 void CreateShader(VkShader *pshader, VkShaderStage stage);
Courtney Goeltzenleuchter7087dde2014-08-11 18:19:35 -060076
Chia-I Wua2636292015-07-03 10:41:20 +080077 VkDevice device() {return m_device->handle();}
Courtney Goeltzenleuchterb85c5812014-08-19 18:35:50 -060078
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -060079protected:
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060080 VkApplicationInfo app_info;
81 VkInstance inst;
Tony Barbour8205d902015-04-16 15:59:00 -060082 VkPhysicalDevice objs[16];
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -060083 uint32_t gpu_count;
Chia-I Wu3b78d312014-12-29 15:39:23 +080084
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -060085 uint32_t m_device_id;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060086 vk_testing::Device *m_device;
Tony Barbour8205d902015-04-16 15:59:00 -060087 VkPhysicalDeviceProperties props;
Cody Northropef72e2a2015-08-03 17:04:53 -060088 std::vector<VkQueueFamilyProperties> queue_props;
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -070089 uint32_t graphics_queue_node_index;
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -060090
91 virtual void SetUp() {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060092 VkResult err;
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -070093 int i;
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -060094
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060095 this->app_info.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -060096 this->app_info.pNext = NULL;
Chia-I Wu7461fcf2014-12-27 15:16:07 +080097 this->app_info.pAppName = "base";
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -060098 this->app_info.appVersion = 1;
Chia-I Wu7461fcf2014-12-27 15:16:07 +080099 this->app_info.pEngineName = "unittest";
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600100 this->app_info.engineVersion = 1;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600101 this->app_info.apiVersion = VK_API_VERSION;
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600102 VkInstanceCreateInfo inst_info = {};
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600103 inst_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
Jon Ashburn29669a42015-04-04 14:52:07 -0600104 inst_info.pNext = NULL;
105 inst_info.pAppInfo = &app_info;
106 inst_info.pAllocCb = NULL;
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600107 inst_info.layerCount = 0;
108 inst_info.ppEnabledLayerNames = NULL;
Jon Ashburn29669a42015-04-04 14:52:07 -0600109 inst_info.extensionCount = 0;
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600110 inst_info.ppEnabledExtensionNames = NULL;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600111 err = vkCreateInstance(&inst_info, &inst);
112 ASSERT_VK_SUCCESS(err);
Jon Ashburn07b309a2015-04-15 11:31:12 -0600113 err = vkEnumeratePhysicalDevices(inst, &this->gpu_count, NULL);
114 ASSERT_VK_SUCCESS(err);
115 ASSERT_LE(this->gpu_count, ARRAY_SIZE(objs)) << "Too many GPUs";
116 err = vkEnumeratePhysicalDevices(inst, &this->gpu_count, objs);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600117 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchter0abdb662015-10-07 13:28:58 -0600118 ASSERT_GE(this->gpu_count, (uint32_t) 1) << "No GPU available";
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600119
Chia-I Wu3b78d312014-12-29 15:39:23 +0800120 m_device_id = 0;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600121 this->m_device = new vk_testing::Device(objs[m_device_id]);
Chia-I Wu3b78d312014-12-29 15:39:23 +0800122 this->m_device->init();
123
Chia-I Wuf5fb1092015-07-03 10:32:05 +0800124 props = m_device->phy().properties();
Chia-I Wu3b78d312014-12-29 15:39:23 +0800125
Chia-I Wuf5fb1092015-07-03 10:32:05 +0800126 queue_props = this->m_device->phy().queue_properties();
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -0700127 for (i = 0; i < queue_props.size(); i++) {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600128 if (queue_props[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) {
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -0700129 graphics_queue_node_index = i;
130 break;
131 }
132 }
133 ASSERT_LT(i, queue_props.size()) << "Could not find a Queue with Graphics support";
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600134 }
135
136 virtual void TearDown() {
Tony Barbour900ae862015-06-02 14:55:46 -0600137 delete m_device;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600138 vkDestroyInstance(inst);
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600139 }
140};
141
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600142TEST_F(VkTest, AllocMemory) {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600143 VkResult err;
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600144 VkMemoryAllocInfo alloc_info = {};
Tony Barbour8205d902015-04-16 15:59:00 -0600145 VkDeviceMemory gpu_mem;
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600146 uint8_t *pData;
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600147
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600148 alloc_info.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO;
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600149 alloc_info.allocationSize = 1024 * 1024; // 1MB
Mark Lobodzinski72346292015-07-02 16:49:40 -0600150 alloc_info.memoryTypeIndex = 0;
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600151
Tony Barbour08baf962015-07-29 14:27:38 -0600152 VkPhysicalDeviceMemoryProperties mem_props;
153 vkGetPhysicalDeviceMemoryProperties(m_device->phy().handle(), &mem_props);
154
155 err = m_device->phy().set_memory_type(((1 << mem_props.memoryTypeCount) - 1), &alloc_info, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT);
156 ASSERT_VK_SUCCESS(err);
157
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600158 err = vkAllocMemory(device(), &alloc_info, &gpu_mem);
159 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchter7087dde2014-08-11 18:19:35 -0600160
Mike Stroyan230e6252015-04-17 12:36:38 -0600161 err = vkMapMemory(device(), gpu_mem, 0, 0, 0, (void **) &pData);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600162 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchter6b814b32014-08-12 09:59:36 -0600163
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600164 memset(pData, 0x55, alloc_info.allocationSize);
Mark Lobodzinski72346292015-07-02 16:49:40 -0600165 EXPECT_EQ(0x55, pData[0]) << "Memory read not same as write";
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600166
Mark Lobodzinski67b42b72015-09-07 13:59:43 -0600167 vkUnmapMemory(device(), gpu_mem);
Courtney Goeltzenleuchter6b814b32014-08-12 09:59:36 -0600168
Mark Lobodzinski67b42b72015-09-07 13:59:43 -0600169 vkFreeMemory(device(), gpu_mem);
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600170}
Courtney Goeltzenleuchter6b814b32014-08-12 09:59:36 -0600171
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600172TEST_F(VkTest, Event) {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600173 VkEventCreateInfo event_info;
174 VkEvent event;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600175 VkResult err;
Courtney Goeltzenleuchter6b814b32014-08-12 09:59:36 -0600176
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600177 // typedef struct VkEventCreateInfo_
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600178 // {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600179 // VkStructureType sType; // Must be VK_STRUCTURE_TYPE_EVENT_CREATE_INFO
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600180 // const void* pNext; // Pointer to next structure
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600181 // VkFlags flags; // Reserved
182 // } VkEventCreateInfo;
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600183 memset(&event_info, 0, sizeof(event_info));
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600184 event_info.sType = VK_STRUCTURE_TYPE_EVENT_CREATE_INFO;
Courtney Goeltzenleuchter6b814b32014-08-12 09:59:36 -0600185
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600186 err = vkCreateEvent(device(), &event_info, &event);
187 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600188
Mike Stroyan230e6252015-04-17 12:36:38 -0600189 err = vkResetEvent(device(), event);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600190 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600191
Mike Stroyan230e6252015-04-17 12:36:38 -0600192 err = vkGetEventStatus(device(), event);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600193 ASSERT_EQ(VK_EVENT_RESET, err);
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600194
Mike Stroyan230e6252015-04-17 12:36:38 -0600195 err = vkSetEvent(device(), event);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600196 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600197
Mike Stroyan230e6252015-04-17 12:36:38 -0600198 err = vkGetEventStatus(device(), event);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600199 ASSERT_EQ(VK_EVENT_SET, err);
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600200
201 // TODO: Test actual synchronization with command buffer event.
202
203 // All done with event memory, clean up
Mark Lobodzinski67b42b72015-09-07 13:59:43 -0600204 vkDestroyEvent(device(), event);
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600205}
206
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600207#define MAX_QUERY_SLOTS 10
208
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600209TEST_F(VkTest, Query) {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600210 VkQueryPoolCreateInfo query_info;
211 VkQueryPool query_pool;
Chia-I Wu54ed0792014-12-27 14:14:50 +0800212 size_t query_result_size;
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600213 uint32_t *query_result_data;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600214 VkResult err;
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600215
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600216 // typedef enum VkQueryType_
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600217 // {
Tony Barbour8205d902015-04-16 15:59:00 -0600218 // VK_QUERY_TYPE_OCCLUSION = 0x00000000,
219 // VK_QUERY_TYPE_PIPELINE_STATISTICS = 0x00000001,
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600220
Tony Barbour8205d902015-04-16 15:59:00 -0600221 // VK_QUERY_TYPE_BEGIN_RANGE = VK_QUERY_TYPE_OCCLUSION,
222 // VK_QUERY_TYPE_END_RANGE = VK_QUERY_TYPE_PIPELINE_STATISTICS,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600223 // VK_NUM_QUERY_TYPE = (VK_QUERY_TYPE_END_RANGE - VK_QUERY_TYPE_BEGIN_RANGE + 1),
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600224 // VK_MAX_ENUM(VkQueryType_)
225 // } VkQueryType;
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600226
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600227 // typedef struct VkQueryPoolCreateInfo_
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600228 // {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600229 // VkStructureType sType; // Must be VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600230 // const void* pNext; // Pointer to next structure
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600231 // VkQueryType queryType;
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600232 // uint32_t slots;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600233 // } VkQueryPoolCreateInfo;
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600234
235 memset(&query_info, 0, sizeof(query_info));
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600236 query_info.sType = VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO;
Tony Barbour8205d902015-04-16 15:59:00 -0600237 query_info.queryType = VK_QUERY_TYPE_OCCLUSION;
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600238 query_info.slots = MAX_QUERY_SLOTS;
239
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600240 // VkResult VKAPI vkCreateQueryPool(
241 // VkDevice device,
242 // const VkQueryPoolCreateInfo* pCreateInfo,
243 // VkQueryPool* pQueryPool);
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600244
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600245 err = vkCreateQueryPool(device(), &query_info, &query_pool);
246 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600247
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600248 // TODO: Test actual synchronization with command buffer event.
249 // TODO: Create command buffer
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600250 // TODO: vkCmdResetQueryPool
251 // TODO: vkCmdBeginQuery
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600252 // TODO: commands
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600253 // TOOD: vkCmdEndQuery
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600254
Mike Stroyan230e6252015-04-17 12:36:38 -0600255 err = vkGetQueryPoolResults(device(), query_pool, 0, MAX_QUERY_SLOTS,
Tony Barbour8205d902015-04-16 15:59:00 -0600256 &query_result_size, VK_NULL_HANDLE, 0);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600257 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600258
259 if (query_result_size > 0) {
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600260 query_result_data = new uint32_t [query_result_size];
Mike Stroyan230e6252015-04-17 12:36:38 -0600261 err = vkGetQueryPoolResults(device(), query_pool, 0, MAX_QUERY_SLOTS,
Tony Barbour8205d902015-04-16 15:59:00 -0600262 &query_result_size, query_result_data, 0);
Jon Ashburn1af28922015-10-02 09:35:45 -0700263 //ASSERT_VK_SUCCESS(err); TODO fix once actually submit queries
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600264
265 // TODO: Test Query result data.
266
267 }
268
Mark Lobodzinski67b42b72015-09-07 13:59:43 -0600269 vkDestroyQueryPool(device(), query_pool);
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600270}
Courtney Goeltzenleuchter6b814b32014-08-12 09:59:36 -0600271
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600272void getQueue(vk_testing::Device *device, uint32_t queue_node_index, const char *qname)
Courtney Goeltzenleuchtercc32aa92014-08-14 10:15:09 -0600273{
Cody Northrop1684adb2015-08-05 11:15:02 -0600274 uint32_t que_idx;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600275 VkResult err;
276 VkQueue queue;
Courtney Goeltzenleuchtercc32aa92014-08-14 10:15:09 -0600277
Cody Northropef72e2a2015-08-03 17:04:53 -0600278 const VkQueueFamilyProperties props = device->phy().queue_properties()[queue_node_index];
Chia-I Wu3b78d312014-12-29 15:39:23 +0800279 for (que_idx = 0; que_idx < props.queueCount; que_idx++) {
Mark Lobodzinskicf26e072015-04-16 11:44:05 -0500280 // TODO: Need to add support for separate MEMMGR and work queues, including synchronization
Chia-I Wua2636292015-07-03 10:41:20 +0800281 err = vkGetDeviceQueue(device->handle(), queue_node_index, que_idx, &queue);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600282 ASSERT_EQ(VK_SUCCESS, err) << "vkGetDeviceQueue: " << qname << " queue #" << que_idx << ": Failed with error: " << vk_result_string(err);
Courtney Goeltzenleuchtercc32aa92014-08-14 10:15:09 -0600283 }
284}
285
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600286void VkTest::CreateImageTest()
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600287{
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600288 VkResult err;
289 VkImage image;
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600290 uint32_t w, h, mipCount;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600291 VkFormat fmt;
292 VkFormatProperties image_fmt;
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600293
294 w =512;
295 h = 256;
296 mipCount = 0;
297
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600298 uint32_t _w = w;
299 uint32_t _h = h;
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600300 while( ( _w > 0 ) || ( _h > 0 ) )
301 {
302 _w >>= 1;
303 _h >>= 1;
304 mipCount++;
305 }
306
Tony Barbour8205d902015-04-16 15:59:00 -0600307 fmt = VK_FORMAT_R8G8B8A8_UINT;
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600308 // TODO: Pick known good format rather than just expect common format
309 /*
310 * XXX: What should happen if given NULL HANDLE for the pData argument?
Tony Barbour8205d902015-04-16 15:59:00 -0600311 * We're not requesting VK_OBJECT_INFO_TYPE_MEMORY_REQUIREMENTS so there is
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600312 * an expectation that pData is a valid pointer.
313 * However, why include a returned size value? That implies that the
314 * amount of data may vary and that doesn't work well for using a
315 * fixed structure.
316 */
317
Courtney Goeltzenleuchter4da96aa2015-07-12 12:52:09 -0600318 err = vkGetPhysicalDeviceFormatProperties(objs[m_device_id], fmt, &image_fmt);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600319 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600320
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600321// typedef struct VkImageCreateInfo_
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600322// {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600323// VkStructureType sType; // Must be VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600324// const void* pNext; // Pointer to next structure.
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600325// VkImageType imageType;
326// VkFormat format;
327// VkExtent3D extent;
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600328// uint32_t mipLevels;
329// uint32_t arraySize;
330// uint32_t samples;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600331// VkImageTiling tiling;
332// VkFlags usage; // VkImageUsageFlags
333// VkFlags flags; // VkImageCreateFlags
334// } VkImageCreateInfo;
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600335
336
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600337 VkImageCreateInfo imageCreateInfo = {};
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600338 imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
Tony Barbour8205d902015-04-16 15:59:00 -0600339 imageCreateInfo.imageType = VK_IMAGE_TYPE_2D;
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600340 imageCreateInfo.format = fmt;
341 imageCreateInfo.arraySize = 1;
342 imageCreateInfo.extent.width = w;
343 imageCreateInfo.extent.height = h;
344 imageCreateInfo.extent.depth = 1;
345 imageCreateInfo.mipLevels = mipCount;
346 imageCreateInfo.samples = 1;
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600347 if (image_fmt.linearTilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) {
348 imageCreateInfo.tiling = VK_IMAGE_TILING_LINEAR;
349 }
350 else if (image_fmt.optimalTilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) {
351 imageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
352 }
353 else {
354 FAIL() << "Neither Linear nor Optimal allowed for color attachment";
355 }
Cody Northropd0d701b2015-06-17 08:28:19 -0600356 imageCreateInfo.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT |
357 VK_IMAGE_USAGE_SAMPLED_BIT;
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600358
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600359// VkResult VKAPI vkCreateImage(
360// VkDevice device,
361// const VkImageCreateInfo* pCreateInfo,
362// VkImage* pImage);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600363 err = vkCreateImage(device(), &imageCreateInfo, &image);
364 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600365
Courtney Goeltzenleuchterac3b73a2014-08-14 17:40:57 -0600366 // Verify image resources
Tony Barbour426b9052015-06-24 16:06:58 -0600367// VkResult VKAPI vkGetImageSubresourceLayout(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600368// VkImage image,
369// const VkImageSubresource* pSubresource,
Tony Barbour426b9052015-06-24 16:06:58 -0600370// VkSubresourceLayout* pLayout);
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600371// typedef struct VkSubresourceLayout_
Courtney Goeltzenleuchterac3b73a2014-08-14 17:40:57 -0600372// {
Tony Barbour8205d902015-04-16 15:59:00 -0600373// VkDeviceSize offset; // Specified in bytes
374// VkDeviceSize size; // Specified in bytes
375// VkDeviceSize rowPitch; // Specified in bytes
376// VkDeviceSize depthPitch; // Specified in bytes
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600377// } VkSubresourceLayout;
Courtney Goeltzenleuchterac3b73a2014-08-14 17:40:57 -0600378
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600379// typedef struct VkImageSubresource_
Courtney Goeltzenleuchterac3b73a2014-08-14 17:40:57 -0600380// {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600381// VkImageAspect aspect;
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600382// uint32_t mipLevel;
Courtney Goeltzenleuchter3dee8082015-09-10 16:38:41 -0600383// uint32_t arrayLayer;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600384// } VkImageSubresource;
Courtney Goeltzenleuchterac3b73a2014-08-14 17:40:57 -0600385
Courtney Goeltzenleuchterac3b73a2014-08-14 17:40:57 -0600386
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600387 if (image_fmt.linearTilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) {
388 VkImageSubresource subresource = {};
389 subresource.aspect = VK_IMAGE_ASPECT_COLOR;
Courtney Goeltzenleuchter3dee8082015-09-10 16:38:41 -0600390 subresource.arrayLayer = 0;
Courtney Goeltzenleuchterac3b73a2014-08-14 17:40:57 -0600391
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600392 _w = w;
393 _h = h;
394 while ((_w > 0) || (_h > 0))
395 {
396 VkSubresourceLayout layout = {};
Tony Barbour426b9052015-06-24 16:06:58 -0600397 err = vkGetImageSubresourceLayout(device(), image, &subresource, &layout);
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600398 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchterac3b73a2014-08-14 17:40:57 -0600399
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600400 // TODO: 4 should be replaced with pixel size for given format
401 EXPECT_LE(_w * 4, layout.rowPitch) << "Pitch does not match expected image pitch";
402 _w >>= 1;
403 _h >>= 1;
404
405 subresource.mipLevel++;
406 }
Courtney Goeltzenleuchterac3b73a2014-08-14 17:40:57 -0600407 }
408
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600409 VkMemoryRequirements mem_req;
Tony Barbour8205d902015-04-16 15:59:00 -0600410 VkDeviceMemory image_mem;
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600411
Tony Barboure84a8d62015-07-10 14:10:27 -0600412 err = vkGetImageMemoryRequirements(device(), image, &mem_req);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600413 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600414
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600415 if (mem_req.size) {
416
417 // VkResult VKAPI vkAllocMemory(
418 // VkDevice device,
419 // const VkMemoryAllocInfo* pAllocInfo,
420 // VkDeviceMemory* pMem);
421 VkMemoryAllocInfo mem_info = {};
422
423 mem_info.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO;
424 mem_info.pNext = NULL;
425 mem_info.allocationSize = mem_req.size;
Mark Lobodzinski72346292015-07-02 16:49:40 -0600426 mem_info.memoryTypeIndex = 0;
427
Chia-I Wuf5fb1092015-07-03 10:32:05 +0800428 err = m_device->phy().set_memory_type(mem_req.memoryTypeBits, &mem_info, 0);
Mark Lobodzinski72346292015-07-02 16:49:40 -0600429 ASSERT_VK_SUCCESS(err);
430
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600431 err = vkAllocMemory(device(), &mem_info, &image_mem);
432 ASSERT_VK_SUCCESS(err);
433
Tony Barboure84a8d62015-07-10 14:10:27 -0600434 err = vkBindImageMemory(device(), image, image_mem, 0);
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600435 ASSERT_VK_SUCCESS(err);
436 }
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600437
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600438// typedef struct VkImageViewCreateInfo_
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600439// {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600440// VkStructureType sType; // Must be VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600441// const void* pNext; // Pointer to next structure
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600442// VkImage image;
443// VkImageViewType viewType;
444// VkFormat format;
445// VkChannelMapping channels;
446// VkImageSubresourceRange subresourceRange;
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600447// float minLod;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600448// } VkImageViewCreateInfo;
449 VkImageViewCreateInfo viewInfo = {};
450 VkImageView view;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600451 viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600452 viewInfo.image = image;
Tony Barbour8205d902015-04-16 15:59:00 -0600453 viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600454 viewInfo.format = fmt;
455
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600456 viewInfo.channels.r = VK_CHANNEL_SWIZZLE_R;
457 viewInfo.channels.g = VK_CHANNEL_SWIZZLE_G;
458 viewInfo.channels.b = VK_CHANNEL_SWIZZLE_B;
459 viewInfo.channels.a = VK_CHANNEL_SWIZZLE_A;
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600460
Courtney Goeltzenleuchter3dee8082015-09-10 16:38:41 -0600461 viewInfo.subresourceRange.baseArrayLayer = 0;
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600462 viewInfo.subresourceRange.arraySize = 1;
463 viewInfo.subresourceRange.baseMipLevel = 0;
464 viewInfo.subresourceRange.mipLevels = 1;
Courtney Goeltzenleuchteraeffeae2015-09-10 17:58:54 -0600465 viewInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600466
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600467// VkResult VKAPI vkCreateImageView(
468// VkDevice device,
469// const VkImageViewCreateInfo* pCreateInfo,
470// VkImageView* pView);
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600471
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600472 err = vkCreateImageView(device(), &viewInfo, &view);
473 ASSERT_VK_SUCCESS(err) << "vkCreateImageView failed";
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600474
475 // TODO: Test image memory.
476
477 // All done with image memory, clean up
Mark Lobodzinski67b42b72015-09-07 13:59:43 -0600478 vkDestroyImageView(device(), view);
479 vkDestroyImage(device(), image);
Courtney Goeltzenleuchter0e168bb2015-06-22 16:26:54 -0600480
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600481 if (mem_req.size) {
Mark Lobodzinski67b42b72015-09-07 13:59:43 -0600482 vkFreeMemory(device(), image_mem);
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600483 }
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600484}
485
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600486TEST_F(VkTest, CreateImage) {
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600487 CreateImageTest();
Courtney Goeltzenleuchter6b814b32014-08-12 09:59:36 -0600488}
489
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600490void VkTest::CreateCommandBufferTest()
Courtney Goeltzenleuchter0842df72014-08-20 15:26:55 -0600491{
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600492 VkResult err;
493 VkCmdBufferCreateInfo info = {};
Cody Northropf02f9f82015-07-09 18:08:05 -0600494 VkCmdPool cmdPool;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600495 VkCmdBuffer cmdBuffer;
Courtney Goeltzenleuchter0842df72014-08-20 15:26:55 -0600496
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600497// typedef struct VkCmdBufferCreateInfo_
Courtney Goeltzenleuchter0842df72014-08-20 15:26:55 -0600498// {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600499// VkStructureType sType; // Must be VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600500// const void* pNext;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600501// VK_QUEUE_TYPE queueType;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600502// VkFlags flags;
503// } VkCmdBufferCreateInfo;
Courtney Goeltzenleuchter0842df72014-08-20 15:26:55 -0600504
Cody Northropf02f9f82015-07-09 18:08:05 -0600505 VkCmdPoolCreateInfo cmd_pool_info;
506 cmd_pool_info.sType = VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO,
507 cmd_pool_info.pNext = NULL,
508 cmd_pool_info.queueFamilyIndex = graphics_queue_node_index;
509 cmd_pool_info.flags = 0,
510 err = vkCreateCommandPool(device(), &cmd_pool_info, &cmdPool);
511 ASSERT_VK_SUCCESS(err) << "vkCreateCommandPool failed";
512
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600513 info.sType = VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO;
Cody Northropf02f9f82015-07-09 18:08:05 -0600514 info.cmdPool = cmdPool;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600515 err = vkCreateCommandBuffer(device(), &info, &cmdBuffer);
516 ASSERT_VK_SUCCESS(err) << "vkCreateCommandBuffer failed";
Courtney Goeltzenleuchter0842df72014-08-20 15:26:55 -0600517
Mark Lobodzinski67b42b72015-09-07 13:59:43 -0600518 vkDestroyCommandBuffer(device(), cmdBuffer);
519 vkDestroyCommandPool(device(), cmdPool);
Courtney Goeltzenleuchter0842df72014-08-20 15:26:55 -0600520}
521
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600522TEST_F(VkTest, TestCommandBuffer) {
Courtney Goeltzenleuchter0842df72014-08-20 15:26:55 -0600523 CreateCommandBufferTest();
524}
525
Cody Northrop87ae5e12015-08-24 15:11:10 -0600526void VkTest::CreateShader(VkShader *pshader, VkShaderStage stage)
Courtney Goeltzenleuchter0842df72014-08-20 15:26:55 -0600527{
Courtney Goeltzenleuchtera693ed22014-08-19 13:34:28 -0600528 void *code;
529 uint32_t codeSize;
Cody Northropacfb0492015-03-17 15:55:58 -0600530 struct icd_spv_header *pSPV;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600531 VkResult err;
Courtney Goeltzenleuchtera693ed22014-08-19 13:34:28 -0600532
Cody Northropacfb0492015-03-17 15:55:58 -0600533 codeSize = sizeof(struct icd_spv_header) + 100;
Courtney Goeltzenleuchtera693ed22014-08-19 13:34:28 -0600534 code = malloc(codeSize);
535 ASSERT_TRUE(NULL != code) << "malloc failed!";
536
537 memset(code, 0, codeSize);
538
Cody Northropacfb0492015-03-17 15:55:58 -0600539 // Indicate that this is SPV data.
540 pSPV = (struct icd_spv_header *) code;
541 pSPV->magic = ICD_SPV_MAGIC;
542 pSPV->version = ICD_SPV_VERSION;
Courtney Goeltzenleuchtera693ed22014-08-19 13:34:28 -0600543
Courtney Goeltzenleuchter2d034fd2015-06-28 13:01:17 -0600544 VkShaderModuleCreateInfo moduleCreateInfo;
545 VkShaderModule module;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600546 VkShaderCreateInfo createInfo;
547 VkShader shader;
Courtney Goeltzenleuchtera693ed22014-08-19 13:34:28 -0600548
Courtney Goeltzenleuchter2d034fd2015-06-28 13:01:17 -0600549 moduleCreateInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
550 moduleCreateInfo.pNext = NULL;
551 moduleCreateInfo.pCode = code;
552 moduleCreateInfo.codeSize = codeSize;
553 moduleCreateInfo.flags = 0;
554 err = vkCreateShaderModule(device(), &moduleCreateInfo, &module);
555 ASSERT_VK_SUCCESS(err);
556
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600557 createInfo.sType = VK_STRUCTURE_TYPE_SHADER_CREATE_INFO;
Courtney Goeltzenleuchtera693ed22014-08-19 13:34:28 -0600558 createInfo.pNext = NULL;
Courtney Goeltzenleuchter2d034fd2015-06-28 13:01:17 -0600559 createInfo.module = module;
560 createInfo.pName = "main";
Courtney Goeltzenleuchtera693ed22014-08-19 13:34:28 -0600561 createInfo.flags = 0;
Cody Northrop87ae5e12015-08-24 15:11:10 -0600562 createInfo.stage = stage;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600563 err = vkCreateShader(device(), &createInfo, &shader);
564 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchtera693ed22014-08-19 13:34:28 -0600565
Mark Lobodzinski67b42b72015-09-07 13:59:43 -0600566 vkDestroyShaderModule(device(), module);
Courtney Goeltzenleuchter2d034fd2015-06-28 13:01:17 -0600567
Courtney Goeltzenleuchter0842df72014-08-20 15:26:55 -0600568 *pshader = shader;
569}
570
Courtney Goeltzenleuchter6b814b32014-08-12 09:59:36 -0600571int main(int argc, char **argv) {
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600572 ::testing::InitGoogleTest(&argc, argv);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600573 vk_testing::set_error_callback(test_error_callback);
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600574 return RUN_ALL_TESTS();
Courtney Goeltzenleuchter7087dde2014-08-11 18:19:35 -0600575}