Add more general flush call to GrContext.
This is to match the current features of SkSurface::flush and to prepare for adding additional features to flush. Bug: skia:8802 Change-Id: I5d68272e1277b416af357e6ffaf426841ceda943 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207301 Commit-Queue: Greg Daniel <egdaniel@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
6dd9d3da60
commit
b9990e4492
@ -713,12 +713,6 @@ public:
|
||||
kPresent, //!< back-end surface will be used for presenting to screen
|
||||
};
|
||||
|
||||
enum FlushFlags {
|
||||
kNone_FlushFlags = 0,
|
||||
// flush will wait till all submitted GPU work is finished before returning.
|
||||
kSyncCpu_FlushFlag = 0x1,
|
||||
};
|
||||
|
||||
/** Issues pending SkSurface commands to the GPU-backed API and resolves any SkSurface MSAA.
|
||||
After issuing all commands, signalSemaphores of count numSemaphores are signaled by the GPU.
|
||||
The work that is submitted to the GPU will be dependent on the BackendSurfaceAccess that is
|
||||
@ -758,35 +752,21 @@ public:
|
||||
@param signalSemaphores array of semaphore containers
|
||||
@return one of: GrSemaphoresSubmitted::kYes, GrSemaphoresSubmitted::kNo
|
||||
*/
|
||||
GrSemaphoresSubmitted flush(BackendSurfaceAccess access, GrFlushFlags flags,
|
||||
int numSemaphores, GrBackendSemaphore signalSemaphores[]);
|
||||
|
||||
/** The below enum and flush call are deprected
|
||||
*/
|
||||
|
||||
enum FlushFlags {
|
||||
kNone_FlushFlags = 0,
|
||||
// flush will wait till all submitted GPU work is finished before returning.
|
||||
kSyncCpu_FlushFlag = 0x1,
|
||||
};
|
||||
GrSemaphoresSubmitted flush(BackendSurfaceAccess access, FlushFlags flags,
|
||||
int numSemaphores, GrBackendSemaphore signalSemaphores[]);
|
||||
|
||||
/** Issues pending SkSurface commands to the GPU-backed API and resolves any SkSurface MSAA.
|
||||
After issuing all commands, signalSemaphores of count numSemaphores semaphores
|
||||
are signaled by the GPU.
|
||||
|
||||
For each GrBackendSemaphore in signalSemaphores:
|
||||
if GrBackendSemaphore is initialized, the GPU back-end uses the semaphore as is;
|
||||
otherwise, a new semaphore is created and initializes GrBackendSemaphore.
|
||||
|
||||
The caller must delete the semaphores created and returned in signalSemaphores.
|
||||
GrBackendSemaphore can be deleted as soon as this function returns.
|
||||
|
||||
If the back-end API is OpenGL only uninitialized backend semaphores are supported.
|
||||
|
||||
If the back-end API is Vulkan semaphores may be initialized or uninitialized.
|
||||
If uninitialized, created semaphores are valid only with the VkDevice
|
||||
with which they were created.
|
||||
|
||||
If GrSemaphoresSubmitted::kNo is returned, the GPU back-end did not create or
|
||||
add any semaphores to signal on the GPU; the caller should not instruct the GPU
|
||||
to wait on any of the semaphores.
|
||||
|
||||
Pending surface commands are flushed regardless of the return result.
|
||||
|
||||
@param numSemaphores size of signalSemaphores array
|
||||
@param signalSemaphores array of semaphore containers
|
||||
@return one of: GrSemaphoresSubmitted::kYes, GrSemaphoresSubmitted::kNo
|
||||
/** Deprecated.
|
||||
*/
|
||||
GrSemaphoresSubmitted flushAndSignalSemaphores(int numSemaphores,
|
||||
GrBackendSemaphore signalSemaphores[]);
|
||||
|
@ -268,8 +268,16 @@ public:
|
||||
* added any semaphores to signal on the GPU. Thus the client should not have the GPU wait on
|
||||
* any of the semaphores. However, any pending commands to the context will still be flushed.
|
||||
*/
|
||||
GrSemaphoresSubmitted flush(GrFlushFlags flags, int numSemaphores,
|
||||
GrBackendSemaphore signalSemaphores[]);
|
||||
|
||||
/**
|
||||
* Deprecated.
|
||||
*/
|
||||
GrSemaphoresSubmitted flushAndSignalSemaphores(int numSemaphores,
|
||||
GrBackendSemaphore signalSemaphores[]);
|
||||
GrBackendSemaphore signalSemaphores[]) {
|
||||
return this->flush(kNone_GrFlushFlags, numSemaphores, signalSemaphores);
|
||||
}
|
||||
|
||||
// Provides access to functions that aren't part of the public API.
|
||||
GrContextPriv priv();
|
||||
|
@ -259,6 +259,12 @@ enum GrGLBackendState {
|
||||
*/
|
||||
static const uint32_t kAll_GrBackendState = 0xffffffff;
|
||||
|
||||
enum GrFlushFlags {
|
||||
kNone_GrFlushFlags = 0,
|
||||
// flush will wait till all submitted GPU work is finished before returning.
|
||||
kSyncCpu_GrFlushFlag = 0x1,
|
||||
};
|
||||
|
||||
/**
|
||||
* Enum used as return value when flush with semaphores so the client knows whether the semaphores
|
||||
* were submitted to GPU or not.
|
||||
|
@ -244,19 +244,18 @@ void GrContext::flush() {
|
||||
RETURN_IF_ABANDONED
|
||||
|
||||
this->drawingManager()->flush(nullptr, SkSurface::BackendSurfaceAccess::kNoAccess,
|
||||
SkSurface::kNone_FlushFlags, 0, nullptr);
|
||||
kNone_GrFlushFlags, 0, nullptr);
|
||||
}
|
||||
|
||||
GrSemaphoresSubmitted GrContext::flushAndSignalSemaphores(int numSemaphores,
|
||||
GrBackendSemaphore signalSemaphores[]) {
|
||||
GrSemaphoresSubmitted GrContext::flush(GrFlushFlags flags, int numSemaphores,
|
||||
GrBackendSemaphore signalSemaphores[]) {
|
||||
ASSERT_SINGLE_OWNER
|
||||
if (this->abandoned()) {
|
||||
return GrSemaphoresSubmitted::kNo;
|
||||
}
|
||||
|
||||
return this->drawingManager()->flush(nullptr, SkSurface::BackendSurfaceAccess::kNoAccess,
|
||||
SkSurface::kNone_FlushFlags, numSemaphores,
|
||||
signalSemaphores);
|
||||
flags, numSemaphores, signalSemaphores);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -195,7 +195,7 @@ void GrContextPriv::flush(GrSurfaceProxy* proxy) {
|
||||
ASSERT_OWNED_PROXY_PRIV(proxy);
|
||||
|
||||
fContext->drawingManager()->flush(proxy, SkSurface::BackendSurfaceAccess::kNoAccess,
|
||||
SkSurface::kNone_FlushFlags, 0, nullptr);
|
||||
kNone_GrFlushFlags, 0, nullptr);
|
||||
}
|
||||
|
||||
void GrContextPriv::prepareSurfaceForExternalIO(GrSurfaceProxy* proxy) {
|
||||
@ -204,7 +204,7 @@ void GrContextPriv::prepareSurfaceForExternalIO(GrSurfaceProxy* proxy) {
|
||||
SkASSERT(proxy);
|
||||
ASSERT_OWNED_PROXY_PRIV(proxy);
|
||||
fContext->drawingManager()->prepareSurfaceForExternalIO(proxy,
|
||||
SkSurface::BackendSurfaceAccess::kNoAccess, SkSurface::kNone_FlushFlags, 0, nullptr);
|
||||
SkSurface::BackendSurfaceAccess::kNoAccess, kNone_GrFlushFlags, 0, nullptr);
|
||||
}
|
||||
|
||||
static bool valid_premul_color_type(GrColorType ct) {
|
||||
|
@ -208,7 +208,7 @@ void GrDrawingManager::freeGpuResources() {
|
||||
// MDB TODO: make use of the 'proxy' parameter.
|
||||
GrSemaphoresSubmitted GrDrawingManager::flush(GrSurfaceProxy* proxy,
|
||||
SkSurface::BackendSurfaceAccess access,
|
||||
SkSurface::FlushFlags flags,
|
||||
GrFlushFlags flags,
|
||||
int numSemaphores,
|
||||
GrBackendSemaphore backendSemaphores[]) {
|
||||
GR_CREATE_TRACE_MARKER_CONTEXT("GrDrawingManager", "flush", fContext);
|
||||
@ -219,7 +219,7 @@ GrSemaphoresSubmitted GrDrawingManager::flush(GrSurfaceProxy* proxy,
|
||||
|
||||
SkDEBUGCODE(this->validate());
|
||||
|
||||
if (SkSurface::kNone_FlushFlags == flags && !numSemaphores && proxy && !fDAG.isUsed(proxy)) {
|
||||
if (kNone_GrFlushFlags == flags && !numSemaphores && proxy && !fDAG.isUsed(proxy)) {
|
||||
return GrSemaphoresSubmitted::kNo;
|
||||
}
|
||||
|
||||
@ -442,7 +442,7 @@ bool GrDrawingManager::executeOpLists(int startIndex, int stopIndex, GrOpFlushSt
|
||||
(*numOpListsExecuted)++;
|
||||
if (*numOpListsExecuted >= kMaxOpListsBeforeFlush) {
|
||||
flushState->gpu()->finishFlush(nullptr, SkSurface::BackendSurfaceAccess::kNoAccess,
|
||||
SkSurface::kNone_FlushFlags, 0, nullptr);
|
||||
kNone_GrFlushFlags, 0, nullptr);
|
||||
*numOpListsExecuted = 0;
|
||||
}
|
||||
}
|
||||
@ -460,7 +460,7 @@ bool GrDrawingManager::executeOpLists(int startIndex, int stopIndex, GrOpFlushSt
|
||||
(*numOpListsExecuted)++;
|
||||
if (*numOpListsExecuted >= kMaxOpListsBeforeFlush) {
|
||||
flushState->gpu()->finishFlush(nullptr, SkSurface::BackendSurfaceAccess::kNoAccess,
|
||||
SkSurface::kNone_FlushFlags, 0, nullptr);
|
||||
kNone_GrFlushFlags, 0, nullptr);
|
||||
*numOpListsExecuted = 0;
|
||||
}
|
||||
}
|
||||
@ -479,7 +479,7 @@ bool GrDrawingManager::executeOpLists(int startIndex, int stopIndex, GrOpFlushSt
|
||||
}
|
||||
|
||||
GrSemaphoresSubmitted GrDrawingManager::prepareSurfaceForExternalIO(
|
||||
GrSurfaceProxy* proxy, SkSurface::BackendSurfaceAccess access, SkSurface::FlushFlags flags,
|
||||
GrSurfaceProxy* proxy, SkSurface::BackendSurfaceAccess access, GrFlushFlags flags,
|
||||
int numSemaphores, GrBackendSemaphore backendSemaphores[]) {
|
||||
if (this->wasAbandoned()) {
|
||||
return GrSemaphoresSubmitted::kNo;
|
||||
@ -759,7 +759,7 @@ void GrDrawingManager::flushIfNecessary() {
|
||||
auto resourceCache = direct->priv().getResourceCache();
|
||||
if (resourceCache && resourceCache->requestsFlush()) {
|
||||
this->flush(nullptr, SkSurface::BackendSurfaceAccess::kNoAccess,
|
||||
SkSurface::kNone_FlushFlags, 0, nullptr);
|
||||
kNone_GrFlushFlags, 0, nullptr);
|
||||
resourceCache->purgeAsNeeded();
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
|
||||
GrSemaphoresSubmitted prepareSurfaceForExternalIO(GrSurfaceProxy*,
|
||||
SkSurface::BackendSurfaceAccess access,
|
||||
SkSurface::FlushFlags flags,
|
||||
GrFlushFlags flags,
|
||||
int numSemaphores,
|
||||
GrBackendSemaphore backendSemaphores[]);
|
||||
|
||||
@ -153,7 +153,7 @@ private:
|
||||
|
||||
GrSemaphoresSubmitted flush(GrSurfaceProxy* proxy,
|
||||
SkSurface::BackendSurfaceAccess access,
|
||||
SkSurface::FlushFlags flags,
|
||||
GrFlushFlags flags,
|
||||
int numSemaphores,
|
||||
GrBackendSemaphore backendSemaphores[]);
|
||||
|
||||
|
@ -420,7 +420,7 @@ int GrGpu::findOrAssignSamplePatternKey(GrRenderTarget* renderTarget, const GrPi
|
||||
|
||||
GrSemaphoresSubmitted GrGpu::finishFlush(GrSurfaceProxy* proxy,
|
||||
SkSurface::BackendSurfaceAccess access,
|
||||
SkSurface::FlushFlags flags, int numSemaphores,
|
||||
GrFlushFlags flags, int numSemaphores,
|
||||
GrBackendSemaphore backendSemaphores[]) {
|
||||
this->stats()->incNumFinishFlushes();
|
||||
GrResourceProvider* resourceProvider = fContext->priv().resourceProvider();
|
||||
|
@ -303,7 +303,7 @@ public:
|
||||
// insert any numSemaphore semaphores on the gpu and set the backendSemaphores to match the
|
||||
// inserted semaphores.
|
||||
GrSemaphoresSubmitted finishFlush(GrSurfaceProxy*, SkSurface::BackendSurfaceAccess access,
|
||||
SkSurface::FlushFlags flags, int numSemaphores,
|
||||
GrFlushFlags flags, int numSemaphores,
|
||||
GrBackendSemaphore backendSemaphores[]);
|
||||
|
||||
virtual void submit(GrGpuCommandBuffer*) = 0;
|
||||
@ -547,7 +547,7 @@ private:
|
||||
bool canDiscardOutsideDstRect) = 0;
|
||||
|
||||
virtual void onFinishFlush(GrSurfaceProxy*, SkSurface::BackendSurfaceAccess access,
|
||||
SkSurface::FlushFlags flags, bool insertedSemaphores) = 0;
|
||||
GrFlushFlags flags, bool insertedSemaphores) = 0;
|
||||
|
||||
#ifdef SK_ENABLE_DUMP_GPU
|
||||
virtual void onDumpJSON(SkJSONWriter*) const {}
|
||||
|
@ -1735,7 +1735,7 @@ void GrRenderTargetContext::drawDrawable(std::unique_ptr<SkDrawable::GpuDrawHand
|
||||
}
|
||||
|
||||
GrSemaphoresSubmitted GrRenderTargetContext::prepareForExternalIO(
|
||||
SkSurface::BackendSurfaceAccess access, SkSurface::FlushFlags flags, int numSemaphores,
|
||||
SkSurface::BackendSurfaceAccess access, GrFlushFlags flags, int numSemaphores,
|
||||
GrBackendSemaphore backendSemaphores[]) {
|
||||
ASSERT_SINGLE_OWNER
|
||||
if (fContext->priv().abandoned()) {
|
||||
|
@ -407,7 +407,7 @@ public:
|
||||
* if the surface has MSAA it will be resolved.
|
||||
*/
|
||||
GrSemaphoresSubmitted prepareForExternalIO(SkSurface::BackendSurfaceAccess access,
|
||||
SkSurface::FlushFlags flags, int numSemaphores,
|
||||
GrFlushFlags flags, int numSemaphores,
|
||||
GrBackendSemaphore backendSemaphores[]);
|
||||
|
||||
/**
|
||||
|
@ -1628,11 +1628,11 @@ void SkGpuDevice::drawDrawable(SkDrawable* drawable, const SkMatrix* matrix, SkC
|
||||
|
||||
void SkGpuDevice::flush() {
|
||||
this->flushAndSignalSemaphores(SkSurface::BackendSurfaceAccess::kNoAccess,
|
||||
SkSurface::kNone_FlushFlags, 0, nullptr);
|
||||
kNone_GrFlushFlags, 0, nullptr);
|
||||
}
|
||||
|
||||
GrSemaphoresSubmitted SkGpuDevice::flushAndSignalSemaphores(SkSurface::BackendSurfaceAccess access,
|
||||
SkSurface::FlushFlags flags,
|
||||
GrFlushFlags flags,
|
||||
int numSemaphores,
|
||||
GrBackendSemaphore signalSemaphores[]) {
|
||||
ASSERT_SINGLE_OWNER
|
||||
|
@ -121,7 +121,7 @@ public:
|
||||
|
||||
void flush() override;
|
||||
GrSemaphoresSubmitted flushAndSignalSemaphores(SkSurface::BackendSurfaceAccess access,
|
||||
SkSurface::FlushFlags flags,
|
||||
GrFlushFlags flags,
|
||||
int numSemaphores,
|
||||
GrBackendSemaphore signalSemaphores[]);
|
||||
bool wait(int numSemaphores, const GrBackendSemaphore* waitSemaphores);
|
||||
|
@ -4307,12 +4307,12 @@ GrGLAttribArrayState* GrGLGpu::HWVertexArrayState::bindInternalVertexArray(GrGLG
|
||||
}
|
||||
|
||||
void GrGLGpu::onFinishFlush(GrSurfaceProxy*, SkSurface::BackendSurfaceAccess access,
|
||||
SkSurface::FlushFlags flags, bool insertedSemaphore) {
|
||||
GrFlushFlags flags, bool insertedSemaphore) {
|
||||
// If we inserted semaphores during the flush, we need to call GLFlush.
|
||||
if (insertedSemaphore) {
|
||||
GL_CALL(Flush());
|
||||
}
|
||||
if (flags & SkSurface::kSyncCpu_FlushFlag) {
|
||||
if (flags & kSyncCpu_GrFlushFlag) {
|
||||
GL_CALL(Finish());
|
||||
}
|
||||
}
|
||||
|
@ -294,7 +294,7 @@ private:
|
||||
void flushBlend(const GrXferProcessor::BlendInfo& blendInfo, const GrSwizzle&);
|
||||
|
||||
void onFinishFlush(GrSurfaceProxy*, SkSurface::BackendSurfaceAccess access,
|
||||
SkSurface::FlushFlags flags, bool insertedSemaphores) override;
|
||||
GrFlushFlags flags, bool insertedSemaphores) override;
|
||||
|
||||
bool copySurfaceAsDraw(GrSurface* dst, GrSurfaceOrigin dstOrigin,
|
||||
GrSurface* src, GrSurfaceOrigin srcOrigin,
|
||||
|
@ -111,7 +111,7 @@ private:
|
||||
void onResolveRenderTarget(GrRenderTarget* target) override { return; }
|
||||
|
||||
void onFinishFlush(GrSurfaceProxy*, SkSurface::BackendSurfaceAccess access,
|
||||
SkSurface::FlushFlags flags, bool insertedSemaphores) override {}
|
||||
GrFlushFlags flags, bool insertedSemaphores) override {}
|
||||
|
||||
GrStencilAttachment* createStencilAttachmentForRenderTarget(const GrRenderTarget*,
|
||||
int width,
|
||||
|
@ -182,8 +182,8 @@ private:
|
||||
void onResolveRenderTarget(GrRenderTarget* target) override { return; }
|
||||
|
||||
void onFinishFlush(GrSurfaceProxy*, SkSurface::BackendSurfaceAccess access,
|
||||
SkSurface::FlushFlags flags, bool insertedSemaphores) override {
|
||||
if (flags & SkSurface::kSyncCpu_FlushFlag) {
|
||||
GrFlushFlags flags, bool insertedSemaphores) override {
|
||||
if (flags & kSyncCpu_GrFlushFlag) {
|
||||
this->submitCommandBuffer(kForce_SyncQueue);
|
||||
} else {
|
||||
this->submitCommandBuffer(kSkip_SyncQueue);
|
||||
|
@ -1883,7 +1883,7 @@ void GrVkGpu::addImageMemoryBarrier(const GrVkResource* resource,
|
||||
}
|
||||
|
||||
void GrVkGpu::onFinishFlush(GrSurfaceProxy* proxy, SkSurface::BackendSurfaceAccess access,
|
||||
SkSurface::FlushFlags flags, bool insertedSemaphore) {
|
||||
GrFlushFlags flags, bool insertedSemaphore) {
|
||||
// Submit the current command buffer to the Queue. Whether we inserted semaphores or not does
|
||||
// not effect what we do here.
|
||||
if (proxy && access == SkSurface::BackendSurfaceAccess::kPresent) {
|
||||
@ -1898,7 +1898,7 @@ void GrVkGpu::onFinishFlush(GrSurfaceProxy* proxy, SkSurface::BackendSurfaceAcce
|
||||
}
|
||||
image->prepareForPresent(this);
|
||||
}
|
||||
if (flags & SkSurface::kSyncCpu_FlushFlag) {
|
||||
if (flags & kSyncCpu_GrFlushFlag) {
|
||||
this->submitCommandBuffer(kForce_SyncQueue);
|
||||
} else {
|
||||
this->submitCommandBuffer(kSkip_SyncQueue);
|
||||
|
@ -220,8 +220,8 @@ private:
|
||||
GrSurfaceOrigin srcOrigin, const SkIRect& srcRect,
|
||||
const SkIPoint& dstPoint, bool canDiscardOutsideDstRect) override;
|
||||
|
||||
void onFinishFlush(GrSurfaceProxy*, SkSurface::BackendSurfaceAccess access,
|
||||
SkSurface::FlushFlags flags, bool insertedSemaphores) override;
|
||||
void onFinishFlush(GrSurfaceProxy*, SkSurface::BackendSurfaceAccess access, GrFlushFlags flags,
|
||||
bool insertedSemaphores) override;
|
||||
|
||||
// Ends and submits the current command buffer to the queue and then creates a new command
|
||||
// buffer and begins it. If sync is set to kForce_SyncQueue, the function will wait for all
|
||||
|
@ -655,7 +655,7 @@ sk_sp<SkImage> SkImage::MakeFromAHardwareBufferWithData(GrContext* context,
|
||||
texContext->writePixels(srcInfo, pixmap.addr(0, 0), pixmap.rowBytes(), 0, 0);
|
||||
|
||||
drawingManager->flush(proxy.get(), SkSurface::BackendSurfaceAccess::kNoAccess,
|
||||
SkSurface::kSyncCpu_FlushFlag, 0, nullptr);
|
||||
kSyncCpu_GrFlushFlag, 0, nullptr);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
@ -244,17 +244,23 @@ void SkSurface::prepareForExternalIO() {
|
||||
}
|
||||
|
||||
void SkSurface::flush() {
|
||||
asSB(this)->onFlush(BackendSurfaceAccess::kNoAccess, kNone_FlushFlags, 0, nullptr);
|
||||
asSB(this)->onFlush(BackendSurfaceAccess::kNoAccess, kNone_GrFlushFlags, 0, nullptr);
|
||||
}
|
||||
|
||||
GrSemaphoresSubmitted SkSurface::flush(BackendSurfaceAccess access, FlushFlags flags,
|
||||
GrSemaphoresSubmitted SkSurface::flush(BackendSurfaceAccess access, GrFlushFlags flags,
|
||||
int numSemaphores, GrBackendSemaphore signalSemaphores[]) {
|
||||
return asSB(this)->onFlush(access, flags, numSemaphores, signalSemaphores);
|
||||
}
|
||||
|
||||
GrSemaphoresSubmitted SkSurface::flush(BackendSurfaceAccess access, FlushFlags flags,
|
||||
int numSemaphores, GrBackendSemaphore signalSemaphores[]) {
|
||||
GrFlushFlags grFlags = flags == kSyncCpu_FlushFlag ? kSyncCpu_GrFlushFlag : kNone_GrFlushFlags;
|
||||
return this->flush(access, grFlags, numSemaphores, signalSemaphores);
|
||||
}
|
||||
|
||||
GrSemaphoresSubmitted SkSurface::flushAndSignalSemaphores(int numSemaphores,
|
||||
GrBackendSemaphore signalSemaphores[]) {
|
||||
return asSB(this)->onFlush(BackendSurfaceAccess::kNoAccess, kNone_FlushFlags,
|
||||
return asSB(this)->onFlush(BackendSurfaceAccess::kNoAccess, kNone_GrFlushFlags,
|
||||
numSemaphores, signalSemaphores);
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ public:
|
||||
* Inserts the requested number of semaphores for the gpu to signal when work is complete on the
|
||||
* gpu and inits the array of GrBackendSemaphores with the signaled semaphores.
|
||||
*/
|
||||
virtual GrSemaphoresSubmitted onFlush(BackendSurfaceAccess access, FlushFlags flags,
|
||||
virtual GrSemaphoresSubmitted onFlush(BackendSurfaceAccess access, GrFlushFlags flags,
|
||||
int numSemaphores,
|
||||
GrBackendSemaphore signalSemaphores[]) {
|
||||
return GrSemaphoresSubmitted::kNo;
|
||||
|
@ -51,7 +51,7 @@ static GrRenderTarget* prepare_rt_for_external_access(SkSurface_Gpu* surface,
|
||||
|
||||
// Grab the render target *after* firing notifications, as it may get switched if CoW kicks in.
|
||||
surface->getDevice()->flushAndSignalSemaphores(SkSurface::BackendSurfaceAccess::kNoAccess,
|
||||
SkSurface::kNone_FlushFlags, 0, nullptr);
|
||||
kNone_GrFlushFlags, 0, nullptr);
|
||||
GrRenderTargetContext* rtc = surface->getDevice()->accessRenderTargetContext();
|
||||
return rtc->accessRenderTarget();
|
||||
}
|
||||
@ -158,7 +158,7 @@ void SkSurface_Gpu::onDiscard() {
|
||||
fDevice->accessRenderTargetContext()->discard();
|
||||
}
|
||||
|
||||
GrSemaphoresSubmitted SkSurface_Gpu::onFlush(BackendSurfaceAccess access, FlushFlags flags,
|
||||
GrSemaphoresSubmitted SkSurface_Gpu::onFlush(BackendSurfaceAccess access, GrFlushFlags flags,
|
||||
int numSemaphores,
|
||||
GrBackendSemaphore signalSemaphores[]) {
|
||||
return fDevice->flushAndSignalSemaphores(access, flags, numSemaphores, signalSemaphores);
|
||||
|
@ -32,7 +32,8 @@ public:
|
||||
void onWritePixels(const SkPixmap&, int x, int y) override;
|
||||
void onCopyOnWrite(ContentChangeMode) override;
|
||||
void onDiscard() override;
|
||||
GrSemaphoresSubmitted onFlush(BackendSurfaceAccess access, FlushFlags flags, int numSemaphores,
|
||||
GrSemaphoresSubmitted onFlush(BackendSurfaceAccess access, GrFlushFlags flags,
|
||||
int numSemaphores,
|
||||
GrBackendSemaphore signalSemaphores[]) override;
|
||||
bool onWait(int numSemaphores, const GrBackendSemaphore* waitSemaphores) override;
|
||||
bool onCharacterize(SkSurfaceCharacterization*) const override;
|
||||
|
@ -100,7 +100,7 @@ static void run_test(GrContext* ctx, skiatest::Reporter* reporter) {
|
||||
SkMatrix::I(), invPath, style);
|
||||
|
||||
rtc->prepareForExternalIO(SkSurface::BackendSurfaceAccess::kNoAccess,
|
||||
SkSurface::kNone_FlushFlags, 0, nullptr);
|
||||
kNone_GrFlushFlags, 0, nullptr);
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -314,7 +314,7 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages, int ma
|
||||
}
|
||||
// Flush everything, test passes if flush is successful(ie, no asserts are hit, no crashes)
|
||||
drawingManager->flush(nullptr, SkSurface::BackendSurfaceAccess::kNoAccess,
|
||||
SkSurface::kNone_FlushFlags, 0, nullptr);
|
||||
kNone_GrFlushFlags, 0, nullptr);
|
||||
|
||||
const GrBackendFormat format =
|
||||
context->priv().caps()->getBackendFormatFromColorType(kRGBA_8888_SkColorType);
|
||||
@ -344,7 +344,7 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages, int ma
|
||||
paint.addColorFragmentProcessor(std::move(blockFP));
|
||||
GrDrawRandomOp(&random, renderTargetContext.get(), std::move(paint));
|
||||
drawingManager->flush(nullptr, SkSurface::BackendSurfaceAccess::kNoAccess,
|
||||
SkSurface::kNone_FlushFlags, 0, nullptr);
|
||||
kNone_GrFlushFlags, 0, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -581,7 +581,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(OnFlushCallbackTest, reporter, ctxInfo) {
|
||||
}
|
||||
|
||||
rtc->prepareForExternalIO(SkSurface::BackendSurfaceAccess::kNoAccess,
|
||||
SkSurface::kNone_FlushFlags, 0, nullptr);
|
||||
kNone_GrFlushFlags, 0, nullptr);
|
||||
|
||||
SkBitmap readBack;
|
||||
readBack.allocN32Pixels(kFinalWidth, kFinalHeight);
|
||||
|
@ -144,7 +144,7 @@ void surface_semaphore_test(skiatest::Reporter* reporter,
|
||||
#endif
|
||||
|
||||
if (flushContext) {
|
||||
mainCtx->flushAndSignalSemaphores(2, semaphores.get());
|
||||
mainCtx->flush(kNone_GrFlushFlags, 2, semaphores.get());
|
||||
} else {
|
||||
mainSurface->flushAndSignalSemaphores(2, semaphores.get());
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ void basic_transfer_from_test(skiatest::Reporter* reporter, const sk_gpu_test::C
|
||||
|
||||
// TODO(bsalomon): caps to know if the map() is synchronous and skip the flush if so.
|
||||
gpu->finishFlush(nullptr, SkSurface::BackendSurfaceAccess::kNoAccess,
|
||||
SkSurface::kSyncCpu_FlushFlag, 0, nullptr);
|
||||
kSyncCpu_GrFlushFlag, 0, nullptr);
|
||||
|
||||
const auto* map = reinterpret_cast<const GrColor*>(buffer->map());
|
||||
REPORTER_ASSERT(reporter, map);
|
||||
@ -308,7 +308,7 @@ void basic_transfer_from_test(skiatest::Reporter* reporter, const sk_gpu_test::C
|
||||
|
||||
// TODO(bsalomon): caps to know if the map() is synchronous and skip the flush if so.
|
||||
gpu->finishFlush(nullptr, SkSurface::BackendSurfaceAccess::kNoAccess,
|
||||
SkSurface::kSyncCpu_FlushFlag, 0, nullptr);
|
||||
kSyncCpu_GrFlushFlag, 0, nullptr);
|
||||
|
||||
map = reinterpret_cast<const GrColor*>(buffer->map());
|
||||
REPORTER_ASSERT(reporter, map);
|
||||
|
@ -821,9 +821,9 @@ bool VulkanTestHelper::flushSurfaceAndSignalSemaphore(skiatest::Reporter* report
|
||||
if (!this->setupSemaphoreForSignaling(reporter, &semaphore)) {
|
||||
return false;
|
||||
}
|
||||
GrSemaphoresSubmitted submitted = fGrContext->flushAndSignalSemaphores(1, &semaphore);
|
||||
GrSemaphoresSubmitted submitted = fGrContext->flush(kNone_GrFlushFlags, 1, &semaphore);
|
||||
if (GrSemaphoresSubmitted::kNo == submitted) {
|
||||
ERRORF(reporter, "Failing call to flushAndSignalSemaphores on SkSurface");
|
||||
ERRORF(reporter, "Failing call to flush on GrContext");
|
||||
return false;
|
||||
}
|
||||
SkASSERT(semaphore.isInitialized());
|
||||
|
@ -514,7 +514,7 @@ void VulkanWindowContext::swapBuffers() {
|
||||
GrBackendSemaphore beSemaphore;
|
||||
beSemaphore.initVulkan(backbuffer->fRenderSemaphore);
|
||||
|
||||
surface->flush(SkSurface::BackendSurfaceAccess::kPresent, SkSurface::kNone_FlushFlags,
|
||||
surface->flush(SkSurface::BackendSurfaceAccess::kPresent, kNone_GrFlushFlags,
|
||||
1, &beSemaphore);
|
||||
|
||||
// Submit present operation to present queue
|
||||
|
Loading…
Reference in New Issue
Block a user