this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fixes to support Raspberry Pi

Raspberry Pi is a armv7-a cortex-a7 with NEON. It's default OS is
Raspbian which is a Debian offshoot. From a build environment
perspective, it is almost indistiguishable from any other Debian based
Linux.

Pi supports OpenGL ES 2.0. Some of the code assumed iOS or Android, so
this needed to be fixed.

It appeared link_libraries was giving me problems early on, so I changed
to target_link_libraries. I'm not sure if this change is still needed,
but link_libraries is deprecated, so it's probably a good change
regardless.

There seems to be a bug in the Pi libraries for glBlendEquationOES,
glBlendEquationSeparateOES, glBlendFuncSpearateOES. Despite the
headers, these symbols are missing in the library, but exist
without the OES suffix. A hack to use the non-OES names is
employed.

Eric Wing 1c4b1806 7e177815

+56 -10
+17 -3
CMakeLists.txt
··· 21 21 set(SDL_gpu_DEFAULT_BUILD_DEMOS OFF) 22 22 set(SDL_gpu_DEFAULT_DISABLE_OPENGL ON) 23 23 set(SDL_gpu_DEFAULT_DISABLE_GLES OFF) 24 + elseif(("${CMAKE_SYSTEM}" MATCHES "Linux") AND ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm")) 25 + 26 + # Assuming Raspberry Pi 2 for now. 27 + # There is a bug with the shipping GLES v1 library where 3 of the symbols are misnamed. 28 + # If you have an arm/ES device without this problem, don't enable this macro. 29 + # TODO: Need way to identify Raspberry Pi/Broadcom 30 + add_definitions(-DSDL_GPU_USE_BROADCOM_RASPBERRYPI_WORKAROUND) 31 + 32 + set(SDL_gpu_DEFAULT_BUILD_DEMOS OFF) 33 + set(SDL_gpu_DEFAULT_DISABLE_OPENGL ON) 34 + set(SDL_gpu_DEFAULT_DISABLE_GLES OFF) 24 35 else() 25 36 set(SDL_gpu_DEFAULT_BUILD_DEMOS ON) 26 37 set(SDL_gpu_DEFAULT_DISABLE_OPENGL OFF) ··· 114 125 include_directories(${OPENGL_INCLUDE_DIR}) 115 126 if(APPLE AND NOT IOS) 116 127 # CMake incorrectly includes AGL.framework in OPENGL_LIBRARIES which is obsolete. 117 - link_libraries(${OPENGL_gl_LIBRARY}) 128 + # link_libraries(${OPENGL_gl_LIBRARY}) 129 + set(SDL_gpu_GL_LIBRARIES ${OPENGL_gl_LIBRARY}) 118 130 else() 119 - link_libraries(${OPENGL_LIBRARIES}) 131 + # link_libraries(${OPENGL_LIBRARIES}) 132 + set(SDL_gpu_GL_LIBRARIES ${OPENGL_LIBRARIES}) 120 133 endif() 121 134 122 135 ··· 181 194 else() 182 195 find_package(OpenGLES REQUIRED) 183 196 include_directories(${OPENGLES_INCLUDE_DIR}) 184 - link_libraries (${OPENGLES_LIBRARIES}) 197 + # link_libraries (${OPENGLES_LIBRARIES}) 198 + set(SDL_gpu_GL_LIBRARIES ${OPENGLES_LIBRARIES}) 185 199 endif() 186 200 187 201 if (SDL_gpu_DISABLE_GLES_1)
+10
include/SDL_gpu_GLES_1.h
··· 27 27 #define GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_OES 28 28 #define GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE_OES 29 29 30 + /* It looks like on Raspberry Pi 2/Raspbian, the 31 + symbols in library are missing the OES suffix, 32 + even though the headers seem to be named right. 33 + */ 34 + #ifdef SDL_GPU_USE_BROADCOM_RASPBERRYPI_WORKAROUND 35 + extern void glBlendEquation(GLenum mode); 36 + extern void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha); 37 + extern void glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); 38 + #else 30 39 #define glBlendEquation glBlendEquationOES 31 40 #define glBlendEquationSeparate glBlendEquationSeparateOES 32 41 #define glBlendFuncSeparate glBlendFuncSeparateOES 42 + #endif 33 43 34 44 #define GL_FUNC_ADD GL_FUNC_ADD_OES 35 45 #define GL_FUNC_SUBTRACT GL_FUNC_SUBTRACT_OES
+20 -5
scripts/FindOpenGLES.cmake
··· 47 47 48 48 ELSE(APPLE) 49 49 50 - IF(0) # Disabled, untill further testing 51 50 52 51 53 - FIND_PATH(OPENGLES_INCLUDE_DIR GLES/gl.h 52 + FIND_PATH(OPENGLES_INCLUDE_DIR GLES2/gl2.h 54 53 /usr/openwin/share/include 55 54 /opt/graphics/OpenGL/include /usr/X11R6/include 56 55 /usr/include 56 + # Raspberry Pi (Raspbian) puts these in /opt/vc "VideoCore" 57 + /opt/vc/include 57 58 ) 58 59 59 60 60 61 FIND_LIBRARY(OPENGLES_gl_LIBRARY 61 - NAMES GLES_CM 62 + # NAMES GLES_CM 63 + NAMES GLESv2 64 + PATHS /opt/graphics/OpenGL/lib 65 + /usr/openwin/lib 66 + /usr/shlib /usr/X11R6/lib 67 + /usr/lib 68 + # Raspberry Pi (Raspbian) puts these in /opt/vc "VideoCore" 69 + /opt/vc/lib 70 + ) 71 + FIND_LIBRARY(OPENGLES_gl1_LIBRARY 72 + NAMES GLESv1_CM 62 73 PATHS /opt/graphics/OpenGL/lib 63 74 /usr/openwin/lib 64 75 /usr/shlib /usr/X11R6/lib 65 76 /usr/lib 77 + # Raspberry Pi (Raspbian) puts these in /opt/vc "VideoCore" 78 + /opt/vc/lib 66 79 ) 67 80 68 81 # On Unix OpenGL most certainly always requires X11. 69 82 # Feel free to tighten up these conditions if you don't 70 83 # think this is always true. 71 84 # It's not true on OSX. 85 + # This is not true on Raspberry Pi (Raspbian) 72 86 87 + IF(0) # Disabled, untill further testing 73 88 IF (OPENGLES_gl_LIBRARY) 74 89 IF(NOT X11_FOUND) 75 90 INCLUDE(FindX11) ··· 88 103 SET( OPENGLES_FOUND "NO" ) 89 104 IF(OPENGLES_gl_LIBRARY) 90 105 91 - SET( OPENGLES_LIBRARIES ${OPENGLES_gl_LIBRARY} ${OPENGLES_LIBRARIES}) 106 + SET( OPENGLES_LIBRARIES ${OPENGLES_gl_LIBRARY} ${OPENGLES_gl1_LIBRARY} ${OPENGLES_LIBRARIES}) 92 107 93 108 SET( OPENGLES_FOUND "YES" ) 94 109 ··· 97 112 MARK_AS_ADVANCED( 98 113 OPENGLES_INCLUDE_DIR 99 114 OPENGLES_gl_LIBRARY 100 - ) 115 + )
+3
src/CMakeLists.txt
··· 81 81 ${SDL_gpu_HDRS} 82 82 ${SDL_gpu_SRCS} 83 83 ) 84 + 85 + target_link_libraries(SDL_gpu_shared ${SDL_gpu_GL_LIBRARIES}) 86 + 84 87 if(SDL_gpu_BUILD_FRAMEWORK) 85 88 set_target_properties(SDL_gpu_shared PROPERTIES 86 89 FRAMEWORK TRUE
+6 -2
src/SDL_gpu_renderer.c
··· 304 304 int count = 0; 305 305 GPU_RendererID default_order[GPU_RENDERER_ORDER_MAX]; 306 306 307 - #if defined(__ANDROID__) || defined(__IPHONEOS__) 307 + // #if defined(__ANDROID__) || defined(__IPHONEOS__) 308 + #if !defined(SDL_GPU_DISABLE_GLES2) && !defined(SDL_GPU_DISABLE_GLES) 308 309 default_order[count++] = GPU_MakeRendererID("OpenGLES 2", GPU_RENDERER_GLES_2, 2, 0); 310 + #endif 311 + #if !defined(SDL_GPU_DISABLE_GLES1) && !defined(SDL_GPU_DISABLE_GLES) 309 312 default_order[count++] = GPU_MakeRendererID("OpenGLES 1", GPU_RENDERER_GLES_1, 1, 1); 310 - #else 313 + #endif 314 + #if !defined(SDL_GPU_DISABLE_OPENGL) 311 315 #ifdef __MACOSX__ 312 316 // My understanding of OS X OpenGL support: 313 317 // OS X 10.9: GL 2.1, 3.3, 4.1