1 /*-------------------------------------------------------------------------
2 * Vulkan Conformance Tests
3 * ------------------------
5 * Copyright (c) 2015 Google Inc.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 * \brief Compute Shader Based Test Case Utility Structs/Functions
22 *//*--------------------------------------------------------------------*/
24 #include "vktSpvAsmComputeShaderTestUtil.hpp"
28 namespace SpirVAssembly
31 const char* getComputeAsmShaderPreamble (void)
34 "OpCapability Shader\n"
35 "OpMemoryModel Logical GLSL450\n"
36 "OpEntryPoint GLCompute %main \"main\" %id\n"
37 "OpExecutionMode %main LocalSize 1 1 1\n";
40 std::string getComputeAsmCommonTypes (std::string blockStorageClass)
43 "%bool = OpTypeBool\n"
44 "%void = OpTypeVoid\n"
45 "%voidf = OpTypeFunction %void\n"
46 "%u32 = OpTypeInt 32 0\n"
47 "%i32 = OpTypeInt 32 1\n"
48 "%f32 = OpTypeFloat 32\n"
49 "%uvec3 = OpTypeVector %u32 3\n"
50 "%fvec3 = OpTypeVector %f32 3\n"
51 "%uvec3ptr = OpTypePointer Input %uvec3\n") +
52 "%i32ptr = OpTypePointer " + blockStorageClass + " %i32\n"
53 "%f32ptr = OpTypePointer " + blockStorageClass + " %f32\n"
54 "%i32arr = OpTypeRuntimeArray %i32\n"
55 "%f32arr = OpTypeRuntimeArray %f32\n";
58 const char* getComputeAsmCommonInt64Types (void)
61 "%i64 = OpTypeInt 64 1\n"
62 "%i64ptr = OpTypePointer Uniform %i64\n"
63 "%i64arr = OpTypeRuntimeArray %i64\n";
66 const char* getComputeAsmInputOutputBuffer (void)
69 "%buf = OpTypeStruct %f32arr\n"
70 "%bufptr = OpTypePointer Uniform %buf\n"
71 "%indata = OpVariable %bufptr Uniform\n"
72 "%outdata = OpVariable %bufptr Uniform\n";
75 const char* getComputeAsmInputOutputBufferTraits (void)
78 "OpDecorate %buf BufferBlock\n"
79 "OpDecorate %indata DescriptorSet 0\n"
80 "OpDecorate %indata Binding 0\n"
81 "OpDecorate %outdata DescriptorSet 0\n"
82 "OpDecorate %outdata Binding 1\n"
83 "OpDecorate %f32arr ArrayStride 4\n"
84 "OpMemberDecorate %buf 0 Offset 0\n";