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, vk::VkDevice device, vk::Allocator &allocator, 47 float initValue = -1.0f); 48 49 void readResultContentsTo(tcu::Vec4 (*results)[4]) const; 50 51 void readResultContentsTo(uint32_t *result) const; 52 getBuffer(void) const53 inline vk::VkBuffer getBuffer(void) const 54 { 55 return *m_buffer; 56 } 57 getResultReadBarrier(void) const58 inline const vk::VkBufferMemoryBarrier *getResultReadBarrier(void) const 59 { 60 return &m_bufferBarrier; 61 } 62 63 private: 64 static vk::Move<vk::VkBuffer> createResultBuffer(const vk::DeviceInterface &vki, vk::VkDevice device, 65 vk::Allocator &allocator, 66 de::MovePtr<vk::Allocation> *outAllocation, 67 float initValue = -1.0f); 68 69 static vk::VkBufferMemoryBarrier createResultBufferBarrier(vk::VkBuffer buffer); 70 71 const vk::DeviceInterface &m_vki; 72 const vk::VkDevice m_device; 73 74 de::MovePtr<vk::Allocation> m_bufferMem; 75 const vk::Unique<vk::VkBuffer> m_buffer; 76 const vk::VkBufferMemoryBarrier m_bufferBarrier; 77 }; 78 79 } // namespace api 80 } // namespace vkt 81 82 #endif // _VKTAPICOMPUTEINSTANCERESULTBUFFER_HPP 83