On 18 May 2012 16:54, Anuj Phogat <span dir="ltr">&lt;<a href="mailto:anuj.phogat@gmail.com" target="_blank">anuj.phogat@gmail.com</a>&gt;</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">

This patch adds following new classes to common.cpp file:<br>
 - Points: Draws a sequence of points with varied sizes in<br>
           color buffer.<br>
<br>
 - Spiral: Draws points with varied sizes in spiral pattern.<br>
<br>
 - StencilSpiral: Draws spiral pattern in stencil buffer.<br>
<br>
 - DepthSpiral: Draws spiral pattern in depth buffer.<br>
<br>
 - Lines: Draws a sequence of lines with varied width in<br>
          color buffer<br>
<br>
 - Star: Draws lines in a star like pattern.<br>
<br>
 - StencilStar: Draws star pattern in stencil buffer.<br>
<br>
 - DepthStar: Draws star pattern in depth buffer.<br>
<br>
All above mentioned classes are used to verify drawing multisample<br>
points and lines in color, depth and sencil buffers.<br></blockquote><div><br>Given my comments in the patches that follow, I think we only need to test lines and points with respect to the color buffer.  So if I&#39;m not mistaken, we can drop everything but Lines and Points, unless you need them for some other test you haven&#39;t sent out for review yet.<br>
 </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Signed-off-by: Anuj Phogat &lt;<a href="mailto:anuj.phogat@gmail.com" target="_blank">anuj.phogat@gmail.com</a>&gt;<br>
---<br>
 tests/spec/ext_framebuffer_multisample/common.cpp |  446 +++++++++++++++++++++<br>
 tests/spec/ext_framebuffer_multisample/common.h   |  152 +++++++<br>
 2 files changed, 598 insertions(+), 0 deletions(-)<br>
<br>
diff --git a/tests/spec/ext_framebuffer_multisample/common.cpp b/tests/spec/ext_framebuffer_multisample/common.cpp<br>
index d1e6bcd..33b2859 100644<br>
--- a/tests/spec/ext_framebuffer_multisample/common.cpp<br>
+++ b/tests/spec/ext_framebuffer_multisample/common.cpp<br>
@@ -639,6 +639,452 @@ void Triangles::draw(float (*proj)[4])<br>
        }<br>
 }<br>
