1 #ifndef _VKTPIPELINEMAKEUTIL_HPP
2 #define _VKTPIPELINEMAKEUTIL_HPP
3 /*------------------------------------------------------------------------
4 * Vulkan Conformance Tests
5 * ------------------------
7 * Copyright (c) 2016 The Khronos Group Inc.
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
23 * \brief Object creation utilities
24 *//*--------------------------------------------------------------------*/
28 #include "vkMemUtil.hpp"
29 #include "deUniquePtr.hpp"
30 #include "tcuVector.hpp"
40 Buffer (const vk::DeviceInterface& vk,
41 const vk::VkDevice device,
42 vk::Allocator& allocator,
43 const vk::VkBufferCreateInfo& bufferCreateInfo,
44 const vk::MemoryRequirement memoryRequirement);
46 const vk::VkBuffer& get (void) const { return *m_buffer; }
47 const vk::VkBuffer& operator* (void) const { return get(); }
48 vk::Allocation& getAllocation (void) const { return *m_allocation; }
51 const vk::Unique<vk::VkBuffer> m_buffer;
52 const de::UniquePtr<vk::Allocation> m_allocation;
54 Buffer (const Buffer&); // "deleted"
55 Buffer& operator= (const Buffer&);
61 Image (const vk::DeviceInterface& vk,
62 const vk::VkDevice device,
63 vk::Allocator& allocator,
64 const vk::VkImageCreateInfo& imageCreateInfo,
65 const vk::MemoryRequirement memoryRequirement);
67 const vk::VkImage& get (void) const { return *m_image; }
68 const vk::VkImage& operator* (void) const { return get(); }
69 vk::Allocation& getAllocation (void) const { return *m_allocation; }
72 const vk::Unique<vk::VkImage> m_image;
73 const de::UniquePtr<vk::Allocation> m_allocation;
75 Image (const Image&); // "deleted"
76 Image& operator= (const Image&);
79 vk::VkBufferCreateInfo makeBufferCreateInfo (const vk::VkDeviceSize bufferSize, const vk::VkBufferUsageFlags usage);
80 vk::Move<vk::VkCommandBuffer> makeCommandBuffer (const vk::DeviceInterface& vk, const vk::VkDevice device, const vk::VkCommandPool commandPool);
81 vk::Move<vk::VkDescriptorSet> makeDescriptorSet (const vk::DeviceInterface& vk, const vk::VkDevice device, const vk::VkDescriptorPool descriptorPool, const vk::VkDescriptorSetLayout setLayout);
82 vk::Move<vk::VkPipelineLayout> makePipelineLayout (const vk::DeviceInterface& vk, const vk::VkDevice device);
83 vk::Move<vk::VkPipelineLayout> makePipelineLayout (const vk::DeviceInterface& vk, const vk::VkDevice device, const vk::VkDescriptorSetLayout descriptorSetLayout);
84 vk::Move<vk::VkPipeline> makeComputePipeline (const vk::DeviceInterface& vk, const vk::VkDevice device, const vk::VkPipelineLayout pipelineLayout, const vk::VkShaderModule shaderModule, const vk::VkSpecializationInfo* specInfo);
85 vk::Move<vk::VkFramebuffer> makeFramebuffer (const vk::DeviceInterface& vk, const vk::VkDevice device, const vk::VkRenderPass renderPass, const deUint32 attachmentCount, const vk::VkImageView* pAttachments, const deUint32 width, const deUint32 height, const deUint32 layers = 1u);
86 vk::Move<vk::VkImageView> makeImageView (const vk::DeviceInterface& vk, const vk::VkDevice vkDevice, const vk::VkImage image, const vk::VkImageViewType viewType, const vk::VkFormat format, const vk::VkImageSubresourceRange subresourceRange);
87 vk::VkBufferMemoryBarrier makeBufferMemoryBarrier (const vk::VkAccessFlags srcAccessMask, const vk::VkAccessFlags dstAccessMask, const vk::VkBuffer buffer, const vk::VkDeviceSize offset, const vk::VkDeviceSize bufferSizeBytes);
88 vk::VkImageMemoryBarrier makeImageMemoryBarrier (const vk::VkAccessFlags srcAccessMask, const vk::VkAccessFlags dstAccessMask, const vk::VkImageLayout oldLayout, const vk::VkImageLayout newLayout, const vk::VkImage image, const vk::VkImageSubresourceRange subresourceRange);
89 de::MovePtr<vk::Allocation> bindImage (const vk::DeviceInterface& vk, const vk::VkDevice device, vk::Allocator& allocator, const vk::VkImage image, const vk::MemoryRequirement requirement);
90 de::MovePtr<vk::Allocation> bindBuffer (const vk::DeviceInterface& vk, const vk::VkDevice device, vk::Allocator& allocator, const vk::VkBuffer buffer, const vk::MemoryRequirement requirement);
91 de::MovePtr<vk::Allocation> bindImageDedicated (const vk::InstanceInterface& vki, const vk::DeviceInterface& vkd, const vk::VkPhysicalDevice physDevice, const vk::VkDevice device, const vk::VkImage image, const vk::MemoryRequirement requirement);
92 de::MovePtr<vk::Allocation> bindBufferDedicated (const vk::InstanceInterface& vki, const vk::DeviceInterface& vkd, const vk::VkPhysicalDevice physDevice, const vk::VkDevice device, const vk::VkBuffer buffer, const vk::MemoryRequirement requirement);
93 void beginCommandBuffer (const vk::DeviceInterface& vk, const vk::VkCommandBuffer commandBuffer);
94 void submitCommandsAndWait (const vk::DeviceInterface& vk, const vk::VkDevice device, const vk::VkQueue queue, const vk::VkCommandBuffer commandBuffer);
99 #endif // _VKTPIPELINEMAKEUTIL_HPP