1 /*------------------------------------------------------------------------
2  * Vulkan Conformance Tests
3  * ------------------------
4  *
5  * Copyright (c) 2016 The Khronos Group Inc.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  *//*!
20  * \file
21  * \brief VK_KHR_shader_draw_parameters tests
22  *//*--------------------------------------------------------------------*/
23 
24 #include "vktDrawShaderDrawParametersTests.hpp"
25 
26 #include "vktTestCaseUtil.hpp"
27 #include "vktDrawTestCaseUtil.hpp"
28 #include "vktDrawBaseClass.hpp"
29 
30 #include "vkQueryUtil.hpp"
31 #include "vkCmdUtil.hpp"
32 
33 #include "tcuTestLog.hpp"
34 #include "tcuImageCompare.hpp"
35 #include "tcuTextureUtil.hpp"
36 
37 namespace vkt
38 {
39 namespace Draw
40 {
41 namespace
42 {
43 
44 enum TestFlagBits
45 {
46 	TEST_FLAG_INSTANCED			= 1u << 0,
47 	TEST_FLAG_INDEXED			= 1u << 1,
48 	TEST_FLAG_INDIRECT			= 1u << 2,
49 	TEST_FLAG_MULTIDRAW			= 1u << 3,	//!< multiDrawIndirect
50 	TEST_FLAG_FIRST_INSTANCE	= 1u << 4,	//!< drawIndirectFirstInstance
51 };
52 typedef deUint32 TestFlags;
53 
54 struct FlagsTestSpec : public TestSpecBase
55 {
56 	TestFlags	flags;
57 };
58 
addFlags(FlagsTestSpec spec,const TestFlags flags)59 inline FlagsTestSpec addFlags (FlagsTestSpec spec, const TestFlags flags)
60 {
61 	spec.flags |= flags;
62 	return spec;
63 }
64 
65 enum Constants
66 {
67 	// \note Data layout in buffers (junk data and good data is intertwined).
68 	//       Values are largely arbitrary, but we try to avoid "nice" numbers to make sure the test doesn't pass by accident.
69 	NUM_VERTICES			= 4,	//!< number of consecutive good vertices
70 	NDX_FIRST_VERTEX		= 2,	//!< index of first good vertex data
71 	NDX_SECOND_VERTEX		= 9,	//!< index of second good vertex data
72 	NDX_FIRST_INDEX			= 11,	//!< index of a first good index (in index data)
73 	NDX_SECOND_INDEX		= 17,	//!< index of a second good index
74 	OFFSET_FIRST_INDEX		= 1,	//!< offset added to the first index
75 	OFFSET_SECOND_INDEX		= 4,	//!< offset added to the second index
76 	MAX_INSTANCE_COUNT		= 3,	//!< max number of draw instances
77 	MAX_INDIRECT_DRAW_COUNT	= 3,	//!< max drawCount of indirect calls
78 };
79 
80 class DrawTest : public DrawTestsBaseClass
81 {
82 public:
83 	typedef FlagsTestSpec	TestSpec;
84 							DrawTest				(Context &context, TestSpec testSpec);
85 	tcu::TestStatus			iterate					(void);
86 
87 private:
88 	template<typename T, std::size_t N>
89 	void					setIndirectCommand		(const T (&pCmdData)[N]);
90 
91 	void					drawReferenceImage		(const tcu::PixelBufferAccess& refImage) const;
92 
isInstanced(void) const93 	bool					isInstanced				(void) const { return (m_flags & TEST_FLAG_INSTANCED)		!= 0; }
isIndexed(void) const94 	bool					isIndexed				(void) const { return (m_flags & TEST_FLAG_INDEXED)			!= 0; }
isIndirect(void) const95 	bool					isIndirect				(void) const { return (m_flags & TEST_FLAG_INDIRECT)		!= 0; }
isMultiDraw(void) const96 	bool					isMultiDraw				(void) const { return (m_flags & TEST_FLAG_MULTIDRAW)		!= 0; }
isFirstInstance(void) const97 	bool					isFirstInstance			(void) const { return (m_flags & TEST_FLAG_FIRST_INSTANCE)	!= 0; }
98 
99 	const TestFlags			m_flags;
100 	de::SharedPtr<Buffer>	m_indexBuffer;
101 	de::SharedPtr<Buffer>	m_indirectBuffer;
102 };
103 
DrawTest(Context & context,TestSpec testSpec)104 DrawTest::DrawTest (Context &context, TestSpec testSpec)
105 	: DrawTestsBaseClass(context, testSpec.shaders[glu::SHADERTYPE_VERTEX], testSpec.shaders[glu::SHADERTYPE_FRAGMENT], testSpec.topology)
106 	, m_flags			(testSpec.flags)
107 {
108 	DE_ASSERT(m_topology == vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP);
109 	DE_ASSERT(!isMultiDraw()     || isIndirect());
110 	DE_ASSERT(!isFirstInstance() || (isIndirect() && isInstanced()));
111 
112 	// Requirements
113 	{
114 		if (!vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_KHR_shader_draw_parameters"))
115 			TCU_THROW(NotSupportedError, "Missing extension: VK_KHR_shader_draw_parameters");
116 
117 		// Shader draw parameters is part of Vulkan 1.1 but is optional
118 		if ( context.contextSupports(vk::ApiVersion(1, 1, 0)) )
119 		{
120 			// Check if shader draw parameters is supported on the physical device.
121 			vk::VkPhysicalDeviceShaderDrawParameterFeatures	drawParameters =
122 			{
123 				vk::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES,	// sType
124 				DE_NULL,																// pNext
125 				VK_FALSE																// shaderDrawParameters
126 			};
127 			vk::VkPhysicalDeviceFeatures					features;
128 			deMemset(&features, 0, sizeof(vk::VkPhysicalDeviceFeatures));
129 
130 			vk::VkPhysicalDeviceFeatures2					featuresExt		=
131 			{
132 				vk::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2,					// sType
133 				&drawParameters,													// pNext
134 				features
135 			};
136 
137 			context.getInstanceInterface().getPhysicalDeviceFeatures2(context.getPhysicalDevice(), &featuresExt);
138 
139 			if (drawParameters.shaderDrawParameters == VK_FALSE)
140 				TCU_THROW(NotSupportedError, "shaderDrawParameters feature not supported by the device");
141 		}
142 
143 		if (isMultiDraw() && !m_context.getDeviceFeatures().multiDrawIndirect)
144 			TCU_THROW(NotSupportedError, "Missing feature: multiDrawIndirect");
145 
146 		if (isFirstInstance() && !m_context.getDeviceFeatures().drawIndirectFirstInstance)
147 			TCU_THROW(NotSupportedError, "Missing feature: drawIndirectFirstInstance");
148 	}
149 
150 	// Vertex data
151 	{
152 		int refIndex = NDX_FIRST_VERTEX - OFFSET_FIRST_INDEX;
153 
154 		m_data.push_back(VertexElementData(tcu::Vec4( 1.0f, -1.0f, 1.0f, 1.0f), tcu::Vec4(1.0f), -1));
155 		m_data.push_back(VertexElementData(tcu::Vec4(-1.0f,  1.0f, 1.0f, 1.0f), tcu::Vec4(1.0f), -1));
156 
157 		if (!isIndexed())
158 			refIndex = 0;
159 
160 		m_data.push_back(VertexElementData(tcu::Vec4(-0.3f,	-0.3f, 1.0f, 1.0f), tcu::Vec4(1.0f), refIndex++));
161 		m_data.push_back(VertexElementData(tcu::Vec4(-0.3f,	 0.3f, 1.0f, 1.0f), tcu::Vec4(1.0f), refIndex++));
162 		m_data.push_back(VertexElementData(tcu::Vec4( 0.3f,	-0.3f, 1.0f, 1.0f), tcu::Vec4(1.0f), refIndex++));
163 		m_data.push_back(VertexElementData(tcu::Vec4( 0.3f,	 0.3f, 1.0f, 1.0f), tcu::Vec4(1.0f), refIndex++));
164 
165 		m_data.push_back(VertexElementData(tcu::Vec4(-1.0f,  1.0f, 1.0f, 1.0f), tcu::Vec4(1.0f), -1));
166 		m_data.push_back(VertexElementData(tcu::Vec4( 1.0f, -1.0f, 1.0f, 1.0f), tcu::Vec4(1.0f), -1));
167 		m_data.push_back(VertexElementData(tcu::Vec4(-1.0f, -1.0f, 1.0f, 1.0f), tcu::Vec4(1.0f), -1));
168 
169 		if (!isIndexed())
170 			refIndex = 0;
171 
172 		m_data.push_back(VertexElementData(tcu::Vec4(-0.3f,	-0.3f, 1.0f, 1.0f), tcu::Vec4(1.0f), refIndex++));
173 		m_data.push_back(VertexElementData(tcu::Vec4(-0.3f,	 0.3f, 1.0f, 1.0f), tcu::Vec4(1.0f), refIndex++));
174 		m_data.push_back(VertexElementData(tcu::Vec4( 0.3f,	-0.3f, 1.0f, 1.0f), tcu::Vec4(1.0f), refIndex++));
175 		m_data.push_back(VertexElementData(tcu::Vec4( 0.3f,	 0.3f, 1.0f, 1.0f), tcu::Vec4(1.0f), refIndex++));
176 
177 		m_data.push_back(VertexElementData(tcu::Vec4(-1.0f,  1.0f, 1.0f, 1.0f), tcu::Vec4(1.0f), -1));
178 		m_data.push_back(VertexElementData(tcu::Vec4( 1.0f, -1.0f, 1.0f, 1.0f), tcu::Vec4(1.0f), -1));
179 
180 		// Make sure constants are up to date
181 		DE_ASSERT(m_data.size() == NDX_SECOND_VERTEX + NUM_VERTICES + 2);
182 		DE_ASSERT(NDX_SECOND_VERTEX - NDX_FIRST_VERTEX - NUM_VERTICES == 3);
183 	}
184 
185 	if (isIndirect())
186 	{
187 		const std::size_t	indirectBufferSize	= MAX_INDIRECT_DRAW_COUNT * 32;	// space for COUNT commands plus some gratuitous padding
188 							m_indirectBuffer	= Buffer::createAndAlloc(m_vk, m_context.getDevice(), BufferCreateInfo(indirectBufferSize, vk::VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT),
189 												  m_context.getDefaultAllocator(), vk::MemoryRequirement::HostVisible);
190 
191 		deMemset(m_indirectBuffer->getBoundMemory().getHostPtr(), 0, indirectBufferSize);
192 		vk::flushMappedMemoryRange(m_vk, m_context.getDevice(), m_indirectBuffer->getBoundMemory().getMemory(), m_indirectBuffer->getBoundMemory().getOffset(), VK_WHOLE_SIZE);
193 	}
194 
195 	if (isIndexed())
196 	{
197 		DE_ASSERT(NDX_FIRST_INDEX + NUM_VERTICES <= NDX_SECOND_INDEX);
198 		const std::size_t	indexBufferSize	= sizeof(deUint32) * (NDX_SECOND_INDEX + NUM_VERTICES);
199 							m_indexBuffer	= Buffer::createAndAlloc(m_vk, m_context.getDevice(), BufferCreateInfo(indexBufferSize, vk::VK_BUFFER_USAGE_INDEX_BUFFER_BIT),
200 																	 m_context.getDefaultAllocator(), vk::MemoryRequirement::HostVisible);
201 		deUint32*			indices			= static_cast<deUint32*>(m_indexBuffer->getBoundMemory().getHostPtr());
202 
203 		deMemset(indices, 0, indexBufferSize);
204 
205 		for (int i = 0; i < NUM_VERTICES; i++)
206 		{
207 			indices[NDX_FIRST_INDEX  + i] = static_cast<deUint32>(NDX_FIRST_VERTEX  + i) - OFFSET_FIRST_INDEX;
208 			indices[NDX_SECOND_INDEX + i] = static_cast<deUint32>(NDX_SECOND_VERTEX + i) - OFFSET_SECOND_INDEX;
209 		}
210 
211 		vk::flushMappedMemoryRange(m_vk, m_context.getDevice(), m_indexBuffer->getBoundMemory().getMemory(), m_indexBuffer->getBoundMemory().getOffset(), VK_WHOLE_SIZE);
212 	}
213 
214 	initialize();
215 }
216 
217 template<typename T, std::size_t N>
setIndirectCommand(const T (& pCmdData)[N])218 void DrawTest::setIndirectCommand (const T (&pCmdData)[N])
219 {
220 	DE_ASSERT(N != 0 && N <= MAX_INDIRECT_DRAW_COUNT);
221 
222 	const std::size_t dataSize = N * sizeof(T);
223 
224 	deMemcpy(m_indirectBuffer->getBoundMemory().getHostPtr(), pCmdData, dataSize);
225 	vk::flushMappedMemoryRange(m_vk, m_context.getDevice(), m_indirectBuffer->getBoundMemory().getMemory(), m_indirectBuffer->getBoundMemory().getOffset(), VK_WHOLE_SIZE);
226 }
227 
228 //! This function must be kept in sync with the shader.
drawReferenceImage(const tcu::PixelBufferAccess & refImage) const229 void DrawTest::drawReferenceImage (const tcu::PixelBufferAccess& refImage) const
230 {
231 	using tcu::Vec2;
232 	using tcu::Vec4;
233 	using tcu::IVec4;
234 
235 	const Vec2	perInstanceOffset[]	= { Vec2(0.0f, 0.0f), Vec2(-0.3f,  0.0f), Vec2(0.0f, 0.3f) };
236 	const Vec2	perDrawOffset[]		= { Vec2(0.0f, 0.0f), Vec2(-0.3f, -0.3f), Vec2(0.3f, 0.3f) };
237 	const Vec4	allColors[]			= { Vec4(1.0f), Vec4(0.0f, 0.0f, 1.0f, 1.0f), Vec4(0.0f, 1.0f, 0.0f, 1.0f) };
238 	const int	numInstances		= isInstanced() ? MAX_INSTANCE_COUNT		: 1;
239 	const int	numIndirectDraws	= isMultiDraw() ? MAX_INDIRECT_DRAW_COUNT	: 1;
240 	const int	rectWidth			= static_cast<int>(WIDTH  * 0.6f / 2.0f);
241 	const int	rectHeight			= static_cast<int>(HEIGHT * 0.6f / 2.0f);
242 
243 	DE_ASSERT(DE_LENGTH_OF_ARRAY(perInstanceOffset) >= numInstances);
244 	DE_ASSERT(DE_LENGTH_OF_ARRAY(allColors) >= numInstances && DE_LENGTH_OF_ARRAY(allColors) >= numIndirectDraws);
245 	DE_ASSERT(DE_LENGTH_OF_ARRAY(perDrawOffset) >= numIndirectDraws);
246 
247 	tcu::clear(refImage, tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f));
248 
249 	for (int drawNdx     = 0; drawNdx     < numIndirectDraws; ++drawNdx)
250 	for (int instanceNdx = 0; instanceNdx < numInstances;     ++instanceNdx)
251 	{
252 		const Vec2	offset	= perInstanceOffset[instanceNdx] + perDrawOffset[drawNdx];
253 		const Vec4&	color	= allColors[isMultiDraw() ? drawNdx : instanceNdx];
254 		int			x		= static_cast<int>(WIDTH  * (1.0f - 0.3f + offset.x()) / 2.0f);
255 		int			y		= static_cast<int>(HEIGHT * (1.0f - 0.3f + offset.y()) / 2.0f);
256 
257 		tcu::clear(tcu::getSubregion(refImage, x, y, rectWidth, rectHeight), color);
258 	}
259 }
260 
iterate(void)261 tcu::TestStatus DrawTest::iterate (void)
262 {
263 	// Draw
264 	{
265 		beginRenderPass();
266 
267 		const vk::VkDeviceSize	vertexBufferOffset	= 0;
268 		const vk::VkBuffer		vertexBuffer		= m_vertexBuffer->object();
269 
270 		m_vk.cmdBindVertexBuffers	(*m_cmdBuffer, 0, 1, &vertexBuffer, &vertexBufferOffset);
271 		m_vk.cmdBindPipeline		(*m_cmdBuffer, vk::VK_PIPELINE_BIND_POINT_GRAPHICS, *m_pipeline);
272 
273 		if (isIndexed())
274 			m_vk.cmdBindIndexBuffer(*m_cmdBuffer, m_indexBuffer->object(), 0ull, vk::VK_INDEX_TYPE_UINT32);
275 
276 		const deUint32			numInstances		= isInstanced() ? MAX_INSTANCE_COUNT : 1;
277 
278 		if (isIndirect())
279 		{
280 			if (isIndexed())
281 			{
282 				const vk::VkDrawIndexedIndirectCommand commands[] =
283 				{
284 					// indexCount, instanceCount, firstIndex, vertexOffset, firstInstance
285 					{ NUM_VERTICES,	numInstances,	NDX_FIRST_INDEX,	OFFSET_FIRST_INDEX,		(isFirstInstance() ? 2u : 0u) },
286 					{ NUM_VERTICES,	numInstances,	NDX_SECOND_INDEX,	OFFSET_SECOND_INDEX,	(isFirstInstance() ? 1u : 0u) },
287 					{ NUM_VERTICES,	numInstances,	NDX_FIRST_INDEX,	OFFSET_FIRST_INDEX,		(isFirstInstance() ? 3u : 0u) },
288 				};
289 				setIndirectCommand(commands);
290 			}
291 			else
292 			{
293 				const vk::VkDrawIndirectCommand commands[] =
294 				{
295 					// vertexCount, instanceCount, firstVertex, firstInstance
296 					{ NUM_VERTICES,	numInstances,	NDX_FIRST_VERTEX,	(isFirstInstance() ? 2u : 0u) },
297 					{ NUM_VERTICES,	numInstances,	NDX_SECOND_VERTEX,	(isFirstInstance() ? 1u : 0u) },
298 					{ NUM_VERTICES,	numInstances,	NDX_FIRST_VERTEX,	(isFirstInstance() ? 3u : 0u) },
299 				};
300 				setIndirectCommand(commands);
301 			}
302 		}
303 
304 		if (isIndirect())
305 		{
306 			const deUint32 numIndirectDraws = isMultiDraw() ? MAX_INDIRECT_DRAW_COUNT : 1;
307 
308 			if (isIndexed())
309 				m_vk.cmdDrawIndexedIndirect(*m_cmdBuffer, m_indirectBuffer->object(), 0ull, numIndirectDraws, sizeof(vk::VkDrawIndexedIndirectCommand));
310 			else
311 				m_vk.cmdDrawIndirect(*m_cmdBuffer, m_indirectBuffer->object(), 0ull, numIndirectDraws, sizeof(vk::VkDrawIndirectCommand));
312 		}
313 		else
314 		{
315 			const deUint32 firstInstance = 2;
316 
317 			if (isIndexed())
318 				m_vk.cmdDrawIndexed(*m_cmdBuffer, NUM_VERTICES, numInstances, NDX_FIRST_INDEX, OFFSET_FIRST_INDEX, firstInstance);
319 			else
320 				m_vk.cmdDraw(*m_cmdBuffer, NUM_VERTICES, numInstances, NDX_FIRST_VERTEX, firstInstance);
321 		}
322 
323 		endRenderPass(m_vk, *m_cmdBuffer);
324 		endCommandBuffer(m_vk, *m_cmdBuffer);
325 	}
326 
327 	// Submit
328 	{
329 		const vk::VkQueue		queue		= m_context.getUniversalQueue();
330 		const vk::VkDevice		device		= m_context.getDevice();
331 
332 		submitCommandsAndWait(m_vk, device, queue, m_cmdBuffer.get());
333 	}
334 
335 	// Validate
336 	{
337 		tcu::TextureLevel referenceFrame(vk::mapVkFormat(m_colorAttachmentFormat), static_cast<int>(0.5f + WIDTH), static_cast<int>(0.5f + HEIGHT));
338 
339 		drawReferenceImage(referenceFrame.getAccess());
340 
341 		const vk::VkOffset3D				zeroOffset		= { 0, 0, 0 };
342 		const tcu::ConstPixelBufferAccess	renderedFrame	= m_colorTargetImage->readSurface(m_context.getUniversalQueue(), m_context.getDefaultAllocator(),
343 															  vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR_BIT);
344 
345 		if (!tcu::fuzzyCompare(m_context.getTestContext().getLog(), "Result", "Image comparison result", referenceFrame.getAccess(), renderedFrame, 0.05f, tcu::COMPARE_LOG_RESULT))
346 			return tcu::TestStatus::fail("Rendered image is incorrect");
347 		else
348 			return tcu::TestStatus::pass("OK");
349 	}
350 }
351 
addDrawCase(tcu::TestCaseGroup * group,const DrawTest::TestSpec testSpec,const TestFlags flags)352 void addDrawCase (tcu::TestCaseGroup* group, const DrawTest::TestSpec testSpec, const TestFlags flags)
353 {
354 	std::ostringstream name;
355 	name << "draw";
356 
357 	if (flags & TEST_FLAG_INDEXED)			name << "_indexed";
358 	if (flags & TEST_FLAG_INDIRECT)			name << "_indirect";
359 	if (flags & TEST_FLAG_INSTANCED)		name << "_instanced";
360 	if (flags & TEST_FLAG_FIRST_INSTANCE)	name << "_first_instance";
361 
362 	group->addChild(new InstanceFactory<DrawTest>(group->getTestContext(), name.str(), "", addFlags(testSpec, flags)));
363 }
364 
365 }	// anonymous
366 
ShaderDrawParametersTests(tcu::TestContext & testCtx)367 ShaderDrawParametersTests::ShaderDrawParametersTests (tcu::TestContext &testCtx)
368 	: TestCaseGroup	(testCtx, "shader_draw_parameters", "VK_KHR_shader_draw_parameters")
369 {
370 }
371 
init(void)372 void ShaderDrawParametersTests::init (void)
373 {
374 	{
375 		DrawTest::TestSpec testSpec;
376 		testSpec.shaders[glu::SHADERTYPE_VERTEX]	= "vulkan/draw/VertexFetchShaderDrawParameters.vert";
377 		testSpec.shaders[glu::SHADERTYPE_FRAGMENT]	= "vulkan/draw/VertexFetch.frag";
378 		testSpec.topology							= vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP;
379 		testSpec.flags								= 0;
380 
381 		de::MovePtr<tcu::TestCaseGroup> group(new tcu::TestCaseGroup(getTestContext(), "base_vertex", ""));
382 		addDrawCase(group.get(), testSpec, 0);
383 		addDrawCase(group.get(), testSpec, TEST_FLAG_INDEXED);
384 		addDrawCase(group.get(), testSpec, TEST_FLAG_INDIRECT);
385 		addDrawCase(group.get(), testSpec, TEST_FLAG_INDEXED | TEST_FLAG_INDIRECT);
386 		addChild(group.release());
387 	}
388 	{
389 		DrawTest::TestSpec testSpec;
390 		testSpec.shaders[glu::SHADERTYPE_VERTEX]	= "vulkan/draw/VertexFetchShaderDrawParameters.vert";
391 		testSpec.shaders[glu::SHADERTYPE_FRAGMENT]	= "vulkan/draw/VertexFetch.frag";
392 		testSpec.topology							= vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP;
393 		testSpec.flags								= TEST_FLAG_INSTANCED;
394 
395 		de::MovePtr<tcu::TestCaseGroup> group(new tcu::TestCaseGroup(getTestContext(), "base_instance", ""));
396 		addDrawCase(group.get(), testSpec, 0);
397 		addDrawCase(group.get(), testSpec, TEST_FLAG_INDEXED);
398 		addDrawCase(group.get(), testSpec, TEST_FLAG_INDIRECT);
399 		addDrawCase(group.get(), testSpec, TEST_FLAG_INDIRECT | TEST_FLAG_FIRST_INSTANCE);
400 		addDrawCase(group.get(), testSpec, TEST_FLAG_INDEXED  | TEST_FLAG_INDIRECT);
401 		addDrawCase(group.get(), testSpec, TEST_FLAG_INDEXED  | TEST_FLAG_INDIRECT | TEST_FLAG_FIRST_INSTANCE);
402 		addChild(group.release());
403 	}
404 	{
405 		DrawTest::TestSpec testSpec;
406 		testSpec.shaders[glu::SHADERTYPE_VERTEX]	= "vulkan/draw/VertexFetchShaderDrawParametersDrawIndex.vert";
407 		testSpec.shaders[glu::SHADERTYPE_FRAGMENT]	= "vulkan/draw/VertexFetch.frag";
408 		testSpec.topology							= vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP;
409 		testSpec.flags								= TEST_FLAG_INDIRECT | TEST_FLAG_MULTIDRAW;
410 
411 		de::MovePtr<tcu::TestCaseGroup> group(new tcu::TestCaseGroup(getTestContext(), "draw_index", ""));
412 		addDrawCase(group.get(), testSpec, 0);
413 		addDrawCase(group.get(), testSpec, TEST_FLAG_INSTANCED);
414 		addDrawCase(group.get(), testSpec, TEST_FLAG_INDEXED);
415 		addDrawCase(group.get(), testSpec, TEST_FLAG_INDEXED | TEST_FLAG_INSTANCED);
416 		addChild(group.release());
417 	}
418 }
419 
420 }	// DrawTests
421 }	// vkt
422