Changeset 223974 in webkit


Ignore:
Timestamp:
Oct 25, 2017 12:42:16 PM (7 years ago)
Author:
jer.noble@apple.com
Message:

UNPACK_FLIP_Y is broken for MSE-backed videos
https://bugs.webkit.org/show_bug.cgi?id=178774

Reviewed by Dean Jackson.

Source/WebCore:

The global GLSL variable gl_Position can apparently only be set once, and any modifications
made after that initial set are ignored. So rather than implement flipping by changing
gl_Position.y, flip the texture coordinates instead.

Drive-by fix: some of the constants used in VideoTextureCopierCV are not defined on older
macOS versions, so make them optional.

Tests: fast/canvas/webgl/texImage2D-mse-flipY-false.html

fast/canvas/webgl/texImage2D-mse-flipY-true.html

  • platform/graphics/cv/VideoTextureCopierCV.cpp:

(WebCore::transferFunctionFromString):
(WebCore::VideoTextureCopierCV::initializeUVContextObjects):

  • platform/cocoa/CoreVideoSoftLink.cpp:
  • platform/cocoa/CoreVideoSoftLink.h:

LayoutTests:

  • fast/canvas/webgl/resources/orientation-flipped-fragmented.mp4: Added.
  • fast/canvas/webgl/resources/orientation-normal-fragmented.mp4: Added.
  • fast/canvas/webgl/texImage2D-mse-flipY-false-expected.txt: Added.
  • fast/canvas/webgl/texImage2D-mse-flipY-false.html: Added.
  • fast/canvas/webgl/texImage2D-mse-flipY-true-expected.txt: Added.
  • fast/canvas/webgl/texImage2D-mse-flipY-true.html: Added.
  • platform/ios/TestExpectations:
