Flutter Engine
The Flutter Engine
|
#include <GrVkSecondaryCBDrawContext.h>
Public Member Functions | |
~GrVkSecondaryCBDrawContext () override | |
SkCanvas * | getCanvas () |
void | flush () |
bool | wait (int numSemaphores, const GrBackendSemaphore waitSemaphores[], bool deleteSemaphoresAfterWait=true) |
void | releaseResources () |
const SkSurfaceProps & | props () const |
bool | characterize (GrSurfaceCharacterization *characterization) const |
bool | draw (sk_sp< const GrDeferredDisplayList > deferredDisplayList) |
bool | isCompatible (const GrSurfaceCharacterization &characterization) const |
Public Member Functions inherited from SkRefCntBase | |
SkRefCntBase () | |
virtual | ~SkRefCntBase () |
bool | unique () const |
void | ref () const |
void | unref () const |
Static Public Member Functions | |
static sk_sp< GrVkSecondaryCBDrawContext > | Make (GrRecordingContext *, const SkImageInfo &, const GrVkDrawableInfo &, const SkSurfaceProps *props) |
This class is a private header that is intended to only be used inside of Chromium. This requires Chromium to burrow in and include this specifically since it is not part of skia's public include directory. This class is used to draw into an external Vulkan secondary command buffer that is imported by the client. The secondary command buffer that gets imported must already have had begin called on it with VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT. Thus any draws to the imported command buffer cannot require changing the render pass. This requirement means that certain types of draws will not be supported when using a GrVkSecondaryCBDrawContext. This includes: Draws that require a dst copy for blending will be dropped Text draws will be dropped (these may require intermediate uploads of text data) Read and Write pixels will not work Any other draw that requires a copy will fail (this includes using backdrop filter with save layer). Stenciling is also disabled, but that should not restrict any actual draws from working.
While using a GrVkSecondaryCBDrawContext, the client can also draw into normal SkSurfaces and then draw those SkSufaces (as SkImages) into the GrVkSecondaryCBDrawContext. If any of the previously mentioned unsupported draws are needed by the client, they can draw them into an offscreen surface, and then draw that into the GrVkSecondaryCBDrawContext.
After all drawing to the GrVkSecondaryCBDrawContext has been done, the client must call flush() on the GrVkSecondaryCBDrawContext to actually fill in the secondary VkCommandBuffer with the draws.
Additionally, the client must keep the GrVkSecondaryCBDrawContext alive until the secondary VkCommandBuffer has been submitted and all work finished on the GPU. Before deleting the GrVkSecondaryCBDrawContext, the client must call releaseResources() so that Skia can cleanup any internal objects that were created for the draws into the secondary command buffer.
Definition at line 62 of file GrVkSecondaryCBDrawContext.h.
|
override |
Definition at line 97 of file GrVkSecondaryCBDrawContext.cpp.
bool GrVkSecondaryCBDrawContext::characterize | ( | GrSurfaceCharacterization * | characterization | ) | const |
Definition at line 129 of file GrVkSecondaryCBDrawContext.cpp.
bool GrVkSecondaryCBDrawContext::draw | ( | sk_sp< const GrDeferredDisplayList > | deferredDisplayList | ) |
Definition at line 222 of file GrVkSecondaryCBDrawContext.cpp.
void GrVkSecondaryCBDrawContext::flush | ( | ) |
Definition at line 109 of file GrVkSecondaryCBDrawContext.cpp.
SkCanvas * GrVkSecondaryCBDrawContext::getCanvas | ( | ) |
Definition at line 102 of file GrVkSecondaryCBDrawContext.cpp.
bool GrVkSecondaryCBDrawContext::isCompatible | ( | const GrSurfaceCharacterization & | characterization | ) | const |
Definition at line 167 of file GrVkSecondaryCBDrawContext.cpp.
|
static |
Definition at line 27 of file GrVkSecondaryCBDrawContext.cpp.
|
inline |
Definition at line 108 of file GrVkSecondaryCBDrawContext.h.
void GrVkSecondaryCBDrawContext::releaseResources | ( | ) |
Definition at line 124 of file GrVkSecondaryCBDrawContext.cpp.
bool GrVkSecondaryCBDrawContext::wait | ( | int | numSemaphores, |
const GrBackendSemaphore | waitSemaphores[], | ||
bool | deleteSemaphoresAfterWait = true |
||
) |
Inserts a list of GPU semaphores that Skia will have the driver wait on before executing commands for this secondary CB. The wait semaphores will get added to the VkCommandBuffer owned by this GrContext when flush() is called, and not the command buffer which the Secondary CB is from. This will guarantee that the driver waits on the semaphores before the secondary command buffer gets executed. We will submit the semphore to wait at VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT and VK_PIPELINE_STAGE_TRANSFER_BIT. If this call returns false, then the GPU back end will not wait on any passed in semaphores, and the client will still own the semaphores, regardless of the value of deleteSemaphoresAfterWait.
If deleteSemaphoresAfterWait is false then Skia will not delete the semaphores. In this case it is the client's responsibility to not destroy or attempt to reuse the semaphores until it knows that Skia has finished waiting on them. This can be done by using finishedProcs on flush calls.
numSemaphores | size of waitSemaphores array |
waitSemaphores | array of semaphore containers @paramm deleteSemaphoresAfterWait who owns and should delete the semaphores |
Definition at line 118 of file GrVkSecondaryCBDrawContext.cpp.