1e5c31af7Sopenharmony_ci/*-------------------------------------------------------------------------
2e5c31af7Sopenharmony_ci * Vulkan Conformance Tests
3e5c31af7Sopenharmony_ci * ------------------------
4e5c31af7Sopenharmony_ci *
5e5c31af7Sopenharmony_ci * Copyright (c) 2017 Google Inc.
6e5c31af7Sopenharmony_ci *
7e5c31af7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
8e5c31af7Sopenharmony_ci * you may not use this file except in compliance with the License.
9e5c31af7Sopenharmony_ci * You may obtain a copy of the License at
10e5c31af7Sopenharmony_ci *
11e5c31af7Sopenharmony_ci *      http://www.apache.org/licenses/LICENSE-2.0
12e5c31af7Sopenharmony_ci *
13e5c31af7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
14e5c31af7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
15e5c31af7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16e5c31af7Sopenharmony_ci * See the License for the specific language governing permissions and
17e5c31af7Sopenharmony_ci * limitations under the License.
18e5c31af7Sopenharmony_ci *
19e5c31af7Sopenharmony_ci *//*!
20e5c31af7Sopenharmony_ci * \file
21e5c31af7Sopenharmony_ci * \brief SPIR-V Assembly Tests for UBO matrix padding.
22e5c31af7Sopenharmony_ci *//*--------------------------------------------------------------------*/
23e5c31af7Sopenharmony_ci
24e5c31af7Sopenharmony_ci#include "vktSpvAsmUboMatrixPaddingTests.hpp"
25e5c31af7Sopenharmony_ci#include "vktSpvAsmComputeShaderCase.hpp"
26e5c31af7Sopenharmony_ci#include "vktSpvAsmComputeShaderTestUtil.hpp"
27e5c31af7Sopenharmony_ci#include "vktSpvAsmGraphicsShaderTestUtil.hpp"
28e5c31af7Sopenharmony_ci#include "tcuVectorUtil.hpp"
29e5c31af7Sopenharmony_ci
30e5c31af7Sopenharmony_cinamespace vkt
31e5c31af7Sopenharmony_ci{
32e5c31af7Sopenharmony_cinamespace SpirVAssembly
33e5c31af7Sopenharmony_ci{
34e5c31af7Sopenharmony_ci
35e5c31af7Sopenharmony_ciusing namespace vk;
36e5c31af7Sopenharmony_ciusing std::map;
37e5c31af7Sopenharmony_ciusing std::string;
38e5c31af7Sopenharmony_ciusing std::vector;
39e5c31af7Sopenharmony_ciusing tcu::IVec3;
40e5c31af7Sopenharmony_ciusing tcu::RGBA;
41e5c31af7Sopenharmony_ciusing tcu::Vec4;
42e5c31af7Sopenharmony_ci
43e5c31af7Sopenharmony_cinamespace
44e5c31af7Sopenharmony_ci{
45e5c31af7Sopenharmony_ci
46e5c31af7Sopenharmony_civoid addComputeUboMatrixPaddingTest (tcu::TestCaseGroup* group)
47e5c31af7Sopenharmony_ci{
48e5c31af7Sopenharmony_ci	tcu::TestContext&	testCtx			= group->getTestContext();
49e5c31af7Sopenharmony_ci	de::Random			rnd				(deStringHash(group->getName()));
50e5c31af7Sopenharmony_ci	const int			numElements		= 128;
51e5c31af7Sopenharmony_ci
52e5c31af7Sopenharmony_ci	// Read input UBO containing and array of mat2x2 using no padding inside matrix. Output
53e5c31af7Sopenharmony_ci	// into output buffer containing floats. The input and output buffer data should match.
54e5c31af7Sopenharmony_ci	const string		shaderSource	=
55e5c31af7Sopenharmony_ci		"                       OpCapability Shader\n"
56e5c31af7Sopenharmony_ci		"                  %1 = OpExtInstImport \"GLSL.std.450\"\n"
57e5c31af7Sopenharmony_ci		"                       OpMemoryModel Logical GLSL450\n"
58e5c31af7Sopenharmony_ci		"                       OpEntryPoint GLCompute %main \"main\" %id\n"
59e5c31af7Sopenharmony_ci		"                       OpExecutionMode %main LocalSize 1 1 1\n"
60e5c31af7Sopenharmony_ci		"                       OpSource GLSL 430\n"
61e5c31af7Sopenharmony_ci		"                       OpDecorate %id BuiltIn GlobalInvocationId\n"
62e5c31af7Sopenharmony_ci		"                       OpDecorate %_arr_v4 ArrayStride 16\n"
63e5c31af7Sopenharmony_ci		"                       OpMemberDecorate %Output 0 Offset 0\n"
64e5c31af7Sopenharmony_ci		"                       OpDecorate %Output BufferBlock\n"
65e5c31af7Sopenharmony_ci		"                       OpDecorate %dataOutput DescriptorSet 0\n"
66e5c31af7Sopenharmony_ci		"                       OpDecorate %dataOutput Binding 1\n"
67e5c31af7Sopenharmony_ci		"                       OpDecorate %_arr_mat2v2 ArrayStride 16\n"
68e5c31af7Sopenharmony_ci		"                       OpMemberDecorate %Input 0 ColMajor\n"
69e5c31af7Sopenharmony_ci		"                       OpMemberDecorate %Input 0 Offset 0\n"
70e5c31af7Sopenharmony_ci		"                       OpMemberDecorate %Input 0 MatrixStride 8\n"
71e5c31af7Sopenharmony_ci		"                       OpDecorate %Input Block\n"
72e5c31af7Sopenharmony_ci		"                       OpDecorate %dataInput DescriptorSet 0\n"
73e5c31af7Sopenharmony_ci		"                       OpDecorate %dataInput Binding 0\n"
74e5c31af7Sopenharmony_ci		"               %void = OpTypeVoid\n"
75e5c31af7Sopenharmony_ci		"                  %3 = OpTypeFunction %void\n"
76e5c31af7Sopenharmony_ci		"                %u32 = OpTypeInt 32 0\n"
77e5c31af7Sopenharmony_ci		" %_ptr_Function_uint = OpTypePointer Function %u32\n"
78e5c31af7Sopenharmony_ci		"             %v3uint = OpTypeVector %u32 3\n"
79e5c31af7Sopenharmony_ci		"  %_ptr_Input_v3uint = OpTypePointer Input %v3uint\n"
80e5c31af7Sopenharmony_ci		"                 %id = OpVariable %_ptr_Input_v3uint Input\n"
81e5c31af7Sopenharmony_ci		"                %i32 = OpTypeInt 32 1\n"
82e5c31af7Sopenharmony_ci		"              %int_0 = OpConstant %i32 0\n"
83e5c31af7Sopenharmony_ci		"              %int_1 = OpConstant %i32 1\n"
84e5c31af7Sopenharmony_ci		"             %uint_0 = OpConstant %u32 0\n"
85e5c31af7Sopenharmony_ci		"             %uint_1 = OpConstant %u32 1\n"
86e5c31af7Sopenharmony_ci		"             %uint_2 = OpConstant %u32 2\n"
87e5c31af7Sopenharmony_ci		"             %uint_3 = OpConstant %u32 3\n"
88e5c31af7Sopenharmony_ci		"    %_ptr_Input_uint = OpTypePointer Input %u32\n"
89e5c31af7Sopenharmony_ci		"                %f32 = OpTypeFloat 32\n"
90e5c31af7Sopenharmony_ci		"            %v4float = OpTypeVector %f32 4\n"
91e5c31af7Sopenharmony_ci		"           %uint_128 = OpConstant %u32 128\n"
92e5c31af7Sopenharmony_ci		"            %_arr_v4 = OpTypeArray %v4float %uint_128\n"
93e5c31af7Sopenharmony_ci		"             %Output = OpTypeStruct %_arr_v4\n"
94e5c31af7Sopenharmony_ci		"%_ptr_Uniform_Output = OpTypePointer Uniform %Output\n"
95e5c31af7Sopenharmony_ci		"         %dataOutput = OpVariable %_ptr_Uniform_Output Uniform\n"
96e5c31af7Sopenharmony_ci		"            %v2float = OpTypeVector %f32 2\n"
97e5c31af7Sopenharmony_ci		"        %mat2v2float = OpTypeMatrix %v2float 2\n"
98e5c31af7Sopenharmony_ci		"        %_arr_mat2v2 = OpTypeArray %mat2v2float %uint_128\n"
99e5c31af7Sopenharmony_ci		"              %Input = OpTypeStruct %_arr_mat2v2\n"
100e5c31af7Sopenharmony_ci		" %_ptr_Uniform_Input = OpTypePointer Uniform %Input\n"
101e5c31af7Sopenharmony_ci		"          %dataInput = OpVariable %_ptr_Uniform_Input Uniform\n"
102e5c31af7Sopenharmony_ci		" %_ptr_Uniform_float = OpTypePointer Uniform %f32\n"
103e5c31af7Sopenharmony_ci		"               %main = OpFunction %void None %3\n"
104e5c31af7Sopenharmony_ci		"                  %5 = OpLabel\n"
105e5c31af7Sopenharmony_ci		"                  %i = OpVariable %_ptr_Function_uint Function\n"
106e5c31af7Sopenharmony_ci		"                 %14 = OpAccessChain %_ptr_Input_uint %id %uint_0\n"
107e5c31af7Sopenharmony_ci		"                 %15 = OpLoad %u32 %14\n"
108e5c31af7Sopenharmony_ci		"                       OpStore %i %15\n"
109e5c31af7Sopenharmony_ci		"                %idx = OpLoad %u32 %i\n"
110e5c31af7Sopenharmony_ci		"                 %34 = OpAccessChain %_ptr_Uniform_float %dataInput %int_0 %idx %int_0 %uint_0\n"
111e5c31af7Sopenharmony_ci		"                 %35 = OpLoad %f32 %34\n"
112e5c31af7Sopenharmony_ci		"                 %36 = OpAccessChain %_ptr_Uniform_float %dataOutput %int_0 %idx %uint_0\n"
113e5c31af7Sopenharmony_ci		"                       OpStore %36 %35\n"
114e5c31af7Sopenharmony_ci		"                 %40 = OpAccessChain %_ptr_Uniform_float %dataInput %int_0 %idx %int_0 %uint_1\n"
115e5c31af7Sopenharmony_ci		"                 %41 = OpLoad %f32 %40\n"
116e5c31af7Sopenharmony_ci		"                 %42 = OpAccessChain %_ptr_Uniform_float %dataOutput %int_0 %idx %uint_1\n"
117e5c31af7Sopenharmony_ci		"                       OpStore %42 %41\n"
118e5c31af7Sopenharmony_ci		"                 %46 = OpAccessChain %_ptr_Uniform_float %dataInput %int_0 %idx %int_1 %uint_0\n"
119e5c31af7Sopenharmony_ci		"                 %47 = OpLoad %f32 %46\n"
120e5c31af7Sopenharmony_ci		"                 %49 = OpAccessChain %_ptr_Uniform_float %dataOutput %int_0 %idx %uint_2\n"
121e5c31af7Sopenharmony_ci		"                       OpStore %49 %47\n"
122e5c31af7Sopenharmony_ci		"                 %52 = OpAccessChain %_ptr_Uniform_float %dataInput %int_0 %idx %int_1 %uint_1\n"
123e5c31af7Sopenharmony_ci		"                 %53 = OpLoad %f32 %52\n"
124e5c31af7Sopenharmony_ci		"                 %55 = OpAccessChain %_ptr_Uniform_float %dataOutput %int_0 %idx %uint_3\n"
125e5c31af7Sopenharmony_ci		"                       OpStore %55 %53\n"
126e5c31af7Sopenharmony_ci		"                       OpReturn\n"
127e5c31af7Sopenharmony_ci		"                       OpFunctionEnd\n";
128e5c31af7Sopenharmony_ci
129e5c31af7Sopenharmony_ci	vector<tcu::Vec4>		inputData;
130e5c31af7Sopenharmony_ci	ComputeShaderSpec		spec;
131e5c31af7Sopenharmony_ci
132e5c31af7Sopenharmony_ci	inputData.reserve(numElements);
133e5c31af7Sopenharmony_ci	for (deUint32 numIdx = 0; numIdx < numElements; ++numIdx)
134e5c31af7Sopenharmony_ci		inputData.push_back(tcu::randomVec4(rnd));
135e5c31af7Sopenharmony_ci
136e5c31af7Sopenharmony_ci	spec.assembly			= shaderSource;
137e5c31af7Sopenharmony_ci	spec.numWorkGroups		= IVec3(numElements, 1, 1);
138e5c31af7Sopenharmony_ci
139e5c31af7Sopenharmony_ci	spec.inputs.push_back(Resource(BufferSp(new Vec4Buffer(inputData)), VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER));
140e5c31af7Sopenharmony_ci	// Shader is expected to pass the input data by treating the input vec4 as mat2x2
141e5c31af7Sopenharmony_ci	spec.outputs.push_back(Resource(BufferSp(new Vec4Buffer(inputData))));
142e5c31af7Sopenharmony_ci
143e5c31af7Sopenharmony_ci	group->addChild(new SpvAsmComputeShaderCase(testCtx, "mat2x2", spec));
144e5c31af7Sopenharmony_ci}
145e5c31af7Sopenharmony_ci
146e5c31af7Sopenharmony_civoid addGraphicsUboMatrixPaddingTest (tcu::TestCaseGroup* group)
147e5c31af7Sopenharmony_ci{
148e5c31af7Sopenharmony_ci	de::Random					rnd					(deStringHash(group->getName()));
149e5c31af7Sopenharmony_ci	map<string, string>			fragments;
150e5c31af7Sopenharmony_ci	const deUint32				numDataPoints		= 128;
151e5c31af7Sopenharmony_ci	RGBA						defaultColors[4];
152e5c31af7Sopenharmony_ci	GraphicsResources			resources;
153e5c31af7Sopenharmony_ci
154e5c31af7Sopenharmony_ci	SpecConstants				noSpecConstants;
155e5c31af7Sopenharmony_ci	PushConstants				noPushConstants;
156e5c31af7Sopenharmony_ci	GraphicsInterfaces			noInterfaces;
157e5c31af7Sopenharmony_ci	std::vector<std::string>	noExtensions;
158e5c31af7Sopenharmony_ci	VulkanFeatures				vulkanFeatures = VulkanFeatures();
159e5c31af7Sopenharmony_ci
160e5c31af7Sopenharmony_ci	vector<tcu::Vec4> inputData(numDataPoints);
161e5c31af7Sopenharmony_ci	for (deUint32 numIdx = 0; numIdx < numDataPoints; ++numIdx)
162e5c31af7Sopenharmony_ci		inputData[numIdx] = tcu::randomVec4(rnd);
163e5c31af7Sopenharmony_ci
164e5c31af7Sopenharmony_ci	resources.inputs.push_back(Resource(BufferSp(new Vec4Buffer(inputData)), VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER));
165e5c31af7Sopenharmony_ci	// Shader is expected to pass the input data by treating the input vec4 as mat2x2
166e5c31af7Sopenharmony_ci	resources.outputs.push_back(Resource(BufferSp(new Vec4Buffer(inputData)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
167e5c31af7Sopenharmony_ci
168e5c31af7Sopenharmony_ci	getDefaultColors(defaultColors);
169e5c31af7Sopenharmony_ci
170e5c31af7Sopenharmony_ci	fragments["pre_main"]	=
171e5c31af7Sopenharmony_ci		"             %uint_128 = OpConstant %u32 128\n"
172e5c31af7Sopenharmony_ci		"    %_arr_v4f_uint_128 = OpTypeArray %v4f32 %uint_128\n"
173e5c31af7Sopenharmony_ci		"               %Output = OpTypeStruct %_arr_v4f_uint_128\n"
174e5c31af7Sopenharmony_ci		"  %_ptr_Uniform_Output = OpTypePointer Uniform %Output\n"
175e5c31af7Sopenharmony_ci		"           %dataOutput = OpVariable %_ptr_Uniform_Output Uniform\n"
176e5c31af7Sopenharmony_ci		"              %mat2v2f = OpTypeMatrix %v2f32 2\n"
177e5c31af7Sopenharmony_ci		"%_arr_mat2v2f_uint_128 = OpTypeArray %mat2v2f %uint_128\n"
178e5c31af7Sopenharmony_ci		"                %Input = OpTypeStruct %_arr_mat2v2f_uint_128\n"
179e5c31af7Sopenharmony_ci		"   %_ptr_Uniform_Input = OpTypePointer Uniform %Input\n"
180e5c31af7Sopenharmony_ci		"            %dataInput = OpVariable %_ptr_Uniform_Input Uniform\n"
181e5c31af7Sopenharmony_ci		"       %_ptr_Uniform_f = OpTypePointer Uniform %f32\n"
182e5c31af7Sopenharmony_ci		"            %c_i32_128 = OpConstant %i32 128\n";
183e5c31af7Sopenharmony_ci
184e5c31af7Sopenharmony_ci	fragments["decoration"]	=
185e5c31af7Sopenharmony_ci		"                         OpDecorate %_arr_v4f_uint_128 ArrayStride 16\n"
186e5c31af7Sopenharmony_ci		"                         OpMemberDecorate %Output 0 Offset 0\n"
187e5c31af7Sopenharmony_ci		"                         OpDecorate %Output BufferBlock\n"
188e5c31af7Sopenharmony_ci		"                         OpDecorate %dataOutput DescriptorSet 0\n"
189e5c31af7Sopenharmony_ci		"                         OpDecorate %dataOutput Binding 1\n"
190e5c31af7Sopenharmony_ci		"                         OpDecorate %_arr_mat2v2f_uint_128 ArrayStride 16\n"
191e5c31af7Sopenharmony_ci		"                         OpMemberDecorate %Input 0 ColMajor\n"
192e5c31af7Sopenharmony_ci		"                         OpMemberDecorate %Input 0 Offset 0\n"
193e5c31af7Sopenharmony_ci		"                         OpMemberDecorate %Input 0 MatrixStride 8\n"
194e5c31af7Sopenharmony_ci		"                         OpDecorate %Input Block\n"
195e5c31af7Sopenharmony_ci		"                         OpDecorate %dataInput DescriptorSet 0\n"
196e5c31af7Sopenharmony_ci		"                         OpDecorate %dataInput Binding 0\n";
197e5c31af7Sopenharmony_ci
198e5c31af7Sopenharmony_ci	// Read input UBO containing and array of mat2x2 using no padding inside matrix. Output
199e5c31af7Sopenharmony_ci	// into output buffer containing floats. The input and output buffer data should match.
200e5c31af7Sopenharmony_ci	// The whole array is handled inside a for loop.
201e5c31af7Sopenharmony_ci	fragments["testfun"]	=
202e5c31af7Sopenharmony_ci		"            %test_code = OpFunction %v4f32 None %v4f32_v4f32_function\n"
203e5c31af7Sopenharmony_ci		"                %param = OpFunctionParameter %v4f32\n"
204e5c31af7Sopenharmony_ci
205e5c31af7Sopenharmony_ci		"                %entry = OpLabel\n"
206e5c31af7Sopenharmony_ci		"                    %i = OpVariable %fp_i32 Function\n"
207e5c31af7Sopenharmony_ci		"                         OpStore %i %c_i32_0\n"
208e5c31af7Sopenharmony_ci		"                         OpBranch %loop\n"
209e5c31af7Sopenharmony_ci
210e5c31af7Sopenharmony_ci		"                 %loop = OpLabel\n"
211e5c31af7Sopenharmony_ci		"                   %15 = OpLoad %i32 %i\n"
212e5c31af7Sopenharmony_ci		"                   %lt = OpSLessThan %bool %15 %c_i32_128\n"
213e5c31af7Sopenharmony_ci		"                         OpLoopMerge %merge %inc None\n"
214e5c31af7Sopenharmony_ci		"                         OpBranchConditional %lt %write %merge\n"
215e5c31af7Sopenharmony_ci
216e5c31af7Sopenharmony_ci		"                %write = OpLabel\n"
217e5c31af7Sopenharmony_ci		"                   %30 = OpLoad %i32 %i\n"
218e5c31af7Sopenharmony_ci		"                   %34 = OpAccessChain %_ptr_Uniform_f %dataInput %c_i32_0 %30 %c_i32_0 %c_u32_0\n"
219e5c31af7Sopenharmony_ci		"                   %35 = OpLoad %f32 %34\n"
220e5c31af7Sopenharmony_ci		"                   %36 = OpAccessChain %_ptr_Uniform_f %dataOutput %c_i32_0 %30 %c_u32_0\n"
221e5c31af7Sopenharmony_ci		"                         OpStore %36 %35\n"
222e5c31af7Sopenharmony_ci		"                   %40 = OpAccessChain %_ptr_Uniform_f %dataInput %c_i32_0 %30 %c_i32_0 %c_u32_1\n"
223e5c31af7Sopenharmony_ci		"                   %41 = OpLoad %f32 %40\n"
224e5c31af7Sopenharmony_ci		"                   %42 = OpAccessChain %_ptr_Uniform_f %dataOutput %c_i32_0 %30 %c_u32_1\n"
225e5c31af7Sopenharmony_ci		"                         OpStore %42 %41\n"
226e5c31af7Sopenharmony_ci		"                   %46 = OpAccessChain %_ptr_Uniform_f %dataInput %c_i32_0 %30 %c_i32_1 %c_u32_0\n"
227e5c31af7Sopenharmony_ci		"                   %47 = OpLoad %f32 %46\n"
228e5c31af7Sopenharmony_ci		"                   %49 = OpAccessChain %_ptr_Uniform_f %dataOutput %c_i32_0 %30 %c_u32_2\n"
229e5c31af7Sopenharmony_ci		"                         OpStore %49 %47\n"
230e5c31af7Sopenharmony_ci		"                   %52 = OpAccessChain %_ptr_Uniform_f %dataInput %c_i32_0 %30 %c_i32_1 %c_u32_1\n"
231e5c31af7Sopenharmony_ci		"                   %53 = OpLoad %f32 %52\n"
232e5c31af7Sopenharmony_ci		"                   %55 = OpAccessChain %_ptr_Uniform_f %dataOutput %c_i32_0 %30 %c_u32_3\n"
233e5c31af7Sopenharmony_ci		"                         OpStore %55 %53\n"
234e5c31af7Sopenharmony_ci		"                         OpBranch %inc\n"
235e5c31af7Sopenharmony_ci
236e5c31af7Sopenharmony_ci		"                  %inc = OpLabel\n"
237e5c31af7Sopenharmony_ci		"                   %37 = OpLoad %i32 %i\n"
238e5c31af7Sopenharmony_ci		"                   %39 = OpIAdd %i32 %37 %c_i32_1\n"
239e5c31af7Sopenharmony_ci		"                         OpStore %i %39\n"
240e5c31af7Sopenharmony_ci		"                         OpBranch %loop\n"
241e5c31af7Sopenharmony_ci
242e5c31af7Sopenharmony_ci		"                %merge = OpLabel\n"
243e5c31af7Sopenharmony_ci		"                         OpReturnValue %param\n"
244e5c31af7Sopenharmony_ci
245e5c31af7Sopenharmony_ci		"                         OpFunctionEnd\n";
246e5c31af7Sopenharmony_ci
247e5c31af7Sopenharmony_ci	resources.inputs.back().setDescriptorType(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER);
248e5c31af7Sopenharmony_ci
249e5c31af7Sopenharmony_ci	vulkanFeatures.coreFeatures.vertexPipelineStoresAndAtomics = DE_TRUE;
250e5c31af7Sopenharmony_ci	vulkanFeatures.coreFeatures.fragmentStoresAndAtomics = DE_FALSE;
251e5c31af7Sopenharmony_ci	createTestForStage(VK_SHADER_STAGE_VERTEX_BIT, "mat2x2_vert", defaultColors, defaultColors, fragments, noSpecConstants,
252e5c31af7Sopenharmony_ci					   noPushConstants, resources, noInterfaces, noExtensions, vulkanFeatures, group);
253e5c31af7Sopenharmony_ci
254e5c31af7Sopenharmony_ci	createTestForStage(VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT, "mat2x2_tessc", defaultColors, defaultColors, fragments, noSpecConstants,
255e5c31af7Sopenharmony_ci					   noPushConstants, resources, noInterfaces, noExtensions, vulkanFeatures, group);
256e5c31af7Sopenharmony_ci
257e5c31af7Sopenharmony_ci	createTestForStage(VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT, "mat2x2_tesse", defaultColors, defaultColors, fragments, noSpecConstants,
258e5c31af7Sopenharmony_ci					   noPushConstants, resources, noInterfaces, noExtensions, vulkanFeatures, group);
259e5c31af7Sopenharmony_ci
260e5c31af7Sopenharmony_ci	createTestForStage(VK_SHADER_STAGE_GEOMETRY_BIT, "mat2x2_geom", defaultColors, defaultColors, fragments, noSpecConstants,
261e5c31af7Sopenharmony_ci					   noPushConstants, resources, noInterfaces, noExtensions, vulkanFeatures, group);
262e5c31af7Sopenharmony_ci
263e5c31af7Sopenharmony_ci	vulkanFeatures.coreFeatures.vertexPipelineStoresAndAtomics = DE_FALSE;
264e5c31af7Sopenharmony_ci	vulkanFeatures.coreFeatures.fragmentStoresAndAtomics = DE_TRUE;
265e5c31af7Sopenharmony_ci	createTestForStage(VK_SHADER_STAGE_FRAGMENT_BIT, "mat2x2_frag", defaultColors, defaultColors, fragments, noSpecConstants,
266e5c31af7Sopenharmony_ci					   noPushConstants, resources, noInterfaces, noExtensions, vulkanFeatures, group);
267e5c31af7Sopenharmony_ci}
268e5c31af7Sopenharmony_ci
269e5c31af7Sopenharmony_ci} // anonymous
270e5c31af7Sopenharmony_ci
271e5c31af7Sopenharmony_citcu::TestCaseGroup* createUboMatrixPaddingComputeGroup (tcu::TestContext& testCtx)
272e5c31af7Sopenharmony_ci{
273e5c31af7Sopenharmony_ci	// Compute tests for UBO struct member packing.
274e5c31af7Sopenharmony_ci	de::MovePtr<tcu::TestCaseGroup> group		(new tcu::TestCaseGroup(testCtx, "ubo_padding"));
275e5c31af7Sopenharmony_ci	addComputeUboMatrixPaddingTest(group.get());
276e5c31af7Sopenharmony_ci
277e5c31af7Sopenharmony_ci	return group.release();
278e5c31af7Sopenharmony_ci}
279e5c31af7Sopenharmony_ci
280e5c31af7Sopenharmony_citcu::TestCaseGroup* createUboMatrixPaddingGraphicsGroup (tcu::TestContext& testCtx)
281e5c31af7Sopenharmony_ci{
282e5c31af7Sopenharmony_ci	de::MovePtr<tcu::TestCaseGroup> group		(new tcu::TestCaseGroup(testCtx, "ubo_padding", "Graphics tests for UBO struct member packing."));
283e5c31af7Sopenharmony_ci	addGraphicsUboMatrixPaddingTest(group.get());
284e5c31af7Sopenharmony_ci
285e5c31af7Sopenharmony_ci	return group.release();
286e5c31af7Sopenharmony_ci}
287e5c31af7Sopenharmony_ci
288e5c31af7Sopenharmony_ci} // SpirVAssembly
289e5c31af7Sopenharmony_ci} // vkt
290