38#define ASSERT_OWNED_PROXY(P) \
39 SkASSERT(!(P) || !((P)->peekTexture()) || (P)->peekTexture()->getContext() == this->context())
40#define ASSERT_SINGLE_OWNER SKGPU_ASSERT_SINGLE_OWNER(this->context()->singleOwner())
41#define RETURN_VALUE_IF_ABANDONED(value) if (this->context()->abandoned()) { return (value); }
53 info.fSubmittedProc(
info.fSubmittedContext,
false);
55 if (
info.fFinishedProc) {
56 info.fFinishedProc(
info.fFinishedContext);
86#if defined(GR_TEST_UTILS)
88void GrDirectContextPriv::dumpCacheStats(
SkString*
out)
const {
90 this->
context()->fResourceCache->dumpStats(out);
97 this->
context()->fResourceCache->dumpStatsKeyValuePairs(keys,
values);
101void GrDirectContextPriv::printCacheStats()
const {
103 this->dumpCacheStats(&
out);
108void GrDirectContextPriv::resetGpuStats()
const {
110 this->
context()->fGpu->stats()->reset();
114void GrDirectContextPriv::dumpGpuStats(
SkString*
out)
const {
116 this->
context()->fGpu->stats()->dump(out);
126 this->
context()->fGpu->stats()->dumpKeyValuePairs(keys,
values);
133void GrDirectContextPriv::printGpuStats()
const {
135 this->dumpGpuStats(&
out);
140void GrDirectContextPriv::resetContextStats() {
146void GrDirectContextPriv::dumpContextStats(
SkString*
out)
const {
152void GrDirectContextPriv::dumpContextStatsKeyValuePairs(
TArray<SkString>* keys,
159void GrDirectContextPriv::printContextStats()
const {
161 this->dumpContextStats(&
out);
167 unsigned int index) {
173 unsigned int numActiveProxies;
175 if (index >= numActiveProxies || !views || !views[index].proxy()) {
187void GrDirectContextPriv::testingOnly_flushAndRemoveOnFlushCallbackObject(
197 std::unique_ptr<GrFragmentProcessor>
fp) {
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;"
216 std::unique_ptr<GrFragmentProcessor>
fp) {
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;"
235 static constexpr int kSize = 256;
237 uint32_t* srcData =
data.get();
243 uint8_t*
color =
reinterpret_cast<uint8_t*
>(&srcData[
kSize*
y +
x]);
259 if (!readSFC || !tempSFC) {
280 GrPixmap firstReadPM( upmII, firstRead,
kSize*
sizeof(uint32_t));
281 GrPixmap secondReadPM(upmII, secondRead,
kSize*
sizeof(uint32_t));
289 if (!readSFC->readPixels(dContext, firstReadPM, {0, 0})) {
301 if (!readSFC->readPixels(dContext, secondReadPM, {0, 0})) {
306 for (
int x = 0;
x <=
y; ++
x) {
319 auto dContext = this->
context();
321 if (!dContext->fDidTestPMConversions) {
323 dContext->fDidTestPMConversions =
true;
327 return dContext->fPMUPMConversionsRoundTrip;
331 std::unique_ptr<GrFragmentProcessor>
fp) {
342 std::unique_ptr<GrFragmentProcessor>
fp) {
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 ASSERT_SINGLE_OWNER
#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 &)
FlPixelBufferTexturePrivate * priv
uint32_t uint32_t * format
static float min(float r, float g, float b)
const myers::Point & get< 0 >(const myers::Segment &s)
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)
std::shared_ptr< const fml::Mapping > data