Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
skgpu::graphite::ContextFactory Namespace Reference

Functions

SK_API std::unique_ptr< ContextMakeDawn (const DawnBackendContext &, const ContextOptions &)
 
SK_API std::unique_ptr< ContextMakeMetal (const MtlBackendContext &, const ContextOptions &)
 
SK_API std::unique_ptr< ContextMakeVulkan (const VulkanBackendContext &, const ContextOptions &)
 

Function Documentation

◆ MakeDawn()

std::unique_ptr< Context > skgpu::graphite::ContextFactory::MakeDawn ( const DawnBackendContext backendContext,
const ContextOptions options 
)

Definition at line 21 of file DawnGraphiteUtils.cpp.

22 {
23 sk_sp<SharedContext> sharedContext = DawnSharedContext::Make(backendContext, options);
24 if (!sharedContext) {
25 return nullptr;
26 }
27
28 auto queueManager =
29 std::make_unique<DawnQueueManager>(backendContext.fQueue, sharedContext.get());
30 if (!queueManager) {
31 return nullptr;
32 }
33
34 auto context = ContextCtorAccessor::MakeContext(std::move(sharedContext),
35 std::move(queueManager),
36 options);
37 SkASSERT(context);
38 return context;
39}
const char * options
#define SkASSERT(cond)
Definition SkAssert.h:116
T * get() const
Definition SkRefCnt.h:303

◆ MakeMetal()

std::unique_ptr< Context > skgpu::graphite::ContextFactory::MakeMetal ( const MtlBackendContext backendContext,
const ContextOptions options 
)

Definition at line 23 of file MtlGraphiteUtils.mm.

24 {
25 sk_sp<SharedContext> sharedContext = MtlSharedContext::Make(backendContext, options);
26 if (!sharedContext) {
27 return nullptr;
28 }
29
30 sk_cfp<id<MTLCommandQueue>> queue =
31 sk_ret_cfp((id<MTLCommandQueue>)(backendContext.fQueue.get()));
32 auto queueManager = std::make_unique<MtlQueueManager>(std::move(queue), sharedContext.get());
33 if (!queueManager) {
34 return nullptr;
35 }
36
37 return ContextCtorAccessor::MakeContext(std::move(sharedContext),
38 std::move(queueManager),
39 options);
40}
VkQueue queue
Definition main.cc:55

◆ MakeVulkan()

std::unique_ptr< Context > skgpu::graphite::ContextFactory::MakeVulkan ( const VulkanBackendContext backendContext,
const ContextOptions options 
)

Definition at line 22 of file VulkanGraphiteUtils.cpp.

23 {
24 sk_sp<SharedContext> sharedContext = VulkanSharedContext::Make(backendContext, options);
25 if (!sharedContext) {
26 return nullptr;
27 }
28
29 std::unique_ptr<QueueManager> queueManager(new VulkanQueueManager(backendContext.fQueue,
30 sharedContext.get()));
31 if (!queueManager) {
32 return nullptr;
33 }
34
35 return ContextCtorAccessor::MakeContext(std::move(sharedContext),
36 std::move(queueManager),
37 options);
38}