• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _VKTCONDITIONALRENDERINGTESTUTIL_HPP
2 #define _VKTCONDITIONALRENDERINGTESTUTIL_HPP
3 /*------------------------------------------------------------------------
4  * Vulkan Conformance Tests
5  * ------------------------
6  *
7  * Copyright (c) 2018 The Khronos Group Inc.
8  * Copyright (c) 2018 Danylo Piliaiev <danylo.piliaiev@gmail.com>
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 Conditional Rendering Test Utils
25  *//*--------------------------------------------------------------------*/
26 
27 #include "vkDefs.hpp"
28 #include "vkObjUtil.hpp"
29 #include "vktDrawBufferObjectUtil.hpp"
30 #include "vktTestCase.hpp"
31 #include "deSharedPtr.hpp"
32 
33 namespace vkt
34 {
35 namespace conditional
36 {
37 
38 struct ConditionalData
39 {
40 	bool		conditionInPrimaryCommandBuffer;
41 	bool		conditionInSecondaryCommandBuffer;
42 	bool		conditionInverted;
43 	bool		conditionInherited;
44 	deUint32	conditionValue;
45 	bool		padConditionValue;
46 
47 	bool		expectCommandExecution;
48 };
49 
50 static const ConditionalData s_testsData[] =
51 {
52 	//	CONDPRI	CONDSEC	INV		INH		V	PAD		RES
53 	{	true,	false,	false,	false,	1,	false,	true	},
54 	{	true,	false,	false,	false,	0,	false,	false	},
55 	{	true,	false,	true,	false,	0,	false,	true	},
56 	{	true,	false,	true,	false,	1,	false,	false	},
57 	{	true,	false,	false,	true,	1,	false,	true	},
58 	{	true,	false,	false,	true,	0,	false,	false	},
59 	{	true,	false,	true,	true,	0,	false,	true	},
60 	{	true,	false,	true,	true,	1,	false,	false	},
61 
62 	{	false,	true,	false,	false,	1,	false,	true	},
63 	{	false,	true,	false,	false,	0,	false,	false	},
64 	{	false,	true,	true,	false,	0,	false,	true	},
65 	{	false,	true,	true,	false,	1,	false,	false	},
66 
67 	// Test that inheritance does not affect outcome of secondary command buffer with conditional rendering or not.
68 	{	false,	false,	false,	true,	0,	false,	true	},
69 
70 	{	false,	true,	false,	true,	1,	false,	true	},
71 	{	false,	true,	false,	true,	0,	false,	false	},
72 	{	false,	true,	true,	true,	1,	false,	false	},
73 	{	false,	true,	true,	true,	0,	false,	true	},
74 };
75 
76 std::ostream&				operator<< (std::ostream& str, ConditionalData const& c);
77 
78 void						checkConditionalRenderingCapabilities	(vkt::Context& context, const ConditionalData& data);
79 de::SharedPtr<Draw::Buffer>	createConditionalRenderingBuffer		(vkt::Context& context, const ConditionalData& data);
80 void						beginConditionalRendering				(const vk::DeviceInterface& vk,
81 																	 vk::VkCommandBuffer cmdBuffer,
82 																	 Draw::Buffer& buffer,
83 																	 const ConditionalData& data);
84 
85 } // conditional
86 } // vkt
87 
88 #endif // _VKTCONDITIONALRENDERINGTESTUTIL_HPP
89