Add struct to wrap all the gpu flush options.
Bug: skia:8802
Change-Id: Ia92807034a8f54067cead59e29c233f91e11f175
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208674
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/tests/GrFinishedFlushTest.cpp b/tests/GrFinishedFlushTest.cpp
index 6b825b1..2584113 100644
--- a/tests/GrFinishedFlushTest.cpp
+++ b/tests/GrFinishedFlushTest.cpp
@@ -30,20 +30,23 @@
// We flush the surface first just to get rid of any discards/clears that got recorded from
// making the surface.
surface->flush();
- ctx->flush(kSyncCpu_GrFlushFlag, 0, nullptr);
+ GrFlushInfo flushInfoSyncCpu;
+ flushInfoSyncCpu.fFlags = kSyncCpu_GrFlushFlag;
+ ctx->flush(flushInfoSyncCpu);
int count = 0;
+ GrFlushInfo flushInfoFinishedProc;
+ flushInfoFinishedProc.fFinishedProc = testing_finished_proc;
+ flushInfoFinishedProc.fFinishedContext = (void*)&count;
// There is no work on the surface so flushing should immediately call the finished proc.
- surface->flush(SkSurface::BackendSurfaceAccess::kNoAccess, kNone_GrFlushFlags, 0, nullptr,
- testing_finished_proc, (void*)&count);
+ surface->flush(SkSurface::BackendSurfaceAccess::kNoAccess, flushInfoFinishedProc);
REPORTER_ASSERT(reporter, count == 1);
canvas->clear(SK_ColorRED);
- surface->flush(SkSurface::BackendSurfaceAccess::kNoAccess, kNone_GrFlushFlags, 0, nullptr,
- testing_finished_proc, (void*)&count);
+ surface->flush(SkSurface::BackendSurfaceAccess::kNoAccess, flushInfoFinishedProc);
bool isVulkan = ctx->backend() == GrBackendApi::kVulkan;
if (isVulkan) {
@@ -53,12 +56,12 @@
} else {
REPORTER_ASSERT(reporter, count == 2);
}
- ctx->flush(kSyncCpu_GrFlushFlag, 0, nullptr);
+ ctx->flush(flushInfoSyncCpu);
REPORTER_ASSERT(reporter, count == 2);
// Test flushing via the GrContext
canvas->clear(SK_ColorBLUE);
- ctx->flush(kNone_GrFlushFlags, 0, nullptr, testing_finished_proc, (void*)&count);
+ ctx->flush(flushInfoFinishedProc);
if (isVulkan) {
// On Vulkan the command buffer we just submitted may or may not have finished immediately
// so the finish proc may not have been called.
@@ -66,25 +69,25 @@
} else {
REPORTER_ASSERT(reporter, count == 3);
}
- ctx->flush(kSyncCpu_GrFlushFlag, 0, nullptr);
+ ctx->flush(flushInfoSyncCpu);
REPORTER_ASSERT(reporter, count == 3);
// There is no work on the surface so flushing should immediately call the finished proc.
- ctx->flush(kNone_GrFlushFlags, 0, nullptr, testing_finished_proc, (void*)&count);
+ ctx->flush(flushInfoFinishedProc);
REPORTER_ASSERT(reporter, count == 4);
count = 0;
int count2 = 0;
canvas->clear(SK_ColorGREEN);
- surface->flush(SkSurface::BackendSurfaceAccess::kNoAccess, kNone_GrFlushFlags, 0, nullptr,
- testing_finished_proc, (void*)&count);
+ surface->flush(SkSurface::BackendSurfaceAccess::kNoAccess, flushInfoFinishedProc);
// There is no work to be flushed here so this will return immediately, but make sure the
// finished call from this proc isn't called till the previous surface flush also is finished.
- ctx->flush(kNone_GrFlushFlags, 0, nullptr, testing_finished_proc, (void*)&count2);
+ flushInfoFinishedProc.fFinishedContext = (void*)&count2;
+ ctx->flush(flushInfoFinishedProc);
REPORTER_ASSERT(reporter, count == count2);
- ctx->flush(kSyncCpu_GrFlushFlag, 0, nullptr);
+ ctx->flush(flushInfoSyncCpu);
REPORTER_ASSERT(reporter, count == 1);
REPORTER_ASSERT(reporter, count == count2);