/*\{*/
-/* 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) */
//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));
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),
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]);
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));
//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));
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));
{
//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));
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));
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);
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));
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));
&& 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),
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));
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));
#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]);
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),
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),
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));
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));
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),
(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));
#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]);
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),
*/
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);
(*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));
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);
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);
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;