<div dir="ltr"><div><div>Ian,<br><br>This test has been moved up the priority list.  Jason has adopted my blitter-removal patches because someone at Intel wants the blitter gone.  (It should've been deleted ages ago.)  Anyway, test coverage for glBitmap was a little spotty for the purposes of removing the blitter from glBitmap in the i965 driver, so that's why I made this test.<br><br></div>Thanks.<br><br></div>Laura<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 11, 2018 at 1:38 PM, Laura Ekstrand <span dir="ltr"><<a href="mailto:laura@jlekstrand.net" target="_blank">laura@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>
 tests/opengl.py                        |   1 +<br>
 tests/spec/gl-1.0/CMakeLists.<wbr>gl.txt    |   1 +<br>
 tests/spec/gl-1.0/bitmap-<wbr>heart-dance.c | 219 ++++++++++++++++++++++++++++++<wbr>+++<br>
 3 files changed, 221 insertions(+)<br>
 create mode 100644 tests/spec/gl-1.0/bitmap-<wbr>heart-dance.c<br>
<br>
diff --git a/tests/opengl.py b/tests/opengl.py<br>
index 347e8c5d4..ddf07b0b7 100644<br>
--- a/tests/opengl.py<br>
+++ b/tests/opengl.py<br>
@@ -570,6 +570,7 @@ with profile.test_list.group_<wbr>manager(<br>
<span class="">         PiglitGLTest,<br>
         grouptools.join('spec', '!opengl 1.0')) as g:<br>
     g(['gl-1.0-beginend-coverage']<wbr>)<br>
+    g(['gl-1.0-bitmap-heart-dance'<wbr>])<br>
     g(['gl-1.0-dlist-beginend'])<br>
     g(['gl-1.0-dlist-bitmap'])<br>
     g(['gl-1.0-dlist-materials'])<br>
diff --git a/tests/spec/gl-1.0/<wbr>CMakeLists.gl.txt b/tests/spec/gl-1.0/<wbr>CMakeLists.gl.txt<br>
index e5986968c..c97a160fc 100644<br>
--- a/tests/spec/gl-1.0/<wbr>CMakeLists.gl.txt<br>
+++ b/tests/spec/gl-1.0/<wbr>CMakeLists.gl.txt<br>
@@ -10,6 +10,7 @@ link_libraries (<br>
<br>
 piglit_add_executable (gl-1.0-user-clip-all-planes user-clip-all-planes.c)<br>
 piglit_add_executable (gl-1.0-beginend-coverage beginend-coverage.c)<br>
+piglit_add_executable (gl-1.0-bitmap-heart-dance bitmap-heart-dance.c)<br>
 piglit_add_executable (gl-1.0-blend-func blend.c)<br>
 piglit_add_executable (gl-1.0-dlist-beginend dlist-beginend.c)<br>
 piglit_add_executable (gl-1.0-dlist-bitmap dlist-bitmap.c)<br>
diff --git a/tests/spec/gl-1.0/bitmap-<wbr>heart-dance.c b/tests/spec/gl-1.0/bitmap-<wbr>heart-dance.c<br>
new file mode 100644<br>
</span>index 000000000..cb1c7faa7<br>
--- /dev/null<br>
+++ b/tests/spec/gl-1.0/bitmap-<wbr>heart-dance.c<br>
@@ -0,0 +1,219 @@<br>
<div><div class="h5">+/*<br>
+ * Copyright (C) 2018 Laura Ekstrand<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a<br>
+ * copy of this software and associated documentation files (the "Software"),<br>
+ * to deal in the Software without restriction, including without limitation<br>
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
+ * and/or sell copies of the Software, and to permit persons to whom the<br>
+ * Software is furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice (including the next<br>
+ * paragraph) shall be included in all copies or substantial portions of the<br>
+ * Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL<br>
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS<br>
+ * IN THE SOFTWARE.<br>
+ */<br>
+<br>
+/**<br>
+ * Test glBitmap in a methodical way using a series of heart shapes.<br>
+ * Heart shape is diagram A.2 from Garnstudio free sock pattern Heart Dance<br>
+ * (<a href="https://www.garnstudio.com/pattern.php?id=7440&cid=17" rel="noreferrer" target="_blank">https://www.garnstudio.com/<wbr>pattern.php?id=7440&cid=17</a>).<br>
+ * Knitting color work is basically glBitmap for knits!<br>
+ *<br>
+ *       _ * _ _ _ * _ _        where  _ = 0<br>
+ *       * * * _ * * * _               * = 1<br>
+ *       * * * * * * * _<br>
+ *       * * * * * * * _<br>
+ *       _ * * * * * _ _<br>
+ *       _ _ * * * _ _ _<br>
+ *       _ _ _ * _ _ _ _<br>
+ *       _ _ _ _ _ _ _ _<br>
+ *<br>
+ * Or:                          Little end    Big end<br>
+ *       0 1 0 0 0 1 0 0         68   0x44     0x22<br>
+ *       1 1 1 0 1 1 1 0        238   0xEE     0x77<br>
+ *       1 1 1 1 1 1 1 0        254   0xFE     0xF7<br>
+ *       1 1 1 1 1 1 1 0        254   0xFE     0xF7<br>
+ *       0 1 1 1 1 1 0 0        124   0x7C     0xE3<br>
+ *       0 0 1 1 1 0 0 0         56   0x38     0xC2<br>
+ *       0 0 0 1 0 0 0 0         16   0x10     0x80<br>
+ *       0 0 0 0 0 0 0 0          0   0x00     0x00<br>
+ *<br>
+ * Laura Ekstrand<br>
+ * March 2018<br>
+ */<br>
+<br>
+#include "piglit-util-gl.h"<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_BEGIN<br>
+       config.supports_gl_compat_<wbr>version = 10;<br>
+       config.window_visual = PIGLIT_GL_VISUAL_DOUBLE |<br>
</div></div>+                              PIGLIT_GL_VISUAL_RGBA;<br>
<div><div class="h5">+       config.window_width = 340;<br>
+       config.window_height = 200;<br>
+       config.khr_no_error_support = PIGLIT_NO_ERRORS;<br>
+PIGLIT_GL_TEST_CONFIG_END<br>
+<br>
+static const float      red[4] = {0.502, 0.082, 0.082, 1.0};<br>
+static const float   salmon[4] = {1.000, 0.353, 0.353, 1.0};<br>
+static const float     pink[4] = {0.945, 0.471, 0.639, 1.0};<br>
+static const float   orange[4] = {1.000, 0.286, 0.000, 1.0};<br>
+static const float ltorange[4] = {1.000, 0.514, 0.322, 1.0};<br>
+static const float   yellow[4] = {1.000, 0.871, 0.133, 1.0};<br>
+static GLubyte bitmap[8] = { 0x00, 0x10, 0x38, 0x7C,<br>
+                            0xFE, 0xFE, 0xEE, 0x44 };<br>
+<br>
+static const char *fragShaderText =<br>
+       "#version 130 \n"<br>
+       "uniform vec4      red; \n"<br>
+       "uniform vec4   salmon; \n"<br>
+       "uniform vec4     pink; \n"<br>
+       "uniform vec4   orange; \n"<br>
+       "uniform vec4 ltorange; \n"<br>
+       "uniform vec4   yellow; \n"<br>
+       "uniform int     xorig; \n"<br>
+       "uniform int     yorig; \n"<br>
+       "uniform int    length; \n"<br>
+       "uniform int       ysp; \n"<br>
+       "uniform int    height; \n"<br>
+       "uniform int  heart[8]; \n"<br>
+       "\n"<br>
+       "void main() \n"<br>
+       "{ \n"<br>
+       "    float zoom = 1.0; \n"<br>
+       "    vec4 black = vec4(0.0, 0.0, 0.0, 1.0); \n"<br>
+       "    int xsp = ysp + 8;  // Must be > 8. \n"<br>
+       "    vec2 fragCoord = gl_FragCoord.xy; \n"<br>
+       "    if ((fragCoord.x < xorig) || (fragCoord.y < height + yorig) ||\n"<br>
+       "        (fragCoord.x > xorig + ((length - 1) * xsp) + 8) || \n"<br>
+       "        (fragCoord.y > height + yorig + (5*ysp) + 8)) { \n"<br>
+       "        gl_FragColor = black; \n"<br>
+       "        return; \n"<br>
+       "    } \n"<br>
+       "    fragCoord = fragCoord/zoom; \n"<br>
+       "    int i = int(fragCoord.y - yorig - height) % ysp; \n"<br>
+       "    int pointmask = i < 8 ? heart[i] : 0; \n"<br>
+       "    int j = int(fragCoord.x - xorig) % xsp; \n"<br>
+       "    if (j > 8) { \n"<br>
+       "      j = 0; \n"<br>
+       "    } \n"<br>
+       "    for (int r = 0; r < j; r++) { \n"<br>
+       "      pointmask = pointmask/2; //left shift. \n"<br>
+       "    } \n"<br>
+       "    if (pointmask % 2 == 1) { \n"<br>
+       "        int c = (int(fragCoord.y - height - yorig) / ysp) % 6; \n"<br>
+       "        switch (c) { \n"<br>
+       "           case 0: \n"<br>
+       "             gl_FragColor = yellow; \n"<br>
+       "             break; \n"<br>
+       "           case 1: \n"<br>
+       "             gl_FragColor = ltorange; \n"<br>
+       "             break; \n"<br>
+       "           case 2: \n"<br>
+       "             gl_FragColor = orange; \n"<br>
+       "             break; \n"<br>
+       "           case 3: \n"<br>
+       "             gl_FragColor = pink; \n"<br>
+       "             break; \n"<br>
+       "           case 4: \n"<br>
+       "             gl_FragColor = salmon; \n"<br>
+       "             break; \n"<br>
+       "           case 5: \n"<br>
+       "             gl_FragColor = red; \n"<br>
+       "             break; \n"<br>
+       "        } \n"<br>
+       "    } else { \n"<br>
+       "        gl_FragColor = black; \n"<br>
+       "    } \n"<br>
+       "} \n";<br>
+<br>
+<br>
+static void<br>
+draw_row(const float* color, int length,<br>
+        int x, int y, int spacex) {<br>
+       glColor4fv(color);<br>
+       glRasterPos2f(x, y);<br>
+       for (int i = 0; i < length; i++) {<br>
</div></div>+               /* A line of hearts. */<br>
<span class="">+               glBitmap(8, 8, 0, 0, 8 + spacex, 0, bitmap);<br>
+       }<br>
+}<br>
+<br>
</span>+static GLuint fragShader, program;<br>
<span class="">+<br>
+enum piglit_result<br>
+piglit_display(void)<br>
+{<br>
</span>+       /* Draw with glBitmap */<br>
<span class="">+       bool pass = true;<br>
+       int length = 17;<br>
+       int x = 20;<br>
+       int y = 30;<br>
+       int spacing = 10;<br>
+<br>
+       glPixelStorei(GL_UNPACK_LSB_<wbr>FIRST, GL_TRUE);<br>
+       glPixelStorei(GL_UNPACK_<wbr>ALIGNMENT, 1);<br>
+<br>
+       glViewport(0, 0, piglit_width, piglit_height);<br>
+       piglit_ortho_projection(<wbr>piglit_width, piglit_height, GL_FALSE);<br>
+<br>
+       glClear(GL_COLOR_BUFFER_BIT);<br>
+       draw_row(     red, length, x, y + 5*spacing, spacing);<br>
+       draw_row(  salmon, length, x, y + 4*spacing, spacing);<br>
+       draw_row(    pink, length, x, y + 3*spacing, spacing);<br>
+       draw_row(  orange, length, x, y + 2*spacing, spacing);<br>
+       draw_row(ltorange, length, x, y + 1*spacing, spacing);<br>
+       draw_row(  yellow, length, x, y + 0*spacing, spacing);<br>
+<br>
+<br>
</span>+       /*<br>
+        * Upload heart pattern. glBitmap is a bit mysterious in its bit<br>
+        * interpretation, and GLSL doesn't have ubyte.<br>
+        */<br>
<span class="">+       int heart[8];<br>
+       for (int i = 0; i < 8; i++) {<br>
+               heart[i] = (int) bitmap[i];<br>
+       }<br>
+       glUniform1iv(<wbr>glGetUniformLocation(program, "heart"), 8, heart);<br>
+<br>
</span>+       /* Load Colors. */<br>
<span class="">+       glUniform4fv(<wbr>glGetUniformLocation(program, "red"),      1, red);<br>
+       glUniform4fv(<wbr>glGetUniformLocation(program, "salmon"),   1, salmon);<br>
+       glUniform4fv(<wbr>glGetUniformLocation(program, "pink"),     1, pink);<br>
+       glUniform4fv(<wbr>glGetUniformLocation(program, "orange"),   1, orange);<br>
+       glUniform4fv(<wbr>glGetUniformLocation(program, "ltorange"), 1, ltorange);<br>
+       glUniform4fv(<wbr>glGetUniformLocation(program, "yellow"),   1, yellow);<br>
+<br>
</span>+       /* Load spacing. */<br>
<span class="">+       glUniform1i(<wbr>glGetUniformLocation(program, "xorig"), x);<br>
+       glUniform1i(<wbr>glGetUniformLocation(program, "yorig"), y);<br>
+       glUniform1i(<wbr>glGetUniformLocation(program, "length"), length);<br>
+       glUniform1i(<wbr>glGetUniformLocation(program, "ysp"), spacing);<br>
+<br>
</span>+       /* Draw shader in top half. */<br>
<span class="">+       glUniform1i(<wbr>glGetUniformLocation(program, "height"), piglit_height/2);<br>
+       piglit_draw_rect(0, piglit_height/2, piglit_width, piglit_height/2);<br>
+<br>
+       piglit_present_results();<br>
+<br>
+       pass = piglit_probe_rects_equal(0, 0, 0, piglit_height/2,<br>
</span>+               piglit_width, piglit_height/2, GL_RGB);<br>
<span class="">+<br>
+       return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
+}<br>
+<br>
+void<br>
+piglit_init(int argc, char **argv)<br>
+{<br>
</span>+       fragShader = piglit_compile_shader_text(GL_<wbr>FRAGMENT_SHADER,<br>
+                                               fragShaderText);<br>
<div class="HOEnZb"><div class="h5">+       program = piglit_link_simple_program(0, fragShader);<br>
+       glUseProgram(program);<br>
+}<br>
</div></div><span class="HOEnZb"><font color="#888888">-- <br>
2.14.3<br>
<br>
</font></span></blockquote></div><br></div>