#include <GraphiteMetalWindowContext.h>
◆ GraphiteMetalWindowContext()
skwindow::internal::GraphiteMetalWindowContext::GraphiteMetalWindowContext |
( |
const DisplayParams & |
params | ) |
|
|
protected |
Definition at line 28 of file GraphiteMetalWindowContext.mm.
33}
static uint32_t GrNextPow2(uint32_t n)
DisplayParams fDisplayParams
WindowContext(const DisplayParams &)
CFTypeRef fDrawableHandle
const EmbeddedViewParams * params
◆ activate()
void skwindow::internal::GraphiteMetalWindowContext::activate |
( |
bool |
isActive | ) |
|
|
overridevirtual |
◆ destroyContext()
void skwindow::internal::GraphiteMetalWindowContext::destroyContext |
( |
| ) |
|
|
protected |
Definition at line 74 of file GraphiteMetalWindowContext.mm.
74 {
75 if (fGraphiteContext) {
76 fGraphiteRecorder.reset();
77 fGraphiteContext.reset();
78 }
79
81
84
87}
virtual void onDestroyContext()=0
sk_cfp< id< MTLCommandQueue > > fQueue
sk_cfp< id< MTLDevice > > fDevice
CAMetalLayer * fMetalLayer
◆ getBackbufferSurface()
sk_sp< SkSurface > skwindow::internal::GraphiteMetalWindowContext::getBackbufferSurface |
( |
| ) |
|
|
overridevirtual |
Implements skwindow::WindowContext.
Definition at line 89 of file GraphiteMetalWindowContext.mm.
89 {
91 id<CAMetalDrawable> currentDrawable = [
fMetalLayer nextDrawable];
92 if (currentDrawable == nil) {
93 return nullptr;
94 }
95
97 (CFTypeRef)currentDrawable.texture);
98
100 backendTex,
105
107}
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
SkISize dimensions() const
SK_API sk_sp< SkSurface > WrapBackendTexture(GrRecordingContext *context, const GrBackendTexture &backendTexture, GrSurfaceOrigin origin, int sampleCnt, SkColorType colorType, sk_sp< SkColorSpace > colorSpace, const SkSurfaceProps *surfaceProps, TextureReleaseProc textureReleaseProc=nullptr, ReleaseContext releaseContext=nullptr)
SkSurfaceProps fSurfaceProps
sk_sp< SkColorSpace > fColorSpace
◆ initializeContext()
void skwindow::internal::GraphiteMetalWindowContext::initializeContext |
( |
| ) |
|
|
protected |
Definition at line 35 of file GraphiteMetalWindowContext.mm.
35 {
38
39 fDevice.reset(MTLCreateSystemDefaultDevice());
41
43 if (@available(macOS 10.11, iOS 9.0, tvOS 9.0, *)) {
45 return;
46 }
47 } else {
48 return;
49 }
50 }
53
55
59
60 fDisplayParams.fGraphiteContextOptions.fOptions.fDisableCachedGlyphUploads =
true;
61
62 fDisplayParams.fGraphiteContextOptions.fPriv.fStoreContextRefInRecorder =
true;
65 fGraphiteRecorder = fGraphiteContext->makeRecorder(ToolUtils::CreateTestingRecorderOptions());
66
67
68
69
70
71
72}
sk_sp< GrDirectContext > fContext
virtual bool onInitializeContext()=0
SK_API std::unique_ptr< Context > MakeMetal(const MtlBackendContext &, const ContextOptions &)
sk_cfp< CFTypeRef > fDevice
sk_cfp< CFTypeRef > fQueue
◆ isValid()
bool skwindow::internal::GraphiteMetalWindowContext::isValid |
( |
| ) |
|
|
inlineoverridevirtual |
◆ onDestroyContext()
virtual void skwindow::internal::GraphiteMetalWindowContext::onDestroyContext |
( |
| ) |
|
|
protectedpure virtual |
◆ onInitializeContext()
virtual bool skwindow::internal::GraphiteMetalWindowContext::onInitializeContext |
( |
| ) |
|
|
protectedpure virtual |
◆ onSwapBuffers()
void skwindow::internal::GraphiteMetalWindowContext::onSwapBuffers |
( |
| ) |
|
|
overrideprotectedvirtual |
Implements skwindow::WindowContext.
Definition at line 109 of file GraphiteMetalWindowContext.mm.
109 {
110 this->snapRecordingAndSubmit();
111
112 id<CAMetalDrawable> currentDrawable = (id<CAMetalDrawable>)
fDrawableHandle;
113
114 id<MTLCommandBuffer> commandBuffer([*
fQueue commandBuffer]);
115 commandBuffer.label = @"Present";
116
117 [commandBuffer presentDrawable:currentDrawable];
118 [commandBuffer commit];
119
122}
◆ setDisplayParams()
void skwindow::internal::GraphiteMetalWindowContext::setDisplayParams |
( |
const DisplayParams & |
params | ) |
|
|
overridevirtual |
◆ fDevice
sk_cfp<id<MTLDevice> > skwindow::internal::GraphiteMetalWindowContext::fDevice |
|
protected |
◆ fDrawableHandle
CFTypeRef skwindow::internal::GraphiteMetalWindowContext::fDrawableHandle |
|
protected |
◆ fMetalLayer
CAMetalLayer* skwindow::internal::GraphiteMetalWindowContext::fMetalLayer |
|
protected |
◆ fQueue
sk_cfp<id<MTLCommandQueue> > skwindow::internal::GraphiteMetalWindowContext::fQueue |
|
protected |
◆ fValid
bool skwindow::internal::GraphiteMetalWindowContext::fValid |
|
protected |
The documentation for this class was generated from the following files: