mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-20 23:31:13 -06:00
Add the full source of BambuStudio
using version 1.0.10
This commit is contained in:
parent
30bcadab3e
commit
1555904bef
3771 changed files with 1251328 additions and 0 deletions
70
src/libslic3r/SLA/Concurrency.hpp
Normal file
70
src/libslic3r/SLA/Concurrency.hpp
Normal file
|
@ -0,0 +1,70 @@
|
|||
#ifndef SLA_CONCURRENCY_H
|
||||
#define SLA_CONCURRENCY_H
|
||||
|
||||
// FIXME: Deprecated
|
||||
|
||||
#include <libslic3r/Execution/ExecutionSeq.hpp>
|
||||
#include <libslic3r/Execution/ExecutionTBB.hpp>
|
||||
|
||||
namespace Slic3r {
|
||||
namespace sla {
|
||||
|
||||
// Set this to true to enable full parallelism in this module.
|
||||
// Only the well tested parts will be concurrent if this is set to false.
|
||||
const constexpr bool USE_FULL_CONCURRENCY = true;
|
||||
|
||||
template<bool> struct _ccr {};
|
||||
|
||||
template<> struct _ccr<true>
|
||||
{
|
||||
using SpinningMutex = execution::SpinningMutex<ExecutionTBB>;
|
||||
using BlockingMutex = execution::BlockingMutex<ExecutionTBB>;
|
||||
|
||||
template<class It, class Fn>
|
||||
static void for_each(It from, It to, Fn &&fn, size_t granularity = 1)
|
||||
{
|
||||
execution::for_each(ex_tbb, from, to, std::forward<Fn>(fn), granularity);
|
||||
}
|
||||
|
||||
template<class...Args>
|
||||
static auto reduce(Args&&...args)
|
||||
{
|
||||
return execution::reduce(ex_tbb, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
static size_t max_concurreny()
|
||||
{
|
||||
return execution::max_concurrency(ex_tbb);
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct _ccr<false>
|
||||
{
|
||||
using SpinningMutex = execution::SpinningMutex<ExecutionSeq>;
|
||||
using BlockingMutex = execution::BlockingMutex<ExecutionSeq>;
|
||||
|
||||
template<class It, class Fn>
|
||||
static void for_each(It from, It to, Fn &&fn, size_t granularity = 1)
|
||||
{
|
||||
execution::for_each(ex_seq, from, to, std::forward<Fn>(fn), granularity);
|
||||
}
|
||||
|
||||
template<class...Args>
|
||||
static auto reduce(Args&&...args)
|
||||
{
|
||||
return execution::reduce(ex_seq, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
static size_t max_concurreny()
|
||||
{
|
||||
return execution::max_concurrency(ex_seq);
|
||||
}
|
||||
};
|
||||
|
||||
using ccr = _ccr<USE_FULL_CONCURRENCY>;
|
||||
using ccr_seq = _ccr<false>;
|
||||
using ccr_par = _ccr<true>;
|
||||
|
||||
}} // namespace Slic3r::sla
|
||||
|
||||
#endif // SLACONCURRENCY_H
|
Loading…
Add table
Add a link
Reference in a new issue