xref: /aosp_15_r20/external/deqp/external/vulkancts/modules/vulkan/pipeline/vktPipelineMakeUtil.cpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
1 /*------------------------------------------------------------------------
2  * Vulkan Conformance Tests
3  * ------------------------
4  *
5  * Copyright (c) 2016 The Khronos Group Inc.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  *//*!
20  * \file
21  * \brief Object creation utilities
22  *//*--------------------------------------------------------------------*/
23 
24 #include "vktPipelineMakeUtil.hpp"
25 #include "vkTypeUtil.hpp"
26 #include "vkPrograms.hpp"
27 #include "vkRefUtil.hpp"
28 #include "vkQueryUtil.hpp"
29 #include <vector>
30 
31 namespace vkt
32 {
33 namespace pipeline
34 {
35 using namespace vk;
36 using de::MovePtr;
37 
makeCommandBuffer(const DeviceInterface & vk,const VkDevice device,const VkCommandPool commandPool)38 Move<VkCommandBuffer> makeCommandBuffer(const DeviceInterface &vk, const VkDevice device,
39                                         const VkCommandPool commandPool)
40 {
41     return allocateCommandBuffer(vk, device, commandPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY);
42 }
43 
bindImageDedicated(const InstanceInterface & vki,const DeviceInterface & vkd,const VkPhysicalDevice physDevice,const VkDevice device,const VkImage image,const MemoryRequirement requirement)44 MovePtr<Allocation> bindImageDedicated(const InstanceInterface &vki, const DeviceInterface &vkd,
45                                        const VkPhysicalDevice physDevice, const VkDevice device, const VkImage image,
46                                        const MemoryRequirement requirement)
47 {
48     MovePtr<Allocation> alloc(allocateDedicated(vki, vkd, physDevice, device, image, requirement));
49     VK_CHECK(vkd.bindImageMemory(device, image, alloc->getMemory(), alloc->getOffset()));
50     return alloc;
51 }
52 
bindBufferDedicated(const InstanceInterface & vki,const DeviceInterface & vkd,const VkPhysicalDevice physDevice,const VkDevice device,const VkBuffer buffer,const MemoryRequirement requirement)53 MovePtr<Allocation> bindBufferDedicated(const InstanceInterface &vki, const DeviceInterface &vkd,
54                                         const VkPhysicalDevice physDevice, const VkDevice device, const VkBuffer buffer,
55                                         const MemoryRequirement requirement)
56 {
57     MovePtr<Allocation> alloc(allocateDedicated(vki, vkd, physDevice, device, buffer, requirement));
58     VK_CHECK(vkd.bindBufferMemory(device, buffer, alloc->getMemory(), alloc->getOffset()));
59     return alloc;
60 }
61 
62 } // namespace pipeline
63 } // namespace vkt
64