Vulkan: Submit semaphores from glWaitSemaphoreEXT & glSignalSemaphoreEXT
Implement submission of client semaphores passed to glWaitSemaphoreEXT &
glSignalSemaphoreEXT.
This also relaxes the expectation that we will not flush() if there are
no commands. Signaling semaphores in particular requires queue submission
irrespective of whether there are any command buffers to submit. If there
are neither commands nor semaphores, we can still skip queue submission.
WebGL runs in Chrome with ANGLE & Vulkan interop as of this patch, albeit
with incorrect synchronization due to texture barriers not being
implemented yet. Quite a few flags are needed to try this:
GN args: angle_vulkan_conformant_configs_only=true
chrome \
--enable-features=UseSkiaRenderer,UiGpuRasterization \
--enable-gpu-rasterization \
--enable-oop-rasterization \
--enable-vulkan \
--use-gl=angle \
--use-angle=vulkan
Bug: angleproject:3289
Change-Id: I3d49c230a2fbf0cd2a2b943b05ded0e4604cc313
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1623815
Commit-Queue: Michael Spang <spang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/validationES2.cpp b/src/libANGLE/validationES2.cpp
index b98de66..f972fb3 100644
--- a/src/libANGLE/validationES2.cpp
+++ b/src/libANGLE/validationES2.cpp
@@ -1124,6 +1124,27 @@
return false;
}
+
+bool IsValidImageLayout(ImageLayout layout)
+{
+ switch (layout)
+ {
+ case ImageLayout::General:
+ case ImageLayout::ColorAttachment:
+ case ImageLayout::DepthStencilAttachment:
+ case ImageLayout::DepthStencilReadOnlyAttachment:
+ case ImageLayout::ShaderReadOnly:
+ case ImageLayout::TransferSrc:
+ case ImageLayout::TransferDst:
+ case ImageLayout::DepthReadOnlyStencilAttachment:
+ case ImageLayout::DepthAttachmentStencilReadOnly:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
} // anonymous namespace
bool ValidateES2TexImageParameters(Context *context,
@@ -3341,8 +3362,16 @@
return false;
}
- UNIMPLEMENTED();
- return false;
+ for (GLuint i = 0; i < numTextureBarriers; ++i)
+ {
+ if (!IsValidImageLayout(FromGLenum<ImageLayout>(dstLayouts[i])))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidImageLayout);
+ return false;
+ }
+ }
+
+ return true;
}
bool ValidateWaitSemaphoreEXT(Context *context,
@@ -3359,8 +3388,16 @@
return false;
}
- UNIMPLEMENTED();
- return false;
+ for (GLuint i = 0; i < numTextureBarriers; ++i)
+ {
+ if (!IsValidImageLayout(FromGLenum<ImageLayout>(srcLayouts[i])))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidImageLayout);
+ return false;
+ }
+ }
+
+ return true;
}
bool ValidateImportSemaphoreFdEXT(Context *context,