OSDN Git Service

mesa: Remove Mesa IR opcodes that existed only for NV_vertex_program.
authorEric Anholt <eric@anholt.net>
Tue, 9 Oct 2012 22:31:42 +0000 (15:31 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 15 Oct 2012 18:53:23 +0000 (11:53 -0700)
v2: Remove dead positive() function, caught by Matt.

Reviewed-by: Brian Paul <brianp@vmware.com> (v1)
src/mesa/drivers/dri/i915/i915_fragprog.c
src/mesa/program/prog_execute.c
src/mesa/program/prog_instruction.c
src/mesa/program/prog_instruction.h
src/mesa/program/prog_optimize.c
src/mesa/program/prog_print.c

index 7a6e067..3038d84 100644 (file)
@@ -1088,7 +1088,6 @@ upload_program(struct i915_fragment_program *p)
 
       case OPCODE_BGNLOOP:
       case OPCODE_BGNSUB:
-      case OPCODE_BRA:
       case OPCODE_BRK:
       case OPCODE_CAL:
       case OPCODE_CONT:
index dd1706e..f57027c 100644 (file)
 static const GLfloat ZeroVec[4] = { 0.0F, 0.0F, 0.0F, 0.0F };
 
 
-
-/**
- * Return TRUE for +0 and other positive values, FALSE otherwise.
- * Used for RCC opcode.
- */
-static inline GLboolean
-positive(float x)
-{
-   fi_type fi;
-   fi.f = x;
-   if (fi.i & 0x80000000)
-      return GL_FALSE;
-   return GL_TRUE;
-}
-
-
-
 /**
  * Return a pointer to the 4-element float vector specified by the given
  * source register.
@@ -728,13 +711,6 @@ _mesa_execute_program(struct gl_context * ctx,
          break;
       case OPCODE_ENDSUB:      /* end subroutine */
          break;
-      case OPCODE_BRA:         /* branch (conditional) */
-         if (eval_condition(machine, inst)) {
-            /* take branch */
-            /* Subtract 1 here since we'll do pc++ below */
-            pc = inst->BranchTarget - 1;
-         }
-         break;
       case OPCODE_BRK:         /* break out of loop (conditional) */
          ASSERT(program->Instructions[inst->BranchTarget].Opcode
                 == OPCODE_ENDLOOP);
@@ -1367,43 +1343,6 @@ _mesa_execute_program(struct gl_context * ctx,
             store_vector4(inst, machine, result);
          }
          break;
-      case OPCODE_RCC:  /* clamped riciprocal */
-         {
-            const float largest = 1.884467e+19, smallest = 5.42101e-20;
-            GLfloat a[4], r, result[4];
-            fetch_vector1(&inst->SrcReg[0], machine, a);
-            if (DEBUG_PROG) {
-               if (a[0] == 0)
-                  printf("RCC(0)\n");
-               else if (IS_INF_OR_NAN(a[0]))
-                  printf("RCC(inf)\n");
-            }
-            if (a[0] == 1.0F) {
-               r = 1.0F;
-            }
-            else {
-               r = 1.0F / a[0];
-            }
-            if (positive(r)) {
-               if (r > largest) {
-                  r = largest;
-               }
-               else if (r < smallest) {
-                  r = smallest;
-               }
-            }
-            else {
-               if (r < -largest) {
-                  r = -largest;
-               }
-               else if (r > -smallest) {
-                  r = -smallest;
-               }
-            }
-            result[0] = result[1] = result[2] = result[3] = r;
-            store_vector4(inst, machine, result);
-         }
-         break;
 
       case OPCODE_RCP:
          {
index d69d7b2..0bd45b0 100644 (file)
@@ -154,13 +154,9 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = {
    { OPCODE_ABS,    "ABS",     1, 1 },
    { OPCODE_ADD,    "ADD",     2, 1 },
    { OPCODE_AND,    "AND",     2, 1 },
-   { OPCODE_ARA,    "ARA",     1, 1 },
    { OPCODE_ARL,    "ARL",     1, 1 },
-   { OPCODE_ARL_NV, "ARL_NV",  1, 1 },
-   { OPCODE_ARR,    "ARL",     1, 1 },
    { OPCODE_BGNLOOP,"BGNLOOP", 0, 0 },
    { OPCODE_BGNSUB, "BGNSUB",  0, 0 },
-   { OPCODE_BRA,    "BRA",     0, 0 },
    { OPCODE_BRK,    "BRK",     0, 0 },
    { OPCODE_CAL,    "CAL",     0, 0 },
    { OPCODE_CMP,    "CMP",     3, 1 },
@@ -210,10 +206,7 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = {
    { OPCODE_PK4B,   "PK4B",    1, 1 },
    { OPCODE_PK4UB,  "PK4UB",   1, 1 },
    { OPCODE_POW,    "POW",     2, 1 },
-   { OPCODE_POPA,   "POPA",    0, 0 },
    { OPCODE_PRINT,  "PRINT",   1, 0 },
-   { OPCODE_PUSHA,  "PUSHA",   0, 0 },
-   { OPCODE_RCC,    "RCC",     1, 1 },
    { OPCODE_RCP,    "RCP",     1, 1 },
    { OPCODE_RET,    "RET",     0, 0 },
    { OPCODE_RFL,    "RFL",     1, 1 },
index 656556d..7c09cda 100644 (file)
@@ -148,13 +148,9 @@ typedef enum prog_opcode {
    OPCODE_ABS,       /*   X        X       1.1               X   */
    OPCODE_ADD,       /*   X        X       X       X         X   */
    OPCODE_AND,       /*                                          */
-   OPCODE_ARA,       /*                    2                     */
    OPCODE_ARL,       /*   X                X                 X   */
-   OPCODE_ARL_NV,    /*                    2                     */
-   OPCODE_ARR,       /*                    2                     */
    OPCODE_BGNLOOP,   /*                                     opt  */
    OPCODE_BGNSUB,    /*                                     opt  */
-   OPCODE_BRA,       /*                    2                     */
    OPCODE_BRK,       /*                    2                opt  */
    OPCODE_CAL,       /*                    2       2        opt  */
    OPCODE_CMP,       /*            X                         X   */
@@ -204,10 +200,7 @@ typedef enum prog_opcode {
    OPCODE_PK4B,      /*                            X             */
    OPCODE_PK4UB,     /*                            X             */
    OPCODE_POW,       /*   X        X               X         X   */
-   OPCODE_POPA,      /*                    3                     */
    OPCODE_PRINT,     /*                    X       X             */
-   OPCODE_PUSHA,     /*                    3                     */
-   OPCODE_RCC,       /*                    1.1                   */
    OPCODE_RCP,       /*   X        X       X       X         X   */
    OPCODE_RET,       /*                    2       2        opt  */
    OPCODE_RFL,       /*                            X             */
index e89e8d6..78d09f1 100644 (file)
@@ -392,7 +392,6 @@ find_next_use(const struct gl_program *prog,
       switch (inst->Opcode) {
       case OPCODE_BGNLOOP:
       case OPCODE_BGNSUB:
-      case OPCODE_BRA:
       case OPCODE_CAL:
       case OPCODE_CONT:
       case OPCODE_IF:
@@ -439,7 +438,6 @@ _mesa_is_flow_control_opcode(enum prog_opcode opcode)
    switch (opcode) {
    case OPCODE_BGNLOOP:
    case OPCODE_BGNSUB:
-   case OPCODE_BRA:
    case OPCODE_CAL:
    case OPCODE_CONT:
    case OPCODE_IF:
index bc5dc58..a560b53 100644 (file)
@@ -748,13 +748,6 @@ _mesa_fprint_instruction_opt(FILE *f,
       fprint_src_reg(f, &inst->SrcReg[0], mode, prog);
       fprint_comment(f, inst);
       break;
-   case OPCODE_BRA:
-      fprintf(f, "BRA %d (%s%s)",
-             inst->BranchTarget,
-             _mesa_condcode_string(inst->DstReg.CondMask),
-             _mesa_swizzle_string(inst->DstReg.CondSwizzle, 0, GL_FALSE));
-      fprint_comment(f, inst);
-      break;
    case OPCODE_IF:
       if (inst->SrcReg[0].File != PROGRAM_UNDEFINED) {
          /* Use ordinary register */