well, i realized there was too many mistakes on my side. For now it "work" as 
not assert during two piglit tests.

results:

Results for glean/texCombine4

Returncode: 0

Errors:
libGL: OpenDriver: 
trying /mnt/hdd1/src/mesa-clean/mesa/lib/nouveau_vieux_dri.so
Mesa: Mesa 7.9-devel DEBUG build Sep  5 2010 00:01:42


Output:
----------------------------------------------------------------------
Test the GL_NV_texture_env_combine4 extension.

texCombine4: Error: GL_NV_texure_env_combine4 failed
        Current GL state:
                COMBINE = GL_ADD_SIGNED_EXT
                SOURCE0: GL_ZERO
                OPERAND0_RGB: GL_SRC_COLOR
                OPERAND0_ALPHA: GL_SRC_ALPHA
                SOURCE1: GL_ZERO
                OPERAND1_RGB: GL_ONE_MINUS_SRC_COLOR
                OPERAND1_ALPHA: GL_ONE_MINUS_SRC_ALPHA
                SOURCE2: GL_ZERO
                OPERAND2_RGB: GL_ONE_MINUS_SRC_COLOR
                OPERAND2_ALPHA: GL_ONE_MINUS_SRC_ALPHA
                SOURCE3: GL_ZERO
                OPERAND3_RGB: GL_SRC_COLOR
                OPERAND3_ALPHA: GL_SRC_ALPHA
                Primary Color: 0.995, 0.853, 0.500, 0.642
                Constant Color: 0.861, 0.596, 0.091, 0.140
                Texture Color: 0.950, 0.925, 0.889, 0.551
        Results:
                Expected color: 0.000, 0.000, 0.000, 0.000
                Rendered color: 0.498, 0.498, 0.498, 0.498
texCombine4:  FAIL rgba8, db, z24, s8, win+pmap, id 33


and

Results for glean/texEnv

eturncode: 0

Errors:
libGL: OpenDriver: 
trying /mnt/hdd1/src/mesa-clean/mesa/lib/nouveau_vieux_dri.so
Mesa: Mesa 7.9-devel DEBUG build Sep  5 2010 00:01:42


Output:
----------------------------------------------------------------------
Test basic texture env modes for all base texture formats.

texEnv:  FAIL:  GL_TEXTURE_ENV_MODE=GL_REPLACE  Texture Format=GL_INTENSITY  
Fragment Color=(0, 0, 0, 0)  Texture Color=(0, 0, 0, 0)  Tex Env Color=(0, 0, 
0, 0)  Blend over=(0.5, 0.5, 0.5, 0.5)  Expected=(0.5, 0.5, 0.5, 0.5)  
Measured=(0, 0, 0, 1)
texEnv:  FAIL:  GL_TEXTURE_ENV_MODE=GL_MODULATE  Texture Format=GL_INTENSITY  
Fragment Color=(0, 0, 0, 0.5)  Texture Color=(0, 0, 0, 0)  Tex Env Color=(0, 
0, 0, 0)  Blend over=(0.5, 0.5, 0.5, 0.5)  Expected=(0.5, 0.5, 0.5, 0.5)  
Measured=(0.247059, 0.247059, 0.247059, 0.501961)
texEnv:  FAIL:  GL_TEXTURE_ENV_MODE=GL_REPLACE  Texture Format=GL_RGB  
Fragment Color=(0, 0, 0, 0)  Texture Color=(0, 0, 0, 0)  Tex Env Color=(0, 0, 
0, 0)  Blend over=(0.5, 0.5, 0.5, 0.5)  Expected=(0.5, 0.5, 0.5, 0.5)  
Measured=(0, 0, 0, 1)
texEnv:  FAIL rgba8, db, z24, s8, win+pmap, id 33

------------------
From 9bf16a26361ab4a44b6568deae30c523488cde1b Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <randrianas...@gmail.com>
Date: Mon, 6 Sep 2010 18:17:48 +0400
Subject: [PATCH 1/7] nv0x: use multitexturing engine for A8 textures, fixes teapot demo broken
 probably since we started to use _mesa_meta_Bitmap

