在 Zenfone Deluxe 2 上使用 setEGLConfigChooser 时 OpenGL 应用程序崩溃
OpenGL app crashes when using setEGLConfigChooser on Zenfone Deluxe 2
我有一个 Android 应用程序使用 GLSurfaceView
进行渲染。该应用程序适用于我们所有的设备,除了一个:我们的 Zenfone Deluxe 2。在我们的 GLSurfaceView
构造函数中我做
setEGLConfigChooser(
8, 8, 8, 8, // rgba
24, // depth
8); // stencil
这总是有效,除了 Zenfone Deluxe 2 崩溃,给出以下堆栈跟踪:
10-13 10:37:07.975 10066-10066/com.my.company.demo V/Monotype: SetAppTypeFace- try to flip, app = com.my.company.demo
10-13 10:37:07.975 10066-10066/com.my.company.demo V/Monotype: Typeface getFontPathFlipFont - systemFont = default#default
10-13 10:37:08.045 10066-10066/com.my.company.demo W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
10-13 10:37:08.065 10066-10066/com.my.company.demo V/Monotype: SetAppTypeFace- try to flip, app = com.my.company.demo
10-13 10:37:08.065 10066-10066/com.my.company.demo V/Monotype: Typeface getFontPathFlipFont - systemFont = default#default
10-13 10:37:08.335 10066-10107/com.my.company.demo D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
10-13 10:37:08.405 10066-10107/com.my.company.demo I/OpenGLRenderer: Initialized EGL, version 1.4
10-13 10:37:08.405 10066-10107/com.my.company.demo W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
10-13 10:37:08.415 10066-10105/com.my.company.demo E/AndroidRuntime: FATAL EXCEPTION: GLThread 1298
Process: com.my.company.demo, PID: 10066
java.lang.RuntimeException: createContext failed: EGL_BAD_CONFIG
at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1196)
at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1187)
at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:1037)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1404)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1243)
然后我简单地取消了对 setEGLConfigChooser
的调用的注释,然后应用程序运行正常。然后 OpenGL 为 RGBA 提供 (8, 8, 8, 0)
,为深度缓冲区提供 24
,为模板缓冲区提供 8
。好的,然后我在 setEGLConfigChooser
中设置了这些值,但是应用程序仍然崩溃并显示相同的输出。
我不知道该怎么做或如何解决它。 setEGLConfigChooser
的 documentation 状态
Install a config chooser which will choose a config with at least the specified depthSize and stencilSize, and exactly the specified redSize, greenSize, blueSize and alphaSize.
If this method is called, it must be called before setRenderer(Renderer) is called.
If no setEGLConfigChooser method is called, then by default the view will choose an RGB_888 surface with a depth buffer depth of at least 16 bits.
这对这个问题没有多大帮助。可能是什么问题?我非常希望能够以更通用的方式调用 setEGLConfigChooser
以定位所有设备。
更多设备信息:
Zenfone Deluxe 2 是一款配备 PowerVR Rogue G6430 GPU 的 x86 设备。我已经下载并安装了最新的软件更新。
gl10.glGetString(GL10.GL_VENDOR);
给出 "Imagination Technologies"
gl10.glGetString(GL10.GL_RENDERER);
给出 "PowerVR Rogue G6430"
gl10.glGetString(GL10.GL_VERSION);
给出 "OpenGL ES 3.1 build 1.5@3830101"
gl10.glGetString(GL10.GL_EXTENSIONS);
给出
GL_EXT_debug_marker
GL_EXT_blend_minmax
GL_EXT_color_buffer_float
GL_EXT_copy_image
GL_EXT_discard_framebuffer
GL_EXT_draw_buffers
GL_EXT_draw_buffers_indexed
GL_EXT_geometry_shader
GL_EXT_geometry_point_size
GL_EXT_gpu_shader5
GL_EXT_multi_draw_arrays
GL_EXT_multisampled_render_to_texture
GL_EXT_occlusion_query_boolean
GL_EXT_primitive_bounding_box
GL_EXT_pvrtc_sRGB
GL_EXT_read_format_bgra
GL_EXT_robustness
GL_EXT_separate_shader_objects
GL_EXT_shader_framebuffer_fetch
GL_EXT_shader_io_blocks
GL_EXT_shader_pixel_local_storage
GL_EXT_shader_texture_lod
GL_EXT_shadow_samplers
GL_EXT_tessellation_shader
GL_EXT_tessellation_point_size
GL_EXT_texture_border_clamp
GL_EXT_texture_buffer
GL_EXT_texture_cube_map_array
GL_EXT_texture_filter_anisotropic
GL_EXT_texture_format_BGRA8888
GL_EXT_texture_rg
GL_EXT_texture_sRGB_decode
GL_IMG_multisampled_render_to_texture
GL_IMG_program_binary
GL_IMG_read_format
GL_IMG_shader_binary
GL_IMG_texture_compression_pvrtc
GL_IMG_texture_compression_pvrtc2
GL_IMG_texture_format_BGRA8888
GL_IMG_texture_npot
GL_KHR_blend_equation_advanced
GL_KHR_blend_equation_advanced_coherent
GL_KHR_debug
GL_OES_compressed_ETC1_RGB8_texture
GL_OES_depth24
GL_OES_depth_texture
GL_OES_EGL_image
GL_OES_EGL_image_external
GL_OES_EGL_image_external_essl3
GL_OES_EGL_sync
GL_OES_element_index_uint
GL_OES_fragment_precision_high
GL_OES_draw_buffers_indexed
GL_OES_get_program_binary
GL_OES_mapbuffer
GL_OES_packed_depth_stencil
GL_OES_required_internalformat
GL_OES_rgb8_rgba8
GL_OES_sample_shading
GL_OES_sample_variables
GL_OES_shader_image_atomic
GL_OES_shader_multisample_interpolation
GL_OES_standard_derivatives
GL_OES_surfaceless_context
GL_OES_texture_float
GL_OES_texture_half_float
GL_OES_texture_npot
GL_OES_texture_stencil8
GL_OES_texture_storage_multisample_2d_array
GL_OES_vertex_array_object
GL_OES_vertex_half_float
如果你看看旧的 MultisampleConfigChooser, the depth is only 16 bits and the stencil is only 1. Also, after cycling through the EGL 1.4 specification,我没有找到任何关于支持的最小模板、深度和颜色缓冲区大小的声明。
您可以尝试使用较小的数字,但如果您想选择最好的数字,则可能需要使其变得更复杂。
它崩溃的原因是因为我在 setEGLContextClientVersion()
之前调用了setEGLConfigChooser()
。在消除崩溃后移动呼叫,它仍然适用于其他设备。有关崩溃原因的更多信息,请参见 this 答案。
我有一个 Android 应用程序使用 GLSurfaceView
进行渲染。该应用程序适用于我们所有的设备,除了一个:我们的 Zenfone Deluxe 2。在我们的 GLSurfaceView
构造函数中我做
setEGLConfigChooser(
8, 8, 8, 8, // rgba
24, // depth
8); // stencil
这总是有效,除了 Zenfone Deluxe 2 崩溃,给出以下堆栈跟踪:
10-13 10:37:07.975 10066-10066/com.my.company.demo V/Monotype: SetAppTypeFace- try to flip, app = com.my.company.demo
10-13 10:37:07.975 10066-10066/com.my.company.demo V/Monotype: Typeface getFontPathFlipFont - systemFont = default#default
10-13 10:37:08.045 10066-10066/com.my.company.demo W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
10-13 10:37:08.065 10066-10066/com.my.company.demo V/Monotype: SetAppTypeFace- try to flip, app = com.my.company.demo
10-13 10:37:08.065 10066-10066/com.my.company.demo V/Monotype: Typeface getFontPathFlipFont - systemFont = default#default
10-13 10:37:08.335 10066-10107/com.my.company.demo D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
10-13 10:37:08.405 10066-10107/com.my.company.demo I/OpenGLRenderer: Initialized EGL, version 1.4
10-13 10:37:08.405 10066-10107/com.my.company.demo W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
10-13 10:37:08.415 10066-10105/com.my.company.demo E/AndroidRuntime: FATAL EXCEPTION: GLThread 1298
Process: com.my.company.demo, PID: 10066
java.lang.RuntimeException: createContext failed: EGL_BAD_CONFIG
at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1196)
at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1187)
at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:1037)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1404)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1243)
然后我简单地取消了对 setEGLConfigChooser
的调用的注释,然后应用程序运行正常。然后 OpenGL 为 RGBA 提供 (8, 8, 8, 0)
,为深度缓冲区提供 24
,为模板缓冲区提供 8
。好的,然后我在 setEGLConfigChooser
中设置了这些值,但是应用程序仍然崩溃并显示相同的输出。
我不知道该怎么做或如何解决它。 setEGLConfigChooser
的 documentation 状态
Install a config chooser which will choose a config with at least the specified depthSize and stencilSize, and exactly the specified redSize, greenSize, blueSize and alphaSize.
If this method is called, it must be called before setRenderer(Renderer) is called.
If no setEGLConfigChooser method is called, then by default the view will choose an RGB_888 surface with a depth buffer depth of at least 16 bits.
这对这个问题没有多大帮助。可能是什么问题?我非常希望能够以更通用的方式调用 setEGLConfigChooser
以定位所有设备。
更多设备信息:
Zenfone Deluxe 2 是一款配备 PowerVR Rogue G6430 GPU 的 x86 设备。我已经下载并安装了最新的软件更新。
gl10.glGetString(GL10.GL_VENDOR);
给出"Imagination Technologies"
gl10.glGetString(GL10.GL_RENDERER);
给出"PowerVR Rogue G6430"
gl10.glGetString(GL10.GL_VERSION);
给出"OpenGL ES 3.1 build 1.5@3830101"
gl10.glGetString(GL10.GL_EXTENSIONS);
给出GL_EXT_debug_marker GL_EXT_blend_minmax GL_EXT_color_buffer_float GL_EXT_copy_image GL_EXT_discard_framebuffer GL_EXT_draw_buffers GL_EXT_draw_buffers_indexed GL_EXT_geometry_shader GL_EXT_geometry_point_size GL_EXT_gpu_shader5 GL_EXT_multi_draw_arrays GL_EXT_multisampled_render_to_texture GL_EXT_occlusion_query_boolean GL_EXT_primitive_bounding_box GL_EXT_pvrtc_sRGB GL_EXT_read_format_bgra GL_EXT_robustness GL_EXT_separate_shader_objects GL_EXT_shader_framebuffer_fetch GL_EXT_shader_io_blocks GL_EXT_shader_pixel_local_storage GL_EXT_shader_texture_lod GL_EXT_shadow_samplers GL_EXT_tessellation_shader GL_EXT_tessellation_point_size GL_EXT_texture_border_clamp GL_EXT_texture_buffer GL_EXT_texture_cube_map_array GL_EXT_texture_filter_anisotropic GL_EXT_texture_format_BGRA8888 GL_EXT_texture_rg GL_EXT_texture_sRGB_decode GL_IMG_multisampled_render_to_texture GL_IMG_program_binary GL_IMG_read_format GL_IMG_shader_binary GL_IMG_texture_compression_pvrtc GL_IMG_texture_compression_pvrtc2 GL_IMG_texture_format_BGRA8888 GL_IMG_texture_npot GL_KHR_blend_equation_advanced GL_KHR_blend_equation_advanced_coherent GL_KHR_debug GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth24 GL_OES_depth_texture GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_EGL_image_external_essl3 GL_OES_EGL_sync GL_OES_element_index_uint GL_OES_fragment_precision_high GL_OES_draw_buffers_indexed GL_OES_get_program_binary GL_OES_mapbuffer GL_OES_packed_depth_stencil GL_OES_required_internalformat GL_OES_rgb8_rgba8 GL_OES_sample_shading GL_OES_sample_variables GL_OES_shader_image_atomic GL_OES_shader_multisample_interpolation GL_OES_standard_derivatives GL_OES_surfaceless_context GL_OES_texture_float GL_OES_texture_half_float GL_OES_texture_npot GL_OES_texture_stencil8 GL_OES_texture_storage_multisample_2d_array GL_OES_vertex_array_object GL_OES_vertex_half_float
如果你看看旧的 MultisampleConfigChooser, the depth is only 16 bits and the stencil is only 1. Also, after cycling through the EGL 1.4 specification,我没有找到任何关于支持的最小模板、深度和颜色缓冲区大小的声明。
您可以尝试使用较小的数字,但如果您想选择最好的数字,则可能需要使其变得更复杂。
它崩溃的原因是因为我在 setEGLContextClientVersion()
之前调用了setEGLConfigChooser()
。在消除崩溃后移动呼叫,它仍然适用于其他设备。有关崩溃原因的更多信息,请参见 this 答案。