Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
skiatest::graphite::ContextFactory Class Reference

#include <ContextFactory.h>

Public Member Functions

 ContextFactory (const TestOptions &)
 
 ContextFactory ()=default
 
 ContextFactory (const ContextFactory &)=delete
 
ContextFactoryoperator= (const ContextFactory &)=delete
 
 ~ContextFactory ()=default
 
ContextInfo getContextInfo (skgpu::ContextType)
 

Detailed Description

Definition at line 30 of file ContextFactory.h.

Constructor & Destructor Documentation

◆ ContextFactory() [1/3]

skiatest::graphite::ContextFactory::ContextFactory ( const TestOptions options)
explicit

Definition at line 47 of file ContextFactory.cpp.

48 : fOptions(options) {}
const char * options

◆ ContextFactory() [2/3]

skiatest::graphite::ContextFactory::ContextFactory ( )
default

◆ ContextFactory() [3/3]

skiatest::graphite::ContextFactory::ContextFactory ( const ContextFactory )
delete

◆ ~ContextFactory()

skiatest::graphite::ContextFactory::~ContextFactory ( )
default

Member Function Documentation

◆ getContextInfo()

ContextInfo skiatest::graphite::ContextFactory::getContextInfo ( skgpu::ContextType  type)

Definition at line 54 of file ContextFactory.cpp.

54 {
56 return {};
57 }
58
59 // Look for an existing ContextInfo that we can re-use.
60 for (const OwnedContextInfo& ctxInfo : fContexts) {
61 if (ctxInfo.fType == type) {
62 return AsContextInfo(ctxInfo);
63 }
64 }
65
66 // Create a new ContextInfo from this context type.
67 std::unique_ptr<GraphiteTestContext> testCtx;
68
69 switch (type) {
70 case skgpu::ContextType::kMetal: {
71#ifdef SK_METAL
73#endif
74 } break;
75 case skgpu::ContextType::kVulkan: {
76#ifdef SK_VULKAN
78#endif
79 } break;
80#ifdef SK_DAWN
81
82#define CASE(TYPE) \
83 case skgpu::ContextType::kDawn_##TYPE: \
84 testCtx = graphite::DawnTestContext::Make(wgpu::BackendType::TYPE); \
85 break;
86#else
87#define CASE(TYPE) \
88 case skgpu::ContextType::kDawn_##TYPE: \
89 break;
90#endif // SK_DAWN
91 CASE(D3D11)
92 CASE(D3D12)
93 CASE(Metal)
94 CASE(Vulkan)
95 CASE(OpenGL)
96 CASE(OpenGLES)
97#undef CASE
98
99 default:
100 break;
101 }
102
103 if (!testCtx) {
104 return ContextInfo{};
105 }
106
107 std::unique_ptr<skgpu::graphite::Context> context = testCtx->makeContext(fOptions);
108 if (!context) {
109 return ContextInfo{};
110 }
111
112 fContexts.push_back({type, std::move(testCtx), std::move(context)});
113 return AsContextInfo(fContexts.back());
114}
static std::unique_ptr< GraphiteTestContext > Make()
static std::unique_ptr< GraphiteTestContext > Make()
#define CASE(Arity, Mask, Name, Args, Result)
bool IsDawnBackend(skgpu::ContextType type)

◆ operator=()

ContextFactory & skiatest::graphite::ContextFactory::operator= ( const ContextFactory )
delete

The documentation for this class was generated from the following files: