Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/angle
Path: blob/main_old/src/common/android_util.h
1693 views
1
//
2
// Copyright 2018 The ANGLE Project Authors. All rights reserved.
3
// Use of this source code is governed by a BSD-style license that can be
4
// found in the LICENSE file.
5
//
6
7
// android_util.h: Utilities for the using the Android platform
8
9
#ifndef COMMON_ANDROIDUTIL_H_
10
#define COMMON_ANDROIDUTIL_H_
11
12
#include <EGL/egl.h>
13
#include <EGL/eglext.h>
14
15
#include <stdint.h>
16
#include <array>
17
18
#include "angle_gl.h"
19
20
struct ANativeWindowBuffer;
21
struct AHardwareBuffer;
22
23
namespace angle
24
{
25
26
namespace android
27
{
28
29
constexpr std::array<GLenum, 3> kSupportedSizedInternalFormats = {GL_RGBA8, GL_RGB8, GL_RGB565};
30
31
ANativeWindowBuffer *ClientBufferToANativeWindowBuffer(EGLClientBuffer clientBuffer);
32
EGLClientBuffer AHardwareBufferToClientBuffer(const AHardwareBuffer *hardwareBuffer);
33
AHardwareBuffer *ClientBufferToAHardwareBuffer(EGLClientBuffer clientBuffer);
34
35
EGLClientBuffer CreateEGLClientBufferFromAHardwareBuffer(int width,
36
int height,
37
int depth,
38
int androidFormat,
39
int usage);
40
41
void GetANativeWindowBufferProperties(const ANativeWindowBuffer *buffer,
42
int *width,
43
int *height,
44
int *depth,
45
int *pixelFormat,
46
uint64_t *usage);
47
GLenum NativePixelFormatToGLInternalFormat(int pixelFormat);
48
int GLInternalFormatToNativePixelFormat(GLenum internalFormat);
49
50
bool NativePixelFormatIsYUV(int pixelFormat);
51
52
AHardwareBuffer *ANativeWindowBufferToAHardwareBuffer(ANativeWindowBuffer *windowBuffer);
53
54
uint64_t GetAHBUsage(int eglNativeBufferUsage);
55
56
} // namespace android
57
} // namespace angle
58
59
#endif // COMMON_ANDROIDUTIL_H_
60
61