[Piglit] [PATCH] Add test to verify interpolation at sample position
Paul Berry
stereotype441 at gmail.com
Mon Feb 3 12:25:20 PST 2014
On 9 January 2014 15:43, Anuj Phogat <anuj.phogat at gmail.com> wrote:
> +void
> +piglit_init(int argc, char**argv)
> +{
> + if (argc != 2)
> + print_usage_and_exit(argv[0]);
> +
> + /* 1st arg: num_samples */
> + char *endptr = NULL;
> + num_samples = strtol(argv[1], &endptr, 0);
> + if (endptr != argv[1] + strlen(argv[1]))
> + print_usage_and_exit(argv[0]);
> +
> + piglit_require_extension("GL_ARB_texture_multisample");
> + piglit_require_extension("GL_ARB_sample_shading");
> + piglit_require_GLSL_version(130);
> +
> + /* Skip the test if num_samples > GL_MAX_SAMPLES */
> + GLint max_samples;
> + glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
> + if (num_samples == 0 || num_samples > max_samples)
> + piglit_report_result(PIGLIT_SKIP);
> +
> + piglit_fbo_config msConfig(num_samples, piglit_width,
> piglit_height);
> + msConfig.attach_texture = true;
> + multisampled_fbo.setup(msConfig);
> +
> + /* Reduced tolerence for stricter color matching */
> + piglit_set_tolerance_for_bits(16, 16, 16, 16);
> + draw_prog_left = piglit_build_simple_program(
> + "#version 130\n"
> + "#extension GL_ARB_sample_shading: require\n"
> + "in vec4 piglit_vertex;\n"
> + "out vec2 test;\n"
> + "void main() {\n"
> + " gl_Position = piglit_vertex;\n"
> + " test = piglit_vertex.xy;\n"
> + "}\n",
> +
> + "#version 130\n"
> + "#extension GL_ARB_sample_shading: require\n"
> + "in vec2 test;\n"
> + "void main() {\n"
> + " gl_FragColor = vec4(abs(test), 0, 1);\n"
> + "}\n");
> +
> + draw_prog_right = piglit_build_simple_program(
> + "#version 130\n"
> + "uniform vec2 sample_pos;\n"
> + "in vec4 piglit_vertex;\n"
> + "out vec2 ref;\n"
> + "void main() {\n"
> + " gl_Position = piglit_vertex;\n"
> + " ref = piglit_vertex.xy;\n"
> + /* Add an offset to account for interplolation
> + * at sample position.
> + */
> + " ref += (sample_pos - 0.5) / 64;\n"
>
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).
With that fixed, and with the Fbo and FboConfig renames you mentioned in
your follow-up email, this patch is:
Reviewed-by: Paul Berry <stereotype441 at gmail.com>
Sorry for the slow review!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140203/0cb31e7b/attachment.html>
More information about the Piglit
mailing list