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 	// Vertex data
113 	{
114 		int refIndex = NDX_FIRST_VERTEX - OFFSET_FIRST_INDEX;
115 
116 		m_data.push_back(VertexElementData(tcu::Vec4( 1.0f, -1.0f, 1.0f, 1.0f), tcu::Vec4(1.0f), -1));
117 		m_data.push_back(VertexElementData(tcu::Vec4(-1.0f,  1.0f, 1.0f, 1.0f), tcu::Vec4(1.0f), -1));
118 
119 		if (!isIndexed())
120 			refIndex = 0;
121 
122 		m_data.push_back(VertexElementData(tcu::Vec4(-0.3f,	-0.3f, 1.0f, 1.0f), tcu::Vec4(1.0f), refIndex++));
123 		m_data.push_back(VertexElementData(tcu::Vec4(-0.3f,	 0.3f, 1.0f, 1.0f), tcu::Vec4(1.0f), refIndex++));
124 		m_data.push_back(VertexElementData(tcu::Vec4( 0.3f,	-0.3f, 1.0f, 1.0f), tcu::Vec4(1.0f), refIndex++));
125 		m_data.push_back(VertexElementData(tcu::Vec4( 0.3f,	 0.3f, 1.0f, 1.0f), tcu::Vec4(1.0f), refIndex++));
126 
127 		m_data.push_back(VertexElementData(tcu::Vec4(-1.0f,  1.0f, 1.0f, 1.0f), tcu::Vec4(1.0f), -1));
128 		m_data.push_back(VertexElementData(tcu::Vec4( 1.0f, -1.0f, 1.0f, 1.0f), tcu::Vec4(1.0f), -1));
129 		m_data.push_back(VertexElementData(tcu::Vec4(-1.0f, -1.0f, 1.0f, 1.0f), tcu::Vec4(1.0f), -1));
130 
131 		if (!isIndexed())
132 			refIndex = 0;
133 
134 		m_data.push_back(VertexElementData(tcu::Vec4(-0.3f,	-0.3f, 1.0f, 1.0f), tcu::Vec4(1.0f), refIndex++));
135 		m_data.push_back(VertexElementData(tcu::Vec4(-0.3f,	 0.3f, 1.0f, 1.0f), tcu::Vec4(1.0f), refIndex++));
136 		m_data.push_back(VertexElementData(tcu::Vec4( 0.3f,	-0.3f, 1.0f, 1.0f), tcu::Vec4(1.0f), refIndex++));
137 		m_data.push_back(VertexElementData(tcu::Vec4( 0.3f,	 0.3f, 1.0f, 1.0f), tcu::Vec4(1.0f), refIndex++));
138 
139 		m_data.push_back(VertexElementData(tcu::Vec4(-1.0f,  1.0f, 1.0f, 1.0f), tcu::Vec4(1.0f), -1));
140 		m_data.push_back(VertexElementData(tcu::Vec4( 1.0f, -1.0f, 1.0f, 1.0f), tcu::Vec4(1.0f), -1));
141 
142 		// Make sure constants are up to date
143 		DE_ASSERT(m_data.size() == NDX_SECOND_VERTEX + NUM_VERTICES + 2);
144 		DE_ASSERT(NDX_SECOND_VERTEX - NDX_FIRST_VERTEX - NUM_VERTICES == 3);
145 	}
146 
147 	if (isIndirect())
148 	{
149 		const std::size_t	indirectBufferSize	= MAX_INDIRECT_DRAW_COUNT * 32;	// space for COUNT commands plus some gratuitous padding
150 							m_indirectBuffer	= Buffer::createAndAlloc(m_vk, m_context.getDevice(), BufferCreateInfo(indirectBufferSize, vk::VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT),
151 												  m_context.getDefaultAllocator(), vk::MemoryRequirement::HostVisible);
152 
153 		deMemset(m_indirectBuffer->getBoundMemory().getHostPtr(), 0, indirectBufferSize);
154 		vk::flushMappedMemoryRange(m_vk, m_context.getDevice(), m_indirectBuffer->getBoundMemory().getMemory(), m_indirectBuffer->getBoundMemory().getOffset(), VK_WHOLE_SIZE);
155 	}
156 
157 	if (isIndexed())
158 	{
159 		DE_ASSERT(NDX_FIRST_INDEX + NUM_VERTICES <= NDX_SECOND_INDEX);
160 		const std::size_t	indexBufferSize	= sizeof(deUint32) * (NDX_SECOND_INDEX + NUM_VERTICES);
161 							m_indexBuffer	= Buffer::createAndAlloc(m_vk, m_context.getDevice(), BufferCreateInfo(indexBufferSize, vk::VK_BUFFER_USAGE_INDEX_BUFFER_BIT),
162 																	 m_context.getDefaultAllocator(), vk::MemoryRequirement::HostVisible);
163 		deUint32*			indices			= static_cast<deUint32*>(m_indexBuffer->getBoundMemory().getHostPtr());
164 
165 		deMemset(indices, 0, indexBufferSize);
166 
167 		for (int i = 0; i < NUM_VERTICES; i++)
168 		{
169 			indices[NDX_FIRST_INDEX  + i] = static_cast<deUint32>(NDX_FIRST_VERTEX  + i) - OFFSET_FIRST_INDEX;
170 			indices[NDX_SECOND_INDEX + i] = static_cast<deUint32>(NDX_SECOND_VERTEX + i) - OFFSET_SECOND_INDEX;
171 		}
172 
173 		vk::flushMappedMemoryRange(m_vk, m_context.getDevice(), m_indexBuffer->getBoundMemory().getMemory(), m_indexBuffer->getBoundMemory().getOffset(), VK_WHOLE_SIZE);
174 	}
175 
176 	initialize();
177 }
178 
179 template<typename T, std::size_t N>
setIndirectCommand(const T (& pCmdData)[N])180 void DrawTest::setIndirectCommand (const T (&pCmdData)[N])
181 {
182 	DE_ASSERT(N != 0 && N <= MAX_INDIRECT_DRAW_COUNT);
183 
184 	const std::size_t dataSize = N * sizeof(T);
185 
186 	deMemcpy(m_indirectBuffer->getBoundMemory().getHostPtr(), pCmdData, dataSize);
187 	vk::flushMappedMemoryRange(m_vk, m_context.getDevice(), m_indirectBuffer->getBoundMemory().getMemory(), m_indirectBuffer->getBoundMemory().getOffset(), VK_WHOLE_SIZE);
188 }
189 
190 //! This function must be kept in sync with the shader.
drawReferenceImage(const tcu::PixelBufferAccess & refImage) const191 void DrawTest::drawReferenceImage (const tcu::PixelBufferAccess& refImage) const
192 {
193 	using tcu::Vec2;
194 	using tcu::Vec4;
195 	using tcu::IVec4;
196 
197 	const Vec2	perInstanceOffset[]	= { Vec2(0.0f, 0.0f), Vec2(-0.3f,  0.0f), Vec2(0.0f, 0.3f) };
198 	const Vec2	perDrawOffset[]		= { Vec2(0.0f, 0.0f), Vec2(-0.3f, -0.3f), Vec2(0.3f, 0.3f) };
199 	const Vec4	allColors[]			= { Vec4(1.0f), Vec4(0.0f, 0.0f, 1.0f, 1.0f), Vec4(0.0f, 1.0f, 0.0f, 1.0f) };
200 	const int	numInstances		= isInstanced() ? MAX_INSTANCE_COUNT		: 1;
201 	const int	numIndirectDraws	= isMultiDraw() ? MAX_INDIRECT_DRAW_COUNT	: 1;
202 	const int	rectWidth			= static_cast<int>(static_cast<float>(WIDTH)  * 0.6f / 2.0f);
203 	const int	rectHeight			= static_cast<int>(static_cast<float>(HEIGHT) * 0.6f / 2.0f);
204 
205 	DE_ASSERT(DE_LENGTH_OF_ARRAY(perInstanceOffset) >= numInstances);
206 	DE_ASSERT(DE_LENGTH_OF_ARRAY(allColors) >= numInstances && DE_LENGTH_OF_ARRAY(allColors) >= numIndirectDraws);
207 	DE_ASSERT(DE_LENGTH_OF_ARRAY(perDrawOffset) >= numIndirectDraws);
208 
209 	tcu::clear(refImage, tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f));
210 
211 	for (int drawNdx     = 0; drawNdx     < numIndirectDraws; ++drawNdx)
212 	for (int instanceNdx = 0; instanceNdx < numInstances;     ++instanceNdx)
213 	{
214 		const Vec2	offset	= perInstanceOffset[instanceNdx] + perDrawOffset[drawNdx];
215 		const Vec4&	color	= allColors[isMultiDraw() ? drawNdx : instanceNdx];
216 		int			x		= static_cast<int>(static_cast<float>(WIDTH)  * (1.0f - 0.3f + offset.x()) / 2.0f);
217 		int			y		= static_cast<int>(static_cast<float>(HEIGHT) * (1.0f - 0.3f + offset.y()) / 2.0f);
218 
219 		tcu::clear(tcu::getSubregion(refImage, x, y, rectWidth, rectHeight), color);
220 	}
221 }
222 
iterate(void)223 tcu::TestStatus DrawTest::iterate (void)
224 {
225 	// Draw
226 	{
227 		beginRenderPass();
228 
229 		const vk::VkDeviceSize	vertexBufferOffset	= 0;
230 		const vk::VkBuffer		vertexBuffer		= m_vertexBuffer->object();
231 
232 		m_vk.cmdBindVertexBuffers	(*m_cmdBuffer, 0, 1, &vertexBuffer, &vertexBufferOffset);
233 		m_vk.cmdBindPipeline		(*m_cmdBuffer, vk::VK_PIPELINE_BIND_POINT_GRAPHICS, *m_pipeline);
234 
235 		if (isIndexed())
236 			m_vk.cmdBindIndexBuffer(*m_cmdBuffer, m_indexBuffer->object(), 0ull, vk::VK_INDEX_TYPE_UINT32);
237 
238 		const deUint32			numInstances		= isInstanced() ? MAX_INSTANCE_COUNT : 1;
239 
240 		if (isIndirect())
241 		{
242 			if (isIndexed())
243 			{
244 				const vk::VkDrawIndexedIndirectCommand commands[] =
245 				{
246 					// indexCount, instanceCount, firstIndex, vertexOffset, firstInstance
247 					{ NUM_VERTICES,	numInstances,	NDX_FIRST_INDEX,	OFFSET_FIRST_INDEX,		(isFirstInstance() ? 2u : 0u) },
248 					{ NUM_VERTICES,	numInstances,	NDX_SECOND_INDEX,	OFFSET_SECOND_INDEX,	(isFirstInstance() ? 1u : 0u) },
249 					{ NUM_VERTICES,	numInstances,	NDX_FIRST_INDEX,	OFFSET_FIRST_INDEX,		(isFirstInstance() ? 3u : 0u) },
250 				};
251 				setIndirectCommand(commands);
252 			}
253 			else
254 			{
255 				const vk::VkDrawIndirectCommand commands[] =
256 				{
257 					// vertexCount, instanceCount, firstVertex, firstInstance
258 					{ NUM_VERTICES,	numInstances,	NDX_FIRST_VERTEX,	(isFirstInstance() ? 2u : 0u) },
259 					{ NUM_VERTICES,	numInstances,	NDX_SECOND_VERTEX,	(isFirstInstance() ? 1u : 0u) },
260 					{ NUM_VERTICES,	numInstances,	NDX_FIRST_VERTEX,	(isFirstInstance() ? 3u : 0u) },
261 				};
262 				setIndirectCommand(commands);
263 			}
264 		}
265 
266 		if (isIndirect())
267 		{
268 			const deUint32 numIndirectDraws = isMultiDraw() ? MAX_INDIRECT_DRAW_COUNT : 1;
269 
270 			if (isIndexed())
271 				m_vk.cmdDrawIndexedIndirect(*m_cmdBuffer, m_indirectBuffer->object(), 0ull, numIndirectDraws, sizeof(vk::VkDrawIndexedIndirectCommand));
272 			else
273 				m_vk.cmdDrawIndirect(*m_cmdBuffer, m_indirectBuffer->object(), 0ull, numIndirectDraws, sizeof(vk::VkDrawIndirectCommand));
274 		}
275 		else
276 		{
277 			const deUint32 firstInstance = 2;
278 
279 			if (isIndexed())
280 				m_vk.cmdDrawIndexed(*m_cmdBuffer, NUM_VERTICES, numInstances, NDX_FIRST_INDEX, OFFSET_FIRST_INDEX, firstInstance);
281 			else
282 				m_vk.cmdDraw(*m_cmdBuffer, NUM_VERTICES, numInstances, NDX_FIRST_VERTEX, firstInstance);
283 		}
284 
285 		endRenderPass(m_vk, *m_cmdBuffer);
286 		endCommandBuffer(m_vk, *m_cmdBuffer);
287 	}
288 
289 	// Submit
290 	{
291 		const vk::VkQueue		queue		= m_context.getUniversalQueue();
292 		const vk::VkDevice		device		= m_context.getDevice();
293 
294 		submitCommandsAndWait(m_vk, device, queue, m_cmdBuffer.get());
295 	}
296 
297 	// Validate
298 	{
299 		tcu::TextureLevel referenceFrame(vk::mapVkFormat(m_colorAttachmentFormat), static_cast<int>(0.5f + static_cast<float>(WIDTH)), static_cast<int>(0.5f + static_cast<float>(HEIGHT)));
300 
301 		drawReferenceImage(referenceFrame.getAccess());
302 
303 		const vk::VkOffset3D				zeroOffset		= { 0, 0, 0 };
304 		const tcu::ConstPixelBufferAccess	renderedFrame	= m_colorTargetImage->readSurface(m_context.getUniversalQueue(), m_context.getDefaultAllocator(),
305 															  vk::VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, vk::VK_IMAGE_ASPECT_COLOR_BIT);
306 
307 		if (!tcu::fuzzyCompare(m_context.getTestContext().getLog(), "Result", "Image comparison result", referenceFrame.getAccess(), renderedFrame, 0.05f, tcu::COMPARE_LOG_RESULT))
308 			return tcu::TestStatus::fail("Rendered image is incorrect");
309 		else
310 			return tcu::TestStatus::pass("OK");
311 	}
312 }
313 
checkSupport(Context & context,TestFlags flags)314 void checkSupport (Context& context, TestFlags flags)
315 {
316 	context.requireDeviceFunctionality("VK_KHR_shader_draw_parameters");
317 
318 	// Shader draw parameters is part of Vulkan 1.1 but is optional
319 	if (context.contextSupports(vk::ApiVersion(1, 1, 0)) )
320 	{
321 		// Check if shader draw parameters is supported on the physical device.
322 		vk::VkPhysicalDeviceShaderDrawParametersFeatures	drawParameters	=
323 		{
324 			vk::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES,	// sType
325 			DE_NULL,																// pNext
326 			VK_FALSE																// shaderDrawParameters
327 		};
328 
329 		vk::VkPhysicalDeviceFeatures						features;
330 		deMemset(&features, 0, sizeof(vk::VkPhysicalDeviceFeatures));
331 
332 		vk::VkPhysicalDeviceFeatures2						featuresExt		=
333 		{
334 			vk::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2,					// sType
335 			&drawParameters,													// pNext
336 			features
337 		};
338 
339 		context.getInstanceInterface().getPhysicalDeviceFeatures2(context.getPhysicalDevice(), &featuresExt);
340 
341 		if (drawParameters.shaderDrawParameters == VK_FALSE)
342 			TCU_THROW(NotSupportedError, "shaderDrawParameters feature not supported by the device");
343 	}
344 
345 	if (flags & TEST_FLAG_MULTIDRAW)
346 		context.requireDeviceCoreFeature(DEVICE_CORE_FEATURE_MULTI_DRAW_INDIRECT);
347 
348 	if (flags & TEST_FLAG_FIRST_INSTANCE)
349 		context.requireDeviceCoreFeature(DEVICE_CORE_FEATURE_DRAW_INDIRECT_FIRST_INSTANCE);
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, FunctionSupport1<TestFlags>>(group->getTestContext(), name.str(), "", addFlags(testSpec, flags), FunctionSupport1<TestFlags>::Args(checkSupport, testSpec.flags | 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