diff options
author | Jason Ekstrand <[email protected]> | 2014-12-16 14:43:26 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-01-15 07:20:22 -0800 |
commit | 813316d1501e08da56a1021a7378d6b5e6371922 (patch) | |
tree | 462e2dbf902656740a8d8c4a769947a7991fed35 /src/glsl/nir | |
parent | e2a8f9e5ccb136f1e9460255054e34c11a41a422 (diff) |
nir/opcodes: Remove the per_component info field
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.
Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/glsl/nir')
-rw-r--r-- | src/glsl/nir/nir.h | 33 | ||||
-rw-r--r-- | src/glsl/nir/nir_opcodes.c | 3 | ||||
-rw-r--r-- | 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 61cdfdf8b1a..367862c9a8a 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 3a86641bc8a..1e66c550c2d 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 985f5727b9b..c16b7fe25e2 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) |