On 7 September 2012 13:04, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
These are supported in hardware; no need for software fallbacks.<br>
<br>
Not actually hit in any of our test cases, since they appear to count<br>
primitives generated which currently causes software fallbacks anyway.<br></blockquote><div><br>How much effort would it be to update the test cases so that they exercise this code?  It seems like it would be worth spending some effort to make sure the hardware path gets tested, just in case there are undiscovered hardware bugs :)<br>
 </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
---<br>
 src/mesa/drivers/dri/i965/brw_primitive_restart.c | 20 ++++++++++----------<br>
 1 file changed, 10 insertions(+), 10 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_primitive_restart.c b/src/mesa/drivers/dri/i965/brw_primitive_restart.c<br>
index 38b5243..fc36897 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_primitive_restart.c<br>
+++ b/src/mesa/drivers/dri/i965/brw_primitive_restart.c<br>
@@ -79,6 +79,7 @@ can_cut_index_handle_prims(struct gl_context *ctx,<br>
                            const struct _mesa_index_buffer *ib)<br>
 {<br>
    struct brw_context *brw = brw_context(ctx);<br>
+   struct intel_context *intel = intel_context(ctx);<br>
<br>
    if (brw->sol.counting_primitives_generated ||<br>
        brw->sol.counting_primitives_written) {<br>
@@ -105,19 +106,18 @@ can_cut_index_handle_prims(struct gl_context *ctx,<br>
       case GL_TRIANGLES:<br>
       case GL_TRIANGLE_STRIP:<br>
          /* Cut index supports these primitive types */<br>
-         break;<br>
-      default:<br>
-         /* Cut index does not support these primitive types */<br>
-      //case GL_LINE_LOOP:<br>
-      //case GL_TRIANGLE_FAN:<br>
-      //case GL_QUADS:<br>
-      //case GL_QUAD_STRIP:<br>
-      //case GL_POLYGON:<br>
-         return false;<br>
+         return true;<br>
+      case GL_LINE_LOOP:<br>
+      case GL_TRIANGLE_FAN:<br>
+      case GL_QUADS:<br>
+      case GL_QUAD_STRIP:<br>
+      case GL_POLYGON:<br>
+         /* Haswell supports cut index on additional primitive types */<br>
+         return intel->is_haswell;<br>
       }<br>
    }<br>
<br>
-   return true;<br>
+   return false;<br></blockquote><div><br>I like the fact that you're returning false for unrecognized primitive types, since we know that in the future more primitive types will be added (GL_LINES_ADJACENCY, GL_LINE_STRIP_ADJACENCY, GL_TRIANGLES_ADJACENCY, GL_TRIANGLE_STRIP_ADJACENCY, and GL_PATCHES), and it's probably safer not to enable hardware primitive restart on those types until we can actually test them.<br>
<br>But I'm worried that we'll forget to revisit this code when we do get around to adding them.  How would you feel about putting the future primitive types into the switch statement, with a comment explaining why we're not handling them, just so they'll show up in grep results when we are working on those new primitive types?  For example maybe something like this:<br>
<br>case GL_LINES_ADJACENCY:<br>   ...<br>case GL_PATCHES:<br>   /* Not yet implemented, so for safety fall back to software primitive restart */<br>   break;<br><br>In any case,<br><br>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>> <br>
 </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 }<br>
<br>
 /**<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.11.4</font></span> <br></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888">
<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>