Shader linking check fails on big endian
When trying to activate Accelerated Graphics on a big endian system, pcbnew says that the shader linking failed, even though it actually succeeded. The reason is this line in SHADER::Link()
:
glGetObjectParameterivARB( programNumber, GL_OBJECT_LINK_STATUS_ARB,
(GLint*) &isShaderLinked );
isShaderLinked
is a bool
(size 1), so casting it to a pointer to GLint
(size 4) and sending it to glGetObjectParameterivARB
is going to write outside the object, clobbering neighboring fields. On a big endian system, "outside the object" is also where the actual bit of information is going to end up, leaving isShadedLinked
with the value 0. But even on little endian this is not safe programming.
Merge Request imminent...
Application: Pcbnew
Version: (5.99.0-1013-gdaa41c663), release build
Libraries:
wxWidgets 3.0.4
libcurl/7.66.0 OpenSSL/1.1.1d zlib/1.2.11 libidn2/2.1.1
Platform: Linux 5.4.21 ppc64, 64 bit, Big endian, wxGTK
Build Info:
Build date: Mar 1 2020 18:52:48
wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
Boost: 1.72.0
OpenCASCADE Community Edition: 6.9.1
Curl: 7.66.0
Compiler: GCC 9.2.0 with C++ ABI 1013
Build settings:
KICAD_SCRIPTING=OFF
KICAD_SCRIPTING_MODULES=OFF
KICAD_SCRIPTING_PYTHON3=OFF
KICAD_SCRIPTING_WXPYTHON=OFF
KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
KICAD_SCRIPTING_ACTION_MENU=OFF
BUILD_GITHUB_PLUGIN=ON
KICAD_USE_OCE=ON
KICAD_USE_OCC=OFF
KICAD_SPICE=ON