Skip to content

Commit

Permalink
Allow setting threadpool size (GLTFPACK_NUM_TOKTX_INSTANCES)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejurka committed Oct 3, 2021
1 parent 63953e3 commit e80b542
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion gltf/gltfpack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,14 @@ static void process(cgltf_data* data, const char* input_path, const char* output
std::vector<std::unique_ptr<TempFile>> images_pre_encoded(data->images_count);
const bool MULTITHREADED_ENCODE = true;
if (MULTITHREADED_ENCODE) {
ThreadPool pool(7);
int threadpool_size = 7;

const char* num_instances_env = getenv("GLTFPACK_NUM_TOKTX_INSTANCES");
if (num_instances_env != NULL) {
int n = atoi(num_instances_env);
if (n != 0) threadpool_size = n;
}
ThreadPool pool(threadpool_size);
std::vector<std::future<bool>> task_results(data->images_count);
for (size_t i = 0; i < data->images_count; ++i)
{
Expand Down

0 comments on commit e80b542

Please sign in to comment.