[Piglit] [PATCH 3/3] depthstencil-render-miplevels: Present the results in non-auto mode.
Eric Anholt
eric at anholt.net
Mon Apr 8 15:35:14 PDT 2013
Paul Berry <stereotype441 at gmail.com> writes:
> On 26 February 2013 12:39, Eric Anholt <eric at anholt.net> wrote:
>
>> I tried to make the presentation be the data that was originally
>> probed -- there's a second readpixels that's unfortunately, but we do
>> use separate textures so that any workaround relayouts of the probed
>> textures don't get tweaked in the process of displaying.
>>
>
> I'm having trouble parsing this sentence. Can you explain further?
Better?
commit a01be8e55f6d4345df45d579677d4d4bfedbebbf
Author: Eric Anholt <eric at anholt.net>
Date: Tue Feb 26 12:23:52 2013 -0800
depthstencil-render-miplevels: Present the results in non-auto mode.
I tried to make the presentation match the data that was originally
probed out of the buffer. This means not using depth texturing, since
on Intel that can trigger texture relayouts. I also left in use of
the piglit probe functions for the auto path, so there are two
separate readpixels calls on each level in the non-auto case where
presentation happens.
>> +/**
>> + * Presents the results of the rendering on the screen.
>> + */
>> +static void
>> +render_results_to_screen()
>> +{
>> + GLuint tex;
>> +
>> + printf("\n");
>> + printf("Depth is on the left, stencil is on the right.\n");
>> + printf("Colors should proceed from nearly-black to nearly-red.\n");
>> +
>> + piglit_ortho_projection(piglit_width, piglit_height, false);
>>
>
> This function draws an image whose width and height are 2*miplevel0_size.
> Since the window size is 512x512, that means that the whole image won't
> appear unless miplevel0_size is 256 or less (I believe this explains why
> Chad didn't see the image he expected when running
> "depthstencil-render-miplevels 1024 d=z24").
>
> I'd be ok with a quick and dirty fix to this--for example, if you changed
> this to do piglit_ortho_projection(2*miplevel0_size, 2*miplevel0_size,
> false) in the case where miplevel0_size > 256, then the whole image would
> appear in the window, but scaled down. It's hacky, but I think it would be
> good enough for what you're trying to achieve here.
Nice hack. I like it.
>> + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
>> + glClearColor(0.5, 0.5, 0.5, 0.0);
>> + glClear(GL_COLOR_BUFFER_BIT);
>> +
>> + glGenTextures(1, &tex);
>> + glBindTexture(GL_TEXTURE_2D, tex);
>> +
>> + if (attach_depth) {
>> + for (int level = 0; level <= max_miplevel; ++level) {
>> + int dim = miplevel0_size >> level;
>> +
>> + glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA,
>> + dim, dim,
>> + 0,
>> + GL_RED, GL_FLOAT,
>> + depth_miplevel_data[level]);
>> + if (!piglit_check_gl_error(GL_NO_ERROR))
>> + piglit_report_result(PIGLIT_FAIL);
>> + }
>> +
>> + render_tex_to_screen(tex, 0, 1);
>>
>
> Any particular reason the y coordinate is 1 rather than 0?
No particularly great reason, other than having done so for many other
tests like fbo-generatemipmap.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20130408/6bcda782/attachment.pgp>
More information about the Piglit
mailing list