On Tue, Dec 16, 2014 at 1:12 AM, Jason Ekstrand <ja...@jlekstrand.net> wrote:
> --- > src/glsl/nir/nir_intrinsics.h | 32 +++++++++++++++----------------- > src/glsl/nir/nir_lower_io.c | 16 ++++++---------- > 2 files changed, 21 insertions(+), 27 deletions(-) > > diff --git a/src/glsl/nir/nir_intrinsics.h b/src/glsl/nir/nir_intrinsics.h > index 75bd12f..e66273d 100644 > --- a/src/glsl/nir/nir_intrinsics.h > +++ b/src/glsl/nir/nir_intrinsics.h > @@ -47,6 +47,21 @@ INTRINSIC(store_var, 1, ARR(0), false, 0, 1, 0, 0) > INTRINSIC(copy_var, 0, ARR(), false, 0, 2, 0, 0) > > /* > + * Interpolation of input. The interp_var_at* intrinsics are similar to > the > + * load_var intrinsic acting an a shader input except that they > interpolate > + * the input differently. The at_sample and at_offset intrinsics take an > + * aditional source that is a integer sample id or a vec2 position offset > + * respectively. > + */ > + > +INTRINSIC(interp_var_at_centroid, 0, ARR(0), true, 0, 1, 0, > + NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER) > +INTRINSIC(interp_var_at_sample, 1, ARR(1), true, 0, 1, 0, > + NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER) > +INTRINSIC(interp_var_at_offset, 1, ARR(2), true, 0, 1, 0, > + NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER) > + > +/* > * a barrier is an intrinsic with no inputs/outputs but which can't be > moved > * around/optimized in general > */ > @@ -110,23 +125,6 @@ LOAD(input, 2, NIR_INTRINSIC_CAN_REORDER) > /* LOAD(ssbo, 2, 0) */ > > /* > - * Interpolation of input. These are similar to the load_input* > intrinsics > - * except they interpolate differently. The interp_at_offset* and > - * interp_at_offset* intrinsics take a second source that is either a > - * sample id or a vec2 position offset. > - */ > - > -#define INTERP(name, num_srcs, src_comps) \ > - INTRINSIC(interp_##name, num_srcs, ARR(src_comps), true, \ > - 0, 0, 2, NIR_INTRINSIC_CAN_ELIMINATE | > NIR_INTRINSIC_CAN_REORDER) \ > - INTRINSIC(interp_##name##_indirect, 1 + num_srcs, ARR(1, src_comps), > true, \ > - 0, 0, 2, NIR_INTRINSIC_CAN_ELIMINATE | > NIR_INTRINSIC_CAN_REORDER) > - > -INTERP(at_centroid, 0, 0) > -INTERP(at_sample, 1, 1) > -INTERP(at_offset, 1, 1) > - > -/* > * Stores work the same way as loads, except now the first register input > is > * the value or array to store and the optional second input is the > indirect > * offset. > diff --git a/src/glsl/nir/nir_lower_io.c b/src/glsl/nir/nir_lower_io.c > index ed3ce81..1ab0400 100644 > --- a/src/glsl/nir/nir_lower_io.c > +++ b/src/glsl/nir/nir_lower_io.c > The changes here are unrelated, so they should get separated out and probably squashed into the vectorizing intrinsics commit. > @@ -205,25 +205,21 @@ nir_lower_io_block(nir_block *block, void > *void_state) > > bool has_indirect = deref_has_indirect(intrin->variables[0]); > > + /* Figure out the opcode */ > nir_intrinsic_op load_op; > switch (mode) { > case nir_var_shader_in: > - if (has_indirect) { > - load_op = nir_intrinsic_load_input_indirect; > - } else { > - load_op = nir_intrinsic_load_input; > - } > + load_op = has_indirect ? nir_intrinsic_load_input_indirect : > + nir_intrinsic_load_input; > break; > case nir_var_uniform: > - if (has_indirect) { > - load_op = nir_intrinsic_load_uniform_indirect; > - } else { > - load_op = nir_intrinsic_load_uniform; > - } > + load_op = has_indirect ? nir_intrinsic_load_uniform_indirect : > + nir_intrinsic_load_uniform; > break; > default: > unreachable("Unknown variable mode"); > } > + > nir_intrinsic_instr *load = > nir_intrinsic_instr_create(state->mem_ctx, > load_op); > load->num_components = intrin->num_components; > -- > 2.2.0 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev >
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev