1 /*------------------------------------------------------------------------
2 * Vulkan Conformance Tests
3 * ------------------------
5 * Copyright (c) 2015 The Khronos Group Inc.
6 * Copyright (c) 2015 Imagination Technologies Ltd.
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and/or associated documentation files (the
10 * "Materials"), to deal in the Materials without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sublicense, and/or sell copies of the Materials, and to
13 * permit persons to whom the Materials are furnished to do so, subject to
14 * the following conditions:
16 * The above copyright notice(s) and this permission notice shall be included
17 * in all copies or substantial portions of the Materials.
19 * The Materials are Confidential Information as defined by the
20 * Khronos Membership Agreement until designated non-confidential by Khronos,
21 * at which point this condition clause shall be removed.
23 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
26 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
27 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
28 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
29 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
33 * \brief Vertex Input Tests
34 *//*--------------------------------------------------------------------*/
36 #include "vktPipelineVertexInputTests.hpp"
37 #include "vktPipelineCombinationsIterator.hpp"
38 #include "vktPipelineClearUtil.hpp"
39 #include "vktPipelineImageUtil.hpp"
40 #include "vktPipelineVertexUtil.hpp"
41 #include "vktPipelineReferenceRenderer.hpp"
42 #include "vktTestCase.hpp"
43 #include "vktTestCaseUtil.hpp"
44 #include "vkImageUtil.hpp"
45 #include "vkMemUtil.hpp"
46 #include "vkPrograms.hpp"
47 #include "vkQueryUtil.hpp"
49 #include "vkRefUtil.hpp"
50 #include "tcuFloat.hpp"
51 #include "tcuImageCompare.hpp"
52 #include "deFloat16.h"
54 #include "deStringUtil.hpp"
55 #include "deUniquePtr.hpp"
70 bool isSupportedVertexFormat (const InstanceInterface& instanceInterface, VkPhysicalDevice device, VkFormat format)
72 VkFormatProperties formatProps;
73 deMemset(&formatProps, 0, sizeof(VkFormatProperties));
74 instanceInterface.getPhysicalDeviceFormatProperties(device, format, &formatProps);
76 return (formatProps.bufferFeatures & VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT) != 0u;
79 float getRepresentableDifferenceUnorm (VkFormat format)
81 DE_ASSERT(isVertexFormatUnorm(format) || isVertexFormatSRGB(format));
83 return 1.0f / float((1 << (getVertexFormatComponentSize(format) * 8)) - 1);
86 float getRepresentableDifferenceSnorm (VkFormat format)
88 DE_ASSERT(isVertexFormatSnorm(format));
90 return 1.0f / float((1 << (getVertexFormatComponentSize(format) * 8 - 1)) - 1);
93 class VertexInputTest : public vkt::TestCase
130 GLSL_BASIC_TYPE_UINT,
131 GLSL_BASIC_TYPE_FLOAT,
132 GLSL_BASIC_TYPE_DOUBLE
137 BINDING_MAPPING_ONE_TO_ONE, // Vertex input bindings will not contain data for more than one attribute.
138 BINDING_MAPPING_ONE_TO_MANY // Vertex input bindings can contain data for more than one attribute.
145 VkVertexInputRate inputRate;
148 struct GlslTypeDescription
151 int vertexInputComponentCount;
152 int vertexInputCount;
153 GlslBasicType basicType;
156 static const GlslTypeDescription s_glslTypeDescriptions[GLSL_TYPE_COUNT];
158 VertexInputTest (tcu::TestContext& testContext,
159 const std::string& name,
160 const std::string& description,
161 const std::vector<AttributeInfo>& attributeInfos,
162 BindingMapping bindingMapping);
164 virtual ~VertexInputTest (void) {}
165 virtual void initPrograms (SourceCollections& programCollection) const;
166 virtual TestInstance* createInstance (Context& context) const;
167 static bool isCompatibleType (VkFormat format, GlslType glslType);
170 std::string getGlslInputDeclarations (void) const;
171 std::string getGlslVertexCheck (void) const;
172 std::string getGlslAttributeConditions (const AttributeInfo& attributeInfo, deUint32 attributeIndex) const;
173 static tcu::Vec4 getFormatThreshold (VkFormat format);
175 const std::vector<AttributeInfo> m_attributeInfos;
176 const BindingMapping m_bindingMapping;
179 class GlslTypeCombinationsIterator : public CombinationsIterator< std::vector<VertexInputTest::GlslType> >
182 GlslTypeCombinationsIterator (deUint32 numValues, deUint32 combinationSize);
183 virtual ~GlslTypeCombinationsIterator (void) {}
186 virtual std::vector<VertexInputTest::GlslType> getCombinationValue (const std::vector<deUint32>& combination);
189 std::vector<VertexInputTest::GlslType> m_combinationValue;
192 class VertexInputInstance : public vkt::TestInstance
195 struct VertexInputAttributeDescription
197 VertexInputTest::GlslType glslType;
198 int vertexInputIndex;
199 VkVertexInputAttributeDescription vkDescription;
202 typedef std::vector<VertexInputAttributeDescription> AttributeDescriptionList;
204 VertexInputInstance (Context& context,
205 const AttributeDescriptionList& attributeDescriptions,
206 const std::vector<VkVertexInputBindingDescription>& bindingDescriptions,
207 const std::vector<VkDeviceSize>& bindingOffsets);
209 virtual ~VertexInputInstance (void);
210 virtual tcu::TestStatus iterate (void);
213 static void writeVertexInputData (deUint8* destPtr, const VkVertexInputBindingDescription& bindingDescription, const VkDeviceSize bindingOffset, const AttributeDescriptionList& attributes);
214 static void writeVertexInputValue (deUint8* destPtr, const VertexInputAttributeDescription& attributes, int indexId);
217 tcu::TestStatus verifyImage (void);
220 std::vector<VkBuffer> m_vertexBuffers;
221 std::vector<Allocation*> m_vertexBufferAllocs;
223 const tcu::UVec2 m_renderSize;
224 const VkFormat m_colorFormat;
226 Move<VkImage> m_colorImage;
227 de::MovePtr<Allocation> m_colorImageAlloc;
228 Move<VkImage> m_depthImage;
229 Move<VkImageView> m_colorAttachmentView;
230 Move<VkRenderPass> m_renderPass;
231 Move<VkFramebuffer> m_framebuffer;
233 Move<VkShaderModule> m_vertexShaderModule;
234 Move<VkShaderModule> m_fragmentShaderModule;
236 Move<VkPipelineLayout> m_pipelineLayout;
237 Move<VkPipeline> m_graphicsPipeline;
239 Move<VkCommandPool> m_cmdPool;
240 Move<VkCommandBuffer> m_cmdBuffer;
242 Move<VkFence> m_fence;
245 const VertexInputTest::GlslTypeDescription VertexInputTest::s_glslTypeDescriptions[GLSL_TYPE_COUNT] =
247 { "int", 1, 1, GLSL_BASIC_TYPE_INT },
248 { "ivec2", 2, 1, GLSL_BASIC_TYPE_INT },
249 { "ivec3", 3, 1, GLSL_BASIC_TYPE_INT },
250 { "ivec4", 4, 1, GLSL_BASIC_TYPE_INT },
252 { "uint", 1, 1, GLSL_BASIC_TYPE_UINT },
253 { "uvec2", 2, 1, GLSL_BASIC_TYPE_UINT },
254 { "uvec3", 3, 1, GLSL_BASIC_TYPE_UINT },
255 { "uvec4", 4, 1, GLSL_BASIC_TYPE_UINT },
257 { "float", 1, 1, GLSL_BASIC_TYPE_FLOAT },
258 { "vec2", 2, 1, GLSL_BASIC_TYPE_FLOAT },
259 { "vec3", 3, 1, GLSL_BASIC_TYPE_FLOAT },
260 { "vec4", 4, 1, GLSL_BASIC_TYPE_FLOAT },
261 { "mat2", 2, 2, GLSL_BASIC_TYPE_FLOAT },
262 { "mat3", 3, 3, GLSL_BASIC_TYPE_FLOAT },
263 { "mat4", 4, 4, GLSL_BASIC_TYPE_FLOAT },
265 { "double", 1, 1, GLSL_BASIC_TYPE_DOUBLE },
266 { "dvec2", 2, 1, GLSL_BASIC_TYPE_DOUBLE },
267 { "dvec3", 3, 1, GLSL_BASIC_TYPE_DOUBLE },
268 { "dvec4", 4, 1, GLSL_BASIC_TYPE_DOUBLE },
269 { "dmat2", 2, 2, GLSL_BASIC_TYPE_DOUBLE },
270 { "dmat3", 3, 3, GLSL_BASIC_TYPE_DOUBLE },
271 { "dmat4", 4, 4, GLSL_BASIC_TYPE_DOUBLE }
275 VertexInputTest::VertexInputTest (tcu::TestContext& testContext,
276 const std::string& name,
277 const std::string& description,
278 const std::vector<AttributeInfo>& attributeInfos,
279 BindingMapping bindingMapping)
281 : vkt::TestCase (testContext, name, description)
282 , m_attributeInfos (attributeInfos)
283 , m_bindingMapping (bindingMapping)
287 TestInstance* VertexInputTest::createInstance (Context& context) const
289 // Create enough binding descriptions with random offsets
290 std::vector<VkVertexInputBindingDescription> bindingDescriptions;
291 std::vector<VkDeviceSize> bindingOffsets;
293 for (size_t bindingNdx = 0; bindingNdx < m_attributeInfos.size() * 2; bindingNdx++)
295 // Use STEP_RATE_VERTEX in even bindings and STEP_RATE_INSTANCE in odd bindings
296 const VkVertexInputRate inputRate = (bindingNdx % 2 == 0) ? VK_VERTEX_INPUT_RATE_VERTEX : VK_VERTEX_INPUT_RATE_INSTANCE;
298 // .strideInBytes will be updated when creating the attribute descriptions
299 const VkVertexInputBindingDescription bindingDescription =
301 (deUint32)bindingNdx, // deUint32 binding;
302 0, // deUint32 stride;
303 inputRate // VkVertexInputRate inputRate;
306 bindingDescriptions.push_back(bindingDescription);
307 bindingOffsets.push_back(4 * bindingNdx);
310 // Create attribute descriptions, assign them to bindings and update .strideInBytes
311 std::vector<VertexInputInstance::VertexInputAttributeDescription> attributeDescriptions;
312 deUint32 attributeLocation = 0;
313 std::vector<deUint32> attributeOffsets (bindingDescriptions.size(), 0);
315 for (size_t attributeNdx = 0; attributeNdx < m_attributeInfos.size(); attributeNdx++)
317 const AttributeInfo& attributeInfo = m_attributeInfos[attributeNdx];
318 const GlslTypeDescription& glslTypeDescription = s_glslTypeDescriptions[attributeInfo.glslType];
319 const deUint32 inputSize = getVertexFormatSize(attributeInfo.vkType);
320 deUint32 attributeBinding;
322 if (m_bindingMapping == BINDING_MAPPING_ONE_TO_ONE)
324 if (attributeInfo.inputRate == VK_VERTEX_INPUT_RATE_VERTEX)
326 attributeBinding = (deUint32)attributeNdx * 2; // Odd binding number
328 else // attributeInfo.inputRate == VK_VERTEX_INPUT_STEP_RATE_INSTANCE
330 attributeBinding = (deUint32)attributeNdx * 2 + 1; // Even binding number
333 else // m_bindingMapping == BINDING_MAPPING_ONE_TO_MANY
335 if (attributeInfo.inputRate == VK_VERTEX_INPUT_RATE_VERTEX)
337 attributeBinding = 0;
339 else // attributeInfo.inputRate == VK_VERTEX_INPUT_STEP_RATE_INSTANCE
341 attributeBinding = 1;
345 for (int descNdx = 0; descNdx < glslTypeDescription.vertexInputCount; descNdx++)
347 const VertexInputInstance::VertexInputAttributeDescription attributeDescription =
349 attributeInfo.glslType, // GlslType glslType;
350 descNdx, // int index;
352 attributeLocation, // deUint32 location;
353 attributeBinding, // deUint32 binding;
354 attributeInfo.vkType, // VkFormat format;
355 attributeOffsets[attributeBinding], // deUint32 offset;
359 bindingDescriptions[attributeBinding].stride += inputSize;
360 attributeOffsets[attributeBinding] += inputSize;
364 attributeDescriptions.push_back(attributeDescription);
368 return new VertexInputInstance(context, attributeDescriptions, bindingDescriptions, bindingOffsets);
371 void VertexInputTest::initPrograms (SourceCollections& programCollection) const
373 std::ostringstream vertexSrc;
375 vertexSrc << "#version 440\n"
376 << getGlslInputDeclarations()
377 << "layout(location = 0) out highp vec4 vtxColor;\n"
378 << "out gl_PerVertex {\n"
379 << " vec4 gl_Position;\n"
381 << "double abs (double x) { if (x < 0.0LF) return -x; else return x; }\n" // NOTE: Currently undefined in glslang ??
382 << "void main (void)\n"
384 << getGlslVertexCheck()
387 programCollection.glslSources.add("attribute_test_vert") << glu::VertexSource(vertexSrc.str());
389 programCollection.glslSources.add("attribute_test_frag") << glu::FragmentSource(
391 "layout(location = 0) in highp vec4 vtxColor;\n"
392 "layout(location = 0) out highp vec4 fragColor;\n"
395 " fragColor = vtxColor;\n"
399 std::string VertexInputTest::getGlslInputDeclarations (void) const
401 std::ostringstream glslInputs;
402 deUint32 location = 0;
404 for (size_t attributeNdx = 0; attributeNdx < m_attributeInfos.size(); attributeNdx++)
406 const GlslTypeDescription& glslTypeDesc = s_glslTypeDescriptions[m_attributeInfos[attributeNdx].glslType];
408 glslInputs << "layout(location = " << location << ") in highp " << glslTypeDesc.name << " attr" << attributeNdx << ";\n";
409 location += glslTypeDesc.vertexInputCount;
412 return glslInputs.str();
415 std::string VertexInputTest::getGlslVertexCheck (void) const
417 std::ostringstream glslCode;
418 int totalInputComponentCount = 0;
421 glslCode << " int okCount = 0;\n";
423 for (size_t attributeNdx = 0; attributeNdx < m_attributeInfos.size(); attributeNdx++)
425 glslCode << getGlslAttributeConditions(m_attributeInfos[attributeNdx], (deUint32)attributeNdx);
427 const int vertexInputCount = VertexInputTest::s_glslTypeDescriptions[m_attributeInfos[attributeNdx].glslType].vertexInputCount;
428 totalInputComponentCount += vertexInputCount * VertexInputTest::s_glslTypeDescriptions[m_attributeInfos[attributeNdx].glslType].vertexInputComponentCount;
432 " if (okCount == " << totalInputComponentCount << ")\n"
434 " if (gl_InstanceIndex == 0)\n"
435 " vtxColor = vec4(1.0, 0.0, 0.0, 1.0);\n"
437 " vtxColor = vec4(0.0, 0.0, 1.0, 1.0);\n"
441 " vtxColor = vec4(okCount / float(" << totalInputComponentCount << "), 0.0f, 0.0f, 1.0);\n" <<
443 " if (gl_InstanceIndex == 0)\n"
445 " if (gl_VertexIndex == 0) gl_Position = vec4(-1.0, -1.0, 0.0, 1.0);\n"
446 " else if (gl_VertexIndex == 1) gl_Position = vec4(0.0, -1.0, 0.0, 1.0);\n"
447 " else if (gl_VertexIndex == 2) gl_Position = vec4(-1.0, 1.0, 0.0, 1.0);\n"
448 " else if (gl_VertexIndex == 3) gl_Position = vec4(0.0, 1.0, 0.0, 1.0);\n"
449 " else gl_Position = vec4(0.0);\n"
453 " if (gl_VertexIndex == 0) gl_Position = vec4(0.0, -1.0, 0.0, 1.0);\n"
454 " else if (gl_VertexIndex == 1) gl_Position = vec4(1.0, -1.0, 0.0, 1.0);\n"
455 " else if (gl_VertexIndex == 2) gl_Position = vec4(0.0, 1.0, 0.0, 1.0);\n"
456 " else if (gl_VertexIndex == 3) gl_Position = vec4(1.0, 1.0, 0.0, 1.0);\n"
457 " else gl_Position = vec4(0.0);\n"
460 return glslCode.str();
463 std::string VertexInputTest::getGlslAttributeConditions (const AttributeInfo& attributeInfo, deUint32 attributeIndex) const
465 std::ostringstream glslCode;
466 std::ostringstream attributeVar;
467 const std::string indexId = (attributeInfo.inputRate == VK_VERTEX_INPUT_RATE_VERTEX) ? "gl_VertexIndex" : "gl_InstanceIndex";
468 const int componentCount = VertexInputTest::s_glslTypeDescriptions[attributeInfo.glslType].vertexInputComponentCount;
469 const int vertexInputCount = VertexInputTest::s_glslTypeDescriptions[attributeInfo.glslType].vertexInputCount;
470 const deUint32 totalComponentCount = componentCount * vertexInputCount;
471 const tcu::Vec4 threshold = getFormatThreshold(attributeInfo.vkType);
472 deUint32 componentIndex = 0;
474 attributeVar << "attr" << attributeIndex;
476 glslCode << std::fixed;
478 for (int columnNdx = 0; columnNdx< vertexInputCount; columnNdx++)
480 for (int rowNdx = 0; rowNdx < componentCount; rowNdx++)
482 std::string accessStr;
484 // Build string representing the access to the attribute component
485 std::ostringstream accessStream;
486 accessStream << attributeVar.str();
488 if (vertexInputCount == 1)
490 if (componentCount > 1)
491 accessStream << "[" << rowNdx << "]";
495 accessStream << "[" << columnNdx << "][" << rowNdx << "]";
498 accessStr = accessStream.str();
501 if (isVertexFormatSint(attributeInfo.vkType))
503 glslCode << "\tif (" << accessStr << " == -(" << totalComponentCount << " * " << indexId << " + " << componentIndex << "))\n";
505 else if (isVertexFormatUint(attributeInfo.vkType))
507 glslCode << "\tif (" << accessStr << " == uint(" << totalComponentCount << " * " << indexId << " + " << componentIndex << "))\n";
509 else if (isVertexFormatSfloat(attributeInfo.vkType))
511 if (VertexInputTest::s_glslTypeDescriptions[attributeInfo.glslType].basicType == VertexInputTest::GLSL_BASIC_TYPE_DOUBLE)
513 glslCode << "\tif (abs(" << accessStr << " + double(0.01 * (" << totalComponentCount << ".0 * float(" << indexId << ") + " << componentIndex << ".0))) < double(" << threshold[rowNdx] << "))\n";
517 glslCode << "\tif (abs(" << accessStr << " + (0.01 * (" << totalComponentCount << ".0 * float(" << indexId << ") + " << componentIndex << ".0))) < " << threshold[rowNdx] << ")\n";
520 else if (isVertexFormatSscaled(attributeInfo.vkType))
522 glslCode << "\tif (abs(" << accessStr << " + (" << totalComponentCount << ".0 * float(" << indexId << ") + " << componentIndex << ".0)) < " << threshold[rowNdx] << ")\n";
524 else if (isVertexFormatUscaled(attributeInfo.vkType))
526 glslCode << "\t if (abs(" << accessStr << " - (" << totalComponentCount << ".0 * float(" << indexId << ") + " << componentIndex << ".0)) < " << threshold[rowNdx] << ")\n";
528 else if (isVertexFormatSnorm(attributeInfo.vkType))
530 const float representableDiff = getRepresentableDifferenceSnorm(attributeInfo.vkType);
532 glslCode << "\tif (abs(" << accessStr << " - (-1.0 + " << representableDiff << " * (" << totalComponentCount << ".0 * float(" << indexId << ") + " << componentIndex << ".0))) < " << threshold[rowNdx] << ")\n";
534 else if (isVertexFormatUnorm(attributeInfo.vkType) || isVertexFormatSRGB(attributeInfo.vkType))
536 const float representableDiff = getRepresentableDifferenceUnorm(attributeInfo.vkType);
538 glslCode << "\tif (abs(" << accessStr << " - " << "(" << representableDiff << " * (" << totalComponentCount << ".0 * float(" << indexId << ") + " << componentIndex << ".0))) < " << threshold[rowNdx] << ")\n";
545 glslCode << "\t\tokCount++;\n\n";
550 return glslCode.str();
553 tcu::Vec4 VertexInputTest::getFormatThreshold (VkFormat format)
559 case VK_FORMAT_R32_SFLOAT:
560 case VK_FORMAT_R32G32_SFLOAT:
561 case VK_FORMAT_R32G32B32_SFLOAT:
562 case VK_FORMAT_R32G32B32A32_SFLOAT:
563 case VK_FORMAT_R64_SFLOAT:
564 case VK_FORMAT_R64G64_SFLOAT:
565 case VK_FORMAT_R64G64B64_SFLOAT:
566 case VK_FORMAT_R64G64B64A64_SFLOAT:
567 return Vec4(0.00001f);
573 if (isVertexFormatSnorm(format))
575 return Vec4(1.5f * getRepresentableDifferenceSnorm(format));
577 else if (isVertexFormatUnorm(format))
579 return Vec4(1.5f * getRepresentableDifferenceUnorm(format));
585 GlslTypeCombinationsIterator::GlslTypeCombinationsIterator (deUint32 numValues, deUint32 combinationSize)
586 : CombinationsIterator< std::vector<VertexInputTest::GlslType> > (numValues, combinationSize)
587 , m_combinationValue (std::vector<VertexInputTest::GlslType>(combinationSize))
589 DE_ASSERT(numValues <= VertexInputTest::GLSL_TYPE_COUNT);
592 std::vector<VertexInputTest::GlslType> GlslTypeCombinationsIterator::getCombinationValue (const std::vector<deUint32>& combination)
594 for (size_t combinationItemNdx = 0; combinationItemNdx < combination.size(); combinationItemNdx++)
595 m_combinationValue[combinationItemNdx] = (VertexInputTest::GlslType)combination[combinationItemNdx];
597 return m_combinationValue;
600 VertexInputInstance::VertexInputInstance (Context& context,
601 const AttributeDescriptionList& attributeDescriptions,
602 const std::vector<VkVertexInputBindingDescription>& bindingDescriptions,
603 const std::vector<VkDeviceSize>& bindingOffsets)
604 : vkt::TestInstance (context)
605 , m_renderSize (16, 16)
606 , m_colorFormat (VK_FORMAT_R8G8B8A8_UNORM)
608 DE_ASSERT(bindingDescriptions.size() == bindingOffsets.size());
610 const DeviceInterface& vk = context.getDeviceInterface();
611 const VkDevice vkDevice = context.getDevice();
612 const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex();
613 SimpleAllocator memAlloc (vk, vkDevice, getPhysicalDeviceMemoryProperties(context.getInstanceInterface(), context.getPhysicalDevice()));
614 const VkComponentMapping componentMappingRGBA = { VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_A };
616 // Create color image
618 const VkImageCreateInfo colorImageParams =
620 VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, // VkStructureType sType;
621 DE_NULL, // const void* pNext;
622 0u, // VkImageCreateFlags flags;
623 VK_IMAGE_TYPE_2D, // VkImageType imageType;
624 m_colorFormat, // VkFormat format;
625 { m_renderSize.x(), m_renderSize.y(), 1u }, // VkExtent3D extent;
626 1u, // deUint32 mipLevels;
627 1u, // deUint32 arrayLayers;
628 VK_SAMPLE_COUNT_1_BIT, // VkSampleCountFlagBits samples;
629 VK_IMAGE_TILING_OPTIMAL, // VkImageTiling tiling;
630 VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT, // VkImageUsageFlags usage;
631 VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode;
632 1u, // deUint32 queueFamilyIndexCount;
633 &queueFamilyIndex, // const deUint32* pQueueFamilyIndices;
634 VK_IMAGE_LAYOUT_UNDEFINED, // VkImageLayout initialLayout;
637 m_colorImage = createImage(vk, vkDevice, &colorImageParams);
639 // Allocate and bind color image memory
640 m_colorImageAlloc = memAlloc.allocate(getImageMemoryRequirements(vk, vkDevice, *m_colorImage), MemoryRequirement::Any);
641 VK_CHECK(vk.bindImageMemory(vkDevice, *m_colorImage, m_colorImageAlloc->getMemory(), m_colorImageAlloc->getOffset()));
644 // Create color attachment view
646 const VkImageViewCreateInfo colorAttachmentViewParams =
648 VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, // VkStructureType sType;
649 DE_NULL, // const void* pNext;
650 0u, // VkImageViewCreateFlags flags;
651 *m_colorImage, // VkImage image;
652 VK_IMAGE_VIEW_TYPE_2D, // VkImageViewType viewType;
653 m_colorFormat, // VkFormat format;
654 componentMappingRGBA, // VkComponentMapping components;
655 { VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u }, // VkImageSubresourceRange subresourceRange;
658 m_colorAttachmentView = createImageView(vk, vkDevice, &colorAttachmentViewParams);
661 // Create render pass
663 const VkAttachmentDescription colorAttachmentDescription =
665 0u, // VkAttachmentDescriptionFlags flags;
666 m_colorFormat, // VkFormat format;
667 VK_SAMPLE_COUNT_1_BIT, // VkSampleCountFlagBits samples;
668 VK_ATTACHMENT_LOAD_OP_CLEAR, // VkAttachmentLoadOp loadOp;
669 VK_ATTACHMENT_STORE_OP_STORE, // VkAttachmentStoreOp storeOp;
670 VK_ATTACHMENT_LOAD_OP_DONT_CARE, // VkAttachmentLoadOp stencilLoadOp;
671 VK_ATTACHMENT_STORE_OP_DONT_CARE, // VkAttachmentStoreOp stencilStoreOp;
672 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, // VkImageLayout initialLayout;
673 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL // VkImageLayout finalLayout;
676 const VkAttachmentReference colorAttachmentReference =
678 0u, // deUint32 attachment;
679 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL // VkImageLayout layout;
682 const VkSubpassDescription subpassDescription =
684 0u, // VkSubpassDescriptionFlags flags;
685 VK_PIPELINE_BIND_POINT_GRAPHICS, // VkPipelineBindPoint pipelineBindPoint;
686 0u, // deUint32 inputAttachmentCount;
687 DE_NULL, // const VkAttachmentReference* pInputAttachments;
688 1u, // deUint32 colorAttachmentCount;
689 &colorAttachmentReference, // const VkAttachmentReference* pColorAttachments;
690 DE_NULL, // const VkAttachmentReference* pResolveAttachments;
691 DE_NULL, // const VkAttachmentReference* pDepthStencilAttachment;
692 0u, // deUint32 preserveAttachmentCount;
693 DE_NULL // const VkAttachmentReference* pPreserveAttachments;
696 const VkRenderPassCreateInfo renderPassParams =
698 VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, // VkStructureType sType;
699 DE_NULL, // const void* pNext;
700 0u, // VkRenderPassCreateFlags flags;
701 1u, // deUint32 attachmentCount;
702 &colorAttachmentDescription, // const VkAttachmentDescription* pAttachments;
703 1u, // deUint32 subpassCount;
704 &subpassDescription, // const VkSubpassDescription* pSubpasses;
705 0u, // deUint32 dependencyCount;
706 DE_NULL // const VkSubpassDependency* pDependencies;
709 m_renderPass = createRenderPass(vk, vkDevice, &renderPassParams);
712 // Create framebuffer
714 const VkFramebufferCreateInfo framebufferParams =
716 VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, // VkStructureType sType;
717 DE_NULL, // const void* pNext;
718 0u, // VkFramebufferCreateFlags flags;
719 *m_renderPass, // VkRenderPass renderPass;
720 1u, // deUint32 attachmentCount;
721 &m_colorAttachmentView.get(), // const VkImageView* pAttachments;
722 (deUint32)m_renderSize.x(), // deUint32 width;
723 (deUint32)m_renderSize.y(), // deUint32 height;
724 1u // deUint32 layers;
727 m_framebuffer = createFramebuffer(vk, vkDevice, &framebufferParams);
730 // Create pipeline layout
732 const VkPipelineLayoutCreateInfo pipelineLayoutParams =
734 VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, // VkStructureType sType;
735 DE_NULL, // const void* pNext;
736 0u, // VkPipelineLayoutCreateFlags flags;
737 0u, // deUint32 setLayoutCount;
738 DE_NULL, // const VkDescriptorSetLayout* pSetLayouts;
739 0u, // deUint32 pushConstantRangeCount;
740 DE_NULL // const VkPushConstantRange* pPushConstantRanges;
743 m_pipelineLayout = createPipelineLayout(vk, vkDevice, &pipelineLayoutParams);
746 m_vertexShaderModule = createShaderModule(vk, vkDevice, m_context.getBinaryCollection().get("attribute_test_vert"), 0);
747 m_fragmentShaderModule = createShaderModule(vk, vkDevice, m_context.getBinaryCollection().get("attribute_test_frag"), 0);
752 const VkPipelineShaderStageCreateInfo shaderStageParams[2] =
755 VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, // VkStructureType sType;
756 DE_NULL, // const void* pNext;
757 0u, // VkPipelineShaderStageCreateFlags flags;
758 VK_SHADER_STAGE_VERTEX_BIT, // VkShaderStageFlagBits stage;
759 *m_vertexShaderModule, // VkShaderModule module;
760 "main", // const char* pName;
761 DE_NULL // const VkSpecializationInfo* pSpecializationInfo;
764 VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, // VkStructureType sType;
765 DE_NULL, // const void* pNext;
766 0u, // VkPipelineShaderStageCreateFlags flags;
767 VK_SHADER_STAGE_FRAGMENT_BIT, // VkShaderStageFlagBits stage;
768 *m_fragmentShaderModule, // VkShaderModule module;
769 "main", // const char* pName;
770 DE_NULL // const VkSpecializationInfo* pSpecializationInfo;
774 // Create vertex attribute array and check if their VK formats are supported
775 std::vector<VkVertexInputAttributeDescription> vkAttributeDescriptions;
776 for (size_t attributeNdx = 0; attributeNdx < attributeDescriptions.size(); attributeNdx++)
778 const VkVertexInputAttributeDescription& attributeDescription = attributeDescriptions[attributeNdx].vkDescription;
780 if (!isSupportedVertexFormat(context.getInstanceInterface(), context.getPhysicalDevice(), attributeDescription.format))
781 throw tcu::NotSupportedError(std::string("Unsupported format for vertex input: ") + getFormatName(attributeDescription.format));
783 vkAttributeDescriptions.push_back(attributeDescription);
786 const VkPipelineVertexInputStateCreateInfo vertexInputStateParams =
788 VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO, // VkStructureType sType;
789 DE_NULL, // const void* pNext;
790 0u, // VkPipelineVertexInputStateCreateFlags flags;
791 (deUint32)bindingDescriptions.size(), // deUint32 vertexBindingDescriptionCount;
792 bindingDescriptions.data(), // const VkVertexInputBindingDescription* pVertexBindingDescriptions;
793 (deUint32)vkAttributeDescriptions.size(), // deUint32 vertexAttributeDescriptionCount;
794 vkAttributeDescriptions.data() // const VkVertexInputAttributeDescription* pVertexAttributeDescriptions;
797 const VkPipelineInputAssemblyStateCreateInfo inputAssemblyStateParams =
799 VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, // VkStructureType sType;
800 DE_NULL, // const void* pNext;
801 0u, // VkPipelineInputAssemblyStateCreateFlags flags;
802 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP, // VkPrimitiveTopology topology;
803 false // VkBool32 primitiveRestartEnable;
806 const VkViewport viewport =
810 (float)m_renderSize.x(), // float width;
811 (float)m_renderSize.y(), // float height;
812 0.0f, // float minDepth;
813 1.0f // float maxDepth;
816 const VkRect2D scissor = { { 0, 0 }, { m_renderSize.x(), m_renderSize.y() } };
818 const VkPipelineViewportStateCreateInfo viewportStateParams =
820 VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, // VkStructureType sType;
821 DE_NULL, // const void* pNext;
822 0u, // VkPipelineViewportStateCreateFlags flags;
823 1u, // deUint32 viewportCount;
824 &viewport, // const VkViewport* pViewports;
825 1u, // deUint32 scissorCount;
826 &scissor // const VkRect2D* pScissors;
829 const VkPipelineRasterizationStateCreateInfo rasterStateParams =
831 VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, // VkStructureType sType;
832 DE_NULL, // const void* pNext;
833 0u, // VkPipelineRasterizationStateCreateFlags flags;
834 false, // VkBool32 depthClampEnable;
835 false, // VkBool32 rasterizerDiscardEnable;
836 VK_POLYGON_MODE_FILL, // VkPolygonMode polygonMode;
837 VK_CULL_MODE_NONE, // VkCullModeFlags cullMode;
838 VK_FRONT_FACE_COUNTER_CLOCKWISE, // VkFrontFace frontFace;
839 VK_FALSE, // VkBool32 depthBiasEnable;
840 0.0f, // float depthBiasConstantFactor;
841 0.0f, // float depthBiasClamp;
842 0.0f, // float depthBiasSlopeFactor;
843 1.0f, // float lineWidth;
846 const VkPipelineColorBlendAttachmentState colorBlendAttachmentState =
848 false, // VkBool32 blendEnable;
849 VK_BLEND_FACTOR_ONE, // VkBlendFactor srcColorBlendFactor;
850 VK_BLEND_FACTOR_ZERO, // VkBlendFactor dstColorBlendFactor;
851 VK_BLEND_OP_ADD, // VkBlendOp colorBlendOp;
852 VK_BLEND_FACTOR_ONE, // VkBlendFactor srcAlphaBlendFactor;
853 VK_BLEND_FACTOR_ZERO, // VkBlendFactor dstAlphaBlendFactor;
854 VK_BLEND_OP_ADD, // VkBlendOp alphaBlendOp;
855 VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | // VkColorComponentFlags colorWriteMask;
856 VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT
859 const VkPipelineColorBlendStateCreateInfo colorBlendStateParams =
861 VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, // VkStructureType sType;
862 DE_NULL, // const void* pNext;
863 0u, // VkPipelineColorBlendStateCreateFlags flags;
864 false, // VkBool32 logicOpEnable;
865 VK_LOGIC_OP_COPY, // VkLogicOp logicOp;
866 1u, // deUint32 attachmentCount;
867 &colorBlendAttachmentState, // const VkPipelineColorBlendAttachmentState* pAttachments;
868 { 0.0f, 0.0f, 0.0f, 0.0f }, // float blendConstants[4];
871 const VkPipelineMultisampleStateCreateInfo multisampleStateParams =
873 VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, // VkStructureType sType;
874 DE_NULL, // const void* pNext;
875 0u, // VkPipelineMultisampleStateCreateFlags flags;
876 VK_SAMPLE_COUNT_1_BIT, // VkSampleCountFlagBits rasterizationSamples;
877 false, // VkBool32 sampleShadingEnable;
878 0.0f, // float minSampleShading;
879 DE_NULL, // const VkSampleMask* pSampleMask;
880 false, // VkBool32 alphaToCoverageEnable;
881 false // VkBool32 alphaToOneEnable;
884 const VkPipelineDynamicStateCreateInfo dynamicStateParams =
886 VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, // VkStructureType sType;
887 DE_NULL, // const void* pNext;
888 0u, // VkPipelineDynamicStateCreateFlags flags;
889 0u, // deUint32 dynamicStateCount;
890 DE_NULL // const VkDynamicState* pDynamicStates;
893 VkPipelineDepthStencilStateCreateInfo depthStencilStateParams =
895 VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO, // VkStructureType sType;
896 DE_NULL, // const void* pNext;
897 0u, // VkPipelineDepthStencilStateCreateFlags flags;
898 false, // VkBool32 depthTestEnable;
899 false, // VkBool32 depthWriteEnable;
900 VK_COMPARE_OP_LESS, // VkCompareOp depthCompareOp;
901 false, // VkBool32 depthBoundsTestEnable;
902 false, // VkBool32 stencilTestEnable;
903 // VkStencilOpState front;
905 VK_STENCIL_OP_KEEP, // VkStencilOp failOp;
906 VK_STENCIL_OP_KEEP, // VkStencilOp passOp;
907 VK_STENCIL_OP_KEEP, // VkStencilOp depthFailOp;
908 VK_COMPARE_OP_NEVER, // VkCompareOp compareOp;
909 0u, // deUint32 compareMask;
910 0u, // deUint32 writeMask;
911 0u, // deUint32 reference;
913 // VkStencilOpState back;
915 VK_STENCIL_OP_KEEP, // VkStencilOp failOp;
916 VK_STENCIL_OP_KEEP, // VkStencilOp passOp;
917 VK_STENCIL_OP_KEEP, // VkStencilOp depthFailOp;
918 VK_COMPARE_OP_NEVER, // VkCompareOp compareOp;
919 0u, // deUint32 compareMask;
920 0u, // deUint32 writeMask;
921 0u, // deUint32 reference;
923 -1.0f, // float minDepthBounds;
924 +1.0f, // float maxDepthBounds;
927 const VkGraphicsPipelineCreateInfo graphicsPipelineParams =
929 VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO, // VkStructureType sType;
930 DE_NULL, // const void* pNext;
931 0u, // VkPipelineCreateFlags flags;
932 2u, // deUint32 stageCount;
933 shaderStageParams, // const VkPipelineShaderStageCreateInfo* pStages;
934 &vertexInputStateParams, // const VkPipelineVertexInputStateCreateInfo* pVertexInputState;
935 &inputAssemblyStateParams, // const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState;
936 DE_NULL, // const VkPipelineTessellationStateCreateInfo* pTessellationState;
937 &viewportStateParams, // const VkPipelineViewportStateCreateInfo* pViewportState;
938 &rasterStateParams, // const VkPipelineRasterizationStateCreateInfo* pRasterizationState;
939 &multisampleStateParams, // const VkPipelineMultisampleStateCreateInfo* pMultisampleState;
940 &depthStencilStateParams, // const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState;
941 &colorBlendStateParams, // const VkPipelineColorBlendStateCreateInfo* pColorBlendState;
942 &dynamicStateParams, // const VkPipelineDynamicStateCreateInfo* pDynamicState;
943 *m_pipelineLayout, // VkPipelineLayout layout;
944 *m_renderPass, // VkRenderPass renderPass;
945 0u, // deUint32 subpass;
946 0u, // VkPipeline basePipelineHandle;
947 0u // deInt32 basePipelineIndex;
950 m_graphicsPipeline = createGraphicsPipeline(vk, vkDevice, DE_NULL, &graphicsPipelineParams);
953 // Create vertex buffer
955 const VkBufferCreateInfo vertexBufferParams =
957 VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // VkStructureType sType;
958 DE_NULL, // const void* pNext;
959 0u, // VkBufferCreateFlags flags;
960 4096u, // VkDeviceSize size;
961 VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, // VkBufferUsageFlags usage;
962 VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode;
963 1u, // deUint32 queueFamilyIndexCount;
964 &queueFamilyIndex // const deUint32* pQueueFamilyIndices;
967 // Upload data for each vertex input binding
968 for (deUint32 bindingNdx = 0; bindingNdx < bindingDescriptions.size(); bindingNdx++)
970 Move<VkBuffer> vertexBuffer = createBuffer(vk, vkDevice, &vertexBufferParams);
971 de::MovePtr<Allocation> vertexBufferAlloc = memAlloc.allocate(getBufferMemoryRequirements(vk, vkDevice, *vertexBuffer), MemoryRequirement::HostVisible);
973 VK_CHECK(vk.bindBufferMemory(vkDevice, *vertexBuffer, vertexBufferAlloc->getMemory(), vertexBufferAlloc->getOffset()));
975 writeVertexInputData((deUint8*)vertexBufferAlloc->getHostPtr(), bindingDescriptions[bindingNdx], bindingOffsets[bindingNdx], attributeDescriptions);
976 flushMappedMemoryRange(vk, vkDevice, vertexBufferAlloc->getMemory(), vertexBufferAlloc->getOffset(), vertexBufferParams.size);
978 m_vertexBuffers.push_back(vertexBuffer.disown());
979 m_vertexBufferAllocs.push_back(vertexBufferAlloc.release());
983 // Create command pool
985 const VkCommandPoolCreateInfo cmdPoolParams =
987 VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, // VkStructureType sType;
988 DE_NULL, // const void* pNext;
989 VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, // VkCommandPoolCreateFlags flags;
990 queueFamilyIndex, // deUint32 queueFamilyIndex;
993 m_cmdPool = createCommandPool(vk, vkDevice, &cmdPoolParams);
996 // Create command buffer
998 const VkCommandBufferAllocateInfo cmdBufferAllocateInfo =
1000 VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, // VkStructureType sType;
1001 DE_NULL, // const void* pNext;
1002 *m_cmdPool, // VkCommandPool commandPool;
1003 VK_COMMAND_BUFFER_LEVEL_PRIMARY, // VkCommandBufferLevel level;
1004 1u // deUint32 bufferCount;
1007 const VkCommandBufferBeginInfo cmdBufferBeginInfo =
1009 VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, // VkStructureType sType;
1010 DE_NULL, // const void* pNext;
1011 0u, // VkCommandBufferUsageFlags flags;
1012 (const VkCommandBufferInheritanceInfo*)DE_NULL,
1015 const VkClearValue attachmentClearValue = defaultClearValue(m_colorFormat);
1017 const VkRenderPassBeginInfo renderPassBeginInfo =
1019 VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, // VkStructureType sType;
1020 DE_NULL, // const void* pNext;
1021 *m_renderPass, // VkRenderPass renderPass;
1022 *m_framebuffer, // VkFramebuffer framebuffer;
1023 { { 0, 0 }, { m_renderSize.x(), m_renderSize.y() } }, // VkRect2D renderArea;
1024 1u, // deUint32 clearValueCount;
1025 &attachmentClearValue // const VkClearValue* pClearValues;
1028 m_cmdBuffer = allocateCommandBuffer(vk, vkDevice, &cmdBufferAllocateInfo);
1030 VK_CHECK(vk.beginCommandBuffer(*m_cmdBuffer, &cmdBufferBeginInfo));
1031 vk.cmdBeginRenderPass(*m_cmdBuffer, &renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE);
1033 vk.cmdBindPipeline(*m_cmdBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, *m_graphicsPipeline);
1035 std::vector<VkBuffer> vertexBuffers;
1036 for (size_t bufferNdx = 0; bufferNdx < m_vertexBuffers.size(); bufferNdx++)
1037 vertexBuffers.push_back(m_vertexBuffers[bufferNdx]);
1039 if (vertexBuffers.size() <= 1)
1041 // One vertex buffer
1042 vk.cmdBindVertexBuffers(*m_cmdBuffer, 0, (deUint32)vertexBuffers.size(), vertexBuffers.data(), bindingOffsets.data());
1046 // Smoke-test vkCmdBindVertexBuffers(..., startBinding, ... )
1048 const deUint32 firstHalfLength = (deUint32)vertexBuffers.size() / 2;
1049 const deUint32 secondHalfLength = firstHalfLength + (deUint32)(vertexBuffers.size() % 2);
1051 // Bind first half of vertex buffers
1052 vk.cmdBindVertexBuffers(*m_cmdBuffer, 0, firstHalfLength, vertexBuffers.data(), bindingOffsets.data());
1054 // Bind second half of vertex buffers
1055 vk.cmdBindVertexBuffers(*m_cmdBuffer, firstHalfLength, secondHalfLength,
1056 vertexBuffers.data() + firstHalfLength,
1057 bindingOffsets.data() + firstHalfLength);
1060 vk.cmdDraw(*m_cmdBuffer, 4, 2, 0, 0);
1062 vk.cmdEndRenderPass(*m_cmdBuffer);
1063 VK_CHECK(vk.endCommandBuffer(*m_cmdBuffer));
1068 const VkFenceCreateInfo fenceParams =
1070 VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, // VkStructureType sType;
1071 DE_NULL, // const void* pNext;
1072 0u // VkFenceCreateFlags flags;
1075 m_fence = createFence(vk, vkDevice, &fenceParams);
1079 VertexInputInstance::~VertexInputInstance (void)
1081 const DeviceInterface& vk = m_context.getDeviceInterface();
1082 const VkDevice vkDevice = m_context.getDevice();
1084 for (size_t bufferNdx = 0; bufferNdx < m_vertexBuffers.size(); bufferNdx++)
1085 vk.destroyBuffer(vkDevice, m_vertexBuffers[bufferNdx], DE_NULL);
1087 for (size_t allocNdx = 0; allocNdx < m_vertexBufferAllocs.size(); allocNdx++)
1088 delete m_vertexBufferAllocs[allocNdx];
1091 void VertexInputInstance::writeVertexInputData(deUint8* destPtr, const VkVertexInputBindingDescription& bindingDescription, const VkDeviceSize bindingOffset, const AttributeDescriptionList& attributes)
1093 const deUint32 vertexCount = (bindingDescription.inputRate == VK_VERTEX_INPUT_RATE_VERTEX) ? (4 * 2) : 2;
1095 deUint8* destOffsetPtr = ((deUint8 *)destPtr) + bindingOffset;
1096 for (deUint32 vertexNdx = 0; vertexNdx < vertexCount; vertexNdx++)
1098 deUint32 vertexInputOffset = 0;
1099 for (size_t attributeNdx = 0; attributeNdx < attributes.size(); attributeNdx++)
1101 const VertexInputAttributeDescription& attribDesc = attributes[attributeNdx];
1103 // Only write vertex input data to bindings referenced by attribute descriptions
1104 if (attribDesc.vkDescription.binding == bindingDescription.binding)
1106 writeVertexInputValue(destOffsetPtr + vertexInputOffset, attribDesc, vertexNdx);
1107 vertexInputOffset += getVertexFormatSize(attribDesc.vkDescription.format);
1110 DE_ASSERT(vertexInputOffset <= bindingDescription.stride);
1111 destOffsetPtr += bindingDescription.stride;
1115 void writeVertexInputValueSint (deUint8* destPtr, VkFormat format, int componentNdx, deInt32 value)
1117 const deUint32 componentSize = getVertexFormatComponentSize(format);
1118 deUint8* destFormatPtr = ((deUint8*)destPtr) + componentSize * componentNdx;
1120 switch (componentSize)
1123 *((deInt8*)destFormatPtr) = (deInt8)value;
1127 *((deInt16*)destFormatPtr) = (deInt16)value;
1131 *((deInt32*)destFormatPtr) = (deInt32)value;
1139 void writeVertexInputValueUint (deUint8* destPtr, VkFormat format, int componentNdx, deUint32 value)
1141 const deUint32 componentSize = getVertexFormatComponentSize(format);
1142 deUint8* destFormatPtr = ((deUint8*)destPtr) + componentSize * componentNdx;
1144 switch (componentSize)
1147 *((deUint8 *)destFormatPtr) = (deUint8)value;
1151 *((deUint16 *)destFormatPtr) = (deUint16)value;
1155 *((deUint32 *)destFormatPtr) = (deUint32)value;
1163 void writeVertexInputValueSfloat (deUint8* destPtr, VkFormat format, int componentNdx, float value)
1165 const deUint32 componentSize = getVertexFormatComponentSize(format);
1166 deUint8* destFormatPtr = ((deUint8*)destPtr) + componentSize * componentNdx;
1168 switch (componentSize)
1171 *((deFloat16*)destFormatPtr) = deFloat32To16(value);
1175 *((float*)destFormatPtr) = value;
1183 void VertexInputInstance::writeVertexInputValue (deUint8* destPtr, const VertexInputAttributeDescription& attribute, int indexId)
1185 const int vertexInputCount = VertexInputTest::s_glslTypeDescriptions[attribute.glslType].vertexInputCount;
1186 const int componentCount = VertexInputTest::s_glslTypeDescriptions[attribute.glslType].vertexInputComponentCount;
1187 const deUint32 totalComponentCount = componentCount * vertexInputCount;
1188 const deUint32 vertexInputIndex = indexId * totalComponentCount + attribute.vertexInputIndex * componentCount;
1189 const bool hasBGROrder = isVertexFormatComponentOrderBGR(attribute.vkDescription.format);
1192 for (int componentNdx = 0; componentNdx < componentCount; componentNdx++)
1196 if (componentNdx == 0)
1198 else if (componentNdx == 2)
1201 swizzledNdx = componentNdx;
1204 swizzledNdx = componentNdx;
1206 switch (attribute.glslType)
1208 case VertexInputTest::GLSL_TYPE_INT:
1209 case VertexInputTest::GLSL_TYPE_IVEC2:
1210 case VertexInputTest::GLSL_TYPE_IVEC3:
1211 case VertexInputTest::GLSL_TYPE_IVEC4:
1212 writeVertexInputValueSint(destPtr, attribute.vkDescription.format, componentNdx, -(deInt32)(vertexInputIndex + swizzledNdx));
1215 case VertexInputTest::GLSL_TYPE_UINT:
1216 case VertexInputTest::GLSL_TYPE_UVEC2:
1217 case VertexInputTest::GLSL_TYPE_UVEC3:
1218 case VertexInputTest::GLSL_TYPE_UVEC4:
1219 writeVertexInputValueUint(destPtr, attribute.vkDescription.format, componentNdx, vertexInputIndex + swizzledNdx);
1222 case VertexInputTest::GLSL_TYPE_FLOAT:
1223 case VertexInputTest::GLSL_TYPE_VEC2:
1224 case VertexInputTest::GLSL_TYPE_VEC3:
1225 case VertexInputTest::GLSL_TYPE_VEC4:
1226 case VertexInputTest::GLSL_TYPE_MAT2:
1227 case VertexInputTest::GLSL_TYPE_MAT3:
1228 case VertexInputTest::GLSL_TYPE_MAT4:
1229 if (isVertexFormatSfloat(attribute.vkDescription.format))
1231 writeVertexInputValueSfloat(destPtr, attribute.vkDescription.format, componentNdx, -(0.01f * (float)(vertexInputIndex + swizzledNdx)));
1233 else if (isVertexFormatSscaled(attribute.vkDescription.format))
1235 writeVertexInputValueSint(destPtr, attribute.vkDescription.format, componentNdx, -(deInt32)(vertexInputIndex + swizzledNdx));
1237 else if (isVertexFormatUscaled(attribute.vkDescription.format) || isVertexFormatUnorm(attribute.vkDescription.format) || isVertexFormatSRGB(attribute.vkDescription.format))
1239 writeVertexInputValueUint(destPtr, attribute.vkDescription.format, componentNdx, vertexInputIndex + swizzledNdx);
1241 else if (isVertexFormatSnorm(attribute.vkDescription.format))
1243 const deInt32 minIntValue = -((1 << (getVertexFormatComponentSize(attribute.vkDescription.format) * 8 - 1))) + 1;
1244 writeVertexInputValueSint(destPtr, attribute.vkDescription.format, componentNdx, minIntValue + (vertexInputIndex + swizzledNdx));
1250 case VertexInputTest::GLSL_TYPE_DOUBLE:
1251 case VertexInputTest::GLSL_TYPE_DVEC2:
1252 case VertexInputTest::GLSL_TYPE_DVEC3:
1253 case VertexInputTest::GLSL_TYPE_DVEC4:
1254 case VertexInputTest::GLSL_TYPE_DMAT2:
1255 case VertexInputTest::GLSL_TYPE_DMAT3:
1256 case VertexInputTest::GLSL_TYPE_DMAT4:
1257 *(reinterpret_cast<double *>(destPtr) + componentNdx) = -0.01 * (vertexInputIndex + swizzledNdx);
1267 tcu::TestStatus VertexInputInstance::iterate (void)
1269 const DeviceInterface& vk = m_context.getDeviceInterface();
1270 const VkDevice vkDevice = m_context.getDevice();
1271 const VkQueue queue = m_context.getUniversalQueue();
1272 const VkSubmitInfo submitInfo =
1274 VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
1275 DE_NULL, // const void* pNext;
1276 0u, // deUint32 waitSemaphoreCount;
1277 DE_NULL, // const VkSemaphore* pWaitSemaphores;
1278 (const VkPipelineStageFlags*)DE_NULL,
1279 1u, // deUint32 commandBufferCount;
1280 &m_cmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
1281 0u, // deUint32 signalSemaphoreCount;
1282 DE_NULL // const VkSemaphore* pSignalSemaphores;
1285 VK_CHECK(vk.resetFences(vkDevice, 1, &m_fence.get()));
1286 VK_CHECK(vk.queueSubmit(queue, 1, &submitInfo, *m_fence));
1287 VK_CHECK(vk.waitForFences(vkDevice, 1, &m_fence.get(), true, ~(0ull) /* infinity*/));
1289 return verifyImage();
1292 bool VertexInputTest::isCompatibleType (VkFormat format, GlslType glslType)
1294 const GlslTypeDescription glslTypeDesc = s_glslTypeDescriptions[glslType];
1296 if ((deUint32)s_glslTypeDescriptions[glslType].vertexInputComponentCount == getVertexFormatComponentCount(format))
1298 switch (glslTypeDesc.basicType)
1300 case GLSL_BASIC_TYPE_INT:
1301 return isVertexFormatSint(format);
1303 case GLSL_BASIC_TYPE_UINT:
1304 return isVertexFormatUint(format);
1306 case GLSL_BASIC_TYPE_FLOAT:
1307 return getVertexFormatComponentSize(format) <= 4 && (isVertexFormatSfloat(format) || isVertexFormatSnorm(format) || isVertexFormatUnorm(format) || isVertexFormatSscaled(format) || isVertexFormatUscaled(format) || isVertexFormatSRGB(format));
1309 case GLSL_BASIC_TYPE_DOUBLE:
1310 return isVertexFormatSfloat(format) && getVertexFormatComponentSize(format) == 8;
1321 tcu::TestStatus VertexInputInstance::verifyImage (void)
1323 bool compareOk = false;
1324 const tcu::TextureFormat tcuColorFormat = mapVkFormat(m_colorFormat);
1325 tcu::TextureLevel reference (tcuColorFormat, m_renderSize.x(), m_renderSize.y());
1326 const tcu::PixelBufferAccess refRedSubregion (tcu::getSubregion(reference.getAccess(),
1327 deRoundFloatToInt32((float)m_renderSize.x() * 0.0f),
1328 deRoundFloatToInt32((float)m_renderSize.y() * 0.0f),
1329 deRoundFloatToInt32((float)m_renderSize.x() * 0.5f),
1330 deRoundFloatToInt32((float)m_renderSize.y() * 1.0f)));
1331 const tcu::PixelBufferAccess refBlueSubregion (tcu::getSubregion(reference.getAccess(),
1332 deRoundFloatToInt32((float)m_renderSize.x() * 0.5f),
1333 deRoundFloatToInt32((float)m_renderSize.y() * 0.0f),
1334 deRoundFloatToInt32((float)m_renderSize.x() * 0.5f),
1335 deRoundFloatToInt32((float)m_renderSize.y() * 1.0f)));
1337 // Create reference image
1338 tcu::clear(reference.getAccess(), defaultClearColor(tcuColorFormat));
1339 tcu::clear(refRedSubregion, tcu::Vec4(1.0f, 0.0f, 0.0f, 1.0f));
1340 tcu::clear(refBlueSubregion, tcu::Vec4(0.0f, 0.0f, 1.0f, 1.0f));
1342 // Compare result with reference image
1344 const DeviceInterface& vk = m_context.getDeviceInterface();
1345 const VkDevice vkDevice = m_context.getDevice();
1346 const VkQueue queue = m_context.getUniversalQueue();
1347 const deUint32 queueFamilyIndex = m_context.getUniversalQueueFamilyIndex();
1348 SimpleAllocator allocator (vk, vkDevice, getPhysicalDeviceMemoryProperties(m_context.getInstanceInterface(), m_context.getPhysicalDevice()));
1349 de::MovePtr<tcu::TextureLevel> result = readColorAttachment(vk, vkDevice, queue, queueFamilyIndex, allocator, *m_colorImage, m_colorFormat, m_renderSize);
1351 compareOk = tcu::intThresholdPositionDeviationCompare(m_context.getTestContext().getLog(),
1354 reference.getAccess(),
1355 result->getAccess(),
1356 tcu::UVec4(2, 2, 2, 2),
1357 tcu::IVec3(1, 1, 0),
1359 tcu::COMPARE_LOG_RESULT);
1363 return tcu::TestStatus::pass("Result image matches reference");
1365 return tcu::TestStatus::fail("Image mismatch");
1368 std::string getAttributeInfoCaseName (const VertexInputTest::AttributeInfo& attributeInfo)
1370 std::ostringstream caseName;
1371 const std::string formatName = getFormatName(attributeInfo.vkType);
1373 caseName << VertexInputTest::s_glslTypeDescriptions[attributeInfo.glslType].name << "_as_" << de::toLower(formatName.substr(10)) << "_rate_";
1375 if (attributeInfo.inputRate == VK_VERTEX_INPUT_RATE_VERTEX)
1376 caseName << "vertex";
1378 caseName << "instance";
1380 return caseName.str();
1383 std::string getAttributeInfosCaseName (const std::vector<VertexInputTest::AttributeInfo>& attributeInfos)
1385 std::ostringstream caseName;
1387 for (size_t attributeNdx = 0; attributeNdx < attributeInfos.size(); attributeNdx++)
1389 caseName << getAttributeInfoCaseName(attributeInfos[attributeNdx]);
1391 if (attributeNdx < attributeInfos.size() - 1)
1395 return caseName.str();
1398 std::string getAttributeInfoDescription (const VertexInputTest::AttributeInfo& attributeInfo)
1400 std::ostringstream caseDesc;
1402 caseDesc << std::string(VertexInputTest::s_glslTypeDescriptions[attributeInfo.glslType].name) << " from type " << getFormatName(attributeInfo.vkType) << " with ";
1404 if (attributeInfo.inputRate == VK_VERTEX_INPUT_RATE_VERTEX)
1405 caseDesc << "vertex input rate ";
1407 caseDesc << "instance input rate ";
1409 return caseDesc.str();
1412 std::string getAttributeInfosDescription (const std::vector<VertexInputTest::AttributeInfo>& attributeInfos)
1414 std::ostringstream caseDesc;
1416 caseDesc << "Uses vertex attributes:\n";
1418 for (size_t attributeNdx = 0; attributeNdx < attributeInfos.size(); attributeNdx++)
1419 caseDesc << "\t- " << getAttributeInfoDescription (attributeInfos[attributeNdx]) << "\n";
1421 return caseDesc.str();
1424 struct CompatibleFormats
1426 VertexInputTest::GlslType glslType;
1427 std::vector<VkFormat> compatibleVkFormats;
1430 de::MovePtr<tcu::TestCaseGroup> createSingleAttributeTests (tcu::TestContext& testCtx)
1432 const VkFormat vertexFormats[] =
1434 // Required, unpacked
1439 VK_FORMAT_R8G8_UNORM,
1440 VK_FORMAT_R8G8_SNORM,
1441 VK_FORMAT_R8G8_UINT,
1442 VK_FORMAT_R8G8_SINT,
1443 VK_FORMAT_R8G8B8A8_UNORM,
1444 VK_FORMAT_R8G8B8A8_SNORM,
1445 VK_FORMAT_R8G8B8A8_UINT,
1446 VK_FORMAT_R8G8B8A8_SINT,
1447 VK_FORMAT_B8G8R8A8_UNORM,
1448 VK_FORMAT_R16_UNORM,
1449 VK_FORMAT_R16_SNORM,
1452 VK_FORMAT_R16_SFLOAT,
1453 VK_FORMAT_R16G16_UNORM,
1454 VK_FORMAT_R16G16_SNORM,
1455 VK_FORMAT_R16G16_UINT,
1456 VK_FORMAT_R16G16_SINT,
1457 VK_FORMAT_R16G16_SFLOAT,
1458 VK_FORMAT_R16G16B16A16_UNORM,
1459 VK_FORMAT_R16G16B16A16_SNORM,
1460 VK_FORMAT_R16G16B16A16_UINT,
1461 VK_FORMAT_R16G16B16A16_SINT,
1462 VK_FORMAT_R16G16B16A16_SFLOAT,
1465 VK_FORMAT_R32_SFLOAT,
1466 VK_FORMAT_R32G32_UINT,
1467 VK_FORMAT_R32G32_SINT,
1468 VK_FORMAT_R32G32_SFLOAT,
1469 VK_FORMAT_R32G32B32_UINT,
1470 VK_FORMAT_R32G32B32_SINT,
1471 VK_FORMAT_R32G32B32_SFLOAT,
1472 VK_FORMAT_R32G32B32A32_UINT,
1473 VK_FORMAT_R32G32B32A32_SINT,
1474 VK_FORMAT_R32G32B32A32_SFLOAT,
1477 VK_FORMAT_R8G8_USCALED,
1478 VK_FORMAT_R8G8_SSCALED,
1479 VK_FORMAT_R16_USCALED,
1480 VK_FORMAT_R16_SSCALED,
1481 VK_FORMAT_R8G8B8_USCALED,
1482 VK_FORMAT_R8G8B8_SSCALED,
1483 VK_FORMAT_B8G8R8_USCALED,
1484 VK_FORMAT_B8G8R8_SSCALED,
1485 VK_FORMAT_R8G8B8A8_USCALED,
1486 VK_FORMAT_R8G8B8A8_SSCALED,
1487 VK_FORMAT_B8G8R8A8_USCALED,
1488 VK_FORMAT_B8G8R8A8_SSCALED,
1489 VK_FORMAT_R16G16_USCALED,
1490 VK_FORMAT_R16G16_SSCALED,
1491 VK_FORMAT_R16G16B16_USCALED,
1492 VK_FORMAT_R16G16B16_SSCALED,
1493 VK_FORMAT_R16G16B16A16_USCALED,
1494 VK_FORMAT_R16G16B16A16_SSCALED,
1498 VK_FORMAT_R8G8_SRGB,
1499 VK_FORMAT_R8G8B8_SRGB,
1500 VK_FORMAT_B8G8R8_SRGB,
1501 VK_FORMAT_R8G8B8A8_SRGB,
1502 VK_FORMAT_B8G8R8A8_SRGB,
1505 VK_FORMAT_R64_SFLOAT,
1506 VK_FORMAT_R64G64_SFLOAT,
1507 VK_FORMAT_R64G64B64_SFLOAT,
1508 VK_FORMAT_R64G64B64A64_SFLOAT,
1511 de::MovePtr<tcu::TestCaseGroup> singleAttributeTests (new tcu::TestCaseGroup(testCtx, "single_attribute", "Uses one attribute"));
1513 for (int formatNdx = 0; formatNdx < DE_LENGTH_OF_ARRAY(vertexFormats); formatNdx++)
1515 for (int glslTypeNdx = 0; glslTypeNdx < VertexInputTest::GLSL_TYPE_COUNT; glslTypeNdx++)
1517 if (VertexInputTest::isCompatibleType(vertexFormats[formatNdx], (VertexInputTest::GlslType)glslTypeNdx))
1519 // Create test case for RATE_VERTEX
1520 VertexInputTest::AttributeInfo attributeInfo;
1521 attributeInfo.vkType = vertexFormats[formatNdx];
1522 attributeInfo.glslType = (VertexInputTest::GlslType)glslTypeNdx;
1523 attributeInfo.inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
1525 singleAttributeTests->addChild(new VertexInputTest(testCtx,
1526 getAttributeInfoCaseName(attributeInfo),
1527 getAttributeInfoDescription(attributeInfo),
1528 std::vector<VertexInputTest::AttributeInfo>(1, attributeInfo),
1529 VertexInputTest::BINDING_MAPPING_ONE_TO_ONE));
1531 // Create test case for RATE_INSTANCE
1532 attributeInfo.inputRate = VK_VERTEX_INPUT_RATE_INSTANCE;
1534 singleAttributeTests->addChild(new VertexInputTest(testCtx,
1535 getAttributeInfoCaseName(attributeInfo),
1536 getAttributeInfoDescription(attributeInfo),
1537 std::vector<VertexInputTest::AttributeInfo>(1, attributeInfo),
1538 VertexInputTest::BINDING_MAPPING_ONE_TO_ONE));
1543 return singleAttributeTests;
1546 de::MovePtr<tcu::TestCaseGroup> createMultipleAttributeTests (tcu::TestContext& testCtx)
1548 // Required vertex formats, unpacked
1549 const VkFormat vertexFormats[] =
1555 VK_FORMAT_R8G8_UNORM,
1556 VK_FORMAT_R8G8_SNORM,
1557 VK_FORMAT_R8G8_UINT,
1558 VK_FORMAT_R8G8_SINT,
1559 VK_FORMAT_R8G8B8A8_UNORM,
1560 VK_FORMAT_R8G8B8A8_SNORM,
1561 VK_FORMAT_R8G8B8A8_UINT,
1562 VK_FORMAT_R8G8B8A8_SINT,
1563 VK_FORMAT_B8G8R8A8_UNORM,
1564 VK_FORMAT_R16_UNORM,
1565 VK_FORMAT_R16_SNORM,
1568 VK_FORMAT_R16_SFLOAT,
1569 VK_FORMAT_R16G16_UNORM,
1570 VK_FORMAT_R16G16_SNORM,
1571 VK_FORMAT_R16G16_UINT,
1572 VK_FORMAT_R16G16_SINT,
1573 VK_FORMAT_R16G16_SFLOAT,
1574 VK_FORMAT_R16G16B16A16_UNORM,
1575 VK_FORMAT_R16G16B16A16_SNORM,
1576 VK_FORMAT_R16G16B16A16_UINT,
1577 VK_FORMAT_R16G16B16A16_SINT,
1578 VK_FORMAT_R16G16B16A16_SFLOAT,
1581 VK_FORMAT_R32_SFLOAT,
1582 VK_FORMAT_R32G32_UINT,
1583 VK_FORMAT_R32G32_SINT,
1584 VK_FORMAT_R32G32_SFLOAT,
1585 VK_FORMAT_R32G32B32_UINT,
1586 VK_FORMAT_R32G32B32_SINT,
1587 VK_FORMAT_R32G32B32_SFLOAT,
1588 VK_FORMAT_R32G32B32A32_UINT,
1589 VK_FORMAT_R32G32B32A32_SINT,
1590 VK_FORMAT_R32G32B32A32_SFLOAT
1593 de::MovePtr<tcu::TestCaseGroup> multipleAttributeTests (new tcu::TestCaseGroup(testCtx, "multiple_attributes", "Uses more than one attribute"));
1595 // Find compatible VK formats for each GLSL vertex type
1596 CompatibleFormats compatibleFormats[VertexInputTest::GLSL_TYPE_COUNT];
1598 for (int glslTypeNdx = 0; glslTypeNdx < VertexInputTest::GLSL_TYPE_COUNT; glslTypeNdx++)
1600 for (int formatNdx = 0; formatNdx < DE_LENGTH_OF_ARRAY(vertexFormats); formatNdx++)
1602 if (VertexInputTest::isCompatibleType(vertexFormats[formatNdx], (VertexInputTest::GlslType)glslTypeNdx))
1603 compatibleFormats[glslTypeNdx].compatibleVkFormats.push_back(vertexFormats[formatNdx]);
1608 de::Random randomFunc (102030);
1609 GlslTypeCombinationsIterator glslTypeCombinationsItr (VertexInputTest::GLSL_TYPE_DOUBLE, 3); // Exclude double values, which are not included in vertexFormats
1610 de::MovePtr<tcu::TestCaseGroup> oneToOneAttributeTests (new tcu::TestCaseGroup(testCtx, "attributes", ""));
1611 de::MovePtr<tcu::TestCaseGroup> oneToManyAttributeTests (new tcu::TestCaseGroup(testCtx, "attributes", ""));
1613 while (glslTypeCombinationsItr.hasNext())
1615 const std::vector<VertexInputTest::GlslType> glslTypes = glslTypeCombinationsItr.next();
1616 std::vector<VertexInputTest::AttributeInfo> attributeInfos (glslTypes.size());
1618 for (size_t attributeNdx = 0; attributeNdx < attributeInfos.size(); attributeNdx++)
1620 DE_ASSERT(!compatibleFormats[glslTypes[attributeNdx]].compatibleVkFormats.empty());
1622 // Select a random compatible format
1623 const std::vector<VkFormat>& formats = compatibleFormats[glslTypes[attributeNdx]].compatibleVkFormats;
1624 const VkFormat format = formats[randomFunc.getUint32() % formats.size()];
1626 attributeInfos[attributeNdx].glslType = glslTypes[attributeNdx];
1627 attributeInfos[attributeNdx].inputRate = (attributeNdx % 2 == 0) ? VK_VERTEX_INPUT_RATE_VERTEX : VK_VERTEX_INPUT_RATE_INSTANCE;
1628 attributeInfos[attributeNdx].vkType = format;
1631 const std::string caseName = getAttributeInfosCaseName(attributeInfos);
1632 const std::string caseDesc = getAttributeInfosDescription(attributeInfos);
1634 oneToOneAttributeTests->addChild(new VertexInputTest(testCtx, caseName, caseDesc, attributeInfos, VertexInputTest::BINDING_MAPPING_ONE_TO_ONE));
1635 oneToManyAttributeTests->addChild(new VertexInputTest(testCtx, caseName, caseDesc, attributeInfos, VertexInputTest::BINDING_MAPPING_ONE_TO_MANY));
1638 de::MovePtr<tcu::TestCaseGroup> bindingOneToOneTests (new tcu::TestCaseGroup(testCtx, "binding_one_to_one", "Each attribute uses a unique binding"));
1639 bindingOneToOneTests->addChild(oneToOneAttributeTests.release());
1640 multipleAttributeTests->addChild(bindingOneToOneTests.release());
1642 de::MovePtr<tcu::TestCaseGroup> bindingOneToManyTests (new tcu::TestCaseGroup(testCtx, "binding_one_to_many", "Attributes share the same binding"));
1643 bindingOneToManyTests->addChild(oneToManyAttributeTests.release());
1644 multipleAttributeTests->addChild(bindingOneToManyTests.release());
1646 return multipleAttributeTests;
1651 tcu::TestCaseGroup* createVertexInputTests (tcu::TestContext& testCtx)
1653 de::MovePtr<tcu::TestCaseGroup> vertexInputTests (new tcu::TestCaseGroup(testCtx, "vertex_input", ""));
1655 vertexInputTests->addChild(createSingleAttributeTests(testCtx).release());
1656 vertexInputTests->addChild(createMultipleAttributeTests(testCtx).release());
1658 return vertexInputTests.release();