patriciogonzalezvivo / glslViewer

Console-based GLSL Sandbox for 2D/3D shaders
BSD 3-Clause "New" or "Revised" License
4.62k stars 350 forks source link

Stack overflow - segmentation fault with OpenGLES2 #267

Closed avafinger closed 2 years ago

avafinger commented 2 years ago

I get a segmentation fault while calling sandbox.setup(files, commands) with command line:

glslViewer _2D/00tests/test.frag

I am running with OpenGL ES2. Can you give some advice to debug this? Increasing the stack does not help.

Debug Output: Calling: ada::initGL (window_viewport, window_properties); glfwMakeContextCurrent(window) glfwMakeContextCurrent(window) OK! glfwSetKeyCallback OK! glfwSetMouseButtonCallback! glfwSetScrollCallback OK setViewport(_viewport.z, _viewport.w) setViewport(_viewport.z, _viewport.w) OK! int initGL is at return 0; ada::initGL (window_viewport, window_properties) done! title and watcher OK! sandbox.verbose sandbox.setup IN Segmentation fault

==10293== Conditional jump or move depends on uninitialised value(s)
==10293==    at 0x3F7DC4: ada::Shader::compileShader(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, bool) (in /home/rock/opengles/glslViewer/build/glslViewer)
==10293==    by 0x3F6E97: ada::Shader::load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, bool) (in /home/rock/opengles/glslViewer/build/glslViewer)
==10293==    by 0x37A5AF: Sandbox::reloadShaders(std::vector<WatchFile, std::allocator<WatchFile> >&) (in /home/rock/opengles/glslViewer/build/glslViewer)
==10293==    by 0x3791F3: Sandbox::setup(std::vector<WatchFile, std::allocator<WatchFile> >&, std::vector<Command, std::allocator<Command> >&) (in /home/rock/opengles/glslViewer/build/glslViewer)
==10293==    by 0x35B4FB: main (in /home/rock/opengles/glslViewer/build/glslViewer)
==10293==  Uninitialised value was created by a stack allocation
==10293==    at 0x3F7568: ada::Shader::compileShader(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, bool) (in /home/rock/opengles/glslViewer/build/glslViewer)
==10293== 
==10293== Conditional jump or move depends on uninitialised value(s)
==10293==    at 0x3F7DC4: ada::Shader::compileShader(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, bool) (in /home/rock/opengles/glslViewer/build/glslViewer)
==10293==    by 0x3F6E97: ada::Shader::load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, bool) (in /home/rock/opengles/glslViewer/build/glslViewer)
==10293==    by 0x3F6EFF: ada::Shader::load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, bool) (in /home/rock/opengles/glslViewer/build/glslViewer)
==10293==    by 0x37A5AF: Sandbox::reloadShaders(std::vector<WatchFile, std::allocator<WatchFile> >&) (in /home/rock/opengles/glslViewer/build/glslViewer)
==10293==    by 0x3791F3: Sandbox::setup(std::vector<WatchFile, std::allocator<WatchFile> >&, std::vector<Command, std::allocator<Command> >&) (in /home/rock/opengles/glslViewer/build/glslViewer)
==10293==    by 0x35B4FB: main (in /home/rock/opengles/glslViewer/build/glslViewer)
==10293==  Uninitialised value was created by a stack allocation
==10293==    at 0x3F7568: ada::Shader::compileShader(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, bool) (in /home/rock/opengles/glslViewer/build/glslViewer)
==10293== 
==10293== Conditional jump or move depends on uninitialised value(s)
==10293==    at 0x3F7DC4: ada::Shader::compileShader(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, bool) (in /home/rock/opengles/glslViewer/build/glslViewer)
==10293==    by 0x3F6E97: ada::Shader::load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, bool) (in /home/rock/opengles/glslViewer/build/glslViewer)
==10293==    by 0x3F6EFF: ada::Shader::load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, bool) (in /home/rock/opengles/glslViewer/build/glslViewer)
==10293==    by 0x3F6EFF: ada::Shader::load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, bool) (in /home/rock/opengles/glslViewer/build/glslViewer)
==10293==    by 0x37A5AF: Sandbox::reloadShaders(std::vector<WatchFile, std::allocator<WatchFile> >&) (in /home/rock/opengles/glslViewer/build/glslViewer)
==10293==    by 0x3791F3: Sandbox::setup(std::vector<WatchFile, std::allocator<WatchFile> >&, std::vector<Command, std::allocator<Command> >&) (in /home/rock/opengles/glslViewer/build/glslViewer)
==10293==    by 0x35B4FB: main (in /home/rock/opengles/glslViewer/build/glslViewer)
==10293==  Uninitialised value was created by a stack allocation
==10293==    at 0x3F7568: ada::Shader::compileShader(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, bool) (in /home/rock/opengles/glslViewer/build/glslViewer)
==10293== 
==10293== Stack overflow in thread #1: can't grow stack to 0x1ffe801000
==10293== 
==10293== Process terminating with default action of signal 11 (SIGSEGV)
==10293==  Access not within mapped region at address 0x1FFE801EE0
==10293== Stack overflow in thread #1: can't grow stack to 0x1ffe801000
==10293==    at 0x4CC556C: vfprintf (vfprintf.c:1239)
==10293==  If you believe this happened as a result of a stack
==10293==  overflow in your program's main thread (unlikely but
==10293==  possible), you can try to increase the size of the
==10293==  main thread stack using the --main-stacksize= flag.
==10293==  The main thread stack size used in this run was 8388608.
==10293== Stack overflow in thread #1: can't grow stack to 0x1ffe801000
==10293== 
==10293== Process terminating with default action of signal 11 (SIGSEGV)
==10293==  Access not within mapped region at address 0x1FFE801E60
==10293== Stack overflow in thread #1: can't grow stack to 0x1ffe801000
==10293==    at 0x4832630: _vgnU_freeres (vg_preloaded.c:59)
==10293==  If you believe this happened as a result of a stack
==10293==  overflow in your program's main thread (unlikely but
==10293==  possible), you can try to increase the size of the
==10293==  main thread stack using the --main-stacksize= flag.
==10293==  The main thread stack size used in this run was 8388608.
==10293== 
==10293== HEAP SUMMARY:
==10293==     in use at exit: 9,903,853 bytes in 35,721 blocks
==10293==   total heap usage: 191,524 allocs, 155,803 frees, 25,559,863 bytes allocated
==10293== 
==10293== LEAK SUMMARY:
==10293==    definitely lost: 4,560 bytes in 3 blocks
==10293==    indirectly lost: 672 bytes in 14 blocks
==10293==      possibly lost: 2,076,384 bytes in 312 blocks
==10293==    still reachable: 7,822,237 bytes in 35,392 blocks
==10293==                       of which reachable via heuristic:
==10293==                         stdstring          : 20,748 bytes in 598 blocks
==10293==                         length64           : 14,216 bytes in 176 blocks
==10293==         suppressed: 0 bytes in 0 blocks
==10293== Rerun with --leak-check=full to see details of leaked memory
==10293== 
==10293== For counts of detected and suppressed errors, rerun with: -v
==10293== ERROR SUMMARY: 22740 errors from 44 contexts (suppressed: 0 from 0)
patriciogonzalezvivo commented 2 years ago

