diff options
author | Brian <brian@yutani.localnet.net> | 2007-02-23 13:40:13 -0700 |
---|---|---|
committer | Brian <brian@yutani.localnet.net> | 2007-02-23 13:40:13 -0700 |
commit | 064ae479a770bf434958d673baf6f7530f642697 (patch) | |
tree | 9331a6b09260d32604cc2603b9bcf93848aecff0 /src/mesa/drivers/dri/i965 | |
parent | 36a0ee199ddc5f29273f9761eeed8e18ad5c874f (diff) |
Update DRI drivers for new glsl compiler.
Mostly:
- update #includes
- update STATE_* token code
Diffstat (limited to 'src/mesa/drivers/dri/i965')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_curbe.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_eu.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_metaops.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_util.c | 32 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs_constval.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs_emit.c | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs_tnl.c | 75 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm_debug.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm_emit.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm_fp.c | 34 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm_pass0.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm_pass1.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm_pass2.c | 4 |
17 files changed, 80 insertions, 106 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 6faee65542..397a9bd3f5 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 4352c3bcb0..3f0aaa1f86 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 d4dbcf38a7..52f89d577c 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 1579762b6d..6e030f191e 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 9d12c26486..b6deee2376 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 74c9d88e46..e173f6fce3 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 528e164db8..caef042f1c 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 ffdb843e85..6eb11b19ad 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 0d61092247..21e961ce9c 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 0f842d289d..1497dc7968 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 ec6ad6105c..f5fddfdb68 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 9a6154b333..f31d0974ec 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 d96a9b717c..fd60515972 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 bb0aa35615..47ddcd0f05 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 36b69b7068..00f6f6b9a4 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 21d0881d57..d668def700 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 cb8d51fb5c..a1edbd6168 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 |