2017-06-16 13:45:32 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2017 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/gpu/vk/GrVkVulkan.h"
|
2017-06-16 13:45:32 +00:00
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "src/gpu/GrContextPriv.h"
|
|
|
|
#include "tests/Test.h"
|
|
|
|
#include "tools/gpu/GrContextFactory.h"
|
2017-06-16 13:45:32 +00:00
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/core/SkCanvas.h"
|
|
|
|
#include "include/core/SkSurface.h"
|
|
|
|
#include "include/gpu/GrBackendSemaphore.h"
|
|
|
|
#include "include/gpu/GrBackendSurface.h"
|
2017-06-16 13:45:32 +00:00
|
|
|
|
2019-11-08 21:18:15 +00:00
|
|
|
#ifdef SK_GL
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "src/gpu/gl/GrGLGpu.h"
|
|
|
|
#include "src/gpu/gl/GrGLUtil.h"
|
2019-11-08 21:18:15 +00:00
|
|
|
#endif
|
2017-07-20 19:47:30 +00:00
|
|
|
|
2017-06-16 13:45:32 +00:00
|
|
|
#ifdef SK_VULKAN
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/gpu/vk/GrVkTypes.h"
|
|
|
|
#include "src/gpu/vk/GrVkCommandPool.h"
|
|
|
|
#include "src/gpu/vk/GrVkGpu.h"
|
|
|
|
#include "src/gpu/vk/GrVkUtil.h"
|
2017-07-20 19:47:30 +00:00
|
|
|
|
|
|
|
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
|
|
|
// windows wants to define this as CreateSemaphoreA or CreateSemaphoreW
|
2017-07-20 20:36:01 +00:00
|
|
|
#undef CreateSemaphore
|
|
|
|
#endif
|
2017-06-16 13:45:32 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
static const int MAIN_W = 8, MAIN_H = 16;
|
|
|
|
static const int CHILD_W = 16, CHILD_H = 16;
|
|
|
|
|
|
|
|
void check_pixels(skiatest::Reporter* reporter, const SkBitmap& bitmap) {
|
|
|
|
const uint32_t* canvasPixels = static_cast<const uint32_t*>(bitmap.getPixels());
|
|
|
|
|
|
|
|
bool failureFound = false;
|
|
|
|
SkPMColor expectedPixel;
|
|
|
|
for (int cy = 0; cy < CHILD_H && !failureFound; ++cy) {
|
|
|
|
for (int cx = 0; cx < CHILD_W && !failureFound; ++cx) {
|
|
|
|
SkPMColor canvasPixel = canvasPixels[cy * CHILD_W + cx];
|
|
|
|
if (cy < CHILD_H / 2) {
|
|
|
|
if (cx < CHILD_W / 2) {
|
|
|
|
expectedPixel = 0xFF0000FF; // Red
|
|
|
|
} else {
|
|
|
|
expectedPixel = 0xFFFF0000; // Blue
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
expectedPixel = 0xFF00FF00; // Green
|
|
|
|
}
|
|
|
|
if (expectedPixel != canvasPixel) {
|
|
|
|
failureFound = true;
|
|
|
|
ERRORF(reporter, "Wrong color at %d, %d. Got 0x%08x when we expected 0x%08x",
|
|
|
|
cx, cy, canvasPixel, expectedPixel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void draw_child(skiatest::Reporter* reporter,
|
|
|
|
const sk_gpu_test::ContextInfo& childInfo,
|
2018-04-11 14:08:06 +00:00
|
|
|
const GrBackendTexture& backendTexture,
|
2017-06-16 13:45:32 +00:00
|
|
|
const GrBackendSemaphore& semaphore) {
|
|
|
|
|
|
|
|
childInfo.testContext()->makeCurrent();
|
|
|
|
|
|
|
|
const SkImageInfo childII = SkImageInfo::Make(CHILD_W, CHILD_H, kRGBA_8888_SkColorType,
|
|
|
|
kPremul_SkAlphaType);
|
|
|
|
|
|
|
|
GrContext* childCtx = childInfo.grContext();
|
|
|
|
sk_sp<SkSurface> childSurface(SkSurface::MakeRenderTarget(childCtx, SkBudgeted::kNo,
|
|
|
|
childII, 0, kTopLeft_GrSurfaceOrigin,
|
|
|
|
nullptr));
|
|
|
|
|
|
|
|
sk_sp<SkImage> childImage = SkImage::MakeFromTexture(childCtx,
|
|
|
|
backendTexture,
|
|
|
|
kTopLeft_GrSurfaceOrigin,
|
2017-12-18 19:48:15 +00:00
|
|
|
kRGBA_8888_SkColorType,
|
2017-06-16 13:45:32 +00:00
|
|
|
kPremul_SkAlphaType,
|
2017-12-18 19:48:15 +00:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2017-06-16 13:45:32 +00:00
|
|
|
nullptr);
|
|
|
|
|
|
|
|
SkCanvas* childCanvas = childSurface->getCanvas();
|
|
|
|
childCanvas->clear(SK_ColorRED);
|
|
|
|
|
|
|
|
childSurface->wait(1, &semaphore);
|
|
|
|
|
|
|
|
childCanvas->drawImage(childImage, CHILD_W/2, 0);
|
|
|
|
|
|
|
|
SkPaint paint;
|
|
|
|
paint.setColor(SK_ColorGREEN);
|
|
|
|
SkIRect rect = SkIRect::MakeLTRB(0, CHILD_H/2, CHILD_W, CHILD_H);
|
|
|
|
childCanvas->drawIRect(rect, paint);
|
|
|
|
|
|
|
|
// read pixels
|
|
|
|
SkBitmap bitmap;
|
|
|
|
bitmap.allocPixels(childII);
|
2017-07-21 18:24:29 +00:00
|
|
|
childSurface->readPixels(bitmap, 0, 0);
|
2017-06-16 13:45:32 +00:00
|
|
|
|
|
|
|
check_pixels(reporter, bitmap);
|
|
|
|
}
|
|
|
|
|
2019-05-09 14:30:12 +00:00
|
|
|
enum class FlushType { kSurface, kImage, kContext };
|
|
|
|
|
2017-06-16 13:45:32 +00:00
|
|
|
void surface_semaphore_test(skiatest::Reporter* reporter,
|
|
|
|
const sk_gpu_test::ContextInfo& mainInfo,
|
|
|
|
const sk_gpu_test::ContextInfo& childInfo1,
|
Revert "Revert "Revert "Revert "Add support for semaphores to be inserted on GrContext flush""""
This reverts commit cc8eb60c486eaf397685c60b28998682025fee1a.
Reason for revert: Chrome change landed that should fix chrome roll
Original change's description:
> Revert "Revert "Revert "Add support for semaphores to be inserted on GrContext flush"""
>
> This reverts commit 876aed8758b7109574999ffac43b1ea47f359bd7.
>
> Reason for revert: the bots seem to be unhappily red with this CL
>
> Original change's description:
> > Revert "Revert "Add support for semaphores to be inserted on GrContext flush""
> >
> > This reverts commit 8724b4609996eb6369b454611e31b065f3d8d2cf.
> >
> > Reason for revert: Creating a test CL to see what happens on the bots
> >
> > Original change's description:
> > > Revert "Add support for semaphores to be inserted on GrContext flush"
> > >
> > > This reverts commit cd1416efbc7af6f115dbaa09dce48e075d1d96ca.
> > >
> > > Reason for revert: speculative, to try to fix roll see gpu_tests.pixel_integration_test.PixelIntegrationTest.Pixel_GpuRasterization_ConcavePaths
> > >
> > > Original change's description:
> > > > Add support for semaphores to be inserted on GrContext flush
> > > >
> > > > This also moves the logic of inserting semaphores down into GrDrawingManager
> > > > and finishFlush on GrGpu. With it being on finishFlush, there should be no
> > > > issues when the DrawingManager starts respecting the proxy passed in assuming
> > > > it always calls finishFlush at the end (which it should).
> > > >
> > > > Bug: skia:
> > > > Change-Id: I925c2a289dcbbb9159b9120878af1d34f21a2dc7
> > > > Reviewed-on: https://skia-review.googlesource.com/25641
> > > > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > > > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > >
> > > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
> > >
> > > Change-Id: I9c5b9cf8c060193e1861dbb8f0c10fb11dfb5249
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Bug: skia:
> > > Reviewed-on: https://skia-review.googlesource.com/25980
> > > Reviewed-by: Mike Reed <reed@google.com>
> > > Commit-Queue: Mike Reed <reed@google.com>
> >
> > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,reed@google.com
> >
> > # Not skipping CQ checks because original CL landed > 1 day ago.
> >
> > Bug: skia:
> > Change-Id: I5edbeaa0769670ee58f362f0ccaa78319410aa6c
> > Reviewed-on: https://skia-review.googlesource.com/26160
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
>
> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,reed@google.com
>
> Change-Id: I22fd6febafe70489a5fdb695c6f4263368eb423d
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:
> Reviewed-on: https://skia-review.googlesource.com/29422
> Reviewed-by: Yuqian Li <liyuqian@google.com>
> Commit-Queue: Yuqian Li <liyuqian@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,liyuqian@google.com,reed@google.com
Change-Id: Ie3eae818b02599a70f714ef6b6635ce7d171bde6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/30000
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2017-08-02 15:10:09 +00:00
|
|
|
const sk_gpu_test::ContextInfo& childInfo2,
|
2019-05-09 14:30:12 +00:00
|
|
|
FlushType flushType) {
|
2017-06-16 13:45:32 +00:00
|
|
|
GrContext* mainCtx = mainInfo.grContext();
|
2019-05-08 13:04:47 +00:00
|
|
|
if (!mainCtx->priv().caps()->semaphoreSupport()) {
|
2017-06-16 13:45:32 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const SkImageInfo ii = SkImageInfo::Make(MAIN_W, MAIN_H, kRGBA_8888_SkColorType,
|
|
|
|
kPremul_SkAlphaType);
|
|
|
|
|
|
|
|
sk_sp<SkSurface> mainSurface(SkSurface::MakeRenderTarget(mainCtx, SkBudgeted::kNo,
|
|
|
|
ii, 0, kTopLeft_GrSurfaceOrigin,
|
|
|
|
nullptr));
|
|
|
|
SkCanvas* mainCanvas = mainSurface->getCanvas();
|
2019-05-09 14:30:12 +00:00
|
|
|
auto blueSurface = mainSurface->makeSurface(ii);
|
|
|
|
blueSurface->getCanvas()->clear(SK_ColorBLUE);
|
|
|
|
auto blueImage = blueSurface->makeImageSnapshot();
|
|
|
|
blueSurface.reset();
|
|
|
|
mainCanvas->drawImage(blueImage, 0, 0);
|
2017-06-16 13:45:32 +00:00
|
|
|
|
|
|
|
SkAutoTArray<GrBackendSemaphore> semaphores(2);
|
2017-07-20 20:36:01 +00:00
|
|
|
#ifdef SK_VULKAN
|
2018-10-12 13:31:11 +00:00
|
|
|
if (GrBackendApi::kVulkan == mainInfo.backend()) {
|
2017-07-20 20:36:01 +00:00
|
|
|
// Initialize the secondary semaphore instead of having Ganesh create one internally
|
2019-02-04 18:26:26 +00:00
|
|
|
GrVkGpu* gpu = static_cast<GrVkGpu*>(mainCtx->priv().getGpu());
|
2017-07-20 20:36:01 +00:00
|
|
|
VkDevice device = gpu->device();
|
|
|
|
|
|
|
|
VkSemaphore vkSem;
|
|
|
|
|
|
|
|
VkSemaphoreCreateInfo createInfo;
|
|
|
|
createInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
|
|
|
|
createInfo.pNext = nullptr;
|
|
|
|
createInfo.flags = 0;
|
2019-11-05 17:36:42 +00:00
|
|
|
GR_VK_CALL_ERRCHECK(gpu, CreateSemaphore(device, &createInfo, nullptr, &vkSem));
|
2017-07-20 20:36:01 +00:00
|
|
|
|
|
|
|
semaphores[1].initVulkan(vkSem);
|
|
|
|
}
|
|
|
|
#endif
|
2017-06-16 13:45:32 +00:00
|
|
|
|
2019-04-17 19:26:11 +00:00
|
|
|
GrFlushInfo info;
|
|
|
|
info.fNumSemaphores = 2;
|
|
|
|
info.fSignalSemaphores = semaphores.get();
|
2019-05-09 14:30:12 +00:00
|
|
|
switch (flushType) {
|
|
|
|
case FlushType::kSurface:
|
|
|
|
mainSurface->flush(SkSurface::BackendSurfaceAccess::kNoAccess, info);
|
|
|
|
break;
|
|
|
|
case FlushType::kImage:
|
|
|
|
blueImage->flush(mainCtx, info);
|
|
|
|
break;
|
|
|
|
case FlushType::kContext:
|
|
|
|
mainCtx->flush(info);
|
|
|
|
break;
|
Revert "Revert "Revert "Revert "Add support for semaphores to be inserted on GrContext flush""""
This reverts commit cc8eb60c486eaf397685c60b28998682025fee1a.
Reason for revert: Chrome change landed that should fix chrome roll
Original change's description:
> Revert "Revert "Revert "Add support for semaphores to be inserted on GrContext flush"""
>
> This reverts commit 876aed8758b7109574999ffac43b1ea47f359bd7.
>
> Reason for revert: the bots seem to be unhappily red with this CL
>
> Original change's description:
> > Revert "Revert "Add support for semaphores to be inserted on GrContext flush""
> >
> > This reverts commit 8724b4609996eb6369b454611e31b065f3d8d2cf.
> >
> > Reason for revert: Creating a test CL to see what happens on the bots
> >
> > Original change's description:
> > > Revert "Add support for semaphores to be inserted on GrContext flush"
> > >
> > > This reverts commit cd1416efbc7af6f115dbaa09dce48e075d1d96ca.
> > >
> > > Reason for revert: speculative, to try to fix roll see gpu_tests.pixel_integration_test.PixelIntegrationTest.Pixel_GpuRasterization_ConcavePaths
> > >
> > > Original change's description:
> > > > Add support for semaphores to be inserted on GrContext flush
> > > >
> > > > This also moves the logic of inserting semaphores down into GrDrawingManager
> > > > and finishFlush on GrGpu. With it being on finishFlush, there should be no
> > > > issues when the DrawingManager starts respecting the proxy passed in assuming
> > > > it always calls finishFlush at the end (which it should).
> > > >
> > > > Bug: skia:
> > > > Change-Id: I925c2a289dcbbb9159b9120878af1d34f21a2dc7
> > > > Reviewed-on: https://skia-review.googlesource.com/25641
> > > > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > > > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > >
> > > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
> > >
> > > Change-Id: I9c5b9cf8c060193e1861dbb8f0c10fb11dfb5249
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Bug: skia:
> > > Reviewed-on: https://skia-review.googlesource.com/25980
> > > Reviewed-by: Mike Reed <reed@google.com>
> > > Commit-Queue: Mike Reed <reed@google.com>
> >
> > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,reed@google.com
> >
> > # Not skipping CQ checks because original CL landed > 1 day ago.
> >
> > Bug: skia:
> > Change-Id: I5edbeaa0769670ee58f362f0ccaa78319410aa6c
> > Reviewed-on: https://skia-review.googlesource.com/26160
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
>
> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,reed@google.com
>
> Change-Id: I22fd6febafe70489a5fdb695c6f4263368eb423d
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:
> Reviewed-on: https://skia-review.googlesource.com/29422
> Reviewed-by: Yuqian Li <liyuqian@google.com>
> Commit-Queue: Yuqian Li <liyuqian@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,liyuqian@google.com,reed@google.com
Change-Id: Ie3eae818b02599a70f714ef6b6635ce7d171bde6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/30000
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2017-08-02 15:10:09 +00:00
|
|
|
}
|
2017-06-16 13:45:32 +00:00
|
|
|
|
|
|
|
sk_sp<SkImage> mainImage = mainSurface->makeImageSnapshot();
|
2018-04-11 14:08:06 +00:00
|
|
|
GrBackendTexture backendTexture = mainImage->getBackendTexture(false);
|
2017-06-16 13:45:32 +00:00
|
|
|
|
2018-04-11 14:08:06 +00:00
|
|
|
draw_child(reporter, childInfo1, backendTexture, semaphores[0]);
|
2017-06-16 13:45:32 +00:00
|
|
|
|
|
|
|
#ifdef SK_VULKAN
|
2018-10-12 13:31:11 +00:00
|
|
|
if (GrBackendApi::kVulkan == mainInfo.backend()) {
|
2017-06-16 13:45:32 +00:00
|
|
|
// In Vulkan we need to make sure we are sending the correct VkImageLayout in with the
|
|
|
|
// backendImage. After the first child draw the layout gets changed to SHADER_READ, so
|
|
|
|
// we just manually set that here.
|
2018-04-11 14:08:06 +00:00
|
|
|
GrVkImageInfo vkInfo;
|
|
|
|
SkAssertResult(backendTexture.getVkImageInfo(&vkInfo));
|
|
|
|
vkInfo.updateImageLayout(VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
|
2017-06-16 13:45:32 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-04-11 14:08:06 +00:00
|
|
|
draw_child(reporter, childInfo2, backendTexture, semaphores[1]);
|
2017-06-16 13:45:32 +00:00
|
|
|
}
|
|
|
|
|
2019-11-08 21:18:15 +00:00
|
|
|
#ifdef SK_GL
|
2017-11-15 20:48:03 +00:00
|
|
|
DEF_GPUTEST(SurfaceSemaphores, reporter, options) {
|
2017-06-16 13:45:32 +00:00
|
|
|
#if defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_WIN) || defined(SK_BUILD_FOR_MAC)
|
|
|
|
static constexpr auto kNativeGLType = sk_gpu_test::GrContextFactory::kGL_ContextType;
|
|
|
|
#else
|
|
|
|
static constexpr auto kNativeGLType = sk_gpu_test::GrContextFactory::kGLES_ContextType;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
for (int typeInt = 0; typeInt < sk_gpu_test::GrContextFactory::kContextTypeCnt; ++typeInt) {
|
2019-05-09 14:30:12 +00:00
|
|
|
for (auto flushType : {FlushType::kSurface, FlushType::kImage, FlushType::kContext}) {
|
Revert "Revert "Revert "Revert "Add support for semaphores to be inserted on GrContext flush""""
This reverts commit cc8eb60c486eaf397685c60b28998682025fee1a.
Reason for revert: Chrome change landed that should fix chrome roll
Original change's description:
> Revert "Revert "Revert "Add support for semaphores to be inserted on GrContext flush"""
>
> This reverts commit 876aed8758b7109574999ffac43b1ea47f359bd7.
>
> Reason for revert: the bots seem to be unhappily red with this CL
>
> Original change's description:
> > Revert "Revert "Add support for semaphores to be inserted on GrContext flush""
> >
> > This reverts commit 8724b4609996eb6369b454611e31b065f3d8d2cf.
> >
> > Reason for revert: Creating a test CL to see what happens on the bots
> >
> > Original change's description:
> > > Revert "Add support for semaphores to be inserted on GrContext flush"
> > >
> > > This reverts commit cd1416efbc7af6f115dbaa09dce48e075d1d96ca.
> > >
> > > Reason for revert: speculative, to try to fix roll see gpu_tests.pixel_integration_test.PixelIntegrationTest.Pixel_GpuRasterization_ConcavePaths
> > >
> > > Original change's description:
> > > > Add support for semaphores to be inserted on GrContext flush
> > > >
> > > > This also moves the logic of inserting semaphores down into GrDrawingManager
> > > > and finishFlush on GrGpu. With it being on finishFlush, there should be no
> > > > issues when the DrawingManager starts respecting the proxy passed in assuming
> > > > it always calls finishFlush at the end (which it should).
> > > >
> > > > Bug: skia:
> > > > Change-Id: I925c2a289dcbbb9159b9120878af1d34f21a2dc7
> > > > Reviewed-on: https://skia-review.googlesource.com/25641
> > > > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > > > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > >
> > > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
> > >
> > > Change-Id: I9c5b9cf8c060193e1861dbb8f0c10fb11dfb5249
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Bug: skia:
> > > Reviewed-on: https://skia-review.googlesource.com/25980
> > > Reviewed-by: Mike Reed <reed@google.com>
> > > Commit-Queue: Mike Reed <reed@google.com>
> >
> > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,reed@google.com
> >
> > # Not skipping CQ checks because original CL landed > 1 day ago.
> >
> > Bug: skia:
> > Change-Id: I5edbeaa0769670ee58f362f0ccaa78319410aa6c
> > Reviewed-on: https://skia-review.googlesource.com/26160
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
>
> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,reed@google.com
>
> Change-Id: I22fd6febafe70489a5fdb695c6f4263368eb423d
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:
> Reviewed-on: https://skia-review.googlesource.com/29422
> Reviewed-by: Yuqian Li <liyuqian@google.com>
> Commit-Queue: Yuqian Li <liyuqian@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,liyuqian@google.com,reed@google.com
Change-Id: Ie3eae818b02599a70f714ef6b6635ce7d171bde6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/30000
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2017-08-02 15:10:09 +00:00
|
|
|
sk_gpu_test::GrContextFactory::ContextType contextType =
|
|
|
|
(sk_gpu_test::GrContextFactory::ContextType) typeInt;
|
|
|
|
// Use "native" instead of explicitly trying OpenGL and OpenGL ES. Do not use GLES on
|
|
|
|
// desktop since tests do not account for not fixing http://skbug.com/2809
|
|
|
|
if (contextType == sk_gpu_test::GrContextFactory::kGL_ContextType ||
|
|
|
|
contextType == sk_gpu_test::GrContextFactory::kGLES_ContextType) {
|
|
|
|
if (contextType != kNativeGLType) {
|
|
|
|
continue;
|
|
|
|
}
|
2017-06-16 13:45:32 +00:00
|
|
|
}
|
2017-11-15 20:48:03 +00:00
|
|
|
sk_gpu_test::GrContextFactory factory(options);
|
2019-06-26 02:07:56 +00:00
|
|
|
sk_gpu_test::ContextInfo ctxInfo = factory.getContextInfo(contextType);
|
Revert "Revert "Revert "Revert "Add support for semaphores to be inserted on GrContext flush""""
This reverts commit cc8eb60c486eaf397685c60b28998682025fee1a.
Reason for revert: Chrome change landed that should fix chrome roll
Original change's description:
> Revert "Revert "Revert "Add support for semaphores to be inserted on GrContext flush"""
>
> This reverts commit 876aed8758b7109574999ffac43b1ea47f359bd7.
>
> Reason for revert: the bots seem to be unhappily red with this CL
>
> Original change's description:
> > Revert "Revert "Add support for semaphores to be inserted on GrContext flush""
> >
> > This reverts commit 8724b4609996eb6369b454611e31b065f3d8d2cf.
> >
> > Reason for revert: Creating a test CL to see what happens on the bots
> >
> > Original change's description:
> > > Revert "Add support for semaphores to be inserted on GrContext flush"
> > >
> > > This reverts commit cd1416efbc7af6f115dbaa09dce48e075d1d96ca.
> > >
> > > Reason for revert: speculative, to try to fix roll see gpu_tests.pixel_integration_test.PixelIntegrationTest.Pixel_GpuRasterization_ConcavePaths
> > >
> > > Original change's description:
> > > > Add support for semaphores to be inserted on GrContext flush
> > > >
> > > > This also moves the logic of inserting semaphores down into GrDrawingManager
> > > > and finishFlush on GrGpu. With it being on finishFlush, there should be no
> > > > issues when the DrawingManager starts respecting the proxy passed in assuming
> > > > it always calls finishFlush at the end (which it should).
> > > >
> > > > Bug: skia:
> > > > Change-Id: I925c2a289dcbbb9159b9120878af1d34f21a2dc7
> > > > Reviewed-on: https://skia-review.googlesource.com/25641
> > > > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > > > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > >
> > > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
> > >
> > > Change-Id: I9c5b9cf8c060193e1861dbb8f0c10fb11dfb5249
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Bug: skia:
> > > Reviewed-on: https://skia-review.googlesource.com/25980
> > > Reviewed-by: Mike Reed <reed@google.com>
> > > Commit-Queue: Mike Reed <reed@google.com>
> >
> > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,reed@google.com
> >
> > # Not skipping CQ checks because original CL landed > 1 day ago.
> >
> > Bug: skia:
> > Change-Id: I5edbeaa0769670ee58f362f0ccaa78319410aa6c
> > Reviewed-on: https://skia-review.googlesource.com/26160
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
>
> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,reed@google.com
>
> Change-Id: I22fd6febafe70489a5fdb695c6f4263368eb423d
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:
> Reviewed-on: https://skia-review.googlesource.com/29422
> Reviewed-by: Yuqian Li <liyuqian@google.com>
> Commit-Queue: Yuqian Li <liyuqian@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,liyuqian@google.com,reed@google.com
Change-Id: Ie3eae818b02599a70f714ef6b6635ce7d171bde6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/30000
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2017-08-02 15:10:09 +00:00
|
|
|
if (!sk_gpu_test::GrContextFactory::IsRenderingContext(contextType)) {
|
2017-06-16 13:45:32 +00:00
|
|
|
continue;
|
|
|
|
}
|
Revert "Revert "Revert "Revert "Add support for semaphores to be inserted on GrContext flush""""
This reverts commit cc8eb60c486eaf397685c60b28998682025fee1a.
Reason for revert: Chrome change landed that should fix chrome roll
Original change's description:
> Revert "Revert "Revert "Add support for semaphores to be inserted on GrContext flush"""
>
> This reverts commit 876aed8758b7109574999ffac43b1ea47f359bd7.
>
> Reason for revert: the bots seem to be unhappily red with this CL
>
> Original change's description:
> > Revert "Revert "Add support for semaphores to be inserted on GrContext flush""
> >
> > This reverts commit 8724b4609996eb6369b454611e31b065f3d8d2cf.
> >
> > Reason for revert: Creating a test CL to see what happens on the bots
> >
> > Original change's description:
> > > Revert "Add support for semaphores to be inserted on GrContext flush"
> > >
> > > This reverts commit cd1416efbc7af6f115dbaa09dce48e075d1d96ca.
> > >
> > > Reason for revert: speculative, to try to fix roll see gpu_tests.pixel_integration_test.PixelIntegrationTest.Pixel_GpuRasterization_ConcavePaths
> > >
> > > Original change's description:
> > > > Add support for semaphores to be inserted on GrContext flush
> > > >
> > > > This also moves the logic of inserting semaphores down into GrDrawingManager
> > > > and finishFlush on GrGpu. With it being on finishFlush, there should be no
> > > > issues when the DrawingManager starts respecting the proxy passed in assuming
> > > > it always calls finishFlush at the end (which it should).
> > > >
> > > > Bug: skia:
> > > > Change-Id: I925c2a289dcbbb9159b9120878af1d34f21a2dc7
> > > > Reviewed-on: https://skia-review.googlesource.com/25641
> > > > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > > > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > >
> > > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
> > >
> > > Change-Id: I9c5b9cf8c060193e1861dbb8f0c10fb11dfb5249
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Bug: skia:
> > > Reviewed-on: https://skia-review.googlesource.com/25980
> > > Reviewed-by: Mike Reed <reed@google.com>
> > > Commit-Queue: Mike Reed <reed@google.com>
> >
> > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,reed@google.com
> >
> > # Not skipping CQ checks because original CL landed > 1 day ago.
> >
> > Bug: skia:
> > Change-Id: I5edbeaa0769670ee58f362f0ccaa78319410aa6c
> > Reviewed-on: https://skia-review.googlesource.com/26160
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
>
> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,reed@google.com
>
> Change-Id: I22fd6febafe70489a5fdb695c6f4263368eb423d
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:
> Reviewed-on: https://skia-review.googlesource.com/29422
> Reviewed-by: Yuqian Li <liyuqian@google.com>
> Commit-Queue: Yuqian Li <liyuqian@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,liyuqian@google.com,reed@google.com
Change-Id: Ie3eae818b02599a70f714ef6b6635ce7d171bde6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/30000
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2017-08-02 15:10:09 +00:00
|
|
|
skiatest::ReporterContext ctx(
|
|
|
|
reporter, SkString(sk_gpu_test::GrContextFactory::ContextTypeName(contextType)));
|
|
|
|
if (ctxInfo.grContext()) {
|
2017-11-15 20:48:03 +00:00
|
|
|
sk_gpu_test::ContextInfo child1 =
|
|
|
|
factory.getSharedContextInfo(ctxInfo.grContext(), 0);
|
|
|
|
sk_gpu_test::ContextInfo child2 =
|
|
|
|
factory.getSharedContextInfo(ctxInfo.grContext(), 1);
|
Revert "Revert "Revert "Revert "Add support for semaphores to be inserted on GrContext flush""""
This reverts commit cc8eb60c486eaf397685c60b28998682025fee1a.
Reason for revert: Chrome change landed that should fix chrome roll
Original change's description:
> Revert "Revert "Revert "Add support for semaphores to be inserted on GrContext flush"""
>
> This reverts commit 876aed8758b7109574999ffac43b1ea47f359bd7.
>
> Reason for revert: the bots seem to be unhappily red with this CL
>
> Original change's description:
> > Revert "Revert "Add support for semaphores to be inserted on GrContext flush""
> >
> > This reverts commit 8724b4609996eb6369b454611e31b065f3d8d2cf.
> >
> > Reason for revert: Creating a test CL to see what happens on the bots
> >
> > Original change's description:
> > > Revert "Add support for semaphores to be inserted on GrContext flush"
> > >
> > > This reverts commit cd1416efbc7af6f115dbaa09dce48e075d1d96ca.
> > >
> > > Reason for revert: speculative, to try to fix roll see gpu_tests.pixel_integration_test.PixelIntegrationTest.Pixel_GpuRasterization_ConcavePaths
> > >
> > > Original change's description:
> > > > Add support for semaphores to be inserted on GrContext flush
> > > >
> > > > This also moves the logic of inserting semaphores down into GrDrawingManager
> > > > and finishFlush on GrGpu. With it being on finishFlush, there should be no
> > > > issues when the DrawingManager starts respecting the proxy passed in assuming
> > > > it always calls finishFlush at the end (which it should).
> > > >
> > > > Bug: skia:
> > > > Change-Id: I925c2a289dcbbb9159b9120878af1d34f21a2dc7
> > > > Reviewed-on: https://skia-review.googlesource.com/25641
> > > > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > > > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > >
> > > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
> > >
> > > Change-Id: I9c5b9cf8c060193e1861dbb8f0c10fb11dfb5249
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Bug: skia:
> > > Reviewed-on: https://skia-review.googlesource.com/25980
> > > Reviewed-by: Mike Reed <reed@google.com>
> > > Commit-Queue: Mike Reed <reed@google.com>
> >
> > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,reed@google.com
> >
> > # Not skipping CQ checks because original CL landed > 1 day ago.
> >
> > Bug: skia:
> > Change-Id: I5edbeaa0769670ee58f362f0ccaa78319410aa6c
> > Reviewed-on: https://skia-review.googlesource.com/26160
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
>
> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,reed@google.com
>
> Change-Id: I22fd6febafe70489a5fdb695c6f4263368eb423d
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:
> Reviewed-on: https://skia-review.googlesource.com/29422
> Reviewed-by: Yuqian Li <liyuqian@google.com>
> Commit-Queue: Yuqian Li <liyuqian@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,liyuqian@google.com,reed@google.com
Change-Id: Ie3eae818b02599a70f714ef6b6635ce7d171bde6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/30000
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2017-08-02 15:10:09 +00:00
|
|
|
if (!child1.grContext() || !child2.grContext()) {
|
|
|
|
continue;
|
|
|
|
}
|
2017-06-16 13:45:32 +00:00
|
|
|
|
2019-05-09 14:30:12 +00:00
|
|
|
surface_semaphore_test(reporter, ctxInfo, child1, child2, flushType);
|
Revert "Revert "Revert "Revert "Add support for semaphores to be inserted on GrContext flush""""
This reverts commit cc8eb60c486eaf397685c60b28998682025fee1a.
Reason for revert: Chrome change landed that should fix chrome roll
Original change's description:
> Revert "Revert "Revert "Add support for semaphores to be inserted on GrContext flush"""
>
> This reverts commit 876aed8758b7109574999ffac43b1ea47f359bd7.
>
> Reason for revert: the bots seem to be unhappily red with this CL
>
> Original change's description:
> > Revert "Revert "Add support for semaphores to be inserted on GrContext flush""
> >
> > This reverts commit 8724b4609996eb6369b454611e31b065f3d8d2cf.
> >
> > Reason for revert: Creating a test CL to see what happens on the bots
> >
> > Original change's description:
> > > Revert "Add support for semaphores to be inserted on GrContext flush"
> > >
> > > This reverts commit cd1416efbc7af6f115dbaa09dce48e075d1d96ca.
> > >
> > > Reason for revert: speculative, to try to fix roll see gpu_tests.pixel_integration_test.PixelIntegrationTest.Pixel_GpuRasterization_ConcavePaths
> > >
> > > Original change's description:
> > > > Add support for semaphores to be inserted on GrContext flush
> > > >
> > > > This also moves the logic of inserting semaphores down into GrDrawingManager
> > > > and finishFlush on GrGpu. With it being on finishFlush, there should be no
> > > > issues when the DrawingManager starts respecting the proxy passed in assuming
> > > > it always calls finishFlush at the end (which it should).
> > > >
> > > > Bug: skia:
> > > > Change-Id: I925c2a289dcbbb9159b9120878af1d34f21a2dc7
> > > > Reviewed-on: https://skia-review.googlesource.com/25641
> > > > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > > > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > >
> > > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
> > >
> > > Change-Id: I9c5b9cf8c060193e1861dbb8f0c10fb11dfb5249
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Bug: skia:
> > > Reviewed-on: https://skia-review.googlesource.com/25980
> > > Reviewed-by: Mike Reed <reed@google.com>
> > > Commit-Queue: Mike Reed <reed@google.com>
> >
> > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,reed@google.com
> >
> > # Not skipping CQ checks because original CL landed > 1 day ago.
> >
> > Bug: skia:
> > Change-Id: I5edbeaa0769670ee58f362f0ccaa78319410aa6c
> > Reviewed-on: https://skia-review.googlesource.com/26160
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
>
> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,reed@google.com
>
> Change-Id: I22fd6febafe70489a5fdb695c6f4263368eb423d
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:
> Reviewed-on: https://skia-review.googlesource.com/29422
> Reviewed-by: Yuqian Li <liyuqian@google.com>
> Commit-Queue: Yuqian Li <liyuqian@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,liyuqian@google.com,reed@google.com
Change-Id: Ie3eae818b02599a70f714ef6b6635ce7d171bde6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/30000
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2017-08-02 15:10:09 +00:00
|
|
|
}
|
2017-06-16 13:45:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-11-08 21:18:15 +00:00
|
|
|
#endif
|
2017-06-16 13:45:32 +00:00
|
|
|
|
2017-07-20 19:47:30 +00:00
|
|
|
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(EmptySurfaceSemaphoreTest, reporter, ctxInfo) {
|
|
|
|
GrContext* ctx = ctxInfo.grContext();
|
2019-05-08 13:04:47 +00:00
|
|
|
if (!ctx->priv().caps()->semaphoreSupport()) {
|
2017-07-20 19:47:30 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const SkImageInfo ii = SkImageInfo::Make(MAIN_W, MAIN_H, kRGBA_8888_SkColorType,
|
|
|
|
kPremul_SkAlphaType);
|
|
|
|
|
|
|
|
sk_sp<SkSurface> mainSurface(SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo,
|
|
|
|
ii, 0, kTopLeft_GrSurfaceOrigin,
|
|
|
|
nullptr));
|
|
|
|
|
|
|
|
// Flush surface once without semaphores to make sure there is no peneding IO for it.
|
|
|
|
mainSurface->flush();
|
|
|
|
|
|
|
|
GrBackendSemaphore semaphore;
|
Revert "Revert "Revert "Revert "Add support for semaphores to be inserted on GrContext flush""""
This reverts commit cc8eb60c486eaf397685c60b28998682025fee1a.
Reason for revert: Chrome change landed that should fix chrome roll
Original change's description:
> Revert "Revert "Revert "Add support for semaphores to be inserted on GrContext flush"""
>
> This reverts commit 876aed8758b7109574999ffac43b1ea47f359bd7.
>
> Reason for revert: the bots seem to be unhappily red with this CL
>
> Original change's description:
> > Revert "Revert "Add support for semaphores to be inserted on GrContext flush""
> >
> > This reverts commit 8724b4609996eb6369b454611e31b065f3d8d2cf.
> >
> > Reason for revert: Creating a test CL to see what happens on the bots
> >
> > Original change's description:
> > > Revert "Add support for semaphores to be inserted on GrContext flush"
> > >
> > > This reverts commit cd1416efbc7af6f115dbaa09dce48e075d1d96ca.
> > >
> > > Reason for revert: speculative, to try to fix roll see gpu_tests.pixel_integration_test.PixelIntegrationTest.Pixel_GpuRasterization_ConcavePaths
> > >
> > > Original change's description:
> > > > Add support for semaphores to be inserted on GrContext flush
> > > >
> > > > This also moves the logic of inserting semaphores down into GrDrawingManager
> > > > and finishFlush on GrGpu. With it being on finishFlush, there should be no
> > > > issues when the DrawingManager starts respecting the proxy passed in assuming
> > > > it always calls finishFlush at the end (which it should).
> > > >
> > > > Bug: skia:
> > > > Change-Id: I925c2a289dcbbb9159b9120878af1d34f21a2dc7
> > > > Reviewed-on: https://skia-review.googlesource.com/25641
> > > > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > > > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > >
> > > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
> > >
> > > Change-Id: I9c5b9cf8c060193e1861dbb8f0c10fb11dfb5249
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Bug: skia:
> > > Reviewed-on: https://skia-review.googlesource.com/25980
> > > Reviewed-by: Mike Reed <reed@google.com>
> > > Commit-Queue: Mike Reed <reed@google.com>
> >
> > TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,reed@google.com
> >
> > # Not skipping CQ checks because original CL landed > 1 day ago.
> >
> > Bug: skia:
> > Change-Id: I5edbeaa0769670ee58f362f0ccaa78319410aa6c
> > Reviewed-on: https://skia-review.googlesource.com/26160
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
>
> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,reed@google.com
>
> Change-Id: I22fd6febafe70489a5fdb695c6f4263368eb423d
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:
> Reviewed-on: https://skia-review.googlesource.com/29422
> Reviewed-by: Yuqian Li <liyuqian@google.com>
> Commit-Queue: Yuqian Li <liyuqian@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,liyuqian@google.com,reed@google.com
Change-Id: Ie3eae818b02599a70f714ef6b6635ce7d171bde6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/30000
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2017-08-02 15:10:09 +00:00
|
|
|
GrSemaphoresSubmitted submitted = mainSurface->flushAndSignalSemaphores(1, &semaphore);
|
|
|
|
REPORTER_ASSERT(reporter, GrSemaphoresSubmitted::kYes == submitted);
|
2017-07-20 19:47:30 +00:00
|
|
|
|
2019-11-08 21:18:15 +00:00
|
|
|
#ifdef SK_GL
|
2018-10-12 13:31:11 +00:00
|
|
|
if (GrBackendApi::kOpenGL == ctxInfo.backend()) {
|
2019-02-04 18:26:26 +00:00
|
|
|
GrGLGpu* gpu = static_cast<GrGLGpu*>(ctx->priv().getGpu());
|
2017-07-20 19:47:30 +00:00
|
|
|
const GrGLInterface* interface = gpu->glInterface();
|
|
|
|
GrGLsync sync = semaphore.glSync();
|
|
|
|
REPORTER_ASSERT(reporter, sync);
|
|
|
|
bool result;
|
|
|
|
GR_GL_CALL_RET(interface, result, IsSync(sync));
|
|
|
|
REPORTER_ASSERT(reporter, result);
|
|
|
|
}
|
2019-11-08 21:18:15 +00:00
|
|
|
#endif
|
2017-07-20 19:47:30 +00:00
|
|
|
|
|
|
|
#ifdef SK_VULKAN
|
2018-10-12 13:31:11 +00:00
|
|
|
if (GrBackendApi::kVulkan == ctxInfo.backend()) {
|
2019-02-04 18:26:26 +00:00
|
|
|
GrVkGpu* gpu = static_cast<GrVkGpu*>(ctx->priv().getGpu());
|
2017-07-20 19:47:30 +00:00
|
|
|
const GrVkInterface* interface = gpu->vkInterface();
|
|
|
|
VkDevice device = gpu->device();
|
|
|
|
VkQueue queue = gpu->queue();
|
2018-12-12 21:22:40 +00:00
|
|
|
GrVkCommandPool* cmdPool = gpu->cmdPool();
|
2017-07-20 19:47:30 +00:00
|
|
|
VkCommandBuffer cmdBuffer;
|
|
|
|
|
|
|
|
// Create Command Buffer
|
|
|
|
const VkCommandBufferAllocateInfo cmdInfo = {
|
|
|
|
VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, // sType
|
|
|
|
nullptr, // pNext
|
2018-12-12 21:22:40 +00:00
|
|
|
cmdPool->vkCommandPool(), // commandPool
|
2017-07-20 19:47:30 +00:00
|
|
|
VK_COMMAND_BUFFER_LEVEL_PRIMARY, // level
|
|
|
|
1 // bufferCount
|
|
|
|
};
|
|
|
|
|
|
|
|
VkResult err = GR_VK_CALL(interface, AllocateCommandBuffers(device, &cmdInfo, &cmdBuffer));
|
|
|
|
if (err) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
VkCommandBufferBeginInfo cmdBufferBeginInfo;
|
|
|
|
memset(&cmdBufferBeginInfo, 0, sizeof(VkCommandBufferBeginInfo));
|
|
|
|
cmdBufferBeginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
|
|
|
|
cmdBufferBeginInfo.pNext = nullptr;
|
|
|
|
cmdBufferBeginInfo.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
|
|
|
|
cmdBufferBeginInfo.pInheritanceInfo = nullptr;
|
|
|
|
|
2019-11-05 17:36:42 +00:00
|
|
|
GR_VK_CALL_ERRCHECK(gpu, BeginCommandBuffer(cmdBuffer, &cmdBufferBeginInfo));
|
|
|
|
GR_VK_CALL_ERRCHECK(gpu, EndCommandBuffer(cmdBuffer));
|
2017-07-20 19:47:30 +00:00
|
|
|
|
|
|
|
VkFenceCreateInfo fenceInfo;
|
|
|
|
VkFence fence;
|
|
|
|
|
|
|
|
memset(&fenceInfo, 0, sizeof(VkFenceCreateInfo));
|
|
|
|
fenceInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
|
|
|
|
err = GR_VK_CALL(interface, CreateFence(device, &fenceInfo, nullptr, &fence));
|
|
|
|
SkASSERT(!err);
|
|
|
|
|
|
|
|
VkPipelineStageFlags waitStages = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT;
|
|
|
|
VkSubmitInfo submitInfo;
|
|
|
|
memset(&submitInfo, 0, sizeof(VkSubmitInfo));
|
|
|
|
submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
|
|
|
|
submitInfo.pNext = nullptr;
|
|
|
|
submitInfo.waitSemaphoreCount = 1;
|
|
|
|
VkSemaphore vkSem = semaphore.vkSemaphore();
|
|
|
|
submitInfo.pWaitSemaphores = &vkSem;
|
|
|
|
submitInfo.pWaitDstStageMask = &waitStages;
|
|
|
|
submitInfo.commandBufferCount = 1;
|
|
|
|
submitInfo.pCommandBuffers = &cmdBuffer;
|
|
|
|
submitInfo.signalSemaphoreCount = 0;
|
|
|
|
submitInfo.pSignalSemaphores = nullptr;
|
2019-11-05 17:36:42 +00:00
|
|
|
GR_VK_CALL_ERRCHECK(gpu, QueueSubmit(queue, 1, &submitInfo, fence));
|
2017-07-20 19:47:30 +00:00
|
|
|
|
|
|
|
err = GR_VK_CALL(interface, WaitForFences(device, 1, &fence, true, 3000000000));
|
|
|
|
|
|
|
|
REPORTER_ASSERT(reporter, err != VK_TIMEOUT);
|
|
|
|
|
|
|
|
GR_VK_CALL(interface, DestroyFence(device, fence, nullptr));
|
|
|
|
GR_VK_CALL(interface, DestroySemaphore(device, vkSem, nullptr));
|
|
|
|
// If the above test fails the wait semaphore will never be signaled which can cause the
|
|
|
|
// device to hang when tearing down (even if just tearing down GL). So we Fail here to
|
|
|
|
// kill things.
|
|
|
|
if (err == VK_TIMEOUT) {
|
2017-08-16 14:53:04 +00:00
|
|
|
SK_ABORT("Waiting on semaphore indefinitely");
|
2017-07-20 19:47:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|