From 064ae479a770bf434958d673baf6f7530f642697 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 23 Feb 2007 13:40:13 -0700 Subject: [PATCH] Update DRI drivers for new glsl compiler. Mostly: - update #includes - update STATE_* token code --- src/mesa/drivers/dri/i915/i915_context.c | 2 +- src/mesa/drivers/dri/i915/i915_fragprog.c | 6 +- src/mesa/drivers/dri/i915/i915_program.c | 12 ++-- src/mesa/drivers/dri/i915/i915_state.c | 2 +- src/mesa/drivers/dri/i915/i915_vtbl.c | 2 +- src/mesa/drivers/dri/i915tex/i915_context.c | 4 +- src/mesa/drivers/dri/i915tex/i915_fragprog.c | 6 +- src/mesa/drivers/dri/i915tex/i915_program.c | 12 ++-- src/mesa/drivers/dri/i915tex/i915_state.c | 2 +- src/mesa/drivers/dri/i965/brw_context.c | 2 +- src/mesa/drivers/dri/i965/brw_curbe.c | 3 +- src/mesa/drivers/dri/i965/brw_eu.h | 2 +- src/mesa/drivers/dri/i965/brw_metaops.c | 2 - src/mesa/drivers/dri/i965/brw_util.c | 32 +++++------ src/mesa/drivers/dri/i965/brw_vs.c | 3 +- src/mesa/drivers/dri/i965/brw_vs_constval.c | 4 +- src/mesa/drivers/dri/i965/brw_vs_emit.c | 5 +- src/mesa/drivers/dri/i965/brw_vs_tnl.c | 75 ++++++++++++------------- src/mesa/drivers/dri/i965/brw_wm.c | 4 -- src/mesa/drivers/dri/i965/brw_wm.h | 2 +- src/mesa/drivers/dri/i965/brw_wm_debug.c | 3 - src/mesa/drivers/dri/i965/brw_wm_emit.c | 4 +- src/mesa/drivers/dri/i965/brw_wm_fp.c | 34 +++++------ src/mesa/drivers/dri/i965/brw_wm_pass0.c | 4 +- src/mesa/drivers/dri/i965/brw_wm_pass1.c | 3 - src/mesa/drivers/dri/i965/brw_wm_pass2.c | 4 +- src/mesa/drivers/dri/mach64/mach64_native_vb.c | 20 +++---- src/mesa/drivers/dri/nouveau/nouveau_context.c | 2 +- src/mesa/drivers/dri/nouveau/nouveau_shader.c | 5 +- src/mesa/drivers/dri/nouveau/nouveau_shader_0.c | 16 ++++-- src/mesa/drivers/dri/nouveau/nouveau_shader_2.c | 3 +- src/mesa/drivers/dri/r200/r200_vertprog.c | 10 ++-- src/mesa/drivers/dri/r300/r300_context.c | 2 +- src/mesa/drivers/dri/r300/r300_fragprog.c | 5 +- src/mesa/drivers/dri/r300/r300_fragprog.h | 5 +- src/mesa/drivers/dri/r300/r300_shader.c | 5 -- src/mesa/drivers/dri/r300/r300_state.c | 8 ++- src/mesa/drivers/dri/r300/r300_vertexprog.c | 13 +++-- src/mesa/drivers/dri/s3v/s3v_tritmp.h | 46 +++++++-------- src/mesa/drivers/dri/tdfx/tdfx_tris.c | 16 +++--- src/mesa/drivers/dri/trident/trident_context.h | 2 +- 41 files changed, 187 insertions(+), 205 deletions(-) diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index e58c949..4ab9d26 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -167,7 +167,7 @@ GLboolean i915CreateContext( const __GLcontextModes *mesaVis, I915_MAX_TEX_INSN); ctx->Const.FragmentProgram.MaxNativeTexIndirections = I915_MAX_TEX_INDIRECT; ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* I don't think we have one */ - ctx->_MaintainTexEnvProgram = GL_TRUE; + ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; driInitExtensions( ctx, i915_extensions, GL_FALSE ); diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c index ef14f3e..a28c8bb 100644 --- a/src/mesa/drivers/dri/i915/i915_fragprog.c +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c @@ -37,7 +37,8 @@ #include "i915_context.h" #include "i915_program.h" -#include "program_instruction.h" +#include "prog_instruction.h" +#include "prog_parameter.h" #include "program.h" #include "programopt.h" @@ -782,9 +783,6 @@ static void fixup_depth_write( struct i915_fragment_program *p ) } -#define FRAG_BIT_TEX(n) (FRAG_BIT_TEX0 << (n)) - - static void check_wpos( struct i915_fragment_program *p ) { GLuint inputs = p->FragProg.Base.InputsRead; diff --git a/src/mesa/drivers/dri/i915/i915_program.c b/src/mesa/drivers/dri/i915/i915_program.c index 9c13290..6849112 100644 --- a/src/mesa/drivers/dri/i915/i915_program.c +++ b/src/mesa/drivers/dri/i915/i915_program.c @@ -430,17 +430,17 @@ void i915_fini_program( struct i915_fragment_program *p ) if (p->error) { p->FragProg.Base.NumNativeInstructions = 0; - p->FragProg.NumNativeAluInstructions = 0; - p->FragProg.NumNativeTexInstructions = 0; - p->FragProg.NumNativeTexIndirections = 0; + p->FragProg.Base.NumNativeAluInstructions = 0; + p->FragProg.Base.NumNativeTexInstructions = 0; + p->FragProg.Base.NumNativeTexIndirections = 0; } else { p->FragProg.Base.NumNativeInstructions = (p->nr_alu_insn + p->nr_tex_insn + p->nr_decl_insn); - p->FragProg.NumNativeAluInstructions = p->nr_alu_insn; - p->FragProg.NumNativeTexInstructions = p->nr_tex_insn; - p->FragProg.NumNativeTexIndirections = p->nr_tex_indirect; + p->FragProg.Base.NumNativeAluInstructions = p->nr_alu_insn; + p->FragProg.Base.NumNativeTexInstructions = p->nr_tex_insn; + p->FragProg.Base.NumNativeTexIndirections = p->nr_tex_indirect; } p->declarations[0] |= program_size + decl_size - 2; diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c index fd11e10..5692289 100644 --- a/src/mesa/drivers/dri/i915/i915_state.c +++ b/src/mesa/drivers/dri/i915/i915_state.c @@ -531,7 +531,7 @@ void i915_update_fog( GLcontext *ctx ) GLboolean enabled; GLboolean try_pixel_fog; - if (ctx->FragmentProgram._Active) { + if (ctx->FragmentProgram._Enabled) { /* Pull in static fog state from program */ mode = ctx->FragmentProgram._Current->FogOption; diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c index 7924754..82a421b 100644 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c @@ -49,7 +49,7 @@ static void i915_render_start( intelContextPtr intel ) if (ctx->FragmentProgram._Current) i915ValidateFragmentProgram( i915 ); else { - assert(!ctx->_MaintainTexEnvProgram); + assert(!ctx->FragmentProgram._MaintainTexEnvProgram); i915ValidateTextureProgram( i915 ); } } diff --git a/src/mesa/drivers/dri/i915tex/i915_context.c b/src/mesa/drivers/dri/i915tex/i915_context.c index 9b4d72e..d418723 100644 --- a/src/mesa/drivers/dri/i915tex/i915_context.c +++ b/src/mesa/drivers/dri/i915tex/i915_context.c @@ -157,8 +157,8 @@ i915CreateContext(const __GLcontextModes * mesaVis, I915_MAX_TEX_INDIRECT; ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* I don't think we have one */ - ctx->_MaintainTexEnvProgram = 1; - ctx->_UseTexEnvProgram = 1; + ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; + /*ctx->_UseTexEnvProgram = 1;*/ driInitExtensions(ctx, i915_extensions, GL_FALSE); diff --git a/src/mesa/drivers/dri/i915tex/i915_fragprog.c b/src/mesa/drivers/dri/i915tex/i915_fragprog.c index 8772e70..cbea609 100644 --- a/src/mesa/drivers/dri/i915tex/i915_fragprog.c +++ b/src/mesa/drivers/dri/i915tex/i915_fragprog.c @@ -37,7 +37,8 @@ #include "i915_context.h" #include "i915_program.h" -#include "program_instruction.h" +#include "prog_instruction.h" +#include "prog_parameter.h" #include "program.h" #include "programopt.h" @@ -772,9 +773,6 @@ fixup_depth_write(struct i915_fragment_program *p) } -#define FRAG_BIT_TEX(n) (FRAG_BIT_TEX0 << (n)) - - static void check_wpos(struct i915_fragment_program *p) { diff --git a/src/mesa/drivers/dri/i915tex/i915_program.c b/src/mesa/drivers/dri/i915tex/i915_program.c index 0be89d3..ed45e4f 100644 --- a/src/mesa/drivers/dri/i915tex/i915_program.c +++ b/src/mesa/drivers/dri/i915tex/i915_program.c @@ -446,17 +446,17 @@ i915_fini_program(struct i915_fragment_program *p) if (p->error) { p->FragProg.Base.NumNativeInstructions = 0; - p->FragProg.NumNativeAluInstructions = 0; - p->FragProg.NumNativeTexInstructions = 0; - p->FragProg.NumNativeTexIndirections = 0; + p->FragProg.Base.NumNativeAluInstructions = 0; + p->FragProg.Base.NumNativeTexInstructions = 0; + p->FragProg.Base.NumNativeTexIndirections = 0; } else { p->FragProg.Base.NumNativeInstructions = (p->nr_alu_insn + p->nr_tex_insn + p->nr_decl_insn); - p->FragProg.NumNativeAluInstructions = p->nr_alu_insn; - p->FragProg.NumNativeTexInstructions = p->nr_tex_insn; - p->FragProg.NumNativeTexIndirections = p->nr_tex_indirect; + p->FragProg.Base.NumNativeAluInstructions = p->nr_alu_insn; + p->FragProg.Base.NumNativeTexInstructions = p->nr_tex_insn; + p->FragProg.Base.NumNativeTexIndirections = p->nr_tex_indirect; } p->declarations[0] |= program_size + decl_size - 2; diff --git a/src/mesa/drivers/dri/i915tex/i915_state.c b/src/mesa/drivers/dri/i915tex/i915_state.c index 78ae4bd..4816afc 100644 --- a/src/mesa/drivers/dri/i915tex/i915_state.c +++ b/src/mesa/drivers/dri/i915tex/i915_state.c @@ -561,7 +561,7 @@ i915_update_fog(GLcontext * ctx) GLboolean enabled; GLboolean try_pixel_fog; - if (ctx->FragmentProgram._Active) { + if (ctx->FragmentProgram._Enabled) { /* Pull in static fog state from program */ mode = ctx->FragmentProgram._Current->FogOption; diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 6faee65..397a9bd 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -148,7 +148,7 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis, brw->emit_state_always = 0; - ctx->_MaintainTexEnvProgram = 1; + ctx->FragmentProgram._MaintainTexEnvProgram = 1; brw_draw_init( brw ); diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index 4352c3b..3f0aaa1 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -35,7 +35,8 @@ #include "context.h" #include "macros.h" #include "enums.h" -#include "shader/program.h" +#include "shader/prog_parameter.h" +#include "shader/prog_statevars.h" #include "intel_batchbuffer.h" #include "brw_context.h" #include "brw_defines.h" diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h index d4dbcf3..52f89d5 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.h +++ b/src/mesa/drivers/dri/i965/brw_eu.h @@ -35,7 +35,7 @@ #include "brw_structs.h" #include "brw_defines.h" -#include "shader/program.h" +#include "shader/prog_instruction.h" #define BRW_SWIZZLE4(a,b,c,d) (((a)<<0) | ((b)<<2) | ((c)<<4) | ((d)<<6)) #define BRW_GET_SWZ(swz, idx) (((swz) >> ((idx)*2)) & 0x3) diff --git a/src/mesa/drivers/dri/i965/brw_metaops.c b/src/mesa/drivers/dri/i965/brw_metaops.c index 1579762..6e030f1 100644 --- a/src/mesa/drivers/dri/i965/brw_metaops.c +++ b/src/mesa/drivers/dri/i965/brw_metaops.c @@ -35,8 +35,6 @@ #include "glheader.h" #include "context.h" #include "macros.h" -#include "enums.h" -#include "dd.h" #include "shader/arbprogparse.h" diff --git a/src/mesa/drivers/dri/i965/brw_util.c b/src/mesa/drivers/dri/i965/brw_util.c index 9d12c26..b6deee2 100644 --- a/src/mesa/drivers/dri/i965/brw_util.c +++ b/src/mesa/drivers/dri/i965/brw_util.c @@ -30,9 +30,9 @@ */ -#include "brw_util.h" #include "mtypes.h" -#include "shader/program.h" +#include "shader/prog_parameter.h" +#include "brw_util.h" #include "brw_defines.h" GLuint brw_count_bits( GLuint val ) @@ -45,7 +45,7 @@ GLuint brw_count_bits( GLuint val ) } -static GLuint brw_parameter_state_flags(const enum state_index state[]) +static GLuint brw_parameter_state_flags(const gl_state_index state[]) { switch (state[0]) { case STATE_MATERIAL: @@ -70,22 +70,16 @@ static GLuint brw_parameter_state_flags(const enum state_index state[]) case STATE_POINT_ATTENUATION: return _NEW_POINT; - case STATE_MATRIX: - switch (state[1]) { - case STATE_MODELVIEW: - return _NEW_MODELVIEW; - case STATE_PROJECTION: - return _NEW_PROJECTION; - case STATE_MVP: - return _NEW_MODELVIEW | _NEW_PROJECTION; - case STATE_TEXTURE: - return _NEW_TEXTURE_MATRIX; - case STATE_PROGRAM: - return _NEW_TRACK_MATRIX; - default: - assert(0); - return 0; - } + case STATE_MODELVIEW_MATRIX: + return _NEW_MODELVIEW; + case STATE_PROJECTION_MATRIX: + return _NEW_PROJECTION; + case STATE_MVP_MATRIX: + return _NEW_MODELVIEW | _NEW_PROJECTION; + case STATE_TEXTURE_MATRIX: + return _NEW_TEXTURE_MATRIX; + case STATE_PROGRAM_MATRIX: + return _NEW_TRACK_MATRIX; case STATE_DEPTH_RANGE: return _NEW_VIEWPORT; diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index 74c9d88..e173f6f 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -34,8 +34,7 @@ #include "brw_vs.h" #include "brw_util.h" #include "brw_state.h" -#include "program.h" -#include "shader/arbprogparse.h" +#include "shader/prog_print.h" diff --git a/src/mesa/drivers/dri/i965/brw_vs_constval.c b/src/mesa/drivers/dri/i965/brw_vs_constval.c index 528e164..caef042 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_constval.c +++ b/src/mesa/drivers/dri/i965/brw_vs_constval.c @@ -30,10 +30,8 @@ */ -#include "brw_context.h" -#include "program.h" -#include "program_instruction.h" #include "macros.h" +#include "brw_context.h" #include "brw_vs.h" /* Component is active if it may diverge from [0,0,0,1]. Undef values diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index ffdb843..6eb11b1 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -30,10 +30,11 @@ */ -#include "brw_context.h" #include "program.h" -#include "program_instruction.h" #include "macros.h" +#include "shader/prog_parameter.h" +#include "shader/prog_print.h" +#include "brw_context.h" #include "brw_vs.h" diff --git a/src/mesa/drivers/dri/i965/brw_vs_tnl.c b/src/mesa/drivers/dri/i965/brw_vs_tnl.c index 0d61092..21e961c 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_tnl.c +++ b/src/mesa/drivers/dri/i965/brw_vs_tnl.c @@ -33,12 +33,11 @@ #include "glheader.h" #include "macros.h" #include "enums.h" +#include "shader/prog_parameter.h" +#include "shader/prog_print.h" #include "brw_vs.h" #include "brw_state.h" -#include "shader/program.h" -#include "shader/program_instruction.h" -#include "shader/arbprogparse.h" struct state_key { unsigned light_global_enabled:1; @@ -398,11 +397,14 @@ static struct ureg register_const4f( struct tnl_program *p, { GLfloat values[4]; GLint idx; + GLuint swizzle; values[0] = s0; values[1] = s1; values[2] = s2; values[3] = s3; - idx = _mesa_add_unnamed_constant( p->program->Base.Parameters, values, 4 ); + idx = _mesa_add_unnamed_constant( p->program->Base.Parameters, values, 4, + &swizzle); + /* XXX what about swizzle? */ return make_ureg(PROGRAM_STATE_VAR, idx); } @@ -424,40 +426,37 @@ static struct ureg get_identity_param( struct tnl_program *p ) return p->identity; } -static struct ureg register_param6( struct tnl_program *p, - GLint s0, - GLint s1, - GLint s2, - GLint s3, - GLint s4, - GLint s5) +static struct ureg register_param5( struct tnl_program *p, + GLint s0, + GLint s1, + GLint s2, + GLint s3, + GLint s4) { - GLint tokens[6]; + gl_state_index tokens[STATE_LENGTH]; GLint idx; tokens[0] = s0; tokens[1] = s1; tokens[2] = s2; tokens[3] = s3; tokens[4] = s4; - tokens[5] = s5; idx = _mesa_add_state_reference( p->program->Base.Parameters, tokens ); return make_ureg(PROGRAM_STATE_VAR, idx); } -#define register_param1(p,s0) register_param6(p,s0,0,0,0,0,0) -#define register_param2(p,s0,s1) register_param6(p,s0,s1,0,0,0,0) -#define register_param3(p,s0,s1,s2) register_param6(p,s0,s1,s2,0,0,0) -#define register_param4(p,s0,s1,s2,s3) register_param6(p,s0,s1,s2,s3,0,0) +#define register_param1(p,s0) register_param5(p,s0,0,0,0,0) +#define register_param2(p,s0,s1) register_param5(p,s0,s1,0,0,0) +#define register_param3(p,s0,s1,s2) register_param5(p,s0,s1,s2,0,0) +#define register_param4(p,s0,s1,s2,s3) register_param5(p,s0,s1,s2,s3,0) -static void register_matrix_param6( struct tnl_program *p, - GLint s0, - GLint s1, - GLint s2, - GLint s3, - GLint s4, - GLint s5, +static void register_matrix_param5( struct tnl_program *p, + GLint s0, /* matrix name */ + GLint s1, /* texture matrix number */ + GLint s2, /* first row */ + GLint s3, /* last row */ + GLint s4, /* modifier */ struct ureg *matrix ) { GLint i; @@ -465,8 +464,8 @@ static void register_matrix_param6( struct tnl_program *p, /* This is a bit sad as the support is there to pull the whole * matrix out in one go: */ - for (i = 0; i <= s4 - s3; i++) - matrix[i] = register_param6( p, s0, s1, s2, i, i, s5 ); + for (i = 0; i <= s3 - s2; i++) + matrix[i] = register_param5( p, s0, s1, i, i, s4 ); } @@ -650,13 +649,13 @@ static struct ureg get_eye_position( struct tnl_program *p ) p->eye_position = reserve_temp(p); if (PREFER_DP4) { - register_matrix_param6( p, STATE_MATRIX, STATE_MODELVIEW, 0, 0, 3, - STATE_MATRIX, modelview ); + register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 3, + 0, modelview ); emit_matrix_transform_vec4(p, p->eye_position, modelview, pos); } else { - register_matrix_param6( p, STATE_MATRIX, STATE_MODELVIEW, 0, 0, 3, + register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 3, STATE_MATRIX_TRANSPOSE, modelview ); emit_transpose_matrix_transform_vec4(p, p->eye_position, modelview, pos); @@ -710,7 +709,7 @@ static struct ureg get_eye_normal( struct tnl_program *p ) struct ureg normal = register_input(p, VERT_ATTRIB_NORMAL ); struct ureg mvinv[3]; - register_matrix_param6( p, STATE_MATRIX, STATE_MODELVIEW, 0, 0, 2, + register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 2, STATE_MATRIX_INVTRANS, mvinv ); p->eye_normal = reserve_temp(p); @@ -745,12 +744,12 @@ static void build_hpos( struct tnl_program *p ) struct ureg mvp[4]; if (PREFER_DP4) { - register_matrix_param6( p, STATE_MATRIX, STATE_MVP, 0, 0, 3, - STATE_MATRIX, mvp ); + register_matrix_param5( p, STATE_MVP_MATRIX, 0, 0, 3, + 0, mvp ); emit_matrix_transform_vec4( p, hpos, mvp, pos ); } else { - register_matrix_param6( p, STATE_MATRIX, STATE_MVP, 0, 0, 3, + register_matrix_param5( p, STATE_MVP_MATRIX, 0, 0, 3, STATE_MATRIX_TRANSPOSE, mvp ); emit_transpose_matrix_transform_vec4( p, hpos, mvp, pos ); } @@ -988,7 +987,7 @@ static void build_lighting( struct tnl_program *p ) */ VPpli = register_param3(p, STATE_LIGHT, i, STATE_POSITION_NORMALIZED); - half = register_param3(p, STATE_LIGHT, i, STATE_HALF); + half = register_param3(p, STATE_LIGHT, i, STATE_HALF_VECTOR); } else { struct ureg Ppli = register_param3(p, STATE_LIGHT, i, @@ -1356,13 +1355,13 @@ static void build_texture_transform( struct tnl_program *p ) out_texgen : register_input(p, VERT_ATTRIB_TEX0+i)); if (PREFER_DP4) { - register_matrix_param6( p, STATE_MATRIX, STATE_TEXTURE, i, - 0, 3, STATE_MATRIX, texmat ); + register_matrix_param5( p, STATE_TEXTURE_MATRIX, i, 0, 3, + 0, texmat ); emit_matrix_transform_vec4( p, out, texmat, in ); } else { - register_matrix_param6( p, STATE_MATRIX, STATE_TEXTURE, i, - 0, 3, STATE_MATRIX_TRANSPOSE, texmat ); + register_matrix_param5( p, STATE_TEXTURE_MATRIX, i, 0, 3, + STATE_MATRIX_TRANSPOSE, texmat ); emit_transpose_matrix_transform_vec4( p, out, texmat, in ); } } diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 0f842d2..1497dc7 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -36,10 +36,6 @@ #include "brw_state.h" #include "brw_hal.h" -#include "program.h" -#include "program_instruction.h" -#include "arbprogparse.h" - GLuint brw_wm_nr_args( GLuint opcode ) { diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index ec6ad61..f5fddfd 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -36,7 +36,7 @@ #include "brw_context.h" #include "brw_eu.h" -#include "program_instruction.h" +#include "prog_instruction.h" /* A big lookup table is used to figure out which and how many * additional regs will inserted before the main payload in the WM diff --git a/src/mesa/drivers/dri/i965/brw_wm_debug.c b/src/mesa/drivers/dri/i965/brw_wm_debug.c index 9a6154b..f31d097 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_debug.c +++ b/src/mesa/drivers/dri/i965/brw_wm_debug.c @@ -32,9 +32,6 @@ #include "brw_context.h" #include "brw_wm.h" -#include "program.h" -#include "shader/arbprogparse.h" -#include "shader/program_instruction.h" void brw_wm_print_value( struct brw_wm_compile *c, diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index d96a9b7..fd60515 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -30,10 +30,8 @@ */ -#include "brw_context.h" -#include "program.h" -#include "program_instruction.h" #include "macros.h" +#include "brw_context.h" #include "brw_wm.h" #define SATURATE (1<<5) diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index bb0aa35..47ddcd0 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -37,9 +37,10 @@ #include "brw_wm.h" #include "brw_util.h" -#include "shader/program.h" -#include "shader/program_instruction.h" -#include "shader/arbprogparse.h" +#include "shader/prog_parameter.h" +#include "shader/prog_print.h" +#include "shader/prog_statevars.h" + #define FIRST_INTERNAL_TEMP MAX_NV_FRAGMENT_PROGRAM_TEMPS @@ -370,23 +371,21 @@ static void emit_interp( struct brw_wm_compile *c, * harm and it's not as if the parameter handling isn't a big hack * anyway. */ -static struct prog_src_register search_or_add_param6( struct brw_wm_compile *c, - GLint s0, - GLint s1, - GLint s2, - GLint s3, - GLint s4, - GLint s5) +static struct prog_src_register search_or_add_param5(struct brw_wm_compile *c, + GLint s0, + GLint s1, + GLint s2, + GLint s3, + GLint s4) { struct gl_program_parameter_list *paramList = c->fp->program.Base.Parameters; - GLint tokens[6]; + gl_state_index tokens[STATE_LENGTH]; GLuint idx; tokens[0] = s0; tokens[1] = s1; tokens[2] = s2; tokens[3] = s3; tokens[4] = s4; - tokens[5] = s5; for (idx = 0; idx < paramList->NumParameters; idx++) { if (paramList->Parameters[idx].Type == PROGRAM_STATE_VAR && @@ -413,6 +412,7 @@ static struct prog_src_register search_or_add_const4f( struct brw_wm_compile *c, struct gl_program_parameter_list *paramList = c->fp->program.Base.Parameters; GLfloat values[4]; GLuint idx; + GLuint swizzle; values[0] = s0; values[1] = s1; @@ -432,8 +432,8 @@ static struct prog_src_register search_or_add_const4f( struct brw_wm_compile *c, return src_reg(PROGRAM_STATE_VAR, idx); } - idx = _mesa_add_unnamed_constant( paramList, values, 4 ); - + idx = _mesa_add_unnamed_constant( paramList, values, 4, &swizzle ); + /* XXX what about swizzle? */ return src_reg(PROGRAM_STATE_VAR, idx); } @@ -527,11 +527,11 @@ static void precalc_tex( struct brw_wm_compile *c, if (inst->TexSrcTarget == TEXTURE_RECT_INDEX) { struct prog_src_register scale = - search_or_add_param6( c, + search_or_add_param5( c, STATE_INTERNAL, STATE_TEXRECT_SCALE, inst->TexSrcUnit, - 0,0,0 ); + 0,0 ); tmpcoord = get_temp(c); @@ -724,7 +724,7 @@ static void fog_blend( struct brw_wm_compile *c, struct prog_src_register fog_factor ) { struct prog_dst_register outcolor = dst_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLR); - struct prog_src_register fogcolor = search_or_add_param6( c, STATE_FOG_COLOR, 0,0,0,0,0 ); + struct prog_src_register fogcolor = search_or_add_param5( c, STATE_FOG_COLOR, 0,0,0,0 ); /* color.xyz = LRP fog_factor.xxxx, output_color, fog_color */ diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass0.c b/src/mesa/drivers/dri/i965/brw_wm_pass0.c index 36b69b7..00f6f6b 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_pass0.c +++ b/src/mesa/drivers/dri/i965/brw_wm_pass0.c @@ -32,9 +32,7 @@ #include "brw_context.h" #include "brw_wm.h" -#include "program.h" -#include "arbprogparse.h" -#include "program_instruction.h" +#include "shader/prog_parameter.h" diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass1.c b/src/mesa/drivers/dri/i965/brw_wm_pass1.c index 21d0881..d668def 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_pass1.c +++ b/src/mesa/drivers/dri/i965/brw_wm_pass1.c @@ -32,9 +32,6 @@ #include "brw_context.h" #include "brw_wm.h" -#include "program.h" -#include "arbprogparse.h" -#include "program_instruction.h" static GLuint get_tracked_mask(struct brw_wm_compile *c, diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass2.c b/src/mesa/drivers/dri/i965/brw_wm_pass2.c index cb8d51f..a1edbd6 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_pass2.c +++ b/src/mesa/drivers/dri/i965/brw_wm_pass2.c @@ -32,9 +32,7 @@ #include "brw_context.h" #include "brw_wm.h" -#include "program.h" -#include "arbprogparse.h" -#include "program_instruction.h" + /* Use these to force spilling so that that functionality can be * tested with known-good examples rather than having to construct new diff --git a/src/mesa/drivers/dri/mach64/mach64_native_vb.c b/src/mesa/drivers/dri/mach64/mach64_native_vb.c index 7872c20..519ec81 100644 --- a/src/mesa/drivers/dri/mach64/mach64_native_vb.c +++ b/src/mesa/drivers/dri/mach64/mach64_native_vb.c @@ -52,14 +52,14 @@ void TAG(translate_vertex)(GLcontext *ctx, { float rhw = 1.0 / LE32_IN_FLOAT( p + 2 ); - dst->texcoord[1][0] = rhw*LE32_IN_FLOAT( p++ ); - dst->texcoord[1][1] = rhw*LE32_IN_FLOAT( p++ ); + dst->attrib[FRAG_ATTRIB_TEX1][0] = rhw*LE32_IN_FLOAT( p++ ); + dst->attrib[FRAG_ATTRIB_TEX1][1] = rhw*LE32_IN_FLOAT( p++ ); } #else - dst->texcoord[1][0] = LE32_IN_FLOAT( p++ ); - dst->texcoord[1][1] = LE32_IN_FLOAT( p++ ); + dst->attrib[FRAG_ATTRIB_TEX1][0] = LE32_IN_FLOAT( p++ ); + dst->attrib[FRAG_ATTRIB_TEX1][1] = LE32_IN_FLOAT( p++ ); #endif - dst->texcoord[1][3] = 1.0; + dst->attrib[FRAG_ATTRIB_TEX1][3] = 1.0; p++; case TEX0_VERTEX_FORMAT: @@ -67,14 +67,14 @@ void TAG(translate_vertex)(GLcontext *ctx, { float rhw = 1.0 / LE32_IN_FLOAT( p + 2 ); - dst->texcoord[0][0] = rhw*LE32_IN_FLOAT( p++ ); - dst->texcoord[0][1] = rhw*LE32_IN_FLOAT( p++ ); + dst->attrib[FRAG_ATTRIB_TEX0][0] = rhw*LE32_IN_FLOAT( p++ ); + dst->attrib[FRAG_ATTRIB_TEX0][1] = rhw*LE32_IN_FLOAT( p++ ); } #else - dst->texcoord[0][0] = LE32_IN_FLOAT( p++ ); - dst->texcoord[0][1] = LE32_IN_FLOAT( p++ ); + dst->attrib[FRAG_ATTRIB_TEX0][0] = LE32_IN_FLOAT( p++ ); + dst->attrib[FRAG_ATTRIB_TEX0][1] = LE32_IN_FLOAT( p++ ); #endif - dst->texcoord[0][3] = 1.0; + dst->attrib[FRAG_ATTRIB_TEX0][3] = 1.0; dst->win[3] = LE32_IN_FLOAT( p++ ); case NOTEX_VERTEX_FORMAT: diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index f811dc1..6f1b57d 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -195,7 +195,7 @@ GLboolean nouveauCreateContext( const __GLcontextModes *glVisual, nouveauShaderInitFuncs(ctx); /* Install Mesa's fixed-function texenv shader support */ if (nmesa->screen->card->type >= NV_40) - ctx->_MaintainTexEnvProgram = GL_TRUE; + ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; /* Initialize the swrast */ _swrast_CreateContext( ctx ); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_shader.c b/src/mesa/drivers/dri/nouveau/nouveau_shader.c index ba47132..bee8d5a 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_shader.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_shader.c @@ -35,9 +35,10 @@ #include "enums.h" #include "extensions.h" -#include "program.h" +#include "shader/program.h" +#include "shader/prog_instruction.h" +/*#include "shader/arbprogparse.h"*/ #include "tnl/tnl.h" -#include "shader/arbprogparse.h" #include "nouveau_context.h" #include "nouveau_shader.h" diff --git a/src/mesa/drivers/dri/nouveau/nouveau_shader_0.c b/src/mesa/drivers/dri/nouveau/nouveau_shader_0.c index 73c1f7c..abba59d 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_shader_0.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_shader_0.c @@ -34,9 +34,10 @@ #include "macros.h" #include "enums.h" -#include "program.h" -#include "programopt.h" -#include "program_instruction.h" +#include "shader/prog_instruction.h" +#include "shader/prog_parameter.h" +#include "shader/prog_statevars.h" +#include "shader/programopt.h" #include "nouveau_context.h" #include "nouveau_shader.h" @@ -411,8 +412,10 @@ pass0_fixup_swizzle(nvsPtr nvs, nvsFragmentHeader *parent, int fpos, if (!rec->swzconst_done) { struct gl_program *prog = &nvs->mesa.vp.Base; + GLuint swizzle; rec->swzconst_id = _mesa_add_unnamed_constant(prog->Parameters, - sc, 4); + sc, 4, &swizzle); + /* XXX what about swizzle? */ rec->swzconst_done = 1; COPY_4V(nvs->params[rec->swzconst_id].val, sc); } @@ -818,7 +821,8 @@ pass0_vp_insert_ff_clip_planes(GLcontext *ctx, nouveauShader *nvs) nvsInstruction *nvsinst; GLuint fpos = 0; nvsRegister opos, epos, eqn, mv[4]; - GLint tokens[6] = { STATE_MATRIX, STATE_MODELVIEW, 0, 0, 0, 0 }; + gl_state_index tokens[STATE_LENGTH] + = { STATE_MODELVIEW_MATRIX, 0, 0, 0, 0 }; GLint id; int i; @@ -826,7 +830,7 @@ pass0_vp_insert_ff_clip_planes(GLcontext *ctx, nouveauShader *nvs) pass0_make_reg(nvs, &opos, NVS_FILE_ATTRIB, NVS_FR_POSITION); pass0_make_reg(nvs, &epos, NVS_FILE_TEMP , -1); for (i=0; i<4; i++) { - tokens[3] = tokens[4] = i; + tokens[2] = tokens[3] = i; id = _mesa_add_state_reference(prog->Parameters, tokens); pass0_make_reg(nvs, &mv[i], NVS_FILE_CONST, id); } diff --git a/src/mesa/drivers/dri/nouveau/nouveau_shader_2.c b/src/mesa/drivers/dri/nouveau/nouveau_shader_2.c index b043f87..6eb9de4 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_shader_2.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_shader_2.c @@ -34,7 +34,8 @@ #include "macros.h" #include "enums.h" -#include "program.h" +#include "shader/prog_parameter.h" +#include "shader/prog_print.h" #include "nouveau_context.h" #include "nouveau_shader.h" diff --git a/src/mesa/drivers/dri/r200/r200_vertprog.c b/src/mesa/drivers/dri/r200/r200_vertprog.c index 4960d48..6089d61 100644 --- a/src/mesa/drivers/dri/r200/r200_vertprog.c +++ b/src/mesa/drivers/dri/r200/r200_vertprog.c @@ -34,14 +34,16 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "macros.h" #include "enums.h" #include "program.h" +#include "shader/prog_instruction.h" +#include "shader/prog_parameter.h" +#include "shader/prog_statevars.h" +#include "shader/programopt.h" +#include "tnl/tnl.h" #include "r200_context.h" #include "r200_vertprog.h" #include "r200_ioctl.h" #include "r200_tcl.h" -#include "program_instruction.h" -#include "programopt.h" -#include "tnl/tnl.h" #if SWIZZLE_X != VSF_IN_COMPONENT_X || \ SWIZZLE_Y != VSF_IN_COMPONENT_Y || \ @@ -462,7 +464,7 @@ static GLboolean r200_translate_vertex_program(GLcontext *ctx, struct r200_verte base e isn't directly available neither. */ if ((mesa_vp->Base.OutputsWritten & (1 << VERT_RESULT_FOGC)) && !vp->fogpidx) { struct gl_program_parameter_list *paramList; - GLint tokens[6] = { STATE_FOG_PARAMS, 0, 0, 0, 0, 0 }; + gl_state_index tokens[STATE_LENGTH] = { STATE_FOG_PARAMS, 0, 0, 0, 0 }; paramList = mesa_vp->Base.Parameters; vp->fogpidx = _mesa_add_state_reference(paramList, tokens); } diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index d10a9d8..8aaf50b 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -334,7 +334,7 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual, ctx->Const.FragmentProgram.MaxNativeTexIndirections = PFS_MAX_TEX_INDIRECT; ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* and these are?? */ _tnl_ProgramCacheInit(ctx); - ctx->_MaintainTexEnvProgram = GL_TRUE; + ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; driInitExtensions(ctx, card_extensions, GL_TRUE); diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c index 8e45bd5..9330ec5 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog.c @@ -43,9 +43,10 @@ #include "glheader.h" #include "macros.h" #include "enums.h" +#include "shader/prog_instruction.h" +#include "shader/prog_parameter.h" +#include "shader/prog_print.h" -#include "program.h" -#include "program_instruction.h" #include "r300_context.h" #include "r300_fragprog.h" #include "r300_reg.h" diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.h b/src/mesa/drivers/dri/r300/r300_fragprog.h index 73986ab..d883aee 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.h +++ b/src/mesa/drivers/dri/r300/r300_fragprog.h @@ -36,10 +36,11 @@ #include "glheader.h" #include "macros.h" #include "enums.h" +#include "shader/program.h" +#include "shader/prog_instruction.h" -#include "program.h" #include "r300_context.h" -#include "program_instruction.h" + #if 0 /* representation of a register for emit_arith/swizzle */ diff --git a/src/mesa/drivers/dri/r300/r300_shader.c b/src/mesa/drivers/dri/r300/r300_shader.c index 26721e8..e8bce93 100644 --- a/src/mesa/drivers/dri/r300/r300_shader.c +++ b/src/mesa/drivers/dri/r300/r300_shader.c @@ -10,11 +10,6 @@ static void r300BindProgram(GLcontext *ctx, GLenum target, struct gl_program *prog) { - - r300ContextPtr rmesa = R300_CONTEXT(ctx); - struct r300_vertex_program_cont *vp=(void *)prog; - - switch(target){ case GL_VERTEX_PROGRAM_ARB: //rmesa->curr_vp = (struct gl_vertex_program *)vp; diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 906dfce..62bbc96 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -46,6 +46,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "api_arrayelt.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" +#include "shader/prog_parameter.h" +#include "shader/prog_statevars.h" #include "vbo/vbo.h" #include "tnl/tnl.h" #include "texformat.h" @@ -1055,8 +1057,10 @@ r300UpdateDrawBuffer(GLcontext *ctx) #endif } -static void r300FetchStateParameter(GLcontext *ctx, const enum state_index state[], - GLfloat *value) +static void +r300FetchStateParameter(GLcontext *ctx, + const gl_state_index state[STATE_LENGTH], + GLfloat *value) { r300ContextPtr r300 = R300_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/r300/r300_vertexprog.c b/src/mesa/drivers/dri/r300/r300_vertexprog.c index 2ff92e1..cc8e077 100644 --- a/src/mesa/drivers/dri/r300/r300_vertexprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertexprog.c @@ -33,11 +33,13 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "macros.h" #include "enums.h" #include "program.h" -#include "nvvertexec.h" +#include "shader/prog_instruction.h" +#include "shader/prog_parameter.h" +#include "shader/prog_statevars.h" +#include "tnl/tnl.h" #include "r300_context.h" #include "r300_program.h" -#include "program_instruction.h" #if SWIZZLE_X != VSF_IN_COMPONENT_X || \ SWIZZLE_Y != VSF_IN_COMPONENT_Y || \ @@ -103,7 +105,7 @@ int r300VertexProgUpdateParams(GLcontext *ctx, struct r300_vertex_program_cont * struct gl_program_parameter_list *paramList; if (mesa_vp->IsNVProgram) { - _mesa_init_vp_per_primitive_registers(ctx); + _mesa_load_tracked_matrices(ctx); for (pi=0; pi < MAX_NV_VERTEX_PROGRAM_PARAMS; pi++) { *dst++=ctx->VertexProgram.Parameters[pi][0]; @@ -880,7 +882,7 @@ static void position_invariant(struct gl_program *prog) struct gl_program_parameter_list *paramList; int i; - GLint tokens[6] = { STATE_MATRIX, STATE_MVP, 0, 0, 0, STATE_MATRIX }; + gl_state_index tokens[STATE_LENGTH] = { STATE_MVP_MATRIX, 0, 0, 0, 0 }; #ifdef PREFER_DP4 tokens[5] = STATE_MATRIX; @@ -963,7 +965,8 @@ static void insert_wpos(struct r300_vertex_program *vp, GLuint temp_index) { - GLint tokens[6] = { STATE_INTERNAL, STATE_R300_WINDOW_DIMENSION, 0, 0, 0, 0 }; + gl_state_index tokens[STATE_LENGTH] + = { STATE_INTERNAL, STATE_R300_WINDOW_DIMENSION, 0, 0, 0 }; struct prog_instruction *vpi; struct prog_instruction *vpi_insert; GLuint window_index; diff --git a/src/mesa/drivers/dri/s3v/s3v_tritmp.h b/src/mesa/drivers/dri/s3v/s3v_tritmp.h index 16318f4..696fc02 100644 --- a/src/mesa/drivers/dri/s3v/s3v_tritmp.h +++ b/src/mesa/drivers/dri/s3v/s3v_tritmp.h @@ -407,17 +407,17 @@ do { \ ctx->Texture.Unit[0]._Current->DriverData); \ deltwx = deltwy = wstart = deltdx = deltdy = dstart = 0; \ \ - u0 = (v[idx[0]].texcoord[0][0] \ + u0 = (v[idx[0]].attrib[FRAG_ATTRIB_TEX0][0] \ * (GLfloat)(t->image[0].image->Width) * 256.0); \ - u1 = (v[idx[1]].texcoord[0][0] \ + u1 = (v[idx[1]].attrib[FRAG_ATTRIB_TEX0][0] \ * (GLfloat)(t->globj->Image[0][0]->Width) * 256.0); \ - u2 = (v[idx[2]].texcoord[0][0] \ + u2 = (v[idx[2]].attrib[FRAG_ATTRIB_TEX0][0] \ * (GLfloat)(t->globj->Image[0][0]->Width) * 256.0); \ - v0 = (v[idx[0]].texcoord[0][1] \ + v0 = (v[idx[0]].attrib[FRAG_ATTRIB_TEX0][1] \ * (GLfloat)(t->globj->Image[0][0]->Height) * 256.0); \ - v1 = (v[idx[1]].texcoord[0][1] \ + v1 = (v[idx[1]].attrib[FRAG_ATTRIB_TEX0][1] \ * (GLfloat)(t->globj->Image[0][0]->Height) * 256.0); \ - v2 = (v[idx[2]].texcoord[0][1] \ + v2 = (v[idx[2]].attrib[FRAG_ATTRIB_TEX0][1] \ * (GLfloat)(t->globj->Image[0][0]->Height) * 256.0); \ \ w0 = (v[idx[0]].win[3]); \ @@ -485,23 +485,23 @@ do { \ GLfloat sxy, suv; \ int lev; \ \ - suv = (v[idx[0]].texcoord[0][0] - \ - v[idx[2]].texcoord[0][0]) * \ - (v[idx[1]].texcoord[0][1] - \ - v[idx[2]].texcoord[0][1]) - \ - (v[idx[1]].texcoord[0][0] - \ - v[idx[2]].texcoord[0][0]) * \ - (v[idx[0]].texcoord[0][1] - \ - v[idx[2]].texcoord[0][2]); \ -\ - sxy = (v[idx[0]].texcoord[0][0] - \ - v[idx[2]].texcoord[0][0]) * \ - (v[idx[1]].texcoord[0][1] - \ - v[idx[2]].texcoord[0][1]) - \ - (v[idx[1]].texcoord[0][0] - \ - v[idx[2]].texcoord[0][0]) * \ - (v[idx[0]].texcoord[0][1] - \ - v[idx[2]].texcoord[0][2]); \ + suv = (v[idx[0]].attrib[FRAG_ATTRIB_TEX0][0] - \ + v[idx[2]].attrib[FRAG_ATTRIB_TEX0][0]) * \ + (v[idx[1]].attrib[FRAG_ATTRIB_TEX0][1] - \ + v[idx[2]].attrib[FRAG_ATTRIB_TEX0][1]) - \ + (v[idx[1]].attrib[FRAG_ATTRIB_TEX0][0] - \ + v[idx[2]].attrib[FRAG_ATTRIB_TEX0][0]) * \ + (v[idx[0]].attrib[FRAG_ATTRIB_TEX0][1] - \ + v[idx[2]].attrib[FRAG_ATTRIB_TEX0][2]); \ +\ + sxy = (v[idx[0]].attrib[FRAG_ATTRIB_TEX0][0] - \ + v[idx[2]].attrib[FRAG_ATTRIB_TEX0][0]) * \ + (v[idx[1]].attrib[FRAG_ATTRIB_TEX0][1] - \ + v[idx[2]].attrib[FRAG_ATTRIB_TEX0][1]) - \ + (v[idx[1]].attrib[FRAG_ATTRIB_TEX0][0] - \ + v[idx[2]].attrib[FRAG_ATTRIB_TEX0][0]) * \ + (v[idx[0]].attrib[FRAG_ATTRIB_TEX0][1] - \ + v[idx[2]].attrib[FRAG_ATTRIB_TEX0][2]); \ \ if (sxy < 0) sxy *= -1.0; \ if (suv < 0) suv *= -1.0; \ diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tris.c b/src/mesa/drivers/dri/tdfx/tdfx_tris.c index ac8daf4..4ba2f40 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tris.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tris.c @@ -165,21 +165,21 @@ tdfx_translate_vertex( GLcontext *ctx, const tdfxVertex *src, SWvertex *dst) dst->color[2] = src->color[0]; dst->color[3] = src->color[3]; - dst->texcoord[0][0] = 1.0 / fxMesa->sScale0 * w * src->tu0; - dst->texcoord[0][1] = 1.0 / fxMesa->tScale0 * w * src->tv0; + dst->attrib[FRAG_ATTRIB_TEX0][0] = 1.0 / fxMesa->sScale0 * w * src->tu0; + dst->attrib[FRAG_ATTRIB_TEX0][1] = 1.0 / fxMesa->tScale0 * w * src->tv0; if (fxMesa->vertexFormat == TDFX_LAYOUT_PROJ1 || fxMesa->vertexFormat == TDFX_LAYOUT_PROJ2) { - dst->texcoord[0][3] = w * src->tq0; + dst->attrib[FRAG_ATTRIB_TEX0][3] = w * src->tq0; } else { - dst->texcoord[0][3] = 1.0; + dst->attrib[FRAG_ATTRIB_TEX0][3] = 1.0; } if (fxMesa->SetupIndex & TDFX_TEX1_BIT) { - dst->texcoord[1][0] = 1.0 / fxMesa->sScale1 * w * src->tu1; - dst->texcoord[1][1] = 1.0 / fxMesa->tScale1 * w * src->tv1; + dst->attrib[FRAG_ATTRIB_TEX1][0] = 1.0 / fxMesa->sScale1 * w * src->tu1; + dst->attrib[FRAG_ATTRIB_TEX1][1] = 1.0 / fxMesa->tScale1 * w * src->tv1; if (fxMesa->vertexFormat == TDFX_LAYOUT_PROJ2) { - dst->texcoord[1][3] = w * src->tq1; + dst->attrib[FRAG_ATTRIB_TEX1][3] = w * src->tq1; } else { - dst->texcoord[1][3] = 1.0; + dst->attrib[FRAG_ATTRIB_TEX1][3] = 1.0; } } } diff --git a/src/mesa/drivers/dri/trident/trident_context.h b/src/mesa/drivers/dri/trident/trident_context.h index b1e68b0..1d3ca84 100644 --- a/src/mesa/drivers/dri/trident/trident_context.h +++ b/src/mesa/drivers/dri/trident/trident_context.h @@ -179,7 +179,7 @@ struct trident_context { GLuint vertex_format; GLuint vertex_size; GLuint vertex_stride_shift; - char *verts; + GLubyte *verts; GLint tmu_source[2]; -- 2.7.4