blob: 57bf875b1a09c96f7a235a30ece87c32f2b3ef10 [file] [log] [blame]
Courtney Goeltzenleuchter447ed582014-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 Goeltzenleuchtercc9da542014-08-12 14:12:22 -060030
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -060031// VK tests
Courtney Goeltzenleuchtercc9da542014-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 Goeltzenleuchterd8e229c2015-04-08 15:36:08 -060054// Verify VK driver initialization
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -060055
Courtney Goeltzenleuchter447ed582014-08-11 18:19:35 -060056#include <stdlib.h>
57#include <stdio.h>
58#include <stdbool.h>
59#include <string.h>
60
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -060061#include <vulkan.h>
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -060062#include "gtest-1.7.0/include/gtest/gtest.h"
Courtney Goeltzenleuchter447ed582014-08-11 18:19:35 -060063
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -060064#include "vktestbinding.h"
Chia-I Wufe84fe12014-12-29 15:39:23 +080065#include "test_common.h"
Cody Northrop054a4702015-03-17 14:54:35 -060066#include "icd-spv.h"
Courtney Goeltzenleuchter447ed582014-08-11 18:19:35 -060067
Jon Ashburn83a64252015-04-15 11:31:12 -060068#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
69
Tony-LunarGd61e1e52015-05-15 12:42:49 -060070class VkTest : public ::testing::Test {
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -060071public:
Courtney Goeltzenleuchter794555b2014-08-13 17:55:12 -060072 void CreateImageTest();
Courtney Goeltzenleuchterde3513a2014-08-20 15:26:55 -060073 void CreateCommandBufferTest();
74 void CreatePipelineTest();
75 void CreateShaderTest();
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060076 void CreateShader(VkShader *pshader);
Courtney Goeltzenleuchter447ed582014-08-11 18:19:35 -060077
Chia-I Wuf368b602015-07-03 10:41:20 +080078 VkDevice device() {return m_device->handle();}
Courtney Goeltzenleuchtercc5eb3a2014-08-19 18:35:50 -060079
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -060080protected:
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060081 VkApplicationInfo app_info;
82 VkInstance inst;
Tony Barbourd1c35722015-04-16 15:59:00 -060083 VkPhysicalDevice objs[16];
Mark Lobodzinski17caf572015-01-29 08:55:56 -060084 uint32_t gpu_count;
Chia-I Wufe84fe12014-12-29 15:39:23 +080085
Mark Lobodzinski17caf572015-01-29 08:55:56 -060086 uint32_t m_device_id;
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -060087 vk_testing::Device *m_device;
Tony Barbourd1c35722015-04-16 15:59:00 -060088 VkPhysicalDeviceProperties props;
89 std::vector<VkPhysicalDeviceQueueProperties> queue_props;
Courtney Goeltzenleuchter18248e62015-03-05 18:09:39 -070090 uint32_t graphics_queue_node_index;
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -060091
92 virtual void SetUp() {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060093 VkResult err;
Courtney Goeltzenleuchter18248e62015-03-05 18:09:39 -070094 int i;
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -060095
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -060096 this->app_info.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -060097 this->app_info.pNext = NULL;
Chia-I Wuf1a5a742014-12-27 15:16:07 +080098 this->app_info.pAppName = "base";
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -060099 this->app_info.appVersion = 1;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800100 this->app_info.pEngineName = "unittest";
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600101 this->app_info.engineVersion = 1;
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600102 this->app_info.apiVersion = VK_API_VERSION;
Courtney Goeltzenleuchter95487bc2015-04-14 18:48:46 -0600103 VkInstanceCreateInfo inst_info = {};
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600104 inst_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
Jon Ashburnb317fad2015-04-04 14:52:07 -0600105 inst_info.pNext = NULL;
106 inst_info.pAppInfo = &app_info;
107 inst_info.pAllocCb = NULL;
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600108 inst_info.layerCount = 0;
109 inst_info.ppEnabledLayerNames = NULL;
Jon Ashburnb317fad2015-04-04 14:52:07 -0600110 inst_info.extensionCount = 0;
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600111 inst_info.ppEnabledExtensionNames = NULL;
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600112 err = vkCreateInstance(&inst_info, &inst);
113 ASSERT_VK_SUCCESS(err);
Jon Ashburn83a64252015-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 Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600118 ASSERT_VK_SUCCESS(err);
Jon Ashburnbf843b22014-11-26 11:06:49 -0700119 ASSERT_GE(this->gpu_count, 1) << "No GPU available";
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600120
Chia-I Wufe84fe12014-12-29 15:39:23 +0800121 m_device_id = 0;
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600122 this->m_device = new vk_testing::Device(objs[m_device_id]);
Chia-I Wufe84fe12014-12-29 15:39:23 +0800123 this->m_device->init();
124
Chia-I Wu999f0482015-07-03 10:32:05 +0800125 props = m_device->phy().properties();
Chia-I Wufe84fe12014-12-29 15:39:23 +0800126
Chia-I Wu999f0482015-07-03 10:32:05 +0800127 queue_props = this->m_device->phy().queue_properties();
Courtney Goeltzenleuchter18248e62015-03-05 18:09:39 -0700128 for (i = 0; i < queue_props.size(); i++) {
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600129 if (queue_props[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) {
Courtney Goeltzenleuchter18248e62015-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 Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600135 }
136
137 virtual void TearDown() {
Tony Barbourc2f67f52015-06-02 14:55:46 -0600138 delete m_device;
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600139 vkDestroyInstance(inst);
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600140 }
141};
142
Tony-LunarGd61e1e52015-05-15 12:42:49 -0600143TEST_F(VkTest, AllocMemory) {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600144 VkResult err;
Courtney Goeltzenleuchter95487bc2015-04-14 18:48:46 -0600145 VkMemoryAllocInfo alloc_info = {};
Tony Barbourd1c35722015-04-16 15:59:00 -0600146 VkDeviceMemory gpu_mem;
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600147 uint8_t *pData;
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600148
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600149 alloc_info.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO;
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600150 alloc_info.allocationSize = 1024 * 1024; // 1MB
Mark Lobodzinskib3fbcd92015-07-02 16:49:40 -0600151 alloc_info.memoryTypeIndex = 0;
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600152
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600153 err = vkAllocMemory(device(), &alloc_info, &gpu_mem);
154 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchter447ed582014-08-11 18:19:35 -0600155
Mike Stroyanb050c682015-04-17 12:36:38 -0600156 err = vkMapMemory(device(), gpu_mem, 0, 0, 0, (void **) &pData);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600157 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchter75011f82014-08-12 09:59:36 -0600158
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600159 memset(pData, 0x55, alloc_info.allocationSize);
Mark Lobodzinskib3fbcd92015-07-02 16:49:40 -0600160 EXPECT_EQ(0x55, pData[0]) << "Memory read not same as write";
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600161
Mike Stroyanb050c682015-04-17 12:36:38 -0600162 err = vkUnmapMemory(device(), gpu_mem);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600163 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchter75011f82014-08-12 09:59:36 -0600164
Mike Stroyanb050c682015-04-17 12:36:38 -0600165 err = vkFreeMemory(device(), gpu_mem);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600166 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600167}
Courtney Goeltzenleuchter75011f82014-08-12 09:59:36 -0600168
Tony-LunarGd61e1e52015-05-15 12:42:49 -0600169TEST_F(VkTest, Event) {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600170 VkEventCreateInfo event_info;
171 VkEvent event;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600172 VkResult err;
Courtney Goeltzenleuchter75011f82014-08-12 09:59:36 -0600173
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600174 // typedef struct VkEventCreateInfo_
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600175 // {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600176 // VkStructureType sType; // Must be VK_STRUCTURE_TYPE_EVENT_CREATE_INFO
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600177 // const void* pNext; // Pointer to next structure
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600178 // VkFlags flags; // Reserved
179 // } VkEventCreateInfo;
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600180 memset(&event_info, 0, sizeof(event_info));
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600181 event_info.sType = VK_STRUCTURE_TYPE_EVENT_CREATE_INFO;
Courtney Goeltzenleuchter75011f82014-08-12 09:59:36 -0600182
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600183 err = vkCreateEvent(device(), &event_info, &event);
184 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600185
Mike Stroyanb050c682015-04-17 12:36:38 -0600186 err = vkResetEvent(device(), event);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600187 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600188
Mike Stroyanb050c682015-04-17 12:36:38 -0600189 err = vkGetEventStatus(device(), event);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600190 ASSERT_EQ(VK_EVENT_RESET, err);
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600191
Mike Stroyanb050c682015-04-17 12:36:38 -0600192 err = vkSetEvent(device(), event);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600193 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600194
Mike Stroyanb050c682015-04-17 12:36:38 -0600195 err = vkGetEventStatus(device(), event);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600196 ASSERT_EQ(VK_EVENT_SET, err);
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600197
198 // TODO: Test actual synchronization with command buffer event.
199
200 // All done with event memory, clean up
Tony Barbour67e99152015-07-10 14:10:27 -0600201 err = vkDestroyEvent(device(), event);
Courtney Goeltzenleuchter10642562015-06-22 16:26:54 -0600202 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600203}
204
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600205#define MAX_QUERY_SLOTS 10
206
Tony-LunarGd61e1e52015-05-15 12:42:49 -0600207TEST_F(VkTest, Query) {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600208 VkQueryPoolCreateInfo query_info;
209 VkQueryPool query_pool;
Chia-I Wu99ff89d2014-12-27 14:14:50 +0800210 size_t query_result_size;
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600211 uint32_t *query_result_data;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600212 VkResult err;
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600213
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600214 // typedef enum VkQueryType_
Courtney Goeltzenleuchter794555b2014-08-13 17:55:12 -0600215 // {
Tony Barbourd1c35722015-04-16 15:59:00 -0600216 // VK_QUERY_TYPE_OCCLUSION = 0x00000000,
217 // VK_QUERY_TYPE_PIPELINE_STATISTICS = 0x00000001,
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600218
Tony Barbourd1c35722015-04-16 15:59:00 -0600219 // VK_QUERY_TYPE_BEGIN_RANGE = VK_QUERY_TYPE_OCCLUSION,
220 // VK_QUERY_TYPE_END_RANGE = VK_QUERY_TYPE_PIPELINE_STATISTICS,
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600221 // VK_NUM_QUERY_TYPE = (VK_QUERY_TYPE_END_RANGE - VK_QUERY_TYPE_BEGIN_RANGE + 1),
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600222 // VK_MAX_ENUM(VkQueryType_)
223 // } VkQueryType;
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600224
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600225 // typedef struct VkQueryPoolCreateInfo_
Courtney Goeltzenleuchter794555b2014-08-13 17:55:12 -0600226 // {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600227 // VkStructureType sType; // Must be VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600228 // const void* pNext; // Pointer to next structure
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600229 // VkQueryType queryType;
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600230 // uint32_t slots;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600231 // } VkQueryPoolCreateInfo;
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600232
233 memset(&query_info, 0, sizeof(query_info));
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600234 query_info.sType = VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO;
Tony Barbourd1c35722015-04-16 15:59:00 -0600235 query_info.queryType = VK_QUERY_TYPE_OCCLUSION;
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600236 query_info.slots = MAX_QUERY_SLOTS;
237
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600238 // VkResult VKAPI vkCreateQueryPool(
239 // VkDevice device,
240 // const VkQueryPoolCreateInfo* pCreateInfo,
241 // VkQueryPool* pQueryPool);
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600242
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600243 err = vkCreateQueryPool(device(), &query_info, &query_pool);
244 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600245
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600246 // TODO: Test actual synchronization with command buffer event.
247 // TODO: Create command buffer
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600248 // TODO: vkCmdResetQueryPool
249 // TODO: vkCmdBeginQuery
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600250 // TODO: commands
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600251 // TOOD: vkCmdEndQuery
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600252
Mike Stroyanb050c682015-04-17 12:36:38 -0600253 err = vkGetQueryPoolResults(device(), query_pool, 0, MAX_QUERY_SLOTS,
Tony Barbourd1c35722015-04-16 15:59:00 -0600254 &query_result_size, VK_NULL_HANDLE, 0);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600255 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600256
257 if (query_result_size > 0) {
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600258 query_result_data = new uint32_t [query_result_size];
Mike Stroyanb050c682015-04-17 12:36:38 -0600259 err = vkGetQueryPoolResults(device(), query_pool, 0, MAX_QUERY_SLOTS,
Tony Barbourd1c35722015-04-16 15:59:00 -0600260 &query_result_size, query_result_data, 0);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600261 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600262
263 // TODO: Test Query result data.
264
265 }
266
Tony Barbour67e99152015-07-10 14:10:27 -0600267 err = vkDestroyQueryPool(device(), query_pool);
Courtney Goeltzenleuchter10642562015-06-22 16:26:54 -0600268 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchter794555b2014-08-13 17:55:12 -0600269}
Courtney Goeltzenleuchter75011f82014-08-12 09:59:36 -0600270
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600271void getQueue(vk_testing::Device *device, uint32_t queue_node_index, const char *qname)
Courtney Goeltzenleuchter3dc07f22014-08-14 10:15:09 -0600272{
273 int que_idx;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600274 VkResult err;
275 VkQueue queue;
Courtney Goeltzenleuchter3dc07f22014-08-14 10:15:09 -0600276
Chia-I Wu999f0482015-07-03 10:32:05 +0800277 const VkPhysicalDeviceQueueProperties props = device->phy().queue_properties()[queue_node_index];
Chia-I Wufe84fe12014-12-29 15:39:23 +0800278 for (que_idx = 0; que_idx < props.queueCount; que_idx++) {
Mark Lobodzinski40f7f402015-04-16 11:44:05 -0500279 // TODO: Need to add support for separate MEMMGR and work queues, including synchronization
Chia-I Wuf368b602015-07-03 10:41:20 +0800280 err = vkGetDeviceQueue(device->handle(), queue_node_index, que_idx, &queue);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600281 ASSERT_EQ(VK_SUCCESS, err) << "vkGetDeviceQueue: " << qname << " queue #" << que_idx << ": Failed with error: " << vk_result_string(err);
Courtney Goeltzenleuchter3dc07f22014-08-14 10:15:09 -0600282 }
283}
284
Tony-LunarGd61e1e52015-05-15 12:42:49 -0600285void VkTest::CreateImageTest()
Courtney Goeltzenleuchter794555b2014-08-13 17:55:12 -0600286{
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600287 VkResult err;
288 VkImage image;
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600289 uint32_t w, h, mipCount;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600290 VkFormat fmt;
291 VkFormatProperties image_fmt;
Courtney Goeltzenleuchter794555b2014-08-13 17:55:12 -0600292
293 w =512;
294 h = 256;
295 mipCount = 0;
296
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600297 uint32_t _w = w;
298 uint32_t _h = h;
Courtney Goeltzenleuchter794555b2014-08-13 17:55:12 -0600299 while( ( _w > 0 ) || ( _h > 0 ) )
300 {
301 _w >>= 1;
302 _h >>= 1;
303 mipCount++;
304 }
305
Tony Barbourd1c35722015-04-16 15:59:00 -0600306 fmt = VK_FORMAT_R8G8B8A8_UINT;
Courtney Goeltzenleuchter794555b2014-08-13 17:55:12 -0600307 // TODO: Pick known good format rather than just expect common format
308 /*
309 * XXX: What should happen if given NULL HANDLE for the pData argument?
Tony Barbourd1c35722015-04-16 15:59:00 -0600310 * We're not requesting VK_OBJECT_INFO_TYPE_MEMORY_REQUIREMENTS so there is
Courtney Goeltzenleuchter794555b2014-08-13 17:55:12 -0600311 * an expectation that pData is a valid pointer.
312 * However, why include a returned size value? That implies that the
313 * amount of data may vary and that doesn't work well for using a
314 * fixed structure.
315 */
316
Chris Forbesbc0bb772015-06-21 22:55:02 +1200317 err = vkGetPhysicalDeviceFormatInfo(objs[m_device_id], fmt, &image_fmt);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600318 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchter794555b2014-08-13 17:55:12 -0600319
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600320// typedef struct VkImageCreateInfo_
Courtney Goeltzenleuchter794555b2014-08-13 17:55:12 -0600321// {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600322// VkStructureType sType; // Must be VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600323// const void* pNext; // Pointer to next structure.
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600324// VkImageType imageType;
325// VkFormat format;
326// VkExtent3D extent;
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600327// uint32_t mipLevels;
328// uint32_t arraySize;
329// uint32_t samples;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600330// VkImageTiling tiling;
331// VkFlags usage; // VkImageUsageFlags
332// VkFlags flags; // VkImageCreateFlags
333// } VkImageCreateInfo;
Courtney Goeltzenleuchter794555b2014-08-13 17:55:12 -0600334
335
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600336 VkImageCreateInfo imageCreateInfo = {};
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600337 imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
Tony Barbourd1c35722015-04-16 15:59:00 -0600338 imageCreateInfo.imageType = VK_IMAGE_TYPE_2D;
Courtney Goeltzenleuchter794555b2014-08-13 17:55:12 -0600339 imageCreateInfo.format = fmt;
340 imageCreateInfo.arraySize = 1;
341 imageCreateInfo.extent.width = w;
342 imageCreateInfo.extent.height = h;
343 imageCreateInfo.extent.depth = 1;
344 imageCreateInfo.mipLevels = mipCount;
345 imageCreateInfo.samples = 1;
Tony-LunarGd61e1e52015-05-15 12:42:49 -0600346 if (image_fmt.linearTilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) {
347 imageCreateInfo.tiling = VK_IMAGE_TILING_LINEAR;
348 }
349 else if (image_fmt.optimalTilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) {
350 imageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
351 }
352 else {
353 FAIL() << "Neither Linear nor Optimal allowed for color attachment";
354 }
Cody Northropbb6fdb32015-06-17 08:28:19 -0600355 imageCreateInfo.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT |
356 VK_IMAGE_USAGE_SAMPLED_BIT;
Courtney Goeltzenleuchter794555b2014-08-13 17:55:12 -0600357
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600358// VkResult VKAPI vkCreateImage(
359// VkDevice device,
360// const VkImageCreateInfo* pCreateInfo,
361// VkImage* pImage);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600362 err = vkCreateImage(device(), &imageCreateInfo, &image);
363 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchter794555b2014-08-13 17:55:12 -0600364
Courtney Goeltzenleuchter7bf0ff82014-08-14 17:40:57 -0600365 // Verify image resources
Tony Barbour59a47322015-06-24 16:06:58 -0600366// VkResult VKAPI vkGetImageSubresourceLayout(
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600367// VkImage image,
368// const VkImageSubresource* pSubresource,
Tony Barbour59a47322015-06-24 16:06:58 -0600369// VkSubresourceLayout* pLayout);
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600370// typedef struct VkSubresourceLayout_
Courtney Goeltzenleuchter7bf0ff82014-08-14 17:40:57 -0600371// {
Tony Barbourd1c35722015-04-16 15:59:00 -0600372// VkDeviceSize offset; // Specified in bytes
373// VkDeviceSize size; // Specified in bytes
374// VkDeviceSize rowPitch; // Specified in bytes
375// VkDeviceSize depthPitch; // Specified in bytes
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600376// } VkSubresourceLayout;
Courtney Goeltzenleuchter7bf0ff82014-08-14 17:40:57 -0600377
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600378// typedef struct VkImageSubresource_
Courtney Goeltzenleuchter7bf0ff82014-08-14 17:40:57 -0600379// {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600380// VkImageAspect aspect;
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600381// uint32_t mipLevel;
382// uint32_t arraySlice;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600383// } VkImageSubresource;
Courtney Goeltzenleuchter7bf0ff82014-08-14 17:40:57 -0600384
Courtney Goeltzenleuchter7bf0ff82014-08-14 17:40:57 -0600385
Tony-LunarGd61e1e52015-05-15 12:42:49 -0600386 if (image_fmt.linearTilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) {
387 VkImageSubresource subresource = {};
388 subresource.aspect = VK_IMAGE_ASPECT_COLOR;
389 subresource.arraySlice = 0;
Courtney Goeltzenleuchter7bf0ff82014-08-14 17:40:57 -0600390
Tony-LunarGd61e1e52015-05-15 12:42:49 -0600391 _w = w;
392 _h = h;
393 while ((_w > 0) || (_h > 0))
394 {
395 VkSubresourceLayout layout = {};
Tony Barbour59a47322015-06-24 16:06:58 -0600396 err = vkGetImageSubresourceLayout(device(), image, &subresource, &layout);
Tony-LunarGd61e1e52015-05-15 12:42:49 -0600397 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchter7bf0ff82014-08-14 17:40:57 -0600398
Tony-LunarGd61e1e52015-05-15 12:42:49 -0600399 // TODO: 4 should be replaced with pixel size for given format
400 EXPECT_LE(_w * 4, layout.rowPitch) << "Pitch does not match expected image pitch";
401 _w >>= 1;
402 _h >>= 1;
403
404 subresource.mipLevel++;
405 }
Courtney Goeltzenleuchter7bf0ff82014-08-14 17:40:57 -0600406 }
407
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600408 VkMemoryRequirements mem_req;
Tony Barbourd1c35722015-04-16 15:59:00 -0600409 VkDeviceMemory image_mem;
Courtney Goeltzenleuchter794555b2014-08-13 17:55:12 -0600410
Tony Barbour67e99152015-07-10 14:10:27 -0600411 err = vkGetImageMemoryRequirements(device(), image, &mem_req);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600412 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchter794555b2014-08-13 17:55:12 -0600413
Tony-LunarGd61e1e52015-05-15 12:42:49 -0600414 if (mem_req.size) {
415
416 // VkResult VKAPI vkAllocMemory(
417 // VkDevice device,
418 // const VkMemoryAllocInfo* pAllocInfo,
419 // VkDeviceMemory* pMem);
420 VkMemoryAllocInfo mem_info = {};
421
422 mem_info.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO;
423 mem_info.pNext = NULL;
424 mem_info.allocationSize = mem_req.size;
Mark Lobodzinskib3fbcd92015-07-02 16:49:40 -0600425 mem_info.memoryTypeIndex = 0;
426
Chia-I Wu999f0482015-07-03 10:32:05 +0800427 err = m_device->phy().set_memory_type(mem_req.memoryTypeBits, &mem_info, 0);
Mark Lobodzinskib3fbcd92015-07-02 16:49:40 -0600428 ASSERT_VK_SUCCESS(err);
429
Tony-LunarGd61e1e52015-05-15 12:42:49 -0600430 err = vkAllocMemory(device(), &mem_info, &image_mem);
431 ASSERT_VK_SUCCESS(err);
432
Tony Barbour67e99152015-07-10 14:10:27 -0600433 err = vkBindImageMemory(device(), image, image_mem, 0);
Tony-LunarGd61e1e52015-05-15 12:42:49 -0600434 ASSERT_VK_SUCCESS(err);
435 }
Courtney Goeltzenleuchter794555b2014-08-13 17:55:12 -0600436
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600437// typedef struct VkImageViewCreateInfo_
Courtney Goeltzenleuchter794555b2014-08-13 17:55:12 -0600438// {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600439// VkStructureType sType; // Must be VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600440// const void* pNext; // Pointer to next structure
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600441// VkImage image;
442// VkImageViewType viewType;
443// VkFormat format;
444// VkChannelMapping channels;
445// VkImageSubresourceRange subresourceRange;
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600446// float minLod;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600447// } VkImageViewCreateInfo;
448 VkImageViewCreateInfo viewInfo = {};
449 VkImageView view;
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600450 viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
Courtney Goeltzenleuchter794555b2014-08-13 17:55:12 -0600451 viewInfo.image = image;
Tony Barbourd1c35722015-04-16 15:59:00 -0600452 viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
Courtney Goeltzenleuchter794555b2014-08-13 17:55:12 -0600453 viewInfo.format = fmt;
454
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600455 viewInfo.channels.r = VK_CHANNEL_SWIZZLE_R;
456 viewInfo.channels.g = VK_CHANNEL_SWIZZLE_G;
457 viewInfo.channels.b = VK_CHANNEL_SWIZZLE_B;
458 viewInfo.channels.a = VK_CHANNEL_SWIZZLE_A;
Courtney Goeltzenleuchter794555b2014-08-13 17:55:12 -0600459
460 viewInfo.subresourceRange.baseArraySlice = 0;
461 viewInfo.subresourceRange.arraySize = 1;
462 viewInfo.subresourceRange.baseMipLevel = 0;
463 viewInfo.subresourceRange.mipLevels = 1;
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600464 viewInfo.subresourceRange.aspect = VK_IMAGE_ASPECT_COLOR;
Courtney Goeltzenleuchter794555b2014-08-13 17:55:12 -0600465
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600466// VkResult VKAPI vkCreateImageView(
467// VkDevice device,
468// const VkImageViewCreateInfo* pCreateInfo,
469// VkImageView* pView);
Courtney Goeltzenleuchter794555b2014-08-13 17:55:12 -0600470
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600471 err = vkCreateImageView(device(), &viewInfo, &view);
472 ASSERT_VK_SUCCESS(err) << "vkCreateImageView failed";
Courtney Goeltzenleuchter794555b2014-08-13 17:55:12 -0600473
474 // TODO: Test image memory.
475
476 // All done with image memory, clean up
Tony Barbour67e99152015-07-10 14:10:27 -0600477 ASSERT_VK_SUCCESS(vkDestroyImageView(device(), view));
478 ASSERT_VK_SUCCESS(vkDestroyImage(device(), image));
Courtney Goeltzenleuchter10642562015-06-22 16:26:54 -0600479
Tony-LunarGd61e1e52015-05-15 12:42:49 -0600480 if (mem_req.size) {
Tony-LunarGd61e1e52015-05-15 12:42:49 -0600481 ASSERT_VK_SUCCESS(vkFreeMemory(device(), image_mem));
482 }
Courtney Goeltzenleuchter794555b2014-08-13 17:55:12 -0600483}
484
Tony-LunarGd61e1e52015-05-15 12:42:49 -0600485TEST_F(VkTest, CreateImage) {
Courtney Goeltzenleuchter794555b2014-08-13 17:55:12 -0600486 CreateImageTest();
Courtney Goeltzenleuchter75011f82014-08-12 09:59:36 -0600487}
488
Tony-LunarGd61e1e52015-05-15 12:42:49 -0600489void VkTest::CreateCommandBufferTest()
Courtney Goeltzenleuchterde3513a2014-08-20 15:26:55 -0600490{
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600491 VkResult err;
492 VkCmdBufferCreateInfo info = {};
Cody Northrope62183e2015-07-09 18:08:05 -0600493 VkCmdPool cmdPool;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600494 VkCmdBuffer cmdBuffer;
Courtney Goeltzenleuchterde3513a2014-08-20 15:26:55 -0600495
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600496// typedef struct VkCmdBufferCreateInfo_
Courtney Goeltzenleuchterde3513a2014-08-20 15:26:55 -0600497// {
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600498// VkStructureType sType; // Must be VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600499// const void* pNext;
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600500// VK_QUEUE_TYPE queueType;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600501// VkFlags flags;
502// } VkCmdBufferCreateInfo;
Courtney Goeltzenleuchterde3513a2014-08-20 15:26:55 -0600503
Cody Northrope62183e2015-07-09 18:08:05 -0600504 VkCmdPoolCreateInfo cmd_pool_info;
505 cmd_pool_info.sType = VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO,
506 cmd_pool_info.pNext = NULL,
507 cmd_pool_info.queueFamilyIndex = graphics_queue_node_index;
508 cmd_pool_info.flags = 0,
509 err = vkCreateCommandPool(device(), &cmd_pool_info, &cmdPool);
510 ASSERT_VK_SUCCESS(err) << "vkCreateCommandPool failed";
511
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600512 info.sType = VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO;
Cody Northrope62183e2015-07-09 18:08:05 -0600513 info.cmdPool = cmdPool;
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600514 err = vkCreateCommandBuffer(device(), &info, &cmdBuffer);
515 ASSERT_VK_SUCCESS(err) << "vkCreateCommandBuffer failed";
Courtney Goeltzenleuchterde3513a2014-08-20 15:26:55 -0600516
Tony Barbour67e99152015-07-10 14:10:27 -0600517 ASSERT_VK_SUCCESS(vkDestroyCommandBuffer(device(), cmdBuffer));
Cody Northrope62183e2015-07-09 18:08:05 -0600518 ASSERT_VK_SUCCESS(vkDestroyCommandPool(device(), cmdPool));
Courtney Goeltzenleuchterde3513a2014-08-20 15:26:55 -0600519}
520
Tony-LunarGd61e1e52015-05-15 12:42:49 -0600521TEST_F(VkTest, TestCommandBuffer) {
Courtney Goeltzenleuchterde3513a2014-08-20 15:26:55 -0600522 CreateCommandBufferTest();
523}
524
Tony-LunarGd61e1e52015-05-15 12:42:49 -0600525void VkTest::CreateShader(VkShader *pshader)
Courtney Goeltzenleuchterde3513a2014-08-20 15:26:55 -0600526{
Courtney Goeltzenleuchter6863ff42014-08-19 13:34:28 -0600527 void *code;
528 uint32_t codeSize;
Cody Northrop3bfd27c2015-03-17 15:55:58 -0600529 struct icd_spv_header *pSPV;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600530 VkResult err;
Courtney Goeltzenleuchter6863ff42014-08-19 13:34:28 -0600531
Cody Northrop3bfd27c2015-03-17 15:55:58 -0600532 codeSize = sizeof(struct icd_spv_header) + 100;
Courtney Goeltzenleuchter6863ff42014-08-19 13:34:28 -0600533 code = malloc(codeSize);
534 ASSERT_TRUE(NULL != code) << "malloc failed!";
535
536 memset(code, 0, codeSize);
537
Cody Northrop3bfd27c2015-03-17 15:55:58 -0600538 // Indicate that this is SPV data.
539 pSPV = (struct icd_spv_header *) code;
540 pSPV->magic = ICD_SPV_MAGIC;
541 pSPV->version = ICD_SPV_VERSION;
Courtney Goeltzenleuchter6863ff42014-08-19 13:34:28 -0600542
Courtney Goeltzenleuchteree4027d2015-06-28 13:01:17 -0600543 VkShaderModuleCreateInfo moduleCreateInfo;
544 VkShaderModule module;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600545 VkShaderCreateInfo createInfo;
546 VkShader shader;
Courtney Goeltzenleuchter6863ff42014-08-19 13:34:28 -0600547
Courtney Goeltzenleuchteree4027d2015-06-28 13:01:17 -0600548 moduleCreateInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
549 moduleCreateInfo.pNext = NULL;
550 moduleCreateInfo.pCode = code;
551 moduleCreateInfo.codeSize = codeSize;
552 moduleCreateInfo.flags = 0;
553 err = vkCreateShaderModule(device(), &moduleCreateInfo, &module);
554 ASSERT_VK_SUCCESS(err);
555
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600556 createInfo.sType = VK_STRUCTURE_TYPE_SHADER_CREATE_INFO;
Courtney Goeltzenleuchter6863ff42014-08-19 13:34:28 -0600557 createInfo.pNext = NULL;
Courtney Goeltzenleuchteree4027d2015-06-28 13:01:17 -0600558 createInfo.module = module;
559 createInfo.pName = "main";
Courtney Goeltzenleuchter6863ff42014-08-19 13:34:28 -0600560 createInfo.flags = 0;
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600561 err = vkCreateShader(device(), &createInfo, &shader);
562 ASSERT_VK_SUCCESS(err);
Courtney Goeltzenleuchter6863ff42014-08-19 13:34:28 -0600563
Tony Barbour67e99152015-07-10 14:10:27 -0600564 err = vkDestroyShaderModule(device(), module);
Courtney Goeltzenleuchteree4027d2015-06-28 13:01:17 -0600565 ASSERT_VK_SUCCESS(err);
566
Courtney Goeltzenleuchterde3513a2014-08-20 15:26:55 -0600567 *pshader = shader;
568}
569
Courtney Goeltzenleuchter75011f82014-08-12 09:59:36 -0600570int main(int argc, char **argv) {
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600571 ::testing::InitGoogleTest(&argc, argv);
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600572 vk_testing::set_error_callback(test_error_callback);
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -0600573 return RUN_ALL_TESTS();
Courtney Goeltzenleuchter447ed582014-08-11 18:19:35 -0600574}