<br>
+void Lines::compile()<br>
+{<br>
+       /* Line coords within (-1,-1) to (1,1) rect */<br>
+       static const float pos_line[][2] = {<br>
+               { -0.8, -0.5 },<br>
+               {  0.8, -0.5 }<br>
+       };<br>
+<br>
+       /* Number of line instances across (and down) */<br>
+       int lines_across = 4;<br>
+<br>
+       /* Total number of lines drawn */<br>
+       num_lines = lines_across * lines_across;<br>
+<br>
+       /* Amount each line should be rotated compared to prev */<br>
+       float rotation_delta = M_PI * 2.0 / num_lines;<br>
+<br>
+       /* Scaling factor uniformly applied to line coords */<br>
+       float line_scale = 0.8 / lines_across;<br>
+<br>
+       /* Final scaling factor */<br>
+       float final_scale = 0.95;<br>
+<br>
+       static const char *vert =<br>
+               &quot;#version 130\n&quot;<br>
+               &quot;in vec2 pos_line;\n&quot;<br>
+               &quot;uniform float line_scale;\n&quot;<br>
+               &quot;uniform float rotation_delta;\n&quot;<br>
+               &quot;uniform int lines_across;\n&quot;<br>
+               &quot;uniform float final_scale;\n&quot;<br>
+               &quot;uniform mat4 proj;\n&quot;<br>
+               &quot;uniform int line_num;\n&quot;<br>
+               &quot;\n&quot;<br>
+               &quot;void main()\n&quot;<br>
+               &quot;{\n&quot;<br>
+               &quot;  vec2 pos = line_scale * pos_line;\n&quot;<br>
+               &quot;  float rotation = rotation_delta * line_num;\n&quot;<br>
+               &quot;  pos = mat2(cos(rotation), sin(rotation),\n&quot;<br>
+               &quot;             -sin(rotation), cos(rotation)) * pos;\n&quot;<br>
+               &quot;  int i = line_num % lines_across;\n&quot;<br>
+               &quot;  int j = lines_across - 1 - line_num / lines_across;\n&quot;<br>
+               &quot;  pos += (vec2(i, j) * 2.0 + 1.0) / lines_across - 1.0;\n&quot;<br>
+               &quot;  pos *= final_scale;\n&quot;<br>
+               &quot;  gl_Position = proj * vec4(pos, 0.0, 1.0);\n&quot;<br>
+               &quot;}\n&quot;;<br>
+<br>
+       static const char *frag =<br>
+               &quot;#version 130\n&quot;<br>
+               &quot;void main()\n&quot;<br>
+               &quot;{\n&quot;<br>
+               &quot;  gl_FragColor = vec4(1.0);\n&quot;<br>
+               &quot;}\n&quot;;<br>
+<br>
+       /* Compile program */<br>
+       prog = glCreateProgram();<br>
+       GLint vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vert);<br>
+       glAttachShader(prog, vs);<br>
+       GLint fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, frag);<br>
+       glAttachShader(prog, fs);<br>
+       glBindAttribLocation(prog, 0, &quot;pos_line&quot;);<br>
+       glLinkProgram(prog);<br>
+       if (!piglit_link_check_status(prog)) {<br>
+               piglit_report_result(PIGLIT_FAIL);<br>
+       }<br>
+<br>
+       /* Set up uniforms */<br>
+       glUseProgram(prog);<br>
+       glUniform1f(glGetUniformLocation(prog, &quot;line_scale&quot;), line_scale);<br>
+       glUniform1f(glGetUniformLocation(prog, &quot;rotation_delta&quot;),<br>
+                   rotation_delta);<br>
+       glUniform1i(glGetUniformLocation(prog, &quot;lines_across&quot;), lines_across);<br>
+       glUniform1f(glGetUniformLocation(prog, &quot;final_scale&quot;), final_scale);<br>
+       proj_loc = glGetUniformLocation(prog, &quot;proj&quot;);<br>
+       line_num_loc = glGetUniformLocation(prog, &quot;line_num&quot;);<br>
+<br>
+       /* Set up vertex array object */<br>
+       glGenVertexArrays(1, &amp;vao);<br>
+       glBindVertexArray(vao);<br>
+<br>
+       /* Set up vertex input buffer */<br>
+       glGenBuffers(1, &amp;vertex_buf);<br>
+       glBindBuffer(GL_ARRAY_BUFFER, vertex_buf);<br>
+       glBufferData(GL_ARRAY_BUFFER, sizeof(pos_line), pos_line,<br>
+                    GL_STATIC_DRAW);<br>
+       glEnableVertexAttribArray(0);<br>
+       glVertexAttribPointer(0, ARRAY_SIZE(pos_line[0]), GL_FLOAT,<br>
+                             GL_FALSE, sizeof(pos_line[0]), (void *) 0);<br>
+}<br>
+<br>
+void Lines::draw(float (*proj)[4])<br>
+{<br>
+       glClear(GL_COLOR_BUFFER_BIT);<br>
+       glUseProgram(prog);<br>
+       glUniformMatrix4fv(proj_loc, 1, GL_TRUE, &amp;proj[0][0]);<br>
+       glBindVertexArray(vao);<br>
+       for (int line_num = 0; line_num &lt; num_lines; ++line_num) {<br>
+               glLineWidth(1 + line_num / 4);<br></blockquote><div><br>It looks like you&#39;re trying to set the line width to values 1.0, 1.25, 1.5, 1.75, 2.0, and so on.  But because line_num is an integer, what&#39;s actually happening is that the line width is being set to 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, etc.<br>

<br>Did you perhaps mean to do this instead?<br><br>glLineWidth(1 + float(line_num) / 4);<br><br>It might also be worth testing line widths less than 1.0, e.g.<br><br>glLineWidth(float(1 + line_num) / 4);<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">


+               glUniform1i(line_num_loc, line_num);<br>
+               glDrawArrays(GL_LINES, 0, 2);<br>
+       }<br>
+}<br>
+<br>
+void Points::compile()<br>
+{<br>
+       /* Point coords within (-1,-1) to (1,1) rect */<br>
+       static const float pos_point[2] = { -0.5, -0.5 };<br>
+<br>
+       /* Number of point instances across (and down) */<br>
+       int points_across = 4;<br>
+<br>
+       /* Total number of points drawn */<br>
+       num_points = points_across * points_across;<br>
+<br>
+       /* Scaling factor uniformly applied to point coords */<br>
+       float point_scale = 0.8 / points_across;<br>
+<br>
+       /* Final scaling factor */<br>
+       float final_scale = 0.95;<br>
+<br>
+       static const char *vert =<br>
+               &quot;#version 130\n&quot;<br>
+               &quot;in vec2 pos_point;\n&quot;<br>
+               &quot;uniform float point_scale;\n&quot;<br>
+               &quot;uniform int points_across;\n&quot;<br>
+               &quot;uniform float final_scale;\n&quot;<br>
+               &quot;uniform mat4 proj;\n&quot;<br>
+               &quot;uniform int point_num;\n&quot;<br>
+               &quot;uniform float depth;\n&quot;<br>
+               &quot;\n&quot;<br>
+               &quot;void main()\n&quot;<br>
+               &quot;{\n&quot;<br>
+               &quot;  vec2 pos = point_scale * pos_point;\n&quot;<br>
+               &quot;  int i = point_num % points_across;\n&quot;<br>
+               &quot;  int j = points_across - 1 - point_num / points_across;\n&quot;<br>
+               &quot;  pos += (vec2(i, j) * 2.0 + 1.0) / points_across - 1.0;\n&quot;<br>
+               &quot;  pos *= final_scale;\n&quot;<br>
+               &quot;  gl_Position = proj * vec4(pos, depth, 1.0);\n&quot;<br>
+               &quot;}\n&quot;;<br>
+<br>
+       static const char *frag =<br>
+               &quot;#version 130\n&quot;<br>
+               &quot;void main()\n&quot;<br>
+               &quot;{\n&quot;<br>
+               &quot;  gl_FragColor = vec4(1.0);\n&quot;<br>
+               &quot;}\n&quot;;<br>
+<br>
+       /* Compile program */<br>
+       prog = glCreateProgram();<br>
+       GLint vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vert);<br>
+       glAttachShader(prog, vs);<br>
+       GLint fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, frag);<br>
+       glAttachShader(prog, fs);<br>
+       glBindAttribLocation(prog, 0, &quot;pos_point&quot;);<br>
+       glLinkProgram(prog);<br>
+       if (!piglit_link_check_status(prog)) {<br>
+               piglit_report_result(PIGLIT_FAIL);<br>
+       }<br>
+<br>
+       /* Set up uniforms */<br>
+       glUseProgram(prog);<br>
+       glUniform1f(glGetUniformLocation(prog, &quot;point_scale&quot;), point_scale);<br>
+       glUniform1i(glGetUniformLocation(prog, &quot;points_across&quot;), points_across);<br>
+       glUniform1f(glGetUniformLocation(prog, &quot;final_scale&quot;), final_scale);<br>
+       proj_loc = glGetUniformLocation(prog, &quot;proj&quot;);<br>
+       point_num_loc = glGetUniformLocation(prog, &quot;point_num&quot;);<br>
+       depth_loc = glGetUniformLocation(prog, &quot;depth&quot;);<br>
+<br>
+       /* Set up vertex array object */<br>
+       glGenVertexArrays(1, &amp;vao);<br>
+       glBindVertexArray(vao);<br>
+<br>
+       /* Set up vertex input buffer */<br>
+       glGenBuffers(1, &amp;vertex_buf);<br>
+       glBindBuffer(GL_ARRAY_BUFFER, vertex_buf);<br>
+       glBufferData(GL_ARRAY_BUFFER, sizeof(pos_point), pos_point,<br>
+                    GL_STATIC_DRAW);<br>
+       glEnableVertexAttribArray(0);<br>
+       glVertexAttribPointer(0, ARRAY_SIZE(pos_point), GL_FLOAT,<br>
+                             GL_FALSE, 0, (void *) 0);<br>
+}<br>
+<br>
+void Points::draw(float (*proj)[4])<br>
+{<br>
+       glClear(GL_COLOR_BUFFER_BIT);<br>
+       glUseProgram(prog);<br>
+       glUniformMatrix4fv(proj_loc, 1, GL_TRUE, &amp;proj[0][0]);<br>
+       glBindVertexArray(vao);<br>
+       glUniform1f(depth_loc, 0.0);<br>
+       for (int point_num = 0; point_num &lt; num_points; ++point_num) {<br>
+               glPointSize(2 + point_num);<br></blockquote><div><br>Any particular reason why we&#39;re only testing integer point sizes &gt;= 2?<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

+               glUniform1i(point_num_loc, point_num);<br>
+               glDrawArrays(GL_POINTS, 0, 1);<br>
+       }<br>
+}<br>
+<br>
+void Spiral::compile()<br>
+{<br>
+       /* Point coords within (-1,-1) to (1,1) rect */<br>
+       static const float pos_point[2] = { 0.7, 0.7 };<br>
+<br>
+       num_points = 15;<br>
+       num_circles = 3;<br>
+<br>
+       static const char *vert =<br>
+               &quot;#version 130\n&quot;<br>
+               &quot;in vec2 pos_point;\n&quot;<br>
+               &quot;uniform float rotation;\n&quot;<br>
+               &quot;uniform float length;\n&quot;<br>
+               &quot;uniform float depth;\n&quot;<br>
+               &quot;uniform mat4 proj;\n&quot;<br>
+               &quot;\n&quot;<br>
+               &quot;void main()\n&quot;<br>
+               &quot;{\n&quot;<br>
+               &quot;  vec2 pos = pos_point * length;\n&quot;<br>
+               &quot;  pos = mat2(cos(rotation), sin(rotation),\n&quot;<br>
+               &quot;             -sin(rotation), cos(rotation)) * pos;\n&quot;<br>
+               &quot;  gl_Position = proj * vec4(pos, depth, 1.0);\n&quot;<br>
+               &quot;}\n&quot;;<br>
+<br>
+       static const char *frag =<br>
+               &quot;#version 130\n&quot;<br>
+               &quot;void main()\n&quot;<br>
+               &quot;{\n&quot;<br>
+               &quot;  gl_FragColor = vec4(0.0);\n&quot;<br>
+               &quot;}\n&quot;;<br>
+<br>
+       /* Compile program */<br>
+       prog = glCreateProgram();<br>
+       GLint vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vert);<br>
+       glAttachShader(prog, vs);<br>
+       GLint fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, frag);<br>
+       glAttachShader(prog, fs);<br>
+       glBindAttribLocation(prog, 0, &quot;pos_point&quot;);<br>
+       glLinkProgram(prog);<br>
+       if (!piglit_link_check_status(prog)) {<br>
+               piglit_report_result(PIGLIT_FAIL);<br>
+       }<br>
+<br>
+       /* Set up uniforms */<br>
+       glUseProgram(prog);<br>
+       rotation_loc = glGetUniformLocation(prog, &quot;rotation&quot;);<br>
+       length_loc = glGetUniformLocation(prog, &quot;length&quot;);<br>
+       depth_loc = glGetUniformLocation(prog, &quot;depth&quot;);<br>
+       glUniform1f(depth_loc, 0.0);<br>
+       proj_loc = glGetUniformLocation(prog, &quot;proj&quot;);<br>
+<br>
+       /* Set up vertex array object */<br>
+       glGenVertexArrays(1, &amp;vao);<br>
+       glBindVertexArray(vao);<br>
+<br>
+       /* Set up vertex input buffer */<br>
+       glGenBuffers(1, &amp;vertex_buf);<br>
+       glBindBuffer(GL_ARRAY_BUFFER, vertex_buf);<br>
+       glBufferData(GL_ARRAY_BUFFER, sizeof(pos_point), pos_point,<br>
+                    GL_STATIC_DRAW);<br>
+       glEnableVertexAttribArray(0);<br>
+       glVertexAttribPointer(0, ARRAY_SIZE(pos_point), GL_FLOAT,<br>
+                             GL_FALSE, 0, (void *) 0);<br>
+}<br>
+<br>
+void<br>
+StencilSpiral::draw(float (*proj)[4])<br>
+{<br>
+       glEnable(GL_STENCIL_TEST);<br>
+       glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);<br>
+<br>
+       glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);<br>
+<br>
+       glUseProgram(prog);<br>
+       glUniformMatrix4fv(proj_loc, 1, GL_TRUE, &amp;proj[0][0]);<br>
+       glUniform1f(depth_loc, 0.0);<br>
+       glBindVertexArray(vao);<br>
+<br>
+       /* Total number of points drawn */<br>
+       int total_points = num_circles * num_points;<br>
+<br>
+       for (int i = 0; i &lt; total_points; ++i) {<br>
+               /* Set the stencil value of point between 0 - 7 */<br>
+               glStencilFunc(GL_ALWAYS, i % 8, 0xff);<br>
+               glPointSize(1 + 2 * ((total_points - i) / num_circles ));<br>
+<br>
+               glUniform1f(length_loc, (1.0 - i * 1.0 / total_points));<br>
+               glUniform1f(rotation_loc, M_PI * 2.0 * i / (num_points));<br>
+<br>
+               glDrawArrays(GL_POINTS, 0, 1);<br>
+       }<br>
+<br>
+       glDisable(GL_STENCIL_TEST);<br>
+}<br>
+<br>
+void<br>
+DepthSpiral::draw(float (*proj)[4])<br>
+{<br>
+       glEnable(GL_DEPTH_TEST);<br>
+       glDepthFunc(GL_LESS);<br>
+<br>
+       glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);<br>
+<br>
+       glUseProgram(prog);<br>
+       glUniformMatrix4fv(proj_loc, 1, GL_TRUE, &amp;proj[0][0]);<br>
+       glBindVertexArray(vao);<br>
+<br>
+       /* Total number of points drawn */<br>
+       int total_points = num_circles * num_points;<br>
+<br>
+       for (int i = 0; i &lt; total_points; ++i) {<br>
+               glPointSize(1 + 2 * ((total_points - i) / num_circles ));<br>
+<br>
+               /* Draw points in a haphazard order so we can verify that<br>
+                * depth comparisons sort them out properly.<br>
+                */<br>
+               int point_to_draw = (i * 10) % total_points;<br>
+<br>
+               glUniform1f(length_loc, (1.0 - i * 1.0 / total_points));<br>
+<br>
+               /* Draw points in a depth range of -1 to +1 */<br>
+               float depth = float(total_points - point_to_draw * 2 - 1)<br>
+                             / (total_points + 1);<br>
+               glUniform1f(depth_loc, depth);<br>
+               glUniform1f(rotation_loc, M_PI * 2.0 * i / num_points);<br>
+<br>
+               glDrawArrays(GL_POINTS, 0, 1);<br>
+       }<br>
+<br>
+       glDisable(GL_DEPTH_TEST);<br>
+}<br>
+<br>
+void Star::compile()<br>
+{<br>
+       /* Triangle coords within (-1,-1) to (1,1) rect */<br>
+       static const float pos_line[][2] = {<br>
+               { -0.3, -0.8 },<br>
+               {  0.3,  0.8 }<br>
+       };<br>
+<br>
+       /* Total number of lines drawn */<br>
+       num_lines = 7;<br>
+<br>
+       static const char *vert =<br>
+               &quot;#version 130\n&quot;<br>
+               &quot;in vec2 pos_line;\n&quot;<br>
+               &quot;uniform float rotation;\n&quot;<br>
+               &quot;uniform float depth;\n&quot;<br>
+               &quot;uniform mat4 proj;\n&quot;<br>
+               &quot;\n&quot;<br>
+               &quot;void main()\n&quot;<br>
+               &quot;{\n&quot;<br>
+               &quot;  vec2 pos = pos_line;\n&quot;<br>
+               &quot;  pos = mat2(cos(rotation), sin(rotation),\n&quot;<br>
+               &quot;             -sin(rotation), cos(rotation)) * pos;\n&quot;<br>
+               &quot;  gl_Position = proj * vec4(pos, depth, 1.0);\n&quot;<br>
+               &quot;}\n&quot;;<br>
+<br>
+       static const char *frag =<br>
+               &quot;#version 130\n&quot;<br>
+               &quot;void main()\n&quot;<br>
+               &quot;{\n&quot;<br>
+               &quot;  gl_FragColor = vec4(0.0);\n&quot;<br>
+               &quot;}\n&quot;;<br>
+<br>
+       /* Compile program */<br>
+       prog = glCreateProgram();<br>
+       GLint vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vert);<br>
+       glAttachShader(prog, vs);<br>
+       GLint fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, frag);<br>
+       glAttachShader(prog, fs);<br>
+       glBindAttribLocation(prog, 0, &quot;pos_line&quot;);<br>
+       glLinkProgram(prog);<br>
+       if (!piglit_link_check_status(prog)) {<br>
+               piglit_report_result(PIGLIT_FAIL);<br>
+       }<br>
+<br>
+       /* Set up uniforms */<br>
+       glUseProgram(prog);<br>
+       rotation_loc = glGetUniformLocation(prog, &quot;rotation&quot;);<br>
+       depth_loc = glGetUniformLocation(prog, &quot;depth&quot;);<br>
+       glUniform1f(depth_loc, 0.0);<br>
+       proj_loc = glGetUniformLocation(prog, &quot;proj&quot;);<br>
+<br>
+       /* Set up vertex array object */<br>
+       glGenVertexArrays(1, &amp;vao);<br>
+       glBindVertexArray(vao);<br>
+<br>
+       /* Set up vertex input buffer */<br>
+       glGenBuffers(1, &amp;vertex_buf);<br>
+       glBindBuffer(GL_ARRAY_BUFFER, vertex_buf);<br>
+       glBufferData(GL_ARRAY_BUFFER, sizeof(pos_line), pos_line,<br>
+                    GL_STATIC_DRAW);<br>
+       glEnableVertexAttribArray(0);<br>
+       glVertexAttribPointer(0, ARRAY_SIZE(pos_line[0]), GL_FLOAT,<br>
+                             GL_FALSE, sizeof(pos_line[0]), (void *) 0);<br>
+}<br>
+<br>
+void<br>
+StencilStar::draw(float (*proj)[4])<br>
+{<br>
+       glEnable(GL_STENCIL_TEST);<br>
+       glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);<br>
+<br>
+       glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);<br>
+<br>
+       glUseProgram(prog);<br>
+       glUniformMatrix4fv(proj_loc, 1, GL_TRUE, &amp;proj[0][0]);<br>
+       glBindVertexArray(vao);<br>
+       for (int i = 0; i &lt; num_lines; ++i) {<br>
+               glStencilFunc(GL_ALWAYS, i+1, 0xff);<br>
+               glUniform1f(rotation_loc, M_PI * 2.0 * i / num_lines);<br>
+               glDrawArrays(GL_LINES, 0, 2);<br>
+       }<br>
+<br>
+       glDisable(GL_STENCIL_TEST);<br>
+}<br>
+<br>
+void<br>
+DepthStar::draw(float (*proj)[4])<br>
+{<br>
+       glEnable(GL_DEPTH_TEST);<br>
+       glDepthFunc(GL_LESS);<br>
+<br>
+       glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);<br>
+<br>
+       glUseProgram(prog);<br>
+       glUniformMatrix4fv(proj_loc, 1, GL_TRUE, &amp;proj[0][0]);<br>
+       glBindVertexArray(vao);<br>
+       for (int i = 0; i &lt; num_lines; ++i) {<br>
+               /* Draw lines in a haphazard order so we can verify<br>
+                * that depth comparisons sort them out properly.<br>
+                */<br>
+               int line_to_draw = (i * 3) % num_lines;<br>
+<br>
+               /* Note: with num_lines == 7, this causes us to draw<br>
+                * lines at depths of 3/4, 1/2, -1/4, 0, 1/4, 1/2,<br>
+                * and 3/4.<br>
+                */<br>
+               glUniform1f(depth_loc,<br>
+                           float(num_lines - line_to_draw * 2 - 1)<br>
+                           / (num_lines + 1));<br>
+<br>
+               glUniform1f(rotation_loc,<br>
+                           M_PI * 2.0 * line_to_draw / num_lines);<br>
+               glDrawArrays(GL_LINES, 0, 2);<br>
+       }<br>
+<br>
+       glDisable(GL_DEPTH_TEST);<br>
+}<br>
+<br>
 void Sunburst::compile()<br>
 {<br>
        /* Triangle coords within (-1,-1) to (1,1) rect */<br>
diff --git a/tests/spec/ext_framebuffer_multisample/common.h b/tests/spec/ext_framebuffer_multisample/common.h<br>
index d86cb95..1bb39b4 100644<br>
--- a/tests/spec/ext_framebuffer_multisample/common.h<br>
+++ b/tests/spec/ext_framebuffer_multisample/common.h<br>
@@ -115,6 +115,7 @@ public:<br>
<br>
 private:<br>
        GLint prog;<br>
+       GLint count;<br>
        GLint color_loc;<br>
        GLuint vertex_buf;<br>
        GLuint vao;<br>
@@ -187,6 +188,157 @@ private:<br>
 };<br>
