blob: e32a29b638945fcc98ab7371604539a493a6262c [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 Goeltzenleuchtered56abc2014-08-12 14:12:22 -060062#include "gtest-1.7.0/include/gtest/gtest.h"
Courtney Goeltzenleuchter7087dde2014-08-11 18:19:35 -060063
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060064#include "vktestbinding.h"
Chia-I Wu3b78d312014-12-29 15:39:23 +080065#include "test_common.h"
Cody Northropd4e020a2015-03-17 14:54:35 -060066#include "icd-spv.h"
Courtney Goeltzenleuchter7087dde2014-08-11 18:19:35 -060067
Jon Ashburn07b309a2015-04-15 11:31:12 -060068#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
69
Tony-LunarGe4fe3152015-05-15 12:42:49 -060070class VkTest : public ::testing::Test {
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -060071public:
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -060072 void CreateImageTest();
Courtney Goeltzenleuchter0842df72014-08-20 15:26:55 -060073 void CreateCommandBufferTest();
74 void CreatePipelineTest();
75 void CreateShaderTest();
Cody Northrop87ae5e12015-08-24 15:11:10 -060076 void CreateShader(VkShader *pshader, VkShaderStage stage);
Courtney Goeltzenleuchter7087dde2014-08-11 18:19:35 -060077
Chia-I Wua2636292015-07-03 10:41:20 +080078 VkDevice device() {return m_device->handle();}
Courtney Goeltzenleuchterb85c5812014-08-19 18:35:50 -060079
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -060080protected:
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060081 VkApplicationInfo app_info;
82 VkInstance inst;
Tony Barbour8205d902015-04-16 15:59:00 -060083 VkPhysicalDevice objs[16];
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -060084 uint32_t gpu_count;
Chia-I Wu3b78d312014-12-29 15:39:23 +080085
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -060086 uint32_t m_device_id;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060087 vk_testing::Device *m_device;
Tony Barbour8205d902015-04-16 15:59:00 -060088 VkPhysicalDeviceProperties props;
Cody Northropef72e2a2015-08-03 17:04:53 -060089 std::vector<VkQueueFamilyProperties> queue_props;
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -070090 uint32_t graphics_queue_node_index;
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -060091
92 virtual void SetUp() {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060093 VkResult err;
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -070094 int i;
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -060095
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060096 this->app_info.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -060097 this->app_info.pNext = NULL;
Chia-I Wu7461fcf2014-12-27 15:16:07 +080098 this->app_info.pAppName = "base";
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -060099 this->app_info.appVersion = 1;
Chia-I Wu7461fcf2014-12-27 15:16:07 +0800100 this->app_info.pEngineName = "unittest";
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600101 this->app_info.engineVersion = 1;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600102 this->app_info.apiVersion = VK_API_VERSION;
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600103 VkInstanceCreateInfo inst_info = {};
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600104 inst_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
Jon Ashburn29669a42015-04-04 14:52:07 -0600105 inst_info.pNext = NULL;
106 inst_info.pAppInfo = &app_info;
107 inst_info.pAllocCb = NULL;
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600108 inst_info.layerCount = 0;
109 inst_info.ppEnabledLayerNames = NULL;
Jon Ashburn29669a42015-04-04 14:52:07 -0600110 inst_info.extensionCount = 0;
Courtney Goeltzenleuchter18061cd2015-06-29 15:39:26 -0600111 inst_info.ppEnabledExtensionNames = NULL;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600112 err = vkCreateInstance(&inst_info, &inst);
113 ASSERT_VK_SUCCESS(err);
Jon Ashburn07b309a2015-04-15 11:31:12 -0600114 err = vkEnumeratePhysicalDevices(inst, &this->gpu_count, NULL);
115 ASSERT_VK_SUCCESS(err);
116 ASSERT_LE(this->gpu_count, ARRAY_SIZE(objs)) << "Too many GPUs";
117 err = vkEnumeratePhysicalDevices(inst, &this->gpu_count, objs);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600118 ASSERT_VK_SUCCESS(err);
Jon Ashburn19733c92014-11-26 11:06:49 -0700119 ASSERT_GE(this->gpu_count, 1) << "No GPU available";
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600120
Chia-I Wu3b78d312014-12-29 15:39:23 +0800121 m_device_id = 0;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600122 this->m_device = new vk_testing::Device(objs[m_device_id]);
Chia-I Wu3b78d312014-12-29 15:39:23 +0800123 this->m_device->init();
124
Chia-I Wuf5fb1092015-07-03 10:32:05 +0800125 props = m_device->phy().properties();
Chia-I Wu3b78d312014-12-29 15:39:23 +0800126
Chia-I Wuf5fb1092015-07-03 10:32:05 +0800127 queue_props = this->m_device->phy().queue_properties();
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -0700128 for (i = 0; i < queue_props.size(); i++) {
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600129 if (queue_props[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) {
Courtney Goeltzenleuchterf3168062015-03-05 18:09:39 -0700130 graphics_queue_node_index = i;
131 break;
132 }
133 }
134 ASSERT_LT(i, queue_props.size()) << "Could not find a Queue with Graphics support";
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600135 }
136
137 virtual void TearDown() {
Tony Barbour900ae862015-06-02 14:55:46 -0600138 delete m_device;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600139 vkDestroyInstance(inst);
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600140 }
141};
142
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600143TEST_F(VkTest, AllocMemory) {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600144 VkResult err;
Courtney Goeltzenleuchterddcb6192015-04-14 18:48:46 -0600145 VkMemoryAllocInfo alloc_info = {};
Tony Barbour8205d902015-04-16 15:59:00 -0600146 VkDeviceMemory gpu_mem;
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600147 uint8_t *pData;
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600148
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600149 alloc_info.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO;
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600150 alloc_info.allocationSize = 1024 * 1024; // 1MB
Mark Lobodzinski72346292015-07-02 16:49:40 -0600151 alloc_info.memoryTypeIndex = 0;
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600152
Tony Barbour08baf962015-07-29 14:27:38 -0600153 VkPhysicalDeviceMemoryProperties mem_props;
154 vkGetPhysicalDeviceMemoryProperties(m_device->phy().handle(), &mem_props);
155
156 err = m_device->phy().set_memory_type(((1 << mem_props.memoryTypeCount) - 1), &alloc_info, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT);
157 ASSERT_VK_SUCCESS(err);
158
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600159 err = vkAllocMemory(device(), &alloc_info, &gpu_mem);
160 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchter7087dde2014-08-11 18:19:35 -0600161
Mike Stroyan230e6252015-04-17 12:36:38 -0600162 err = vkMapMemory(device(), gpu_mem, 0, 0, 0, (void **) &pData);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600163 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchter6b814b32014-08-12 09:59:36 -0600164
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600165 memset(pData, 0x55, alloc_info.allocationSize);
Mark Lobodzinski72346292015-07-02 16:49:40 -0600166 EXPECT_EQ(0x55, pData[0]) << "Memory read not same as write";
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600167
Mark Lobodzinski67b42b72015-09-07 13:59:43 -0600168 vkUnmapMemory(device(), gpu_mem);
Courtney Goeltzenleuchter6b814b32014-08-12 09:59:36 -0600169
Mark Lobodzinski67b42b72015-09-07 13:59:43 -0600170 vkFreeMemory(device(), gpu_mem);
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600171}
Courtney Goeltzenleuchter6b814b32014-08-12 09:59:36 -0600172
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600173TEST_F(VkTest, Event) {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600174 VkEventCreateInfo event_info;
175 VkEvent event;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600176 VkResult err;
Courtney Goeltzenleuchter6b814b32014-08-12 09:59:36 -0600177
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600178 // typedef struct VkEventCreateInfo_
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600179 // {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600180 // VkStructureType sType; // Must be VK_STRUCTURE_TYPE_EVENT_CREATE_INFO
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600181 // const void* pNext; // Pointer to next structure
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600182 // VkFlags flags; // Reserved
183 // } VkEventCreateInfo;
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600184 memset(&event_info, 0, sizeof(event_info));
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600185 event_info.sType = VK_STRUCTURE_TYPE_EVENT_CREATE_INFO;
Courtney Goeltzenleuchter6b814b32014-08-12 09:59:36 -0600186
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600187 err = vkCreateEvent(device(), &event_info, &event);
188 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600189
Mike Stroyan230e6252015-04-17 12:36:38 -0600190 err = vkResetEvent(device(), event);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600191 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600192
Mike Stroyan230e6252015-04-17 12:36:38 -0600193 err = vkGetEventStatus(device(), event);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600194 ASSERT_EQ(VK_EVENT_RESET, err);
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600195
Mike Stroyan230e6252015-04-17 12:36:38 -0600196 err = vkSetEvent(device(), event);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600197 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600198
Mike Stroyan230e6252015-04-17 12:36:38 -0600199 err = vkGetEventStatus(device(), event);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600200 ASSERT_EQ(VK_EVENT_SET, err);
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600201
202 // TODO: Test actual synchronization with command buffer event.
203
204 // All done with event memory, clean up
Mark Lobodzinski67b42b72015-09-07 13:59:43 -0600205 vkDestroyEvent(device(), event);
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600206}
207
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600208#define MAX_QUERY_SLOTS 10
209
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600210TEST_F(VkTest, Query) {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600211 VkQueryPoolCreateInfo query_info;
212 VkQueryPool query_pool;
Chia-I Wu54ed0792014-12-27 14:14:50 +0800213 size_t query_result_size;
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600214 uint32_t *query_result_data;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600215 VkResult err;
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600216
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600217 // typedef enum VkQueryType_
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600218 // {
Tony Barbour8205d902015-04-16 15:59:00 -0600219 // VK_QUERY_TYPE_OCCLUSION = 0x00000000,
220 // VK_QUERY_TYPE_PIPELINE_STATISTICS = 0x00000001,
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600221
Tony Barbour8205d902015-04-16 15:59:00 -0600222 // VK_QUERY_TYPE_BEGIN_RANGE = VK_QUERY_TYPE_OCCLUSION,
223 // VK_QUERY_TYPE_END_RANGE = VK_QUERY_TYPE_PIPELINE_STATISTICS,
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600224 // VK_NUM_QUERY_TYPE = (VK_QUERY_TYPE_END_RANGE - VK_QUERY_TYPE_BEGIN_RANGE + 1),
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600225 // VK_MAX_ENUM(VkQueryType_)
226 // } VkQueryType;
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600227
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600228 // typedef struct VkQueryPoolCreateInfo_
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600229 // {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600230 // VkStructureType sType; // Must be VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600231 // const void* pNext; // Pointer to next structure
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600232 // VkQueryType queryType;
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600233 // uint32_t slots;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600234 // } VkQueryPoolCreateInfo;
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600235
236 memset(&query_info, 0, sizeof(query_info));
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600237 query_info.sType = VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO;
Tony Barbour8205d902015-04-16 15:59:00 -0600238 query_info.queryType = VK_QUERY_TYPE_OCCLUSION;
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600239 query_info.slots = MAX_QUERY_SLOTS;
240
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600241 // VkResult VKAPI vkCreateQueryPool(
242 // VkDevice device,
243 // const VkQueryPoolCreateInfo* pCreateInfo,
244 // VkQueryPool* pQueryPool);
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600245
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600246 err = vkCreateQueryPool(device(), &query_info, &query_pool);
247 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600248
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600249 // TODO: Test actual synchronization with command buffer event.
250 // TODO: Create command buffer
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600251 // TODO: vkCmdResetQueryPool
252 // TODO: vkCmdBeginQuery
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600253 // TODO: commands
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600254 // TOOD: vkCmdEndQuery
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600255
Mike Stroyan230e6252015-04-17 12:36:38 -0600256 err = vkGetQueryPoolResults(device(), query_pool, 0, MAX_QUERY_SLOTS,
Tony Barbour8205d902015-04-16 15:59:00 -0600257 &query_result_size, VK_NULL_HANDLE, 0);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600258 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600259
260 if (query_result_size > 0) {
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600261 query_result_data = new uint32_t [query_result_size];
Mike Stroyan230e6252015-04-17 12:36:38 -0600262 err = vkGetQueryPoolResults(device(), query_pool, 0, MAX_QUERY_SLOTS,
Tony Barbour8205d902015-04-16 15:59:00 -0600263 &query_result_size, query_result_data, 0);
Jon Ashburn1af28922015-10-02 09:35:45 -0700264 //ASSERT_VK_SUCCESS(err); TODO fix once actually submit queries
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600265
266 // TODO: Test Query result data.
267
268 }
269
Mark Lobodzinski67b42b72015-09-07 13:59:43 -0600270 vkDestroyQueryPool(device(), query_pool);
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600271}
Courtney Goeltzenleuchter6b814b32014-08-12 09:59:36 -0600272
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600273void getQueue(vk_testing::Device *device, uint32_t queue_node_index, const char *qname)
Courtney Goeltzenleuchtercc32aa92014-08-14 10:15:09 -0600274{
Cody Northrop1684adb2015-08-05 11:15:02 -0600275 uint32_t que_idx;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600276 VkResult err;
277 VkQueue queue;
Courtney Goeltzenleuchtercc32aa92014-08-14 10:15:09 -0600278
Cody Northropef72e2a2015-08-03 17:04:53 -0600279 const VkQueueFamilyProperties props = device->phy().queue_properties()[queue_node_index];
Chia-I Wu3b78d312014-12-29 15:39:23 +0800280 for (que_idx = 0; que_idx < props.queueCount; que_idx++) {
Mark Lobodzinskicf26e072015-04-16 11:44:05 -0500281 // TODO: Need to add support for separate MEMMGR and work queues, including synchronization
Chia-I Wua2636292015-07-03 10:41:20 +0800282 err = vkGetDeviceQueue(device->handle(), queue_node_index, que_idx, &queue);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600283 ASSERT_EQ(VK_SUCCESS, err) << "vkGetDeviceQueue: " << qname << " queue #" << que_idx << ": Failed with error: " << vk_result_string(err);
Courtney Goeltzenleuchtercc32aa92014-08-14 10:15:09 -0600284 }
285}
286
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600287void VkTest::CreateImageTest()
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600288{
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600289 VkResult err;
290 VkImage image;
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600291 uint32_t w, h, mipCount;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600292 VkFormat fmt;
293 VkFormatProperties image_fmt;
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600294
295 w =512;
296 h = 256;
297 mipCount = 0;
298
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600299 uint32_t _w = w;
300 uint32_t _h = h;
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600301 while( ( _w > 0 ) || ( _h > 0 ) )
302 {
303 _w >>= 1;
304 _h >>= 1;
305 mipCount++;
306 }
307
Tony Barbour8205d902015-04-16 15:59:00 -0600308 fmt = VK_FORMAT_R8G8B8A8_UINT;
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600309 // TODO: Pick known good format rather than just expect common format
310 /*
311 * XXX: What should happen if given NULL HANDLE for the pData argument?
Tony Barbour8205d902015-04-16 15:59:00 -0600312 * We're not requesting VK_OBJECT_INFO_TYPE_MEMORY_REQUIREMENTS so there is
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600313 * an expectation that pData is a valid pointer.
314 * However, why include a returned size value? That implies that the
315 * amount of data may vary and that doesn't work well for using a
316 * fixed structure.
317 */
318
Courtney Goeltzenleuchter4da96aa2015-07-12 12:52:09 -0600319 err = vkGetPhysicalDeviceFormatProperties(objs[m_device_id], fmt, &image_fmt);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600320 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600321
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600322// typedef struct VkImageCreateInfo_
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600323// {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600324// VkStructureType sType; // Must be VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600325// const void* pNext; // Pointer to next structure.
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600326// VkImageType imageType;
327// VkFormat format;
328// VkExtent3D extent;
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600329// uint32_t mipLevels;
330// uint32_t arraySize;
331// uint32_t samples;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600332// VkImageTiling tiling;
333// VkFlags usage; // VkImageUsageFlags
334// VkFlags flags; // VkImageCreateFlags
335// } VkImageCreateInfo;
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600336
337
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600338 VkImageCreateInfo imageCreateInfo = {};
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600339 imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
Tony Barbour8205d902015-04-16 15:59:00 -0600340 imageCreateInfo.imageType = VK_IMAGE_TYPE_2D;
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600341 imageCreateInfo.format = fmt;
342 imageCreateInfo.arraySize = 1;
343 imageCreateInfo.extent.width = w;
344 imageCreateInfo.extent.height = h;
345 imageCreateInfo.extent.depth = 1;
346 imageCreateInfo.mipLevels = mipCount;
347 imageCreateInfo.samples = 1;
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600348 if (image_fmt.linearTilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) {
349 imageCreateInfo.tiling = VK_IMAGE_TILING_LINEAR;
350 }
351 else if (image_fmt.optimalTilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) {
352 imageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
353 }
354 else {
355 FAIL() << "Neither Linear nor Optimal allowed for color attachment";
356 }
Cody Northropd0d701b2015-06-17 08:28:19 -0600357 imageCreateInfo.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT |
358 VK_IMAGE_USAGE_SAMPLED_BIT;
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600359
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600360// VkResult VKAPI vkCreateImage(
361// VkDevice device,
362// const VkImageCreateInfo* pCreateInfo,
363// VkImage* pImage);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600364 err = vkCreateImage(device(), &imageCreateInfo, &image);
365 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600366
Courtney Goeltzenleuchterac3b73a2014-08-14 17:40:57 -0600367 // Verify image resources
Tony Barbour426b9052015-06-24 16:06:58 -0600368// VkResult VKAPI vkGetImageSubresourceLayout(
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600369// VkImage image,
370// const VkImageSubresource* pSubresource,
Tony Barbour426b9052015-06-24 16:06:58 -0600371// VkSubresourceLayout* pLayout);
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600372// typedef struct VkSubresourceLayout_
Courtney Goeltzenleuchterac3b73a2014-08-14 17:40:57 -0600373// {
Tony Barbour8205d902015-04-16 15:59:00 -0600374// VkDeviceSize offset; // Specified in bytes
375// VkDeviceSize size; // Specified in bytes
376// VkDeviceSize rowPitch; // Specified in bytes
377// VkDeviceSize depthPitch; // Specified in bytes
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600378// } VkSubresourceLayout;
Courtney Goeltzenleuchterac3b73a2014-08-14 17:40:57 -0600379
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600380// typedef struct VkImageSubresource_
Courtney Goeltzenleuchterac3b73a2014-08-14 17:40:57 -0600381// {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600382// VkImageAspect aspect;
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600383// uint32_t mipLevel;
Courtney Goeltzenleuchter3dee8082015-09-10 16:38:41 -0600384// uint32_t arrayLayer;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600385// } VkImageSubresource;
Courtney Goeltzenleuchterac3b73a2014-08-14 17:40:57 -0600386
Courtney Goeltzenleuchterac3b73a2014-08-14 17:40:57 -0600387
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600388 if (image_fmt.linearTilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) {
389 VkImageSubresource subresource = {};
390 subresource.aspect = VK_IMAGE_ASPECT_COLOR;
Courtney Goeltzenleuchter3dee8082015-09-10 16:38:41 -0600391 subresource.arrayLayer = 0;
Courtney Goeltzenleuchterac3b73a2014-08-14 17:40:57 -0600392
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600393 _w = w;
394 _h = h;
395 while ((_w > 0) || (_h > 0))
396 {
397 VkSubresourceLayout layout = {};
Tony Barbour426b9052015-06-24 16:06:58 -0600398 err = vkGetImageSubresourceLayout(device(), image, &subresource, &layout);
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600399 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchterac3b73a2014-08-14 17:40:57 -0600400
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600401 // TODO: 4 should be replaced with pixel size for given format
402 EXPECT_LE(_w * 4, layout.rowPitch) << "Pitch does not match expected image pitch";
403 _w >>= 1;
404 _h >>= 1;
405
406 subresource.mipLevel++;
407 }
Courtney Goeltzenleuchterac3b73a2014-08-14 17:40:57 -0600408 }
409
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600410 VkMemoryRequirements mem_req;
Tony Barbour8205d902015-04-16 15:59:00 -0600411 VkDeviceMemory image_mem;
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600412
Tony Barboure84a8d62015-07-10 14:10:27 -0600413 err = vkGetImageMemoryRequirements(device(), image, &mem_req);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600414 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600415
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600416 if (mem_req.size) {
417
418 // VkResult VKAPI vkAllocMemory(
419 // VkDevice device,
420 // const VkMemoryAllocInfo* pAllocInfo,
421 // VkDeviceMemory* pMem);
422 VkMemoryAllocInfo mem_info = {};
423
424 mem_info.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO;
425 mem_info.pNext = NULL;
426 mem_info.allocationSize = mem_req.size;
Mark Lobodzinski72346292015-07-02 16:49:40 -0600427 mem_info.memoryTypeIndex = 0;
428
Chia-I Wuf5fb1092015-07-03 10:32:05 +0800429 err = m_device->phy().set_memory_type(mem_req.memoryTypeBits, &mem_info, 0);
Mark Lobodzinski72346292015-07-02 16:49:40 -0600430 ASSERT_VK_SUCCESS(err);
431
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600432 err = vkAllocMemory(device(), &mem_info, &image_mem);
433 ASSERT_VK_SUCCESS(err);
434
Tony Barboure84a8d62015-07-10 14:10:27 -0600435 err = vkBindImageMemory(device(), image, image_mem, 0);
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600436 ASSERT_VK_SUCCESS(err);
437 }
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600438
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600439// typedef struct VkImageViewCreateInfo_
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600440// {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600441// VkStructureType sType; // Must be VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600442// const void* pNext; // Pointer to next structure
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600443// VkImage image;
444// VkImageViewType viewType;
445// VkFormat format;
446// VkChannelMapping channels;
447// VkImageSubresourceRange subresourceRange;
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600448// float minLod;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600449// } VkImageViewCreateInfo;
450 VkImageViewCreateInfo viewInfo = {};
451 VkImageView view;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600452 viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600453 viewInfo.image = image;
Tony Barbour8205d902015-04-16 15:59:00 -0600454 viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600455 viewInfo.format = fmt;
456
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600457 viewInfo.channels.r = VK_CHANNEL_SWIZZLE_R;
458 viewInfo.channels.g = VK_CHANNEL_SWIZZLE_G;
459 viewInfo.channels.b = VK_CHANNEL_SWIZZLE_B;
460 viewInfo.channels.a = VK_CHANNEL_SWIZZLE_A;
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600461
Courtney Goeltzenleuchter3dee8082015-09-10 16:38:41 -0600462 viewInfo.subresourceRange.baseArrayLayer = 0;
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600463 viewInfo.subresourceRange.arraySize = 1;
464 viewInfo.subresourceRange.baseMipLevel = 0;
465 viewInfo.subresourceRange.mipLevels = 1;
Courtney Goeltzenleuchteraeffeae2015-09-10 17:58:54 -0600466 viewInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600467
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600468// VkResult VKAPI vkCreateImageView(
469// VkDevice device,
470// const VkImageViewCreateInfo* pCreateInfo,
471// VkImageView* pView);
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600472
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600473 err = vkCreateImageView(device(), &viewInfo, &view);
474 ASSERT_VK_SUCCESS(err) << "vkCreateImageView failed";
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600475
476 // TODO: Test image memory.
477
478 // All done with image memory, clean up
Mark Lobodzinski67b42b72015-09-07 13:59:43 -0600479 vkDestroyImageView(device(), view);
480 vkDestroyImage(device(), image);
Courtney Goeltzenleuchter0e168bb2015-06-22 16:26:54 -0600481
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600482 if (mem_req.size) {
Mark Lobodzinski67b42b72015-09-07 13:59:43 -0600483 vkFreeMemory(device(), image_mem);
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600484 }
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600485}
486
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600487TEST_F(VkTest, CreateImage) {
Courtney Goeltzenleuchter9c3aad02014-08-13 17:55:12 -0600488 CreateImageTest();
Courtney Goeltzenleuchter6b814b32014-08-12 09:59:36 -0600489}
490
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600491void VkTest::CreateCommandBufferTest()
Courtney Goeltzenleuchter0842df72014-08-20 15:26:55 -0600492{
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600493 VkResult err;
494 VkCmdBufferCreateInfo info = {};
Cody Northropf02f9f82015-07-09 18:08:05 -0600495 VkCmdPool cmdPool;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600496 VkCmdBuffer cmdBuffer;
Courtney Goeltzenleuchter0842df72014-08-20 15:26:55 -0600497
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600498// typedef struct VkCmdBufferCreateInfo_
Courtney Goeltzenleuchter0842df72014-08-20 15:26:55 -0600499// {
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600500// VkStructureType sType; // Must be VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600501// const void* pNext;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600502// VK_QUEUE_TYPE queueType;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600503// VkFlags flags;
504// } VkCmdBufferCreateInfo;
Courtney Goeltzenleuchter0842df72014-08-20 15:26:55 -0600505
Cody Northropf02f9f82015-07-09 18:08:05 -0600506 VkCmdPoolCreateInfo cmd_pool_info;
507 cmd_pool_info.sType = VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO,
508 cmd_pool_info.pNext = NULL,
509 cmd_pool_info.queueFamilyIndex = graphics_queue_node_index;
510 cmd_pool_info.flags = 0,
511 err = vkCreateCommandPool(device(), &cmd_pool_info, &cmdPool);
512 ASSERT_VK_SUCCESS(err) << "vkCreateCommandPool failed";
513
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600514 info.sType = VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO;
Cody Northropf02f9f82015-07-09 18:08:05 -0600515 info.cmdPool = cmdPool;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600516 err = vkCreateCommandBuffer(device(), &info, &cmdBuffer);
517 ASSERT_VK_SUCCESS(err) << "vkCreateCommandBuffer failed";
Courtney Goeltzenleuchter0842df72014-08-20 15:26:55 -0600518
Mark Lobodzinski67b42b72015-09-07 13:59:43 -0600519 vkDestroyCommandBuffer(device(), cmdBuffer);
520 vkDestroyCommandPool(device(), cmdPool);
Courtney Goeltzenleuchter0842df72014-08-20 15:26:55 -0600521}
522
Tony-LunarGe4fe3152015-05-15 12:42:49 -0600523TEST_F(VkTest, TestCommandBuffer) {
Courtney Goeltzenleuchter0842df72014-08-20 15:26:55 -0600524 CreateCommandBufferTest();
525}
526
Cody Northrop87ae5e12015-08-24 15:11:10 -0600527void VkTest::CreateShader(VkShader *pshader, VkShaderStage stage)
Courtney Goeltzenleuchter0842df72014-08-20 15:26:55 -0600528{
Courtney Goeltzenleuchtera693ed22014-08-19 13:34:28 -0600529 void *code;
530 uint32_t codeSize;
Cody Northropacfb0492015-03-17 15:55:58 -0600531 struct icd_spv_header *pSPV;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600532 VkResult err;
Courtney Goeltzenleuchtera693ed22014-08-19 13:34:28 -0600533
Cody Northropacfb0492015-03-17 15:55:58 -0600534 codeSize = sizeof(struct icd_spv_header) + 100;
Courtney Goeltzenleuchtera693ed22014-08-19 13:34:28 -0600535 code = malloc(codeSize);
536 ASSERT_TRUE(NULL != code) << "malloc failed!";
537
538 memset(code, 0, codeSize);
539
Cody Northropacfb0492015-03-17 15:55:58 -0600540 // Indicate that this is SPV data.
541 pSPV = (struct icd_spv_header *) code;
542 pSPV->magic = ICD_SPV_MAGIC;
543 pSPV->version = ICD_SPV_VERSION;
Courtney Goeltzenleuchtera693ed22014-08-19 13:34:28 -0600544
Courtney Goeltzenleuchter2d034fd2015-06-28 13:01:17 -0600545 VkShaderModuleCreateInfo moduleCreateInfo;
546 VkShaderModule module;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600547 VkShaderCreateInfo createInfo;
548 VkShader shader;
Courtney Goeltzenleuchtera693ed22014-08-19 13:34:28 -0600549
Courtney Goeltzenleuchter2d034fd2015-06-28 13:01:17 -0600550 moduleCreateInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
551 moduleCreateInfo.pNext = NULL;
552 moduleCreateInfo.pCode = code;
553 moduleCreateInfo.codeSize = codeSize;
554 moduleCreateInfo.flags = 0;
555 err = vkCreateShaderModule(device(), &moduleCreateInfo, &module);
556 ASSERT_VK_SUCCESS(err);
557
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600558 createInfo.sType = VK_STRUCTURE_TYPE_SHADER_CREATE_INFO;
Courtney Goeltzenleuchtera693ed22014-08-19 13:34:28 -0600559 createInfo.pNext = NULL;
Courtney Goeltzenleuchter2d034fd2015-06-28 13:01:17 -0600560 createInfo.module = module;
561 createInfo.pName = "main";
Courtney Goeltzenleuchtera693ed22014-08-19 13:34:28 -0600562 createInfo.flags = 0;
Cody Northrop87ae5e12015-08-24 15:11:10 -0600563 createInfo.stage = stage;
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600564 err = vkCreateShader(device(), &createInfo, &shader);
565 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchtera693ed22014-08-19 13:34:28 -0600566
Mark Lobodzinski67b42b72015-09-07 13:59:43 -0600567 vkDestroyShaderModule(device(), module);
Courtney Goeltzenleuchter2d034fd2015-06-28 13:01:17 -0600568
Courtney Goeltzenleuchter0842df72014-08-20 15:26:55 -0600569 *pshader = shader;
570}
571
Courtney Goeltzenleuchter6b814b32014-08-12 09:59:36 -0600572int main(int argc, char **argv) {
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600573 ::testing::InitGoogleTest(&argc, argv);
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -0600574 vk_testing::set_error_callback(test_error_callback);
Courtney Goeltzenleuchtered56abc2014-08-12 14:12:22 -0600575 return RUN_ALL_TESTS();
Courtney Goeltzenleuchter7087dde2014-08-11 18:19:35 -0600576}