41 { return (value); }
42
50
53 info.fSubmittedProc(
info.fSubmittedContext,
false);
54 }
55 if (
info.fFinishedProc) {
56 info.fFinishedProc(
info.fFinishedContext);
57 }
59 }
60
61#ifdef SK_DEBUG
65 }
66#endif
68}
69
73}
74
77 if (!gpu) {
78 return false;
79 }
80
82}
83
84
85
86#if defined(GR_TEST_UTILS)
87
88void GrDirectContextPriv::dumpCacheStats(
SkString* out)
const {
89#if GR_CACHE_STATS
90 this->
context()->fResourceCache->dumpStats(out);
91#endif
92}
93
96#if GR_CACHE_STATS
97 this->
context()->fResourceCache->dumpStatsKeyValuePairs(keys, values);
98#endif
99}
100
101void GrDirectContextPriv::printCacheStats() const {
103 this->dumpCacheStats(&out);
105}
106
107
108void GrDirectContextPriv::resetGpuStats() const {
109#if GR_GPU_STATS
110 this->
context()->fGpu->stats()->reset();
111#endif
112}
113
114void GrDirectContextPriv::dumpGpuStats(
SkString* out)
const {
115#if GR_GPU_STATS
116 this->
context()->fGpu->stats()->dump(out);
117 if (
auto builder = this->
context()->fGpu->pipelineBuilder()) {
119 }
120#endif
121}
122
125#if GR_GPU_STATS
126 this->
context()->fGpu->stats()->dumpKeyValuePairs(keys, values);
127 if (
auto builder = this->
context()->fGpu->pipelineBuilder()) {
128 builder->stats()->dumpKeyValuePairs(keys, values);
129 }
130#endif
131}
132
133void GrDirectContextPriv::printGpuStats() const {
135 this->dumpGpuStats(&out);
137}
138
139
140void GrDirectContextPriv::resetContextStats() {
141#if GR_GPU_STATS
143#endif
144}
145
146void GrDirectContextPriv::dumpContextStats(
SkString* out)
const {
147#if GR_GPU_STATS
149#endif
150}
151
152void GrDirectContextPriv::dumpContextStatsKeyValuePairs(
TArray<SkString>* keys,
154#if GR_GPU_STATS
155 this->
context()->
stats()->dumpKeyValuePairs(keys, values);
156#endif
157}
158
159void GrDirectContextPriv::printContextStats() const {
161 this->dumpContextStats(&out);
163}
164
165
167 unsigned int index) {
169 if (!atlasManager) {
170 return nullptr;
171 }
172
173 unsigned int numActiveProxies;
175 if (index >= numActiveProxies || !views || !views[index].proxy()) {
176 return nullptr;
177 }
178
183 views[index],
185}
186
187void GrDirectContextPriv::testingOnly_flushAndRemoveOnFlushCallbackObject(
191}
192#endif
193
194
195
197 std::unique_ptr<GrFragmentProcessor> fp) {
198 if (!fp) {
199 return nullptr;
200 }
201
203 "half4 main(half4 halfColor) {"
204 "float4 color = float4(halfColor);"
205 "color = floor(color * 255 + 0.5) / 255;"
206 "color.rgb = floor(color.rgb * color.a * 255 + 0.5) / 255;"
207 "return color;"
208 "}"
209 );
210
213}
214
216 std::unique_ptr<GrFragmentProcessor> fp) {
217 if (!fp) {
218 return nullptr;
219 }
220
222 "half4 main(half4 halfColor) {"
223 "float4 color = float4(halfColor);"
224 "color = floor(color * 255 + 0.5) / 255;"
225 "color.rgb = color.a <= 0 ? half3(0) : floor(color.rgb / color.a * 255 + 0.5) / 255;"
226 "return color;"
227 "}"
228 );
229
232}
233
235 static constexpr int kSize = 256;
237 uint32_t* srcData =
data.get();
238
239
240
243 uint8_t*
color =
reinterpret_cast<uint8_t*
>(&srcData[
kSize*
y +
x]);
248 }
249 }
250
254
255 auto readSFC =
257 auto tempSFC =
259 if (!readSFC || !tempSFC) {
260 return false;
261 }
262
263
264
265
269
271 if (!dataView) {
272 return false;
273 }
274
279
280 GrPixmap firstReadPM( upmII, firstRead,
kSize*
sizeof(uint32_t));
281 GrPixmap secondReadPM(upmII, secondRead,
kSize*
sizeof(uint32_t));
282
283
284
285
286
289 if (!readSFC->readPixels(dContext, firstReadPM, {0, 0})) {
290 return false;
291 }
292
296
300
301 if (!readSFC->readPixels(dContext, secondReadPM, {0, 0})) {
302 return false;
303 }
304
306 for (
int x = 0;
x <=
y; ++
x) {
308 return false;
309 }
310 }
311 }
312
313 return true;
314}
315
318
319 auto dContext = this->
context();
320
321 if (!dContext->fDidTestPMConversions) {
323 dContext->fDidTestPMConversions = true;
324 }
325
326
327 return dContext->fPMUPMConversionsRoundTrip;
328}
329
331 std::unique_ptr<GrFragmentProcessor> fp) {
333
335
337
339}
340
342 std::unique_ptr<GrFragmentProcessor> fp) {
344
346
348
350}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static bool test_for_preserving_PM_conversions(GrDirectContext *dContext)
static std::unique_ptr< GrFragmentProcessor > make_unpremul_effect(std::unique_ptr< GrFragmentProcessor > fp)
#define ASSERT_OWNED_PROXY(P)
static std::unique_ptr< GrFragmentProcessor > make_premul_effect(std::unique_ptr< GrFragmentProcessor > fp)
#define GR_CREATE_TRACE_MARKER_CONTEXT(classname, op, context)
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
std::tuple< GrSurfaceProxyView, GrColorType > GrMakeUncachedBitmapProxyView(GrRecordingContext *rContext, const SkBitmap &bitmap, skgpu::Mipmapped mipmapped, SkBackingFit fit, skgpu::Budgeted budgeted)
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
sk_sp< T > sk_ref_sp(T *obj)
SkRuntimeEffect * SkMakeRuntimeEffect(SkRuntimeEffect::Result(*make)(SkString, const SkRuntimeEffect::Options &), const char *sksl, SkRuntimeEffect::Options options=SkRuntimeEffect::Options{})
void createDDLTask(sk_sp< const GrDeferredDisplayList >, sk_sp< GrRenderTargetProxy > newDest)
std::unique_ptr< GrFragmentProcessor > createPMToUPMEffect(std::unique_ptr< GrFragmentProcessor >)
std::unique_ptr< GrFragmentProcessor > createUPMToPMEffect(std::unique_ptr< GrFragmentProcessor >)
GrAtlasManager * getAtlasManager()
bool compile(const GrProgramDesc &, const GrProgramInfo &)
GrSemaphoresSubmitted flushSurfaces(SkSpan< GrSurfaceProxy * >, SkSurfaces::BackendSurfaceAccess=SkSurfaces::BackendSurfaceAccess::kNoAccess, const GrFlushInfo &={}, const skgpu::MutableTextureState *newState=nullptr)
bool validPMUPMConversionExists()
GrDirectContext * context()
void flushAndSubmit(GrSyncCpu sync=GrSyncCpu::kNo)
GrDirectContextPriv priv()
void createDDLTask(sk_sp< const GrDeferredDisplayList >, sk_sp< GrRenderTargetProxy > newDest)
GrSemaphoresSubmitted flushSurfaces(SkSpan< GrSurfaceProxy * >, SkSurfaces::BackendSurfaceAccess, const GrFlushInfo &, const skgpu::MutableTextureState *newState)
static std::unique_ptr< GrFragmentProcessor > HighPrecision(std::unique_ptr< GrFragmentProcessor >)
virtual bool compile(const GrProgramDesc &, const GrProgramInfo &)=0
std::unique_ptr< skgpu::ganesh::SurfaceFillContext > makeSFC(GrImageInfo, std::string_view label, SkBackingFit=SkBackingFit::kExact, int sampleCount=1, skgpu::Mipmapped=skgpu::Mipmapped::kNo, skgpu::Protected=skgpu::Protected::kNo, GrSurfaceOrigin=kTopLeft_GrSurfaceOrigin, skgpu::Budgeted=skgpu::Budgeted::kYes)
GrDrawingManager * drawingManager()
static std::unique_ptr< GrSkSLFP > Make(const SkRuntimeEffect *effect, const char *name, std::unique_ptr< GrFragmentProcessor > inputFP, OptFlags optFlags, Args &&... args)
static std::unique_ptr< GrFragmentProcessor > Make(GrSurfaceProxyView, SkAlphaType, const SkMatrix &=SkMatrix::I(), GrSamplerState::Filter=GrSamplerState::Filter::kNearest, GrSamplerState::MipmapMode mipmapMode=GrSamplerState::MipmapMode::kNone)
static Result MakeForColorFilter(SkString sksl, const Options &)
static constexpr int kSize
FlPixelBufferTexturePrivate * priv
uint32_t uint32_t * format
#define ASSERT_SINGLE_OWNER
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
static constexpr SkColorType MaskFormatToColorType(MaskFormat format)
GrGpuSubmittedProc fSubmittedProc
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
SkImageInfo makeAlphaType(SkAlphaType newAlphaType) const
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)