<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p>Looks good.</p>
<p><br>
</p>
<p>Reviewed-by : Neha Bhende <bhenden@vmware.com><br>
</p>
<p><br>
</p>
<div id="x_Signature">
<div id="x_divtagdefaultwrapper" style="font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255); font-family:Calibri,Arial,Helvetica,sans-serif,"EmojiFont","Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p>Thanks,</p>
<p>Neha<br>
</p>
</div>
</div>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Brian Paul <brianp@vmware.com><br>
<b>Sent:</b> Friday, July 14, 2017 9:06:17 AM<br>
<b>To:</b> piglit@lists.freedesktop.org<br>
<b>Cc:</b> Charmaine Lee; Neha Bhende; Brian Paul<br>
<b>Subject:</b> [PATCH] clipflat: refactor some code</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Pull the innermost code out of testPrim() into a new function.<br>
This can make things a little easier for hacking/debugging.<br>
<br>
Also, print whether PV control is supported and whether quads follow<br>
the PV convention.<br>
---<br>
 tests/general/clipflat.c | 121 +++++++++++++++++++++++++++--------------------<br>
 1 file changed, 71 insertions(+), 50 deletions(-)<br>
<br>
diff --git a/tests/general/clipflat.c b/tests/general/clipflat.c<br>
index 1820418..2608d28 100644<br>
--- a/tests/general/clipflat.c<br>
+++ b/tests/general/clipflat.c<br>
@@ -209,10 +209,16 @@ piglit_init(int argc, char **argv)<br>
                 provoking_vertex_first = true;<br>
         }<br>
 <br>
+       printf("Have GL_ARB/EXT_provoking_vertex: %s\n",<br>
+              provoking_vertex_first ? "yes" : "no");<br>
+<br>
         if (provoking_vertex_first) {<br>
                 GLboolean k;<br>
                 glGetBooleanv(GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT, &k);<br>
                 quads_follows_pv_convention = k;<br>
+<br>
+               printf("Quads follow provoking vertex convention: %s\n",<br>
+                      k ? "yes" : "no");<br>
         }<br>
 }<br>
 <br>
@@ -443,11 +449,72 @@ reportSubtest(GLenum mode, int drawMode, GLuint facing,<br>
 }<br>
 <br>
 <br>
-// Test a particular primitive mode<br>
+// Test a particular primitive mode for one drawing mode, filled/unfilled<br>
+// state and CW/CCW winding.<br>
 static bool<br>
