Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 1 | // Copyright 2019 The SwiftShader Authors. All Rights Reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | #include "ComputeProgram.hpp" |
Chris Forbes | 548e366 | 2019-04-25 10:00:06 -0700 | [diff] [blame] | 16 | #include "Constants.hpp" |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 17 | |
| 18 | #include "Vulkan/VkDebug.hpp" |
| 19 | #include "Vulkan/VkPipelineLayout.hpp" |
| 20 | |
Ben Clayton | ecfeede | 2019-05-08 08:51:01 +0100 | [diff] [blame] | 21 | #include <queue> |
| 22 | |
Ben Clayton | c2bb50b | 2019-03-13 14:28:32 +0000 | [diff] [blame] | 23 | namespace |
| 24 | { |
| 25 | enum { X, Y, Z }; |
| 26 | } // anonymous namespace |
| 27 | |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 28 | namespace sw |
| 29 | { |
Nicolas Capens | 09591b8 | 2019-04-08 22:51:08 -0400 | [diff] [blame] | 30 | ComputeProgram::ComputeProgram(SpirvShader const *shader, vk::PipelineLayout const *pipelineLayout, const vk::DescriptorSet::Bindings &descriptorSets) |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 31 | : data(Arg<0>()), |
| 32 | routine(pipelineLayout), |
| 33 | shader(shader), |
Nicolas Capens | 09591b8 | 2019-04-08 22:51:08 -0400 | [diff] [blame] | 34 | pipelineLayout(pipelineLayout), |
| 35 | descriptorSets(descriptorSets) |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 36 | { |
| 37 | } |
| 38 | |
| 39 | ComputeProgram::~ComputeProgram() |
| 40 | { |
| 41 | } |
| 42 | |
| 43 | void ComputeProgram::generate() |
| 44 | { |
| 45 | shader->emitProlog(&routine); |
| 46 | emit(); |
| 47 | shader->emitEpilog(&routine); |
| 48 | } |
| 49 | |
Ben Clayton | 13dcbec | 2019-05-08 08:43:55 +0100 | [diff] [blame] | 50 | void ComputeProgram::setWorkgroupBuiltins(Int workgroupID[3]) |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 51 | { |
Ben Clayton | c2bb50b | 2019-03-13 14:28:32 +0000 | [diff] [blame] | 52 | setInputBuiltin(spv::BuiltInNumWorkgroups, [&](const SpirvShader::BuiltinMapping& builtin, Array<SIMD::Float>& value) |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 53 | { |
Ben Clayton | 13dcbec | 2019-05-08 08:43:55 +0100 | [diff] [blame] | 54 | auto numWorkgroups = *Pointer<Int4>(data + OFFSET(Data, numWorkgroups)); |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 55 | for (uint32_t component = 0; component < builtin.SizeInComponents; component++) |
| 56 | { |
| 57 | value[builtin.FirstComponent + component] = |
Ben Clayton | c2bb50b | 2019-03-13 14:28:32 +0000 | [diff] [blame] | 58 | As<SIMD::Float>(SIMD::Int(Extract(numWorkgroups, component))); |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 59 | } |
| 60 | }); |
| 61 | |
Chris Forbes | f256465 | 2019-03-19 09:06:19 -0700 | [diff] [blame] | 62 | setInputBuiltin(spv::BuiltInWorkgroupId, [&](const SpirvShader::BuiltinMapping& builtin, Array<SIMD::Float>& value) |
| 63 | { |
| 64 | for (uint32_t component = 0; component < builtin.SizeInComponents; component++) |
| 65 | { |
| 66 | value[builtin.FirstComponent + component] = |
Ben Clayton | 13dcbec | 2019-05-08 08:43:55 +0100 | [diff] [blame] | 67 | As<SIMD::Float>(SIMD::Int(workgroupID[component])); |
Chris Forbes | f256465 | 2019-03-19 09:06:19 -0700 | [diff] [blame] | 68 | } |
| 69 | }); |
| 70 | |
Ben Clayton | c2bb50b | 2019-03-13 14:28:32 +0000 | [diff] [blame] | 71 | setInputBuiltin(spv::BuiltInWorkgroupSize, [&](const SpirvShader::BuiltinMapping& builtin, Array<SIMD::Float>& value) |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 72 | { |
Ben Clayton | 13dcbec | 2019-05-08 08:43:55 +0100 | [diff] [blame] | 73 | auto workgroupSize = *Pointer<Int4>(data + OFFSET(Data, workgroupSize)); |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 74 | for (uint32_t component = 0; component < builtin.SizeInComponents; component++) |
| 75 | { |
| 76 | value[builtin.FirstComponent + component] = |
Ben Clayton | c2bb50b | 2019-03-13 14:28:32 +0000 | [diff] [blame] | 77 | As<SIMD::Float>(SIMD::Int(Extract(workgroupSize, component))); |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 78 | } |
| 79 | }); |
| 80 | |
Ben Clayton | c2bb50b | 2019-03-13 14:28:32 +0000 | [diff] [blame] | 81 | setInputBuiltin(spv::BuiltInNumSubgroups, [&](const SpirvShader::BuiltinMapping& builtin, Array<SIMD::Float>& value) |
Ben Clayton | 5ceec2c | 2019-03-13 09:16:50 +0000 | [diff] [blame] | 82 | { |
| 83 | ASSERT(builtin.SizeInComponents == 1); |
Ben Clayton | 13dcbec | 2019-05-08 08:43:55 +0100 | [diff] [blame] | 84 | auto subgroupsPerWorkgroup = *Pointer<Int>(data + OFFSET(Data, subgroupsPerWorkgroup)); |
| 85 | value[builtin.FirstComponent] = As<SIMD::Float>(SIMD::Int(subgroupsPerWorkgroup)); |
Ben Clayton | 5ceec2c | 2019-03-13 09:16:50 +0000 | [diff] [blame] | 86 | }); |
| 87 | |
Ben Clayton | c2bb50b | 2019-03-13 14:28:32 +0000 | [diff] [blame] | 88 | setInputBuiltin(spv::BuiltInSubgroupSize, [&](const SpirvShader::BuiltinMapping& builtin, Array<SIMD::Float>& value) |
Ben Clayton | 5ceec2c | 2019-03-13 09:16:50 +0000 | [diff] [blame] | 89 | { |
| 90 | ASSERT(builtin.SizeInComponents == 1); |
Ben Clayton | 13dcbec | 2019-05-08 08:43:55 +0100 | [diff] [blame] | 91 | auto invocationsPerSubgroup = *Pointer<Int>(data + OFFSET(Data, invocationsPerSubgroup)); |
| 92 | value[builtin.FirstComponent] = As<SIMD::Float>(SIMD::Int(invocationsPerSubgroup)); |
Ben Clayton | 5ceec2c | 2019-03-13 09:16:50 +0000 | [diff] [blame] | 93 | }); |
| 94 | |
Ben Clayton | c2bb50b | 2019-03-13 14:28:32 +0000 | [diff] [blame] | 95 | setInputBuiltin(spv::BuiltInSubgroupLocalInvocationId, [&](const SpirvShader::BuiltinMapping& builtin, Array<SIMD::Float>& value) |
Ben Clayton | 5ceec2c | 2019-03-13 09:16:50 +0000 | [diff] [blame] | 96 | { |
| 97 | ASSERT(builtin.SizeInComponents == 1); |
Ben Clayton | c2bb50b | 2019-03-13 14:28:32 +0000 | [diff] [blame] | 98 | value[builtin.FirstComponent] = As<SIMD::Float>(SIMD::Int(0, 1, 2, 3)); |
Ben Clayton | 5ceec2c | 2019-03-13 09:16:50 +0000 | [diff] [blame] | 99 | }); |
Ben Clayton | 2cd983d | 2019-05-10 11:30:09 +0100 | [diff] [blame] | 100 | |
| 101 | setInputBuiltin(spv::BuiltInDeviceIndex, [&](const SpirvShader::BuiltinMapping& builtin, Array<SIMD::Float>& value) |
| 102 | { |
| 103 | ASSERT(builtin.SizeInComponents == 1); |
| 104 | // Only a single physical device is supported. |
| 105 | value[builtin.FirstComponent] = As<SIMD::Float>(SIMD::Int(0, 0, 0, 0)); |
| 106 | }); |
Ben Clayton | 13dcbec | 2019-05-08 08:43:55 +0100 | [diff] [blame] | 107 | } |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 108 | |
Ben Clayton | 13dcbec | 2019-05-08 08:43:55 +0100 | [diff] [blame] | 109 | void ComputeProgram::setSubgroupBuiltins(Int workgroupID[3], SIMD::Int localInvocationIndex, Int subgroupIndex) |
| 110 | { |
| 111 | Int4 numWorkgroups = *Pointer<Int4>(data + OFFSET(Data, numWorkgroups)); |
| 112 | Int4 workgroupSize = *Pointer<Int4>(data + OFFSET(Data, workgroupSize)); |
| 113 | |
| 114 | // TODO: Fix Int4 swizzles so we can just use workgroupSize.x, workgroupSize.y. |
| 115 | Int workgroupSizeX = Extract(workgroupSize, X); |
| 116 | Int workgroupSizeY = Extract(workgroupSize, Y); |
| 117 | |
| 118 | SIMD::Int localInvocationID[3]; |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 119 | { |
Ben Clayton | 13dcbec | 2019-05-08 08:43:55 +0100 | [diff] [blame] | 120 | SIMD::Int idx = localInvocationIndex; |
| 121 | localInvocationID[Z] = idx / SIMD::Int(workgroupSizeX * workgroupSizeY); |
| 122 | idx -= localInvocationID[Z] * SIMD::Int(workgroupSizeX * workgroupSizeY); // modulo |
| 123 | localInvocationID[Y] = idx / SIMD::Int(workgroupSizeX); |
| 124 | idx -= localInvocationID[Y] * SIMD::Int(workgroupSizeX); // modulo |
| 125 | localInvocationID[X] = idx; |
| 126 | } |
| 127 | |
| 128 | setInputBuiltin(spv::BuiltInLocalInvocationIndex, [&](const SpirvShader::BuiltinMapping& builtin, Array<SIMD::Float>& value) |
| 129 | { |
| 130 | ASSERT(builtin.SizeInComponents == 1); |
| 131 | value[builtin.FirstComponent] = As<SIMD::Float>(localInvocationIndex); |
| 132 | }); |
| 133 | |
| 134 | setInputBuiltin(spv::BuiltInSubgroupId, [&](const SpirvShader::BuiltinMapping& builtin, Array<SIMD::Float>& value) |
| 135 | { |
| 136 | ASSERT(builtin.SizeInComponents == 1); |
| 137 | value[builtin.FirstComponent] = As<SIMD::Float>(SIMD::Int(subgroupIndex)); |
| 138 | }); |
| 139 | |
| 140 | setInputBuiltin(spv::BuiltInLocalInvocationId, [&](const SpirvShader::BuiltinMapping& builtin, Array<SIMD::Float>& value) |
| 141 | { |
| 142 | for (uint32_t component = 0; component < builtin.SizeInComponents; component++) |
| 143 | { |
| 144 | value[builtin.FirstComponent + component] = |
| 145 | As<SIMD::Float>(localInvocationID[component]); |
| 146 | } |
| 147 | }); |
| 148 | |
| 149 | setInputBuiltin(spv::BuiltInGlobalInvocationId, [&](const SpirvShader::BuiltinMapping& builtin, Array<SIMD::Float>& value) |
| 150 | { |
| 151 | SIMD::Int wgID = 0; |
| 152 | wgID = Insert(wgID, workgroupID[X], X); |
| 153 | wgID = Insert(wgID, workgroupID[Y], Y); |
| 154 | wgID = Insert(wgID, workgroupID[Z], Z); |
| 155 | auto localBase = workgroupSize * wgID; |
| 156 | for (uint32_t component = 0; component < builtin.SizeInComponents; component++) |
| 157 | { |
| 158 | auto globalInvocationID = SIMD::Int(Extract(localBase, component)) + localInvocationID[component]; |
| 159 | value[builtin.FirstComponent + component] = As<SIMD::Float>(globalInvocationID); |
| 160 | } |
| 161 | }); |
| 162 | } |
| 163 | |
| 164 | void ComputeProgram::emit() |
| 165 | { |
Ben Clayton | ecfeede | 2019-05-08 08:51:01 +0100 | [diff] [blame] | 166 | Int workgroupX = Arg<1>(); |
| 167 | Int workgroupY = Arg<2>(); |
| 168 | Int workgroupZ = Arg<3>(); |
| 169 | Pointer<Byte> workgroupMemory = Arg<4>(); |
| 170 | Int firstSubgroup = Arg<5>(); |
| 171 | Int subgroupCount = Arg<6>(); |
| 172 | |
Ben Clayton | 13dcbec | 2019-05-08 08:43:55 +0100 | [diff] [blame] | 173 | routine.descriptorSets = data + OFFSET(Data, descriptorSets); |
| 174 | routine.descriptorDynamicOffsets = data + OFFSET(Data, descriptorDynamicOffsets); |
| 175 | routine.pushConstants = data + OFFSET(Data, pushConstants); |
| 176 | routine.constants = *Pointer<Pointer<Byte>>(data + OFFSET(Data, constants)); |
Ben Clayton | ecfeede | 2019-05-08 08:51:01 +0100 | [diff] [blame] | 177 | routine.workgroupMemory = workgroupMemory; |
Ben Clayton | 13dcbec | 2019-05-08 08:43:55 +0100 | [diff] [blame] | 178 | |
| 179 | Int invocationsPerWorkgroup = *Pointer<Int>(data + OFFSET(Data, invocationsPerWorkgroup)); |
| 180 | |
| 181 | Int workgroupID[3] = {workgroupX, workgroupY, workgroupZ}; |
| 182 | setWorkgroupBuiltins(workgroupID); |
| 183 | |
| 184 | For(Int i = 0, i < subgroupCount, i++) |
| 185 | { |
| 186 | auto subgroupIndex = firstSubgroup + i; |
| 187 | |
Ben Clayton | c2bb50b | 2019-03-13 14:28:32 +0000 | [diff] [blame] | 188 | // TODO: Replace SIMD::Int(0, 1, 2, 3) with SIMD-width equivalent |
| 189 | auto localInvocationIndex = SIMD::Int(subgroupIndex * SIMD::Width) + SIMD::Int(0, 1, 2, 3); |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 190 | |
Ben Clayton | 13dcbec | 2019-05-08 08:43:55 +0100 | [diff] [blame] | 191 | // Disable lanes where (invocationIDs >= invocationsPerWorkgroup) |
| 192 | auto activeLaneMask = CmpLT(localInvocationIndex, SIMD::Int(invocationsPerWorkgroup)); |
Ben Clayton | 49d8158 | 2019-03-12 20:05:04 +0000 | [diff] [blame] | 193 | |
Ben Clayton | 13dcbec | 2019-05-08 08:43:55 +0100 | [diff] [blame] | 194 | setSubgroupBuiltins(workgroupID, localInvocationIndex, subgroupIndex); |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 195 | |
Nicolas Capens | 09591b8 | 2019-04-08 22:51:08 -0400 | [diff] [blame] | 196 | shader->emit(&routine, activeLaneMask, descriptorSets); |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 197 | } |
| 198 | } |
| 199 | |
Ben Clayton | c2bb50b | 2019-03-13 14:28:32 +0000 | [diff] [blame] | 200 | void ComputeProgram::setInputBuiltin(spv::BuiltIn id, std::function<void(const SpirvShader::BuiltinMapping& builtin, Array<SIMD::Float>& value)> cb) |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 201 | { |
| 202 | auto it = shader->inputBuiltins.find(id); |
| 203 | if (it != shader->inputBuiltins.end()) |
| 204 | { |
| 205 | const auto& builtin = it->second; |
Ben Clayton | 4774761 | 2019-04-04 16:27:35 +0100 | [diff] [blame] | 206 | cb(builtin, routine.getVariable(builtin.Id)); |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 207 | } |
| 208 | } |
| 209 | |
| 210 | void ComputeProgram::run( |
Ben Clayton | 225a130 | 2019-04-02 12:28:22 +0100 | [diff] [blame] | 211 | vk::DescriptorSet::Bindings const &descriptorSets, |
| 212 | vk::DescriptorSet::DynamicOffsets const &descriptorDynamicOffsets, |
| 213 | PushConstantStorage const &pushConstants, |
Chris Forbes | 4a4c259 | 2019-05-13 08:53:36 -0700 | [diff] [blame] | 214 | uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 215 | uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) |
| 216 | { |
Ben Clayton | 13dcbec | 2019-05-08 08:43:55 +0100 | [diff] [blame] | 217 | auto &modes = shader->getModes(); |
| 218 | |
| 219 | auto invocationsPerSubgroup = SIMD::Width; |
| 220 | auto invocationsPerWorkgroup = modes.WorkgroupSizeX * modes.WorkgroupSizeY * modes.WorkgroupSizeZ; |
| 221 | auto subgroupsPerWorkgroup = (invocationsPerWorkgroup + invocationsPerSubgroup - 1) / invocationsPerSubgroup; |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 222 | |
Ben Clayton | ecd3848 | 2019-04-19 17:11:08 -0400 | [diff] [blame] | 223 | // We're sharing a buffer here across all workgroups. |
Ben Clayton | ecfeede | 2019-05-08 08:51:01 +0100 | [diff] [blame] | 224 | // We can only do this because we know a single workgroup is in flight |
| 225 | // at any time. |
Ben Clayton | ecd3848 | 2019-04-19 17:11:08 -0400 | [diff] [blame] | 226 | std::vector<uint8_t> workgroupMemory(shader->workgroupMemory.size()); |
| 227 | |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 228 | Data data; |
| 229 | data.descriptorSets = descriptorSets; |
Ben Clayton | 225a130 | 2019-04-02 12:28:22 +0100 | [diff] [blame] | 230 | data.descriptorDynamicOffsets = descriptorDynamicOffsets; |
Ben Clayton | c2bb50b | 2019-03-13 14:28:32 +0000 | [diff] [blame] | 231 | data.numWorkgroups[X] = groupCountX; |
| 232 | data.numWorkgroups[Y] = groupCountY; |
| 233 | data.numWorkgroups[Z] = groupCountZ; |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 234 | data.numWorkgroups[3] = 0; |
Ben Clayton | 13dcbec | 2019-05-08 08:43:55 +0100 | [diff] [blame] | 235 | data.workgroupSize[X] = modes.WorkgroupSizeX; |
| 236 | data.workgroupSize[Y] = modes.WorkgroupSizeY; |
| 237 | data.workgroupSize[Z] = modes.WorkgroupSizeZ; |
| 238 | data.workgroupSize[3] = 0; |
| 239 | data.invocationsPerSubgroup = invocationsPerSubgroup; |
| 240 | data.invocationsPerWorkgroup = invocationsPerWorkgroup; |
| 241 | data.subgroupsPerWorkgroup = subgroupsPerWorkgroup; |
Chris Forbes | a30de54 | 2019-03-18 18:51:55 -0700 | [diff] [blame] | 242 | data.pushConstants = pushConstants; |
Chris Forbes | 548e366 | 2019-04-25 10:00:06 -0700 | [diff] [blame] | 243 | data.constants = &sw::constants; |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 244 | |
Chris Forbes | 4a4c259 | 2019-05-13 08:53:36 -0700 | [diff] [blame] | 245 | for (uint32_t groupZ = baseGroupZ; groupZ < baseGroupZ + groupCountZ; groupZ++) |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 246 | { |
Chris Forbes | 4a4c259 | 2019-05-13 08:53:36 -0700 | [diff] [blame] | 247 | for (uint32_t groupY = baseGroupY; groupY < baseGroupY + groupCountY; groupY++) |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 248 | { |
Chris Forbes | 4a4c259 | 2019-05-13 08:53:36 -0700 | [diff] [blame] | 249 | for (uint32_t groupX = baseGroupX; groupX < baseGroupX + groupCountX; groupX++) |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 250 | { |
Ben Clayton | ecfeede | 2019-05-08 08:51:01 +0100 | [diff] [blame] | 251 | |
| 252 | // TODO(bclayton): Split work across threads. |
| 253 | using Coroutine = std::unique_ptr<rr::Stream<SpirvShader::YieldResult>>; |
| 254 | std::queue<Coroutine> coroutines; |
| 255 | |
| 256 | if (shader->getModes().ContainsControlBarriers) |
| 257 | { |
| 258 | // Make a function call per subgroup so each subgroup |
| 259 | // can yield, bringing all subgroups to the barrier |
| 260 | // together. |
| 261 | for(int subgroupIndex = 0; subgroupIndex < subgroupsPerWorkgroup; subgroupIndex++) |
| 262 | { |
| 263 | auto coroutine = (*this)(&data, groupX, groupY, groupZ, workgroupMemory.data(), subgroupIndex, 1); |
| 264 | coroutines.push(std::move(coroutine)); |
| 265 | } |
| 266 | } |
| 267 | else |
| 268 | { |
| 269 | auto coroutine = (*this)(&data, groupX, groupY, groupZ, workgroupMemory.data(), 0, subgroupsPerWorkgroup); |
| 270 | coroutines.push(std::move(coroutine)); |
| 271 | } |
| 272 | |
| 273 | while (coroutines.size() > 0) |
| 274 | { |
| 275 | auto coroutine = std::move(coroutines.front()); |
| 276 | coroutines.pop(); |
| 277 | |
| 278 | SpirvShader::YieldResult result; |
| 279 | if (coroutine->await(result)) |
| 280 | { |
| 281 | // TODO: Consider result (when the enum is more than 1 entry). |
| 282 | coroutines.push(std::move(coroutine)); |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | } // groupX |
| 287 | } // groupY |
| 288 | } // groupZ |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 289 | } |
Ben Clayton | 13dcbec | 2019-05-08 08:43:55 +0100 | [diff] [blame] | 290 | |
| 291 | } // namespace sw |