• Le Hoang Quyen's avatar
    Fix incorrect 2D YUV textures decoding. · 05883935
    Le Hoang Quyen authored
    - yuv_to_rgb_converter.cc was only able to correctly handle rectangle
      YUV textures (GL_TEXTURE_RECTANGLE_ARB). However, it couldn't handle
      GL_TEXTURE_2D textures correctly (The Metal backend uses GL_TEXTURE_2D
      for IOSurface unlike the default OpenGL backend).
    
    - The shaders code as well as the OpenGL code were assuming the textures
      are rectangle whereas the 2D scenarios hadn't been tested properly.
      For example, the OpenGL code always passed texture size to
      "a_texScale" uniform to scale the texcoords, regardless of the texture
      being rectangle or 2D. In 2D fragment shader, the texcoords for UV
      texture were reduced by half as if the texcoords are for rectangle
      texture.
    
    - Furthermore, when binding IOSurface to 2D textures, the code forgot
      to disable mipmap filtering. Because by default 2D textures have
      mipmap filtering enabled, and IOSurface bound textures don't have
      mipmap, this led to the YUV textures were reported as incomplete by
      OpenGL. Thus decoding wouldn't be able to sample real results from the
      YUV textures.
    
    Bug: angleproject:4846
    Bug: angleproject:2634
    Bug: 1122432
    Change-Id: Ie43b755c19b3dc149ddca3d68c381fee99479c00
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2378407
    Commit-Queue: Le Hoang Quyen <le.hoang.q@gmail.com>
    Reviewed-by: default avatarccameron <ccameron@chromium.org>
    Reviewed-by: default avatarYuly Novikov <ynovikov@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#804299}
    05883935
gl_image_io_surface_egl.mm 12.8 KB