1#ifndef _VKTDYNAMICSTATEBUFFEROBJECTUTIL_HPP 2#define _VKTDYNAMICSTATEBUFFEROBJECTUTIL_HPP 3/*------------------------------------------------------------------------ 4 * Vulkan Conformance Tests 5 * ------------------------ 6 * 7 * Copyright (c) 2015 The Khronos Group Inc. 8 * Copyright (c) 2015 Intel Corporation 9 * 10 * Licensed under the Apache License, Version 2.0 (the "License"); 11 * you may not use this file except in compliance with the License. 12 * You may obtain a copy of the License at 13 * 14 * http://www.apache.org/licenses/LICENSE-2.0 15 * 16 * Unless required by applicable law or agreed to in writing, software 17 * distributed under the License is distributed on an "AS IS" BASIS, 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 * See the License for the specific language governing permissions and 20 * limitations under the License. 21 * 22 *//*! 23 * \file 24 * \brief Buffer Object Util 25 *//*--------------------------------------------------------------------*/ 26 27#include "vkDefs.hpp" 28#include "vkMemUtil.hpp" 29#include "vkRefUtil.hpp" 30 31#include "deSharedPtr.hpp" 32 33namespace vkt 34{ 35namespace DynamicState 36{ 37 38class Buffer 39{ 40public: 41 42 static de::SharedPtr<Buffer> create (const vk::DeviceInterface& vk, vk::VkDevice device, const vk::VkBufferCreateInfo &createInfo); 43 44 static de::SharedPtr<Buffer> createAndAlloc (const vk::DeviceInterface& vk, 45 vk::VkDevice device, 46 const vk::VkBufferCreateInfo& createInfo, 47 vk::Allocator& allocator, 48 vk::MemoryRequirement allocationMemoryProperties = vk::MemoryRequirement::Any); 49 50 Buffer (const vk::DeviceInterface &vk, vk::VkDevice device, vk::Move<vk::VkBuffer> object); 51 52 void bindMemory (de::MovePtr<vk::Allocation> allocation); 53 54 vk::VkBuffer object (void) const { return *m_object; } 55 vk::Allocation getBoundMemory (void) const { return *m_allocation; } 56 57private: 58 59 Buffer (const Buffer& other); // Not allowed! 60 Buffer& operator= (const Buffer& other); // Not allowed! 61 62 de::MovePtr<vk::Allocation> m_allocation; 63 vk::Unique<vk::VkBuffer> m_object; 64 65 const vk::DeviceInterface& m_vk; 66 vk::VkDevice m_device; 67}; 68 69} // DynamicState 70} // vkt 71 72#endif // _VKTDYNAMICSTATEBUFFEROBJECTUTIL_HPP 73