[Feature] (SharedImage): sample NV12/P010 dma-bufs through GL_OES_EGL_image_external on both backends, copying foreign buffers into server YUV images

This commit is contained in:
2026-10-03 22:46:00 -04:00
parent 4633ca223c
commit 7218bacb49
58 changed files with 2972 additions and 153 deletions
@@ -3525,6 +3525,7 @@ void main() {
CollectWireObjects(m_submitCounter, true);
ClearAllWireDrawPassCaches();
DestroyWireColorBlitResources();
DestroyWireYuvResources();
DestroyWireDepthMipmapResources();
DestroyWireMultisampleResolveResources();
DestroySharedImagePresentTargets(false);
@@ -8107,6 +8108,8 @@ void main() {
#include "WireDraw.inc"
// AFTER WireFramebuffer.inc: the shared-image present is that file's readback, into an image.
#include "WireSharedImage.inc"
// AFTER WireSharedImage.inc: a YUV image is that file's reading side, converted on the way.
#include "WireYuvImage.inc"
void VulkanRenderer::Clear(GLbitfield mask) {
#if MOBILEGL_BUILD_DISAGGREGATED
@@ -16032,6 +16035,23 @@ void main() {
}
}
// YUV shared images (WireYuvImage.inc) are sampled through a VkSamplerYcbcrConversion, a
// feature of its own; asked only where AHardwareBuffers are imported at all.
m_samplerYcbcrConversion = false;
VkPhysicalDeviceSamplerYcbcrConversionFeatures ycbcrFeatures{};
ycbcrFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES;
if (m_wireAhbImport && getPhysicalDeviceFeatures2 != nullptr) {
VkPhysicalDeviceFeatures2 featureQuery{};
featureQuery.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
featureQuery.pNext = &ycbcrFeatures;
getPhysicalDeviceFeatures2(m_physicalDevice.handle, &featureQuery);
if (ycbcrFeatures.samplerYcbcrConversion == VK_TRUE) {
ycbcrFeatures.pNext = const_cast<void*>(deviceCreateInfo.pNext);
deviceCreateInfo.pNext = &ycbcrFeatures;
m_samplerYcbcrConversion = true;
}
}
// VK_EXT_multi_draw: tier 1 of the multi-draw dispatch - one vkCmdDrawMulti(Indexed)EXT
// for a whole glMultiDraw* batch (VkMultiDrawIndexedInfoEXT carries per-draw
// firstIndex/indexCount/vertexOffset, so glMultiDrawElementsBaseVertex fits natively).