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