From 32a42fe06a77c8bdda59a2bc21d47efddeffc1a0 Mon Sep 17 00:00:00 2001 From: ikits Date: Fri, 26 Sep 2003 11:34:59 +0000 Subject: [PATCH] added support for GL_ARB_vertex_shader, GL_ARB_fragment_shader, and GL_ARB_shader_objects git-svn-id: https://glew.svn.sourceforge.net/svnroot/glew/trunk/glew@132 783a27ee-832a-0410-bc00-9f386506c6dd --- auto/bin/parse_spec.pl | 7 ++++++- auto/bin/update_ext.sh | 37 +++++++++++++++++++++++++++++++++++-- auto/src/glew_pre.c | 16 +++++++++------- 3 files changed, 50 insertions(+), 10 deletions(-) diff --git a/auto/bin/parse_spec.pl b/auto/bin/parse_spec.pl index 61478dc..73d31f4 100755 --- a/auto/bin/parse_spec.pl +++ b/auto/bin/parse_spec.pl @@ -45,7 +45,7 @@ my %typemap = ( ushort => "GLushort", DMbuffer => "void *", - # ARB VBO introduces this, no idea how to handle it properly. The spec + # ARB VBO introduces these, no idea how to handle them properly. The spec # file babbles about how great this will be on 64 bit systems, but doesn't # actually say how to define this nor how to detect that this has been # defined (i.e., is this tied to the VBO spec or not?). For now I'll just @@ -54,6 +54,11 @@ my %typemap = ( sizeiptrARB => "GLsizeiptrARB", intptrARB => "GLintptrARB", + # ARB shader objects introduces these, charARB is at least 8 bits, + # handleARB is at least 32 bits + charARB => "GLcharARB", + handleARB => "GLhandleARB", + # GLX 1.3 defines new types which might not be available at compile time #GLXFBConfig => "void*", diff --git a/auto/bin/update_ext.sh b/auto/bin/update_ext.sh index e1ffc77..f1c160e 100755 --- a/auto/bin/update_ext.sh +++ b/auto/bin/update_ext.sh @@ -17,10 +17,10 @@ if [ ! -d $1 ] ; then grep -v EXT $1/GL_NV_texture_compression_vtc > tmp; \ mv tmp $1/GL_NV_texture_compression_vtc # remove duplicates from GL_ARB_vertex_program and GL_ARB_fragment_program - grep -v -f $1/GL_ARB_vertex_program $1/GL_ARB_fragment_program > tmp; \ + grep -v -F -f $1/GL_ARB_vertex_program $1/GL_ARB_fragment_program > tmp; \ mv tmp $1/GL_ARB_fragment_program # remove duplicates from GLX_EXT_visual_rating and GLX_EXT_visual_info - grep -v -f $1/GLX_EXT_visual_info $1/GLX_EXT_visual_rating > tmp; \ + grep -v -F -f $1/GLX_EXT_visual_info $1/GLX_EXT_visual_rating > tmp; \ mv tmp $1/GLX_EXT_visual_rating # fix GL_NV_occlusion_query and GL_HP_occlusion_test grep -v '_HP' $1/GL_NV_occlusion_query > tmp; \ @@ -55,4 +55,37 @@ if [ ! -d $1 ] ; then echo -e "\tDECLARE_HANDLE(HPBUFFEREXT);" >> $1/WGL_EXT_pbuffer # get rid of GL_SUN_multi_draw_arrays rm -f $1/GL_SUN_multi_draw_arrays +# change variable names in GL_ARB_vertex_shader + sed -i -e 's/v0/x/g' $1/GL_ARB_vertex_shader + sed -i -e 's/v1/y/g' $1/GL_ARB_vertex_shader + sed -i -e 's/v2/z/g' $1/GL_ARB_vertex_shader + sed -i -e 's/v3/w/g' $1/GL_ARB_vertex_shader +# remove triplicates in GL_ARB_shader_objects, GL_ARB_fragment_shader, +# and GL_ARB_vertex_shader + grep -v -F -f $1/GL_ARB_shader_objects $1/GL_ARB_fragment_shader > tmp; \ + mv tmp $1/GL_ARB_fragment_shader + grep -v -F -f $1/GL_ARB_shader_objects $1/GL_ARB_vertex_shader > tmp; \ + mv tmp $1/GL_ARB_vertex_shader +# remove duplicates in GL_ARB_vertex_program and GL_ARB_vertex_shader + grep -v -F -f $1/GL_ARB_vertex_program $1/GL_ARB_vertex_shader > tmp; \ + mv tmp $1/GL_ARB_vertex_shader +# remove triplicates in GL_ARB_fragment_program, GL_ARB_fragment_shader, +# and GL_ARB_vertex_shader + grep -v -F -f $1/GL_ARB_fragment_program $1/GL_ARB_fragment_shader > tmp; \ + mv tmp $1/GL_ARB_fragment_shader + grep -v -F -f $1/GL_ARB_fragment_program $1/GL_ARB_vertex_shader > tmp; \ + mv tmp $1/GL_ARB_vertex_shader +# fix bugs in GL_ARB_vertex_shader + grep -v "GL_FLOAT" $1/GL_ARB_vertex_shader > tmp; \ + mv tmp $1/GL_ARB_vertex_shader + sed -i -e 's/handle /GLhandleARB /g' $1/GL_ARB_vertex_shader +# fix bugs in GL_ARB_shader_objects + grep -v "GL_FLOAT" $1/GL_ARB_shader_objects > tmp; \ + mv tmp $1/GL_ARB_shader_objects + grep -v "GL_INT" $1/GL_ARB_shader_objects > tmp; \ + mv tmp $1/GL_ARB_shader_objects +# add typedefs to GL_ARB_shader_objects + echo -e "\ttypedef char GLcharARB" >> $1/GL_ARB_shader_objects + echo -e "\ttypedef int GLhandleARB" >> $1/GL_ARB_shader_objects fi + diff --git a/auto/src/glew_pre.c b/auto/src/glew_pre.c index bdca054..5279c13 100644 --- a/auto/src/glew_pre.c +++ b/auto/src/glew_pre.c @@ -39,13 +39,15 @@ #ifdef _WIN32 # define glewGetProcAddress(name) wglGetProcAddress(name) #else -#ifdef __APPLE__ -# define glewGetProcAddress(name) NSGLGetProcAddress(name) -#else -#ifdef __sgi -# define glewGetProcAddress(name) dlGetProcAddress(name) -#else /* __linux */ -# define glewGetProcAddress(name) (*glXGetProcAddressARB)(name) +# ifdef __APPLE__ +# define glewGetProcAddress(name) NSGLGetProcAddress(name) +# else +# ifdef __sgi +# define glewGetProcAddress(name) dlGetProcAddress(name) +# else /* __linux */ +# define glewGetProcAddress(name) (*glXGetProcAddressARB)(name) +# endif +# endif #endif #ifdef __APPLE__