Bail if context creation fails in FuzzDDLThreadingGL

Bug: oss-fuzz:31634
Change-Id: I9717d04d391c584f28d415fa728c7296edb91723
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379038
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
This commit is contained in:
Adlai Holler 2021-03-03 16:24:51 -07:00 committed by Skia Commit-Bot
parent e4ef35caa1
commit 4db5726495

View File

@ -112,11 +112,16 @@ DDLFuzzer::DDLFuzzer(Fuzz* fuzz, ContextType contextType) : fFuzz(fuzz) {
sk_gpu_test::ContextInfo ctxInfo = fContextFactory.getContextInfo(contextType);
sk_gpu_test::TestContext* testCtx = ctxInfo.testContext();
fContext = ctxInfo.directContext();
if (!fContext) {
return;
}
SkISize canvasSize = kPromiseImageSize;
canvasSize.fWidth *= kPromiseImagesPerDDL;
SkImageInfo ii = SkImageInfo::Make(canvasSize, kRGBA_8888_SkColorType, kPremul_SkAlphaType);
fSurface = SkSurface::MakeRenderTarget(fContext, SkBudgeted::kNo, ii);
SkAssertResult(fSurface->characterize(&fSurfaceCharacterization));
if (!fSurface || !fSurface->characterize(&fSurfaceCharacterization)) {
return;
}
testCtx->makeNotCurrent();
fGpuTaskGroup.add([&]{
@ -249,6 +254,9 @@ void DDLFuzzer::recordAndPlayDDL() {
}
void DDLFuzzer::run() {
if (!fSurface) {
return;
}
fRecordingTaskGroup.batch(kIterationCount, [=](int i) {
this->recordAndPlayDDL();
});