[Piglit] [PATCH 03/15] arb_direct_state_access: Testing NamedFramebufferRenderbuffer.
Dylan Baker
baker.dylan.c at gmail.com
Mon Mar 9 17:31:16 PDT 2015
I didn't read them all, but the ones I scanned through looked correct.
On Mon, Mar 09, 2015 at 04:34:54PM -0700, Laura Ekstrand wrote:
> Okay, it's rebased on master:
> http://cgit.freedesktop.org/~ldeks/piglit/log/tests?h=adsa-framebuffers
>
> On Fri, Mar 6, 2015 at 10:48 AM, Dylan Baker <baker.dylan.c at gmail.com>
> wrote:
>
> > You're gonna have to rebase this series on master, the all.py format
> > has changed. If you want help with that let me know.
> >
> > On Thu, Mar 05, 2015 at 06:01:13PM -0800, Laura Ekstrand wrote:
> > > ---
> > > tests/all.py | 1 +
> > > .../spec/arb_direct_state_access/CMakeLists.gl.txt | 1 +
> > > .../namedframebufferrenderbuffer.c | 159
> > +++++++++++++++++++++
> > > 3 files changed, 161 insertions(+)
> > > create mode 100644
> > tests/spec/arb_direct_state_access/namedframebufferrenderbuffer.c
> > >
> > > diff --git a/tests/all.py b/tests/all.py
> > > index cd85fc5..8e45442 100644
> > > --- a/tests/all.py
> > > +++ b/tests/all.py
> > > @@ -4028,6 +4028,7 @@
> > spec['ARB_direct_state_access']['unmapnamedbuffer-vbo'] =
> > PiglitGLTest(['arb_dir
> > > spec['ARB_direct_state_access']['flushmappednamedbufferrange'] =
> > PiglitGLTest(['arb_direct_state_access-flushmappednamedbufferrange'],
> > run_concurrent=True)
> > > spec['ARB_direct_state_access']['getnamedbufferparameter'] =
> > PiglitGLTest(['arb_direct_state_access-getnamedbufferparameter'],
> > run_concurrent=True)
> > > spec['ARB_direct_state_access']['getnamedbuffersubdata'] =
> > PiglitGLTest(['arb_direct_state_access-getnamedbuffersubdata'],
> > run_concurrent=True)
> > > +spec['ARB_direct_state_access']['namedframebufferrenderbuffer'] =
> > PiglitGLTest(['arb_direct_state_access-namedframebufferrenderbuffer'],
> > run_concurrent=True)
> > >
> > > arb_shader_image_load_store = spec['ARB_shader_image_load_store']
> > > arb_shader_image_load_store['atomicity'] =
> > PiglitGLTest(['arb_shader_image_load_store-atomicity'], run_concurrent=True)
> > > diff --git a/tests/spec/arb_direct_state_access/CMakeLists.gl.txt
> > b/tests/spec/arb_direct_state_access/CMakeLists.gl.txt
> > > index a9b82eb..488ca18 100644
> > > --- a/tests/spec/arb_direct_state_access/CMakeLists.gl.txt
> > > +++ b/tests/spec/arb_direct_state_access/CMakeLists.gl.txt
> > > @@ -25,6 +25,7 @@ piglit_add_executable
> > (arb_direct_state_access-unmapnamedbuffer-vbo unmapnamedbu
> > > piglit_add_executable
> > (arb_direct_state_access-flushmappednamedbufferrange
> > flushmappednamedbufferrange.c)
> > > piglit_add_executable (arb_direct_state_access-getnamedbufferparameter
> > getnamedbufferparameter.c)
> > > piglit_add_executable (arb_direct_state_access-getnamedbuffersubdata
> > getnamedbuffersubdata.c)
> > > +piglit_add_executable
> > (arb_direct_state_access-namedframebufferrenderbuffer
> > namedframebufferrenderbuffer.c)
> > > piglit_add_executable (arb_direct_state_access-dsa-textures
> > dsa-textures.c dsa-utils.c)
> > > piglit_add_executable (arb_direct_state_access-texturesubimage
> > texturesubimage.c)
> > > piglit_add_executable (arb_direct_state_access-bind-texture-unit
> > bind-texture-unit.c)
> > > diff --git
> > a/tests/spec/arb_direct_state_access/namedframebufferrenderbuffer.c
> > b/tests/spec/arb_direct_state_access/namedframebufferrenderbuffer.c
> > > new file mode 100644
> > > index 0000000..df82400
> > > --- /dev/null
> > > +++ b/tests/spec/arb_direct_state_access/namedframebufferrenderbuffer.c
> > > @@ -0,0 +1,159 @@
> > > +/*
> > > + * Copyright (c) 2012 VMware, Inc.
> > > + * Copyright 2015 Intel Corporation
> > > + *
> > > + * Permission is hereby granted, free of charge, to any person
> > obtaining a
> > > + * copy of this software and associated documentation files (the
> > "Software"),
> > > + * to deal in the Software without restriction, including without
> > limitation
> > > + * the rights to use, copy, modify, merge, publish, distribute,
> > sublicense,
> > > + * and/or sell copies of the Software, and to permit persons to whom the
> > > + * Software is furnished to do so, subject to the following conditions:
> > > + *
> > > + * The above copyright notice and this permission notice (including the
> > next
> > > + * paragraph) shall be included in all copies or substantial portions
> > of the
> > > + * Software.
> > > + *
> > > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> > EXPRESS OR
> > > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> > MERCHANTABILITY,
> > > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
> > SHALL
> > > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> > OTHER
> > > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> > ARISING
> > > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> > DEALINGS
> > > + * IN THE SOFTWARE.
> > > + */
> > > +
> > > +/**
> > > + * Test glViewport w/ FBOs.
> > > + * In Mesa, on-screen windows and user-created FBOs are stored
> > differently
> > > + * (inverted). Make sure viewports are handled properly.
> > > + * Draw a test pattern (with many viewports) into the window, then draw
> > the
> > > + * same thing into an FBO. Compare the images. They should be the
> > same.
> > > + */
> > > +
> > > +#include "piglit-util-gl.h"
> > > +
> > > +PIGLIT_GL_TEST_CONFIG_BEGIN
> > > +
> > > + config.supports_gl_compat_version = 10;
> > > +
> > > + config.window_width = 500;
> > > + config.window_height = 500;
> > > + config.window_visual = PIGLIT_GL_VISUAL_RGB |
> > PIGLIT_GL_VISUAL_DOUBLE;
> > > +
> > > +PIGLIT_GL_TEST_CONFIG_END
> > > +
> > > +/**
> > > + * Draw an rgbw texture in a bunch of viewports which tile the window.
> > > + * Note that viewports extend beyond the edges of the window too.
> > > + */
> > > +static void
> > > +draw_test_image(void)
> > > +{
> > > + int vx, vy, vw = 200, vh = 200;
> > > + GLuint texture;
> > > +
> > > + texture = piglit_rgbw_texture(GL_RGBA8, 32, 32, GL_FALSE, GL_FALSE,
> > > + GL_UNSIGNED_BYTE);
> > > + glBindTextureUnit(0, texture);
> > > +
> > > + glClear(GL_COLOR_BUFFER_BIT);
> > > +
> > > + glMatrixMode(GL_PROJECTION);
> > > + glLoadIdentity();
> > > + glFrustum(-1, 1, -1, 1, 3, 9.5);
> > > +
> > > + /* Draw some quads at an odd rotation.
> > > + * Note that we want near/far frustum clipping.
> > > + */
> > > + glMatrixMode(GL_MODELVIEW);
> > > + glPushMatrix();
> > > + glTranslatef(0, 1, -6.20);
> > > + glRotatef(-60, 1, 0, 0);
> > > + glRotatef(30, 0, 0, 1);
> > > + glScalef(3.5, 3.5, 3.5);
> > > +
> > > + /* loop over viewports */
> > > + for (vy = -50; vy < piglit_height; vy += vh+10) {
> > > + for (vx = -30; vx < piglit_width; vx += vw+10) {
> > > + glViewport(vx, vy, vw, vh);
> > > + piglit_draw_rect_tex(-1, -1, 1, 1, 0, 0, 1, 1);
> > > + }
> > > + }
> > > +
> > > + glPopMatrix();
> > > +
> > > + glDeleteTextures(1, &texture);
> > > +}
> > > +
> > > +
> > > +enum piglit_result
> > > +piglit_display(void)
> > > +{
> > > + GLubyte *win_image, *fbo_image;
> > > + GLuint fbo, rb;
> > > + bool pass = true;
> > > +
> > > + win_image = (GLubyte *) malloc(piglit_width * piglit_height * 3);
> > > + fbo_image = (GLubyte *) malloc(piglit_width * piglit_height * 3);
> > > +
> > > + glPixelStorei(GL_PACK_ALIGNMENT, 1);
> > > + glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
> > > +
> > > + glCreateFramebuffers(1, &fbo);
> > > + glGenRenderbuffers(1, &rb);
> > > + glBindRenderbuffer(GL_RENDERBUFFER, rb);
> > > + glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA,
> > > + piglit_width, piglit_height);
> > > + glNamedFramebufferRenderbuffer(fbo, GL_COLOR_ATTACHMENT0,
> > > + GL_RENDERBUFFER, rb);
> > > +
> > > + if (!piglit_check_gl_error(GL_NO_ERROR))
> > > + piglit_report_result(PIGLIT_FAIL);
> > > +
> > > + glBindFramebuffer(GL_FRAMEBUFFER, fbo);
> > > + assert(glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) ==
> > > + GL_FRAMEBUFFER_COMPLETE_EXT);
> > > +
> > > + /* draw reference image in the window */
> > > + glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
> > > + draw_test_image();
> > > + glReadPixels(0, 0, piglit_width, piglit_height,
> > > + GL_RGB, GL_UNSIGNED_BYTE, win_image);
> > > +
> > > + /* draw test image in fbo */
> > > + glBindFramebuffer(GL_FRAMEBUFFER, fbo);
> > > + glReadBuffer(GL_COLOR_ATTACHMENT0);
> > > + draw_test_image();
> > > + glReadPixels(0, 0, piglit_width, piglit_height,
> > > + GL_RGB, GL_UNSIGNED_BYTE, fbo_image);
> > > +
> > > + /* compare images */
> > > + if (memcmp(win_image, fbo_image, piglit_width * piglit_height *
> > 3)) {
> > > + printf("Image comparison failed!\n");
> > > + pass = false;
> > > + }
> > > + else if (!piglit_automatic) {
> > > + printf("Image comparison passed.\n");
> > > + }
> > > +
> > > + glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
> > > +
> > > + piglit_present_results();
> > > +
> > > + glDeleteRenderbuffers(1, &rb);
> > > + glDeleteFramebuffers(1, &fbo);
> > > + free(win_image);
> > > + free(fbo_image);
> > > +
> > > + return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> > > +}
> > > +
> > > +
> > > +void
> > > +piglit_init(int argc, char **argv)
> > > +{
> > > + piglit_require_extension("GL_ARB_direct_state_access");
> > > + piglit_require_extension("GL_ARB_framebuffer_object");
> > > + glClearColor(0.2, 0.2, 0.2, 0.0);
> > > + glEnable(GL_TEXTURE_2D);
> > > +}
> > > --
> > > 2.1.0
> > >
> > > _______________________________________________
> > > Piglit mailing list
> > > Piglit at lists.freedesktop.org
> > > http://lists.freedesktop.org/mailman/listinfo/piglit
> >
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20150309/4e12ffec/attachment-0001.sig>
More information about the Piglit
mailing list