• 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 "vktDrawBufferObjectUtil.hpp"
29 #include "vktTestCase.hpp"
30 #include "deSharedPtr.hpp"
31 
32 namespace vkt
33 {
34 namespace conditional
35 {
36 
37 struct ConditionalData
38 {
39 	bool		conditionEnabled;
40 	deUint32	conditionValue;
41 	bool		conditionInverted;
42 	bool		useSecondaryBuffer;
43 
44 	bool		expectCommandExecution;
45 };
46 
47 static const ConditionalData s_testsData[] =
48 {
49 //  Enabled	Val Inverted Secondary Result
50 	{ true,	1,	false,	false,		true },
51 	{ true,	0,	false,	false,		false },
52 	{ true,	0,	true,	false,		true},
53 	{ true,	1,	true,	false,		false },
54 	{ true,	1,	false,	true,		true },
55 	{ true,	0,	false,	true,		false },
56 	{ true,	0,	true,	true,		true },
57 	{ true,	1,	true,	true,		false },
58 
59 	/* Test that commands are executed correctly when secondary command buffer is constructed
60 	 * with conditional rendering enabled but conditional rendering is not enabled when
61 	 * executing it in the primary command buffer.
62 	 */
63 	{ false,1,	false,	true,		true },
64 };
65 
66 std::ostream&				operator<< (std::ostream& str, ConditionalData const& c);
67 
68 void						checkConditionalRenderingCapabilities	(vkt::Context& context, const ConditionalData& data);
69 de::SharedPtr<Draw::Buffer>	createConditionalRenderingBuffer		(vkt::Context& context, const ConditionalData& data);
70 void						beginConditionalRendering				(const vk::DeviceInterface& vk,
71 																	 vk::VkCommandBuffer cmdBuffer,
72 																	 Draw::Buffer& buffer,
73 																	 const ConditionalData& data);
74 
75 } // conditional
76 } // vkt
77 
78 #endif // _VKTCONDITIONALRENDERINGTESTUTIL_HPP