Android 在Zenfone Deluxe 2上使用setEGLConfigChooser时OpenGL应用程序崩溃
我有一个Android应用程序,它使用Android 在Zenfone Deluxe 2上使用setEGLConfigChooser时OpenGL应用程序崩溃,android,opengl-es,opengl-es-2.0,glsurfaceview,Android,Opengl Es,Opengl Es 2.0,Glsurfaceview,我有一个Android应用程序,它使用GLSurfaceView进行渲染。该应用程序适用于我们的所有设备,只有一台除外:Zenfone Deluxe 2。在我们的GLSurfaceView构造函数中,我是这样做的 setEGLConfigChooser( 8, 8, 8, 8, // rgba 24, // depth 8); // stencil 除Zenfone Deluxe 2崩溃外,这始终有效,并提供以下堆栈跟踪: 10-13 1
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
中设置了这些值,但是应用程序仍然会以相同的输出崩溃
我不知道该怎么做,也不知道该如何解决。forsetEGLConfigChooser
状态
安装一个配置选择器,该选择器将选择至少具有指定的depthSize和stencilSize的配置,并且恰好具有指定的redSize、greenSize、blueSize和alphaSize
如果调用此方法,则必须在调用setRenderer(渲染器)之前调用它
如果未调用setEGLConfigChooser方法,则默认情况下,视图将选择深度缓冲区深度至少为16位的RGB_888曲面
这在这个问题上没有多大帮助。问题是什么?我非常希望能够以更通用的方式调用setEGLConfigChooser
,以针对所有设备
更多设备信息:
Zenfone Deluxe 2是一款x86设备,带有PowerVR Rogue G6430 GPU。我已下载并安装了可能的最新软件更新
提供了gl10.glGetString(gl10.glu供应商)
“想象技术”
gl10.glGetString(gl10.glu渲染器)代码>给出了“PowerVR Rogue G6430”
gl10.glGetString(gl10.glu版本)代码>给出了OpenGL ES 3.1构建1。5@3830101“
gl10.glGetString(gl10.glu扩展名)代码>给出
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
您可以使用较小的数字进行尝试,但如果要选择可用的最佳数字,可能需要使其更复杂。它崩溃的原因是因为我在
setEGLContextClientVersion()之前调用了setEGLConfigChooser()
。在发生故障后移动呼叫可以消除故障,并且在其他设备上仍能正常工作。有关它崩溃原因的更多信息,请参见答案。我的问题不在于选择哪个值,而在于在一个特定设备的setEGLConfigChooser
中崩溃,而我的所有其他设备在调用它时都能正常工作。当使用设备在不调用setEGLConfigChooser
时提供的完全相同的配置时,它也会崩溃。EGL\u BAD\u config肯定意味着崩溃是由于您传入的配置不正确引起的。因此,这意味着你必须小心选择哪些值。