[Mesa-dev] [PATCH 3/9] nouveau: Enable extensions by just setting the flags

Ian Romanick idr at freedesktop.org
Tue Sep 6 13:13:19 PDT 2011


From: Ian Romanick <ian.d.romanick at intel.com>

Core Mesa already does the dispatch offset remapping for every
function that could possibly ever be supported.  There's no need to
continue using that cruft in the driver.

Since the call to _mesa_enable_imaging_extensions (via
driInitExtensions) is removed, EXT_blend_color, EXT_blend_logic_op,
EXT_blend_minmax, and EXT_blend_subtract are explicitly added to the
list.

Cc: Ben Skeggs <bskeggs at redhat.com>
Reviewed-by: Francisco Jerez <currojerez at riseup.net>
Cc: Viktor Novotný <noviktor at seznam.cz>
---
 src/mesa/drivers/dri/nouveau/nouveau_context.c |   44 ++++++++++-------------
 src/mesa/drivers/dri/nouveau/nv10_context.c    |   14 +++-----
 src/mesa/drivers/dri/nouveau/nv20_context.c    |   14 +++-----
 3 files changed, 29 insertions(+), 43 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 22b9957..1c35578 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -24,6 +24,7 @@
  *
  */
 
+#include <stdbool.h>
 #include "nouveau_driver.h"
 #include "nouveau_context.h"
 #include "nouveau_bufferobj.h"
@@ -41,30 +42,6 @@
 #include "tnl/tnl.h"
 #include "tnl/t_context.h"
 
-#define need_GL_EXT_framebuffer_object
-#define need_GL_EXT_fog_coord
-#define need_GL_EXT_secondary_color
-
-#include "main/remap_helper.h"
-
-static const struct dri_extension nouveau_extensions[] = {
-	{ "GL_ARB_multitexture",	NULL },
-	{ "GL_ARB_texture_env_add",	NULL },
-	{ "GL_ARB_texture_mirrored_repeat", NULL },
-	{ "GL_EXT_fog_coord",		GL_EXT_fog_coord_functions },
-	{ "GL_EXT_framebuffer_blit",	NULL },
-	{ "GL_EXT_framebuffer_object",	GL_EXT_framebuffer_object_functions },
-	{ "GL_EXT_packed_depth_stencil", NULL},
-	{ "GL_EXT_secondary_color",	GL_EXT_secondary_color_functions },
-	{ "GL_EXT_stencil_wrap",	NULL },
-	{ "GL_EXT_texture_env_combine",	NULL },
-	{ "GL_EXT_texture_filter_anisotropic", NULL },
-	{ "GL_EXT_texture_lod_bias",	NULL },
-	{ "GL_NV_blend_square",         NULL },
-	{ "GL_NV_texture_env_combine4",	NULL },
-	{ NULL,				NULL }
-};
-
 static void
 nouveau_channel_flush_notify(struct nouveau_channel *chan)
 {
@@ -140,7 +117,24 @@ nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen,
 	nctx->hw.chan->user_private = nctx;
 
 	/* Enable any supported extensions. */
-	driInitExtensions(ctx, nouveau_extensions, GL_TRUE);
+	ctx->Extensions.ARB_multitexture = true;
+	ctx->Extensions.ARB_texture_mirrored_repeat = true;
+	ctx->Extensions.EXT_blend_color = true;
+	ctx->Extensions.EXT_blend_logic_op = true;
+	ctx->Extensions.EXT_blend_minmax = true;
+	ctx->Extensions.EXT_blend_subtract = true;
+	ctx->Extensions.EXT_fog_coord = true;
+	ctx->Extensions.EXT_framebuffer_blit = true;
+	ctx->Extensions.EXT_framebuffer_object = true;
+	ctx->Extensions.EXT_packed_depth_stencil = true;
+	ctx->Extensions.EXT_secondary_color = true;
+	ctx->Extensions.EXT_stencil_wrap = true;
+	ctx->Extensions.EXT_texture_env_add = true;
+	ctx->Extensions.EXT_texture_env_combine = true;
+	ctx->Extensions.EXT_texture_filter_anisotropic = true;
+	ctx->Extensions.EXT_texture_lod_bias = true;
+	ctx->Extensions.NV_blend_square = true;
+	ctx->Extensions.NV_texture_env_combine4 = true;
 
 	return GL_TRUE;
 }
diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c b/src/mesa/drivers/dri/nouveau/nv10_context.c
index 8074b4b..da0ef2b 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_context.c
@@ -24,6 +24,7 @@
  *
  */
 
+#include <stdbool.h>
 #include "main/state.h"
 #include "nouveau_driver.h"
 #include "nouveau_context.h"
@@ -34,14 +35,6 @@
 #include "nv04_driver.h"
 #include "nv10_driver.h"
 
-static const struct dri_extension nv10_extensions[] = {
-	{ "GL_ARB_texture_env_crossbar", NULL },
-	{ "GL_EXT_texture_rectangle",	NULL },
-	{ "GL_ARB_texture_env_combine", NULL },
-	{ "GL_ARB_texture_env_dot3",    NULL },
-	{ NULL,				NULL }
-};
-
 static GLboolean
 use_fast_zclear(struct gl_context *ctx, GLbitfield buffers)
 {
@@ -439,7 +432,10 @@ nv10_context_create(struct nouveau_screen *screen, const struct gl_config *visua
 	if (!nouveau_context_init(ctx, screen, visual, share_ctx))
 		goto fail;
 
-	driInitExtensions(ctx, nv10_extensions, GL_FALSE);
+	ctx->Extensions.ARB_texture_env_crossbar = true;
+	ctx->Extensions.ARB_texture_env_combine = true;
+	ctx->Extensions.ARB_texture_env_dot3 = true;
+	ctx->Extensions.NV_texture_rectangle = true;
 
 	/* GL constants. */
 	ctx->Const.MaxTextureLevels = 12;
diff --git a/src/mesa/drivers/dri/nouveau/nv20_context.c b/src/mesa/drivers/dri/nouveau/nv20_context.c
index e0483b2..2766851 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_context.c
@@ -24,6 +24,7 @@
  *
  */
 
+#include <stdbool.h>
 #include "nouveau_driver.h"
 #include "nouveau_context.h"
 #include "nouveau_fbo.h"
@@ -34,14 +35,6 @@
 #include "nv10_driver.h"
 #include "nv20_driver.h"
 
-static const struct dri_extension nv20_extensions[] = {
-	{ "GL_ARB_texture_env_crossbar", NULL },
-	{ "GL_EXT_texture_rectangle",	NULL },
-	{ "GL_ARB_texture_env_combine", NULL },
-	{ "GL_ARB_texture_env_dot3",    NULL },
-	{ NULL,				NULL }
-};
-
 static void
 nv20_clear(struct gl_context *ctx, GLbitfield buffers)
 {
@@ -453,7 +446,10 @@ nv20_context_create(struct nouveau_screen *screen, const struct gl_config *visua
 	if (!nouveau_context_init(ctx, screen, visual, share_ctx))
 		goto fail;
 
-	driInitExtensions(ctx, nv20_extensions, GL_FALSE);
+	ctx->Extensions.ARB_texture_env_crossbar = true;
+	ctx->Extensions.ARB_texture_env_combine = true;
+	ctx->Extensions.ARB_texture_env_dot3 = true;
+	ctx->Extensions.NV_texture_rectangle = true;
 
 	/* GL constants. */
 	ctx->Const.MaxTextureCoordUnits = NV20_TEXTURE_UNITS;
-- 
1.7.4.4



More information about the mesa-dev mailing list