From 2de0716a469ed3ee9d5c479102b8e3288e4e0825 Mon Sep 17 00:00:00 2001 From: Nigel Stewart Date: Thu, 16 Aug 2012 14:01:11 -0500 Subject: [PATCH] Initial NaCL support for GLEW - it's not Windows or Linux/X11. --- auto/Makefile | 8 ++++---- auto/src/glew_head.c | 4 +++- auto/src/glew_init_tail.c | 4 ++-- auto/src/glew_utils.c | 2 +- auto/src/glew_utils.h | 2 +- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/auto/Makefile b/auto/Makefile index c6914d4..5800434 100644 --- a/auto/Makefile +++ b/auto/Makefile @@ -188,7 +188,7 @@ $(S.DEST)/glew.c: $(EXT)/.dummy cat $(SRC)/glew_init_wgl.c >> $@ $(BIN)/make_list.pl $(WGL_EXT_SPEC) >> $@ echo -e "\n return GLEW_OK;\n}" >> $@; - echo -e "\n#elif !defined(__ANDROID__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))" >> $@ + echo -e "\n#elif !defined(__ANDROID__) && !defined(__native_client__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))" >> $@ $(BIN)/make_def_fun.pl GLX $(GLX_CORE_SPEC) >> $@ $(BIN)/make_def_fun.pl GLX $(GLX_EXT_SPEC) >> $@ echo -e "\n#if !defined(GLEW_MX)" >> $@; @@ -203,7 +203,7 @@ $(S.DEST)/glew.c: $(EXT)/.dummy $(BIN)/make_list.pl $(CORE)/GLX_VERSION_1_3 | grep -v '\"GLX_VERSION' >> $@ $(BIN)/make_list.pl $(GLX_EXT_SPEC) >> $@ echo -e "\n return GLEW_OK;\n}" >> $@ - echo -e "\n#endif /* !defined(__ANDROID__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) */\n" >> $@; + echo -e "\n#endif /* !defined(__ANDROID__) && !defined(__native_client__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) */\n" >> $@; cat $(SRC)/glew_init_tail.c >> $@ cat $(SRC)/glew_str_head.c >> $@ $(BIN)/make_str.pl $(GL_CORE_SPEC) $(GL_EXT_SPEC) >> $@ @@ -234,7 +234,7 @@ $(S.DEST)/glew_def.c: $(EXT)/.dummy $(BIN)/make_def_var.pl WGL $(WGL_EXT_SPEC) >> $@ echo -e "\n#endif /* _WIN32 */" >> $@ echo -e "\n#endif /* !GLEW_MX */" >> $@; - echo -e "\n#if !defined(_WIN32) && !defined(__ANDROID__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))" >> $@ + echo -e "\n#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(__native_client__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))" >> $@ $(BIN)/make_def_fun.pl GLX $(GLX_CORE_SPEC) >> $@ $(BIN)/make_def_fun.pl GLX $(GLX_EXT_SPEC) >> $@ echo -e "\n#if !defined(GLEW_MX)" >> $@; @@ -243,7 +243,7 @@ $(S.DEST)/glew_def.c: $(EXT)/.dummy $(BIN)/make_def_var.pl GLX $(GLX_CORE_SPEC) >> $@ $(BIN)/make_def_var.pl GLX $(GLX_EXT_SPEC) >> $@ echo -e "\n#endif /* !GLEW_MX */" >> $@; - echo -e "\n#endif /* !defined(_WIN32) && !defined(__ANDROID__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) */" >> $@; + echo -e "\n#endif /* !defined(_WIN32) && !defined(__ANDROID__) && !defined(__native_client__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) */" >> $@; rm -f $@.bak $(S.DEST)/glew_init.c: $(EXT)/.dummy diff --git a/auto/src/glew_head.c b/auto/src/glew_head.c index d12e8c2..252d55a 100644 --- a/auto/src/glew_head.c +++ b/auto/src/glew_head.c @@ -2,7 +2,7 @@ #if defined(_WIN32) # include -#elif !defined(__ANDROID__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) +#elif !defined(__ANDROID__) && !defined(__native_client__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) # include #endif @@ -135,6 +135,8 @@ void* NSGLGetProcAddress (const GLubyte *name) # define glewGetProcAddress(name) dlGetProcAddress(name) #elif defined(__ANDROID__) # define glewGetProcAddress(name) NULL /* TODO */ +#elif defined(__native_client__) +# define glewGetProcAddress(name) NULL /* TODO */ #else /* __linux */ # define glewGetProcAddress(name) (*glXGetProcAddressARB)(name) #endif diff --git a/auto/src/glew_init_tail.c b/auto/src/glew_init_tail.c index 90188bf..2316fb3 100644 --- a/auto/src/glew_init_tail.c +++ b/auto/src/glew_init_tail.c @@ -36,7 +36,7 @@ GLboolean glewExperimental = GL_FALSE; #if defined(_WIN32) extern GLenum GLEWAPIENTRY wglewContextInit (void); -#elif !defined(__ANDROID__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) +#elif !defined(__ANDROID__) && !defined(__native_client__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) extern GLenum GLEWAPIENTRY glxewContextInit (void); #endif /* _WIN32 */ @@ -47,7 +47,7 @@ GLenum GLEWAPIENTRY glewInit (void) if ( r != 0 ) return r; #if defined(_WIN32) return wglewContextInit(); -#elif !defined(__ANDROID__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) /* _UNIX */ +#elif !defined(__ANDROID__) && !defined(__native_client__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) /* _UNIX */ return glxewContextInit(); #else return r; diff --git a/auto/src/glew_utils.c b/auto/src/glew_utils.c index e31f048..a7748df 100644 --- a/auto/src/glew_utils.c +++ b/auto/src/glew_utils.c @@ -32,7 +32,7 @@ #include #if defined(_WIN32) # include -#elif !defined(__ANDROID__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) +#elif !defined(__ANDROID__) && !defined(__native_client__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) # include #endif diff --git a/auto/src/glew_utils.h b/auto/src/glew_utils.h index e25d8b9..4291972 100644 --- a/auto/src/glew_utils.h +++ b/auto/src/glew_utils.h @@ -35,7 +35,7 @@ #include #if defined(_WIN32) # include -#elif !defined(__ANDROID__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) +#elif !defined(__ANDROID__) && !defined(__native_client__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) # include #endif