Flutter Engine
The Flutter Engine
Functions
ProxyConversionTest.cpp File Reference
#include "include/core/SkRefCnt.h"
#include "include/core/SkSize.h"
#include "include/core/SkTypes.h"
#include "include/gpu/GpuTypes.h"
#include "include/gpu/GrBackendSurface.h"
#include "include/gpu/GrDirectContext.h"
#include "include/gpu/GrTypes.h"
#include "include/private/gpu/ganesh/GrTypesPriv.h"
#include "src/gpu/RefCntedCallback.h"
#include "src/gpu/SkBackingFit.h"
#include "src/gpu/ganesh/GrCaps.h"
#include "src/gpu/ganesh/GrDirectContextPriv.h"
#include "src/gpu/ganesh/GrGpu.h"
#include "src/gpu/ganesh/GrProxyProvider.h"
#include "src/gpu/ganesh/GrRenderTarget.h"
#include "src/gpu/ganesh/GrRenderTargetProxy.h"
#include "src/gpu/ganesh/GrSurfaceProxy.h"
#include "src/gpu/ganesh/GrTextureProxy.h"
#include "tests/CtsEnforcement.h"
#include "tests/Test.h"
#include <utility>

Go to the source code of this file.

Functions

static sk_sp< GrSurfaceProxymake_wrapped_rt (GrProxyProvider *provider, GrGpu *gpu, skiatest::Reporter *reporter, const SkISize &size, GrColorType colorType)
 
void clean_up_wrapped_rt (GrGpu *gpu, sk_sp< GrSurfaceProxy > proxy)
 
static sk_sp< GrSurfaceProxymake_offscreen_rt (GrProxyProvider *provider, SkISize dimensions, GrColorType colorType)
 
static sk_sp< GrSurfaceProxymake_texture (GrProxyProvider *provider, SkISize dimensions, GrColorType colorType, GrRenderable renderable)
 
 DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS (PreinstantiatedProxyConversionTest, reporter, ctxInfo, CtsEnforcement::kApiLevel_T)
 
 DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS (DefferredProxyConversionTest, reporter, ctxInfo, CtsEnforcement::kApiLevel_T)
 

Function Documentation

◆ clean_up_wrapped_rt()

void clean_up_wrapped_rt ( GrGpu gpu,
sk_sp< GrSurfaceProxy proxy 
)

Definition at line 44 of file ProxyConversionTest.cpp.

44 {
45 SkASSERT(proxy->unique());
46 SkASSERT(proxy->peekRenderTarget());
48 proxy.reset();
49 gpu->deleteTestingOnlyBackendRenderTarget(rt);
50}
#define SkASSERT(cond)
Definition: SkAssert.h:116
virtual GrBackendRenderTarget getBackendRenderTarget() const =0
GrRenderTarget * peekRenderTarget() const
bool unique() const
Definition: SkRefCnt.h:175
void reset(T *ptr=nullptr)
Definition: SkRefCnt.h:310

◆ DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS() [1/2]

DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS ( DefferredProxyConversionTest  ,
reporter  ,
ctxInfo  ,
CtsEnforcement::kApiLevel_T   
)

Definition at line 148 of file ProxyConversionTest.cpp.

151 {
152 auto context = ctxInfo.directContext();
153 GrProxyProvider* proxyProvider = context->priv().proxyProvider();
154 const GrCaps* caps = context->priv().caps();
155
156 static constexpr SkISize kDims = {64, 64};
157
160 {
161 sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(format,
162 kDims,
164 1,
169 /*label=*/{});
170
171 // Both RenderTarget and Texture
172 GrRenderTargetProxy* rtProxy = proxy->asRenderTargetProxy();
173 REPORTER_ASSERT(reporter, rtProxy);
174 GrTextureProxy* tProxy = rtProxy->asTextureProxy();
175 REPORTER_ASSERT(reporter, tProxy);
176 REPORTER_ASSERT(reporter, tProxy->asRenderTargetProxy() == rtProxy);
177 REPORTER_ASSERT(reporter, rtProxy->asRenderTargetProxy() == rtProxy);
178 }
179
180 {
181 sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(format,
182 kDims,
184 1,
189 /*label=*/{});
190
191 // Both RenderTarget and Texture - but via GrTextureProxy
192 GrTextureProxy* tProxy = proxy->asTextureProxy();
193 REPORTER_ASSERT(reporter, tProxy);
194 GrRenderTargetProxy* rtProxy = tProxy->asRenderTargetProxy();
195 REPORTER_ASSERT(reporter, rtProxy);
196 REPORTER_ASSERT(reporter, rtProxy->asTextureProxy() == tProxy);
197 REPORTER_ASSERT(reporter, tProxy->asTextureProxy() == tProxy);
198 }
199
200 {
201 sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(format,
202 kDims,
204 1,
209 /*label=*/{});
210 // Texture-only
211 GrTextureProxy* tProxy = proxy->asTextureProxy();
212 REPORTER_ASSERT(reporter, tProxy);
213 REPORTER_ASSERT(reporter, tProxy->asTextureProxy() == tProxy);
215 }
216}
reporter
Definition: FontMgrTest.cpp:39
#define REPORTER_ASSERT(r, cond,...)
Definition: Test.h:286
Definition: GrCaps.h:57
GrBackendFormat getDefaultBackendFormat(GrColorType, GrRenderable) const
Definition: GrCaps.cpp:400
sk_sp< GrTextureProxy > createProxy(const GrBackendFormat &, SkISize dimensions, GrRenderable, int renderTargetSampleCnt, skgpu::Mipmapped, SkBackingFit, skgpu::Budgeted, GrProtected, std::string_view label, GrInternalSurfaceFlags=GrInternalSurfaceFlags::kNone, UseAllocator useAllocator=UseAllocator::kYes)
GrRenderTargetProxy * asRenderTargetProxy() override
virtual GrRenderTargetProxy * asRenderTargetProxy()
virtual GrTextureProxy * asTextureProxy()
GrTextureProxy * asTextureProxy() override
uint32_t uint32_t * format
Definition: SkSize.h:16

