| 273 | const unsigned int users); |
| 274 | |
| 275 | __forceinline size_t alloc(const size_t blocks) |
| 276 | { |
| 277 | if (unlikely(blocks >= switch_block_threshold)) |
| 278 | throw_RTCError(RTC_ERROR_INVALID_OPERATION,"allocation exceeds size of tessellation cache segment"); |
| 279 | |
| 280 | assert(blocks < switch_block_threshold); |
| 281 | size_t index = next_block.fetch_add(blocks); |
| 282 | if (unlikely(index + blocks >= switch_block_threshold)) return (size_t)-1; |
| 283 | return index; |
| 284 | } |
| 285 | |
| 286 | static __forceinline void* malloc(const size_t bytes) |
| 287 | { |