-testPrim(GLenum mode, const GLfloat *verts, GLuint count)<br>
+testPrimCombo(GLenum mode, const GLfloat *verts, GLuint count,<br>
+                         bool fill, enum draw_mode drawMode, GLuint facing)<br>
 {<br>
         GLfloat x, y;<br>
+       bool pass = true;<br>
+<br>
+       glPolygonMode(GL_FRONT_AND_BACK, fill ? GL_LINE : GL_FILL);<br>
+<br>
+       if (facing == 0) {<br>
+               glFrontFace(GL_CCW);<br>
+               glCullFace(GL_BACK);<br>
+       }<br>
+       else {<br>
+               glFrontFace(GL_CW);<br>
+               glCullFace(GL_FRONT);<br>
+       }<br>
+<br>
+       // Position the geometry at 9 different locations to test<br>
+       // clipping against the left, right, bottom and top edges of<br>
+       // the window.<br>
+       // Only the center location will be unclipped.<br>
+       for (y = -1.0; y <= 1.0; y += 1.0) {<br>
+               for (x = -1.0; x <= 1.0; x += 1.0) {<br>
+                       bool quad_pass;<br>
+                       GLfloat badColor[3];<br>
+<br>
+                       glPushMatrix();<br>
+                       glTranslatef(x, y, 0.0);<br>
+<br>
+                       glClear(GL_COLOR_BUFFER_BIT);<br>
+<br>
+                       switch (drawMode) {<br>
+                       case BEGIN_END:<br>
+                               drawBeginEnd(mode, verts, count);<br>
+                               break;<br>
+                       case DRAW_ARRAYS:<br>
+                               drawArrays(mode, verts, count);<br>
+                               break;<br>
+                       case DRAW_ELEMENTS:<br>
+                               drawElements(mode, verts, count);<br>
+                               break;<br>
+                       default:<br>
+                               assert(0);<br>
+                       }<br>
+<br>
+                       glPopMatrix();<br>
+<br>
+                       quad_pass = checkResult(badColor);<br>
+                       pass = pass && quad_pass;<br>
+                       reportSubtest(mode, drawMode, facing, fill,<br>
+                                                 badColor, x, y, quad_pass);<br>
+               }<br>
+       }<br>
+<br>
+       return pass;<br>
+}<br>
+<br>
+<br>
+// Test a particular primitive mode for all drawing modes, filled/unfilled<br>
+// and CW/CCW winding.<br>
+static bool<br>
+testPrim(GLenum mode, const GLfloat *verts, GLuint count)<br>
+{<br>
         GLuint facing, fill;<br>
         int drawMode;<br>
         bool pass = true;<br>
@@ -455,59 +522,13 @@ testPrim(GLenum mode, const GLfloat *verts, GLuint count)<br>
         // Loop over polygon mode: filled vs. outline<br>
         for (fill = 0; fill < 2; fill++) {<br>
 <br>
-               glPolygonMode(GL_FRONT_AND_BACK, fill ? GL_LINE : GL_FILL);<br>
-<br>
                 // Loop over drawing mode: glBegin/End vs glDrawArrays vs glDrawElements<br>
                 for (drawMode = 0; drawMode < NUM_DRAW_MODES; drawMode++) {<br>
 <br>
                         // Loop over CW vs. CCW winding (should make no difference)<br>
                         for (facing = 0; facing < 2; facing++) {<br>
-<br>
-                               if (facing == 0) {<br>
-                                       glFrontFace(GL_CCW);<br>
-                                       glCullFace(GL_BACK);<br>
-                               }<br>
-                               else {<br>
-                                       glFrontFace(GL_CW);<br>
-                                       glCullFace(GL_FRONT);<br>
-                               }<br>
-<br>
-                               // Position the geometry at 9 different locations to test<br>
-                               // clipping against the left, right, bottom and top edges of<br>
-                               // the window.<br>
-                               // Only the center location will be unclipped.<br>
-                               for (y = -1.0; y <= 1.0; y += 1.0) {<br>
-                                       for (x = -1.0; x <= 1.0; x += 1.0) {<br>
-                                               bool quad_pass;<br>
-                                               GLfloat badColor[3];<br>
-<br>
-                                               glPushMatrix();<br>
-                                               glTranslatef(x, y, 0.0);<br>
-<br>
-                                               glClear(GL_COLOR_BUFFER_BIT);<br>
-<br>
-                                               switch (drawMode) {<br>
-                                               case BEGIN_END:<br>
-                                                       drawBeginEnd(mode, verts, count);<br>
-                                                       break;<br>
-                                               case DRAW_ARRAYS:<br>
-                                                       drawArrays(mode, verts, count);<br>
-                                                       break;<br>
-                                               case DRAW_ELEMENTS:<br>
-                                                       drawElements(mode, verts, count);<br>
-                                                       break;<br>
-                                               default:<br>
-                                                       assert(0);<br>
-                                               }<br>
-<br>
-                                               glPopMatrix();<br>
-<br>
-                                               quad_pass = checkResult(badColor);<br>
-                                               pass = pass && quad_pass;<br>
-                                               reportSubtest(mode, drawMode, facing, fill,<br>
-                                                             badColor, x, y, quad_pass);<br>
-                                       }<br>
-                               }<br>
+                               pass = testPrimCombo(mode, verts, count,<br>
+                                                                        fill, drawMode, facing) && pass;<br>
                         }<br>
                 }<br>
         }<br>
-- <br>
1.9.1<br>
<br>
</div>
</span></font>
</body>
</html>