* @brief Resets the command buffer in preparation for a kernel dispatch. * Since command buffers are consumed upon submission, this function is used * both in the initial kernel creation and every time the kernel is to be * reused for a dispatch. * @param[in] device WGPUDevice instance to manage the operation * @param[in] op Kernel instance representing the kernel to reset * * @code * rese
| 1143 | * @endcode |
| 1144 | */ |
| 1145 | inline void resetCommandBuffer(WGPUDevice &device, Kernel &op) { |
| 1146 | { |
| 1147 | WGPUCommandEncoder commandEncoder = |
| 1148 | wgpuDeviceCreateCommandEncoder(device, nullptr); |
| 1149 | WGPUComputePassEncoder computePassEncoder = |
| 1150 | wgpuCommandEncoderBeginComputePass(commandEncoder, nullptr); |
| 1151 | wgpuComputePassEncoderSetPipeline(computePassEncoder, op.computePipeline); |
| 1152 | wgpuComputePassEncoderSetBindGroup(computePassEncoder, 0, op.bindGroup, 0, |
| 1153 | nullptr); |
| 1154 | wgpuComputePassEncoderDispatchWorkgroups( |
| 1155 | computePassEncoder, op.totalWorkgroups[0], op.totalWorkgroups[1], |
| 1156 | op.totalWorkgroups[2]); |
| 1157 | wgpuComputePassEncoderEnd(computePassEncoder); |
| 1158 | op.commandBuffer = wgpuCommandEncoderFinish(commandEncoder, nullptr); |
| 1159 | } |
| 1160 | } |
| 1161 | |
| 1162 | /** |
| 1163 | * @brief NoParam is a no-op type used to indicate that a kernel does not have |
no outgoing calls
no test coverage detected