HI do you mind sharing:

  1. What OS are you working?
  2. Did you compile the binary yourself? did you install one of the released binaries? what version?
  3. What was the full command you run?
avafinger commented 2 years ago

Hi @patriciogonzalezvivo

  • What OS are you working?
lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 10 (buster)
Release:    10
Codename:   buster

My setup is a nanopi-m4 Rockchip rk3399 with hardware acceleration (mali GPU).

arm_release_ver of this libmali is 'r18p0-01rel0', rk_so_ver is '4'.
Using display 0x555c8c9bd0 with EGL version 1.4
EGL Version "1.4 Midgard-"r18p0-01rel0""
EGL Vendor "ARM"
EGL Extensions "EGL_KHR_partial_update EGL_KHR_image_pixmap EGL_EXT_image_dma_buf_import EGL_KHR_config_attribs EGL_KHR_image EGL_KHR_image_base EGL_KHR_fence_sync EGL_KHR_wait_sync EGL_KHR_gl_colorspace EGL_KHR_get_all_proc_addresses EGL_IMG_context_priority EGL_ARM_pixmap_multisample_discard EGL_ARM_implicit_external_sync EGL_KHR_gl_texture_2D_image EGL_KHR_gl_renderbuffer_image EGL_KHR_create_context EGL_KHR_surfaceless_context EGL_KHR_gl_texture_cubemap_image EGL_EXT_create_context_robustness"
GL Extensions: "GL_ARM_rgba8 GL_ARM_mali_shader_binary GL_OES_depth24 GL_OES_depth_texture GL_OES_depth_texture_cube_map GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_EXT_read_format_bgra GL_OES_compressed_paletted_texture GL_OES_compressed_ETC1_RGB8_texture GL_OES_standard_derivatives GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_EGL_image_external_essl3 GL_OES_EGL_sync GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_required_internalformat GL_OES_vertex_array_object GL_OES_mapbuffer GL_EXT_texture_format_BGRA8888 GL_EXT_texture_rg GL_EXT_texture_type_2_10_10_10_REV GL_OES_fbo_render_mipmap GL_OES_element_index_uint GL_EXT_shadow_samplers GL_OES_texture_compression_astc GL_KHR_texture_compression_astc_ldr GL_KHR_texture_compression_astc_hdr GL_KHR_texture_compression_astc_sliced_3d GL_KHR_debug GL_EXT_occlusion_query_boolean GL_EXT_disjoint_timer_query GL_EXT_blend_minmax GL_EXT_discard_framebuffer GL_OES_get_program_binary GL_OES_texture_3D GL_EXT_texture_storage GL_EXT_multisampled_render_to_texture GL_OES_surfaceless_context GL_OES_texture_stencil8 GL_EXT_shader_pixel_local_storage GL_ARM_shader_framebuffer_fetch GL_ARM_shader_framebuffer_fetch_depth_stencil GL_ARM_mali_program_binary GL_EXT_sRGB GL_EXT_sRGB_write_control GL_EXT_texture_sRGB_decode GL_EXT_texture_sRGB_R8 GL_EXT_texture_sRGB_RG8 GL_KHR_blend_equation_advanced GL_KHR_blend_equation_advanced_coherent GL_OES_texture_storage_multisample_2d_array GL_OES_shader_image_atomic GL_EXT_robustness GL_EXT_draw_buffers_indexed GL_OES_draw_buffers_indexed GL_EXT_texture_border_clamp GL_OES_texture_border_clamp GL_EXT_texture_cube_map_array GL_OES_texture_cube_map_array GL_OES_sample_variables GL_OES_sample_shading GL_OES_shader_multisample_interpolation GL_EXT_shader_io_blocks GL_OES_shader_io_blocks GL_EXT_tessellation_shader GL_OES_tessellation_shader GL_EXT_primitive_bounding_box GL_OES_primitive_bounding_box GL_EXT_geometry_shader GL_OES_geometry_shader GL_ANDROID_extension_pack_es31a GL_EXT_gpu_shader5 GL_OES_gpu_shader5 GL_EXT_texture_buffer GL_OES_texture_buffer GL_EXT_copy_image GL_OES_copy_image GL_EXT_color_buffer_half_float GL_EXT_color_buffer_float GL_EXT_YUV_target GL_OVR_multiview GL_OVR_multiview2 GL_OVR_multiview_multisampled_render_to_texture GL_KHR_robustness GL_KHR_robust_buffer_access_behavior GL_EXT_draw_elements_base_vertex GL_OES_draw_elements_base_vertex "

