st/mesa: Fix EGLImageTargetTexture2D for GL_TEXTURE_2D
authorWoody Chow <woodychow@google.com>
Wed, 19 Aug 2020 05:19:12 +0000 (14:19 +0900)
committerMarge Bot <eric+marge@anholt.net>
Tue, 25 Aug 2020 02:10:15 +0000 (02:10 +0000)
Before this change, internalFormat was defaulted to GL_RGBA (
unsized internal format). Therefore, subsequent glTexSubImage2D
call with type != GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT_4_4_4_4 or
GL_UNSIGNED_SHORT_5_5_5_1 would give GL_INVALID_OPERATION.

This fixes

android.graphics.cts.BitmapColorSpaceTest#test16bitHardware
android.graphics.cts.ImageDecoderTest#testDecodeBitmap*
android.graphics.cts.BitmapTest#testNdkFormatsHardware

in CtsGraphicsTestCases

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6382>

src/mesa/state_tracker/st_cb_eglimage.c

index 5b03c5eb580452c46bd3dcb5ea9ddf719d975797..bf25e3130918ae6f3ff6ab0f6558586a9469d44f 100644 (file)
@@ -327,7 +327,9 @@ st_egl_image_target_texture_2d(struct gl_context *ctx, GLenum target,
                          &native_supported))
       return;
 
-   st_bind_egl_image(ctx, texObj, texImage, &stimg, false, native_supported);
+   st_bind_egl_image(ctx, texObj, texImage, &stimg,
+                     target != GL_TEXTURE_EXTERNAL_OES,
+                     native_supported);
    pipe_resource_reference(&stimg.texture, NULL);
 }