◆ DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS() [2/2]

DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS ( PreinstantiatedProxyConversionTest  ,
reporter  ,
ctxInfo  ,
CtsEnforcement::kApiLevel_T   
)

Definition at line 78 of file ProxyConversionTest.cpp.

81 {
82 auto context = ctxInfo.directContext();
83 GrProxyProvider* proxyProvider = context->priv().proxyProvider();
84 GrGpu* gpu = context->priv().getGpu();
85
86 static constexpr auto kSize = SkISize::Make(64, 64);
87 static constexpr auto kColorType = GrColorType::kRGBA_8888;
88
89 {
90 // External on-screen render target.
92 make_wrapped_rt(proxyProvider, gpu, reporter, kSize, kColorType));
93 if (sProxy) {
94 // RenderTarget-only
95 GrRenderTargetProxy* rtProxy = sProxy->asRenderTargetProxy();
96 REPORTER_ASSERT(reporter, rtProxy);
98 REPORTER_ASSERT(reporter, rtProxy->asRenderTargetProxy() == rtProxy);
99 clean_up_wrapped_rt(gpu, std::move(sProxy));
100 }
101 }
102
103 {
104 // Internal offscreen render target.
106 if (sProxy) {
107 // Both RenderTarget and Texture
108 GrRenderTargetProxy* rtProxy = sProxy->asRenderTargetProxy();
109 REPORTER_ASSERT(reporter, rtProxy);
110 GrTextureProxy* tProxy = rtProxy->asTextureProxy();
111 REPORTER_ASSERT(reporter, tProxy);
112 REPORTER_ASSERT(reporter, tProxy->asRenderTargetProxy() == rtProxy);
113 REPORTER_ASSERT(reporter, rtProxy->asRenderTargetProxy() == rtProxy);
114 }
115 }
116
117 {
118 // Internal offscreen render target - but through GrTextureProxy
121 if (sProxy) {
122 // Both RenderTarget and Texture
123 GrTextureProxy* tProxy = sProxy->asTextureProxy();
124 REPORTER_ASSERT(reporter, tProxy);
125 GrRenderTargetProxy* rtProxy = tProxy->asRenderTargetProxy();
126 REPORTER_ASSERT(reporter, rtProxy);
127 REPORTER_ASSERT(reporter, rtProxy->asTextureProxy() == tProxy);
128 REPORTER_ASSERT(reporter, tProxy->asTextureProxy() == tProxy);
129 }
130 }
131
132 {
133 // force no-RT
136 if (sProxy) {
137 // Texture-only
138 GrTextureProxy* tProxy = sProxy->asTextureProxy();
139 REPORTER_ASSERT(reporter, tProxy);
140 REPORTER_ASSERT(reporter, tProxy->asTextureProxy() == tProxy);
142 }
143 }
144}
void clean_up_wrapped_rt(GrGpu *gpu, sk_sp< GrSurfaceProxy > proxy)
static sk_sp< GrSurfaceProxy > make_texture(GrProxyProvider *provider, SkISize dimensions, GrColorType colorType, GrRenderable renderable)
static sk_sp< GrSurfaceProxy > make_wrapped_rt(GrProxyProvider *provider, GrGpu *gpu, skiatest::Reporter *reporter, const SkISize &size, GrColorType colorType)
static sk_sp< GrSurfaceProxy > make_offscreen_rt(GrProxyProvider *provider, SkISize dimensions, GrColorType colorType)
static constexpr auto kColorType
Definition: GrGpu.h:62
constexpr int kSize
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ make_offscreen_rt()

static sk_sp< GrSurfaceProxy > make_offscreen_rt ( GrProxyProvider provider,
SkISize  dimensions,
GrColorType  colorType 
)
static

Definition at line 52 of file ProxyConversionTest.cpp.

54 {
55 return provider->testingOnly_createInstantiatedProxy(dimensions,
58 1,
62}
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)

◆ make_texture()

static sk_sp< GrSurfaceProxy > make_texture ( GrProxyProvider provider,
SkISize  dimensions,
GrColorType  colorType,
GrRenderable  renderable 
)
static

Definition at line 64 of file ProxyConversionTest.cpp.

67 {
68 return provider->testingOnly_createInstantiatedProxy(dimensions,
70 renderable,
71 1,
75}

◆ make_wrapped_rt()

static sk_sp< GrSurfaceProxy > make_wrapped_rt ( GrProxyProvider provider,
GrGpu gpu,
skiatest::Reporter reporter,
const SkISize size,
GrColorType  colorType 
)
static

Definition at line 35 of file ProxyConversionTest.cpp.

39 {
40 auto backendRT = gpu->createTestingOnlyBackendRenderTarget(size, colorType);
41 return provider->wrapBackendRenderTarget(backendRT, nullptr);
42}
sk_sp< GrSurfaceProxy > wrapBackendRenderTarget(const GrBackendRenderTarget &, sk_sp< skgpu::RefCntedCallback > releaseHelper)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259