MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / GenerateVulkanCode

Function GenerateVulkanCode

test/val/val_memory_semantics_test.cpp:142–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142std::string GenerateVulkanCode(const std::string instruction,
143 const uint32_t semantics,
144 const uint32_t semantics2 = 0) {
145 std::ostringstream ss;
146 ss << R"(
147OpCapability Shader
148OpCapability VulkanMemoryModel
149OpExtension "SPV_KHR_vulkan_memory_model"
150OpMemoryModel Logical Vulkan
151OpEntryPoint GLCompute %main "main" %var
152OpExecutionMode %main LocalSize 32 1 1
153%void = OpTypeVoid
154%uint = OpTypeInt 32 0
155%func = OpTypeFunction %void
156%uint_ptr = OpTypePointer Workgroup %uint
157%uint_0 = OpConstant %uint 0
158%uint_1 = OpConstant %uint 1
159%uint_2 = OpConstant %uint 2
160%uint_4 = OpConstant %uint 4
161%scope = OpConstant %uint 5
162%semantics = OpConstant %uint )"
163 << semantics << R"(
164%semantics2 = OpConstant %uint )"
165 << semantics2 << R"(
166%semantics_min = OpConstant %uint )"
167 << (semantics & Volatile) << R"(
168%semantics_max = OpConstant %uint )"
169 << (32712 | (semantics & Volatile)) << R"(
170%var = OpVariable %uint_ptr Workgroup
171%main = OpFunction %void None %func
172%label = OpLabel
173)" << instruction
174 << R"(
175OpReturn
176OpFunctionEnd)";
177
178 return ss.str();
179}
180
181using VulkanMemorySemantics =
182 spvtest::ValidateBase<std::tuple<uint32_t, uint32_t, uint32_t, uint32_t,

Callers 1

TEST_PFunction · 0.85

Calls 1

strMethod · 0.45

Tested by

no test coverage detected