opengl: Add support for EGL_EXT_pixel_format_float.

This lets swapchains support RGBA16Float when the underlying EGL
implementation supports it.

Bug: 344814083
Change-Id: I59e9ebe0203685c60804a77e47e702e1f8fe7016
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/195916
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/src/dawn/native/opengl/DisplayEGL.cpp b/src/dawn/native/opengl/DisplayEGL.cpp
index 1794c72..9efe5d9 100644
--- a/src/dawn/native/opengl/DisplayEGL.cpp
+++ b/src/dawn/native/opengl/DisplayEGL.cpp
@@ -130,7 +130,8 @@
     static constexpr wgpu::TextureFormat kFormatWhenConfigRequired[] = {
         wgpu::TextureFormat::RGBA8Unorm};
     static constexpr wgpu::TextureFormat kFormatsWithNoConfigContext[] = {
-        wgpu::TextureFormat::RGBA8Unorm, wgpu::TextureFormat::RGB10A2Unorm};
+        wgpu::TextureFormat::RGBA8Unorm, wgpu::TextureFormat::RGB10A2Unorm,
+        wgpu::TextureFormat::RGBA16Float};
 
     if (egl.HasExt(EGLExt::NoConfigContext)) {
         return {kFormatsWithNoConfigContext};
@@ -166,7 +167,17 @@
             AddAttrib(EGL_ALPHA_SIZE, 2);
             break;
 
-            // TODO(344814083): Support RGBA16Float with EGL_EXT_pixel_format_float.
+        case wgpu::TextureFormat::RGBA16Float:
+            if (!egl.HasExt(EGLExt::PixelFormatFloat)) {
+                return kNoConfig;
+            }
+            AddAttrib(EGL_RED_SIZE, 16);
+            AddAttrib(EGL_BLUE_SIZE, 16);
+            AddAttrib(EGL_GREEN_SIZE, 16);
+            AddAttrib(EGL_ALPHA_SIZE, 16);
+            AddAttrib(EGL_COLOR_COMPONENT_TYPE_EXT, EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT);
+            break;
+
             // TODO(344814083): Support RGBA8UnormSrgb with EGL_KHR_gl_colorspace.
 
         default:
diff --git a/src/dawn/native/opengl/EGLFunctions.cpp b/src/dawn/native/opengl/EGLFunctions.cpp
index c27813d..79b7c5b 100644
--- a/src/dawn/native/opengl/EGLFunctions.cpp
+++ b/src/dawn/native/opengl/EGLFunctions.cpp
@@ -84,6 +84,7 @@
      ExtType::Display},
     {EGLExt::ReusableSync, "EGL_KHR_reusable_sync", NeverPromoted, ExtType::Display},
     {EGLExt::NoConfigContext, "EGL_KHR_no_config_context", NeverPromoted, ExtType::Display},
+    {EGLExt::PixelFormatFloat, "EGL_EXT_pixel_format_float", NeverPromoted, ExtType::Display},
     //
 }};
 
diff --git a/src/dawn/native/opengl/EGLFunctions.h b/src/dawn/native/opengl/EGLFunctions.h
index f85f893..5bd5df5 100644
--- a/src/dawn/native/opengl/EGLFunctions.h
+++ b/src/dawn/native/opengl/EGLFunctions.h
@@ -58,6 +58,7 @@
     DisplayTextureShareGroup,
     ReusableSync,
     NoConfigContext,
+    PixelFormatFloat,
 
     EnumCount,
 };