Location:
trunk
Files:
6 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r223967 r223974  
     12017-10-25  Jer Noble  <jer.noble@apple.com>
     2
     3        UNPACK_FLIP_Y is broken for MSE-backed videos
     4        https://bugs.webkit.org/show_bug.cgi?id=178774
     5
     6        Reviewed by Dean Jackson.
     7
     8        * fast/canvas/webgl/resources/orientation-flipped-fragmented.mp4: Added.
     9        * fast/canvas/webgl/resources/orientation-normal-fragmented.mp4: Added.
     10        * fast/canvas/webgl/texImage2D-mse-flipY-false-expected.txt: Added.
     11        * fast/canvas/webgl/texImage2D-mse-flipY-false.html: Added.
     12        * fast/canvas/webgl/texImage2D-mse-flipY-true-expected.txt: Added.
     13        * fast/canvas/webgl/texImage2D-mse-flipY-true.html: Added.
     14        * platform/ios/TestExpectations:
     15
    1162017-10-25  Ryan Haddad  <ryanhaddad@apple.com>
    217
  • trunk/LayoutTests/platform/ios/TestExpectations

    r223845 r223974  
    27432743webgl/1.0.2/conformance/uniforms/out-of-bounds-uniform-array-access.html [ Skip ]
    27442744
     2745fast/canvas/webgl/texImage2D-mse-flipY-false.html [ Skip ]
     2746fast/canvas/webgl/texImage2D-mse-flipY-true.html [ Skip ]
    27452747fast/canvas/webgl/texImage2D-video-flipY-false.html [ Skip ]
    27462748fast/canvas/webgl/texImage2D-video-flipY-true.html [ Skip ]
  • trunk/Source/WebCore/ChangeLog

    r223973 r223974  
     12017-10-25  Jer Noble  <jer.noble@apple.com>
     2
     3        UNPACK_FLIP_Y is broken for MSE-backed videos
     4        https://bugs.webkit.org/show_bug.cgi?id=178774
     5
     6        Reviewed by Dean Jackson.
     7
     8        The global GLSL variable gl_Position can apparently only be set once, and any modifications
     9        made after that initial set are ignored. So rather than implement flipping by changing
     10        gl_Position.y, flip the texture coordinates instead.
     11
     12        Drive-by fix: some of the constants used in VideoTextureCopierCV are not defined on older
     13        macOS versions, so make them optional.
     14
     15        Tests: fast/canvas/webgl/texImage2D-mse-flipY-false.html
     16               fast/canvas/webgl/texImage2D-mse-flipY-true.html
     17
     18        * platform/graphics/cv/VideoTextureCopierCV.cpp:
     19        (WebCore::transferFunctionFromString):
     20        (WebCore::VideoTextureCopierCV::initializeUVContextObjects):
     21        * platform/cocoa/CoreVideoSoftLink.cpp:
     22        * platform/cocoa/CoreVideoSoftLink.h:
     23
    1242017-10-25  Chris Dumez  <cdumez@apple.com>
    225
  • trunk/Source/WebCore/platform/cocoa/CoreVideoSoftLink.cpp

    r223289 r223974  
    6161SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, CoreVideo, kCVImageBufferYCbCrMatrix_ITU_R_601_4, CFStringRef)
    6262SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, CoreVideo, kCVImageBufferYCbCrMatrix_SMPTE_240M_1995, CFStringRef)
    63 SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, CoreVideo, kCVImageBufferYCbCrMatrix_DCI_P3, CFStringRef)
    64 SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, CoreVideo, kCVImageBufferYCbCrMatrix_P3_D65, CFStringRef)
    65 SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, CoreVideo, kCVImageBufferYCbCrMatrix_ITU_R_2020, CFStringRef)
     63SOFT_LINK_CONSTANT_MAY_FAIL_FOR_SOURCE(WebCore, CoreVideo, kCVImageBufferYCbCrMatrix_DCI_P3, CFStringRef)
     64SOFT_LINK_CONSTANT_MAY_FAIL_FOR_SOURCE(WebCore, CoreVideo, kCVImageBufferYCbCrMatrix_P3_D65, CFStringRef)
     65SOFT_LINK_CONSTANT_MAY_FAIL_FOR_SOURCE(WebCore, CoreVideo, kCVImageBufferYCbCrMatrix_ITU_R_2020, CFStringRef)
    6666
    6767#if PLATFORM(IOS)
  • trunk/Source/WebCore/platform/cocoa/CoreVideoSoftLink.h

    r223289 r223974  
    8585SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, CoreVideo, kCVImageBufferYCbCrMatrix_SMPTE_240M_1995, CFStringRef)
    8686#define kCVImageBufferYCbCrMatrix_SMPTE_240M_1995 get_CoreVideo_kCVImageBufferYCbCrMatrix_SMPTE_240M_1995()
    87 SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, CoreVideo, kCVImageBufferYCbCrMatrix_DCI_P3, CFStringRef)
     87SOFT_LINK_CONSTANT_MAY_FAIL_FOR_HEADER(WebCore, CoreVideo, kCVImageBufferYCbCrMatrix_DCI_P3, CFStringRef)
    8888#define kCVImageBufferYCbCrMatrix_DCI_P3 get_CoreVideo_kCVImageBufferYCbCrMatrix_DCI_P3()
    89 SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, CoreVideo, kCVImageBufferYCbCrMatrix_P3_D65, CFStringRef)
     89SOFT_LINK_CONSTANT_MAY_FAIL_FOR_HEADER(WebCore, CoreVideo, kCVImageBufferYCbCrMatrix_P3_D65, CFStringRef)
    9090#define kCVImageBufferYCbCrMatrix_P3_D65 get_CoreVideo_kCVImageBufferYCbCrMatrix_P3_D65()
    91 SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, CoreVideo, kCVImageBufferYCbCrMatrix_ITU_R_2020, CFStringRef)
     91SOFT_LINK_CONSTANT_MAY_FAIL_FOR_HEADER(WebCore, CoreVideo, kCVImageBufferYCbCrMatrix_ITU_R_2020, CFStringRef)
    9292#define kCVImageBufferYCbCrMatrix_ITU_R_2020 get_CoreVideo_kCVImageBufferYCbCrMatrix_ITU_R_2020()
    9393
  • trunk/Source/WebCore/platform/graphics/cv/VideoTextureCopierCV.cpp

    r223315 r223974  
    103103    if (string == kCVImageBufferYCbCrMatrix_SMPTE_240M_1995)
    104104        return TransferFunction::kSMPTE_240M_1995;
    105     if (string == kCVImageBufferYCbCrMatrix_DCI_P3)
     105    if (canLoad_CoreVideo_kCVImageBufferYCbCrMatrix_DCI_P3() && string == kCVImageBufferYCbCrMatrix_DCI_P3)
    106106        return TransferFunction::kDCI_P3;
    107     if (string == kCVImageBufferYCbCrMatrix_P3_D65)
     107    if (canLoad_CoreVideo_kCVImageBufferYCbCrMatrix_P3_D65() && string == kCVImageBufferYCbCrMatrix_P3_D65)
    108108        return TransferFunction::kP3_D65;
    109     if (string == kCVImageBufferYCbCrMatrix_ITU_R_2020)
     109    if (canLoad_CoreVideo_kCVImageBufferYCbCrMatrix_ITU_R_2020() && string == kCVImageBufferYCbCrMatrix_ITU_R_2020)
    110110        return TransferFunction::kITU_R_2020;
    111111    return TransferFunction::Unknown;
     
    397397        "void main() {\n"
    398398        "   gl_Position = vec4(a_position, 0, 1.0);\n"
     399        "   vec2 normalizedPosition = a_position * .5 + .5;\n"
    399400        "   if (u_flipY == 1) {\n"
    400         "       gl_Position.y = -gl_Position.y;\n"
     401        "       normalizedPosition.y = 1.0 - normalizedPosition.y;\n"
    401402        "   }\n"
    402         "   vec2 normalizedPosition = a_position * .5 + .5;\n"
    403403#if PLATFORM(IOS)
    404404        "   v_yTextureCoordinate = normalizedPosition;\n"
Note: See TracChangeset for help on using the changeset viewer.