Merge branch 'jekstrand_renderpass_transfer_bit_fix' into 'master'
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / modules / vulkan / api / vktApiComputeInstanceResultBuffer.hpp
1 #ifndef _VKTAPICOMPUTEINSTANCERESULTBUFFER_HPP
2 #define _VKTAPICOMPUTEINSTANCERESULTBUFFER_HPP
3 /*-------------------------------------------------------------------------
4  * Vulkan Conformance Tests
5  * ------------------------
6  *
7  * Copyright (c) 2015 The Khronos Group Inc.
8  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
9  * Copyright (c) 2015 Google Inc.
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining a
12  * copy of this software and/or associated documentation files (the
13  * "Materials"), to deal in the Materials without restriction, including
14  * without limitation the rights to use, copy, modify, merge, publish,
15  * distribute, sublicense, and/or sell copies of the Materials, and to
16  * permit persons to whom the Materials are furnished to do so, subject to
17  * the following conditions:
18  *
19  * The above copyright notice(s) and this permission notice shall be
20  * included in all copies or substantial portions of the Materials.
21  *
22  * The Materials are Confidential Information as defined by the
23  * Khronos Membership Agreement until designated non-confidential by
24  * Khronos, at which point this condition clause shall be removed.
25  *
26  * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
29  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
30  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
31  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
32  * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
33  *
34  *//*--------------------------------------------------------------------*/
35
36 #include "tcuDefs.hpp"
37 #include "tcuTestLog.hpp"
38 #include "deUniquePtr.hpp"
39 #include "vkRef.hpp"
40 #include "vkMemUtil.hpp"
41 #include "vkQueryUtil.hpp"
42
43 namespace vkt
44 {
45
46 namespace api
47 {
48
49 class ComputeInstanceResultBuffer
50 {
51 public:
52         enum
53         {
54                 DATA_SIZE = sizeof(tcu::Vec4[4])
55         };
56
57                                                                                         ComputeInstanceResultBuffer (const vk::DeviceInterface &vki,
58                                                                                                                                                                 vk::VkDevice device,
59                                                                                                                                                                 vk::Allocator &allocator);
60
61         void                                                                    readResultContentsTo(tcu::Vec4 (* results)[4]) const;
62
63         inline vk::VkBuffer                                             getBuffer(void) const { return *m_buffer; }
64
65         inline const vk::VkBufferMemoryBarrier* getResultReadBarrier(void) const { return &m_bufferBarrier; }
66
67 private:
68         static vk::Move<vk::VkBuffer>                   createResultBuffer(const vk::DeviceInterface &vki,
69                                                                                                                 vk::VkDevice device,
70                                                                                                                 vk::Allocator &allocator,
71                                                                                                                 de::MovePtr<vk::Allocation>* outAllocation);
72
73         static vk::VkBufferMemoryBarrier                createResultBufferBarrier(vk::VkBuffer buffer);
74
75         const vk::DeviceInterface &                             m_vki;
76         const vk::VkDevice                                              m_device;
77
78         de::MovePtr<vk::Allocation>                             m_bufferMem;
79         const vk::Unique<vk::VkBuffer>                  m_buffer;
80         const vk::VkBufferMemoryBarrier                 m_bufferBarrier;
81 };
82
83 } // api
84 } // vkt
85
86 #endif // _VKTAPICOMPUTEINSTANCERESULTBUFFER_HPP