Skip to content

Commit a47d60a

Browse files
James Godfrey-KittleSkCQ
James Godfrey-Kittle
authored and
SkCQ
committed
Early-out instead of asserting in make_vk_backend_texture
Bug: b/276858394 Change-Id: I9cdad86b6a2f016e3833d1af79bce98d1bb119ad Reviewed-on: https://skia-review.googlesource.com/c/skia/+/679156 Commit-Queue: James Godfrey-Kittle <[email protected]> Reviewed-by: Leon Scroggins <[email protected]>
1 parent c702ab9 commit a47d60a

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/gpu/ganesh/GrAHardwareBufferUtils.cpp

+13-2
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,12 @@ static GrBackendTexture make_vk_backend_texture(
347347
}
348348

349349
VkFormat format;
350-
SkAssertResult(backendFormat.asVkFormat(&format));
350+
if (!backendFormat.asVkFormat(&format)) {
351+
SkDebugf("asVkFormat failed (valid: %d, backend: %d)",
352+
backendFormat.isValid(),
353+
backendFormat.backend());
354+
return GrBackendTexture();
355+
}
351356

352357
VkResult err;
353358

@@ -364,6 +369,13 @@ static GrBackendTexture make_vk_backend_texture(
364369
return GrBackendTexture();
365370
}
366371

372+
if (hwbFormatProps.format != format) {
373+
SkDebugf("Queried format not consistent with expected format; got: %d, expected: %d",
374+
hwbFormatProps.format,
375+
format);
376+
return GrBackendTexture();
377+
}
378+
367379
VkExternalFormatANDROID externalFormat;
368380
externalFormat.sType = VK_STRUCTURE_TYPE_EXTERNAL_FORMAT_ANDROID;
369381
externalFormat.pNext = nullptr;
@@ -389,7 +401,6 @@ static GrBackendTexture make_vk_backend_texture(
389401
SkASSERT(hwbFormatProps.externalFormat == ycbcrConversion->fExternalFormat);
390402
externalFormat.externalFormat = hwbFormatProps.externalFormat;
391403
}
392-
SkASSERT(format == hwbFormatProps.format);
393404

394405
const VkExternalMemoryImageCreateInfo externalMemoryImageInfo{
395406
VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO, // sType

0 commit comments

Comments
 (0)