Francisco, [and everyone interested] please add comments!

What i sould add in validation code, what is correct mesa_format for various 
nv hardware for depth textures, new piglit failures and so on.

Patches  on top of mesa ea9e5dbbc2e992ead954d3d2ebf3689f7a003f79
From 228d160733321125389871aa92f9cce809713374 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <randrianas...@gmail.com>
Date: Fri, 10 Sep 2010 22:28:06 +0400
Subject: [PATCH 1/4] nouveau: add prototype function for validating FBO, based on intel code
 Allow wine to start.

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

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
index 32d8f2d..baac4fd 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
@@ -259,6 +259,33 @@ nouveau_finish_render_texture(GLcontext *ctx,
 	texture_dirty(att->Texture);
 }
 
+
+static void
+nouveau_validate_rb(GLcontext *ctx, struct gl_framebuffer *fb)
+{
+
+int	i;
+
+	for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
+      struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[i];
+
+      if (rb == NULL)
+		continue;
+
+      switch (rb->Format) {
+      case MESA_FORMAT_ARGB8888:
+      case MESA_FORMAT_XRGB8888:
+      case MESA_FORMAT_RGB565:
+ break;
+      default:
+ fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
+      }
+   }
+
+
+}
+
+
 void
 nouveau_fbo_functions_init(struct dd_function_table *functions)
 {
@@ -269,5 +296,6 @@ nouveau_fbo_functions_init(struct dd_function_table *functions)
 	functions->FramebufferRenderbuffer = nouveau_framebuffer_renderbuffer;
 	functions->RenderTexture = nouveau_render_texture;
 	functions->FinishRenderTexture = nouveau_finish_render_texture;
+	functions->ValidateFramebuffer = nouveau_validate_rb;
 #endif
 }
-- 
1.7.0.2

From aaa8d998a307dee0cfc636a21e69d78f2c2a2a18 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <randrianas...@gmail.com>
Date: Fri, 10 Sep 2010 22:31:02 +0400
Subject: [PATCH 2/4] nouveau: Move ARB_texture_env_dot3  and  GL_ARB_texture_env_combine
 into nv10/nv20 specific extension lists, add GL_EXT_packed_depth_stencil
 into common list so demos/fbotexture starts on nv05  and appear correct

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

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 4a1534b..cea3588 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -50,12 +50,11 @@
 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 },
 	{ "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 },
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 68f425c6c38168a002f9100d063057dda3852e43 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <randrianas...@gmail.com>
Date: Fri, 10 Sep 2010 22:35:04 +0400
Subject: [PATCH 3/4] nouveau: Allow depth textures in common code, pushed  assertion down to
 individual drivers, assert only show  up after I exposed
 GL_EXT_packed_depth_stencil and run piglit's fbo tests.

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

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index 442f4e8..5fe0ad0 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -171,6 +171,15 @@ nouveau_choose_tex_format(GLcontext *ctx, GLint internalFormat,
 	case GL_COLOR_INDEX16_EXT:
 	case GL_COLOR_INDEX8_EXT:
 		return MESA_FORMAT_CI8;
+	
+	case GL_DEPTH_COMPONENT:
+	case GL_DEPTH_COMPONENT16:
+	case GL_DEPTH_COMPONENT24:
+	case GL_DEPTH_COMPONENT32:
+	case GL_DEPTH_STENCIL_EXT:
+	case GL_DEPTH24_STENCIL8_EXT:
+		return MESA_FORMAT_S8_Z24;
+
 
 	default:
 		assert(0);
-- 
1.7.0.2

From 913e17d86c08ef69730e913cbdd7555838558a25 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <randrianas...@gmail.com>
Date: Fri, 10 Sep 2010 22:37:55 +0400
Subject: [PATCH 4/4] nv0x: Enable eng3dm for A8/L8 textures, v2 hopefully has formatting issue fixed,
 aligned with code in mesa master. Still required for text display in many demos

---
 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 1d34c86..2af167c 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_context.c
@@ -47,6 +47,14 @@ 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->TexFormat  == MESA_FORMAT_A8 ||
+		    ti->TexFormat  == MESA_FORMAT_L8)
+		fahrenheit = hw->eng3dm;
+	}
 
 	if (fahrenheit != nctx->eng3d) {
 		nctx->eng3d = fahrenheit;
-- 
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