I can see glsViewer is linked with GL and not GLES, how can i enforce the use of GLES?

ldd ./glslViewer 
    linux-vdso.so.1 (0x0000007fb07b0000)
    libncurses.so.6 => /lib/aarch64-linux-gnu/libncurses.so.6 (0x0000007fb0260000)
    libtinfo.so.6 => /lib/aarch64-linux-gnu/libtinfo.so.6 (0x0000007fb0222000)
    libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000007fb01f3000)
    libdl.so.2 => /lib/aarch64-linux-gnu/libdl.so.2 (0x0000007fb01df000)
    libatomic.so.1 => /lib/aarch64-linux-gnu/libatomic.so.1 (0x0000007fb01c6000)
    librt.so.1 => /lib/aarch64-linux-gnu/librt.so.1 (0x0000007fb01ae000)
    libGLX.so.0 => /lib/aarch64-linux-gnu/libGLX.so.0 (0x0000007fb016c000)
    libOpenGL.so.0 => /lib/aarch64-linux-gnu/libOpenGL.so.0 (0x0000007fb00fc000)
    libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000007fb003f000)
    libstdc++.so.6 => /lib/aarch64-linux-gnu/libstdc++.so.6 (0x0000007fafeb4000)
    libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1 (0x0000007fafe90000)
    libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000007fafd1e000)
    /lib/ld-linux-aarch64.so.1 (0x0000007fb0782000)
    libX11.so.6 => /lib/aarch64-linux-gnu/libX11.so.6 (0x0000007fafbd3000)
    libXext.so.6 => /lib/aarch64-linux-gnu/libXext.so.6 (0x0000007fafbb3000)
    libGLdispatch.so.0 => /lib/aarch64-linux-gnu/libGLdispatch.so.0 (0x0000007fafa84000)
    libxcb.so.1 => /lib/aarch64-linux-gnu/libxcb.so.1 (0x0000007fafa4d000)
    libXau.so.6 => /lib/aarch64-linux-gnu/libXau.so.6 (0x0000007fafa3a000)
    libXdmcp.so.6 => /lib/aarch64-linux-gnu/libXdmcp.so.6 (0x0000007fafa24000)
    libbsd.so.0 => /lib/aarch64-linux-gnu/libbsd.so.0 (0x0000007faf9fe000)
