1#ifndef _VKTPIPELINEVERTEXUTIL_HPP
2#define _VKTPIPELINEVERTEXUTIL_HPP
3/*------------------------------------------------------------------------
4 * Vulkan Conformance Tests
5 * ------------------------
6 *
7 * Copyright (c) 2015 The Khronos Group Inc.
8 * Copyright (c) 2015 Imagination Technologies Ltd.
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 Utilities for vertex buffers.
25 *//*--------------------------------------------------------------------*/
26
27#include "vkDefs.hpp"
28#include "tcuDefs.hpp"
29#include "tcuVectorUtil.hpp"
30
31#include <vector>
32
33namespace vkt
34{
35namespace pipeline
36{
37
38struct Vertex4RGBA
39{
40	tcu::Vec4 position;
41	tcu::Vec4 color;
42};
43
44struct Vertex4RGBARGBA
45{
46	tcu::Vec4 position;
47	tcu::Vec4 color0;
48	tcu::Vec4 color1;
49};
50
51struct Vertex4Tex4
52{
53	tcu::Vec4 position;
54	tcu::Vec4 texCoord;
55};
56
57deUint32					getVertexFormatSize					(vk::VkFormat format);
58deUint32					getVertexFormatComponentCount		(vk::VkFormat format);
59deUint32					getVertexFormatComponentSize		(vk::VkFormat format);
60deUint32					getPackedVertexFormatComponentWidth	(vk::VkFormat format, deUint32 componentNdx);
61bool						isVertexFormatComponentOrderBGR		(vk::VkFormat format);
62bool						isVertexFormatComponentOrderABGR	(vk::VkFormat format);
63bool						isVertexFormatComponentOrderARGB	(vk::VkFormat format);
64bool						isVertexFormatSint					(vk::VkFormat format);
65bool						isVertexFormatUint					(vk::VkFormat format);
66bool						isVertexFormatSfloat				(vk::VkFormat format);
67bool						isVertexFormatUfloat				(vk::VkFormat format);
68bool						isVertexFormatUnorm					(vk::VkFormat format);
69bool						isVertexFormatSnorm					(vk::VkFormat format);
70bool						isVertexFormatSRGB					(vk::VkFormat format);
71bool						isVertexFormatSscaled				(vk::VkFormat format);
72bool						isVertexFormatUscaled				(vk::VkFormat format);
73bool						isVertexFormatDouble				(vk::VkFormat format);
74bool						isVertexFormatPacked				(vk::VkFormat format);
75
76/*! \brief Creates a pattern of 4 overlapping quads.
77 *
78 *  The quads are alined along the plane Z = 0, with X,Y taking values between -1 and 1.
79 *  Each quad covers one of the quadrants of the scene and partially extends to the other 3 quadrants.
80 *  The triangles of each quad have different winding orders (CW/CCW).
81 */
82std::vector<Vertex4RGBA>		createOverlappingQuads				(void);
83std::vector<Vertex4RGBARGBA>	createOverlappingQuadsDualSource	(void);
84
85std::vector<Vertex4Tex4>	createFullscreenQuad		(void);
86std::vector<Vertex4Tex4>	createQuadMosaic			(int rows, int columns);
87std::vector<Vertex4Tex4>	createQuadMosaicCube		(void);
88std::vector<Vertex4Tex4>	createQuadMosaicCubeArray	(int faceArrayIndices[6]);
89
90std::vector<Vertex4Tex4>	createTestQuadMosaic		(vk::VkImageViewType viewType);
91
92} // pipeline
93} // vkt
94
95#endif // _VKTPIPELINEVERTEXUTIL_HPP
96