镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

alphaMaskingShaderExample : segmentation fault #76

Closed

Description

@bakercp

For some reason, we are getting a segmentation fault on load. I believe it may have something to do with the size of the ofFBO (or not).

Activity

  1. kalwalt commented on Dec 22, 2012

    @kalwalt

    @bakercp i have the same issue also with PandaboardES

  2. jvcleave commented on Dec 22, 2012

    @jvcleave
    Member

    I get this:

    Program received signal SIGSEGV, Segmentation fault. 0x000879f8 in ofRectangle::ofRectangle(float, float, float, float) ()

  3. jvcleave commented on Dec 22, 2012

    @jvcleave
    Member

    commenting out this line
    https://github.com/openFrameworks-RaspberryPi/openFrameworks/blob/develop-raspberrypi/examples/gl/alphaMaskingShaderExample/src/testApp.cpp#L17

    allows it to run but I then get
    [error] Failed creating shader of type GL_FRAGMENT_SHADER [error] Trying to link GLSL program, but no shaders created yet

  4. kalwalt commented on Dec 22, 2012

    @kalwalt

    @jvcleave good to know! maybe GLES doesn't support GL_ARB_texture_rectangle?

  5. kalwalt commented on Dec 22, 2012

    @kalwalt

    commenting out ofSetWindowShape(width, height);
    but i receive another siggbart:
    Program received signal SIGSEGV, Segmentation fault.
    0x00000000 in ?? ()

  6. jvcleave commented on Dec 22, 2012

    @jvcleave
    Member

    my guess is that the shader isn't GLES compatible - not sure if that would cause a crash though (doesn't on the pi)

  7. kalwalt commented on Dec 22, 2012

    @kalwalt

    converting the shader to non rectangular tex give me the same seg fault. This happen on PandaboardES.

  8. jvcleave commented on Dec 22, 2012

    @jvcleave
    Member

    @kalwalt can you post your conversion? I started to do it but I am GLSL incompatible :)

  9. kalwalt commented on Dec 22, 2012

    @kalwalt

    yes of course, here it is:

    string shaderProgram = " \n

    uniform sampler2D tex0;
    uniform sampler2D maskTex;

    void main (void){
    vec2 pos = gl_TexCoord[0].st;

    vec3 src = texture2D(tex0, pos).rgb;
    float mask = texture2D(maskTex, pos).r;

    gl_FragColor = vec4( src , mask);
    }";
    if the shader will compile than the app won't works but at least we know that the problem reside in the shader.

    @jvcleave let me know if in raspberrypi works

  10. jvcleave commented on Dec 23, 2012

    @jvcleave
    Member

    I get that it compiled but failed to link - I think there may be more
    incompatibilities as the noise.frag and noise.vert from the shaderExamples
    compile and link

  11. jvcleave commented on Dec 23, 2012

    @jvcleave
    Member

    @kalwalt can you try this one - it is working on the RPI for me
    http://www.jvcref.com/files/PI/tests/alphaMaskingShaderExampleGLES2.zip

  12. kalwalt commented on Dec 23, 2012

    @kalwalt

    @jvcleave i will try it!

  13. kalwalt commented on Dec 23, 2012

    @kalwalt

    @jvcleave this not works for me on the PandaboardES look at my console ,running gdb:

    walter@walter-desktop:~/OF-develop-raspberrypi/openFrameworks/examples/gles/alphaMaskingShaderExampleGLES2/bin$ gdb ./alphaMaskingShaderExampleGLES2.app
    GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
    Copyright (C) 2012 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law. Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "arm-linux-gnueabihf".
    For bug reporting instructions, please see:
    http://bugs.launchpad.net/gdb-linaro/...
    Reading symbols from /home/walter/OF-develop-raspberrypi/openFrameworks/examples/gles/alphaMaskingShaderExampleGLES2/bin/alphaMaskingShaderExampleGLES2.app...done.
    (gdb) r
    Starting program: /home/walter/OF-develop-raspberrypi/openFrameworks/examples/gles/alphaMaskingShaderExampleGLES2/bin/alphaMaskingShaderExampleGLES2.app
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
    [ofAppEGLWindow::setupEGL:notice] setting EGL Display
    PVR:(Warning): LoadWSModule: Window system module libpvrws_KMS.so did not validate native display [98, /generic_ws.c]
    PVR:(Warning): LoadWSModule: Window system module libpvrws_WAYLAND.so did not validate native display [98, /generic_ws.c]
    [ofAppEGLWindow::setupEGL:notice] EGL Display correctly set.
    PVR:(Warning): PVRSRVOpenDCDevice: Warning - 138 returned [80, /bridged_pvr_dc_glue.c]
    [ofAppEGLWindow::setupEGL:notice] ofGetCurrentRenderer()->getType()=GLES2
    [ofAppEGLWindow::setupEGL:notice] GLES2 Renderer detected.
    [ofAppEGLWindow::setupEGL:notice] OpenGL ES version
    [notice] GLES2 loading vertex shader from default source
    [notice] GLES2 loading fragment shader from default source
    [ofAppEGLWindow::setupEGL:notice] -----EGL-----
    [ofAppEGLWindow::setupEGL:notice] EGL_VERSION_MAJOR = 1
    [ofAppEGLWindow::setupEGL:notice] EGL_VERSION_MINOR = 4
    [ofAppEGLWindow::setupEGL:notice] EGL_CLIENT_APIS = OpenGL_ES
    [ofAppEGLWindow::setupEGL:notice] EGL_VENDOR = Imagination Technologies
    [ofAppEGLWindow::setupEGL:notice] EGL_VERSION = 1.4 build 1.9@2166536
    [ofAppEGLWindow::setupEGL:notice] EGL_EXTENSIONS = EGL_IMG_client_api_ogl EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_image EGL_KHR_vg_parent_image EGL_KHR_fence_sync EGL_IMG_hibernate_process EGL_WL_bind_wayland_display EGL_KHR_surfaceless_gles2 EGL_NV_post_sub_buffer
    [ofAppEGLWindow::setupEGL:notice] GL_RENDERER =
    [ofAppEGLWindow::setupEGL:notice] GL_VERSION =
    [ofAppEGLWindow::setupEGL:notice] GL_VENDOR =
    [ofAppEGLWindow::setupEGL:notice] -------------
    [ofAppEGLWindow::setupOpenGL:notice] CREATED SCREEN WITH SIZE 1280 x 720
    [ofAppEGLWindow:error] Peripherals not supported on X11
    [ofFbo:verbose] FBO supported
    terminate called after throwing an instance of 'std::logic_error'
    what(): basic_string::_S_construct null not valid

    Program received signal SIGABRT, Aborted.
    __libc_do_syscall ()
    at ../ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S:47
    47 ../ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S: No such file or directory.
    (gdb)

    not sure to have understood the output from gdb, but
    at least now with your GLES2 example the fbo is working partially , with the AlphaMaskingShaderExample i crash suddenly. Maybe it is a limitation on the size of the fbo?

  14. kalwalt commented on Dec 23, 2012

    @kalwalt

    Commenting out all the lines about shader even so i got a seg fault . i think that issue in PandaboardES reside in the fbo. More investigation is needed.

  15. kalwalt commented on Dec 23, 2012

    @kalwalt

    now i'm sure the problem is in allocating the fbo.:
    create an app with only a ofFbo
    fbo.allocate(400,400,GL_RGB);
    it crash allocating it.

  16. 39 remaining items

  17. kalwalt commented on Jan 2, 2013

    @kalwalt

    i did this:
    /*
    // create an EGL rendering eglContext
    EGLint attribute_list_surface_context[] = {
    EGL_CONTEXT_CLIENT_VERSION, glesVersionForContext,
    EGL_NONE
    };
    */
    // create an EGL rendering eglContext
    EGLint attribute_list_surface_context[] = {
    EGL_CONTEXT_CLIENT_VERSION, 2,
    EGL_NONE
    };
    and gave me the some error

    ./alphaMaskingShaderExample_debug.app
    

    [ofAppEGLWindow::createSurface:notice] Setting up EGL Display
    PVR:(Warning): LoadWSModule: Window system module libpvrws_KMS.so did not validate native display [98, /generic_ws.c]
    PVR:(Warning): LoadWSModule: Window system module libpvrws_WAYLAND.so did not validate native display [98, /generic_ws.c]
    [ofAppEGLWindow::createSurface:notice] EGL Display correctly set.
    PVR:(Warning): PVRSRVOpenDCDevice: Warning - 138 returned [80, /bridged_pvr_dc_glue.c]
    [ofAppEGLWindow::createSurface:notice] ofGetCurrentRenderer()->getType()=GLES2
    [ofAppEGLWindow::createSurface:notice] GLES2 Renderer detected.
    [ofAppEGLWindow::createSurface:error] Error creating context. EGL_BAD_CONFIG (Invald frame buffer configuration specified)
    [ofAppEGLWindow::setupPeripherals:notice] Peripherals not supported on X11
    [ofAppEGLWindow::setupOpenGL:notice] Peripheral setup complete.
    [ofAppEGLWindow::runAppViaInfiniteLoop:notice] Entering infinite loop.
    [ofFbo:verbose] FBO supported
    terminate called after throwing an instance of 'std::logic_error'
    what(): basic_string::_S_construct null not valid
    [ofAppRunner:verbose] sighandler : Signal handled 6
    [verbose] OF app is being terminated!
    [ofAppEGLWindow::destroySurface:error] Attempted to destroy uninitialized window.
    walter@walter-desktop:~/OF-develop-raspberrypi/openFrameworks/examples/gl/alphaMaskingShaderExample/bin$

    think that the problem is that eglConfig or attribute_list_surface_context are not set properly

  18. kalwalt commented on Jan 2, 2013

    @kalwalt

    @bakercp i m looking here now at line 539 of ofAppEGLWindow.cpp:

    result = eglChooseConfig(eglDisplay,
    attribute_list_framebuffer_config,
    &eglConfig,
    1, // we only want the first one. if we want more,
    // we need to pass in an array.
    // we are optimistic and don't give it more chances
    // to find a good configuration
    &num_configs);

    according to http://www.khronos.org/registry/egl/sdk/docs/man/xhtml/eglChooseConfig.html

    EGLBoolean eglChooseConfig( EGLDisplay display,
    EGLint const * attrib_list,
    EGLConfig * configs,
    EGLint config_size,
    EGLint * num_config)
    Parameters
    display
    Specifies the EGL display connection.

    attrib_list
    Specifies attributes required to match by configs.

    configs
    Returns an array of frame buffer configurations.

    config_size
    Specifies the size of the array of frame buffer configurations.

    num_config
    Returns the number of frame buffer configurations returned.

    why config_size is set to one ? This means that we have only one config or should be instead the size of the array?

  19. kalwalt commented on Jan 2, 2013

    @kalwalt

    i did the last test framebuffer set to:

    // these are usually set as default, but set them here just to be sure
    frameBufferAttributes[EGL_RED_SIZE] = 5; // 8 bits for red
    frameBufferAttributes[EGL_GREEN_SIZE] = 6; // 8 bits for green
    frameBufferAttributes[EGL_BLUE_SIZE] = 5; // 8 bits for blue
    frameBufferAttributes[EGL_ALPHA_SIZE] = 0; // 8 bits for alpha
    //frameBufferAttributes[EGL_LUMINANCE_SIZE] = EGL_DONT_CARE; // 8 bits for alpha
    //frameBufferAttributes[EGL_DEPTH_SIZE] = 24; // 24 bits for depth
    //frameBufferAttributes[EGL_STENCIL_SIZE] = 8; // 8 bits for stencil
    //frameBufferAttributes[EGL_SAMPLES] = 1;

    and
    result = eglChooseConfig(eglDisplay,
    attribute_list_framebuffer_config,
    &eglConfig,
    settings.frameBufferAttributes.size(),
    &num_configs);

    but gave me the same error:

    (gdb) run
    Starting program: /home/walter/OF-develop-raspberrypi/openFrameworks/examples/gl/alphaMaskingShaderExample/bin/alphaMaskingShaderExample_debug.app
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
    [ofAppEGLWindow::createSurface:notice] Setting up EGL Display
    PVR:(Warning): LoadWSModule: Window system module libpvrws_KMS.so did not validate native display [98, /generic_ws.c]
    PVR:(Warning): LoadWSModule: Window system module libpvrws_WAYLAND.so did not validate native display [98, /generic_ws.c]
    [ofAppEGLWindow::createSurface:notice] EGL Display correctly set.
    PVR:(Warning): PVRSRVOpenDCDevice: Warning - 138 returned [80, /bridged_pvr_dc_glue.c]
    [ofAppEGLWindow::createSurface:notice] ofGetCurrentRenderer()->getType()=GLES2
    [ofAppEGLWindow::createSurface:notice] GLES2 Renderer detected.
    [ofAppEGLWindow::createSurface:error] Error creating context. EGL_BAD_CONFIG (Invald frame buffer configuration specified)
    [ofAppEGLWindow::setupPeripherals:notice] Peripherals not supported on X11
    [ofAppEGLWindow::setupOpenGL:notice] Peripheral setup complete.
    [ofAppEGLWindow::runAppViaInfiniteLoop:notice] Entering infinite loop.
    [ofFbo:verbose] FBO supported
    terminate called after throwing an instance of 'std::logic_error'
    what(): basic_string::_S_construct null not valid

    Program received signal SIGABRT, Aborted.
    __libc_do_syscall ()
    at ../ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S:47
    47 ../ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S: No such file or directory.
    (gdb) bt
    #0 __libc_do_syscall ()
    at ../ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S:47
    #1 0xb6b09e92 in __GI_raise (sig=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:67
    #2 0xb6b0c26c in __GI_abort () at abort.c:91
    #3 0xb6cc65f4 in __gnu_cxx::__verbose_terminate_handler() ()
    from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
    #4 0xb6cc5234 in ?? () from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
    #5 0xb6cc5234 in ?? () from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
    Backtrace stopped: previous frame identical to this frame (corrupt stack?)
    (gdb)

    i think that for today is enough...

  20. bakercp commented on Jan 2, 2013

    @bakercp
    MemberAuthor

    &eglConfig is a pointer to a single EGLConfig single (i.e. the same a pointer to the first element of an array of length 1). config_size is us telling eglChooseConfig that our array is only length 1. When we tell eglChooseConfig that our configs array is of length 1, we are essentially telling it that we want a maximum of one configuration to be generated given our attrib_list. It is possible to receive more than one -- configuration that we can query and choose from. The EGLConfig arrays (if you request more than one) are sorted based on a set criteria (described here http://www.khronos.org/registry/egl/sdk/docs/man/xhtml/eglChooseConfig.html). But, but asking for 1 back, we are asking for its best guess. If it doesn't return at least one, then we know that it won't return others that might be "better."

    If you use

    result = eglChooseConfig(eglDisplay, 
    attribute_list_framebuffer_config, 
    &eglConfig, 
    settings.frameBufferAttributes.size(),
    &num_configs);

    that won't work.

    settings.frameBufferAttributes.size() is the length of the frameBufferAttributes map, which is not relevant. The only place that size is used in to construct the attribute_list_framebuffer_config array. The attribute_list_framebuffer_config consists of keys / values and is terminated by EGL_NONE.

  21. kalwalt commented on Jan 2, 2013

    @kalwalt

    @bakercp I realized that did not make sense what I did. It was just a desperate attempt. However, it is now more clear. I will make another attempt tomorrow. Thanks for your cooperation and help!

  22. bakercp commented on Jan 2, 2013

    @bakercp
    MemberAuthor

    No worries @kalwalt! I know the feeling. I'm looking forward to getting this working. It will soon ... ! We need to get some other pandaboarders to try it out and see what they can make of it.

  23. kalwalt commented on Jan 2, 2013

    @kalwalt

    We need to get some other pandaboarders to try it out and see what they can make of it.

    totally agree with you! we need to make new proselityes...

  24. arturoc commented on Jan 3, 2013

    @arturoc

    it's fixed now, the framebuffer settings where missing the gles version

  25. kalwalt commented on Jan 3, 2013

    @kalwalt

    Hi @arturoc i tested you latest f61f6d3 but get SIGBART

    (gdb) run
    Starting program: /home/walter/OF-develop-raspberrypi/openFrameworks/examples/gl/alphaMaskingShaderExample/bin/alphaMaskingShaderExample_debug
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
    [ofAppEGLWindow::createSurface:notice] Setting up EGL Display
    PVR:(Warning): LoadWSModule: Window system module libpvrws_KMS.so did not validate native display [98, /generic_ws.c]
    PVR:(Warning): LoadWSModule: Window system module libpvrws_WAYLAND.so did not validate native display [98, /generic_ws.c]
    [ofAppEGLWindow::createSurface:notice] EGL Display correctly set.
    PVR:(Warning): PVRSRVOpenDCDevice: Warning - 138 returned [80, /bridged_pvr_dc_glue.c]
    [ofAppEGLWindow::createSurface:notice] ofGetCurrentRenderer()->getType()=GLES2
    [ofAppEGLWindow::createSurface:notice] GLES2 Renderer detected.
    [ofAppEGLWindow::createSurface:notice] Surface created correctly
    [ofAppEGLWindow::createSurface:notice] API Binded correctly
    [ofAppEGLWindow::createSurface:notice] OpenGL ES version
    [notice] GLES2 loading vertex shader from default source
    [notice] GLES2 loading fragment shader from default source
    [ofAppEGLWindow::createSurface:notice] -----EGL-----
    [ofAppEGLWindow::createSurface:notice] EGL_VERSION_MAJOR = 1
    [ofAppEGLWindow::createSurface:notice] EGL_VERSION_MINOR = 4
    [ofAppEGLWindow::createSurface:notice] EGL_CLIENT_APIS = OpenGL_ES
    [ofAppEGLWindow::createSurface:notice] EGL_VENDOR = Imagination Technologies
    [ofAppEGLWindow::createSurface:notice] EGL_VERSION = 1.4 build 1.9@2166536
    [ofAppEGLWindow::createSurface:notice] EGL_EXTENSIONS = EGL_IMG_client_api_ogl EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_image EGL_KHR_vg_parent_image EGL_KHR_fence_sync EGL_IMG_hibernate_process EGL_WL_bind_wayland_display EGL_KHR_surfaceless_gles2 EGL_NV_post_sub_buffer
    [ofAppEGLWindow::createSurface:notice] GL_RENDERER =
    [ofAppEGLWindow::createSurface:notice] GL_VERSION =
    [ofAppEGLWindow::createSurface:notice] GL_VENDOR =
    [ofAppEGLWindow::createSurface:notice] -------------
    [ofAppEGLWindow::setupPeripherals:notice] Peripherals not supported on X11
    [ofAppEGLWindow::setupOpenGL:notice] Peripheral setup complete.
    [ofAppEGLWindow::runAppViaInfiniteLoop:notice] Entering infinite loop.
    terminate called after throwing an instance of 'std::logic_error'
    what(): basic_string::_S_construct null not valid

    Program received signal SIGABRT, Aborted.
    __libc_do_syscall ()
    at ../ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S:47
    47 ../ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S: No such file or directory.
    (gdb) bt
    #0 __libc_do_syscall ()
    at ../ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S:47
    #1 0xb6b09e92 in __GI_raise (sig=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:67
    #2 0xb6b0c26c in __GI_abort () at abort.c:91
    #3 0xb6cc65f4 in __gnu_cxx::__verbose_terminate_handler() ()
    from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
    #4 0xb6cc5234 in ?? () from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
    #5 0xb6cc5234 in ?? () from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
    Backtrace stopped: previous frame identical to this frame (corrupt stack?)
    (gdb)

    i think there is a significant progress but something went wrong after , see these lines

    [ofAppEGLWindow::createSurface:notice] GL_RENDERER =
    [ofAppEGLWindow::createSurface:notice] GL_VERSION =
    [ofAppEGLWindow::createSurface:notice] GL_VENDOR =

    are empty instead we should have some info.
    Did you tested on this example or on something else?
    Thank you.

  26. arturoc commented on Jan 3, 2013

    @arturoc

    you need to change the order of the libraries in libs/openframeworksCompiled/project/linuxarmv7 from:

    PLATFORM_PKG_CONFIG_LIBRARIES += glesv1_cm
    PLATFORM_PKG_CONFIG_LIBRARIES += glesv2

    to

    PLATFORM_PKG_CONFIG_LIBRARIES += glesv2
    PLATFORM_PKG_CONFIG_LIBRARIES += glesv1_cm

    that should solve the problem. this is not ideal, we can add a variable in config.make that allows to swtich this from the project config

  27. kalwalt commented on Jan 3, 2013

    @kalwalt

    ok i will try it!

  28. kalwalt commented on Jan 3, 2013

    @kalwalt

    @arturoc this works perfecty!!
    WOW!
    we can definitely close this issue!

  29. added a commit that references this issue on Jun 16, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions