OES_texture_float / OES_texture_half_float unavailable in WebGL 1.0 on iOS Simulator...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 May 2020 00:16:47 +0000 (00:16 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 May 2020 00:16:47 +0000 (00:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=210524

Patch by Kenneth Russell <kbr@chromium.org> on 2020-05-20
Reviewed by Dean Jackson.

Source/ThirdParty/ANGLE:

Emulate LUMINANCE, ALPHA and LUMINANCE_ALPHA floating-point
textures on top of RED / RG textures when the underlying
OES_texture_float/half_float OpenGL ES extensions are unavailable.

This makes the conformance/extensions/oes-texture{-half}-float*
tests run and pass in the iOS Simulator.

This change is being reviewed upstream in the ANGLE repository and
is only being uploaded here for testing purposes. It will be
rolled in with the next ANGLE update.

* src/libANGLE/renderer/gl/TextureGL.cpp:
(rx::TextureGL::setSwizzle):
* src/libANGLE/renderer/gl/formatutilsgl.cpp:
(rx::nativegl::BuildInternalFormatInfoMap):
(rx::nativegl::IsLUMAFormat):
(rx::nativegl::EmulateLUMAFormat):
(rx::nativegl::EmulateLUMA):
(rx::nativegl::GetNativeInternalFormat):
(rx::nativegl::GetNativeFormat):
(rx::nativegl::GetNativeType):
(rx::nativegl::GetTexImageFormat):
(rx::nativegl::GetTexSubImageFormat):

LayoutTests:

Remove expected failure for
webgl/2.0.0/conformance/extensions/oes-texture-float-expected.txt
on ios-simulator. Enable
fast/canvas/webgl/oes-texture-half-float-uint16.html on iOS.

* platform/ios-simulator/webgl/2.0.0/conformance/extensions/oes-texture-float-expected.txt: Removed.
* platform/ios/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@261975 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/ios-simulator/webgl/2.0.0/conformance/extensions/oes-texture-float-expected.txt [deleted file]
LayoutTests/platform/ios/TestExpectations
Source/ThirdParty/ANGLE/ChangeLog
Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/TextureGL.cpp
Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/formatutilsgl.cpp

index be76e3f..823588e 100644 (file)
@@ -1,3 +1,18 @@
+2020-05-20  Kenneth Russell  <kbr@chromium.org>
+
+        OES_texture_float / OES_texture_half_float unavailable in WebGL 1.0 on iOS Simulator with ANGLE
+        https://bugs.webkit.org/show_bug.cgi?id=210524
+
+        Reviewed by Dean Jackson.
+
+        Remove expected failure for
+        webgl/2.0.0/conformance/extensions/oes-texture-float-expected.txt
+        on ios-simulator. Enable
+        fast/canvas/webgl/oes-texture-half-float-uint16.html on iOS.
+
+        * platform/ios-simulator/webgl/2.0.0/conformance/extensions/oes-texture-float-expected.txt: Removed.
+        * platform/ios/TestExpectations:
+
 2020-05-20  Chris Dumez  <cdumez@apple.com>
 
         (r261946) [ iOS ] fast/frames/didBecomeCurrentDocumentInFrame-crash.html is failing
diff --git a/LayoutTests/platform/ios-simulator/webgl/2.0.0/conformance/extensions/oes-texture-float-expected.txt b/LayoutTests/platform/ios-simulator/webgl/2.0.0/conformance/extensions/oes-texture-float-expected.txt
deleted file mode 100644 (file)
index 6a9fe83..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
-
-Test: ../../resources/webgl_test_files/conformance/extensions/oes-texture-float.html
-[ 1: PASS ] WebGL context exists
-[ 2: PASS ] getError was expected value: NO_ERROR : texture parameter setup should succeed
-[ 3: PASS ] getError was expected value: INVALID_ENUM : floating-point texture allocation must be disallowed if OES_texture_float isn't enabled
-[ 4: PASS ] Successfully enabled OES_texture_float extension
-[ 5: PASS ] getError was expected value: NO_ERROR : texture parameter setup should succeed
-[ 6: PASS ] getError was expected value: NO_ERROR : floating-point texture allocation should succeed if OES_texture_float is enabled
-[ 7: PASS ] should be green
-[ 8: FAIL ] should be red at (0, 0) expected: 255,0,0,255 was 0,255,0,255
-[ 9: PASS ] getError was expected value: NO_ERROR : texture parameter setup should succeed
-[ 10: PASS ] getError was expected value: NO_ERROR : floating-point texture allocation should succeed if OES_texture_float is enabled
-[ 11: PASS ] should be green
-[ 12: FAIL ] should be red at (0, 0) expected: 255,0,0,255 was 0,255,0,255
-[ 13: PASS ] getError was expected value: NO_ERROR : texture parameter setup should succeed
-[ 14: PASS ] getError was expected value: NO_ERROR : floating-point texture allocation should succeed if OES_texture_float is enabled
-[ 15: PASS ] should be green
-[ 16: FAIL ] should be red at (0, 0) expected: 255,0,0,255 was 0,255,0,255
-[ 17: PASS ] getError was expected value: NO_ERROR : texture parameter setup should succeed
-[ 18: PASS ] getError was expected value: NO_ERROR : floating-point texture allocation should succeed if OES_texture_float is enabled
-[ 19: PASS ] should be green
-[ 20: FAIL ] should be red at (0, 0) expected: 255,0,0,255 was 0,255,0,255
-[ 21: PASS ] getError was expected value: NO_ERROR : texture parameter setup should succeed
-[ 22: PASS ] getError was expected value: NO_ERROR : floating-point texture allocation should succeed if OES_texture_float is enabled
-[ 23: PASS ] should be green
-[ 24: FAIL ] should be red at (0, 0) expected: 255,0,0,255 was 0,255,0,255
-[ 25: PASS ] gl.getExtension("OES_texture_float").myProperty is 2
-[ 26: PASS ] successfullyParsed is true
-[ FAIL ] 5 failures reported
-
index 672c0c0..001a800 100644 (file)
@@ -3469,7 +3469,6 @@ webkit.org/b/207858 webgl/smell-test.html [ Pass Failure ImageOnlyFailure ]
 webkit.org/b/207858 webgl/webgl-backing-store-size-update.html [ Pass Failure ImageOnlyFailure ]
 webkit.org/b/207858 webgl/webgl-border.html [ Pass Failure ImageOnlyFailure ]
 webkit.org/b/207858 webgl/webgl-box-shadow.html [ Pass Failure ImageOnlyFailure ]
-webkit.org/b/207858 fast/canvas/webgl/oes-texture-half-float-uint16.html [ Pass Failure ]
 webkit.org/b/207858 fast/canvas/webgl/program-test.html [ Failure ]
 webkit.org/b/207858 fast/canvas/webgl/uninitialized-test.html [ Pass Failure ]
 webkit.org/b/207858 fast/canvas/webgl/oes-texture-float-linear.html [ Pass Failure ]
index a0e017d..b9889d1 100644 (file)
@@ -1,3 +1,34 @@
+2020-05-20  Kenneth Russell  <kbr@chromium.org>
+
+        OES_texture_float / OES_texture_half_float unavailable in WebGL 1.0 on iOS Simulator with ANGLE
+        https://bugs.webkit.org/show_bug.cgi?id=210524
+
+        Reviewed by Dean Jackson.
+
+        Emulate LUMINANCE, ALPHA and LUMINANCE_ALPHA floating-point
+        textures on top of RED / RG textures when the underlying
+        OES_texture_float/half_float OpenGL ES extensions are unavailable.
+
+        This makes the conformance/extensions/oes-texture{-half}-float*
+        tests run and pass in the iOS Simulator.
+
+        This change is being reviewed upstream in the ANGLE repository and
+        is only being uploaded here for testing purposes. It will be
+        rolled in with the next ANGLE update.
+
+        * src/libANGLE/renderer/gl/TextureGL.cpp:
+        (rx::TextureGL::setSwizzle):
+        * src/libANGLE/renderer/gl/formatutilsgl.cpp:
+        (rx::nativegl::BuildInternalFormatInfoMap):
+        (rx::nativegl::IsLUMAFormat):
+        (rx::nativegl::EmulateLUMAFormat):
+        (rx::nativegl::EmulateLUMA):
+        (rx::nativegl::GetNativeInternalFormat):
+        (rx::nativegl::GetNativeFormat):
+        (rx::nativegl::GetNativeType):
+        (rx::nativegl::GetTexImageFormat):
+        (rx::nativegl::GetTexSubImageFormat):
+
 2020-05-18  James Darpinian  <jdarpinian@chromium.org>
 
         Enable regenerateStructNames workaround on iOS
index 01652f9..d828aa6 100644 (file)
@@ -1610,8 +1610,22 @@ angle::Result TextureGL::setSwizzle(const gl::Context *context, GLint swizzle[4]
         onStateChange(angle::SubjectMessage::SubjectChanged);
 
         stateManager->bindTexture(getType(), mTextureID);
-        ANGLE_GL_TRY(context, functions->texParameteriv(ToGLenum(getType()),
-                                                        GL_TEXTURE_SWIZZLE_RGBA, swizzle));
+        if (functions->standard == STANDARD_GL_ES)
+        {
+            ANGLE_GL_TRY(context, functions->texParameteri(ToGLenum(getType()),
+                                                           GL_TEXTURE_SWIZZLE_R, swizzle[0]));
+            ANGLE_GL_TRY(context, functions->texParameteri(ToGLenum(getType()),
+                                                           GL_TEXTURE_SWIZZLE_G, swizzle[1]));
+            ANGLE_GL_TRY(context, functions->texParameteri(ToGLenum(getType()),
+                                                           GL_TEXTURE_SWIZZLE_B, swizzle[2]));
+            ANGLE_GL_TRY(context, functions->texParameteri(ToGLenum(getType()),
+                                                           GL_TEXTURE_SWIZZLE_A, swizzle[3]));
+        }
+        else
+        {
+            ANGLE_GL_TRY(context, functions->texParameteriv(ToGLenum(getType()),
+                                                            GL_TEXTURE_SWIZZLE_RGBA, swizzle));
+        }
     }
     return angle::Result::Continue;
 }
index 570ba49..7cba5e6 100644 (file)
@@ -275,16 +275,16 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap()
     InsertFormatMapping(&map, GL_DEPTH_STENCIL,         VersionOnly(1, 5),                                  VersionOrExts(1, 5, "GL_ARB_depth_texture"), VersionOnly(1, 5),                                  VersionOnly(2, 0),                           VersionOrExts(3, 0, "GL_OES_depth_texture"), VersionOnly(2, 0),                                                       VersionOnly(2, 0)                                                      );
 
     // Luminance alpha formats
-    //                       | Format                  | OpenGL texture support                      | Filter           | Render          | OpenGL ES texture support            | Filter                                      | OpenGL ES texture attachment support | OpenGL ES renderbuffer support |
-    InsertFormatMapping(&map, GL_ALPHA8_EXT,             AlwaysSupported(),                           AlwaysSupported(), NeverSupported(), AlwaysSupported(),                     AlwaysSupported(),                            NeverSupported(),                      NeverSupported()                );
-    InsertFormatMapping(&map, GL_LUMINANCE8_EXT,         AlwaysSupported(),                           AlwaysSupported(), NeverSupported(), AlwaysSupported(),                     AlwaysSupported(),                            NeverSupported(),                      NeverSupported()                );
-    InsertFormatMapping(&map, GL_LUMINANCE8_ALPHA8_EXT,  AlwaysSupported(),                           AlwaysSupported(), NeverSupported(), AlwaysSupported(),                     AlwaysSupported(),                            NeverSupported(),                      NeverSupported()                );
-    InsertFormatMapping(&map, GL_ALPHA16F_EXT,           VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_OES_texture_half_float"), ExtsOnly("GL_OES_texture_half_float_linear"), NeverSupported(),                      NeverSupported()                );
-    InsertFormatMapping(&map, GL_LUMINANCE16F_EXT,       VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_OES_texture_half_float"), ExtsOnly("GL_OES_texture_half_float_linear"), NeverSupported(),                      NeverSupported()                );
-    InsertFormatMapping(&map, GL_LUMINANCE_ALPHA16F_EXT, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_OES_texture_half_float"), ExtsOnly("GL_OES_texture_half_float_linear"), NeverSupported(),                      NeverSupported()                );
-    InsertFormatMapping(&map, GL_ALPHA32F_EXT,           VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_OES_texture_float"),      ExtsOnly("GL_OES_texture_float_linear"),      NeverSupported(),                      NeverSupported()                );
-    InsertFormatMapping(&map, GL_LUMINANCE32F_EXT,       VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_OES_texture_float"),      ExtsOnly("GL_OES_texture_float_linear"),      NeverSupported(),                      NeverSupported()                );
-    InsertFormatMapping(&map, GL_LUMINANCE_ALPHA32F_EXT, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_OES_texture_float"),      ExtsOnly("GL_OES_texture_float_linear"),      NeverSupported(),                      NeverSupported()                );
+    //                      | Format                   | OpenGL texture support                     | Filter           | Render          | OpenGL ES texture support                       | Filter                                      | OpenGL ES texture attachment support | OpenGL ES renderbuffer support  |
+    InsertFormatMapping(&map, GL_ALPHA8_EXT,             AlwaysSupported(),                           AlwaysSupported(), NeverSupported(), AlwaysSupported(),                                AlwaysSupported(),                            NeverSupported(),                      NeverSupported()                );
+    InsertFormatMapping(&map, GL_LUMINANCE8_EXT,         AlwaysSupported(),                           AlwaysSupported(), NeverSupported(), AlwaysSupported(),                                AlwaysSupported(),                            NeverSupported(),                      NeverSupported()                );
+    InsertFormatMapping(&map, GL_LUMINANCE8_ALPHA8_EXT,  AlwaysSupported(),                           AlwaysSupported(), NeverSupported(), AlwaysSupported(),                                AlwaysSupported(),                            NeverSupported(),                      NeverSupported()                );
+    InsertFormatMapping(&map, GL_ALPHA16F_EXT,           VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), VersionOrExts(3, 0, "GL_OES_texture_half_float"), ExtsOnly("GL_OES_texture_half_float_linear"), NeverSupported(),                      NeverSupported()                );
+    InsertFormatMapping(&map, GL_LUMINANCE16F_EXT,       VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), VersionOrExts(3, 0, "GL_OES_texture_half_float"), ExtsOnly("GL_OES_texture_half_float_linear"), NeverSupported(),                      NeverSupported()                );
+    InsertFormatMapping(&map, GL_LUMINANCE_ALPHA16F_EXT, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), VersionOrExts(3, 0, "GL_OES_texture_half_float"), ExtsOnly("GL_OES_texture_half_float_linear"), NeverSupported(),                      NeverSupported()                );
+    InsertFormatMapping(&map, GL_ALPHA32F_EXT,           VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), VersionOrExts(3, 0, "GL_OES_texture_float"),      ExtsOnly("GL_OES_texture_float_linear"),      NeverSupported(),                      NeverSupported()                );
+    InsertFormatMapping(&map, GL_LUMINANCE32F_EXT,       VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), VersionOrExts(3, 0, "GL_OES_texture_float"),      ExtsOnly("GL_OES_texture_float_linear"),      NeverSupported(),                      NeverSupported()                );
+    InsertFormatMapping(&map, GL_LUMINANCE_ALPHA32F_EXT, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), VersionOrExts(3, 0, "GL_OES_texture_float"),      ExtsOnly("GL_OES_texture_float_linear"),      NeverSupported(),                      NeverSupported()                );
 
     // EXT_texture_compression_rgtc formats
     //                       | Format                                  | OpenGL texture support                                | Filter           | Render          | OpenGL ES texture support                  | Filter           | OpenGL ES texture attachment support | OpenGL ES renderbuffer support |
@@ -434,6 +434,33 @@ const InternalFormat &GetInternalFormatInfo(GLenum internalFormat, StandardGL st
     return *defaultInternalFormat;
 }
 
+static bool IsLUMAFormat(GLenum format)
+{
+    return (format == GL_LUMINANCE || format == GL_ALPHA || format == GL_LUMINANCE_ALPHA);
+}
+
+static GLenum EmulateLUMAFormat(const GLenum format)
+{
+    // This is needed separately from EmulateLUMA because some format/type combinations that come in
+    // to GetNativeFormat don't have entries in the internal format map.
+
+    ASSERT(IsLUMAFormat(format));
+
+    if (format == GL_LUMINANCE || format == GL_ALPHA)
+        return GL_RED;
+
+    return GL_RG;
+}
+
+static const gl::InternalFormat &EmulateLUMA(const gl::InternalFormat &internalFormat)
+{
+    ASSERT(IsLUMAFormat(internalFormat.format));
+
+    // Work around deprecated luminance/alpha formats in the OpenGL core profile, and OpenGL ES 3.0
+    // and greater, by backing them with R or RG textures.
+    return gl::GetInternalFormatInfo(EmulateLUMAFormat(internalFormat.format), internalFormat.type);
+}
+
 static GLenum GetNativeInternalFormat(const FunctionsGL *functions,
                                       const angle::FeaturesGL &features,
                                       const gl::InternalFormat &internalFormat)
@@ -479,26 +506,34 @@ static GLenum GetNativeInternalFormat(const FunctionsGL *functions,
 
         if ((functions->profile & GL_CONTEXT_CORE_PROFILE_BIT) != 0)
         {
-            // Work around deprecated luminance alpha formats in the OpenGL core profile by backing
-            // them with R or RG textures.
-            if (internalFormat.format == GL_LUMINANCE || internalFormat.format == GL_ALPHA)
+            if (IsLUMAFormat(internalFormat.format))
             {
-                result = gl::GetInternalFormatInfo(GL_RED, internalFormat.type).sizedInternalFormat;
-            }
-
-            if (internalFormat.format == GL_LUMINANCE_ALPHA)
-            {
-                result = gl::GetInternalFormatInfo(GL_RG, internalFormat.type).sizedInternalFormat;
+                result = EmulateLUMA(internalFormat).sizedInternalFormat;
             }
         }
     }
     else if (functions->isAtLeastGLES(gl::Version(3, 0)))
     {
-        if (internalFormat.componentType == GL_FLOAT && !internalFormat.isLUMA())
+        if (internalFormat.componentType == GL_FLOAT)
         {
-            // Use sized internal formats for floating point textures.  Extensions such as
-            // EXT_color_buffer_float require the sized formats to be renderable.
-            result = internalFormat.sizedInternalFormat;
+            if (!internalFormat.isLUMA())
+            {
+                // Use sized internal formats for floating point textures.  Extensions such as
+                // EXT_color_buffer_float require the sized formats to be renderable.
+                result = internalFormat.sizedInternalFormat;
+            }
+            else if ((internalFormat.type == GL_FLOAT &&
+                      !functions->hasGLESExtension("GL_OES_texture_float")) ||
+                     (internalFormat.type == GL_HALF_FLOAT_OES &&
+                      !functions->hasGLESExtension("GL_OES_texture_half_float")))
+            {
+                // The legacy luminance/alpha formats from OES_texture_float are emulated with R/RG
+                // textures.
+                if (IsLUMAFormat(internalFormat.format))
+                {
+                    result = EmulateLUMA(internalFormat).sizedInternalFormat;
+                }
+            }
         }
         else if (internalFormat.format == GL_RED_EXT || internalFormat.format == GL_RG_EXT)
         {
@@ -519,7 +554,8 @@ static GLenum GetNativeInternalFormat(const FunctionsGL *functions,
 
 static GLenum GetNativeFormat(const FunctionsGL *functions,
                               const angle::FeaturesGL &features,
-                              GLenum format)
+                              GLenum format,
+                              GLenum type)
 {
     GLenum result = format;
 
@@ -541,14 +577,9 @@ static GLenum GetNativeFormat(const FunctionsGL *functions,
         {
             // Work around deprecated luminance alpha formats in the OpenGL core profile by backing
             // them with R or RG textures.
-            if (format == GL_LUMINANCE || format == GL_ALPHA)
+            if (IsLUMAFormat(format))
             {
-                result = GL_RED;
-            }
-
-            if (format == GL_LUMINANCE_ALPHA)
-            {
-                result = GL_RG;
+                result = EmulateLUMAFormat(format);
             }
         }
     }
@@ -566,6 +597,18 @@ static GLenum GetNativeFormat(const FunctionsGL *functions,
                 result = GL_RGBA;
             }
         }
+
+        if ((type == GL_FLOAT && !functions->hasGLESExtension("GL_OES_texture_float")) ||
+            (type == GL_HALF_FLOAT_OES &&
+             !functions->hasGLESExtension("GL_OES_texture_half_float")))
+        {
+            // On ES 3.0 systems that don't have GL_OES_texture_float or OES_texture_half_float, the
+            // LUMINANCE/ALPHA formats from those extensions must be emulated with R/RG textures.
+            if (IsLUMAFormat(format))
+            {
+                result = EmulateLUMAFormat(format);
+            }
+        }
     }
 
     return result;
@@ -629,18 +672,12 @@ static GLenum GetNativeType(const FunctionsGL *functions,
     {
         if (type == GL_HALF_FLOAT_OES)
         {
-            switch (format)
+            if (!IsLUMAFormat(format) || !functions->hasGLESExtension("GL_OES_texture_half_float"))
             {
-                case GL_LUMINANCE_ALPHA:
-                case GL_LUMINANCE:
-                case GL_ALPHA:
-                    // In ES3, these formats come from EXT_texture_storage, which uses
-                    // HALF_FLOAT_OES. Other formats (like RGBA) use HALF_FLOAT (non-OES) in ES3.
-                    break;
-
-                default:
-                    result = GL_HALF_FLOAT;
-                    break;
+                // In ES3, the luminance formats come from OES_texture_half_float, which uses
+                // HALF_FLOAT_OES. Other formats (like RGBA) use HALF_FLOAT (non-OES) in ES3.
+                // If they're emulated (see above), use HALF_FLOAT.
+                result = GL_HALF_FLOAT;
             }
         }
     }
@@ -701,7 +738,7 @@ TexImageFormat GetTexImageFormat(const FunctionsGL *functions,
     TexImageFormat result;
     result.internalFormat = GetNativeInternalFormat(
         functions, features, gl::GetInternalFormatInfo(internalFormat, type));
-    result.format = GetNativeFormat(functions, features, format);
+    result.format = GetNativeFormat(functions, features, format, type);
     result.type   = GetNativeType(functions, features, format, type);
     return result;
 }
@@ -712,7 +749,7 @@ TexSubImageFormat GetTexSubImageFormat(const FunctionsGL *functions,
                                        GLenum type)
 {
     TexSubImageFormat result;
-    result.format = GetNativeFormat(functions, features, format);
+    result.format = GetNativeFormat(functions, features, format, type);
     result.type   = GetNativeType(functions, features, format, type);
     return result;
 }