1 #ifndef _VKTDRAWBASECLASS_HPP
2 #define _VKTDRAWBASECLASS_HPP
3 /*------------------------------------------------------------------------
4 * Vulkan Conformance Tests
5 * ------------------------
7 * Copyright (c) 2015 The Khronos Group Inc.
8 * Copyright (c) 2015 Intel Corporation
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
14 * http://www.apache.org/licenses/LICENSE-2.0
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.
24 * \brief Command draw Tests - Base Class
25 *//*--------------------------------------------------------------------*/
28 #include "vktTestCase.hpp"
29 #include "vktDrawGroupParams.hpp"
31 #include "tcuTestLog.hpp"
32 #include "tcuResource.hpp"
33 #include "tcuImageCompare.hpp"
34 #include "tcuCommandLine.hpp"
36 #include "vkRefUtil.hpp"
37 #include "vkImageUtil.hpp"
39 #include "deSharedPtr.hpp"
41 #include "vkPrograms.hpp"
43 #include "vktDrawCreateInfoUtil.hpp"
44 #include "vktDrawImageObjectUtil.hpp"
45 #include "vktDrawBufferObjectUtil.hpp"
52 struct PositionColorVertex
54 PositionColorVertex (tcu::Vec4 position_, tcu::Vec4 color_)
55 : position (position_)
63 struct VertexElementData : public PositionColorVertex
65 VertexElementData (tcu::Vec4 position_, tcu::Vec4 color_, deUint32 refVertexIndex_)
66 : PositionColorVertex (position_, color_)
67 , refVertexIndex (refVertexIndex_)
71 deUint32 refVertexIndex;
74 struct ReferenceImageCoordinates
76 ReferenceImageCoordinates (void)
90 struct ReferenceImageInstancedCoordinates
92 ReferenceImageInstancedCoordinates (void)
106 class DrawTestsBaseClass : public TestInstance
109 DrawTestsBaseClass (Context& context, const char* vertexShaderName, const char* fragmentShaderName, const SharedGroupParams groupParams, vk::VkPrimitiveTopology topology = vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP);
112 void initialize (void);
113 virtual void initPipeline (const vk::VkDevice device);
114 void preRenderBarriers (void);
115 void beginLegacyRender (vk::VkCommandBuffer cmdBuffer, const vk::VkSubpassContents content = vk::VK_SUBPASS_CONTENTS_INLINE);
116 void endLegacyRender (vk::VkCommandBuffer cmdBuffer);
117 virtual tcu::TestStatus iterate (void) { TCU_FAIL("Implement iterate() method!"); }
119 #ifndef CTS_USES_VULKANSC
120 void beginSecondaryCmdBuffer (const vk::DeviceInterface& vk, const vk::VkRenderingFlagsKHR renderingFlags = 0u);
121 void beginDynamicRender (vk::VkCommandBuffer cmdBuffer, const vk::VkRenderingFlagsKHR renderingFlags = 0u);
122 void endDynamicRender (vk::VkCommandBuffer cmdBuffer);
123 #endif // CTS_USES_VULKANSC
131 vk::VkFormat m_colorAttachmentFormat;
133 const SharedGroupParams m_groupParams;
134 const vk::VkPrimitiveTopology m_topology;
136 const vk::DeviceInterface& m_vk;
138 vk::Move<vk::VkPipeline> m_pipeline;
139 vk::Move<vk::VkPipelineLayout> m_pipelineLayout;
141 de::SharedPtr<Image> m_colorTargetImage;
142 vk::Move<vk::VkImageView> m_colorTargetView;
144 // vertex buffer for vertex colors & position
145 de::SharedPtr<Buffer> m_vertexBuffer;
147 // vertex buffer with reference data used in VS
148 de::SharedPtr<Buffer> m_vertexRefDataBuffer;
150 PipelineCreateInfo::VertexInputState m_vertexInputState;
152 vk::Move<vk::VkCommandPool> m_cmdPool;
153 vk::Move<vk::VkCommandBuffer> m_cmdBuffer;
154 vk::Move<vk::VkCommandBuffer> m_secCmdBuffer;
156 vk::Move<vk::VkFramebuffer> m_framebuffer;
157 vk::Move<vk::VkRenderPass> m_renderPass;
159 const std::string m_vertexShaderName;
160 const std::string m_fragmentShaderName;
162 std::vector<VertexElementData> m_data;
168 #endif // _VKTDRAWBASECLASS_HPP