<div dir="ltr">On 9 January 2014 15:43, Anuj Phogat <span dir="ltr"><<a href="mailto:anuj.phogat@gmail.com" target="_blank">anuj.phogat@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">+void<br>
+piglit_init(int argc, char**argv)<br>
+{<br>
+ if (argc != 2)<br>
+ print_usage_and_exit(argv[0]);<br>
+<br>
+ /* 1st arg: num_samples */<br>
+ char *endptr = NULL;<br>
+ num_samples = strtol(argv[1], &endptr, 0);<br>
+ if (endptr != argv[1] + strlen(argv[1]))<br>
+ print_usage_and_exit(argv[0]);<br>
+<br>
+ piglit_require_extension("GL_ARB_texture_multisample");<br>
+ piglit_require_extension("GL_ARB_sample_shading");<br>
+ piglit_require_GLSL_version(130);<br>
+<br>
+ /* Skip the test if num_samples > GL_MAX_SAMPLES */<br>
+ GLint max_samples;<br>
+ glGetIntegerv(GL_MAX_SAMPLES, &max_samples);<br>
+ if (num_samples == 0 || num_samples > max_samples)<br>
+ piglit_report_result(PIGLIT_SKIP);<br>
+<br>
+ piglit_fbo_config msConfig(num_samples, piglit_width, piglit_height);<br>
+ msConfig.attach_texture = true;<br>
+ multisampled_fbo.setup(msConfig);<br>
+<br>
+ /* Reduced tolerence for stricter color matching */<br>
+ piglit_set_tolerance_for_bits(16, 16, 16, 16);<br>
+ draw_prog_left = piglit_build_simple_program(<br>
+ "#version 130\n"<br>
+ "#extension GL_ARB_sample_shading: require\n"<br>
+ "in vec4 piglit_vertex;\n"<br>
+ "out vec2 test;\n"<br>
+ "void main() {\n"<br>
+ " gl_Position = piglit_vertex;\n"<br>
+ " test = piglit_vertex.xy;\n"<br>
+ "}\n",<br>
+<br>
+ "#version 130\n"<br>
+ "#extension GL_ARB_sample_shading: require\n"<br>
+ "in vec2 test;\n"<br>
+ "void main() {\n"<br>
+ " gl_FragColor = vec4(abs(test), 0, 1);\n"<br>
+ "}\n");<br>
+<br>
+ draw_prog_right = piglit_build_simple_program(<br>
+ "#version 130\n"<br>
+ "uniform vec2 sample_pos;\n"<br>
+ "in vec4 piglit_vertex;\n"<br>
+ "out vec2 ref;\n"<br>
+ "void main() {\n"<br>
+ " gl_Position = piglit_vertex;\n"<br>
+ " ref = piglit_vertex.xy;\n"<br>
+ /* Add an offset to account for interplolation<br>
+ * at sample position.<br>
+ */<br>
+ " ref += (sample_pos - 0.5) / 64;\n"<br></blockquote><div><br>As with the patch "Add test to verify 'centroid' qualifier is ignored in case of persample shading", it would be nice to have a comment here explaining the origin of the magic number 64 (it comes from the fact that pattern_width == pattern_height == 128, so the scaling factor between normalized device coordinates and pixels is 128/2 == 64).<br>
<br></div><div>With that fixed, and with the Fbo and FboConfig renames you mentioned in your follow-up email, this patch is:<br><br>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br>
<br>Sorry for the slow review!<br></div></div></div></div>