rock@nanopi-m4:~/DRM$ cd ..
rock@nanopi-m4:~$ gcc --version
gcc (Debian 8.3.0-6) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

rock@nanopi-m4:~$ g++ --version
g++ (Debian 8.3.0-6) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  • Did you compile the binary yourself? did you install one of the released binaries? what version?

I have compiled it from the source code (latest git). No pre-built released binary installed, only from source code.

  • What was the full command you run?

cd examples glslViewer 2D/00_tests/test.frag or with some printing info to see where it crashed ../build/glslViewer 2D/00_tests/test.frag

So, can you instruct how to build it with full debug info? Looks like some variables might have not been initialized during the compileShader(). Are there any restrictions to running with OpenGL ES2 ?

I was wondering if is not possible for you to update to the latest glfw, i have the latest glfw (git) running in my setup but you use some previous versions during build and link. I don't think this is the problem.

avafinger commented 2 years ago

Just an update. The rendering part is to be done with OpenGLES2, and that seems to be working.

cd examples

Running command line: ./build/glslViewer --verbose 2D/00_tests/test.frag &> err_debug3.txt

something like:

Calling: ada::initGL (window_viewport, window_properties);
arm_release_ver of this libmali is 'r18p0-01rel0', rk_so_ver is '4'.glfwMakeContextCurrent(window)
glfwMakeContextCurrent(window) OK!
glfwSetKeyCallback OK!
glfwSetMouseButtonCallback!
glfwSetScrollCallback OK
setViewport(_viewport.z, _viewport.w)
setViewport(_viewport.z, _viewport.w) OK!
int initGL is at return 0;
ada::initGL (window_viewport, window_properties) done!
title and watcher OK!
sandbox.verbose
Specs:

  - Vendor: terminate called after throwing an instance of 'std::logic_error'
