diff options
Diffstat (limited to 'src/mesa/drivers/glide')
-rw-r--r-- | src/mesa/drivers/glide/fxglidew.h | 4 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxtris.c | 84 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxvb.c | 49 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxvbtmp.h | 21 |
4 files changed, 65 insertions, 93 deletions
diff --git a/src/mesa/drivers/glide/fxglidew.h b/src/mesa/drivers/glide/fxglidew.h index 31a8fa3b02e..feacde84189 100644 --- a/src/mesa/drivers/glide/fxglidew.h +++ b/src/mesa/drivers/glide/fxglidew.h @@ -119,7 +119,8 @@ typedef struct { float oow; /* 1/W (used for W-buffering, texturing) */ unsigned char pargb[4]; /* B, G, R, A [0..255] */ GrTmuVertex tmuvtx[GLIDE_NUM_TMU]; - long pad[16 - 11]; /* future use; also ensure 64b structure */ + float fog; /* fog coordinate */ + long pad[16 - 12]; /* ensure 64b structure */ } GrVertex; #define GR_VERTEX_X_OFFSET 0 @@ -133,6 +134,7 @@ typedef struct { #define GR_VERTEX_SOW_TMU1_OFFSET 8 #define GR_VERTEX_TOW_TMU1_OFFSET 9 #define GR_VERTEX_OOW_TMU1_OFFSET 10 +#define GR_VERTEX_FOG_OFFSET 11 diff --git a/src/mesa/drivers/glide/fxtris.c b/src/mesa/drivers/glide/fxtris.c index 08ecc6dd81b..209a29e7668 100644 --- a/src/mesa/drivers/glide/fxtris.c +++ b/src/mesa/drivers/glide/fxtris.c @@ -24,6 +24,7 @@ /* Authors: * Keith Whitwell <[email protected]> + * Daniel Borca <[email protected]> */ #include "glheader.h" @@ -310,10 +311,10 @@ static struct { #define VERT_SET_RGBA( dst, f ) \ do { \ - dst->pargb[2] = f[0]; \ - dst->pargb[1] = f[1]; \ - dst->pargb[0] = f[2]; \ - dst->pargb[3] = f[3]; \ + dst->pargb[2] = f[0] * 255.; \ + dst->pargb[1] = f[1] * 255.; \ + dst->pargb[0] = f[2] * 255.; \ + dst->pargb[3] = f[3] * 255.; \ } while (0) #define VERT_COPY_RGBA( v0, v1 ) \ @@ -343,7 +344,7 @@ do { \ #define RENDER_PRIMITIVE fxMesa->render_primitive #define IND FX_FALLBACK_BIT #define TAG(x) x -#include "../common/t_dd_unfilled.h" +#include "../../tnl_dd/t_dd_unfilled.h" #undef IND /*********************************************************************** @@ -352,136 +353,136 @@ do { \ #define IND (0) #define TAG(x) x -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_OFFSET_BIT) #define TAG(x) x##_offset -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_TWOSIDE_BIT) #define TAG(x) x##_twoside -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT) #define TAG(x) x##_twoside_offset -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_UNFILLED_BIT) #define TAG(x) x##_unfilled -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_OFFSET_BIT|FX_UNFILLED_BIT) #define TAG(x) x##_offset_unfilled -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_TWOSIDE_BIT|FX_UNFILLED_BIT) #define TAG(x) x##_twoside_unfilled -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_UNFILLED_BIT) #define TAG(x) x##_twoside_offset_unfilled -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_FALLBACK_BIT) #define TAG(x) x##_fallback -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_OFFSET_BIT|FX_FALLBACK_BIT) #define TAG(x) x##_offset_fallback -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_TWOSIDE_BIT|FX_FALLBACK_BIT) #define TAG(x) x##_twoside_fallback -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_FALLBACK_BIT) #define TAG(x) x##_twoside_offset_fallback -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_UNFILLED_BIT|FX_FALLBACK_BIT) #define TAG(x) x##_unfilled_fallback -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_FALLBACK_BIT) #define TAG(x) x##_offset_unfilled_fallback -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_TWOSIDE_BIT|FX_UNFILLED_BIT|FX_FALLBACK_BIT) #define TAG(x) x##_twoside_unfilled_fallback -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_UNFILLED_BIT| \ FX_FALLBACK_BIT) #define TAG(x) x##_twoside_offset_unfilled_fallback -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" /* Fx doesn't support provoking-vertex flat-shading? */ #define IND (FX_FLAT_BIT) #define TAG(x) x##_flat -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_OFFSET_BIT|FX_FLAT_BIT) #define TAG(x) x##_offset_flat -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_TWOSIDE_BIT|FX_FLAT_BIT) #define TAG(x) x##_twoside_flat -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_FLAT_BIT) #define TAG(x) x##_twoside_offset_flat -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_UNFILLED_BIT|FX_FLAT_BIT) #define TAG(x) x##_unfilled_flat -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_FLAT_BIT) #define TAG(x) x##_offset_unfilled_flat -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_TWOSIDE_BIT|FX_UNFILLED_BIT|FX_FLAT_BIT) #define TAG(x) x##_twoside_unfilled_flat -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_FLAT_BIT) #define TAG(x) x##_twoside_offset_unfilled_flat -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_FALLBACK_BIT|FX_FLAT_BIT) #define TAG(x) x##_fallback_flat -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_OFFSET_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT) #define TAG(x) x##_offset_fallback_flat -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_TWOSIDE_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT) #define TAG(x) x##_twoside_fallback_flat -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT) #define TAG(x) x##_twoside_offset_fallback_flat -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_UNFILLED_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT) #define TAG(x) x##_unfilled_fallback_flat -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT) #define TAG(x) x##_offset_unfilled_fallback_flat -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_TWOSIDE_BIT|FX_UNFILLED_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT) #define TAG(x) x##_twoside_unfilled_fallback_flat -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" #define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_UNFILLED_BIT| \ FX_FALLBACK_BIT|FX_FLAT_BIT) #define TAG(x) x##_twoside_offset_unfilled_fallback_flat -#include "../common/t_dd_tritmp.h" +#include "../../tnl_dd/t_dd_tritmp.h" static void init_rast_tab( void ) @@ -719,9 +720,10 @@ static void fx_render_vb_tri_strip( GLcontext *ctx, INIT(GL_TRIANGLE_STRIP); + /* [dBorca] WTF?!? if (flags & PRIM_PARITY) mode = GR_TRIANGLE_STRIP_CONTINUE; - else + else*/ mode = GR_TRIANGLE_STRIP; grDrawVertexArrayContiguous( mode, count-start, @@ -837,7 +839,7 @@ static void (*fx_render_tab_verts[GL_POLYGON+2])(GLcontext *, fx_render_vb_poly, fx_render_vb_noop, }; -#undef INIT(x) +#undef INIT /**********************************************************************/ @@ -879,7 +881,7 @@ static void (*fx_render_tab_verts[GL_POLYGON+2])(GLcontext *, #undef TAG #define TAG(x) fx_##x##_elts #define ELT(x) elt[x] -#include "../common/t_dd_rendertmp.h" +#include "../../tnl_dd/t_dd_rendertmp.h" /* Verts, no clipping. */ @@ -887,7 +889,7 @@ static void (*fx_render_tab_verts[GL_POLYGON+2])(GLcontext *, #undef TAG #define TAG(x) fx_##x##_verts #define ELT(x) x -/*#include "../common/t_dd_rendertmp.h"*/ /* we have fx_render_vb_* now */ +/*#include "../../tnl_dd/t_dd_rendertmp.h"*/ /* we have fx_render_vb_* now */ diff --git a/src/mesa/drivers/glide/fxvb.c b/src/mesa/drivers/glide/fxvb.c index 8d3647ad60e..03cefef0826 100644 --- a/src/mesa/drivers/glide/fxvb.c +++ b/src/mesa/drivers/glide/fxvb.c @@ -24,7 +24,8 @@ */ /* Authors: - * Keith Whitwell + * Keith Whitwell <[email protected]> + * Daniel Borca <[email protected]> */ #ifdef HAVE_CONFIG_H @@ -67,41 +68,7 @@ static struct { } setup_tab[MAX_SETUP]; -static void import_float_colors( GLcontext *ctx ) -{ - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - struct gl_client_array *from = VB->ColorPtr[0]; - struct gl_client_array *to = &FX_CONTEXT(ctx)->UbyteColor; - GLuint count = VB->Count; - - if (!to->Ptr) { - to->Ptr = ALIGN_MALLOC( VB->Size * 4 * sizeof(GLubyte), 32 ); - to->Type = GL_UNSIGNED_BYTE; - } - - /* No need to transform the same value 3000 times. - */ - if (!from->StrideB) { - to->StrideB = 0; - count = 1; - } - else - to->StrideB = 4 * sizeof(GLubyte); - - _math_trans_4ub( (GLubyte (*)[4]) to->Ptr, - from->Ptr, - from->StrideB, - from->Type, - from->Size, - 0, - count); - - VB->ColorPtr[0] = to; -} - - -/* Hack alert: assume chan is 8 bits */ -#define GET_COLOR(ptr, idx) (((GLchan (*)[4])((ptr)->Ptr))[idx]) +#define GET_COLOR(ptr, idx) ((ptr)->data[idx]) static void interp_extras( GLcontext *ctx, @@ -112,13 +79,15 @@ static void interp_extras( GLcontext *ctx, struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; if (VB->ColorPtr[1]) { - INTERP_4CHAN( t, + assert(VB->ColorPtr[1]->stride == 4 * sizeof(GLfloat)); + + INTERP_4F( t, GET_COLOR(VB->ColorPtr[1], dst), GET_COLOR(VB->ColorPtr[1], out), GET_COLOR(VB->ColorPtr[1], in) ); #if 1 /* [dBorca] GL_EXT_separate_specular_color */ if (VB->SecondaryColorPtr[1]) { - INTERP_3CHAN( t, + INTERP_3F( t, GET_COLOR(VB->SecondaryColorPtr[1], dst), GET_COLOR(VB->SecondaryColorPtr[1], out), GET_COLOR(VB->SecondaryColorPtr[1], in) ); @@ -139,11 +108,11 @@ static void copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src ) struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; if (VB->ColorPtr[1]) { - COPY_CHAN4( GET_COLOR(VB->ColorPtr[1], dst), + COPY_4FV( GET_COLOR(VB->ColorPtr[1], dst), GET_COLOR(VB->ColorPtr[1], src) ); #if 1 /* [dBorca] GL_EXT_separate_specular_color */ if (VB->SecondaryColorPtr[1]) { - COPY_CHAN4( GET_COLOR(VB->SecondaryColorPtr[1], dst), + COPY_4FV( GET_COLOR(VB->SecondaryColorPtr[1], dst), GET_COLOR(VB->SecondaryColorPtr[1], src) ); } #endif diff --git a/src/mesa/drivers/glide/fxvbtmp.h b/src/mesa/drivers/glide/fxvbtmp.h index 7d5741cd75d..e0af9bdb4fe 100644 --- a/src/mesa/drivers/glide/fxvbtmp.h +++ b/src/mesa/drivers/glide/fxvbtmp.h @@ -24,6 +24,7 @@ /* Authors: * Keith Whitwell <[email protected]> + * Daniel Borca <[email protected]> */ @@ -40,7 +41,7 @@ static void TAG(emit)( GLcontext *ctx, GLuint tmu0_source = fxMesa->tmu_source[0]; GLuint tmu1_source = fxMesa->tmu_source[1]; GLfloat (*tc0)[4], (*tc1)[4]; - GLubyte (*col)[4]; + GLfloat (*col)[4]; GLuint tc0_stride, tc1_stride, col_stride; GLuint tc0_size, tc1_size; GLfloat (*proj)[4] = VB->NdcPtr->data; @@ -71,10 +72,8 @@ static void TAG(emit)( GLcontext *ctx, } if (IND & SETUP_RGBA) { - if (VB->ColorPtr[0]->Type != GL_UNSIGNED_BYTE) - import_float_colors( ctx ); - col = VB->ColorPtr[0]->Ptr; - col_stride = VB->ColorPtr[0]->StrideB; + col = VB->ColorPtr[0]->data; + col_stride = VB->ColorPtr[0]->stride; } if (start) { @@ -84,7 +83,7 @@ static void TAG(emit)( GLcontext *ctx, if (IND & SETUP_TMU1) tc1 = (GLfloat (*)[4])((GLubyte *)tc1 + start * tc1_stride); if (IND & SETUP_RGBA) - STRIDE_4UB(col, start * col_stride); + STRIDE_4F(col, start * col_stride); } for (i=start; i < end; i++, v++) { @@ -116,11 +115,11 @@ static void TAG(emit)( GLcontext *ctx, proj = (GLfloat (*)[4])((GLubyte *)proj + proj_stride); } if (IND & SETUP_RGBA) { - v->pargb[2] = col[0][0]; - v->pargb[1] = col[0][1]; - v->pargb[0] = col[0][2]; - v->pargb[3] = col[0][3]; - STRIDE_4UB(col, col_stride); + v->pargb[2] = col[0][0] * 255.; + v->pargb[1] = col[0][1] * 255.; + v->pargb[0] = col[0][2] * 255.; + v->pargb[3] = col[0][3] * 255.; + STRIDE_4F(col, col_stride); } if (IND & SETUP_TMU0) { GLfloat w = v->oow; |