blob: efba1b421ba2194efe35f379a65565729b840369 [file] [log] [blame]
Po-Hsien Wang00777b22019-04-24 16:37:09 -07001// Copyright 2019 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "submitTest.h"
6#include "testUtil.h"
7
8namespace vkbench {
9void SubmitTest::TestInitialization() {
10 fences_.push_back(device_.createFence({vk::FenceCreateFlagBits::eSignaled}));
11 // Create empty cmdBuffer
12 cmd_buffers_ = device_.allocateCommandBuffers(
13 {cmd_pool_, vk::CommandBufferLevel::ePrimary, 1});
14 cmd_buffers_[0].begin({vk::CommandBufferUsageFlagBits::eSimultaneousUse});
15 cmd_buffers_[0].end();
16
17 for (auto& t : smt_infos_) {
18 t.setCommandBufferCount(1);
19 t.setPCommandBuffers(&cmd_buffers_[0]);
20 }
21}
22
23bool SubmitTest::TestRun() {
24 device_.waitForFences(fences_, VK_TRUE, std::numeric_limits<uint64_t>::max());
25 device_.resetFences(fences_);
26 gfx_queue_.submit(smt_infos_, fences_[0], {});
27 return true;
28}
29
30void SubmitTest::TestCleanup() {
31 device_.waitForFences(fences_, VK_TRUE, std::numeric_limits<uint64_t>::max());
32}
33
34void SubmitTest::TestDestroy() {
35 if (!device_)
36 return;
37
38 if (cmd_pool_)
39 device_.freeCommandBuffers(cmd_pool_, cmd_buffers_);
40 for (auto &fence : fences_) {
41 device_.destroyFence(fence);
42 }
43}
44} // namespace vkbench