rgb:FF/19/19
rgb:CC/CC/CC
rgb:99/99/99
rgb:66/66/66
what():  basic_string::_M_construct null not valid

Running command line: ../build/glslViewer 2D/00_tests/test.frag &> err_debug4.txt


Calling: ada::initGL (window_viewport, window_properties);
arm_release_ver of this libmali is 'r18p0-01rel0', rk_so_ver is '4'.glfwMakeContextCurrent(window)
glfwMakeContextCurrent(window) OK!
glfwSetKeyCallback OK!
glfwSetMouseButtonCallback!
glfwSetScrollCallback OK
setViewport(_viewport.z, _viewport.w)
setViewport(_viewport.z, _viewport.w) OK!
int initGL is at return 0;
ada::initGL (window_viewport, window_properties) done!
title and watcher OK!
sandbox.verbose
sandbox.setup IN
rgb:FF/19/19
rgb:CC/CC/CC
rgb:99/99/99
rgb:66/66/66

?[H
   ?[H?(0?[0mlqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk?(B?[2;1H?(0?[0mx?(B>?[80G?(0?[0mx?(B?[3;1H?(0?[0mmqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj?(B?[2;4H?(0?[0m?(B?[H?[J

?[H
   ?[H?(0?[0mlqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk?(B?[2;1H?(0?[0mx?(B>?[80G?(0?[0mx?(B?[3;1H?(0?[0mmqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj?(B?[2;4H?(0?[0m?(B

err_debug.tar.gz

patriciogonzalezvivo commented 2 years ago

Question, are you running glslViewer from a X11 enviroment? or directly from the terminal? Seams you compiled the GLFW which only works inside X11 environment. It should take care of compiling against OpenGL ES 2. But in the case of you wanting to specify it here you can change it https://github.com/patriciogonzalezvivo/ada/blob/e83950d91d8fee930655090406e73cb902581659/src/CMakeLists.txt#L230-L237

avafinger commented 2 years ago

Question, are you running glslViewer from a X11 enviroment?

yes, X11. glfw only works with X11 (and OpenGLES2). I will try to understand what you proposed and enforce GLES.

patriciogonzalezvivo commented 2 years ago

There is a #define flag call PLATFORM_RPI added when you are compiling on a Raspberry Pi, which skip some of the more advance GPU features and replace them with some that this limited GPU have ( related to missing extensions ). Maybe you can try replacing this https://github.com/patriciogonzalezvivo/ada/blob/main/src/CMakeLists.txt#L231b for this one https://github.com/patriciogonzalezvivo/ada/blob/main/src/CMakeLists.txt#L67

to

avafinger commented 2 years ago

hi @patriciogonzalezvivo ,

I need to add the include search for deps/ada/deps/glfw/deps on your cmake, can you help?

rock@nanopi-m4:~/opengles/glslViewer-dev/build$ cmake ..
-- Including X11 support
-- OPENGL_LIBRARIES: /usr/lib/aarch64-linux-gnu/libOpenGL.so;/usr/lib/aarch64-linux-gnu/libGLX.so
-- OPENGL_opengl_LIBRARY: /usr/lib/aarch64-linux-gnu/libOpenGL.so
-- Could NOT find FFMPEG (missing: FFMPEG_LIBRARIES FFMPEG_LIBRARY_DIRS FFMPEG_INCLUDE_DIRS) 
-- Checking for modules 'libavdevice;libavfilter;libavformat;libavcodec;libswresample;libswscale;libavutil'
--   No package 'libavdevice' found
--   No package 'libavfilter' found
--   No package 'libavformat' found
--   No package 'libavcodec' found
--   No package 'libswresample' found
--   No package 'libswscale' found
--   No package 'libavutil' found
-- USING GLFW DRIVERS
-- PLATFORM LINUX
-- KHR/usr/include
-- EGL_INCLUDE_DIRS:       /usr/include
-- EGL_LIBRARIES:          /usr/lib/aarch64-linux-gnu/libEGL.so
-- GLESv2_INCLUDE_DIRS:    /usr/include;/usr/include
-- GLESv2_LIBRARIES:       /usr/lib/aarch64-linux-gnu/libGLESv2.so
-- If you are using the static library build, please keep in mind (and inform yourself of the implications) that liblo is licensed with LGPL v2.1+.
-- package_details.cmake: your architecture is arm64
-- Configuring done
-- Generating done
-- Build files have been written to: /home/rock/opengles/glslViewer-dev/build
rock@nanopi-m4:~/opengles/glslViewer-dev/build$ make
[ 13%] Built target lo_static
[ 38%] Built target glfw
[ 41%] Built target stb
[ 43%] Built target glob
[ 45%] Built target skymodel
[ 46%] Building CXX object deps/ada/src/CMakeFiles/ada.dir/window.cpp.o
In file included from /home/rock/opengles/glslViewer-dev/deps/ada/include/ada/window.h:3,
                 from /home/rock/opengles/glslViewer-dev/deps/ada/src/window.cpp:1:
/home/rock/opengles/glslViewer-dev/deps/ada/include/ada/gl/gl.h:83:14: fatal error: glad/gles2.h: No such file or directory
     #include <glad/gles2.h>
              ^~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [deps/ada/src/CMakeFiles/ada.dir/build.make:63: deps/ada/src/CMakeFiles/ada.dir/window.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:480: deps/ada/src/CMakeFiles/ada.dir/all] Error 2
make: *** [Makefile:152: all] Error 2
avafinger commented 2 years ago

reverted that change, no need for that.

facing this error:

[ 86%] Building CXX object CMakeFiles/glslViewer.dir/src/io/gltf.cpp.o
In file included from /home/rock/opengles/glslViewer-dev/src/io/gltf.cpp:32:
/home/rock/opengles/glslViewer-dev/deps/tinygltf/tiny_gltf.h: In function ‘bool tinygltf::WriteImageData(const string*, const string*, tinygltf::Image*, bool, void*)’:
/home/rock/opengles/glslViewer-dev/deps/tinygltf/tiny_gltf.h:2439:10: error: ‘stbi_write_jpg_to_func’ was not declared in this scope
     if (!stbi_write_jpg_to_func(WriteToMemory_stbi, &data, image->width,
          ^~~~~~~~~~~~~~~~~~~~~~
/home/rock/opengles/glslViewer-dev/deps/tinygltf/tiny_gltf.h:2439:10: note: suggested alternative: ‘stbi_write_png_to_func’
     if (!stbi_write_jpg_to_func(WriteToMemory_stbi, &data, image->width,
          ^~~~~~~~~~~~~~~~~~~~~~
          stbi_write_png_to_func
make[2]: *** [CMakeFiles/glslViewer.dir/build.make:76: CMakeFiles/glslViewer.dir/src/io/gltf.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:79: CMakeFiles/glslViewer.dir/all] Error 2
make: *** [Makefile:152: all] Error 2
avafinger commented 2 years ago

I got it working. There seem to be some issues with rendering, i believe. But i have to learn more about your nice tool.

../build/glslViewer --verbose 3D/00_pipeline/00_background.frag 3D/00_pipeline/head.ply
arm_release_ver of this libmali is 'r18p0-01rel0', rk_so_ver is '4'.sandbox.verbose
Specs:

  - Vendor: ARM
  - Renderer: Mali-T860
  - Version: OpenGL ES 3.2 v1.r18p0-01rel0.5cb5681058e8e076ff89747c20c32578
  - GLSL version: OpenGL ES GLSL ES 3.20
  - Extensions: GL_ARM_rgba8 GL_ARM_mali_shader_binary GL_OES_depth24 GL_OES_depth_texture GL_OES_depth_texture_cube_map GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_EXT_read_format_bgra GL_OES_compressed_paletted_texture GL_OES_compressed_ETC1_RGB8_texture GL_OES_standard_derivatives GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_EGL_image_external_essl3 GL_OES_EGL_sync GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_required_internalformat GL_OES_vertex_array_object GL_OES_mapbuffer GL_EXT_texture_format_BGRA8888 GL_EXT_texture_rg GL_EXT_texture_type_2_10_10_10_REV GL_OES_fbo_render_mipmap GL_OES_element_index_uint GL_EXT_shadow_samplers GL_OES_texture_compression_astc GL_KHR_texture_compression_astc_ldr GL_KHR_texture_compression_astc_hdr GL_KHR_texture_compression_astc_sliced_3d GL_KHR_debug GL_EXT_occlusion_query_boolean GL_EXT_disjoint_timer_query GL_EXT_blend_minmax GL_EXT_discard_framebuffer GL_OES_get_program_binary GL_OES_texture_3D GL_EXT_texture_storage GL_EXT_multisampled_render_to_texture GL_OES_surfaceless_context GL_OES_texture_stencil8 GL_EXT_shader_pixel_local_storage GL_ARM_shader_framebuffer_fetch GL_ARM_shader_framebuffer_fetch_depth_stencil GL_ARM_mali_program_binary GL_EXT_sRGB GL_EXT_sRGB_write_control GL_EXT_texture_sRGB_decode GL_EXT_texture_sRGB_R8 GL_EXT_texture_sRGB_RG8 GL_KHR_blend_equation_advanced GL_KHR_blend_equation_advanced_coherent GL_OES_texture_storage_multisample_2d_array GL_OES_shader_image_atomic GL_EXT_robustness GL_EXT_draw_buffers_indexed GL_OES_draw_buffers_indexed GL_EXT_texture_border_clamp GL_OES_texture_border_clamp GL_EXT_texture_cube_map_array GL_OES_texture_cube_map_array GL_OES_sample_variables GL_OES_sample_shading GL_OES_shader_multisample_interpolation GL_EXT_shader_io_blocks GL_OES_shader_io_blocks GL_EXT_tessellation_shader GL_OES_tessellation_shader GL_EXT_primitive_bounding_box GL_OES_primitive_bounding_box GL_EXT_geometry_shader GL_OES_geometry_shader GL_ANDROID_extension_pack_es31a GL_EXT_gpu_shader5 GL_OES_gpu_shader5 GL_EXT_texture_buffer GL_OES_texture_buffer GL_EXT_copy_image GL_OES_copy_image GL_EXT_color_buffer_half_float GL_EXT_color_buffer_float GL_EXT_YUV_target GL_OVR_multiview GL_OVR_multiview2 GL_OVR_multiview_multisampled_render_to_texture GL_KHR_robustness GL_KHR_robust_buffer_access_behavior GL_EXT_draw_elements_base_vertex GL_OES_draw_elements_base_vertex 
  - Implementation limits: 
      + GL_MAX_TEXTURE_SIZE = 8192
sandbox.setup IN

Image 1: ../build/glslViewer --verbose 3D/00_pipeline/00_background.frag 3D/00_pipeline/head.ply glslViewer

Image 2: (passed the wrong parameters and got this) ../build/glslViewer --verbode 3D/00_pipeline/00_background.frag 3D/00_pipeline/head.ply glslViewer-2

I will try to join your channel and learn more about how to use it. The fix was to force the linking with GLES2v2 and EGL (from rockchip).

Thank you for your work and for the advice.