<br>
 /**<br>
+ * Program we use to draw a test pattern into the color buffer.<br>
+ *<br>
+ * This program draws a sequence of points with varied sizes. This ensures<br>
+ * antialiasing works well with all point sizes.<br>
+ */<br>
+class Points : public TestPattern<br>
+{<br>
+public:<br>
+       virtual void compile();<br>
+       virtual void draw(float (*proj)[4]);<br>
+<br>
+private:<br>
+       GLint prog;<br>
+       GLuint vao;<br>
+       GLint proj_loc;<br>
+       GLint depth_loc;<br>
+       GLint point_num_loc;<br>
+       GLuint vertex_buf;<br>
+       int num_points;<br>
+};<br>
+<br>
+/**<br>
+ * Program we use to draw a test pattern into the depth and stencil<br>
+ * buffers.<br>
+ *<br>
+ * This program draws a &quot;spiral&quot; pattern consisting of 45 points,<br>
+ * each with a different size.<br>
+ * This program is further specialized into depth and stencil variants.<br>
+ */<br>
+class Spiral : public TestPattern<br>
+{<br>
+public:<br>
+       virtual void compile();<br>
+<br>
+protected:<br>
+       GLint prog;<br>
+       GLint rotation_loc;<br>
+       GLint depth_loc;<br>
+       GLint length_loc;<br>
+       GLint proj_loc;<br>
+       GLuint vao;<br>
+       int num_points;<br>
+       int num_circles;<br>
+<br>
+private:<br>
+       GLuint vertex_buf;<br>
+};<br>
+<br>
+/**<br>
+ * Program we use to draw a test pattern into the stencil buffer.<br>
+ *<br>
+ * The points in this spiral are drawn back-to-front, using no<br>
+ * depth testing.  Each point is drawn using a stencil<br>
+ * value between 0 to 7.<br>
+ */<br>
+class StencilSpiral : public Spiral<br>
+{<br>
+public:<br>
+       virtual void draw(float (*proj)[4]);<br>
+};<br>
+<br>
+/**<br>
+ * Program we use to draw a test pattern into the depth buffer.<br>
+ *<br>
+ * The points in this spiral are drawn at a series of different<br>
+ * depth values, with depth testing enabled.  They are drawn in an<br>
+ * arbitrary non-consecutive order, to verify that depth testing<br>
+ * properly sorts the surfaces into front-to-back order.<br>
+ */<br>
+class DepthSpiral : public Spiral<br>
+{<br>
+public:<br>
+       virtual void draw(float (*proj)[4]);<br>
+};<br>
+<br>
+/**<br>
+ * Program we use to draw a test pattern into the color buffer.<br>
+ *<br>
+ * This program draws a sequence of lines with varied width. This ensures<br>
+ * antialiasing works well with all line widths.<br>
+ */<br>
+class Lines : public TestPattern<br>
+{<br>
+public:<br>
+       virtual void compile();<br>
+       virtual void draw(float (*proj)[4]);<br>
+<br>
+private:<br>
+       GLint prog;<br>
+       GLuint vao;<br>
+       GLint proj_loc;<br>
+       GLint line_num_loc;<br>
+       GLuint vertex_buf;<br>
+       int num_lines;<br>
+};<br>
+<br>
+/**<br>
+ * Program we use to draw a test pattern into the depth and stencil<br>
+ * buffers.<br>
+ *<br>
+ * This program draws a &quot;star&quot; pattern consisting of 7 overlapping<br>
+ * lines, each at a different angle.  This ensures that we&#39;ll thoroughly<br>
+ * exercise antialiasing.<br>
+ *<br>
+ * This program is further specialized into depth and stencil variants.<br>
+ */<br>
+class Star : public TestPattern<br>
+{<br>
+public:<br>
+       virtual void compile();<br>
+<br>
+protected:<br>
+       GLint prog;<br>
+       GLint rotation_loc;<br>
+       GLint depth_loc;<br>
+       GLint proj_loc;<br>
+       GLuint vao;<br>
+       int num_lines;<br>
+<br>
+private:<br>
+       GLuint vertex_buf;<br>
+};<br>
+<br>
+/**<br>
+ * Program we use to draw a test pattern into the stencil buffer.<br>
+ *<br>
+ * The lines in this star are drawn back-to-front, using no<br>
+ * depth testing.  Each line is drawn using a different stencil<br>
+ * value.<br>
+ */<br>
+class StencilStar : public Star<br>
+{<br>
+public:<br>
+       virtual void draw(float (*proj)[4]);<br>
+};<br>
+<br>
+/**<br>
+ * Program we use to draw a test pattern into the depth buffer.<br>
+ *<br>
+ * The lines in this star are drawn at a series of different<br>
+ * depth values, with depth testing enabled.  They are drawn in an<br>
+ * arbitrary non-consecutive order, to verify that depth testing<br>
+ * properly sorts the lines into front-to-back order.<br>
+ */<br>
+class DepthStar : public Star<br>
+{<br>
+public:<br>
+       virtual void draw(float (*proj)[4]);<br>
+};<br>
+<br>
+/**<br>
  * Program we use to draw a test pattern into the depth and stencil<br>
  * buffers.<br>
  *<br>
<span><font color="#888888">--<br>
1.7.7.6<br>
<br>
_______________________________________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org" target="_blank">Piglit@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/piglit" target="_blank">http://lists.freedesktop.org/mailman/listinfo/piglit</a><br>
</font></span></blockquote></div><br>