program: Remove NV_fragment_program Abs support.
authorMatt Turner <mattst88@gmail.com>
Sat, 27 Feb 2016 22:04:30 +0000 (14:04 -0800)
committerMatt Turner <mattst88@gmail.com>
Tue, 1 Mar 2016 19:41:29 +0000 (11:41 -0800)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Brian Paul <brianp@vmware.com>
src/mesa/main/ffvertex_prog.c
src/mesa/program/ir_to_mesa.cpp
src/mesa/program/prog_execute.c
src/mesa/program/prog_instruction.h
src/mesa/program/prog_opt_constant_fold.c
src/mesa/program/prog_optimize.c
src/mesa/program/prog_print.c
src/mesa/program/prog_to_nir.c
src/mesa/program/program_parse.y
src/mesa/state_tracker/st_mesa_to_tgsi.c

index 537c74668682eb23e4e9dc21d5f00e526c89e3a5..d72bc71aa72392613b83bb1e8ea8f1c0988ee453 100644 (file)
@@ -537,7 +537,6 @@ static void emit_arg( struct prog_src_register *src,
    src->File = reg.file;
    src->Index = reg.idx;
    src->Swizzle = reg.swz;
-   src->Abs = reg.abs;
    src->Negate = reg.negate ? NEGATE_XYZW : NEGATE_NONE;
    src->RelAddr = 0;
    /* Check that bitfield sizes aren't exceeded */
index a208c05a067248ed3c97188a9752545c61ad9b95..10d931c8b6b08f02daf1769dbd1fcf800fe41f83 100644 (file)
@@ -2180,7 +2180,6 @@ mesa_src_reg_from_ir_src_reg(src_reg reg)
    mesa_reg.Swizzle = reg.swizzle;
    mesa_reg.RelAddr = reg.reladdr != NULL;
    mesa_reg.Negate = reg.negate;
-   mesa_reg.Abs = 0;
 
    return mesa_reg;
 }
index fec72eef960b6aabb71de0a1405edd4a3c6661b2..8f167be60cdc282580ac0613e86693d501420ba9 100644 (file)
@@ -200,12 +200,6 @@ fetch_vector4(const struct prog_src_register *source,
       result[3] = src[GET_SWZ(source->Swizzle, 3)];
    }
 
