This patch enables GL_ARB_vertex_program and GL_NV_vertex_program
support in the r200 driver. Both extensions can be enabled via
options, GL_ARB_vertex_program is on by default, GL_NV_vertex_program
off. Option descriptions are in german, english and french.

Apply with cat r200_vp.patch | patch -p1 in Mesa/src/mesa/drivers/dri

Philipp Klaus Krause
diff --unified -r dri.bak/common/xmlpool.h dri/common/xmlpool.h
--- dri.bak/common/xmlpool.h	2004-05-08 12:08:21 +0200
+++ dri/common/xmlpool.h	2004-09-06 20:32:38 +0200
@@ -273,4 +273,25 @@
         DRI_CONF_DESC(de,"Anzahl der Textureinheiten") \
 DRI_CONF_OPT_END
 
+/* Options for features that are not done in hardware by the driver (like GL_ARB_vertex_program
+   On cards where there is no documentation (r200) or on rasterization-only hardware). */
+#define DRI_CONF_SECTION_SOFTWARE \
+DRI_CONF_SECTION_BEGIN \
+        DRI_CONF_DESC(de,"Funktionalität, die nicht durch die Hardware beschleunigt wird") \
+        DRI_CONF_DESC(en,"Features that are not hardware-accelerated")
+
+#define DRI_CONF_ARB_VERTEX_PROGRAM(def) \
+DRI_CONF_OPT_BEGIN(arb_vertex_program,bool,def) \
+        DRI_CONF_DESC(de,"GL_ARB_vertex_program aktivieren") \
+        DRI_CONF_DESC(en,"Enable GL_ARB_vertex_program") \
+        DRI_CONF_DESC(fr,"Activer GL_ARB_vertex_program") \
+DRI_CONF_OPT_END
+
+#define DRI_CONF_NV_VERTEX_PROGRAM(def) \
+DRI_CONF_OPT_BEGIN(nv_vertex_program,bool,def) \
+        DRI_CONF_DESC(de,"GL_NV_vertex_program aktivieren") \
+        DRI_CONF_DESC(en,"Enable GL_NV_vertex_program") \
+        DRI_CONF_DESC(fr,"Activer GL_NV_vertex_program") \
+DRI_CONF_OPT_END
+
 #endif
diff --unified -r dri.bak/r200/r200_context.c dri/r200/r200_context.c
--- dri.bak/r200/r200_context.c	2004-07-04 22:33:49 +0200
+++ dri/r200/r200_context.c	2004-09-06 20:23:26 +0200
@@ -62,7 +62,7 @@
 #include "r200_vtxfmt.h"
 #include "r200_maos.h"
 
-#define DRIVER_DATE	"20030328"
+#define DRIVER_DATE	"20040906"
 
 #include "vblank.h"
 #include "utils.h"
@@ -166,6 +166,7 @@
    &_tnl_fog_coordinate_stage,
    &_tnl_texgen_stage,
    &_tnl_texture_transform_stage,
+   &_tnl_vertex_program_stage,
 
    /* Try again to go to tcl? 
     *     - no good for asymmetric-twoside (do with multipass)
@@ -406,6 +407,10 @@
       _mesa_enable_extension( ctx, "GL_EXT_blend_equation_separate" );
       _mesa_enable_extension( ctx, "GL_EXT_blend_func_separate" );
    }
+   if(driQueryOptionb(&rmesa->optionCache, "arb_vertex_program"))
+      _mesa_enable_extension( ctx, "GL_ARB_vertex_program");
+   if(driQueryOptionb(&rmesa->optionCache, "nv_vertex_program"))
+      _mesa_enable_extension( ctx, "GL_NV_VERTEX_PROGRAM");
 
 #if 0
    r200InitDriverFuncs( ctx );
diff --unified -r dri.bak/r200/r200_screen.c dri/r200/r200_screen.c
--- dri.bak/r200/r200_screen.c	2004-07-04 22:33:49 +0200
+++ dri/r200/r200_screen.c	2004-09-06 20:24:02 +0200
@@ -75,6 +75,10 @@
     DRI_CONF_SECTION_DEBUG
         DRI_CONF_NO_RAST(false)
     DRI_CONF_SECTION_END
+    DRI_CONF_SECTION_SOFTWARE
+        DRI_CONF_ARB_VERTEX_PROGRAM(true)
+        DRI_CONF_NV_VERTEX_PROGRAM(false)
+    DRI_CONF_SECTION_END
 DRI_CONF_END;
 static const GLuint __driNConfigOptions = 11;
 
diff --unified -r dri.bak/r200/r200_state.c dri/r200/r200_state.c
--- dri.bak/r200/r200_state.c	2004-05-27 18:56:47 +0200
+++ dri/r200/r200_state.c	2004-09-06 20:22:41 +0200
@@ -2043,6 +2043,10 @@
       r200UpdateSpecular ( ctx );
       break;
 
+   case GL_VERTEX_PROGRAM_ARB:
+      TCL_FALLBACK(rmesa->glCtx, R200_TCL_FALLBACK_TCL_DISABLE, state);
+      break;
+
    default:
       return;
    }
diff --unified -r dri.bak/r200/r200_tcl.h dri/r200/r200_tcl.h
--- dri.bak/r200/r200_tcl.h	2004-06-03 00:09:11 +0200
+++ dri/r200/r200_tcl.h	2004-09-06 20:22:41 +0200
@@ -60,6 +60,7 @@
 #define R200_TCL_FALLBACK_TEXGEN_5          0x200 /* texgen, unit 5 */
 #define R200_TCL_FALLBACK_TCL_DISABLE       0x400 /* user disable */
 #define R200_TCL_FALLBACK_BITMAP            0x800 /* draw bitmap with points */
+#define R200_TCL_FALLBACK_VERTEX_PROGRAM    0x1000/* vertex program active */
 
 #define TCL_FALLBACK( ctx, bit, mode )	r200TclFallback( ctx, bit, mode )
 

Reply via email to