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"
30 #include "tcuTestLog.hpp"
31 #include "tcuResource.hpp"
32 #include "tcuImageCompare.hpp"
33 #include "tcuCommandLine.hpp"
35 #include "vkRefUtil.hpp"
36 #include "vkImageUtil.hpp"
38 #include "deSharedPtr.hpp"
40 #include "vkPrograms.hpp"
42 #include "vktDrawCreateInfoUtil.hpp"
43 #include "vktDrawImageObjectUtil.hpp"
44 #include "vktDrawBufferObjectUtil.hpp"
51 struct PositionColorVertex
53 PositionColorVertex (tcu::Vec4 position_, tcu::Vec4 color_)
54 : position (position_)
62 struct VertexElementData : public PositionColorVertex
64 VertexElementData (tcu::Vec4 position_, tcu::Vec4 color_, deUint32 refVertexIndex_)
65 : PositionColorVertex (position_, color_)
66 , refVertexIndex (refVertexIndex_)
70 deUint32 refVertexIndex;
73 struct ReferenceImageCoordinates
75 ReferenceImageCoordinates (void)
89 struct ReferenceImageInstancedCoordinates
91 ReferenceImageInstancedCoordinates (void)
105 class DrawTestsBaseClass : public TestInstance
108 DrawTestsBaseClass (Context& context, const char* vertexShaderName, const char* fragmentShaderName, vk::VkPrimitiveTopology topology = vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP);
111 void initialize (void);
112 virtual void initPipeline (const vk::VkDevice device);
113 void beginRenderPass (void);
114 virtual tcu::TestStatus iterate (void) { TCU_FAIL("Implement iterate() method!"); }
122 vk::VkFormat m_colorAttachmentFormat;
124 const vk::VkPrimitiveTopology m_topology;
126 const vk::DeviceInterface& m_vk;
128 vk::Move<vk::VkPipeline> m_pipeline;
129 vk::Move<vk::VkPipelineLayout> m_pipelineLayout;
131 de::SharedPtr<Image> m_colorTargetImage;
132 vk::Move<vk::VkImageView> m_colorTargetView;
134 // vertex buffer for vertex colors & position
135 de::SharedPtr<Buffer> m_vertexBuffer;
137 // vertex buffer with reference data used in VS
138 de::SharedPtr<Buffer> m_vertexRefDataBuffer;
140 PipelineCreateInfo::VertexInputState m_vertexInputState;
142 vk::Move<vk::VkCommandPool> m_cmdPool;
143 vk::Move<vk::VkCommandBuffer> m_cmdBuffer;
145 vk::Move<vk::VkFramebuffer> m_framebuffer;
146 vk::Move<vk::VkRenderPass> m_renderPass;
148 const std::string m_vertexShaderName;
149 const std::string m_fragmentShaderName;
151 std::vector<VertexElementData> m_data;
157 #endif // _VKTDRAWBASECLASS_HPP