Adreno220帧缓冲对象

时间:2012-03-09 07:11:40

标签: framebuffer

我制作了一个示例JNI android app。

适用于Galaxy Note(Mali 400MP),但不适用于SGS2LTE(Adreno 220)。

我认为它在制作FBO时存在问题。

cpp代码在

之下
// Create Depth Buffer;
GL_CMD(glGenFramebuffers(1, &m_depthBuffer))
GL_CMD(glBindRenderbuffer(GL_RENDERBUFFER, m_depthBuffer))
GL_CMD(glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, m_width, m_height))
GL_CMD(glBindRenderbuffer(GL_RENDERBUFFER, 0))
// Create Stencil Buffer;
GL_CMD(glGenFramebuffers(1, &m_stencilBuffer))
GL_CMD(glBindRenderbuffer(GL_RENDERBUFFER, m_stencilBuffer))
GL_CMD(glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, m_width, m_height))
GL_CMD(glBindRenderbuffer(GL_RENDERBUFFER, 0))

// Construct FBO
GL_CMD(glGenFramebuffers(1, &m_fbo))
GL_CMD(glBindFramebuffer(GL_FRAMEBUFFER, m_fbo))
GL_CMD(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureId, 0))
GL_CMD(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthBuffer))
GL_CMD(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_stencilBuffer))

GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE) {
    LOGE("Check Frame Buffer Status Failed : %x", status);
    return;
}

GL_CMD(glClear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT))

状态表示0x8CDD(GL_FRAMEBUFFER_UNSUPPORTED_EXT)。

我附上了Logcat。

01-03 03:59:32.829: D/libEGL(24851): loaded /system/lib/egl/libGLES_android.so
01-03 03:59:32.829: D/libEGL(24851): loaded /system/lib/egl/libEGL_adreno200.so
01-03 03:59:32.839: D/libEGL(24851): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
01-03 03:59:32.839: D/libEGL(24851): loaded /system/lib/egl/libGLESv2_adreno200.so
01-03 03:59:32.849: W/EglHelper(24851): createContext com.google.android.gles_jni.EGLContextImpl@40529b80 tid=1
01-03 03:59:32.869: D/Surface(24851): Surface is full screen
01-03 03:59:32.899: D/Surface(24851): Surface is full screen
01-03 03:59:32.899: W/EglHelper(24851): start() tid=1
01-03 03:59:32.909: W/EglHelper(24851): createContext com.google.android.gles_jni.EGLContextImpl@4052afc0 tid=1
01-03 03:59:32.909: W/EglHelper(24851): createSurface()  tid=1
01-03 03:59:32.939: D/dalvikvm(24851): Note: class Landroid/opengl/GLWrapperBase; has 211 unimplemented (abstract) methods
01-03 03:59:32.939: I/EGLUtils(24851): GL Version = OpenGL ES 2.0 1566933
01-03 03:59:32.939: I/EGLUtils(24851): GL Vendor = Qualcomm
01-03 03:59:32.949: I/EGLUtils(24851): GL Renderer = Adreno (TM) 220
01-03 03:59:32.949: I/EGLUtils(24851): GL Extensions = GL_AMD_compressed_ATC_texture GL_AMD_performance_monitor GL_AMD_program_binary_Z400 GL_EXT_texture_filter_anisotropic GL_EXT_texture_format_BGRA8888 GL_EXT_texture_type_2_10_10_10_REV GL_NV_fence GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_depth24 GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_fragment_precision_high GL_OES_get_program_binary GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_vertex_type_10_10_10_2 GL_QCOM_alpha_test GL_QCOM_binning_control GL_QCOM_driver_control GL_QCOM_perfmon_global_mode GL_QCOM_extended_get GL_QCOM_extended_get2 GL_QCOM_tiled_rendering GL_QCOM_writeonly_rendering GL_QCOM_memory_monitor GL_AMD_compressed_3DC_texture 
01-03 03:59:32.979: I/GLUtils(24851): EGL Extensions : EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_ANDROID_image_native_buffer EGL_ANDROID_swap_rectangle EGL_ANDROID_get_render_buffer 
01-03 03:59:32.989: I/GLUtils(24851): GL Extensions : GL_AMD_compressed_ATC_texture GL_AMD_performance_monitor GL_AMD_program_binary_Z400 GL_EXT_texture_filter_anisotropic GL_EXT_texture_format_BGRA8888 GL_EXT_texture_type_2_10_10_10_REV GL_NV_fence GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_depth24 GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_fragment_precision_high GL_OES_get_program_binary GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_vertex_type_10_10_10_2 GL_QCOM_alpha_test GL_QCOM_binning_control GL_QCOM_driver_control GL_QCOM_perfmon_global_mode GL_QCOM_extended_get GL_QCOM_extended_get2 GL_QCOM_tiled_rendering GL_QCOM_writeonly_rendering GL_QCOM_memory_monitor GL_AMD_compressed_3DC_texture 
01-03 03:59:32.989: I/SharedTexture(24851): imageEGL: 0 syncKHR: 0
01-03 03:59:33.009: D/CLIPBOARD(24851): Hide Clipboard dialog at Starting input: finished by someone else... !
**01-03 03:59:33.039: E/AGRE(24851): Check Frame Buffer Status Failed : 8cdd**

它如何在Adreno 220上运行?

2 个答案:

答案 0 :(得分:0)

您是否检查了glCheckFramebufferStatus()返回的确切值?如果是GL_FRAMEBUFFER_UNSUPPORTED,您应该尝试忽略错误并继续执行。

答案 1 :(得分:0)

尝试使用GL_OES_packed_depth_stencil而不是单独的深度/模板渲染缓冲区。有关详细信息,请参阅http://www.khronos.org/registry/gles/extensions/OES/OES_packed_depth_stencil.txt。在使用之前,您需要检查设备是否确实支持此扩展。这就是Adreno 220的情况。