79#define GL_CALL(X) GR_GL_CALL(this->glInterface(), X)
80#define GL_CALL_RET(RET, X) GR_GL_CALL_RET(this->glInterface(), RET, X)
82#define GL_ALLOC_CALL(call) \
84 if (this->glCaps().skipErrorChecks()) { \
85 GR_GL_CALL(this->glInterface(), call); \
86 return static_cast<GrGLenum>(GR_GL_NO_ERROR); \
88 this->clearErrorsAndCheckForOOM(); \
89 GR_GL_CALL_NOERRCHECK(this->glInterface(), call); \
90 return this->getErrorAndCheckForOOM(); \
179 SK_ABORT(
"Unexpected GL texture target.");
186bool GrGLGpu::TextureUnitBindings::hasBeenModified(
GrGLenum target)
const {
192 fTargetBindings[targetIndex].fBoundResourceID = resourceID;
193 fTargetBindings[targetIndex].fHasBeenModified =
true;
196void GrGLGpu::TextureUnitBindings::invalidateForScratchUse(
GrGLenum target) {
200void GrGLGpu::TextureUnitBindings::invalidateAllTargets(
bool markUnmodified) {
201 for (
auto& targetBinding : fTargetBindings) {
202 targetBinding.fBoundResourceID.makeInvalid();
203 if (markUnmodified) {
204 targetBinding.fHasBeenModified =
false;
281 fTextureUnitStates = std::make_unique<UnitState[]>(fNumTextureUnits);
285 if (!fNumTextureUnits) {
292 if (unitIdx >= fNumTextureUnits) {
326 if (!fTextureUnitStates[unitIdx].fKnown ||
327 fTextureUnitStates[unitIdx].fSamplerIDIfKnown != sampler->id()) {
329 fTextureUnitStates[unitIdx].fSamplerIDIfKnown = sampler->id();
330 fTextureUnitStates[unitIdx].fKnown =
true;
335 if (!fTextureUnitStates[unitIdx].fKnown ||
336 fTextureUnitStates[unitIdx].fSamplerIDIfKnown != 0) {
338 fTextureUnitStates[unitIdx].fSamplerIDIfKnown = 0;
339 fTextureUnitStates[unitIdx].fKnown =
true;
344 std::fill_n(fTextureUnitStates.get(), fNumTextureUnits, UnitState{});
349 fTextureUnitStates.reset();
350 fNumTextureUnits = 0;
354 if (!fNumTextureUnits) {
361 std::fill_n(fTextureUnitStates.get(), fNumTextureUnits, UnitState{});
372 fInterface = that.fInterface;
380 GR_GL_CALL(fInterface, DeleteSamplers(1, &fID));
398 static constexpr int kMaxSamplers = 32;
401 std::unique_ptr<UnitState[]> fTextureUnitStates;
403 int fNumTextureUnits;
411#if !defined(SK_DISABLE_LEGACY_GL_MAKE_NATIVE_INTERFACE)
433GrGLGpu::GrGLGpu(std::unique_ptr<GrGLContext> ctx,
GrDirectContext* dContext)
435 , fGLContext(
std::move(ctx))
436 , fProgramCache(new ProgramCache(dContext->
priv().
options().fRuntimeProgramCacheSize))
440 , fStencilClearFBOID(0)
441 , fFinishCallbacks(this) {
450 fHWTextureUnitBindings.
reset(this->numTextureUnits());
465 fHWBufferState[
i].invalidate();
468 if (this->
glCaps().useSamplerObjects()) {
469 fSamplerObjectCache = std::make_unique<SamplerObjectCache>(
this);
476 fCopyProgramArrayBuffer.
reset();
477 fMipmapProgramArrayBuffer.
reset();
479 fProgramCache->
reset();
495 if (fStencilClearFBOID) {
505 for (
size_t i = 0;
i <
std::size(fMipmapPrograms); ++
i) {
511 fSamplerObjectCache.reset();
513 fFinishCallbacks.
callAll(
true);
528 if (fStencilClearFBOID) {
536 for (
size_t i = 0;
i <
std::size(fMipmapPrograms); ++
i) {
542 if (fSamplerObjectCache) {
543 fSamplerObjectCache->release();
547 fProgramCache->abandon();
549 if (fSamplerObjectCache) {
550 fSamplerObjectCache->abandon();
555 fProgramCache->
reset();
556 fProgramCache.
reset();
561 fStencilClearFBOID = 0;
562 fCopyProgramArrayBuffer.
reset();
564 fCopyPrograms[
i].fProgram = 0;
566 fMipmapProgramArrayBuffer.
reset();
567 for (
size_t i = 0;
i <
std::size(fMipmapPrograms); ++
i) {
568 fMipmapPrograms[
i].fProgram = 0;
575 return fProgramCache.
get();
579 return fProgramCache;
584void GrGLGpu::onResetContext(uint32_t resetBits) {
602 if (!this->
glCaps().isCoreProfile()) {
613 if (this->
glCaps().imagingSupport() && !this->
glCaps().isCoreProfile()) {
618 fHWWireframeEnabled = kUnknown_TriState;
627 this->
glCaps().fbFetchRequiresEnablePerSample()) {
632 fHWWriteToColor = kUnknown_TriState;
637 fHWClearColor[0] = fHWClearColor[1] = fHWClearColor[2] = fHWClearColor[3] =
SK_FloatNaN;
641 if (this->
glCaps().clientCanDisableMultisample()) {
646 fHWConservativeRasterEnabled = kUnknown_TriState;
649 fHWActiveTextureUnitIdx = -1;
653 for (
int s = 0;
s < this->numTextureUnits(); ++
s) {
654 fHWTextureUnitBindings[
s].invalidateAllTargets(
false);
656 if (fSamplerObjectCache) {
657 fSamplerObjectCache->invalidateBindings();
662 fHWBlendState.invalidate();
666 fHWScissorSettings.invalidate();
667 fHWWindowRectsState.invalidate();
673 fHWStencilTestEnabled = kUnknown_TriState;
678 fHWVertexArrayState.invalidate();
686 fHWSRGBFramebuffer = kUnknown_TriState;
687 fBoundDrawFramebuffer = 0;
692 if (this->
caps()->writePixelsRowBytesSupport() ||
693 this->
caps()->transferPixelsToRowBytesSupport()) {
696 if (this->
glCaps().readPixelsRowBytesSupport()) {
699 if (this->
glCaps().packFlipYSupport()) {
708 ++fResetTimestampForTextureParameters;
714 bool skipRectTexSupportCheck =
false) {
754 return glTextureData->info().refParameters();
784 texture->baseLevelWasBoundToFBO();
791 bool skipRectTexSupportCheck =
false) {
873 if (!this->createRenderTargetObjects(
desc, sampleCnt, &rtIDs)) {
889 texRT->baseLevelWasBoundToFBO();
899 if (backendRT.
isProtected() && !this->glCaps().supportsProtectedContent()) {
911 if (sampleCount <= 1) {
929 "GLGpu_WrapBackendRenderTarget");
951 bool prepForTexSampling) {
958 this->bindTextureToScratchUnit(glTex->target(), glTex->textureID());
962 if (mipLevelCount && this->
glCaps().mipmapLevelControlSupport()) {
963 auto params = glTex->parameters();
965 int maxLevel = glTex->maxMipmapLevel();
966 if (
params->nonsamplerState().fBaseMipMapLevel != 0) {
970 if (
params->nonsamplerState().fMaxMipmapLevel != maxLevel) {
974 params->set(
nullptr, nonsamplerState, fResetTimestampForTextureParameters);
977 if (this->
glCaps().flushBeforeWritePixels()) {
982 return this->uploadColorTypeTexData(glTex->format(),
1033 static_assert(
sizeof(
int) ==
sizeof(int32_t),
"");
1045 const size_t trimRowBytes =
rect.width() * bpp;
1046 const void* pixels = (
void*)
offset;
1050 bool restoreGLRowLength =
false;
1051 if (trimRowBytes != rowBytes) {
1055 restoreGLRowLength =
true;
1063 textureFormat, textureColorType, bufferColorType, &externalFormat, &externalType);
1064 if (!externalFormat || !externalType) {
1079 if (restoreGLRowLength) {
1092 auto* glBuffer =
static_cast<GrGLBuffer*
>(transferBuffer.
get());
1099 auto offsetAsPtr =
reinterpret_cast<void*
>(
offset);
1100 return this->readOrTransferPixelsFrom(
surface,
1114 auto* xferBufferState = this->hwBufferState(
type);
1115 if (!xferBufferState->fBufferZeroKnownBound) {
1116 GL_CALL(BindBuffer(xferBufferState->fGLTarget, 0));
1117 xferBufferState->fBoundBufferUniqueID.makeInvalid();
1118 xferBufferState->fBufferZeroKnownBound =
true;
1122bool GrGLGpu::uploadColorTypeTexData(
GrGLFormat textureFormat,
1129 int mipLevelCount) {
1141 textureFormat, textureColorType, srcColorType, &externalFormat, &externalType);
1142 if (!externalFormat || !externalType) {
1145 this->uploadTexData(texDims,
target, dstRect, externalFormat, externalType, bpp, texels,
1150bool GrGLGpu::uploadColorToTex(
GrGLFormat textureFormat,
1153 std::array<float, 4>
color,
1154 uint32_t levelMask) {
1156 GrGLenum externalFormat, externalType;
1163 std::unique_ptr<char[]> pixelStorage;
1167 levels.
resize(numLevels);
1169 for (
int i = 0;
i < numLevels; ++
i, levelDims = {
std::max(levelDims.width() >> 1, 1),
1170 std::max(levelDims.height() >> 1, 1)}) {
1171 if (levelMask & (1 <<
i)) {
1172 if (!pixelStorage) {
1175 size_t rb = ii.minRowBytes();
1176 pixelStorage.reset(
new char[rb * levelDims.height()]);
1182 levels[
i] = {pixelStorage.get(), levelDims.width()*bpp,
nullptr};
1190void GrGLGpu::uploadTexData(
SkISize texDims,
1197 int mipLevelCount) {
1206 bool restoreGLRowLength =
false;
1213 std::max(dims.height() >> 1, 1)}) {
1214 if (!texels[
level].fPixels) {
1217 const size_t trimRowBytes = dims.
width() * bpp;
1223 restoreGLRowLength =
true;
1225 SkASSERT(rowBytes == trimRowBytes);
1229 externalFormat, externalType, texels[
level].fPixels));
1231 if (restoreGLRowLength) {
1249 if (!internalFormat) {
1255 bool useTexStorage =
caps.formatSupportsTexStorage(
format);
1257 int numMipLevels = 1;
1267 if (useTexStorage) {
1305 const char* rawLevelData = &((
const char*)
data)[
offset];
1361 GL_CALL(DeleteRenderbuffers(1, &rtIDs->fMSColorRenderbufferID));
1364 this->deleteFramebuffer(rtIDs->fMultisampleFBOID);
1367 this->deleteFramebuffer(rtIDs->fSingleSampleFBOID);
1371 GrGLenum colorRenderbufferFormat = 0;
1391 if (sampleCount <= 1) {
1393 }
else if (this->
glCaps().usesImplicitMSAAResolve()) {
1408#if defined(__has_feature)
1409#define IS_TSAN __has_feature(thread_sanitizer)
1419 if (!this->renderbufferStorageMSAA(*fGLContext, sampleCount, colorRenderbufferFormat,
1420 desc.fSize.width(),
desc.fSize.height())) {
1430 if (!this->
glCaps().skipErrorChecks()) {
1436 if (this->
glCaps().rebindColorAttachmentAfterCheckFramebufferStatus()) {
1458 if (!this->
glCaps().skipErrorChecks()) {
1464 if (this->
glCaps().rebindColorAttachmentAfterCheckFramebufferStatus()) {
1483 cleanupOnFail.clear();
1515 int renderTargetSampleCnt,
1519 uint32_t levelClearMask,
1520 std::string_view label) {
1531 texDesc.
fSize = dimensions;
1532 switch (
format.textureType()) {
1540 if (mipLevelCount > 1 || !this->
glCaps().rectangleTextureSupport()) {
1551 this->
glCaps().supportsProtectedContent());
1553 texDesc.
fID = this->createTexture(dimensions, texDesc.
fFormat, texDesc.
fTarget, renderable,
1554 &initialState, mipLevelCount, texDesc.
fIsProtected, label);
1565 if (!this->createRenderTargetObjects(texDesc, renderTargetSampleCnt, &rtIDDesc)) {
1569 tex = sk_make_sp<GrGLTextureRenderTarget>(
this,
1571 renderTargetSampleCnt,
1576 tex->baseLevelWasBoundToFBO();
1578 tex = sk_make_sp<GrGLTexture>(
this, budgeted, texDesc, mipmapStatus, label);
1582 fResetTimestampForTextureParameters);
1583 if (levelClearMask) {
1584 if (this->
glCaps().clearTextureSupport()) {
1585 GrGLenum externalFormat, externalType;
1589 for (
int i = 0;
i < mipLevelCount; ++
i) {
1590 if (levelClearMask & (1U <<
i)) {
1591 GL_CALL(ClearTexImage(tex->textureID(),
i, externalFormat, externalType,
1595 }
else if (this->
glCaps().canFormatBeFBOColorAttachment(
1597 !this->
glCaps().performColorClearsAsDraws()) {
1599 this->disableWindowRectangles();
1600 this->flushColorWrite(
true);
1601 this->flushClearColor({0, 0, 0, 0});
1602 for (
int i = 0;
i < mipLevelCount; ++
i) {
1603 if (levelClearMask & (1U <<
i)) {
1605 kDst_TempFBOTarget);
1612 this->bindTextureToScratchUnit(texDesc.
fTarget, tex->textureID());
1613 std::array<float, 4> zeros = {};
1614 this->uploadColorToTex(texDesc.
fFormat,
1638 desc.fSize = dimensions;
1643 this->
glCaps().supportsProtectedContent());
1644 desc.fID = this->createCompressedTexture2D(
desc.fSize, compression,
desc.fFormat,
1645 mipmapped,
desc.fIsProtected, &initialState);
1651 if (!this->uploadCompressedTexData(compression,
desc.fFormat, dimensions, mipmapped,
1665 auto tex = sk_make_sp<GrGLTexture>(
this, budgeted,
desc, mipmapStatus,
1666 "GLGpuCreateCompressedTexture");
1669 fResetTimestampForTextureParameters);
1696 this->
glCaps().supportsProtectedContent());
1697 info.fID = this->createCompressedTexture2D(dimensions, compression, glFormat,
1698 mipmapped,
info.fProtected, &initialState);
1706 auto parameters = sk_make_sp<GrGLTextureParameters>();
1709 fResetTimestampForTextureParameters);
1712 dimensions.
width(), dimensions.
height(), mipmapped,
info, std::move(parameters));
1715bool GrGLGpu::onUpdateCompressedBackendTexture(
const GrBackendTexture& backendTexture,
1732 this->bindTextureToScratchUnit(
info.fTarget,
info.fID);
1736 if (backendTexture.
hasMipmaps() && this->glCaps().mipmapLevelControlSupport()) {
1739 if (
params->nonsamplerState().fBaseMipMapLevel != 0) {
1745 if (
params->nonsamplerState().fMaxMipmapLevel != (numMipLevels - 1)) {
1749 params->set(
nullptr, nonsamplerState, fResetTimestampForTextureParameters);
1752 bool result = this->uploadCompressedTexData(compression,
1761 this->bindTextureToScratchUnit(
info.fTarget, 0);
1767 static const int kSize = 16;
1770 if (!this->
glCaps().hasStencilFormatBeenDeterminedForFormat(
format)) {
1772 int firstWorkingStencilFormatIndex = -1;
1790 GL_CALL(GenFramebuffers(1, &fb));
1799 GL_CALL(GenRenderbuffers(1, &sbRBID));
1805 for (
int i = 0;
i < stencilFmtCnt && sbRBID; ++
i) {
1825 firstWorkingStencilFormatIndex =
i;
1838 GL_CALL(DeleteRenderbuffers(1, &sbRBID));
1840 GL_CALL(DeleteTextures(1, &colorID));
1843 fGLContext->caps()->setStencilFormatIndexForFormat(
format, firstWorkingStencilFormatIndex);
1849 const std::string khr_debug_label = label.empty() ?
"Skia" : std::string(label);
1855GrGLuint GrGLGpu::createCompressedTexture2D(
1881 if (this->
glCaps().supportsProtectedContent()) {
1884 GL_CALL(DeleteTextures(1, &
id));
1899 std::string_view label) {
1910 this->bindTextureToScratchUnit(
target,
id);
1927 if (this->
glCaps().supportsProtectedContent()) {
1930 GL_CALL(DeleteTextures(1, &
id));
1937 bool success =
false;
1938 if (internalFormat) {
1940 auto levelCount =
std::max(mipLevelCount, 1);
1945 GrGLenum externalFormat, externalType;
1948 if (externalFormat && externalType) {
1953 const int twoToTheMipLevel = 1 <<
level;
1954 const int currentWidth =
std::max(1, dimensions.
width() / twoToTheMipLevel);
1955 const int currentHeight =
std::max(1, dimensions.
height() / twoToTheMipLevel);
1957 currentHeight, 0, externalFormat, externalType,
1967 GL_CALL(DeleteTextures(1, &
id));
1972 SkISize dimensions,
int numStencilSamples) {
2004 if (kYes_TriState != fHWScissorSettings.fEnabled) {
2006 fHWScissorSettings.fEnabled = kYes_TriState;
2009 if (kNo_TriState != fHWScissorSettings.fEnabled) {
2011 fHWScissorSettings.fEnabled = kNo_TriState;
2017 SkASSERT(fHWScissorSettings.fEnabled == TriState::kYes_TriState);
2019 if (fHWScissorSettings.fRect != nativeScissor) {
2020 GL_CALL(Scissor(nativeScissor.fX, nativeScissor.fY, nativeScissor.fWidth,
2021 nativeScissor.fHeight));
2022 fHWScissorSettings.fRect = nativeScissor;
2028 if (fHWViewport != nativeViewport) {
2029 GL_CALL(Viewport(nativeViewport.fX, nativeViewport.fY,
2030 nativeViewport.fWidth, nativeViewport.fHeight));
2031 fHWViewport = nativeViewport;
2043 if (!this->
caps()->maxWindowRectangles() ||
2044 fHWWindowRectsState.knownEqualTo(origin, rt->
width(), rt->
height(), windowState)) {
2055 for (
int i = 0;
i < numWindows; ++
i) {
2060 GL_CALL(WindowRectangles(glmode, numWindows, glwindows->
asInts()));
2062 fHWWindowRectsState.set(origin, rt->
width(), rt->
height(), windowState);
2066void GrGLGpu::disableWindowRectangles() {
2068 if (!this->
caps()->maxWindowRectangles() || fHWWindowRectsState.knownDisabled()) {
2072 fHWWindowRectsState.setDisabled();
2103 this->flushStencil(stencil, programInfo.
origin());
2106 glRT, programInfo.
origin());
2112 this->flushRenderTarget(glRT, useMultisampleFBO);
2124 if (program == fHWProgram) {
2130 fHWProgram = std::move(program);
2136 if (fHWProgramID ==
id) {
2146 SkASSERT(fHWWriteToColor != kUnknown_TriState);
2147 if (fHWWriteToColor == kYes_TriState) {
2162 auto* bufferState = this->hwBufferState(
type);
2163 if (
buffer->isCpuBuffer()) {
2164 if (!bufferState->fBufferZeroKnownBound) {
2165 GL_CALL(BindBuffer(bufferState->fGLTarget, 0));
2166 bufferState->fBufferZeroKnownBound =
true;
2167 bufferState->fBoundBufferUniqueID.makeInvalid();
2170 bufferState->fBoundBufferUniqueID) {
2173 bufferState->fBufferZeroKnownBound =
false;
2174 bufferState->fBoundBufferUniqueID = glBuffer->
uniqueID();
2177 return bufferState->fGLTarget;
2181 std::array<float, 4>
color,
2183 bool useMultisampleFBO,
2188 SkASSERT(!scissor.
enabled() || !this->caps()->performPartialClearsAsDraws());
2194 this->flushRenderTarget(glRT, useMultisampleFBO);
2195 this->flushScissor(scissor, glRT->
height(), origin);
2196 this->disableWindowRectangles();
2197 this->flushColorWrite(
true);
2198 this->flushClearColor(
color);
2215 SkASSERT(!fIsExecutingCommandBuffer_DebugOnly);
2219 this->flushRenderTarget(rt, useMultisampleFBO);
2220 SkDEBUGCODE(fIsExecutingCommandBuffer_DebugOnly =
true);
2227 GL_CALL(StartTiling(nativeBounds.fX, nativeBounds.fY, nativeBounds.fWidth,
2228 nativeBounds.fHeight, preserveMask));
2234 this->flushClearColor(colorLoadStore.
fClearColor);
2235 this->flushColorWrite(
true);
2239 SkASSERT(!this->
caps()->performStencilClearsAsDraws());
2240 GL_CALL(StencilMask(0xffffffff));
2246 this->disableWindowRectangles();
2257 SkASSERT(fIsExecutingCommandBuffer_DebugOnly);
2261 if (rt->
uniqueID() != fHWBoundRenderTargetUniqueID ||
2262 useMultisampleFBO != fHWBoundFramebufferIsMSAA) {
2279 if (!discardAttachments.
empty()) {
2282 discardAttachments.
begin()));
2286 discardAttachments.
begin()));
2296 GL_CALL(EndTiling(preserveMask));
2299 SkDEBUGCODE(fIsExecutingCommandBuffer_DebugOnly =
false);
2306 SkASSERT(!this->
caps()->performStencilClearsAsDraws());
2307 SkASSERT(!scissor.
enabled() || !this->caps()->performPartialClearsAsDraws());
2320 GrGLint clipStencilMask = (1 << (stencilBitCount - 1));
2327 static const GrGLint clipStencilMask = ~0;
2330 if (insideStencilMask) {
2331 value = (1 << (stencilBitCount - 1));
2336 this->flushRenderTarget(glRT, useMultisampleFBO);
2338 this->flushScissor(scissor, glRT->
height(), origin);
2339 this->disableWindowRectangles();
2341 GL_CALL(StencilMask((uint32_t) clipStencilMask));
2352 int rowWidthInPixels) {
2363 format, surfaceColorType, dstColorType, &externalFormat, &externalType);
2364 if (!externalFormat || !externalType) {
2370 constexpr bool useMultisampleFBO =
false;
2371 if (renderTarget->
numSamples() > 1 && renderTarget->
isFBO0(useMultisampleFBO)) {
2374 this->flushRenderTarget(renderTarget, useMultisampleFBO);
2382 if (rowWidthInPixels !=
rect.width()) {
2396 if (rowWidthInPixels !=
rect.width()) {
2401 if (!renderTarget) {
2421 rowPixelWidth =
rect.width();
2423 SkASSERT(!(rowBytes % bytesPerPixel));
2424 rowPixelWidth = rowBytes / bytesPerPixel;
2427 return this->readOrTransferPixelsFrom(
surface,
2437 bool useMultisampleFBO,
2445 if (!fCachedOpsRenderPass) {
2446 fCachedOpsRenderPass = std::make_unique<GrGLOpsRenderPass>(
this);
2448 if (useMultisampleFBO && rt->
numSamples() == 1) {
2451 if (!glRT->ensureDynamicMSAAAttachment()) {
2452 SkDebugf(
"WARNING: Failed to make dmsaa attachment. Render pass will be dropped.");
2456 fCachedOpsRenderPass->set(rt, useMultisampleFBO,
bounds, origin, colorInfo, stencilInfo);
2457 return fCachedOpsRenderPass.get();
2463 if (fHWBoundRenderTargetUniqueID != rtID ||
2464 fHWBoundFramebufferIsMSAA != useMultisampleFBO ||
2465 target->mustRebind(useMultisampleFBO)) {
2466 target->bind(useMultisampleFBO);
2473 if (!this->
glCaps().skipErrorChecks() &&
2474 !this->
glCaps().rebindColorAttachmentAfterCheckFramebufferStatus()) {
2478 SkDebugf(
"GrGLGpu::flushRenderTargetNoColorWrites glCheckFramebufferStatus %x\n",
2483 fHWBoundRenderTargetUniqueID = rtID;
2484 fHWBoundFramebufferIsMSAA = useMultisampleFBO;
2489 if (this->
caps()->workarounds().force_update_scissor_state_when_binding_fbo0) {
2491 if (!fHWScissorSettings.fRect.isInvalid()) {
2495 if (fHWScissorSettings.fEnabled == kYes_TriState) {
2498 }
else if (fHWScissorSettings.fEnabled == kNo_TriState) {
2504 if (this->
glCaps().srgbWriteControl()) {
2505 this->flushFramebufferSRGB(this->
caps()->isFormatSRGB(
target->backendFormat()));
2508 if (this->
glCaps().shouldQueryImplementationReadSupport(
target->format())) {
2517void GrGLGpu::flushFramebufferSRGB(
bool enable) {
2518 if (enable && kYes_TriState != fHWSRGBFramebuffer) {
2520 fHWSRGBFramebuffer = kYes_TriState;
2521 }
else if (!enable && kNo_TriState != fHWSRGBFramebuffer) {
2523 fHWSRGBFramebuffer = kNo_TriState;
2530 if (this->
glCaps().requiresCullFaceEnableDisableWhenDrawingLinesAfterNonLines() &&
2535 fLastPrimitiveType = primitiveType;
2537 switch (primitiveType) {
2549 SK_ABORT(
"invalid GrPrimitiveType");
2564 bool invalidateReadBufferAfterBlit) {
2583 this->disableWindowRectangles();
2584 GL_CALL(ResolveMultisampleFramebuffer());
2588 int l = resolveRect.
x();
2589 int b = resolveRect.
y();
2590 int r = resolveRect.
x() + resolveRect.
width();
2591 int t = resolveRect.
y() + resolveRect.
height();
2595 this->disableWindowRectangles();
2600 invalidateReadBufferAfterBlit) {
2611 rt->
bind(readBufferIsMSAA);
2640 return gTable[(
int)op];
2661 GR_GL_CALL(
gl, StencilFuncSeparate(glFace, glFunc, ref, mask));
2662 GR_GL_CALL(
gl, StencilMaskSeparate(glFace, writeMask));
2670 this->disableStencil();
2671 }
else if (fHWStencilSettings != stencilSettings ||
2672 (stencilSettings.
isTwoSided() && fHWStencilOrigin != origin)) {
2673 if (kYes_TriState != fHWStencilTestEnabled) {
2676 fHWStencilTestEnabled = kYes_TriState;
2687 fHWStencilSettings = stencilSettings;
2688 fHWStencilOrigin = origin;
2692void GrGLGpu::disableStencil() {
2693 if (kNo_TriState != fHWStencilTestEnabled) {
2696 fHWStencilTestEnabled = kNo_TriState;
2701void GrGLGpu::flushConservativeRasterState(
bool enabled) {
2702 if (this->
caps()->conservativeRasterSupport()) {
2704 if (kYes_TriState != fHWConservativeRasterEnabled) {
2706 fHWConservativeRasterEnabled = kYes_TriState;
2709 if (kNo_TriState != fHWConservativeRasterEnabled) {
2711 fHWConservativeRasterEnabled = kNo_TriState;
2717void GrGLGpu::flushWireframeState(
bool enabled) {
2718 if (this->
caps()->wireframeSupport()) {
2719 if (this->
caps()->wireframeMode() || enabled) {
2720 if (kYes_TriState != fHWWireframeEnabled) {
2722 fHWWireframeEnabled = kYes_TriState;
2725 if (kNo_TriState != fHWWireframeEnabled) {
2727 fHWWireframeEnabled = kNo_TriState;
2741 this->flushBlendAndColorWrite(preserveDstBlend, swizzle);
2755 if (kNo_TriState != fHWBlendState.fEnabled) {
2762 SkASSERT(this->
caps()->advancedBlendEquationSupport());
2766 fHWBlendState.fEquation = blendEquation;
2773 if (this->
glCaps().mustResetBlendFuncBetweenDualSourceAndDisable() &&
2784 fHWBlendState.fEnabled = kNo_TriState;
2787 if (kYes_TriState != fHWBlendState.fEnabled) {
2790 fHWBlendState.fEnabled = kYes_TriState;
2793 if (fHWBlendState.fEquation != equation) {
2795 fHWBlendState.fEquation = equation;
2799 SkASSERT(this->
caps()->advancedBlendEquationSupport());
2806 if (fHWBlendState.fSrcCoeff != srcCoeff || fHWBlendState.fDstCoeff != dstCoeff) {
2809 fHWBlendState.fSrcCoeff = srcCoeff;
2810 fHWBlendState.fDstCoeff = dstCoeff;
2815 if (!fHWBlendState.fConstColorValid || fHWBlendState.fConstColor != blendConst) {
2816 GL_CALL(BlendColor(blendConst.
fR, blendConst.
fG, blendConst.
fB, blendConst.
fA));
2817 fHWBlendState.fConstColor = blendConst;
2818 fHWBlendState.fConstColorValid =
true;
2831 if (!this->
caps()->npotTextureTileSupport()) {
2845 if (fHWTextureUnitBindings[unitIdx].boundID(
target) != textureID) {
2846 this->setTextureUnit(unitIdx);
2848 fHWTextureUnitBindings[unitIdx].setBoundID(
target, textureID);
2864 auto timestamp =
texture->parameters()->resetTimestamp();
2865 bool setAll = timestamp < fResetTimestampForTextureParameters;
2868 if (this->
glCaps().useSamplerObjects()) {
2869 fSamplerObjectCache->bindSampler(unitIdx, samplerState);
2870 if (this->
glCaps().mustSetAnyTexParameterToEnableMipmapping()) {
2875 texture->parameters()->samplerOverriddenState();
2876 this->setTextureUnit(unitIdx);
2878 newSamplerState = oldSamplerState;
2880 samplerStateToRecord = &newSamplerState;
2884 if (fSamplerObjectCache) {
2885 fSamplerObjectCache->unbindSampler(unitIdx);
2888 texture->parameters()->samplerOverriddenState();
2889 samplerStateToRecord = &newSamplerState;
2899 this->glCaps().maxTextureMaxAnisotropy());
2902 newSamplerState.
fMinLOD = -1000.f;
2903 newSamplerState.
fMaxLOD = 1000.f;
2906 this->setTextureUnit(unitIdx);
2910 this->setTextureUnit(unitIdx);
2913 if (this->
glCaps().mipmapLodControlSupport()) {
2914 if (setAll || newSamplerState.
fMinLOD != oldSamplerState.
fMinLOD) {
2915 this->setTextureUnit(unitIdx);
2918 if (setAll || newSamplerState.
fMaxLOD != oldSamplerState.
fMaxLOD) {
2919 this->setTextureUnit(unitIdx);
2923 if (setAll || newSamplerState.
fWrapS != oldSamplerState.
fWrapS) {
2924 this->setTextureUnit(unitIdx);
2927 if (setAll || newSamplerState.
fWrapT != oldSamplerState.
fWrapT) {
2928 this->setTextureUnit(unitIdx);
2931 if (this->
glCaps().clampToBorderSupport()) {
2934 this->setTextureUnit(unitIdx);
2935 static const GrGLfloat kTransparentBlack[4] = {0.f, 0.f, 0.f, 0.f};
2939 if (this->
caps()->anisoSupport()) {
2953 texture->parameters()->nonsamplerState();
2954 if (this->
glCaps().textureSwizzleSupport()) {
2962 this->setTextureUnit(unitIdx);
2977 if (this->
glCaps().mipmapLevelControlSupport() &&
2979 !this->glCaps().dontSetBaseOrMaxLevelForExternalTextures())) {
2981 this->setTextureUnit(unitIdx);
2986 this->setTextureUnit(unitIdx);
2991 texture->parameters()->set(samplerStateToRecord, newNonsamplerState,
2992 fResetTimestampForTextureParameters);
2995void GrGLGpu::onResetTextureBindings() {
2998 for (
int i = 0;
i < this->numTextureUnits(); ++
i) {
2999 this->setTextureUnit(
i);
3000 for (
auto target : kTargets) {
3001 if (fHWTextureUnitBindings[
i].hasBeenModified(
target)) {
3005 fHWTextureUnitBindings[
i].invalidateAllTargets(
true);
3009void GrGLGpu::flushColorWrite(
bool writeColor) {
3011 if (kNo_TriState != fHWWriteToColor) {
3014 fHWWriteToColor = kNo_TriState;
3017 if (kYes_TriState != fHWWriteToColor) {
3019 fHWWriteToColor = kYes_TriState;
3024void GrGLGpu::flushClearColor(std::array<float, 4>
color) {
3026 if (this->
glCaps().clearToBoundaryValuesIsBroken() &&
3027 (1 == r || 0 == r) && (1 == g || 0 == g) && (1 ==
b || 0 ==
b) && (1 ==
a || 0 ==
a)) {
3028 static const GrGLfloat safeAlpha1 = nextafter(1.f, 2.f);
3029 static const GrGLfloat safeAlpha0 = nextafter(0.f, -1.f);
3030 a = (1 ==
a) ? safeAlpha1 : safeAlpha0;
3032 if (r != fHWClearColor[0] || g != fHWClearColor[1] ||
3033 b != fHWClearColor[2] ||
a != fHWClearColor[3]) {
3035 fHWClearColor[0] = r;
3036 fHWClearColor[1] = g;
3037 fHWClearColor[2] =
b;
3038 fHWClearColor[3] =
a;
3042void GrGLGpu::setTextureUnit(
int unit) {
3043 SkASSERT(unit >= 0 && unit < this->numTextureUnits());
3044 if (unit != fHWActiveTextureUnitIdx) {
3046 fHWActiveTextureUnitIdx = unit;
3052 int lastUnitIdx = this->numTextureUnits() - 1;
3053 if (lastUnitIdx != fHWActiveTextureUnitIdx) {
3055 fHWActiveTextureUnitIdx = lastUnitIdx;
3059 fHWTextureUnitBindings[lastUnitIdx].invalidateForScratchUse(
target);
3069 int dstSampleCnt = 0;
3070 int srcSampleCnt = 0;
3092 dstTexTypePtr = &dstTexType;
3096 srcTexTypePtr = &srcTexType;
3099 return caps.
canCopyAsBlit(dstFormat, dstSampleCnt, dstTexTypePtr,
3100 srcFormat, srcSampleCnt, srcTexTypePtr,
3101 src->getBoundsRect(),
true, srcRect, dstRect);
3132 dstTexTypePtr = &dstTexType;
3136 srcTexTypePtr = &srcTexType;
3140 srcFormat, srcHasMSAARenderBuffer, srcTexTypePtr);
3144 TempFBOTarget tempFBOTarget) {
3146 if (!rt || mipLevel > 0) {
3152 tempFBOID = kSrc_TempFBOTarget == tempFBOTarget ? &fTempSrcFBOID : &fTempDstFBOID;
3154 if (0 == *tempFBOID) {
3162 if (mipLevel == 0) {
3163 texture->baseLevelWasBoundToFBO();
3172 if (mipLevel > 0 || !
surface->asRenderTarget()) {
3183void GrGLGpu::onFBOChanged() {
3184 if (this->
caps()->workarounds().flush_on_framebuffer_change) {
3185 this->flush(FlushType::kForce);
3188 if (fIsExecutingCommandBuffer_DebugOnly) {
3189 SkDebugf(
"WARNING: GL FBO binding changed while executing a command buffer. "
3190 "This will severely hurt performance.\n");
3198 fBoundDrawFramebuffer = fboid;
3200 this->onFBOChanged();
3207 if (fboid == fBoundDrawFramebuffer &&
3208 this->
caps()->workarounds().unbind_attachments_on_bound_render_fbo_delete) {
3221 GL_CALL(DeleteFramebuffers(1, &fboid));
3224 if (fboid == fBoundDrawFramebuffer) {
3225 this->onFBOChanged();
3234 bool preferCopy =
SkToBool(
dst->asRenderTarget());
3235 bool scalingCopy = dstRect.
size() != srcRect.
size();
3238 this->
glCaps().canCopyAsDraw(dstFormat,
SkToBool(
src->asTexture()), scalingCopy)) {
3240 bool drawToMultisampleFBO = dstRT && dstRT->
numSamples() > 1;
3241 if (this->copySurfaceAsDraw(
dst, drawToMultisampleFBO,
src, srcRect, dstRect, filter)) {
3248 this->copySurfaceAsCopyTexSubImage(
dst,
src, srcRect, dstRect.
topLeft());
3253 return this->copySurfaceAsBlitFramebuffer(
dst,
src, srcRect, dstRect, filter);
3257 this->
glCaps().canCopyAsDraw(dstFormat,
SkToBool(
src->asTexture()), scalingCopy)) {
3259 bool drawToMultisampleFBO = dstRT && dstRT->
numSamples() > 1;
3260 if (this->copySurfaceAsDraw(
dst, drawToMultisampleFBO,
src, srcRect, dstRect, filter)) {
3268bool GrGLGpu::createCopyProgram(
GrTexture* srcTex) {
3271 int progIdx = TextureToCopyProgramIdx(srcTex);
3275 if (!fCopyProgramArrayBuffer) {
3286 if (fCopyProgramArrayBuffer) {
3288 vdata, 0,
sizeof(vdata),
false);
3291 if (!fCopyProgramArrayBuffer) {
3297 if (!fCopyPrograms[progIdx].
fProgram) {
3312 vshaderTxt.
appendf(
"#extension %s : require\n", extension);
3314 vTexCoord.addModifier(
"noperspective");
3317 aVertex.appendDecl(shaderCaps, &vshaderTxt);
3319 uTexCoordXform.appendDecl(shaderCaps, &vshaderTxt);
3321 uPosXform.appendDecl(shaderCaps, &vshaderTxt);
3323 vTexCoord.appendDecl(shaderCaps, &vshaderTxt);
3329 "v_texCoord = half2(a_vertex.xy * u_texCoordXform.xy + u_texCoordXform.zw);"
3330 "sk_Position.xy = a_vertex * u_posXform.xy + u_posXform.zw;"
3331 "sk_Position.zw = half2(0, 1);"
3338 fshaderTxt.
appendf(
"#extension %s : require\n", extension);
3342 vTexCoord.appendDecl(shaderCaps, &fshaderTxt);
3344 uTexture.appendDecl(shaderCaps, &fshaderTxt);
3349 "sk_FragColor = sample(u_texture, v_texCoord);"
3352 std::string vertexSkSL{vshaderTxt.
c_str(), vshaderTxt.
size()};
3353 std::string fragmentSkSL{fshaderTxt.
c_str(), fshaderTxt.
size()};
3366 fProgramCache->stats(),
3382 fProgramCache->stats(),
3405 GetUniformLocation(fCopyPrograms[progIdx].
fProgram,
"u_texture"));
3407 GetUniformLocation(fCopyPrograms[progIdx].
fProgram,
"u_posXform"));
3409 GetUniformLocation(fCopyPrograms[progIdx].
fProgram,
"u_texCoordXform"));
3411 GL_CALL(BindAttribLocation(fCopyPrograms[progIdx].
fProgram, 0,
"a_vertex"));
3419bool GrGLGpu::createMipmapProgram(
int progIdx) {
3420 const bool oddWidth =
SkToBool(progIdx & 0x2);
3421 const bool oddHeight =
SkToBool(progIdx & 0x1);
3422 const int numTaps = (oddWidth ? 2 : 1) * (oddHeight ? 2 : 1);
3428 if (!fMipmapPrograms[progIdx].
fProgram) {
3448 vshaderTxt.
appendf(
"#extension %s : require\n", extension);
3456 aVertex.appendDecl(shaderCaps, &vshaderTxt);
3458 uTexCoordXform.appendDecl(shaderCaps, &vshaderTxt);
3460 for (
int i = 0;
i < numTaps; ++
i) {
3461 vTexCoords[
i].
appendDecl(shaderCaps, &vshaderTxt);
3468 "sk_Position.xy = a_vertex * half2(2) - half2(1);"
3469 "sk_Position.zw = half2(0, 1);"
3473 if (oddWidth && oddHeight) {
3475 "v_texCoord0 = a_vertex.xy * u_texCoordXform.yw;"
3476 "v_texCoord1 = a_vertex.xy * u_texCoordXform.yw + half2(u_texCoordXform.x, 0);"
3477 "v_texCoord2 = a_vertex.xy * u_texCoordXform.yw + half2(0, u_texCoordXform.z);"
3478 "v_texCoord3 = a_vertex.xy * u_texCoordXform.yw + u_texCoordXform.xz;"
3480 }
else if (oddWidth) {
3482 "v_texCoord0 = a_vertex.xy * half2(u_texCoordXform.y, 1);"
3483 "v_texCoord1 = a_vertex.xy * half2(u_texCoordXform.y, 1) + half2(u_texCoordXform.x, 0);"
3485 }
else if (oddHeight) {
3487 "v_texCoord0 = a_vertex.xy * half2(1, u_texCoordXform.w);"
3488 "v_texCoord1 = a_vertex.xy * half2(1, u_texCoordXform.w) + half2(0, u_texCoordXform.z);"
3492 "v_texCoord0 = a_vertex.xy;"
3501 fshaderTxt.
appendf(
"#extension %s : require\n", extension);
3504 for (
int i = 0;
i < numTaps; ++
i) {
3506 vTexCoords[
i].
appendDecl(shaderCaps, &fshaderTxt);
3509 uTexture.appendDecl(shaderCaps, &fshaderTxt);
3516 if (oddWidth && oddHeight) {
3518 "sk_FragColor = (sample(u_texture, v_texCoord0) + "
3519 "sample(u_texture, v_texCoord1) + "
3520 "sample(u_texture, v_texCoord2) + "
3521 "sample(u_texture, v_texCoord3)) * 0.25;"
3523 }
else if (oddWidth || oddHeight) {
3525 "sk_FragColor = (sample(u_texture, v_texCoord0) + "
3526 "sample(u_texture, v_texCoord1)) * 0.5;"
3530 "sk_FragColor = sample(u_texture, v_texCoord0);"
3536 std::string vertexSkSL{vshaderTxt.
c_str(), vshaderTxt.
size()};
3537 std::string fragmentSkSL{fshaderTxt.
c_str(), fshaderTxt.
size()};
3551 fProgramCache->stats(),
3566 fProgramCache->stats(),
3588 GetUniformLocation(fMipmapPrograms[progIdx].
fProgram,
"u_texture"));
3590 GetUniformLocation(fMipmapPrograms[progIdx].
fProgram,
"u_texCoordXform"));
3592 GL_CALL(BindAttribLocation(fMipmapPrograms[progIdx].
fProgram, 0,
"a_vertex"));
3610 this->flushRenderTarget(dstRT, drawToMultisampleFBO);
3615 if (!this->
glCaps().isFormatRenderable(dstTex->format(), 1)) {
3621 int progIdx = TextureToCopyProgramIdx(srcTex);
3622 if (!fCopyPrograms[progIdx].
fProgram) {
3623 if (!this->createCopyProgram(srcTex)) {
3624 SkDebugf(
"Failed to create copy program.\n");
3632 fHWVertexArrayState.setVertexArrayID(
this, 0);
3638 int dw =
dst->width();
3639 int dh =
dst->height();
3648 int sw =
src->width();
3649 int sh =
src->height();
3659 sx1 - sx0, sy1 - sy0, sx0, sy0));
3662 this->flushConservativeRasterState(
false);
3663 this->flushWireframeState(
false);
3665 this->disableWindowRectangles();
3666 this->disableStencil();
3667 if (this->
glCaps().srgbWriteControl()) {
3668 this->flushFramebufferSRGB(
true);
3686 this->bindTextureToScratchUnit(dstTex->
target(), dstTex->
textureID());
3688 dstPoint.
fX, dstPoint.
fY,
3714 this->disableWindowRectangles();
3761 if (0 == fTempDstFBOID) {
3762 GL_CALL(GenFramebuffers(1, &fTempDstFBOID));
3769 this->setTextureUnit(0);
3774 if (!fMipmapProgramArrayBuffer) {
3785 fMipmapProgramArrayBuffer->
updateData(vdata, 0,
3790 if (!fMipmapProgramArrayBuffer) {
3794 fHWVertexArrayState.setVertexArrayID(
this, 0);
3804 this->disableWindowRectangles();
3805 this->disableStencil();
3811 std::unique_ptr<GrSemaphore> semaphore;
3814 int progIdx = TextureSizeToMipmapProgramIdx(
width,
height);
3815 if (!fMipmapPrograms[progIdx].
fProgram) {
3816 if (!this->createMipmapProgram(progIdx)) {
3817 SkDebugf(
"Failed to create mipmap program.\n");
3825 if (this->
glCaps().regenerateMipmapType() == RegenerateMipmapType::kBasePlusSync &&
3832 const float invWidth = 1.0f /
width;
3833 const float invHeight = 1.0f /
height;
3835 invWidth, (
width - 1) * invWidth, invHeight, (
height - 1) * invHeight));
3845 if (this->
glCaps().regenerateMipmapType() == RegenerateMipmapType::kBasePlusMaxLevel) {
3858 if (this->
glCaps().regenerateMipmapType() == RegenerateMipmapType::kBasePlusSync &&
3859 level < levelCount-1) {
3873 if (this->
glCaps().regenerateMipmapType() == RegenerateMipmapType::kBasePlusMaxLevel) {
3876 glTex->
parameters()->
set(
nullptr, nonsamplerState, fResetTimestampForTextureParameters);
3900 this->
caps()->blendEquationSupport());
3912 std::string_view label) {
3924 int numMipLevels = 1;
3938 switch (
format.textureType()) {
3953 this->
glCaps().supportsProtectedContent());
3955 info.fID = this->createTexture(dimensions, glFormat,
info.fTarget, renderable, &initialState,
3956 numMipLevels,
info.fProtected, label);
3962 this->bindTextureToScratchUnit(
info.fTarget, 0);
3964 auto parameters = sk_make_sp<GrGLTextureParameters>();
3967 fResetTimestampForTextureParameters);
3970 dimensions.
width(), dimensions.
height(), mipmapped,
info, std::move(parameters), label);
3975 std::array<float, 4>
color) {
3981 int numMipLevels = 1;
3989 this->bindTextureToScratchUnit(
info.fTarget,
info.fID);
3993 if (numMipLevels && this->
glCaps().mipmapLevelControlSupport()) {
3996 if (
params->nonsamplerState().fBaseMipMapLevel != 0) {
4000 if (
params->nonsamplerState().fMaxMipmapLevel != (numMipLevels - 1)) {
4004 params->set(
nullptr, nonsamplerState, fResetTimestampForTextureParameters);
4007 uint32_t levelMask = (1 << numMipLevels) - 1;
4008 bool result = this->uploadColorToTex(glFormat,
4015 this->bindTextureToScratchUnit(
info.fTarget, 0);
4032 desc, programInfo, &stat);
4040#if defined(GR_TEST_UTILS)
4042bool GrGLGpu::isTestingOnlyBackendTexture(
const GrBackendTexture& tex)
const {
4060 if (dimensions.
width() > this->caps()->maxRenderTargetSize() ||
4061 dimensions.
height() > this->caps()->maxRenderTargetSize()) {
4077 bool useTexture =
false;
4078 if (sampleCnt > 1 && !this->
glCaps().usesMSAARenderBuffers()) {
4085 if (sampleCnt > 1) {
4090 int sFormatIdx = this->getCompatibleStencilIndex(
format);
4091 if (sFormatIdx < 0) {
4100 this->
glCaps().supportsProtectedContent());
4102 auto deleteIDs = [&](
bool saveFBO =
false) {
4105 GL_CALL(DeleteTextures(1, &colorID));
4107 GL_CALL(DeleteRenderbuffers(1, &colorID));
4111 GL_CALL(DeleteRenderbuffers(1, &stencilID));
4113 if (!saveFBO &&
info.fFBOID) {
4119 GL_CALL(GenTextures(1, &colorID));
4121 GL_CALL(GenRenderbuffers(1, &colorID));
4123 GL_CALL(GenRenderbuffers(1, &stencilID));
4124 if (!stencilID || !colorID) {
4149 if (sampleCnt == 1) {
4159 if (sampleCnt == 1) {
4163 if (!this->renderbufferStorageMSAA(this->
glContext(), sampleCnt, renderBufferFormat,
4174 if (sampleCnt == 1) {
4178 if (!this->renderbufferStorageMSAA(this->
glContext(), sampleCnt,
4210 dimensions.
width(), dimensions.
height(), sampleCnt, stencilBits,
info);
4234 if (!fCoreProfileVertexArray) {
4241 attribState = fCoreProfileVertexArray->bindWithIndexBuffer(gpu, ibuf);
4243 attribState = fCoreProfileVertexArray->bind(gpu);
4250 this->setVertexArrayID(gpu, 0);
4253 if (fDefaultVertexArrayAttribState.count() != attrCount) {
4254 fDefaultVertexArrayAttribState.resize(attrCount);
4256 attribState = &fDefaultVertexArrayAttribState;
4263 fFinishCallbacks.
add(finishedProc, finishedContext);
4266void GrGLGpu::flush(
FlushType flushType) {
4267 if (fNeedsGLFlush || flushType == FlushType::kForce) {
4269 fNeedsGLFlush =
false;
4273bool GrGLGpu::onSubmitToGpu(
GrSyncCpu sync) {
4275 (!fFinishCallbacks.
empty() && !this->glCaps().fenceSyncSupport())) {
4277 fFinishCallbacks.
callAll(
true);
4281 fFinishCallbacks.
check();
4283 if (!this->
glCaps().skipErrorChecks()) {
4292 if (fStagingBufferManager) {
4293 fStagingBufferManager->detachBuffers();
4299 SkASSERT(fCachedOpsRenderPass.get() == renderPass);
4300 fCachedOpsRenderPass->reset();
4304 if (!this->
glCaps().fenceSyncSupport()) {
4311 GL_CALL(GenFences(1, &fence));
4313 sync =
reinterpret_cast<GrGLsync>(
static_cast<intptr_t
>(fence));
4317 this->setNeedsFlush();
4323 GrGLuint nvFence =
static_cast<GrGLuint>(
reinterpret_cast<intptr_t
>(sync));
4326 this->flush(FlushType::kForce);
4335 GL_CALL(FinishFence(nvFence));
4346 if (!this->
glCaps().fenceSyncSupport()) {
4349 return this->waitSync(fence, 0,
false);
4353 if (this->
glCaps().fenceSyncSupport()) {
4376 this->setNeedsFlush();
4387 fFinishCallbacks.
check();
4399#if GR_GL_CHECK_ERROR
4404 GrGLenum error = this->fGLContext->glInterface()->fFunctions.fGetError();
4414 GL_CALL(DeleteFences(1, &nvFence));
4422 std::unique_ptr<GrSemaphore> semaphore = this->
makeSemaphore(
true);
4426 this->flush(FlushType::kForce);
4440 SK_ABORT(
"Unexpected samper type");
4444#ifdef SK_ENABLE_DUMP_GPU
4459 writer->
appendCString(
"GL_SHADING_LANGUAGE_VERSION", (
const char*)(str));
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
SkTextureCompressionType GrBackendFormatToCompressionType(const GrBackendFormat &format)
int GrBackendFormatStencilBits(const GrBackendFormat &format)
bool GrClearImage(const GrImageInfo &dstInfo, void *dst, size_t dstRB, std::array< float, 4 > color)
#define GR_GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM
#define GR_GL_OUT_OF_MEMORY
#define GR_GL_ONE_MINUS_SRC1_COLOR
#define GR_GL_TRIANGLE_STRIP
#define GR_GL_TEXTURE_MAX_LOD
#define GR_GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM
#define GR_GL_COLOR_TABLE
#define GR_GL_UNPACK_ROW_LENGTH
#define GR_GL_NEAREST_MIPMAP_LINEAR
#define GR_GL_IMPLEMENTATION_COLOR_READ_TYPE
#define GR_GL_FRONT_AND_BACK
#define GR_GL_ONE_MINUS_SRC1_ALPHA
#define GR_GL_PIXEL_PACK_BUFFER
#define GR_GL_POINT_SMOOTH
#define GR_GL_POLYGON_STIPPLE
#define GR_GL_DRAW_FRAMEBUFFER
#define GR_GL_POLYGON_SMOOTH
#define GR_GL_LINEAR_MIPMAP_NEAREST
#define GR_GL_TEXTURE_BASE_LEVEL
#define GR_GL_TIMEOUT_IGNORED
#define GR_GL_MULTISAMPLE
#define GR_GL_COLOR_LOGIC_OP
#define GR_GL_CLAMP_TO_EDGE
#define GR_GL_READ_FRAMEBUFFER
#define GR_GL_TEXTURE_MAX_ANISOTROPY
#define GR_GL_DRAW_INDIRECT_BUFFER
#define GR_GL_TEXTURE_SWIZZLE_B
#define GR_GL_ALL_COMPLETED
#define GR_GL_ONE_MINUS_DST_ALPHA
#define GR_GL_TEXTURE_WRAP_T
#define GR_GL_LINE_SMOOTH
#define GR_GL_HSL_SATURATION
#define GR_GL_STENCIL_BUFFER_BIT
#define GR_GL_TEXTURE_USAGE
#define GR_GL_ELEMENT_ARRAY_BUFFER
#define GR_GL_INDEX_LOGIC_OP
#define GR_GL_TEXTURE_MAG_FILTER
#define GR_GL_POLYGON_OFFSET_FILL
#define GR_GL_PACK_ROW_LENGTH
#define GR_GL_ALREADY_SIGNALED
#define GR_GL_TEXTURE_SWIZZLE_RGBA
#define GR_GL_CONSTANT_COLOR
#define GR_GL_SHADING_LANGUAGE_VERSION
#define GR_GL_IMPLEMENTATION_COLOR_READ_FORMAT
#define GR_GL_RENDERBUFFER
#define GR_GL_FUNC_REVERSE_SUBTRACT
#define GR_GL_FRAMEBUFFER_ATTACHMENT
#define GR_GL_FRAGMENT_SHADER
#define GR_GL_ONE_MINUS_CONSTANT_COLOR
#define GR_GL_TEXTURE_SWIZZLE_A
#define GR_GL_UNPACK_ALIGNMENT
#define GR_GL_STENCIL_ATTACHMENT
#define GR_GL_NEAREST_MIPMAP_NEAREST
#define GR_GL_LINEAR_MIPMAP_LINEAR
#define GR_GL_STENCIL_TEST
#define GR_GL_DEPTH_ATTACHMENT
#define GR_GL_ONE_MINUS_DST_COLOR
#define GR_GL_FRAMEBUFFER_COMPLETE
#define GR_GL_VERTEX_PROGRAM_POINT_SIZE
#define GR_GL_TEXTURE_PROTECTED_EXT
#define GR_GL_TEXTURE_RECTANGLE
#define GR_GL_SCISSOR_TEST
#define GR_GL_TEXTURE_BORDER_COLOR
#define GR_GL_PIXEL_UNPACK_BUFFER
#define GR_GL_TEXTURE_WRAP_S
#define GR_GL_FUNC_SUBTRACT
#define GR_GL_TEXTURE_MIN_LOD
#define GR_GL_CLAMP_TO_BORDER
#define GR_GL_COLOR_BUFFER_BIT
#define GR_GL_FETCH_PER_SAMPLE
#define GR_GL_TEXTURE_SWIZZLE_R
#define GR_GL_SYNC_FLUSH_COMMANDS_BIT
#define GR_GL_TEXTURE_MAX_LEVEL
#define GR_GL_VERTEX_SHADER
#define GR_GL_CONDITION_SATISFIED
#define GR_GL_FRAMEBUFFER_SRGB
#define GR_GL_COLOR_BUFFER_BIT0
#define GR_GL_TEXTURE_SWIZZLE_G
#define GR_GL_ARRAY_BUFFER
#define GR_GL_ONE_MINUS_SRC_COLOR
#define GR_GL_MIRRORED_REPEAT
#define GR_GL_HSL_LUMINOSITY
#define GR_GL_SYNC_GPU_COMMANDS_COMPLETE
#define GR_GL_TEXTURE_EXTERNAL
#define GR_GL_TEXTURE_MIN_FILTER
#define GR_GL_ONE_MINUS_SRC_ALPHA
#define GR_GL_PACK_ALIGNMENT
#define GR_GL_CONSERVATIVE_RASTERIZATION
#define GR_GL_PACK_REVERSE_ROW_ORDER
#define GR_GL_FRAMEBUFFER
#define GR_GL_COLOR_ATTACHMENT0
static bool check_compressed_backend_texture(const GrBackendTexture &backendTex, const GrGLCaps &caps, GrGLTexture::Desc *desc, bool skipRectTexSupportCheck=false)
static GrGLenum wrap_mode_to_gl_wrap(GrSamplerState::WrapMode wrapMode, const GrCaps &caps)
static sk_sp< GrTexture > return_null_texture()
static int gl_target_to_binding_index(GrGLenum target)
static sk_sp< GrGLTextureParameters > get_gl_texture_params(const GrBackendTexture &backendTex)
static const GrGLenum gXfermodeCoeff2Blend[]
static bool can_blit_framebuffer_for_copy_surface(const GrSurface *dst, const GrSurface *src, const SkIRect &srcRect, const SkIRect &dstRect, const GrGLCaps &caps)
static bool check_backend_texture(const GrBackendTexture &backendTex, const GrGLCaps &caps, GrGLTexture::Desc *desc, bool skipRectTexSupportCheck=false)
static void set_khr_debug_label(GrGLGpu *gpu, const GrGLuint id, std::string_view label)
static GrGLenum filter_to_gl_min_filter(GrSamplerState::Filter filter, GrSamplerState::MipmapMode mm)
static bool rt_has_msaa_render_buffer(const GrGLRenderTarget *rt, const GrGLCaps &glCaps)
static bool check_write_and_transfer_input(GrGLTexture *glTex)
static GrGLTextureParameters::SamplerOverriddenState set_initial_texture_params(const GrGLInterface *interface, const GrGLCaps &caps, GrGLenum target)
static const GrGLenum gXfermodeEquation2Blend[]
static void cleanup_program(GrGLGpu *gpu, GrGLuint *programID, GrGLuint *vshader, GrGLuint *fshader)
static bool can_copy_texsubimage(const GrSurface *dst, const GrSurface *src, const GrGLCaps &caps)
static GrGLenum filter_to_gl_mag_filter(GrSamplerState::Filter filter)
#define GL_ALLOC_CALL(call)
static bool use_tiled_rendering(const GrGLCaps &glCaps, const GrOpsRenderPass::StencilLoadAndStoreInfo &stencilLoadStore)
#define GL_CALL_RET(RET, X)
SK_API sk_sp< const GrGLInterface > GrGLMakeNativeInterface()
bool GrGLCheckLinkStatus(const GrGLGpu *gpu, GrGLuint programID, bool shaderWasCached, GrContextOptions::ShaderErrorHandler *errorHandler, const std::string *sksl[kGrShaderTypeCount], const std::string glsl[kGrShaderTypeCount])
GrGLuint GrGLCompileAndAttachShader(const GrGLContext &glCtx, GrGLuint programId, GrGLenum type, const std::string &glsl, bool shaderWasCached, GrThreadSafePipelineBuilder::Stats *stats, GrContextOptions::ShaderErrorHandler *errorHandler)
unsigned char GrGLboolean
unsigned int GrGLbitfield
#define GR_IS_GR_GL(standard)
struct __GLsync * GrGLsync
#define GR_IS_GR_GL_ES(standard)
bool GrGLFormatIsCompressed(GrGLFormat format)
GrGLenum GrToGLStencilFunc(GrStencilTest test)
static constexpr int GrGLFormatStencilBits(GrGLFormat format)
static constexpr GrGLFormat GrGLFormatFromGLEnum(GrGLenum glFormat)
#define GR_GL_CALL(IFACE, X)
#define GR_GL_GetIntegerv(gl, e, p)
static constexpr GrGLenum GrGLFormatToEnum(GrGLFormat format)
static constexpr bool GrGLFormatIsPackedDepthStencil(GrGLFormat format)
static constexpr int kGrStencilOpCount
static constexpr size_t GrColorTypeBytesPerPixel(GrColorType ct)
#define GrCapsDebugf(caps,...)
@ kBorrow_GrWrapOwnership
static const constexpr int kGrGpuBufferTypeCount
static constexpr bool GrIsPrimTypeLines(GrPrimitiveType type)
@ kStatic_GrAccessPattern
@ kFloat2_GrVertexAttribType
static const int kGrShaderTypeCount
skgpu::Protected GrProtected
@ kTopLeft_GrSurfaceOrigin
void * GrGpuFinishedContext
void(* GrGpuFinishedProc)(GrGpuFinishedContext finishedContext)
@ kProgram_GrGLBackendState
@ kTextureBinding_GrGLBackendState
@ kVertex_GrGLBackendState
@ kBlend_GrGLBackendState
@ kMSAAEnable_GrGLBackendState
@ kPixelStore_GrGLBackendState
@ kStencil_GrGLBackendState
@ kRenderTarget_GrGLBackendState
static SkSLType SkSLCombinedSamplerTypeForTextureType(GrTextureType type)
@ kTexture_GrXferBarrierType
@ kBlend_GrXferBarrierType
#define SK_ABORT(message,...)
size_t SkCompressedDataSize(SkTextureCompressionType type, SkISize dimensions, TArray< size_t > *individualMipOffsets, bool mipmapped)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
constexpr float SK_FloatNaN
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
constexpr bool SkIsPow2(T value)
sk_sp< T > sk_ref_sp(T *obj)
#define RENDERENGINE_ABORTF(...)
@ kTextureExternalSampler
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
constexpr size_t SkToSizeT(S x)
constexpr int SkToInt(S x)
static constexpr bool SkToBool(const T &x)
constexpr unsigned SkToUInt(S x)
GrBackendFormat getBackendFormat() const
GrBackendApi backend() const
SkISize dimensions() const
static const GrBackendFormatData * GetBackendData(const GrBackendFormat &format)
SkISize dimensions() const
GrBackendFormat getBackendFormat() const
std::string_view getLabel() const
GrBackendApi backend() const
GrContextOptions::ShaderErrorHandler * getShaderErrorHandler() const
virtual bool isCpuBuffer() const =0
virtual bool isFormatTexturable(const GrBackendFormat &, GrTextureType) const =0
const GrShaderCaps * shaderCaps() const
bool anisoSupport() const
bool supportsProtectedContent() const
int maxVertexAttributes() const
maximum number of attribute values per vertex
bool clampToBorderSupport() const
@ kAdvanced_BlendEquationSupport
virtual bool isFormatRenderable(const GrBackendFormat &format, int sampleCount) const =0
virtual int getRenderTargetSampleCount(int requestedCount, const GrBackendFormat &) const =0
bool writePixelsRowBytesSupport() const
GrDirectContextPriv priv()
static sk_sp< GrGLAttachment > MakeStencil(GrGLGpu *gpu, SkISize dimensions, int sampleCnt, GrGLFormat format)
static sk_sp< GrGLAttachment > MakeMSAA(GrGLGpu *gpu, SkISize dimensions, int sampleCnt, GrGLFormat format)
void set(GrGLGpu *, int attribIndex, const GrBuffer *vertexBuffer, GrVertexAttribType cpuType, SkSLType gpuType, GrGLsizei stride, size_t offsetInBytes, int divisor=0)
void enableVertexArrays(const GrGLGpu *, int enabledCount, GrPrimitiveRestart=GrPrimitiveRestart::kNo)
static sk_sp< GrGLBuffer > Make(GrGLGpu *, size_t size, GrGpuBufferType intendedType, GrAccessPattern)
GrGLuint bufferID() const
void getReadPixelsFormat(GrGLFormat surfaceFormat, GrColorType surfaceColorType, GrColorType memoryColorType, GrGLenum *externalFormat, GrGLenum *externalType) const
GrGLenum getRenderbufferInternalFormat(GrGLFormat format) const
@ kES_EXT_MsToTexture_MSFBOType
@ kES_IMG_MsToTexture_MSFBOType
bool isCoreProfile() const
void didQueryImplementationReadSupport(GrGLFormat format, GrGLenum readFormat, GrGLenum readType) const
float maxTextureMaxAnisotropy() const
MSFBOType msFBOType() const
void getTexSubImageExternalFormatAndType(GrGLFormat surfaceFormat, GrColorType surfaceColorType, GrColorType memoryColorType, GrGLenum *externalFormat, GrGLenum *externalType) const
bool usesMSAARenderBuffers() const
bool rectangleTextureSupport() const
Are textures with GL_TEXTURE_RECTANGLE type supported.
bool debugSupport() const
Is there support for GL_KHR_debug?
bool doManualMipmapping() const
bool framebufferResolvesMustBeFullSize() const
void getTexSubImageDefaultFormatTypeAndColorType(GrGLFormat format, GrGLenum *externalFormat, GrGLenum *externalType, GrColorType *colorType) const
GrGLFormat getFormatFromColorType(GrColorType colorType) const
int getStencilFormatIndexForFormat(GrGLFormat format) const
bool isFormatRenderable(const GrBackendFormat &format, int sampleCount) const override
bool canCopyTexSubImage(GrGLFormat dstFormat, bool dstHasMSAARenderBuffer, const GrTextureType *dstTypeIfTexture, GrGLFormat srcFormat, bool srcHasMSAARenderBuffer, const GrTextureType *srcTypeIfTexture) const
int getRenderTargetSampleCount(int requestedCount, const GrBackendFormat &format) const override
bool canCopyAsBlit(GrGLFormat dstFormat, int dstSampleCnt, const GrTextureType *dstTypeIfTexture, GrGLFormat srcFormat, int srcSampleCnt, const GrTextureType *srcTypeIfTexture, const SkRect &srcBounds, bool srcBoundsExact, const SkIRect &srcRect, const SkIRect &dstRect) const
bool tiledRenderingSupport() const
void getTexImageExternalFormatAndType(GrGLFormat surfaceFormat, GrGLenum *externalFormat, GrGLenum *externalType) const
@ kDiscard_InvalidateFBType
@ kInvalidate_InvalidateFBType
const skia_private::TArray< GrGLFormat, true > & stencilFormats() const
GrGLenum getTexImageOrStorageInternalFormat(GrGLFormat format) const
const GrGLCaps * caps() const
static std::unique_ptr< GrGLContext > Make(sk_sp< const GrGLInterface >, const GrContextOptions &)
void dumpJSON(SkJSONWriter *) const
void add(GrGpuFinishedProc finishedProc, GrGpuFinishedContext finishedContext)
void callAll(bool doDelete)
void invalidateBindings()
void bindSampler(int unitIdx, GrSamplerState state)
void unbindSampler(int unitIdx)
SamplerObjectCache(GrGLGpu *gpu)
GrGLStandard glStandard() const
void flushScissorRect(const SkIRect &scissor, int rtHeight, GrSurfaceOrigin)
const GrGLCaps & glCaps() const
void clear(const GrScissorState &, std::array< float, 4 > color, GrRenderTarget *, bool useMultisampleFBO, GrSurfaceOrigin)
GrThreadSafePipelineBuilder * pipelineBuilder() override
void invalidateBoundRenderTarget()
void deleteSync(GrGLsync)
void bindVertexArray(GrGLuint id)
void clearErrorsAndCheckForOOM()
void bindTexture(int unitIdx, GrSamplerState samplerState, const skgpu::Swizzle &, GrGLTexture *)
void bindFramebuffer(GrGLenum fboTarget, GrGLuint fboid)
void deleteBackendTexture(const GrBackendTexture &) override
sk_sp< GrAttachment > makeMSAAAttachment(SkISize dimensions, const GrBackendFormat &format, int numSamples, GrProtected isProtected, GrMemoryless) override
void clearStencilClip(const GrScissorState &, bool insideStencilMask, GrRenderTarget *, bool useMultisampleFBO, GrSurfaceOrigin)
sk_sp< GrAttachment > makeStencilAttachment(const GrBackendFormat &colorFormat, SkISize dimensions, int numStencilSamples) override
GrGLenum prepareToDraw(GrPrimitiveType primitiveType)
const GrGLInterface * glInterface() const
void flushProgram(sk_sp< GrGLProgram >)
void didDrawTo(GrRenderTarget *)
GrGLenum bindBuffer(GrGpuBufferType type, const GrBuffer *)
void deleteFramebuffer(GrGLuint fboid)
void finishOutstandingGpuWork() override
void resolveRenderFBOs(GrGLRenderTarget *, const SkIRect &resolveRect, ResolveDirection, bool invalidateReadBufferAfterBlit=false)
void beginCommandBuffer(GrGLRenderTarget *, bool useMultisampleFBO, const SkIRect &bounds, GrSurfaceOrigin, const GrOpsRenderPass::LoadAndStoreInfo &colorLoadStore, const GrOpsRenderPass::StencilLoadAndStoreInfo &stencilLoadStore)
bool compile(const GrProgramDesc &, const GrProgramInfo &) override
void flushViewport(const SkIRect &viewport, int rtHeight, GrSurfaceOrigin)
bool flushGLState(GrRenderTarget *, bool useMultisampleFBO, const GrProgramInfo &)
void checkFinishProcs() override
void deleteFence(GrGLsync)
sk_sp< GrThreadSafePipelineBuilder > refPipelineBuilder() override
GrGLint fTexCoordXformUniform
void disconnect(DisconnectType) override
std::unique_ptr< GrSemaphore > makeSemaphore(bool isOwned) override
std::unique_ptr< GrSemaphore > wrapBackendSemaphore(const GrBackendSemaphore &, GrSemaphoreWrapType, GrWrapOwnership) override
void insertSemaphore(GrSemaphore *semaphore) override
void endCommandBuffer(GrGLRenderTarget *, bool useMultisampleFBO, const GrOpsRenderPass::LoadAndStoreInfo &colorLoadStore, const GrOpsRenderPass::StencilLoadAndStoreInfo &stencilLoadStore)
std::unique_ptr< GrSemaphore > prepareTextureForCrossContextUsage(GrTexture *) override
void waitSemaphore(GrSemaphore *semaphore) override
GrGLenum getErrorAndCheckForOOM()
void submit(GrOpsRenderPass *renderPass) override
const GrGLContextInfo & ctxInfo() const
void willExecute() override
static std::unique_ptr< GrGpu > Make(sk_sp< const GrGLInterface >, const GrContextOptions &, GrDirectContext *)
const GrGLContext & glContext() const
GrGLuint programID() const
void updateUniforms(const GrRenderTarget *, const GrProgramInfo &)
void bindForPixelOps(GrGLenum fboTarget)
bool glRTFBOIDis0() const
void bindForResolve(ResolveDirection)
void bind(bool useMultisampleFBO)
bool isFBO0(bool multisample) const
static sk_sp< GrGLRenderTarget > MakeWrapped(GrGLGpu *, const SkISize &, GrGLFormat, int sampleCount, const IDs &, int stencilBits, skgpu::Protected, std::string_view label)
GrGLFormat format() const
static std::unique_ptr< GrGLSemaphore > Make(GrGLGpu *gpu, bool isOwned)
void setSync(const GrGLsync &sync)
void set(const SamplerOverriddenState *samplerState, const NonsamplerState &nonsamplerState, ResetTimestamp currTimestamp)
const NonsamplerState & nonsamplerState() const
static sk_sp< GrGLTextureRenderTarget > MakeWrapped(GrGLGpu *gpu, int sampleCount, const GrGLTexture::Desc &, sk_sp< GrGLTextureParameters >, const GrGLRenderTarget::IDs &, GrWrapCacheable, GrMipmapStatus, std::string_view label)
void textureParamsModified() override
GrGLuint textureID() const
GrGLTextureParameters * parameters()
GrGLFormat format() const
static sk_sp< GrGLTexture > MakeWrapped(GrGLGpu *, GrMipmapStatus, const Desc &, sk_sp< GrGLTextureParameters >, GrWrapCacheable, GrIOType, std::string_view label)
size_t size() const final
bool updateData(const void *src, size_t offset, size_t size, bool preserve)
bool isCpuBuffer() const final
UniqueID uniqueID() const
void incStencilAttachmentCreates()
const GrCaps * caps() const
GrDirectContext * getContext()
void didWriteToSurface(GrSurface *surface, GrSurfaceOrigin origin, const SkIRect *bounds, uint32_t mipLevels=1) const
bool checkAndResetOOMed()
virtual void disconnect(DisconnectType)
void initCaps(sk_sp< const GrCaps > caps)
void handleDirtyContext()
const skgpu::Swizzle & writeSwizzle() const
bool hasStencilClip() const
bool isScissorTestEnabled() const
bool usesConservativeRaster() const
const GrWindowRectsState & getWindowRectsState() const
const GrXferProcessor & getXferProcessor() const
GrSurfaceOrigin origin() const
const GrPipeline & pipeline() const
const GrUserStencilSettings * userStencilSettings() const
bool isStencilEnabled() const
bool requiresManualMSAAResolve() const
GrAttachment * getStencilAttachment(bool useMSAASurface) const
int numStencilBits(bool useMSAASurface) const
constexpr skgpu::Mipmapped mipmapped() const
constexpr WrapMode wrapModeX() const
constexpr Filter filter() const
constexpr bool isRepeatedX() const
constexpr MipmapMode mipmapMode() const
constexpr bool isRepeatedY() const
constexpr WrapMode wrapModeY() const
bool set(const SkIRect &rect)
const SkIRect & rect() const
void addModifier(const char *modifier)
void setTypeModifier(TypeModifier type)
void appendDecl(const GrShaderCaps *, SkString *out) const
void reset(const GrUserStencilSettings &, bool hasStencilClip, int numStencilBits)
const Face & postOriginCCWFace(GrSurfaceOrigin origin) const
const Face & singleSidedFace() const
const Face & postOriginCWFace(GrSurfaceOrigin origin) const
virtual GrBackendFormat backendFormat() const =0
SkISize dimensions() const
virtual GrTexture * asTexture()
GrTextureType textureType() const
const SkIRect * data() const
static constexpr int kMaxWindows
const GrWindowRectangles & windows() const
skgpu::BlendInfo getBlendInfo() const
void beginObject(const char *name=nullptr, bool multiline=true)
void appendName(const char *name)
void appendCString(const char *value)
V * insert(const K &key, V value)
static int ComputeLevelCount(int baseWidth, int baseHeight)
void append(const char text[])
const char * c_str() const
void void void appendf(const char format[],...) SK_PRINTF_LIKE(2
void reset(T *ptr=nullptr)
constexpr std::array< float, 4 > applyTo(std::array< float, 4 > color) const
static constexpr Swizzle RGBA()
void reset(size_t count=0)
void resize(size_t count)
const EmbeddedViewParams * params
FlutterSemanticsFlag flags
FlPixelBufferTexturePrivate * priv
const uint8_t uint32_t uint32_t GError ** error
uint32_t uint32_t * format
static float max(float r, float g, float b)
static float min(float r, float g, float b)
SK_API GrBackendRenderTarget MakeGL(int width, int height, int sampleCnt, int stencilBits, const GrGLFramebufferInfo &glInfo)
SK_API bool GetGLFramebufferInfo(const GrBackendRenderTarget &, GrGLFramebufferInfo *)
SK_API GrBackendTexture MakeGL(int width, int height, skgpu::Mipmapped, const GrGLTextureInfo &glInfo, std::string_view label={})
SK_API bool GetGLTextureInfo(const GrBackendTexture &, GrGLTextureInfo *)
Optional< SkRect > bounds
sk_sp< SkBlender > blender SkRect rect
static void Finish(Thread *thread)
std::function< ProfileSample(void)> Sampler
Sampler is run during SamplingProfiler::SampleRepeatedly. Each platform should implement its version ...
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
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
static bool LinkProgram(const ReactorGLES &reactor, const std::shared_ptr< PipelineGLES > &pipeline, const std::shared_ptr< const ShaderFunction > &vert_function, const std::shared_ptr< const ShaderFunction > &frag_function)
def timeout(deadline, cmd)
static constexpr bool BlendCoeffRefsConstant(const BlendCoeff coeff)
static constexpr bool BlendEquationIsAdvanced(BlendEquation equation)
static constexpr bool BlendShouldDisable(BlendEquation equation, BlendCoeff srcCoeff, BlendCoeff dstCoeff)
static const int kBlendEquationCnt
bool SkSLToGLSL(const SkSL::ShaderCaps *caps, const std::string &sksl, SkSL::ProgramKind programKind, const SkSL::ProgramSettings &settings, std::string *glsl, SkSL::ProgramInterface *outInterface, ShaderErrorHandler *errorHandler)
void Flush(SkSurface *surface)
static constexpr bool BlendCoeffRefsSrc2(const BlendCoeff coeff)
constexpr bool contains(std::string_view str, std::string_view needle)
GrGLExtensions fExtensions
int fTotalMemorySamplesPerPixel
GrGLuint fMultisampleFBOID
GrBackendObjectOwnership fRTFBOOwnership
GrGLuint fSingleSampleFBOID
GrGLuint fMSColorRenderbufferID
skgpu::Protected fIsProtected
GrBackendObjectOwnership fOwnership
const int * asInts() const
void setRelativeTo(GrSurfaceOrigin org, int rtHeight, const SkIRect &devRect)
static GrNativeRect MakeRelativeTo(GrSurfaceOrigin origin, int rtHeight, SkIRect devRect)
std::array< float, 4 > fClearColor
const char * noperspectiveInterpolationExtensionString() const
constexpr int32_t x() const
constexpr int32_t y() const
static bool Intersects(const SkIRect &a, const SkIRect &b)
int32_t fBottom
larger y-axis bounds
constexpr SkISize size() const
constexpr int32_t height() const
int32_t fTop
smaller y-axis bounds
static constexpr SkIRect MakeSize(const SkISize &size)
constexpr int32_t width() const
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
constexpr SkIPoint topLeft() const
static constexpr SkIRect MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
int32_t fLeft
smaller x-axis bounds
bool contains(int32_t x, int32_t y) const
int32_t fRight
larger x-axis bounds
constexpr int32_t width() const
constexpr int32_t height() const
bool fExternalTextureSupport
bool fNoPerspectiveInterpolationSupport
skgpu::BlendCoeff fDstBlend
SkPMColor4f fBlendConstant
skgpu::BlendCoeff fSrcBlend
std::shared_ptr< const fml::Mapping > data
#define TRACE_EVENT0(category_group, name)