* @brief Runner callback function for a compression worker thread. * * @param thread_count The number of threads in the worker pool. * @param thread_id The index of this thread in the worker pool. * @param payload The parameters for this thread. */
| 243 | * @param payload The parameters for this thread. |
| 244 | */ |
| 245 | static void compression_workload_runner( |
| 246 | int thread_count, |
| 247 | int thread_id, |
| 248 | void* payload |
| 249 | ) { |
| 250 | (void)thread_count; |
| 251 | |
| 252 | char name[16] { 0 }; |
| 253 | std::snprintf(name, 16, "astc workc %d", thread_id); |
| 254 | set_thread_name(name); |
| 255 | |
| 256 | compression_workload* work = static_cast<compression_workload*>(payload); |
| 257 | astcenc_error error = astcenc_compress_image( |
| 258 | work->context, work->image, &work->swizzle, |
| 259 | work->data_out, work->data_len, thread_id); |
| 260 | |
| 261 | // This is a racy update, so which error gets returned is a random, but it |
| 262 | // will reliably report an error if an error occurs |
| 263 | if (error != ASTCENC_SUCCESS) |
| 264 | { |
| 265 | work->error = error; |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | /** |
| 270 | * @brief Runner callback function for a decompression worker thread. |
nothing calls this directly
no test coverage detected