MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenColorIO / getGPUProcessor

Method getGPUProcessor

src/OpenColorIO/Processor.cpp:491–523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

489}
490
491ConstGPUProcessorRcPtr Processor::Impl::getGPUProcessor(const OpRcPtrVec & gpuOps,
492 OptimizationFlags oFlags) const
493{
494 // Helper method.
495 auto CreateProcessor = [](const OpRcPtrVec & ops,
496 OptimizationFlags oFlags) -> GPUProcessorRcPtr
497 {
498 GPUProcessorRcPtr gpu = GPUProcessorRcPtr(new GPUProcessor(), &GPUProcessor::deleter);
499 gpu->getImpl()->finalize(ops, oFlags);
500 return gpu;
501 };
502
503 oFlags = EnvironmentOverride(oFlags);
504
505 if (m_gpuProcessorCache.isEnabled())
506 {
507 AutoMutex guard(m_gpuProcessorCache.lock());
508
509 // As the entry is a shared pointer instance, having an empty one means that the entry does
510 // not exist in the cache. So, it provides a fast existence check & access in one call.
511 GPUProcessorRcPtr & processor = m_gpuProcessorCache[oFlags];
512 if (!processor)
513 {
514 processor = CreateProcessor(gpuOps, oFlags);
515 }
516
517 return processor;
518 }
519 else
520 {
521 return CreateProcessor(gpuOps, oFlags);
522 }
523}
524
525///////////////////////////////////////////////////////////////////////////
526

Callers

nothing calls this directly

Calls 5

EnvironmentOverrideFunction · 0.85
getImplMethod · 0.80
lockMethod · 0.80
finalizeMethod · 0.45
isEnabledMethod · 0.45

Tested by

no test coverage detected