Bug 227586

Summary: ANGLE Metal Buffers created out of IOSurfaces should take the EGL_IOSURFACE_USAGE_HINT_ANGLE into account
Product: WebKit Reporter: Kimmo Kinnunen <kkinnunen>
Component: ANGLEAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: dino, dustin.kerstein, kbr, kkinnunen, kpiddington, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 231031    

Description Kimmo Kinnunen 2021-07-01 08:22:59 PDT
ANGLE Metal Buffers created out of IOSurfaces should take the EGL_IOSURFACE_USAGE_HINT_ANGLE into account

The attribute EGL_IOSURFACE_USAGE_HINT_ANGLE may optionally be specified as
    a combination of the bits EGL_IOSURFACE_READ_HINT_ANGLE and
    EGL_IOSURFACE_WRITE_HINT_ANGLE. On the iOS Simulator platform, where
    IOSurface support is incomplete, these hints indicate whether the intent is
    to read from the IOSurface, write to it, or both. Explicitly passing 0 for
    this attribute is equivalent to setting both the read and write usage
    bits. This attribute is ignored on other platforms."

angle::Result IOSurfaceSurfaceMtl::ensureColorTextureCreated(const gl::Context *context)
{
    if (mColorTexture)
    {
        return angle::Result::Continue;
    }
    ContextMtl *contextMtl = mtl::GetImpl(context);
    ANGLE_MTL_OBJC_SCOPE
    {
        auto texDesc =
            [MTLTextureDescriptor texture2DDescriptorWithPixelFormat:mColorFormat.metalFormat
                                                               width:mSize.width
                                                              height:mSize.height
                                                           mipmapped:NO];

        texDesc.usage = MTLTextureUsageShaderRead | MTLTextureUsageRenderTarget;
Comment 1 Radar WebKit Bug Importer 2021-07-08 08:23:17 PDT
<rdar://problem/80324846>