diff options
author | Brian <[email protected]> | 2007-03-26 10:13:02 -0600 |
---|---|---|
committer | Brian <[email protected]> | 2007-03-26 10:13:02 -0600 |
commit | d619cceea47dc3070ebb7f7ea4f8b6b31a672d38 (patch) | |
tree | f8b8a9f3fdc3f17a43436af270b22754b1749d31 /src/mesa/drivers/dri/i965 | |
parent | 76f3b66e0489526694d6a39b4a6ac3b1c2bee100 (diff) | |
parent | e71c34aaa173ca451fa02e526ead77758f7eeb74 (diff) |
merge of glsl-compiler-1 branch
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 | 77 | ||||
-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, 81 insertions, 107 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 6faee65542b..397a9bd3f5c 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 4352c3bcb0f..3f0aaa1f86d 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 d4dbcf38a7a..52f89d577ca 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 1579762b6d1..6e030f191ef 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 9d12c26486d..b6deee23769 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 74c9d88e464..e173f6fce3e 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 528e164db8c..caef042f1cd 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 ffdb843e85f..6eb11b19ad2 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 dd1664bf33a..35adc4846a0 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 ); } @@ -894,7 +893,7 @@ static struct ureg calculate_light_attenuation( struct tnl_program *p, /* Need to add some addtional parameters to allow lighting in object - * space - STATE_SPOT_DIRECTION and STATE_HALF implicitly assume eye + * space - STATE_SPOT_DIRECTION and STATE_HALF_VECTOR implicitly assume eye * space lighting. */ static void build_lighting( struct tnl_program *p ) @@ -993,7 +992,7 @@ static void build_lighting( struct tnl_program *p ) emit_op2(p, OPCODE_SUB, half, 0, VPpli, eye_hat); emit_normalize_vec3(p, half, half); } else { - half = register_param3(p, STATE_LIGHT, i, STATE_HALF); + half = register_param3(p, STATE_LIGHT, i, STATE_HALF_VECTOR); } } else { @@ -1360,13 +1359,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 0f842d289d7..1497dc79687 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 ec6ad6105ca..f5fddfdb68a 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 9a6154b3336..f31d0974ecf 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 d96a9b717c0..fd605159727 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 ba2dbeccde2..ff97d87dc45 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 36b69b70681..00f6f6b9a4f 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 21d0881d57e..d668def7007 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 cb8d51fb5cf..a1edbd6168d 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 |