Allow client to pass in VK_IMAGE_LAYOUT_UNDEFINED into mutable state change requests.
Passing in VK_IMAGE_LAYOUT_UNDEFINED will tell Skia to not update the layout when doing the state change. Bug: skia:10742 Change-Id: Ic59b7c95d3a73e29dcd6eec16a2fd138e1a1d95f Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318204 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
parent
e77162ea89
commit
9a48697bd7
@ -976,6 +976,10 @@ public:
|
||||
object to be prepped for that use. A finishedProc or semaphore on the GrFlushInfo will also
|
||||
include the work for any requested state change.
|
||||
|
||||
If the backend API is Vulkan, the caller can set the GrBackendSurfaceMutableState's
|
||||
VkImageLayout to VK_IMAGE_LAYOUT_UNDEFINED or queueFamilyIndex to VK_QUEUE_FAMILY_IGNORED to
|
||||
tell Skia to not change those respective states.
|
||||
|
||||
If the return is GrSemaphoresSubmitted::kYes, only initialized GrBackendSemaphores will be
|
||||
submitted to the gpu during the next submit call (it is possible Skia failed to create a
|
||||
subset of the semaphores). The client should not wait on these semaphores until after submit
|
||||
|
@ -687,6 +687,10 @@ public:
|
||||
* called (e.g updateBackendTexture and flush). If finishedProc is not null then it will be
|
||||
* called with finishedContext after the state transition is known to have occurred on the GPU.
|
||||
*
|
||||
* If the backend API is Vulkan, the caller can set the GrBackendSurfaceMutableState's
|
||||
* VkImageLayout to VK_IMAGE_LAYOUT_UNDEFINED or queueFamilyIndex to VK_QUEUE_FAMILY_IGNORED to
|
||||
* tell Skia to not change those respective states.
|
||||
*
|
||||
* See GrBackendSurfaceMutableState to see what state can be set via this call.
|
||||
*/
|
||||
bool setBackendTextureState(const GrBackendTexture&,
|
||||
|
@ -1791,6 +1791,9 @@ void set_layout_and_queue_from_mutable_state(GrVkGpu* gpu, GrVkImage* image,
|
||||
// can also be used for general dst flags since we don't know exactly what the client
|
||||
// plans on using the image for.
|
||||
VkImageLayout newLayout = newInfo.getImageLayout();
|
||||
if (newLayout == VK_IMAGE_LAYOUT_UNDEFINED) {
|
||||
newLayout = image->currentLayout();
|
||||
}
|
||||
VkPipelineStageFlags dstStage = GrVkImage::LayoutToPipelineSrcStageFlags(newLayout);
|
||||
VkAccessFlags dstAccess = GrVkImage::LayoutToSrcAccessMask(newLayout);
|
||||
|
||||
|
@ -113,6 +113,13 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkBackendSurfaceMutableStateTest, reporter, ctxIn
|
||||
REPORTER_ASSERT(reporter, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL == info.fImageLayout);
|
||||
REPORTER_ASSERT(reporter, gpu->queueIndex() == info.fCurrentQueueFamily);
|
||||
|
||||
// Make sure passing in VK_IMAGE_LAYOUT_UNDEFINED does not change the layout
|
||||
GrBackendSurfaceMutableState noopState(VK_IMAGE_LAYOUT_UNDEFINED, VK_QUEUE_FAMILY_IGNORED);
|
||||
dContext->setBackendTextureState(backendTex, noopState);
|
||||
REPORTER_ASSERT(reporter, backendTex.getVkImageInfo(&info));
|
||||
REPORTER_ASSERT(reporter, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL == info.fImageLayout);
|
||||
REPORTER_ASSERT(reporter, gpu->queueIndex() == info.fCurrentQueueFamily);
|
||||
|
||||
// To test queue transitions, we don't have any other valid queue available so instead we try
|
||||
// to transition to external queue.
|
||||
if (gpu->vkCaps().supportsExternalMemory()) {
|
||||
@ -127,7 +134,9 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkBackendSurfaceMutableStateTest, reporter, ctxIn
|
||||
|
||||
dContext->submit();
|
||||
|
||||
GrBackendSurfaceMutableState externalState2(VK_IMAGE_LAYOUT_GENERAL, initQueue);
|
||||
// Go back to the initial queue. Also we should stay in VK_IMAGE_LAYOUT_GENERAL since we
|
||||
// are passing in VK_IMAGE_LAYOUT_UNDEFINED
|
||||
GrBackendSurfaceMutableState externalState2(VK_IMAGE_LAYOUT_UNDEFINED, initQueue);
|
||||
dContext->setBackendTextureState(backendTex, externalState2);
|
||||
|
||||
REPORTER_ASSERT(reporter, backendTex.getVkImageInfo(&info));
|
||||
|
Loading…
Reference in New Issue
Block a user