Home | History | Annotate | Download | only in draw
      1 #ifndef _VKTDRAWBUFFEROBJECTUTIL_HPP
      2 #define _VKTDRAWBUFFEROBJECTUTIL_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 "vkMemUtil.hpp"
     28 #include "vkRefUtil.hpp"
     29 
     30 #include "deSharedPtr.hpp"
     31 
     32 namespace vkt
     33 {
     34 namespace Draw
     35 {
     36 
     37 class Buffer
     38 {
     39 public:
     40 
     41 	static de::SharedPtr<Buffer> create			(const vk::DeviceInterface& vk, vk::VkDevice device, const vk::VkBufferCreateInfo &createInfo);
     42 
     43 	static de::SharedPtr<Buffer> createAndAlloc (const vk::DeviceInterface&		vk,
     44 												 vk::VkDevice					device,
     45 												 const vk::VkBufferCreateInfo&	createInfo,
     46 												 vk::Allocator&					allocator,
     47 												 vk::MemoryRequirement			allocationMemoryProperties = vk::MemoryRequirement::Any);
     48 
     49 								Buffer			(const vk::DeviceInterface &vk, vk::VkDevice device, vk::Move<vk::VkBuffer> object);
     50 
     51 	void						bindMemory		(de::MovePtr<vk::Allocation> allocation);
     52 
     53 	vk::VkBuffer				object			(void) const								{ return *m_object;		}
     54 	vk::Allocation				getBoundMemory	(void) const								{ return *m_allocation;	}
     55 
     56 private:
     57 
     58 	Buffer										(const Buffer& other);	// Not allowed!
     59 	Buffer&						operator=		(const Buffer& other);	// Not allowed!
     60 
     61 	de::MovePtr<vk::Allocation>		m_allocation;
     62 	vk::Unique<vk::VkBuffer>		m_object;
     63 
     64 	const vk::DeviceInterface&		m_vk;
     65 	vk::VkDevice					m_device;
     66 };
     67 
     68 } // Draw
     69 } // vkt
     70 
     71 #endif // _VKTDRAWBUFFEROBJECTUTIL_HPP
     72