• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _VKBARRIERUTIL_HPP
2 #define _VKBARRIERUTIL_HPP
3 /*-------------------------------------------------------------------------
4  * Vulkan CTS Framework
5  * --------------------
6  *
7  * Copyright (c) 2018 The Khronos Group Inc.
8  * Copyright (c) 2018 Google Inc.
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 Utility for generating barriers
25  *//*--------------------------------------------------------------------*/
26 
27 #include "vkDefs.hpp"
28 
29 namespace vk
30 {
31 
32 VkBufferMemoryBarrier makeBufferMemoryBarrier (const VkAccessFlags	srcAccessMask,
33 											   const VkAccessFlags	dstAccessMask,
34 											   const VkBuffer		buffer,
35 											   const VkDeviceSize	offset,
36 											   const VkDeviceSize	bufferSizeBytes,
37 											   const deUint32		srcQueueFamilyIndex		= VK_QUEUE_FAMILY_IGNORED,
38 											   const deUint32		dstQueueFamilyIndex		= VK_QUEUE_FAMILY_IGNORED);
39 
40 VkBufferMemoryBarrier2KHR makeBufferMemoryBarrier2(const VkPipelineStageFlags2KHR	srcStageMask,
41 												   const VkAccessFlags2KHR			srcAccessMask,
42 												   const VkPipelineStageFlags2KHR	dstStageMask,
43 												   const VkAccessFlags2KHR			dstAccessMask,
44 												   const VkBuffer					buffer,
45 												   const VkDeviceSize				offset,
46 												   const VkDeviceSize				size,
47 												   const deUint32					srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
48 												   const deUint32					dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED);
49 
50 VkImageMemoryBarrier makeImageMemoryBarrier (const VkAccessFlags			srcAccessMask,
51 											 const VkAccessFlags			dstAccessMask,
52 											 const VkImageLayout			oldLayout,
53 											 const VkImageLayout			newLayout,
54 											 const VkImage					image,
55 											 const VkImageSubresourceRange	subresourceRange,
56 											 const deUint32					srcQueueFamilyIndex		= VK_QUEUE_FAMILY_IGNORED,
57 											 const deUint32					dstQueueFamilyIndex		= VK_QUEUE_FAMILY_IGNORED);
58 
59 VkImageMemoryBarrier2KHR makeImageMemoryBarrier2 (const VkPipelineStageFlags2KHR	srcStageMask,
60 												  const VkAccessFlags2KHR			srcAccessMask,
61 												  const VkPipelineStageFlags2KHR	dstStageMask,
62 												  const VkAccessFlags2KHR			dstAccessMask,
63 												  const VkImageLayout				oldLayout,
64 												  const VkImageLayout				newLayout,
65 												  const VkImage						image,
66 												  const VkImageSubresourceRange		subresourceRange,
67 												  const deUint32					srcQueueFamilyIndex		= VK_QUEUE_FAMILY_IGNORED,
68 												  const deUint32					dstQueueFamilyIndex		= VK_QUEUE_FAMILY_IGNORED);
69 
70 VkMemoryBarrier makeMemoryBarrier (const VkAccessFlags	srcAccessMask,
71 								   const VkAccessFlags	dstAccessMask);
72 
73 VkMemoryBarrier2KHR makeMemoryBarrier2(const VkPipelineStageFlags2KHR	srcStageMask,
74 									   const VkAccessFlags2KHR			srcAccessMask,
75 									   const VkPipelineStageFlags2KHR	dstStageMask,
76 									   const VkAccessFlags2KHR			dstAccessMask);
77 
78 void cmdPipelineMemoryBarrier		(const DeviceInterface&			vk,
79 									 const VkCommandBuffer			commandBuffer,
80 									 const VkPipelineStageFlags		srcStageMask,
81 									 const VkPipelineStageFlags		dstStageMask,
82 									 const VkMemoryBarrier*			pMemoryBarriers,
83 									 const size_t					memoryBarrierCount = 1u,
84 									 const VkDependencyFlags		dependencyFlags = 0);
85 
86 void cmdPipelineBufferMemoryBarrier	(const DeviceInterface&			vk,
87 									 const VkCommandBuffer			commandBuffer,
88 									 const VkPipelineStageFlags		srcStageMask,
89 									 const VkPipelineStageFlags		dstStageMask,
90 									 const VkBufferMemoryBarrier*	pBufferMemoryBarriers,
91 									 const size_t					bufferMemoryBarrierCount = 1u,
92 									 const VkDependencyFlags		dependencyFlags = 0);
93 
94 void cmdPipelineImageMemoryBarrier	(const DeviceInterface&			vk,
95 									 const VkCommandBuffer			commandBuffer,
96 									 const VkPipelineStageFlags		srcStageMask,
97 									 const VkPipelineStageFlags		dstStageMask,
98 									 const VkImageMemoryBarrier*	pImageMemoryBarriers,
99 									 const size_t					imageMemoryBarrierCount = 1u,
100 									 const VkDependencyFlags		dependencyFlags = 0);
101 
102 } // vk
103 
104 #endif // _VKBARRIERUTIL_HPP
105