---
 src/mesa/drivers/dri/nouveau/nv04_context.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c b/src/mesa/drivers/dri/nouveau/nv04_context.c
index 6834f7c..af46ce2 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_context.c
@@ -38,6 +38,7 @@ nv04_context_engine(GLcontext *ctx)
 	struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw;
 	struct nouveau_grobj *fahrenheit;
 
+
 	if (ctx->Texture.Unit[0].EnvMode == GL_COMBINE ||
 	    ctx->Texture.Unit[0].EnvMode == GL_BLEND ||
 	    ctx->Texture.Unit[0].EnvMode == GL_ADD ||
@@ -46,6 +47,13 @@ nv04_context_engine(GLcontext *ctx)
 		fahrenheit = hw->eng3dm;
 	else
 		fahrenheit = hw->eng3d;
+		
+	if (ctx->Texture.Unit[0]._ReallyEnabled) {
+	struct gl_texture_object *t = ctx->Texture.Unit[0]._Current;
+	struct gl_texture_image *ti = t->Image[0][t->BaseLevel];
+		if (ti->_BaseFormat == GL_ALPHA)
+			fahrenheit = hw->eng3dm;
+	}
 
 	if (fahrenheit != nctx->eng3d) {
 		nctx->eng3d = fahrenheit;
-- 
1.7.0.2

From 8ca9fd5db720af498fcaf1365db19fbd2be57b57 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <randrianas...@gmail.com>
Date: Mon, 6 Sep 2010 18:26:05 +0400
Subject: [PATCH 2/7] nv0x: add workaround for TNT2 and small sifm copies, shuts up errors but texenv demo still NOT fixed.

---
 src/mesa/drivers/dri/nouveau/nv04_surface.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_surface.c b/src/mesa/drivers/dri/nouveau/nv04_surface.c
index e3febf7..48078f9 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_surface.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_surface.c
@@ -410,10 +410,19 @@ nv04_surface_copy(GLcontext *ctx,
 		nv04_surface_copy_m2mf(ctx, dst, src, dx, dy, sx, sy, w, h);
 		return;
 	}
+	
+	/* TNT2 seems to be upset if we use sifm with small region,
+	 add workaround */
+	int sifm_allowed = 0;
+	if (context_chipset(ctx) < 0x10) {
+		if (w > 8 && h > 8)
+			sifm_allowed = 1;
+	} else { sifm_allowed = 1; }
+
 
 	/* Swizzle using sifm+swzsurf. */
         if (src->layout == LINEAR && dst->layout == SWIZZLED &&
-	    dst->cpp != 1 && !(dst->offset & 63)) {
+	    dst->cpp != 1 && !(dst->offset & 63) &&  (sifm_allowed == 1)) {
 		nv04_surface_copy_swizzle(ctx, dst, src, dx, dy, sx, sy, w, h);
 		return;
 	}
-- 
1.7.0.2

From 3accecebe12d34e74feae8149615c379bea54915 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <randrianas...@gmail.com>
Date: Wed, 8 Sep 2010 15:27:24 +0400
Subject: [PATCH 5/7] mesa: hack support for EXT_texture_env_combine in texenv.c, avoid gl errors if only this extension enabled in  driver

---
 src/mesa/main/texenv.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c
index 4442fb8..d8402da 100644
--- a/src/mesa/main/texenv.c
+++ b/src/mesa/main/texenv.c
@@ -320,7 +320,8 @@ set_combiner_operand(GLcontext *ctx,
       alpha = GL_FALSE;
       break;
    case GL_OPERAND2_RGB:
-      if (ctx->Extensions.ARB_texture_env_combine) {
+      if (ctx->Extensions.ARB_texture_env_combine || 
+    	    ctx->Extensions.EXT_texture_env_combine) {
          term = 2;
          alpha = GL_FALSE;
       }
@@ -348,7 +349,8 @@ set_combiner_operand(GLcontext *ctx,
       alpha = GL_TRUE;
       break;
    case GL_OPERAND2_ALPHA:
-      if (ctx->Extensions.ARB_texture_env_combine) {
+      if (ctx->Extensions.ARB_texture_env_combine || 
+    	    ctx->Extensions.EXT_texture_env_combine) {
          term = 2;
          alpha = GL_TRUE;
       }
-- 
1.7.0.2

From c183d547ec41466e902248c856c7291dfac33726 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <randrianas...@gmail.com>
Date: Tue, 7 Sep 2010 19:00:31 +0400
Subject: [PATCH 3/7] nouveau: Trivially move GL_ARB_texture_env_dot3 and GL_ARB_texture_env_combine
  from common extension list into nv10 and nv20 specific extension lists, so they will not show up on nv0x.

---
 src/mesa/drivers/dri/nouveau/nouveau_context.c |    2 --
 src/mesa/drivers/dri/nouveau/nv10_context.c    |    2 ++
 src/mesa/drivers/dri/nouveau/nv20_context.c    |    2 ++
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index f481161..e9e7bbf 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -50,8 +50,6 @@
 static const struct dri_extension nouveau_extensions[] = {
 	{ "GL_ARB_multitexture",	NULL },
 	{ "GL_ARB_texture_env_add",	NULL },
-	{ "GL_ARB_texture_env_combine",	NULL },
-	{ "GL_ARB_texture_env_dot3",	NULL },
 	{ "GL_ARB_texture_mirrored_repeat", NULL },
 	{ "GL_EXT_fog_coord",		GL_EXT_fog_coord_functions },
 	{ "GL_EXT_framebuffer_blit",	NULL },
diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c b/src/mesa/drivers/dri/nouveau/nv10_context.c
index b6d1036..7f00002 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_context.c
@@ -34,6 +34,8 @@
 
 static const struct dri_extension nv10_extensions[] = {
 	{ "GL_EXT_texture_rectangle",	NULL },
+	{ "GL_ARB_texture_env_combine", NULL },
+	{ "GL_ARB_texture_env_dot3",    NULL },
 	{ NULL,				NULL }
 };
 
diff --git a/src/mesa/drivers/dri/nouveau/nv20_context.c b/src/mesa/drivers/dri/nouveau/nv20_context.c
index 789dcaa..03cb14a 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_context.c
@@ -33,6 +33,8 @@
 
 static const struct dri_extension nv20_extensions[] = {
 	{ "GL_EXT_texture_rectangle",	NULL },
+	{ "GL_ARB_texture_env_combine", NULL },
+	{ "GL_ARB_texture_env_dot3",    NULL },
 	{ NULL,				NULL }
 };
 
-- 
1.7.0.2

From 8d361fd58f6c5543f398aeb2a8eaff596bf721d8 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <randrianas...@gmail.com>
Date: Wed, 8 Sep 2010 06:50:04 +0400
Subject: [PATCH 4/7] nouveau: Add GL_EXT_texture_env_combine and GL_NV_texture_env_combine4 into common extension list, currently fail piglit tests, need more testing!

---
 src/mesa/drivers/dri/nouveau/nouveau_context.c |    2 ++
 src/mesa/drivers/dri/nouveau/nv04_state_frag.c |   10 +++++-----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index e9e7bbf..0b735df 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -56,8 +56,10 @@ static const struct dri_extension nouveau_extensions[] = {
 	{ "GL_EXT_framebuffer_object",	GL_EXT_framebuffer_object_functions },
 	{ "GL_EXT_secondary_color",	GL_EXT_secondary_color_functions },
 	{ "GL_EXT_stencil_wrap",	NULL },
+	{ "GL_EXT_texture_env_combine",     NULL },
 	{ "GL_EXT_texture_lod_bias",	NULL },
 	{ "GL_NV_blend_square",         NULL },
+	{ "GL_NV_texture_env_combine4",    NULL },
 	{ "GL_SGIS_generate_mipmap",	NULL },
 	{ NULL,				NULL }
 };
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_frag.c b/src/mesa/drivers/dri/nouveau/nv04_state_frag.c
index d7c86d4..d95ac97 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_frag.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_frag.c
@@ -89,13 +89,13 @@ get_input_source(struct combiner_state *rc, int source)
 	case GL_TEXTURE1:
 		return COMBINER_SOURCE(TEXTURE1);
 
-	case GL_CONSTANT:
+	case GL_CONSTANT_EXT:
 		return COMBINER_SOURCE(CONSTANT);
 
-	case GL_PRIMARY_COLOR:
+	case GL_PRIMARY_COLOR_EXT:
 		return COMBINER_SOURCE(PRIMARY_COLOR);
 
-	case GL_PREVIOUS:
+	case GL_PREVIOUS_EXT:
 		return rc->unit ? COMBINER_SOURCE(PREVIOUS) :
 			COMBINER_SOURCE(PRIMARY_COLOR);
 
@@ -202,7 +202,7 @@ setup_combiner(struct combiner_state *rc)
 		UNSIGNED_OP(rc);
 		break;
 
-	case GL_INTERPOLATE:
+	case GL_INTERPOLATE_EXT:
 		INPUT_ARG(rc, 0, 0, 0);
 		INPUT_ARG(rc, 1, 2, 0);
 		INPUT_ARG(rc, 2, 1, 0);
@@ -210,7 +210,7 @@ setup_combiner(struct combiner_state *rc)
 		UNSIGNED_OP(rc);
 		break;
 
-	case GL_ADD_SIGNED:
+	case GL_ADD_SIGNED_EXT:
 		INPUT_ARG(rc, 0, 0, 0);
 		INPUT_SRC(rc, 1, ZERO, INVERT);
 		INPUT_ARG(rc, 2, 1, 0);
-- 
1.7.0.2

From 6e3cbb059b96032bd1a800b802e15f0c72e291fd Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <randrianas...@gmail.com>
Date: Wed, 8 Sep 2010 15:29:11 +0400
Subject: [PATCH 6/7] nv0x: avoid assertion, just hack, we need properly enable multitexturing engine for advanced  texenv modes and/or emulated textures, may be by dirtying context on texenv changes?

---
 src/mesa/drivers/dri/nouveau/nv04_state_raster.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
index c191571..a2544fb 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
@@ -307,11 +307,17 @@ nv04_emit_blend(GLcontext *ctx, int emit)
 		else
 			blend |= NV04_TEXTURED_TRIANGLE_BLEND_SHADE_MODE_FLAT;
 
+
+		
 		/* Texture environment. */
-		if (ctx->Texture._EnabledUnits)
+		if (ctx->Texture._EnabledUnits) {
+		    if ((ctx->Texture.Unit[0].EnvMode == GL_REPLACE) ||
+			ctx->Texture.Unit[0].EnvMode == GL_MODULATE ||
+			ctx->Texture.Unit[0].EnvMode == GL_DECAL) {
 			blend |= get_texenv_mode(ctx->Texture.Unit[0].EnvMode);
-		else
+		} else { blend |= get_texenv_mode(GL_MODULATE); }
 			blend |= get_texenv_mode(GL_MODULATE);
+		}
 
 		/* Secondary color */
 		if (NEED_SECONDARY_COLOR(ctx))
-- 
1.7.0.2

From 919c1a8d3efc726850bce7ab02f959dda2e9e543 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <randrianas...@gmail.com>
Date: Wed, 8 Sep 2010 17:15:14 +0400
Subject: [PATCH 7/7] nv0x: enable eng3dm for L8 textures and all non-basic texenv modes, add GL_ZERO case for NV_texture_env_combine4
  , piglit still complain, need even more work!

---
 src/mesa/drivers/dri/nouveau/nv04_context.c      |    9 +++++----
 src/mesa/drivers/dri/nouveau/nv04_state_frag.c   |    8 +++++---
 src/mesa/drivers/dri/nouveau/nv04_state_raster.c |    8 ++------
 3 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c b/src/mesa/drivers/dri/nouveau/nv04_context.c
index af46ce2..bacab57 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_context.c
@@ -39,9 +39,9 @@ nv04_context_engine(GLcontext *ctx)
 	struct nouveau_grobj *fahrenheit;
 
 
-	if (ctx->Texture.Unit[0].EnvMode == GL_COMBINE ||
-	    ctx->Texture.Unit[0].EnvMode == GL_BLEND ||
-	    ctx->Texture.Unit[0].EnvMode == GL_ADD ||
+	if ((ctx->Texture.Unit[0].EnvMode != GL_DECAL &&
+	    ctx->Texture.Unit[0].EnvMode != GL_MODULATE &&
+	    ctx->Texture.Unit[0].EnvMode != GL_REPLACE ) ||
 	    ctx->Texture.Unit[1]._ReallyEnabled ||
 	    ctx->Stencil.Enabled)
 		fahrenheit = hw->eng3dm;
@@ -51,7 +51,8 @@ nv04_context_engine(GLcontext *ctx)
 	if (ctx->Texture.Unit[0]._ReallyEnabled) {
 	struct gl_texture_object *t = ctx->Texture.Unit[0]._Current;
 	struct gl_texture_image *ti = t->Image[0][t->BaseLevel];
-		if (ti->_BaseFormat == GL_ALPHA)
+		if (ti->TexFormat  == MESA_FORMAT_A8 ||
+		ti->TexFormat  == MESA_FORMAT_L8 )
 			fahrenheit = hw->eng3dm;
 	}
 
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_frag.c b/src/mesa/drivers/dri/nouveau/nv04_state_frag.c
index d95ac97..2beb2db 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_frag.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_frag.c
@@ -79,6 +79,8 @@ static uint32_t
 get_input_source(struct combiner_state *rc, int source)
 {
 	switch (source) {
+	case GL_ZERO:
+		return COMBINER_SOURCE(ZERO);
 	case GL_TEXTURE:
 		return rc->unit ? COMBINER_SOURCE(TEXTURE1) :
 			COMBINER_SOURCE(TEXTURE0);
@@ -89,13 +91,13 @@ get_input_source(struct combiner_state *rc, int source)
 	case GL_TEXTURE1:
 		return COMBINER_SOURCE(TEXTURE1);
 
-	case GL_CONSTANT_EXT:
+	case GL_CONSTANT:
 		return COMBINER_SOURCE(CONSTANT);
 
-	case GL_PRIMARY_COLOR_EXT:
+	case GL_PRIMARY_COLOR:
 		return COMBINER_SOURCE(PRIMARY_COLOR);
 
-	case GL_PREVIOUS_EXT:
+	case GL_PREVIOUS:
 		return rc->unit ? COMBINER_SOURCE(PREVIOUS) :
 			COMBINER_SOURCE(PRIMARY_COLOR);
 
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
index a2544fb..9d28201 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
@@ -310,14 +310,10 @@ nv04_emit_blend(GLcontext *ctx, int emit)
 
 		
 		/* Texture environment. */
-		if (ctx->Texture._EnabledUnits) {
-		    if ((ctx->Texture.Unit[0].EnvMode == GL_REPLACE) ||
-			ctx->Texture.Unit[0].EnvMode == GL_MODULATE ||
-			ctx->Texture.Unit[0].EnvMode == GL_DECAL) {
+		if (ctx->Texture._EnabledUnits) 
 			blend |= get_texenv_mode(ctx->Texture.Unit[0].EnvMode);
-		} else { blend |= get_texenv_mode(GL_MODULATE); }
+		else
 			blend |= get_texenv_mode(GL_MODULATE);
-		}
 
 		/* Secondary color */
 		if (NEED_SECONDARY_COLOR(ctx))
-- 
1.7.0.2

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to