-   if (source->Abs) {
-      result[0] = fabsf(result[0]);
-      result[1] = fabsf(result[1]);
-      result[2] = fabsf(result[2]);
-      result[3] = fabsf(result[3]);
-   }
    if (source->Negate) {
       assert(source->Negate == NEGATE_XYZW);
       result[0] = -result[0];
@@ -258,12 +252,6 @@ fetch_vector4_deriv(struct gl_context * ctx,
       result[2] = deriv[GET_SWZ(source->Swizzle, 2)];
       result[3] = deriv[GET_SWZ(source->Swizzle, 3)];
       
-      if (source->Abs) {
-         result[0] = fabsf(result[0]);
-         result[1] = fabsf(result[1]);
-         result[2] = fabsf(result[2]);
-         result[3] = fabsf(result[3]);
-      }
       if (source->Negate) {
          assert(source->Negate == NEGATE_XYZW);
          result[0] = -result[0];
@@ -289,9 +277,6 @@ fetch_vector1(const struct prog_src_register *source,
 
    result[0] = src[GET_SWZ(source->Swizzle, 0)];
 
-   if (source->Abs) {
-      result[0] = fabsf(result[0]);
-   }
    if (source->Negate) {
       result[0] = -result[0];
    }
index 9dc869bfbb246fd7aba16958ece34eba948c61f3..0120227711a150e04e96973cab6b37db8ccc0bc0 100644 (file)
@@ -198,11 +198,8 @@ struct prog_src_register
    GLuint Swizzle:12;
    GLuint RelAddr:1;
 
-   /** Take the component-wise absolute value */
-   GLuint Abs:1;
-
    /**
-    * Post-Abs negation.
+    * Negation.
     * This will either be NEGATE_NONE or NEGATE_XYZW, except for the SWZ
     * instruction which allows per-component negation.
     */
index e2518e660e66345dfb5c92b4704a1d058facb080..1d796dcf2e43b809101ca5aa8ea1c5cfc55849a7 100644 (file)
@@ -82,7 +82,6 @@ src_regs_are_same(const struct prog_src_register *a,
    return (a->File == b->File)
       && (a->Index == b->Index)
       && (a->Swizzle == b->Swizzle)
-      && (a->Abs == b->Abs)
       && (a->Negate == b->Negate)
       && (a->RelAddr == 0)
       && (b->RelAddr == 0);
@@ -99,13 +98,6 @@ get_value(struct gl_program *prog, struct prog_src_register *r, float *data)
    data[2] = value[GET_SWZ(r->Swizzle, 2)].f;
    data[3] = value[GET_SWZ(r->Swizzle, 3)].f;
 
-   if (r->Abs) {
-      data[0] = fabsf(data[0]);
-      data[1] = fabsf(data[1]);
-      data[2] = fabsf(data[2]);
-      data[3] = fabsf(data[3]);
-   }
-
    if (r->Negate & 0x01) {
       data[0] = -data[0];
    }
index a416402dfeecfc3cf129b2298e2f130b75e5e713..c6d22644419cec78fb46de9d51fb6ca0d11cab11 100644 (file)
@@ -447,7 +447,6 @@ can_downward_mov_be_modifed(const struct prog_instruction *mov)
       mov->Opcode == OPCODE_MOV &&
       mov->SrcReg[0].RelAddr == 0 &&
       mov->SrcReg[0].Negate == 0 &&
-      mov->SrcReg[0].Abs == 0 &&
       mov->DstReg.RelAddr == 0;
 }
 
@@ -516,8 +515,7 @@ _mesa_remove_extra_move_use(struct gl_program *prog)
 
            if (inst2->SrcReg[arg].File != mov->DstReg.File ||
                inst2->SrcReg[arg].Index != mov->DstReg.Index ||
-               inst2->SrcReg[arg].RelAddr ||
-               inst2->SrcReg[arg].Abs)
+               inst2->SrcReg[arg].RelAddr)
               continue;
             read_mask = get_src_arg_mask(inst2, arg, NO_MASK);
 
index 2bca0447e6a494c566f61fee0a0a97b6efee93f9..08381b425230094a04a30946b31d8f225b5ccac3 100644 (file)
@@ -528,15 +528,11 @@ fprint_src_reg(FILE *f,
                gl_prog_print_mode mode,
                const struct gl_program *prog)
 {
-   const char *abs = srcReg->Abs ? "|" : "";
-
-   fprintf(f, "%s%s%s%s",
-          abs,
+   fprintf(f, "%s%s",
           reg_string((gl_register_file) srcReg->File,
                      srcReg->Index, mode, srcReg->RelAddr, prog),
           _mesa_swizzle_string(srcReg->Swizzle,
-                               srcReg->Negate, GL_FALSE),
-          abs);
+                               srcReg->Negate, GL_FALSE));
 #if 0
    fprintf(f, "%s[%d]%s",
           _mesa_register_file_name((gl_register_file) srcReg->File),
index fa31dfc846be0b11a3164df9b43e19006e7a0d38..1f916ab92992eed5c19b287b4d0d586023ca4290 100644 (file)
@@ -230,9 +230,6 @@ ptn_get_src(struct ptn_compile *c, const struct prog_src_register *prog_src)
 
       def = nir_fmov_alu(b, src, 4);
 
-      if (prog_src->Abs)
-         def = nir_fabs(b, def);
-
       if (prog_src->Negate)
          def = nir_fneg(b, def);
    } else {
@@ -258,9 +255,6 @@ ptn_get_src(struct ptn_compile *c, const struct prog_src_register *prog_src)
             chans[i] = &mov->dest.dest.ssa;
          }
 
-         if (prog_src->Abs)
-            chans[i] = nir_fabs(b, chans[i]);
-
          if (prog_src->Negate & (1 << i))
             chans[i] = nir_fneg(b, chans[i]);
       }
index 260f4724460e2d0f33f8d3399cbea5b2dc516dd9..4c32bc897ab92e66b3410a4f1e17909c5364fedb 100644 (file)
@@ -555,21 +555,6 @@ scalarSrcReg: optionalSign scalarUse
              $$.Base.Negate = ~$$.Base.Negate;
           }
        }
-       | optionalSign '|' scalarUse '|'
-       {
-          $$ = $3;
-
-          if (!state->option.NV_fragment) {
-             yyerror(& @2, state, "unexpected character '|'");
-             YYERROR;
-          }
-
-          if ($1) {
-             $$.Base.Negate = ~$$.Base.Negate;
-          }
-
-          $$.Base.Abs = 1;
-       }
        ;
 
 scalarUse:  srcReg scalarSuffix
@@ -609,24 +594,6 @@ swizzleSrcReg: optionalSign srcReg swizzleSuffix
           $$.Base.Swizzle = _mesa_combine_swizzles($$.Base.Swizzle,
                                                    $3.swizzle);
        }
-       | optionalSign '|' srcReg swizzleSuffix '|'
-       {
-          $$ = $3;
-
-          if (!state->option.NV_fragment) {
-             yyerror(& @2, state, "unexpected character '|'");
-             YYERROR;
-          }
-
-          if ($1) {
-             $$.Base.Negate = ~$$.Base.Negate;
-          }
-
-          $$.Base.Abs = 1;
-          $$.Base.Swizzle = _mesa_combine_swizzles($$.Base.Swizzle,
-                                                   $4.swizzle);
-       }
-
        ;
 
 maskedDstReg: dstReg optionalMask
index dbee3d6018ce0d8a781e4aae0a650b2e8b949816..8772efb0944e6d9b8a6116a4156639706a9e67f0 100644 (file)
@@ -320,9 +320,6 @@ translate_src( struct st_translate *t,
    if (SrcReg->Negate == NEGATE_XYZW)
       src = ureg_negate(src);
 
-   if (SrcReg->Abs) 
-      src = ureg_abs(src);
-
    if (SrcReg->RelAddr) {
       src = ureg_src_indirect( src, ureg_src(t->address[0]));
       if (SrcReg->File != PROGRAM_INPUT &&