blob: 98d6bf178be2bdbc782b1f1e0356736e7970d6ee [file] [log] [blame]
Karl Schultz99e9d1d2016-02-02 17:17:23 -07001/*
2 * Copyright (c) 2015-2016 The Khronos Group Inc.
3 * Copyright (c) 2015-2016 Valve Corporation
4 * Copyright (c) 2015-2016 LunarG, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and/or associated documentation files (the "Materials"), to
8 * deal in the Materials without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Materials, and to permit persons to whom the Materials are
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice(s) and this permission notice shall be included in
14 * all copies or substantial portions of the Materials.
15 *
Karl Schultz99e9d1d2016-02-02 17:17:23 -070016 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 *
20 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
21 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
23 * USE OR OTHER DEALINGS IN THE MATERIALS.
24 *
25 * Author: Chia-I Wu <olvaffe@gmail.com>
26 * Author: Chris Forbes <chrisf@ijw.co.nz>
27 * Author: Courtney Goeltzenleuchter <courtney@LunarG.com>
28 * Author: Mark Lobodzinski <mark@lunarg.com>
29 * Author: Mike Stroyan <mike@LunarG.com>
30 * Author: Tobin Ehlis <tobine@google.com>
31 * Author: Tony Barbour <tony@LunarG.com>
32 */
33
Tony Barbour34888cf2015-03-02 16:38:52 -070034#ifndef TEST_ENVIRONMENT_H
35#define TEST_ENVIRONMENT_H
Chia-I Wu5b66aa52015-04-16 22:02:10 +080036
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060037#include "vktestbinding.h"
Tony Barbour34888cf2015-03-02 16:38:52 -070038
Courtney Goeltzenleuchter9cc421e2015-04-08 15:36:08 -060039namespace vk_testing {
Tony Barbour34888cf2015-03-02 16:38:52 -070040class Environment : public ::testing::Environment {
Karl Schultz99e9d1d2016-02-02 17:17:23 -070041 public:
Tony Barbour34888cf2015-03-02 16:38:52 -070042 Environment();
43
44 bool parse_args(int argc, char **argv);
45
46 virtual void SetUp();
Tony Barbour34888cf2015-03-02 16:38:52 -070047 virtual void TearDown();
Tony Barbour34888cf2015-03-02 16:38:52 -070048
49 const std::vector<Device *> &devices() { return devs_; }
50 Device &default_device() { return *(devs_[default_dev_]); }
Jon Ashburncedc15f2015-05-21 18:13:33 -060051 VkInstance get_instance() { return inst; }
Tony Barbour8205d902015-04-16 15:59:00 -060052 VkPhysicalDevice gpus[16];
Tony Barbour34888cf2015-03-02 16:38:52 -070053
Karl Schultz99e9d1d2016-02-02 17:17:23 -070054 private:
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060055 VkApplicationInfo app_;
Courtney Goeltzenleuchter0abdb662015-10-07 13:28:58 -060056 uint32_t default_dev_;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060057 VkInstance inst;
Tony Barbour34888cf2015-03-02 16:38:52 -070058
59 std::vector<Device *> devs_;
60};
61}
62#endif // TEST_ENVIRONMENT_H