aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Skeggs <[email protected]>2006-12-08 14:12:47 +0000
committerBen Skeggs <[email protected]>2006-12-08 14:12:47 +0000
commitc04c74bc5da454478fd0dbf3b25dd54190ac0942 (patch)
tree0ba4dae0a77b0441079aa72bfcdac9de1798d80f
parentfe91d00e332b42d0aea9f7aa266f8cc28ac9ec39 (diff)
Skeletal extension handling across chipsets.
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_context.c45
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_screen.c10
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_shader.c3
3 files changed, 55 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index f48c54416a3..53d26e0d742 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -65,11 +65,44 @@ static const struct dri_debug_control debug_control[] =
{ NULL, 0 }
};
+#define need_GL_ARB_vertex_program
+#include "extension_helper.h"
+
const struct dri_extension common_extensions[] =
{
{ NULL, 0 }
};
+const struct dri_extension nv10_extensions[] =
+{
+ { NULL, 0 }
+};
+
+const struct dri_extension nv20_extensions[] =
+{
+ { NULL, 0 }
+};
+
+const struct dri_extension nv30_extensions[] =
+{
+ { "GL_ARB_fragment_program", NULL },
+ { NULL, 0 }
+};
+
+const struct dri_extension nv40_extensions[] =
+{
+ /* ARB_vp can be moved to nv20/30 once the shader backend has been
+ * written for those cards.
+ */
+ { "GL_ARB_vertex_program", GL_ARB_vertex_program_functions },
+ { NULL, 0 }
+};
+
+const struct dri_extension nv50_extensions[] =
+{
+ { NULL, 0 }
+};
+
/* Create the device specific context.
*/
GLboolean nouveauCreateContext( const __GLcontextModes *glVisual,
@@ -137,6 +170,18 @@ GLboolean nouveauCreateContext( const __GLcontextModes *glVisual,
nmesa->sarea = (drm_nouveau_sarea_t *)((char *)sPriv->pSAREA +
screen->sarea_priv_offset);
+ /* Enable any supported extensions */
+ driInitExtensions(ctx, common_extensions, GL_TRUE);
+ if (nmesa->screen->card->type >= NV_10)
+ driInitExtensions(ctx, nv10_extensions, GL_FALSE);
+ if (nmesa->screen->card->type >= NV_20)
+ driInitExtensions(ctx, nv20_extensions, GL_FALSE);
+ if (nmesa->screen->card->type >= NV_30)
+ driInitExtensions(ctx, nv30_extensions, GL_FALSE);
+ if (nmesa->screen->card->type >= NV_40)
+ driInitExtensions(ctx, nv40_extensions, GL_FALSE);
+ if (nmesa->screen->card->type >= NV_50)
+ driInitExtensions(ctx, nv50_extensions, GL_FALSE);
nmesa->current_primitive = -1;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
index 93f66826e89..8e548dbcbdf 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
@@ -53,6 +53,11 @@ DRI_CONF_END;
static const GLuint __driNConfigOptions = 1;
extern const struct dri_extension common_extensions[];
+extern const struct dri_extension nv10_extensions[];
+extern const struct dri_extension nv20_extensions[];
+extern const struct dri_extension nv30_extensions[];
+extern const struct dri_extension nv40_extensions[];
+extern const struct dri_extension nv50_extensions[];
static nouveauScreenPtr nouveauCreateScreen(__DRIscreenPrivate *sPriv)
{
@@ -352,6 +357,11 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc
* Hello chicken. Hello egg. How are you two today?
*/
driInitExtensions( NULL, common_extensions, GL_FALSE );
+ driInitExtensions( NULL, nv10_extensions, GL_FALSE );
+ driInitExtensions( NULL, nv10_extensions, GL_FALSE );
+ driInitExtensions( NULL, nv30_extensions, GL_FALSE );
+ driInitExtensions( NULL, nv40_extensions, GL_FALSE );
+ driInitExtensions( NULL, nv50_extensions, GL_FALSE );
}
return (void *) psp;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_shader.c b/src/mesa/drivers/dri/nouveau/nouveau_shader.c
index 4dedefe5a30..e3082ebc69b 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_shader.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_shader.c
@@ -184,7 +184,6 @@ nouveauShaderInitFuncs(GLcontext * ctx)
return;
}
- _mesa_enable_extension(ctx, "GL_ARB_vertex_program");
ctx->Const.VertexProgram.MaxNativeInstructions = nmesa->VPfunc.MaxInst;
ctx->Const.VertexProgram.MaxNativeAluInstructions = nmesa->VPfunc.MaxInst;
ctx->Const.VertexProgram.MaxNativeTexInstructions = nmesa->VPfunc.MaxInst;
@@ -196,8 +195,6 @@ nouveauShaderInitFuncs(GLcontext * ctx)
ctx->Const.VertexProgram.MaxNativeParameters = nmesa->VPfunc.MaxConst;
if (nmesa->screen->card->type >= NV_30) {
- _mesa_enable_extension(ctx, "GL_ARB_fragment_program");
-
ctx->Const.FragmentProgram.MaxNativeInstructions = nmesa->FPfunc.MaxInst;
ctx->Const.FragmentProgram.MaxNativeAluInstructions = nmesa->FPfunc.MaxInst;
ctx->Const.FragmentProgram.MaxNativeTexInstructions = nmesa->FPfunc.MaxInst;