Merge "Merge "Fix color change verification in dithering tests" into nougat-cts-dev...
[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  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  *
15  *      http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  *
23  *//*--------------------------------------------------------------------*/
24
25 #include "tcuDefs.hpp"
26 #include "tcuTestLog.hpp"
27 #include "deUniquePtr.hpp"
28 #include "vkRef.hpp"
29 #include "vkMemUtil.hpp"
30 #include "vkQueryUtil.hpp"
31
32 namespace vkt
33 {
34
35 namespace api
36 {
37
38 class ComputeInstanceResultBuffer
39 {
40 public:
41         enum
42         {
43                 DATA_SIZE = sizeof(tcu::Vec4[4])
44         };
45
46                                                                                         ComputeInstanceResultBuffer (const vk::DeviceInterface &vki,
47                                                                                                                                                                 vk::VkDevice device,
48                                                                                                                                                                 vk::Allocator &allocator,
49                                                                                                                                                                 float initValue = -1.0f);
50
51         void                                                                    readResultContentsTo(tcu::Vec4 (* results)[4]) const;
52
53         void                                                                    readResultContentsTo(deUint32* result) const;
54
55         inline vk::VkBuffer                                             getBuffer(void) const { return *m_buffer; }
56
57         inline const vk::VkBufferMemoryBarrier* getResultReadBarrier(void) const { return &m_bufferBarrier; }
58
59 private:
60         static vk::Move<vk::VkBuffer>                   createResultBuffer(const vk::DeviceInterface &vki,
61                                                                                                                 vk::VkDevice device,
62                                                                                                                 vk::Allocator &allocator,
63                                                                                                                 de::MovePtr<vk::Allocation>* outAllocation,
64                                                                                                                 float initValue = -1.0f);
65
66         static vk::VkBufferMemoryBarrier                createResultBufferBarrier(vk::VkBuffer buffer);
67
68         const vk::DeviceInterface &                             m_vki;
69         const vk::VkDevice                                              m_device;
70
71         de::MovePtr<vk::Allocation>                             m_bufferMem;
72         const vk::Unique<vk::VkBuffer>                  m_buffer;
73         const vk::VkBufferMemoryBarrier                 m_bufferBarrier;
74 };
75
76 } // api
77 } // vkt
78
79 #endif // _VKTAPICOMPUTEINSTANCERESULTBUFFER_HPP