diff options
author | Oliver McFadden <[email protected]> | 2008-02-25 12:35:55 +0000 |
---|---|---|
committer | Oliver McFadden <[email protected]> | 2008-03-01 06:33:06 +0000 |
commit | bd46a482c479e7ce765e45f444ba0f7e54432a4e (patch) | |
tree | 14c01eca17cc85bd6872f41df942de8759e8f8d8 /src/mesa | |
parent | 66952fa5aec04aa2abeefa0e949ce3812fae229d (diff) |
r300: Converted to the new Vector Engine defines.
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_reg.h | 45 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_state.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_vertprog.c | 59 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_vertprog.h | 2 |
4 files changed, 32 insertions, 76 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index 29d2e7f4f34..48b91cfd7b3 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -2499,51 +2499,6 @@ enum { /*\{*/ -/* Every instruction is four dwords long: - * DWORD 0: output and opcode - * DWORD 1: first argument - * DWORD 2: second argument - * DWORD 3: third argument - * - * Notes: - * - ABS r, a is implemented as MAX r, a, -a - * - MOV is implemented as ADD to zero - * - XPD is implemented as MUL + MAD - * - FLR is implemented as FRC + ADD - * - apparently, fglrx tries to schedule instructions so that there is at - * least one instruction between the write to a temporary and the first - * read from said temporary; however, violations of this scheduling are - * allowed - * - register indices seem to be unrelated with OpenGL aliasing to - * conventional state - * - only one attribute and one parameter can be loaded at a time; however, - * the same attribute/parameter can be used for more than one argument - * - the second software argument for POW is the third hardware argument - * (no idea why) - * - MAD with only temporaries as input seems to use VPI_OUT_SELECT_MAD_2 - * - * There is some magic surrounding LIT: - * The single argument is replicated across all three inputs, but swizzled: - * First argument: xyzy - * Second argument: xyzx - * Third argument: xyzw - * Whenever the result is used later in the fragment program, fglrx forces - * x and w to be 1.0 in the input selection; I don't know whether this is - * strictly necessary - */ -#define R300_VPI_OUT_OP_DOT (1 << 0) -#define R300_VPI_OUT_OP_MUL (2 << 0) -#define R300_VPI_OUT_OP_ADD (3 << 0) -#define R300_VPI_OUT_OP_MAD (4 << 0) -#define R300_VPI_OUT_OP_DST (5 << 0) -#define R300_VPI_OUT_OP_FRC (6 << 0) -#define R300_VPI_OUT_OP_MAX (7 << 0) -#define R300_VPI_OUT_OP_MIN (8 << 0) -#define R300_VPI_OUT_OP_SGE (9 << 0) -#define R300_VPI_OUT_OP_SLT (10 << 0) - /* Used in GL_POINT_DISTANCE_ATTENUATION_ARB, vector(scalar, vector) */ -#define R300_VPI_OUT_OP_UNK12 (12 << 0) -#define R300_VPI_OUT_OP_ARL (13 << 0) #define R300_VPI_OUT_OP_EXP (65 << 0) #define R300_VPI_OUT_OP_LOG (66 << 0) /* Used in fog computations, scalar(scalar) */ diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 6f9f3fbf5d1..2387b151716 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1659,7 +1659,7 @@ static void r300SetupDefaultVertexProgram(r300ContextPtr rmesa) for (i = VERT_ATTRIB_POS; i < VERT_ATTRIB_MAX; i++) { if (rmesa->state.sw_tcl_inputs[i] != -1) { - prog->program.body.i[program_end + 0] = MAKE_VSF_OP(R300_VPI_OUT_OP_MUL, o_reg++, VSF_FLAG_ALL, PVS_DST_REG_OUT); + prog->program.body.i[program_end + 0] = MAKE_VSF_OP(VE_MULTIPLY, o_reg++, VSF_FLAG_ALL, PVS_DST_REG_OUT); prog->program.body.i[program_end + 1] = VSF_REG(rmesa->state.sw_tcl_inputs[i]); prog->program.body.i[program_end + 2] = VSF_ATTR_UNITY(rmesa->state.sw_tcl_inputs[i]); prog->program.body.i[program_end + 3] = VSF_UNITY(rmesa->state.sw_tcl_inputs[i]); diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 7e724514b06..ec2299f4c80 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -376,7 +376,7 @@ static GLuint *t_opcode_abs(struct r300_vertex_program *vp, //MAX RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_MAX, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_MAXIMUM, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -406,7 +406,7 @@ static GLuint *t_opcode_add(struct r300_vertex_program *vp, hw_op = (src[0].File == PROGRAM_TEMPORARY && src[1].File == PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : - R300_VPI_OUT_OP_MAD; + VE_MULTIPLY_ADD; inst[0] = MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg), @@ -417,7 +417,7 @@ static GLuint *t_opcode_add(struct r300_vertex_program *vp, inst[3] = t_src(vp, &src[1]); #else inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); @@ -434,7 +434,7 @@ static GLuint *t_opcode_arl(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_ARL, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_FLT2FIX_DX, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -452,7 +452,7 @@ static GLuint *t_opcode_dp3(struct r300_vertex_program *vp, //DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ZERO} PARAM 0{} {X Y Z ZERO} inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_DOT, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_DOT_PRODUCT, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -486,7 +486,7 @@ static GLuint *t_opcode_dp4(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_DOT, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_DOT_PRODUCT, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -503,7 +503,7 @@ static GLuint *t_opcode_dph(struct r300_vertex_program *vp, { //DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ONE} PARAM 0{} {X Y Z W} inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_DOT, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_DOT_PRODUCT, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -527,7 +527,7 @@ static GLuint *t_opcode_dst(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_DST, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_DISTANCE_VECTOR, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -578,7 +578,7 @@ static GLuint *t_opcode_flr(struct r300_vertex_program *vp, ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} TMP 0{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W */ inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_FRC, *u_temp_i, + MAKE_VSF_OP(VE_FRACTION, *u_temp_i, t_dst_mask(vpi->DstReg.WriteMask), PVS_DST_REG_TEMPORARY); @@ -588,7 +588,7 @@ static GLuint *t_opcode_flr(struct r300_vertex_program *vp, inst += 4; inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -613,7 +613,7 @@ static GLuint *t_opcode_frc(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_FRC, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_FRACTION, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -716,7 +716,7 @@ static GLuint *t_opcode_mad(struct r300_vertex_program *vp, && src[1].File == PROGRAM_TEMPORARY && src[2].File == PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : - R300_VPI_OUT_OP_MAD; + VE_MULTIPLY_ADD; inst[0] = MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg), @@ -734,7 +734,7 @@ static GLuint *t_opcode_max(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_MAX, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_MAXIMUM, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -750,7 +750,7 @@ static GLuint *t_opcode_min(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_MIN, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_MINIMUM, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -769,7 +769,7 @@ static GLuint *t_opcode_mov(struct r300_vertex_program *vp, #if 1 inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); @@ -779,7 +779,7 @@ static GLuint *t_opcode_mov(struct r300_vertex_program *vp, hw_op = (src[0].File == PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : - R300_VPI_OUT_OP_MAD; + VE_MULTIPLY_ADD; inst[0] = MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg), @@ -804,7 +804,7 @@ static GLuint *t_opcode_mul(struct r300_vertex_program *vp, hw_op = (src[0].File == PROGRAM_TEMPORARY && src[1].File == PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : - R300_VPI_OUT_OP_MAD; + VE_MULTIPLY_ADD; inst[0] = MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg), @@ -870,7 +870,7 @@ static GLuint *t_opcode_sge(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_SGE, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_SET_GREATER_THAN_EQUAL, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -886,7 +886,7 @@ static GLuint *t_opcode_slt(struct r300_vertex_program *vp, struct prog_src_register src[3]) { inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_SLT, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_SET_LESS_THAN, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -909,7 +909,7 @@ static GLuint *t_opcode_sub(struct r300_vertex_program *vp, hw_op = (src[0].File == PROGRAM_TEMPORARY && src[1].File == PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : - R300_VPI_OUT_OP_MAD; + VE_MULTIPLY_ADD; inst[0] = MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg), @@ -929,7 +929,7 @@ static GLuint *t_opcode_sub(struct r300_vertex_program *vp, (src[1].RelAddr << 4); #else inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -958,7 +958,7 @@ static GLuint *t_opcode_swz(struct r300_vertex_program *vp, #if 1 inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &src[0]); @@ -968,7 +968,7 @@ static GLuint *t_opcode_swz(struct r300_vertex_program *vp, hw_op = (src[0].File == PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : - R300_VPI_OUT_OP_MAD; + VE_MULTIPLY_ADD; inst[0] = MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg), @@ -992,7 +992,7 @@ static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, */ inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_MAD, *u_temp_i, + MAKE_VSF_OP(VE_MULTIPLY_ADD, *u_temp_i, t_dst_mask(vpi->DstReg.WriteMask), PVS_DST_REG_TEMPORARY); @@ -1019,7 +1019,7 @@ static GLuint *t_opcode_xpd(struct r300_vertex_program *vp, (*u_temp_i)--; inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_MAD, t_dst_index(vp, &vpi->DstReg), + MAKE_VSF_OP(VE_MULTIPLY_ADD, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -1147,7 +1147,7 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, if (CMP_SRCS(src[1], src[2]) || CMP_SRCS(src[0], src[2])) { inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, + MAKE_VSF_OP(VE_ADD, u_temp_i, VSF_FLAG_ALL, PVS_DST_REG_TEMPORARY); @@ -1175,7 +1175,7 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, if (num_operands >= 2) { if (CMP_SRCS(src[1], src[0])) { inst[0] = - MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, + MAKE_VSF_OP(VE_ADD, u_temp_i, VSF_FLAG_ALL, PVS_DST_REG_TEMPORARY); @@ -1296,8 +1296,9 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, of the fragment program. Blank the outputs here. */ for (i = 0; i < VERT_RESULT_MAX; i++) { if (vp->key.OutputsAdded & (1 << i)) { - inst[0] = MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, vp->outputs[i], - VSF_FLAG_ALL, VSF_OUT_CLASS_RESULT); + inst[0] = MAKE_VSF_OP(VE_ADD, vp->outputs[i], + VSF_FLAG_ALL, + VSF_OUT_CLASS_RESULT); inst[1] = ZERO_SRC_0; inst[2] = ZERO_SRC_0; inst[3] = ZERO_SRC_0; diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index 6f7afec3f3d..90906cc1e30 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -102,7 +102,7 @@ #define VP_OUTMASK_ZW (VP_OUTMASK_Z|VP_OUTMASK_W) #define VP_OUT(instr,outclass,outidx,outmask) \ - (R300_VPI_OUT_OP_##instr | \ + (VE_##instr | \ ((outidx) << R300_VPI_OUT_REG_INDEX_SHIFT) | \ VP_OUTCLASS_##outclass | \ VP_OUTMASK_##outmask) |