OpenGL은 3D 그래픽 처리 하드웨어의 표준 소프트웨어 인터페이스를 지정하는 크로스 플랫폼 그래픽 API입니다. OpenGL ES는 삽입된 기기용 OpenGL 사양의 하위 집합입니다.
Android 호환 기기는 EGL, OpenGL ES 1.x, OpenGL ES 2.0용 드라이버를 제공해야 합니다. OpenGL ES 3.x 지원은 선택사항입니다. 주요 고려사항은 다음과 같습니다.
GL 드라이버가 뛰어난 성능을 발휘하고 OpenGL ES 표준을 준수하도록 합니다.
GL 컨텍스트를 무제한으로 허용합니다. Android는 백그라운드에서 앱을 허용하고 GL 컨텍스트를 활성 상태로 유지하기 때문에 드라이버의 컨텍스트 수를 제한해서는 안 됩니다.
한번에 20~30개의 활성 GL 컨텍스트를 갖는 것이 일반적이므로 각 컨텍스트에 할당되는 메모리의 양에 주의해야 합니다.
YV12 이미지 형식 및 미디어 코덱 또는 카메라와 같이 시스템의 다른 구성 요소에서 가져온 기타 YUV 이미지 형식을 지원합니다.
필수 확장 프로그램인 EGL_KHR_wait_sync, GL_OES_texture_external, EGL_ANDROID_image_native_buffer, EGL_ANDROID_recordable을 지원합니다. 또한 Hardware Composer v1.1 이상에서는 EGL_ANDROID_framebuffer_target 확장 프로그램이 필요합니다.
EGL_ANDROID_blob_cache, EGL_KHR_fence_sync, EGL_ANDROID_native_fence_sync도 지원하는 것이 좋습니다.
Android는 시스템 이미지가 빌드될 때 시스템에서 사용 가능한 GPU를 식별할 수 있어야 합니다. 32비트 및 64비트 OpenGL ES 드라이버의 기본 경로는 각각 /vendor/lib/egl 및 /vendor/lib64/egl입니다.
로더는 두 시스템 속성인 ro.hardware.egl 및 ro.board.platform 또는 정확한 이름을 사용하여 시스템 드라이버를 검색하고 로드합니다. OpenGL ES 드라이버는 하나의 바이너리로 제공되거나 3개의 바이너리로 분할되어야 합니다. OpenGL ES 드라이버가 하나의 바이너리로 제공되는 경우 다음 이름 중 하나를 사용합니다.
Android 10에는 GLES 2.0 이상의 레이어 시스템이 도입되었습니다. GLES 레이어는 앱 내에서 제공하거나 도구에서 제공하는 공유 객체입니다. GLES 레이어를 사용하면 디버그 가능한 앱에서 Vulkan과 동일한 설정 메커니즘을 사용하여 레이어를 검색하고 로드할 수 있습니다.
EGL 로더 내의 구성요소인 GLES LayerLoader는 GLES 레이어를 식별합니다.
GLES LayerLoader가 찾은 각 레이어의 경우 GLES LayerLoader는 AndroidGLESLayer_Initialize를 호출하고 libEGL의 함수 목록을 탐색하고 알려진 모든 함수에 대해 AndroidGLESLayer_GetProcAddress를 호출합니다.
레이어는 함수를 가로채는 경우 함수의 주소를 추적합니다.
레이어가 함수를 가로채지 않으면 AndroidGLESLayer_GetProcAddress는 전달된 것과 동일한 함수 주소를 반환합니다. 그런 다음 LayerLoader는 함수 후크 목록을 업데이트하여 레이어의 진입점을 가리킵니다.
레이어 사용 설정
전역적으로 또는 앱별로 GLES 레이어를 사용 설정할 수 있습니다. 앱별 설정은 재부팅을 거쳐도 지속되는 반면, 전역 속성은 재부팅 시 지워집니다.
adb shell settings delete global enable_gpu_debug_layersadb shell settings delete global gpu_debug_appadb shell settings delete global gpu_debug_layer_app
전역적으로 레이어 사용 설정하기:
# Attempts to load layers for all applications, including native executablesadbshellsetpropdebug.gles.layerslayer1:layer2:...:layerN
레이어 테스트
GLES 레이어는 Android CTS를 기반으로 작동하며 CTS의 호환 기기 테스트를 통과해야 합니다. 레이어가 기기에서 작동하는지 확인하려면 $ atest CtsGpuToolsHostTestCases를 실행합니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-27(UTC)"],[],[],null,["# Implement OpenGL ES and EGL\n\n[OpenGL](https://www.opengl.org/) is a cross-platform graphics\nAPI that specifies a standard software\ninterface for 3D graphics processing hardware. [OpenGL ES](https://www.khronos.org/opengles/) is a subset of the\nOpenGL specification for embedded devices.\n\nTo be Android [compatible](/docs/compatibility/overview), devices\nneed to provide drivers for EGL, OpenGL ES 1.x, and OpenGL ES 2.0. Support\nfor OpenGL ES 3.x is optional. Key considerations include:\n\n- Ensuring that the GL driver is robust and conforms to OpenGL ES standards.\n- Allowing an unlimited number of GL contexts. Because Android allows apps in the background and tries to keep GL contexts alive, you shouldn't limit the number of contexts in your driver.\n- Being mindful of the amount of memory allocated for each context, because it's common to have 20--30 active GL contexts at once.\n- Supporting the YV12 image format and other YUV image formats that come from other components in the system, such as media codecs or the camera.\n- Supporting the mandatory extensions `EGL_KHR_wait_sync`, `GL_OES_texture_external`, `EGL_ANDROID_image_native_buffer`, and `EGL_ANDROID_recordable`. Additionally, Hardware Composer v1.1 and higher require the `EGL_ANDROID_framebuffer_target` extension.\n\nIt's highly recommended to also support `EGL_ANDROID_blob_cache`,\n`EGL_KHR_fence_sync`, and\n`EGL_ANDROID_native_fence_sync`.\n\nAndroid 10 implements the [EGL 1.5 interface](https://www.khronos.org/registry/EGL/specs/eglspec.1.5.pdf). For information on new features in\nEGL 1.5, see the [Khronos Releases 1.5 Specification](https://www.khronos.org/news/press/khronos-releases-egl-1.5-specification).\n| **Note:** The OpenGL API exposed to app developers differs from the OpenGL implemented on the device. Apps can't directly access the GL driver layer and must go through the interface provided by the APIs.\n\nDriver loading\n--------------\n\nAndroid expects the GPUs available to the system to be known when the system\nimage is built. The preferred paths for 32-bit and 64-bit OpenGL ES drivers are\n`/vendor/lib/egl` and `/vendor/lib64/egl` respectively.\nThe [loader](https://android.googlesource.com/platform/frameworks/native/+/refs/heads/android16-release/opengl/libs/EGL/Loader.h) uses two system properties,\n`ro.hardware.egl` and `ro.board.platform`, or the exact\nname to discover and load the system drivers. The OpenGL ES driver must be\nshipped in either one binary or split into three binaries. If the OpenGL ES\ndriver is shipped in one binary, use one of the following names: \n\n```genshi\nlibGLES_${ro.hardware.egl}.so\nlibGLES_${ro.board.platform}.so\nlibGLES.so\n```\n\nIf the OpenGL ES driver is shipped into three binaries, use one of the\nfollowing name sets: \n\n```genshi\nlibEGL_${ro.hardware.egl}.so\nlibGLESv1_CM_${ro.hardware.egl}.so\nlibGLESv2_${ro.hardware.egl}.so\n\nlibEGL_${ro.board.platform}.so\nlibGLESv1_CM_${ro.board.platform}.so\nlibGLESv2_${ro.board.platform}.so\n\nlibEGL.so\nlibGLESv1_CM.so\nlibGLESv2.so\n```\n\nOpenGL ES layers\n----------------\n\nAndroid 10 introduces a layering system for GLES\n2.0+. GLES layers are shared objects available from within apps or provided by\ntools. GLES layers enable debuggable apps to discover and load layers using the\nsame setup mechanisms as\n[Vulkan](https://developer.android.com/ndk/guides/graphics/validation-layer#vl-adb).\n| **Caution:** When layering is enabled, GLES 1.x exclusive functions continue to route to GLES 1.x drivers, but functions shared with GLES 2.0+ are routed to 2.0+ drivers.\n\nGLES LayerLoader, a component within the EGL loader, identifies GLES layers.\nFor each layer the GLES LayerLoader finds, the GLES LayerLoader\ncalls `AndroidGLESLayer_Initialize`, walks libEGL's function lists,\nand calls `AndroidGLESLayer_GetProcAddress` for all known functions.\nIf the layer intercepts a function, it tracks the function's address.\nIf the layer doesn't intercept a function,\n`AndroidGLESLayer_GetProcAddress` returns the same function\naddress it was passed. The LayerLoader then updates the function hook list to\npoint to the layer's entry point.\n\n### Enable layers\n\n| **Note:** Android's security model and policies differ significantly from other platforms. Android only enables those who have root access to load GLES layers from a device's local storage. Without root access, GLES layers can only be loaded for debuggable apps.\n\nYou can enable GLES layers either per app or globally. Per-app settings\npersist across reboots, while global properties are cleared on reboot.\n\nTo enable layers *per app*: \n\n # Enable layers\n adb shell settings put global enable_gpu_debug_layers 1\n\n # Specify target app\n adb shell settings put global gpu_debug_app \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003epackage_name\u003c/span\u003e\u003c/var\u003e\n\n # Specify layer list (from top to bottom)\n adb shell settings put global gpu_debug_layers_gles \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003elayer1\u003c/span\u003e\u003c/var\u003e:\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003elayer2\u003c/span\u003e\u003c/var\u003e:\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-o\"\u003e...\u003c/span\u003e\u003c/var\u003e:\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003elayerN\u003c/span\u003e\u003c/var\u003e\n\n # Specify packages to search for layers\n adb shell settings put global gpu_debug_layer_app \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003epackage1\u003c/span\u003e\u003c/var\u003e:\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003epackage2\u003c/span\u003e\u003c/var\u003e:\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-o\"\u003e...\u003c/span\u003e\u003c/var\u003e:\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003epackageN\u003c/span\u003e\u003c/var\u003e\n\nTo disable layers *per app*: \n\n adb shell settings delete global enable_gpu_debug_layers\n adb shell settings delete global gpu_debug_app\n adb shell settings delete global gpu_debug_layer_app\n\nTo enable layers *globally*: \n\n # Attempts to load layers for all applications, including native executables\n adb shell setprop debug.gles.layers \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003elayer1\u003c/span\u003e\u003c/var\u003e:\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003elayer2\u003c/span\u003e\u003c/var\u003e:\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-o\"\u003e...\u003c/span\u003e\u003c/var\u003e:\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003elayerN\u003c/span\u003e\u003c/var\u003e\n\n### Test layers\n\nGLES layers are backed by Android CTS and are required to pass CTS tests for\n[compatible devices](/docs/compatibility/overview). To identify if layers\nare working on a device, run `$ atest CtsGpuToolsHostTestCases`."]]