Cherry-pick SPIR-V assembly test improvements
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / modules / vulkan / spirv_assembly / vktSpvAsmComputeShaderTestUtil.cpp
index 5727fb5..2d60026 100644 (file)
 
 #include "vktSpvAsmComputeShaderTestUtil.hpp"
 
-DE_EMPTY_CPP_FILE
+namespace vkt
+{
+namespace SpirVAssembly
+{
+
+const char* getComputeAsmShaderPreamble (void)
+{
+       return
+               "OpCapability Shader\n"
+               "OpMemoryModel Logical GLSL450\n"
+               "OpEntryPoint GLCompute %main \"main\" %id\n"
+               "OpExecutionMode %main LocalSize 1 1 1\n";
+}
+
+const char* getComputeAsmCommonTypes (void)
+{
+       return
+               "%bool      = OpTypeBool\n"
+               "%void      = OpTypeVoid\n"
+               "%voidf     = OpTypeFunction %void\n"
+               "%u32       = OpTypeInt 32 0\n"
+               "%i32       = OpTypeInt 32 1\n"
+               "%f32       = OpTypeFloat 32\n"
+               "%uvec3     = OpTypeVector %u32 3\n"
+               "%fvec3     = OpTypeVector %f32 3\n"
+               "%uvec3ptr  = OpTypePointer Input %uvec3\n"
+               "%i32ptr    = OpTypePointer Uniform %i32\n"
+               "%f32ptr    = OpTypePointer Uniform %f32\n"
+               "%i32arr    = OpTypeRuntimeArray %i32\n"
+               "%f32arr    = OpTypeRuntimeArray %f32\n";
+}
+
+const char* getComputeAsmInputOutputBuffer (void)
+{
+       return
+               "%buf     = OpTypeStruct %f32arr\n"
+               "%bufptr  = OpTypePointer Uniform %buf\n"
+               "%indata    = OpVariable %bufptr Uniform\n"
+               "%outdata   = OpVariable %bufptr Uniform\n";
+}
+
+const char* getComputeAsmInputOutputBufferTraits (void)
+{
+       return
+               "OpDecorate %buf BufferBlock\n"
+               "OpDecorate %indata DescriptorSet 0\n"
+               "OpDecorate %indata Binding 0\n"
+               "OpDecorate %outdata DescriptorSet 0\n"
+               "OpDecorate %outdata Binding 1\n"
+               "OpDecorate %f32arr ArrayStride 4\n"
+               "OpMemberDecorate %buf 0 Offset 0\n";
+}
+
+} // SpirVAssembly
+} // vkt