Add additional abanoned checks in read pixels.
The checks for PMUPM conversions can cause us to abanon the context when work is submitted to the GPU for its tests. So after calling that function we need to make sure we're still in a valid state. Bug: chromium:1205797 Change-Id: I652da7fc9bb230fcd141c890d312fce37fc42e22 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439817 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
parent
159005a196
commit
c26565755d
@ -128,6 +128,11 @@ bool SurfaceContext::readPixels(GrDirectContext* dContext, GrPixmap dst, SkIPoin
|
||||
defaultRGBAFormat.isValid() &&
|
||||
dContext->priv().validPMUPMConversionExists();
|
||||
|
||||
// Since the validPMUPMConversionExists function actually submits work to the gpu to do its
|
||||
// tests, it is possible that during that call we have abanoned the context. Thus we do
|
||||
// another abanoned check here to make sure we are still valid.
|
||||
RETURN_FALSE_IF_ABANDONED
|
||||
|
||||
auto readFlag = caps->surfaceSupportsReadPixels(srcSurface);
|
||||
if (readFlag == GrCaps::SurfaceReadPixelsSupport::kUnsupported) {
|
||||
return false;
|
||||
@ -379,6 +384,12 @@ bool SurfaceContext::internalWritePixels(GrDirectContext* dContext,
|
||||
dstColorType == GrColorType::kBGRA_8888) &&
|
||||
rgbaDefaultFormat.isValid() &&
|
||||
dContext->priv().validPMUPMConversionExists();
|
||||
|
||||
// Since the validPMUPMConversionExists function actually submits work to the gpu to do its
|
||||
// tests, it is possible that during that call we have abanoned the context. Thus we do an
|
||||
// abanoned check here to make sure we are still valid.
|
||||
RETURN_FALSE_IF_ABANDONED
|
||||
|
||||
// Drawing code path doesn't support writing to levels and doesn't support inserting layout
|
||||
// transitions.
|
||||
if ((!caps->surfaceSupportsWritePixels(dstSurface) || canvas2DFastPath) && numLevels == 1) {
|
||||
|
@ -1554,6 +1554,9 @@ GrCaps::SurfaceReadPixelsSupport GrVkCaps::surfaceSupportsReadPixels(
|
||||
}
|
||||
if (auto tex = static_cast<const GrVkTexture*>(surface->asTexture())) {
|
||||
auto texAttachment = tex->textureAttachment();
|
||||
if (!texAttachment) {
|
||||
return SurfaceReadPixelsSupport::kUnsupported;
|
||||
}
|
||||
// We can't directly read from a VkImage that has a ycbcr sampler.
|
||||
if (texAttachment->ycbcrConversionInfo().isValid()) {
|
||||
return SurfaceReadPixelsSupport::kCopyToTexture2D;
|
||||
@ -1588,8 +1591,12 @@ bool GrVkCaps::onSurfaceSupportsWritePixels(const GrSurface* surface) const {
|
||||
}
|
||||
// We can't write to a texture that has a ycbcr sampler.
|
||||
if (auto tex = static_cast<const GrVkTexture*>(surface->asTexture())) {
|
||||
auto texAttachment = tex->textureAttachment();
|
||||
if (!texAttachment) {
|
||||
return false;
|
||||
}
|
||||
// We can't directly read from a VkImage that has a ycbcr sampler.
|
||||
if (tex->textureAttachment()->ycbcrConversionInfo().isValid()) {
|
||||
if (texAttachment->ycbcrConversionInfo().isValid()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user