Edit

kc3-lang/angle/src/common/android_util.h

Branch :

  • Show log

    Commit

  • Author : Mohan Maiya
    Date : 2020-09-15 16:53:26
    Hash : c99c22bb
    Message : EGL: Add support for EGL_ANDROID_create_native_client_buffer This EGL extension will add support for creating EGLClientBuffer backed by an Android window buffer (struct ANativeWindowBuffer) which can be later used to create an EGLImage. Bug: angleproject:5018 Tests: angle_end2end_tests --gtest_filter=ImageTest.SourceNativeClientBufferTarget* Change-Id: If78ed7b80ad09629b8c5f5b5a0eb07a548e82e6e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2404320 Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>

  • src/common/android_util.h
  • //
    // Copyright 2018 The ANGLE Project Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style license that can be
    // found in the LICENSE file.
    //
    
    // android_util.h: Utilities for the using the Android platform
    
    #ifndef COMMON_ANDROIDUTIL_H_
    #define COMMON_ANDROIDUTIL_H_
    
    #include <EGL/egl.h>
    #include <EGL/eglext.h>
    
    #include <stdint.h>
    #include <array>
    
    #include "angle_gl.h"
    
    struct ANativeWindowBuffer;
    struct AHardwareBuffer;
    
    namespace angle
    {
    
    namespace android
    {
    
    constexpr std::array<GLenum, 3> kSupportedSizedInternalFormats = {GL_RGBA8, GL_RGB8, GL_RGB565};
    
    ANativeWindowBuffer *ClientBufferToANativeWindowBuffer(EGLClientBuffer clientBuffer);
    EGLClientBuffer AHardwareBufferToClientBuffer(const AHardwareBuffer *hardwareBuffer);
    
    EGLClientBuffer CreateEGLClientBufferFromAHardwareBuffer(int width,
                                                             int height,
                                                             int depth,
                                                             int androidFormat,
                                                             int usage);
    
    void GetANativeWindowBufferProperties(const ANativeWindowBuffer *buffer,
                                          int *width,
                                          int *height,
                                          int *depth,
                                          int *pixelFormat);
    GLenum NativePixelFormatToGLInternalFormat(int pixelFormat);
    int GLInternalFormatToNativePixelFormat(GLenum internalFormat);
    
    AHardwareBuffer *ANativeWindowBufferToAHardwareBuffer(ANativeWindowBuffer *windowBuffer);
    
    uint64_t GetAHBUsage(int eglNativeBufferUsage);
    
    }  // namespace android
    }  // namespace angle
    
    #endif  // COMMON_ANDROIDUTIL_H_