-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The attached patches enable GL_EXT_fog_coord for r300, and also enable
SW TCL to correctly route fog coordinates. This is sufficient to get fog
coords working on the current git head.

I'd like some review, because although it's a cool thought to think that
just these few lines, plus the recent change in fragment program
generation, magically make things work, I've fought against fog for too
long to just assume that it's "that simple." :3

~ C.

- --
~ Corbin Simpson
<[EMAIL PROTECTED]>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkj/sVYACgkQeCCY8PC5utCiMACdGsPKTu+HzDeoXfxRts13WVBv
2kEAoItTAfs6A33cwzabBE7JRY2zfkWK
=vJ8K
-----END PGP SIGNATURE-----
>From 4a474a901c41713d58476b79d1a77a03dce4ba1b Mon Sep 17 00:00:00 2001
From: simpson <[EMAIL PROTECTED](none)>
Date: Wed, 22 Oct 2008 13:36:04 -0700
Subject: [PATCH] r300: Enable EXT_fog_coord.

---
 src/mesa/drivers/dri/r300/r300_context.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/r300/r300_context.c 
b/src/mesa/drivers/dri/r300/r300_context.c
index 3743627..9498082 100644
--- a/src/mesa/drivers/dri/r300/r300_context.c
+++ b/src/mesa/drivers/dri/r300/r300_context.c
@@ -84,7 +84,7 @@ int hw_tcl_on = 1;
 #define need_GL_ARB_vertex_buffer_object
 #define need_GL_ARB_vertex_program
 #define need_GL_EXT_blend_minmax
-//#define need_GL_EXT_fog_coord
+#define need_GL_EXT_fog_coord
 #define need_GL_EXT_multi_draw_arrays
 #define need_GL_EXT_secondary_color
 #define need_GL_EXT_blend_equation_separate
@@ -116,7 +116,7 @@ const struct dri_extension card_extensions[] = {
   {"GL_EXT_blend_func_separate",       GL_EXT_blend_func_separate_functions},
   {"GL_EXT_blend_minmax",              GL_EXT_blend_minmax_functions},
   {"GL_EXT_blend_subtract",            NULL},
-//  {"GL_EXT_fog_coord",                       GL_EXT_fog_coord_functions },
+{"GL_EXT_fog_coord",                   GL_EXT_fog_coord_functions },
   {"GL_EXT_multi_draw_arrays",         GL_EXT_multi_draw_arrays_functions},
   {"GL_EXT_gpu_program_parameters",     
GL_EXT_gpu_program_parameters_functions},
   {"GL_EXT_secondary_color",           GL_EXT_secondary_color_functions},
-- 
1.5.6.4

>From 25a80ca9959d843df532f4e96609e7da7e3b3d50 Mon Sep 17 00:00:00 2001
From: simpson <[EMAIL PROTECTED](none)>
Date: Wed, 22 Oct 2008 13:36:20 -0700
Subject: [PATCH] r300: Enable SW TCL fog coords.

---
 src/mesa/drivers/dri/r300/r300_swtcl.c          |    2 ++
 src/mesa/drivers/dri/r300/radeon_program_pair.c |    5 +++++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c 
b/src/mesa/drivers/dri/r300/r300_swtcl.c
index b6e7ce1..8287da5 100644
--- a/src/mesa/drivers/dri/r300/r300_swtcl.c
+++ b/src/mesa/drivers/dri/r300/r300_swtcl.c
@@ -186,6 +186,8 @@ static void r300SetVertexFormat( GLcontext *ctx )
        for (i = VERT_ATTRIB_TEX0; i <= VERT_ATTRIB_TEX7; i++)
                if (InputsRead & (1 << i))
                        inputs[i] = 6 + (i - VERT_ATTRIB_TEX0);
+       if (InputsRead & (1 << VERT_ATTRIB_FOG))
+               inputs[VERT_ATTRIB_FOG] = 14;
        
        for (i = 0, nr = 0; i < VERT_ATTRIB_MAX; i++) {
                if (InputsRead & (1 << i)) {
diff --git a/src/mesa/drivers/dri/r300/radeon_program_pair.c 
b/src/mesa/drivers/dri/r300/radeon_program_pair.c
index 5ad50d2..58bc0d5 100644
--- a/src/mesa/drivers/dri/r300/radeon_program_pair.c
+++ b/src/mesa/drivers/dri/r300/radeon_program_pair.c
@@ -473,6 +473,11 @@ static void allocate_input_registers(struct pair_state *s)
                alloc_hw_reg(s, PROGRAM_INPUT, FRAG_ATTRIB_COL1, hwindex++);
        InputsRead &= ~FRAG_BIT_COL1;
 
+       /* Fog coordinate */
+       if (InputsRead & FRAG_BIT_FOGC)
+               alloc_hw_reg(s, PROGRAM_INPUT, FRAG_ATTRIB_FOGC, hwindex++);
+       InputsRead &= ~FRAG_BIT_FOGC;
+
        /* Anything else */
        if (InputsRead)
                error("Don't know how to handle inputs 0x%x\n", InputsRead);
-- 
1.5.6.4

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to