android - android ndk opengl creating protected context
问题描述
I am trying to create a protected context using opengl on android.
I am basing my code off of: https://github.com/googlesamples/android-ndk
Using the native activity as my base.
I have changed the EGL parameters to the following:
EGLint context_attribs[] = {
EGL_CONTEXT_CLIENT_VERSION, 3,
0x32C0, EGL_TRUE,
EGL_NONE,
};
EGLint surface_attribs[] = {
0x32C0, EGL_TRUE,
EGL_NONE,
};
And things seem to work on most devices, but a few devices are giving strange behavior (phone crashes, or not displaying at all, even though they claim to support protected contexts). A good example is the s9 qualcomm edition runs fine, until anything appears on the screen (overlay, navbar slide down, or sliding the samsung side-bar) which will result in a phone reboot.
Is there something I may have missed with setting up the protected contexts?
According to the khronos docs: https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_protected_content.txt
0x32c0 is the correct number for protected content.
--------------EDIT--------------
I swapped 0x32c0 over to EGL_PROTECTED_CONTENT_EXT, and checked the extensions, and EGL_EXT_protected_content does exist. There are two devices I am working with that are having problems with this specifically (Samsung Galaxy s9+ qualcomm and Samsung Galaxy Tab S2). The S2 claims it supports the protected context, but then after using it, I get EGL_BAD_ALLOC. On the S9, everything runs fine, no errors, but the device will consistently crash on me after using it for a little.
解决方案
为什么使用 0x32C0 而不是令牌名称:EGL_PROTECTED_CONTENT_EXT?
您是否查询过扩展字符串“EGL_EXT_protected_content”在受支持的扩展中?这应该是你做的第一件事。
您是否尝试执行任何不允许的操作?可能导致崩溃。
从 eglCreateSurface 和 eglCreateContext 检查您的错误。EGL_BAD_ATTRIBUTE 表示不支持。
推荐阅读
- database-design - 为什么 facebook messenger 和 discord 使用数据库而不是排队系统来获取他们的消息?
- google-apps-script - 无法在清单文件中设置会议解决方案的密钥
- javascript - 根据用户事件在 Firebase 托管中自动创建新页面(JAVASCRIPT)
- php - 为什么我的 echo json_encode($data) 实际上会在我的页面上显示某些内容以及如何避免这种情况(ajax/php 表单验证)
- typescript - NestJs - DTO 和实体
- schema.org - JobPosting 架构问题:数字不是 baseSalary 属性的已知有效目标类型
- tensorflow - 无法在 Keras 中导入 AttentionLayer (TF1.13)
- cmake - 如何在 GNU make 的 cmake 中包含由自定义命令生成的依赖文件?
- python - 无法使用 Pipenv 缓存对 Github Actions 的依赖项
- c# - 以编程方式添加到 DataGridView 单元格的 ComboBox 未在单元格单击时展开