On Tue, Dec 16, 2014 at 5:53 PM, Jason Ekstrand <ja...@jlekstrand.net> wrote: > Originally, this field was intended for determining if the given > instruction acted per-component or if it had mismatching source and > destination sizes that would have to be interpreted specially. However, we > can easily derive this from output_size == 0, so it's not really that > useful. Also, the values we were setting in nir_opcodes.h for this field > were completely bogus and it was never used. > --- > src/glsl/nir/nir.h | 33 +++++++++++++++------------------ > src/glsl/nir/nir_opcodes.c | 3 +-- > src/glsl/nir/nir_opcodes.h | 34 +++++++++++++++++----------------- > 3 files changed, 33 insertions(+), 37 deletions(-) > > diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h > index a1a133c..ba04c29 100644 > --- a/src/glsl/nir/nir.h > +++ b/src/glsl/nir/nir.h > @@ -533,7 +533,7 @@ typedef struct { > unsigned write_mask : 4; /* ignored if dest.is_ssa is true */ > } nir_alu_dest; > > -#define OPCODE(name, num_inputs, per_component, output_size, output_type, \ > +#define OPCODE(name, num_inputs, output_size, output_type, \ > input_sizes, input_types, algebraic_props) \ > nir_op_##name, > > @@ -565,24 +565,21 @@ typedef struct { > unsigned num_inputs; > > /** > - * If true, the opcode acts in the standard, per-component manner; the > - * operation is performed on each component (except the ones that are > masked > - * out) with the input being taken from the input swizzle for that > component. > + * The number of components in the output > * > - * If false, the size of the output and inputs are explicitly given; > swizzle > - * and writemask are still in effect, but if the output component is > masked > - * out, then the input component may still be in use. > + * If non-zero, this is the size of the output and input sizes are > + * explicitly given; swizzle and writemask are still in effect, but if > + * the output component is masked out, then the input component may > + * still be in use. > * > - * The size of some of the inputs may be given (i.e. non-zero) even though > - * per_component is false; in that case, each component of the input acts > - * per-component, while the rest of the inputs and the output are normal. > - * For example, for conditional select the condition is per-component but > - * everything else is normal. > - */ > - bool per_component; > - > - /** > - * If per_component is false, the number of components in the output. > + * If zero, the opcode acts in the standard, per-component manner; the > + * operation is performed on each component (except the ones that are > + * masked out) with the input being taken from the input swizzle for > + * that component. > + * > + * The size of some of the inputs may be given (i.e. non-zero) even > + * though output_size is zero; in that case, the inputs with a zero > + * size act per-component, while the inputs with non-zero size don't. > */ > unsigned output_size; > > @@ -594,7 +591,7 @@ typedef struct { > nir_alu_type output_type; > > /** > - * If per_component is false, the number of components in each input. > + * The number of components in each input > */ > unsigned input_sizes[4]; > > diff --git a/src/glsl/nir/nir_opcodes.c b/src/glsl/nir/nir_opcodes.c > index 3a86641..1e66c55 100644 > --- a/src/glsl/nir/nir_opcodes.c > +++ b/src/glsl/nir/nir_opcodes.c > @@ -27,12 +27,11 @@ > > #include "nir.h" > > -#define OPCODE(_name, _num_inputs, _per_component, _output_size, > _output_type, \ > +#define OPCODE(_name, _num_inputs, _output_size, _output_type, \ > _input_sizes, _input_types, _algebraic_props) \ > { \ > .name = #_name, \ > .num_inputs = _num_inputs, \ > - .per_component = _per_component, \ > .output_size = _output_size, \ > .output_type = _output_type, \ > .input_sizes = _input_sizes, \ > diff --git a/src/glsl/nir/nir_opcodes.h b/src/glsl/nir/nir_opcodes.h > index 6525fe6..60198b0 100644 > --- a/src/glsl/nir/nir_opcodes.h > +++ b/src/glsl/nir/nir_opcodes.h > @@ -29,7 +29,7 @@ > * This header file defines all the available opcodes in one place. It > expands > * to a list of macros of the form: > * > - * OPCODE(name, num_inputs, per_component, output_size, output_type, > + * OPCODE(name, num_inputs, output_size, output_type, > * input_sizes, input_types, algebraic_properties) > * > * Which should correspond one-to-one with the nir_op_info structure. It is > @@ -40,11 +40,11 @@ > > #define ARR(...) { __VA_ARGS__ } > > -#define UNOP(name, type) OPCODE(name, 1, false, 0, type, ARR(0), ARR(type), > 0) > +#define UNOP(name, type) OPCODE(name, 1, 0, type, ARR(0), ARR(type), 0) > #define UNOP_CONVERT(name, in_type, out_type) \ > - OPCODE(name, 1, false, 0, out_type, ARR(0), ARR(in_type), 0) > + OPCODE(name, 1, 0, out_type, ARR(0), ARR(in_type), 0) > #define UNOP_HORIZ(name, output_size, output_type, input_size, input_type) \ > - OPCODE(name, 1, true, output_size, output_type, ARR(input_size), \ > + OPCODE(name, 1, output_size, output_type, ARR(input_size), \ > ARR(input_type), 0) > > #define UNOP_REDUCE(name, output_size, output_type, input_type) \ > @@ -175,21 +175,21 @@ UNOP_HORIZ(fnoise4_3, 4, nir_type_float, 3, > nir_type_float) > UNOP_HORIZ(fnoise4_4, 4, nir_type_float, 4, nir_type_float) > > #define BINOP(name, type, alg_props) \ > - OPCODE(name, 2, true, 0, type, ARR(0, 0), ARR(type, type), alg_props) > + OPCODE(name, 2, 0, type, ARR(0, 0), ARR(type, type), alg_props) > #define BINOP_CONVERT(name, out_type, in_type, alg_props) \ > - OPCODE(name, 2, true, 0, out_type, ARR(0, 0), ARR(in_type, in_type), > alg_props) > + OPCODE(name, 2, 0, out_type, ARR(0, 0), ARR(in_type, in_type), alg_props) > #define BINOP_COMPARE(name, type, alg_props) \ > - OPCODE(name, 2, true, 0, nir_type_bool, ARR(0, 0), ARR(type, type), > alg_props) > + OPCODE(name, 2, 0, nir_type_bool, ARR(0, 0), ARR(type, type), alg_props) > #define BINOP_HORIZ(name, output_size, output_type, src1_size, src1_type, \ > src2_size, src2_type) \ > - OPCODE(name, 2, true, output_size, output_type, ARR(src1_size, > src2_size), \ > + OPCODE(name, 2, output_size, output_type, ARR(src1_size, src2_size), \ > ARR(src1_type, src2_type), 0) > #define BINOP_REDUCE(name, output_size, output_type, src_type) \ > - OPCODE(name##2, 2, false, output_size, output_type, \ > + OPCODE(name##2, 2, output_size, output_type, \ > ARR(2, 2), ARR(src_type, src_type), nir_op_is_commutative) \ > - OPCODE(name##3, 2, false, output_size, output_type, \ > + OPCODE(name##3, 2, output_size, output_type, \ > ARR(3, 3), ARR(src_type, src_type), nir_op_is_commutative) \ > - OPCODE(name##4, 2, false, output_size, output_type, \ > + OPCODE(name##4, 2, output_size, output_type, \ > ARR(4, 4), ARR(src_type, src_type), nir_op_is_commutative) > > BINOP(fadd, nir_type_float, nir_op_is_commutative | nir_op_is_associative) > @@ -314,9 +314,9 @@ BINOP(ldexp, nir_type_unsigned, 0) > BINOP_HORIZ(vec2, 2, nir_type_unsigned, 1, nir_type_unsigned, 1, > nir_type_unsigned) > > #define TRIOP(name, type) \ > - OPCODE(name, 3, true, 0, type, ARR(0, 0, 0), ARR(type, type, type), 0) > + OPCODE(name, 3, 0, type, ARR(0, 0, 0), ARR(type, type, type), 0) > #define TRIOP_HORIZ(name, output_size, src1_size, src2_size, src3_size) \ > - OPCODE(name, 3, false, output_size, nir_type_unsigned, \ > + OPCODE(name, 3, output_size, nir_type_unsigned, \ > ARR(src1_size, src2_size, src3_size), \ > ARR(nir_type_unsigned, nir_type_unsigned, nir_type_unsigned), 0) > > @@ -334,13 +334,13 @@ TRIOP(flrp, nir_type_float) > */ > > TRIOP(fcsel, nir_type_float) > -OPCODE(bcsel, 3, true, 0, nir_type_unsigned, ARR(0, 0, 0), > +OPCODE(bcsel, 3, 0, nir_type_unsigned, ARR(0, 0, 0), > ARR(nir_type_bool, nir_type_unsigned, nir_type_unsigned), 0) > > TRIOP(bfi, nir_type_unsigned) > > TRIOP(ubitfield_extract, nir_type_unsigned) > -OPCODE(ibitfield_extract, 3, true, 0, nir_type_int, ARR(0, 0, 0), > +OPCODE(ibitfield_extract, 3, 0, nir_type_int, ARR(0, 0, 0), > ARR(nir_type_int, nir_type_unsigned, nir_type_unsigned), 0) > > /** > @@ -349,12 +349,12 @@ OPCODE(ibitfield_extract, 3, true, 0, nir_type_int, > ARR(0, 0, 0), > TRIOP_HORIZ(vec3, 3, 1, 1, 1) > > #define QUADOP(name) \ > - OPCODE(name, 4, true, 0, nir_type_unsigned, ARR(0, 0, 0, 0), \ > + OPCODE(name, 4, 0, nir_type_unsigned, ARR(0, 0, 0, 0), \ > ARR(nir_type_unsigned, nir_type_unsigned, nir_type_unsigned, > nir_type_unsigned), \ > 0) > #define QUADOP_HORIZ(name, output_size, src1_size, src2_size, src3_size, \ > src4_size) \ > - OPCODE(name, 4, false, output_size, nir_type_unsigned, \ > + OPCODE(name, 4, output_size, nir_type_unsigned, \ > ARR(src1_size, src2_size, src3_size, src4_size), \ > ARR(nir_type_unsigned, nir_type_unsigned, nir_type_unsigned, > nir_type_unsigned), \ > 0) > -- > 2.2.0 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Yeah, per_component definitely shouldn't have been there in the first place... Reviewed-by: Connor Abbott <cwabbo...@gmail.com> _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev