ptitSeb / gl4es

GL4ES is a OpenGL 2.1/1.5 to GL ES 2.0/1.1 translation library, with support for Pandora, ODroid, OrangePI, CHIP, Raspberry PI, Android, Emscripten and AmigaOS4.
http://ptitseb.github.io/gl4es/
MIT License
711 stars 160 forks source link

No thread safety #34

Open Icenowy opened 7 years ago

Icenowy commented 7 years ago

I tested the thread safety of gl4es with glthreads program in the mesa-demos package.

It hangs.

icenowy@x220i [ gl4es@master ] $ LD_LIBRARY_PATH=~/git-repos/gl4es/build/lib LIBGL_ES=2 glthreads 
LIBGL: Initialising gl4es
LIBGL: v1.0.2 built on Oct 22 2017 19:23:58
LIBGL: Using GLES 2.0 backend
LIBGL:loaded: libGLESv2.so
LIBGL:loaded: libEGL.so
LIBGL: Using GLES 2.0 backend
LIBGL: Extension GL_EXT_blend_minmax detected and used
LIBGL: Extension glBlendColor found and used
LIBGL: Extension GL_OES_element_index_uint detected
LIBGL: FBO are in core, and so used
LIBGL: Extension GL_OES_packed_depth_stencil detected and used
LIBGL: Extension GL_OES_depth24 detected and used
LIBGL: Extension GL_OES_rgb8_rgba8 detected and used
LIBGL: Extension GL_EXT_multi_draw_arrays detected and used
LIBGL: Extension GL_EXT_texture_format_BGRA8888 detected and used
LIBGL: Extension GL_OES_depth_texture detected and used
LIBGL: Extension GL_EXT_texture_rg detected
LIBGL: Extension GL_OES_texture_float detected
LIBGL: Extension GL_EXT_frag_depth detected and used
LIBGL: Max vertex attrib: 16
LIBGL: Max texture size: 8192
LIBGL: Texture Units: 8(8), Max lights: 8, Max planes: 6
LIBGL: Implementation Read is GL_BGRA/GL_UNSIGNED_BYTE
LIBGL: Targeting OpenGL 2.0
LIBGL: Current folder is:/home/icenowy/git-repos/gl4es
glthreads: test of GL thread safety (any key = exit)
Usage:
  glthreads [options]
Options:
   -display DISPLAYNAME  Specify display string
   -n NUMTHREADS  Number of threads to create
   -p  Use a separate display connection for each thread
   -l  Use application-side locking
   -t  Enable texturing
Keyboard:
   Esc  Exit
   t    Change texture image (requires -t option)
   a    Toggle animation
   s    Step rotation (when not animating)
glthreads: No explict locking.
glthreads: Single display connection.
XInitThreads() returned 1 (success)
glthreads: creating windows
glthreads: creating threads
glthreads: Created thread 0x7f02c8b66700
glthreads: Created thread 0x7f02c0365700
glthreads: 0: GL_RENDERER = GLES_CM wrapper
glthreads: 1: GL_RENDERER = GLES_CM wrapper
Segmentation fault (core dumped)
icenowy@x220i [ gl4es@master ] ! glthreads 
glthreads: test of GL thread safety (any key = exit)
Usage:
  glthreads [options]
Options:
   -display DISPLAYNAME  Specify display string
   -n NUMTHREADS  Number of threads to create
   -p  Use a separate display connection for each thread
   -l  Use application-side locking
   -t  Enable texturing
Keyboard:
   Esc  Exit
   t    Change texture image (requires -t option)
   a    Toggle animation
   s    Step rotation (when not animating)
glthreads: No explict locking.
glthreads: Single display connection.
XInitThreads() returned 1 (success)
glthreads: creating windows
glthreads: creating threads
glthreads: Created thread 0x7f2632823700
glthreads: Created thread 0x7f2632022700
glthreads: 0: GL_RENDERER = Mesa DRI Intel(R) Sandybridge Mobile 
glthreads: 1: GL_RENDERER = Mesa DRI Intel(R) Sandybridge Mobile 
ptitSeb commented 7 years ago

Yes, there is no code to make it thread safe for now.

I'll probably work on that later, but that's not in my short term plan.