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 32namespace vkt 33{ 34 35namespace api 36{ 37 38class ComputeInstanceResultBuffer 39{ 40public: 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 50 void readResultContentsTo(tcu::Vec4 (* results)[4]) const; 51 52 inline vk::VkBuffer getBuffer(void) const { return *m_buffer; } 53 54 inline const vk::VkBufferMemoryBarrier* getResultReadBarrier(void) const { return &m_bufferBarrier; } 55 56private: 57 static vk::Move<vk::VkBuffer> createResultBuffer(const vk::DeviceInterface &vki, 58 vk::VkDevice device, 59 vk::Allocator &allocator, 60 de::MovePtr<vk::Allocation>* outAllocation); 61 62 static vk::VkBufferMemoryBarrier createResultBufferBarrier(vk::VkBuffer buffer); 63 64 const vk::DeviceInterface & m_vki; 65 const vk::VkDevice m_device; 66 67 de::MovePtr<vk::Allocation> m_bufferMem; 68 const vk::Unique<vk::VkBuffer> m_buffer; 69 const vk::VkBufferMemoryBarrier m_bufferBarrier; 70}; 71 72} // api 73} // vkt 74 75#endif // _VKTAPICOMPUTEINSTANCERESULTBUFFER_HPP 76