| 140 | } |
| 141 | |
| 142 | std::string GenerateVulkanCode(const std::string instruction, |
| 143 | const uint32_t semantics, |
| 144 | const uint32_t semantics2 = 0) { |
| 145 | std::ostringstream ss; |
| 146 | ss << R"( |
| 147 | OpCapability Shader |
| 148 | OpCapability VulkanMemoryModel |
| 149 | OpExtension "SPV_KHR_vulkan_memory_model" |
| 150 | OpMemoryModel Logical Vulkan |
| 151 | OpEntryPoint GLCompute %main "main" %var |
| 152 | OpExecutionMode %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"( |
| 175 | OpReturn |
| 176 | OpFunctionEnd)"; |
| 177 | |
| 178 | return ss.str(); |
| 179 | } |
| 180 | |
| 181 | using VulkanMemorySemantics = |
| 182 | spvtest::ValidateBase<std::tuple<uint32_t, uint32_t, uint32_t, uint32_t, |