From: Matt Turner Date: Sat, 27 Feb 2016 22:04:30 +0000 (-0800) Subject: program: Remove NV_fragment_program Abs support. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fe2d2c7ad8793fbcc4761cf5b51270c296eb811c;p=mesa.git program: Remove NV_fragment_program Abs support. Reviewed-by: Kenneth Graunke Reviewed-by: Ian Romanick Acked-by: Brian Paul --- diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 537c7466868..d72bc71aa72 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -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 */ diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index a208c05a067..10d931c8b6b 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -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; } diff --git a/src/mesa/program/prog_execute.c b/src/mesa/program/prog_execute.c index fec72eef960..8f167be60cd 100644 --- a/src/mesa/program/prog_execute.c +++ b/src/mesa/program/prog_execute.c @@ -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]; } diff --git a/src/mesa/program/prog_instruction.h b/src/mesa/program/prog_instruction.h index 9dc869bfbb2..0120227711a 100644 --- a/src/mesa/program/prog_instruction.h +++ b/src/mesa/program/prog_instruction.h @@ -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. */ diff --git a/src/mesa/program/prog_opt_constant_fold.c b/src/mesa/program/prog_opt_constant_fold.c index e2518e660e6..1d796dcf2e4 100644 --- a/src/mesa/program/prog_opt_constant_fold.c +++ b/src/mesa/program/prog_opt_constant_fold.c @@ -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]; } diff --git a/src/mesa/program/prog_optimize.c b/src/mesa/program/prog_optimize.c index a416402dfee..c6d22644419 100644 --- a/src/mesa/program/prog_optimize.c +++ b/src/mesa/program/prog_optimize.c @@ -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); diff --git a/src/mesa/program/prog_print.c b/src/mesa/program/prog_print.c index 2bca0447e6a..08381b42523 100644 --- a/src/mesa/program/prog_print.c +++ b/src/mesa/program/prog_print.c @@ -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), diff --git a/src/mesa/program/prog_to_nir.c b/src/mesa/program/prog_to_nir.c index fa31dfc846b..1f916ab9299 100644 --- a/src/mesa/program/prog_to_nir.c +++ b/src/mesa/program/prog_to_nir.c @@ -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]); } diff --git a/src/mesa/program/program_parse.y b/src/mesa/program/program_parse.y index 260f4724460..4c32bc897ab 100644 --- a/src/mesa/program/program_parse.y +++ b/src/mesa/program/program_parse.y @@ -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 diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index dbee3d6018c..8772efb0944 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -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 &&