* @brief simple in-place string replacement helper function for substituting * placeholders in a WGSL string template. * * Note this is not meant to be used in performance-critical code paths and * should be used ahead-of-time before any performance-critical codepath to * preprocess WGSL code strings. * * @param[in] str String to mutate with substitution replacements. * @param[in] from Sub
| 273 | * @endcode |
| 274 | */ |
| 275 | inline void replaceAll(std::string &str, const std::string &from, |
| 276 | const std::string &to) { |
| 277 | size_t start_pos = 0; |
| 278 | while ((start_pos = str.find(from, start_pos)) != std::string::npos) { |
| 279 | str.replace(start_pos, from.length(), to); |
| 280 | start_pos += to.length(); |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | /** |
| 285 | * @brief KernelCode is the representation of WGSL GPU code with template |
no outgoing calls
no test coverage detected