Several fixes for the parallel raycasts

- Limits the maximum number of threads to 64, since btThreadSupportPosix
and btThreadsupportWin32 don't support more than 64 bits at this moment,
due to the use of UINT64 bitmasks. This could be fixed by using
std::bitset or some other alternative.
- Introduces a threadpool class, b3ThreadPool, which is a simple wrapper
around btThreadSupportInterface and uses this instead of the global task
scheduler for parallel raycasting. This is actually quite a bit faster
than the task scheduler (~10-15% in my tests for parallel raycasts),
since the advanced features (parallelFor) are not necessary for the
parallel raycasts.
- Puts 16*1024 of MAX_RAY_INTERSECTION_MAX_SIZE_STREAMING in
parentheses, since it otherwise causes problems with other operators
of equal precedence and introduces a smaller constant for Apple targets.
- Refactors the parallel raycasts code and adds some more profiling.
This commit is contained in:
Tigran Gasparian
2018-06-19 18:28:48 +02:00
parent 8c851a70c7
commit b84eb8af74
5 changed files with 112 additions and 48 deletions

View File

@@ -585,7 +585,13 @@ typedef union {
#define MAX_RAY_INTERSECTION_BATCH_SIZE 256
#define MAX_RAY_INTERSECTION_BATCH_SIZE_STREAMING 16*1024
#ifdef __APPLE__
#define MAX_RAY_INTERSECTION_BATCH_SIZE_STREAMING (4*1024)
#else
#define MAX_RAY_INTERSECTION_BATCH_SIZE_STREAMING (16*1024)
#endif
#define MAX_RAY_HITS MAX_RAY_INTERSECTION_BATCH_SIZE
#define VISUAL_SHAPE_MAX_PATH_LEN 1024