1 /*------------------------------------------------------------------------
2 * Vulkan Conformance Tests
3 * ------------------------
4 *
5 * Copyright (c) 2017 The Khronos Group Inc.
6 * Copyright (c) 2017 Google Inc.
7 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
8 *
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 *
21 *//*!
22 * \file
23 * \brief Differing iterpolation decorations tests
24 *//*--------------------------------------------------------------------*/
25
26 #include "vktDrawDifferingInterpolationTests.hpp"
27
28 #include "vktDrawBaseClass.hpp"
29 #include "vkQueryUtil.hpp"
30 #include "vkCmdUtil.hpp"
31 #include "vkTypeUtil.hpp"
32 #include "vktTestGroupUtil.hpp"
33
34 #include "deDefs.h"
35 #include "deRandom.hpp"
36 #include "deString.h"
37
38 #include "tcuTestCase.hpp"
39 #include "tcuRGBA.hpp"
40 #include "tcuTextureUtil.hpp"
41 #include "tcuImageCompare.hpp"
42 #include "tcuStringTemplate.hpp"
43
44 #include "rrRenderer.hpp"
45
46 #include <string>
47 #include <sstream>
48
49 namespace vkt
50 {
51 namespace Draw
52 {
53 namespace
54 {
55 using namespace vk;
56 using namespace std;
57
58 struct DrawParams
59 {
60 string vertShader;
61 string fragShader;
62 string refVertShader;
63 string refFragShader;
64 const SharedGroupParams groupParams;
65 };
66
67 class DrawTestInstance : public TestInstance
68 {
69 public:
70 DrawTestInstance (Context& context, const DrawParams& data);
71 ~DrawTestInstance (void);
72 tcu::TestStatus iterate (void);
73
74 protected:
75 void preRenderCommands (VkCommandBuffer cmdBuffer, VkImage colorTargetImage, const VkClearValue& clearColor);
76 void draw (VkCommandBuffer cmdBuffer, VkPipeline pipeline, VkBuffer vertexBuffer);
77
78 #ifndef CTS_USES_VULKANSC
79 void beginSecondaryCmdBuffer(VkCommandBuffer cmdBuffer, VkFormat colorAttachmentFormat, VkRenderingFlagsKHR renderingFlags = 0u);
80 #endif // CTS_USES_VULKANSC
81
82 private:
83 DrawParams m_data;
84
85 enum
86 {
87 WIDTH = 256,
88 HEIGHT = 256
89 };
90 };
91
DrawTestInstance(Context & context,const DrawParams & data)92 DrawTestInstance::DrawTestInstance (Context& context, const DrawParams& data)
93 : vkt::TestInstance (context)
94 , m_data (data)
95 {
96 }
97
~DrawTestInstance(void)98 DrawTestInstance::~DrawTestInstance (void)
99 {
100 }
101
102 class DrawTestCase : public TestCase
103 {
104 public:
105 DrawTestCase (tcu::TestContext& context, const char* name, const char* desc, const DrawParams data);
106 ~DrawTestCase (void);
107 virtual void initPrograms (SourceCollections& programCollection) const;
108 virtual void checkSupport (Context& context) const;
109 virtual TestInstance* createInstance (Context& context) const;
110
111 private:
112 DrawParams m_data;
113 };
114
DrawTestCase(tcu::TestContext & context,const char * name,const char * desc,const DrawParams data)115 DrawTestCase::DrawTestCase (tcu::TestContext& context, const char* name, const char* desc, const DrawParams data)
116 : vkt::TestCase (context, name, desc)
117 , m_data (data)
118 {
119 }
120
~DrawTestCase(void)121 DrawTestCase::~DrawTestCase (void)
122 {
123 }
124
initPrograms(SourceCollections & programCollection) const125 void DrawTestCase::initPrograms (SourceCollections& programCollection) const
126 {
127 const tcu::StringTemplate vertShader (string(
128 "#version 430\n"
129 "layout(location = 0) in vec4 in_position;\n"
130 "layout(location = 1) in vec4 in_color;\n"
131 "layout(location = 0) ${qualifier:opt} out vec4 out_color;\n"
132 "out gl_PerVertex {\n"
133 " vec4 gl_Position;\n"
134 " float gl_PointSize;\n"
135 "};\n"
136 "void main() {\n"
137 " gl_PointSize = 1.0;\n"
138 " gl_Position = in_position;\n"
139 " out_color = in_color;\n"
140 "}\n"));
141
142 const tcu::StringTemplate fragShader (string(
143 "#version 430\n"
144 "layout(location = 0) ${qualifier:opt} in vec4 in_color;\n"
145 "layout(location = 0) out vec4 out_color;\n"
146 "void main()\n"
147 "{\n"
148 " out_color = in_color;\n"
149 "}\n"));
150
151 map<string, string> empty;
152 map<string, string> flat;
153 flat["qualifier"] = "flat";
154 map<string, string> noPerspective;
155 noPerspective["qualifier"] = "noperspective";
156
157 programCollection.glslSources.add("vert") << glu::VertexSource(vertShader.specialize(empty));
158 programCollection.glslSources.add("vertFlatColor") << glu::VertexSource(vertShader.specialize(flat));
159 programCollection.glslSources.add("vertNoPerspective") << glu::VertexSource(vertShader.specialize(noPerspective));
160 programCollection.glslSources.add("frag") << glu::FragmentSource(fragShader.specialize(empty));
161 programCollection.glslSources.add("fragFlatColor") << glu::FragmentSource(fragShader.specialize(flat));
162 programCollection.glslSources.add("fragNoPerspective") << glu::FragmentSource(fragShader.specialize(noPerspective));
163 }
164
checkSupport(Context & context) const165 void DrawTestCase::checkSupport(Context& context) const
166 {
167 if (m_data.groupParams->useDynamicRendering)
168 context.requireDeviceFunctionality("VK_KHR_dynamic_rendering");
169 }
170
createInstance(Context & context) const171 TestInstance* DrawTestCase::createInstance (Context& context) const
172 {
173 return new DrawTestInstance(context, m_data);
174 }
175
iterate(void)176 tcu::TestStatus DrawTestInstance::iterate (void)
177 {
178 tcu::ConstPixelBufferAccess frames[2];
179 de::SharedPtr<Image> colorTargetImages[2];
180 const string vertShaderNames[2] = { m_data.vertShader, m_data.refVertShader };
181 const string fragShaderNames[2] = { m_data.fragShader, m_data.refFragShader };
182 const DeviceInterface& vk = m_context.getDeviceInterface();
183 const VkDevice device = m_context.getDevice();
184 tcu::TestLog &log = m_context.getTestContext().getLog();
185
186 // Run two iterations with shaders that have different interpolation decorations. Images should still match.
187 for (deUint32 frameIdx = 0; frameIdx < DE_LENGTH_OF_ARRAY(frames); frameIdx++)
188 {
189 const CmdPoolCreateInfo cmdPoolCreateInfo (m_context.getUniversalQueueFamilyIndex());
190 Move<VkCommandPool> cmdPool = createCommandPool(vk, device, &cmdPoolCreateInfo);
191 Move<VkCommandBuffer> cmdBuffer = allocateCommandBuffer(vk, device, *cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY);
192 Move<VkCommandBuffer> secCmdBuffer;
193 const Unique<VkShaderModule> vs (createShaderModule(vk, device, m_context.getBinaryCollection().get(vertShaderNames[frameIdx].c_str()), 0));
194 const Unique<VkShaderModule> fs (createShaderModule(vk, device, m_context.getBinaryCollection().get(fragShaderNames[frameIdx].c_str()), 0));
195 const VkFormat targetImageFormat = VK_FORMAT_R8G8B8A8_UNORM;
196 de::SharedPtr<Buffer> vertexBuffer;
197 Move<VkRenderPass> renderPass;
198 Move<VkImageView> colorTargetView;
199 Move<VkFramebuffer> framebuffer;
200 Move<VkPipeline> pipeline;
201
202 // Create color buffer image.
203 {
204 const VkExtent3D targetImageExtent = { WIDTH, HEIGHT, 1 };
205 const ImageCreateInfo targetImageCreateInfo (VK_IMAGE_TYPE_2D, targetImageFormat, targetImageExtent, 1, 1, VK_SAMPLE_COUNT_1_BIT,
206 VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT);
207 colorTargetImages[frameIdx] = Image::createAndAlloc(vk, device, targetImageCreateInfo, m_context.getDefaultAllocator(), m_context.getUniversalQueueFamilyIndex());
208 }
209
210 const ImageViewCreateInfo colorTargetViewInfo(colorTargetImages[frameIdx]->object(), VK_IMAGE_VIEW_TYPE_2D, targetImageFormat);
211 colorTargetView = createImageView(vk, device, &colorTargetViewInfo);
212
213 // Create render pass and frame buffer.
214 if (!m_data.groupParams->useDynamicRendering)
215 {
216 RenderPassCreateInfo renderPassCreateInfo;
217 renderPassCreateInfo.addAttachment(AttachmentDescription(targetImageFormat,
218 VK_SAMPLE_COUNT_1_BIT,
219 VK_ATTACHMENT_LOAD_OP_LOAD,
220 VK_ATTACHMENT_STORE_OP_STORE,
221 VK_ATTACHMENT_LOAD_OP_DONT_CARE,
222 VK_ATTACHMENT_STORE_OP_STORE,
223 VK_IMAGE_LAYOUT_GENERAL,
224 VK_IMAGE_LAYOUT_GENERAL));
225
226 const VkAttachmentReference colorAttachmentRef = { 0, VK_IMAGE_LAYOUT_GENERAL };
227 renderPassCreateInfo.addSubpass(SubpassDescription(VK_PIPELINE_BIND_POINT_GRAPHICS,
228 0,
229 0,
230 DE_NULL,
231 1,
232 &colorAttachmentRef,
233 DE_NULL,
234 AttachmentReference(),
235 0,
236 DE_NULL));
237
238 renderPass = createRenderPass(vk, device, &renderPassCreateInfo);
239
240 vector<VkImageView> colorAttachments { *colorTargetView };
241 const FramebufferCreateInfo framebufferCreateInfo (*renderPass, colorAttachments, WIDTH, HEIGHT, 1);
242 framebuffer = createFramebuffer(vk, device, &framebufferCreateInfo);
243 }
244
245 // Create vertex buffer.
246 {
247 const PositionColorVertex vertices[] =
248 {
249 PositionColorVertex(
250 tcu::Vec4(-0.8f, -0.7f, 1.0f, 1.0f), // Coord
251 tcu::Vec4(1.0f, 0.0f, 0.0f, 1.0f)), // Color
252
253 PositionColorVertex(
254 tcu::Vec4(0.0f, 0.4f, 0.5f, 0.5f), // Coord
255 tcu::Vec4(0.0f, 1.0f, 0.0f, 1.0f)), // Color
256
257 PositionColorVertex(
258 tcu::Vec4(0.8f, -0.5f, 1.0f, 1.0f), // Coord
259 tcu::Vec4(0.0f, 0.0f, 1.0f, 1.0f)) // Color
260 };
261
262 const VkDeviceSize dataSize = DE_LENGTH_OF_ARRAY(vertices) * sizeof(PositionColorVertex);
263 vertexBuffer = Buffer::createAndAlloc(vk, device, BufferCreateInfo(dataSize, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT), m_context.getDefaultAllocator(), MemoryRequirement::HostVisible);
264 deUint8* ptr = reinterpret_cast<deUint8*>(vertexBuffer->getBoundMemory().getHostPtr());
265
266 deMemcpy(ptr, vertices, static_cast<size_t>(dataSize));
267 flushMappedMemoryRange(vk, device, vertexBuffer->getBoundMemory().getMemory(), vertexBuffer->getBoundMemory().getOffset(), VK_WHOLE_SIZE);
268 }
269
270 const PipelineLayoutCreateInfo pipelineLayoutCreateInfo;
271 Move<VkPipelineLayout> pipelineLayout = createPipelineLayout(vk, device, &pipelineLayoutCreateInfo);
272
273 // Create pipeline
274 {
275 const PipelineCreateInfo::ColorBlendState::Attachment vkCbAttachmentState;
276
277 VkViewport viewport = makeViewport(WIDTH, HEIGHT);
278 VkRect2D scissor = makeRect2D(WIDTH, HEIGHT);
279
280 const VkVertexInputBindingDescription vertexInputBindingDescription = { 0, (deUint32)sizeof(tcu::Vec4) * 2, VK_VERTEX_INPUT_RATE_VERTEX };
281
282 const VkVertexInputAttributeDescription vertexInputAttributeDescriptions[2] =
283 {
284 { 0u, 0u, VK_FORMAT_R32G32B32A32_SFLOAT, 0u },
285 { 1u, 0u, VK_FORMAT_R32G32B32A32_SFLOAT, (deUint32)(sizeof(float)* 4) }
286 };
287
288 PipelineCreateInfo::VertexInputState vertexInputState = PipelineCreateInfo::VertexInputState(1, &vertexInputBindingDescription, 2, vertexInputAttributeDescriptions);
289
290 PipelineCreateInfo pipelineCreateInfo(*pipelineLayout, *renderPass, 0, 0);
291 pipelineCreateInfo.addShader(PipelineCreateInfo::PipelineShaderStage(*vs, "main", VK_SHADER_STAGE_VERTEX_BIT));
292 pipelineCreateInfo.addShader(PipelineCreateInfo::PipelineShaderStage(*fs, "main", VK_SHADER_STAGE_FRAGMENT_BIT));
293 pipelineCreateInfo.addState(PipelineCreateInfo::VertexInputState(vertexInputState));
294 pipelineCreateInfo.addState(PipelineCreateInfo::InputAssemblerState(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST));
295 pipelineCreateInfo.addState(PipelineCreateInfo::ColorBlendState(1, &vkCbAttachmentState));
296 pipelineCreateInfo.addState(PipelineCreateInfo::ViewportState(1, vector<VkViewport>(1, viewport), vector<VkRect2D>(1, scissor)));
297 pipelineCreateInfo.addState(PipelineCreateInfo::DepthStencilState());
298 pipelineCreateInfo.addState(PipelineCreateInfo::RasterizerState());
299 pipelineCreateInfo.addState(PipelineCreateInfo::MultiSampleState());
300
301 #ifndef CTS_USES_VULKANSC
302 VkPipelineRenderingCreateInfoKHR renderingCreateInfo
303 {
304 VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO_KHR,
305 DE_NULL,
306 0u,
307 1u,
308 &targetImageFormat,
309 VK_FORMAT_UNDEFINED,
310 VK_FORMAT_UNDEFINED
311 };
312
313 if (m_data.groupParams->useDynamicRendering)
314 pipelineCreateInfo.pNext = &renderingCreateInfo;
315 #endif // CTS_USES_VULKANSC
316
317 pipeline = createGraphicsPipeline(vk, device, DE_NULL, &pipelineCreateInfo);
318 }
319
320 const VkRect2D renderArea = makeRect2D(WIDTH, HEIGHT);
321 const VkClearValue clearColor { { { 0.0f, 0.0f, 0.0f, 1.0f } } };
322 const VkBuffer buffer = vertexBuffer->object();
323
324 // Record commands
325 #ifndef CTS_USES_VULKANSC
326 if (m_data.groupParams->useSecondaryCmdBuffer)
327 {
328 secCmdBuffer = allocateCommandBuffer(vk, device, *cmdPool, VK_COMMAND_BUFFER_LEVEL_SECONDARY);
329
330 // record secondary command buffer
331 if (m_data.groupParams->secondaryCmdBufferCompletelyContainsDynamicRenderpass)
332 {
333 beginSecondaryCmdBuffer(*secCmdBuffer, targetImageFormat, VK_RENDERING_CONTENTS_SECONDARY_COMMAND_BUFFERS_BIT);
334 beginRendering(vk, *secCmdBuffer, *colorTargetView, renderArea, clearColor, VK_IMAGE_LAYOUT_GENERAL, VK_ATTACHMENT_LOAD_OP_LOAD, 0u);
335 }
336 else
337 beginSecondaryCmdBuffer(*secCmdBuffer, targetImageFormat);
338
339 draw(*secCmdBuffer, *pipeline, buffer);
340
341 if (m_data.groupParams->secondaryCmdBufferCompletelyContainsDynamicRenderpass)
342 endRendering(vk, *secCmdBuffer);
343
344 endCommandBuffer(vk, *secCmdBuffer);
345
346 // record primary command buffer
347 beginCommandBuffer(vk, *cmdBuffer, 0u);
348
349 preRenderCommands(*cmdBuffer, colorTargetImages[frameIdx]->object(), clearColor);
350
351 if (!m_data.groupParams->secondaryCmdBufferCompletelyContainsDynamicRenderpass)
352 beginRendering(vk, *cmdBuffer, *colorTargetView, renderArea, clearColor, VK_IMAGE_LAYOUT_GENERAL, VK_ATTACHMENT_LOAD_OP_LOAD, VK_RENDERING_CONTENTS_SECONDARY_COMMAND_BUFFERS_BIT);
353
354 vk.cmdExecuteCommands(*cmdBuffer, 1u, &*secCmdBuffer);
355
356 if (!m_data.groupParams->secondaryCmdBufferCompletelyContainsDynamicRenderpass)
357 endRendering(vk, *cmdBuffer);
358
359 endCommandBuffer(vk, *cmdBuffer);
360 }
361 else if (m_data.groupParams->useDynamicRendering)
362 {
363 beginCommandBuffer(vk, *cmdBuffer);
364
365 preRenderCommands(*cmdBuffer, colorTargetImages[frameIdx]->object(), clearColor);
366 beginRendering(vk, *cmdBuffer, *colorTargetView, renderArea, clearColor, VK_IMAGE_LAYOUT_GENERAL, VK_ATTACHMENT_LOAD_OP_LOAD);
367 draw(*cmdBuffer, *pipeline, buffer);
368 endRendering(vk, *cmdBuffer);
369
370 endCommandBuffer(vk, *cmdBuffer);
371 }
372 #endif // CTS_USES_VULKANSC
373
374 if (!m_data.groupParams->useDynamicRendering)
375 {
376 beginCommandBuffer(vk, *cmdBuffer);
377
378 preRenderCommands(*cmdBuffer, colorTargetImages[frameIdx]->object(), clearColor);
379 beginRenderPass(vk, *cmdBuffer, *renderPass, *framebuffer, renderArea);
380 draw(*cmdBuffer, *pipeline, buffer);
381 endRenderPass(vk, *cmdBuffer);
382
383 endCommandBuffer(vk, *cmdBuffer);
384 }
385
386 // Submit and read results.
387 const VkQueue queue = m_context.getUniversalQueue();
388 const VkOffset3D zeroOffset = { 0, 0, 0 };
389 submitCommandsAndWait(vk, device, queue, cmdBuffer.get());
390 frames[frameIdx] = colorTargetImages[frameIdx]->readSurface(queue, m_context.getDefaultAllocator(), VK_IMAGE_LAYOUT_GENERAL, zeroOffset, WIDTH, HEIGHT, VK_IMAGE_ASPECT_COLOR_BIT);
391 }
392
393 qpTestResult res = QP_TEST_RESULT_PASS;
394
395 if (!tcu::intThresholdCompare(log, "Result", "Image comparison result", frames[0], frames[1], tcu::UVec4(0), tcu::COMPARE_LOG_RESULT))
396 res = QP_TEST_RESULT_FAIL;
397
398 return tcu::TestStatus(res, qpGetTestResultName(res));
399 }
400
preRenderCommands(VkCommandBuffer cmdBuffer,VkImage colorTargetImage,const VkClearValue & clearColor)401 void DrawTestInstance::preRenderCommands (VkCommandBuffer cmdBuffer, VkImage colorTargetImage, const VkClearValue& clearColor)
402 {
403 const DeviceInterface& vk = m_context.getDeviceInterface();
404 const ImageSubresourceRange subresourceRange (VK_IMAGE_ASPECT_COLOR_BIT);
405 const VkMemoryBarrier memBarrier
406 {
407 VK_STRUCTURE_TYPE_MEMORY_BARRIER,
408 DE_NULL,
409 VK_ACCESS_TRANSFER_WRITE_BIT,
410 VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT
411 };
412
413 initialTransitionColor2DImage(vk, cmdBuffer, colorTargetImage, VK_IMAGE_LAYOUT_GENERAL,
414 vk::VK_ACCESS_TRANSFER_WRITE_BIT, vk::VK_PIPELINE_STAGE_TRANSFER_BIT);
415
416 vk.cmdClearColorImage(cmdBuffer, colorTargetImage, VK_IMAGE_LAYOUT_GENERAL, &clearColor.color, 1, &subresourceRange);
417
418 vk.cmdPipelineBarrier(cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
419 0, 1, &memBarrier, 0, DE_NULL, 0, DE_NULL);
420 }
421
draw(VkCommandBuffer cmdBuffer,VkPipeline pipeline,VkBuffer vertexBuffer)422 void DrawTestInstance::draw (VkCommandBuffer cmdBuffer, VkPipeline pipeline, VkBuffer vertexBuffer)
423 {
424 const DeviceInterface& vk = m_context.getDeviceInterface();
425 const VkDeviceSize vertexBufferOffset = 0;
426
427 vk.cmdBindVertexBuffers(cmdBuffer, 0, 1, &vertexBuffer, &vertexBufferOffset);
428 vk.cmdBindPipeline(cmdBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
429 vk.cmdDraw(cmdBuffer, 3u, 1u, 0u, 0u);
430 }
431
432 #ifndef CTS_USES_VULKANSC
beginSecondaryCmdBuffer(VkCommandBuffer cmdBuffer,VkFormat colorAttachmentFormat,VkRenderingFlagsKHR renderingFlags)433 void DrawTestInstance::beginSecondaryCmdBuffer(VkCommandBuffer cmdBuffer, VkFormat colorAttachmentFormat, VkRenderingFlagsKHR renderingFlags)
434 {
435 VkCommandBufferInheritanceRenderingInfoKHR inheritanceRenderingInfo
436 {
437 VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_RENDERING_INFO_KHR, // VkStructureType sType;
438 DE_NULL, // const void* pNext;
439 renderingFlags, // VkRenderingFlagsKHR flags;
440 0u, // uint32_t viewMask;
441 1u, // uint32_t colorAttachmentCount;
442 &colorAttachmentFormat, // const VkFormat* pColorAttachmentFormats;
443 VK_FORMAT_UNDEFINED, // VkFormat depthAttachmentFormat;
444 VK_FORMAT_UNDEFINED, // VkFormat stencilAttachmentFormat;
445 VK_SAMPLE_COUNT_1_BIT, // VkSampleCountFlagBits rasterizationSamples;
446 };
447 const VkCommandBufferInheritanceInfo bufferInheritanceInfo = initVulkanStructure(&inheritanceRenderingInfo);
448
449 VkCommandBufferUsageFlags usageFlags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
450 if (!m_data.groupParams->secondaryCmdBufferCompletelyContainsDynamicRenderpass)
451 usageFlags |= VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT;
452
453 const VkCommandBufferBeginInfo commandBufBeginParams
454 {
455 VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, // VkStructureType sType;
456 DE_NULL, // const void* pNext;
457 usageFlags, // VkCommandBufferUsageFlags flags;
458 &bufferInheritanceInfo
459 };
460
461 const DeviceInterface& vk = m_context.getDeviceInterface();
462 VK_CHECK(vk.beginCommandBuffer(cmdBuffer, &commandBufBeginParams));
463 }
464 #endif // CTS_USES_VULKANSC
465
createTests(tcu::TestCaseGroup * testGroup,const SharedGroupParams groupParams)466 void createTests (tcu::TestCaseGroup* testGroup, const SharedGroupParams groupParams)
467 {
468 tcu::TestContext& testCtx = testGroup->getTestContext();
469 const DrawParams paramsFlat0 = { "vert", "fragFlatColor", "vertFlatColor", "fragFlatColor", groupParams };
470 const DrawParams paramsFlat1 = { "vertFlatColor", "frag", "vert", "frag", groupParams };
471
472 const DrawParams paramsNoPerspective0 = { "vert", "fragNoPerspective", "vertNoPerspective", "fragNoPerspective", groupParams };
473 const DrawParams paramsNoPerspective1 = { "vertNoPerspective", "frag", "vert", "frag", groupParams };
474
475 testGroup->addChild(new DrawTestCase(testCtx, "flat_0", "Mismatching flat interpolation testcase 0.", paramsFlat0));
476 testGroup->addChild(new DrawTestCase(testCtx, "flat_1", "Mismatching flat interpolation testcase 1.", paramsFlat1));
477
478 testGroup->addChild(new DrawTestCase(testCtx, "noperspective_0", "Mismatching noperspective interpolation testcase 0.", paramsNoPerspective0));
479 testGroup->addChild(new DrawTestCase(testCtx, "noperspective_1", "Mismatching noperspective interpolation testcase 1.", paramsNoPerspective1));
480 }
481
482 } // anonymous
483
createDifferingInterpolationTests(tcu::TestContext & testCtx,const SharedGroupParams groupParams)484 tcu::TestCaseGroup* createDifferingInterpolationTests (tcu::TestContext& testCtx, const SharedGroupParams groupParams)
485 {
486 return createTestGroup(testCtx, "differing_interpolation", "Tests for mismatched interpolation decorations.", createTests, groupParams);
487 }
488
489 } // Draw
490 } // vkt
491