From 635ea8737488cc2fdcf0fcacb4ca39c8bc3b028a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 10 Oct 2009 11:52:38 -0600 Subject: progs/tests: added test for GL_EXT_texture_compression_s3tc support --- progs/tests/mipmap_comp.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/progs/tests/mipmap_comp.c b/progs/tests/mipmap_comp.c index 5842e2b880..dd2232113b 100644 --- a/progs/tests/mipmap_comp.c +++ b/progs/tests/mipmap_comp.c @@ -285,6 +285,12 @@ main(int argc, char** argv) glutInitWindowSize (600, 600); glutCreateWindow (argv[0]); glewInit(); + + if (!glutExtensionSupported("GL_EXT_texture_compression_s3tc")) { + fprintf(stderr, "This test requires GL_EXT_texture_compression_s3tc.\n"); + exit(1); + } + myInit(); glutReshapeFunc (myReshape); glutDisplayFunc(display); -- cgit v1.2.3 From 02b9fb9c80ae9079cd2eab945d58551f9d9cbd7c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 14:46:02 -0600 Subject: progs/tests: fixes for drawbuffers.c Disable GL_DEPTH_TEST before glDrawPixels. Show color buffer 0 on left, color buffer 1 on right. --- progs/tests/drawbuffers.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/progs/tests/drawbuffers.c b/progs/tests/drawbuffers.c index d75a870c26..7a19933e62 100644 --- a/progs/tests/drawbuffers.c +++ b/progs/tests/drawbuffers.c @@ -43,6 +43,8 @@ Display(void) glUseProgram_func(Program); + glEnable(GL_DEPTH_TEST); + /* draw to user framebuffer */ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, FBobject); @@ -68,18 +70,23 @@ Display(void) glPopMatrix(); /* read from user framebuffer */ - /* bottom half = colorbuffer 0 */ + /* left half = colorbuffer 0 */ glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); - glReadPixels(0, 0, Width, Height / 2, GL_RGBA, GL_UNSIGNED_BYTE, + glPixelStorei(GL_PACK_ROW_LENGTH, Width); + glPixelStorei(GL_PACK_SKIP_PIXELS, 0); + glReadPixels(0, 0, Width / 2, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); - /* top half = colorbuffer 1 */ + + /* right half = colorbuffer 1 */ glReadBuffer(GL_COLOR_ATTACHMENT1_EXT); - glReadPixels(0, Height/2, Width, Height - Height / 2, + glPixelStorei(GL_PACK_SKIP_PIXELS, Width / 2); + glReadPixels(Width / 2, 0, Width - Width / 2, Height, GL_RGBA, GL_UNSIGNED_BYTE, - buffer + Width * (Height / 2) * 4); + buffer); /* draw to window */ glUseProgram_func(0); + glDisable(GL_DEPTH_TEST); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); glWindowPos2iARB(0, 0); glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); -- cgit v1.2.3 From 35506dec6734a1ae777dc16981cb19e514f41897 Mon Sep 17 00:00:00 2001 From: Chow Loong Jin Date: Wed, 28 Oct 2009 14:34:14 +0800 Subject: Add --with-dri-searchpath argument * Add an extra argument to configure which allows for specifying different DRI driver search paths to libGL (FDO #24766) Signed-off-by: Dan Nicholson --- configs/autoconf.in | 2 +- configure.ac | 7 +++++++ src/mesa/drivers/dri/Makefile | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/configs/autoconf.in b/configs/autoconf.in index 83737e3a7d..a7f3c9df92 100644 --- a/configs/autoconf.in +++ b/configs/autoconf.in @@ -124,7 +124,7 @@ INSTALL_INC_DIR = $(includedir) DRI_DRIVER_INSTALL_DIR = @DRI_DRIVER_INSTALL_DIR@ # Where libGL will look for DRI hardware drivers -DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR) +DRI_DRIVER_SEARCH_DIR = @DRI_DRIVER_SEARCH_DIR@ # Xorg driver install directory (for xorg state-tracker) XORG_DRIVER_INSTALL_DIR = @XORG_DRIVER_INSTALL_DIR@ diff --git a/configure.ac b/configure.ac index 44fb77960c..5d11cf8452 100644 --- a/configure.ac +++ b/configure.ac @@ -649,6 +649,13 @@ AC_ARG_WITH([dri-driverdir], [DRI_DRIVER_INSTALL_DIR="$withval"], [DRI_DRIVER_INSTALL_DIR='${libdir}/dri']) AC_SUBST([DRI_DRIVER_INSTALL_DIR]) +dnl Extra search path for DRI drivers +AC_ARG_WITH([dri-searchpath], + [AS_HELP_STRING([--with-dri-searchpath=DIRS...], + [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])], + [DRI_DRIVER_SEARCH_DIR="$withval"], + [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}']) +AC_SUBST([DRI_DRIVER_SEARCH_DIR]) dnl Direct rendering or just indirect rendering AC_ARG_ENABLE([driglx-direct], [AS_HELP_STRING([--disable-driglx-direct], diff --git a/src/mesa/drivers/dri/Makefile b/src/mesa/drivers/dri/Makefile index 32db097861..264648c3fb 100644 --- a/src/mesa/drivers/dri/Makefile +++ b/src/mesa/drivers/dri/Makefile @@ -25,7 +25,7 @@ pcedit = sed \ -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \ -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \ -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \ - -e 's,@DRI_DRIVER_DIR@,$(DRI_DRIVER_SEARCH_DIR),' \ + -e 's,@DRI_DRIVER_DIR@,$(DRI_DRIVER_INSTALL_DIR),' \ -e 's,@DRI_PC_REQ_PRIV@,$(DRI_PC_REQ_PRIV),' dri.pc: dri.pc.in -- cgit v1.2.3 From e0556657526a7fe53d6e17cf70ffa6a8ee35e0a9 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 2 Nov 2009 12:35:47 -0700 Subject: glx: Fix memory leak if XF86DRICreateDrawable() fails Signed-off-by: Brian Paul --- src/glx/x11/dri_glx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c index ab24bd8ffe..4f7acb6cc3 100644 --- a/src/glx/x11/dri_glx.c +++ b/src/glx/x11/dri_glx.c @@ -596,8 +596,10 @@ driCreateDrawable(__GLXscreenConfigs * psc, pdraw->drawable = drawable; pdraw->psc = psc; - if (!XF86DRICreateDrawable(psc->dpy, psc->scr, drawable, &hwDrawable)) + if (!XF86DRICreateDrawable(psc->dpy, psc->scr, drawable, &hwDrawable)) { + Xfree(pdraw); return NULL; + } /* Create a new drawable */ pdraw->driDrawable = -- cgit v1.2.3 From 0197348641614188c400d7c616573bb7f1eea781 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 3 Nov 2009 09:26:32 -0700 Subject: st/mesa: fix tests for depth and depth/stencil texture formats --- src/mesa/state_tracker/st_cb_texture.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 50675b5896..e8e81ede00 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1313,7 +1313,8 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level, srcX, srcY, width, height); - if (baseFormat == GL_DEPTH_COMPONENT && + if ((baseFormat == GL_DEPTH_COMPONENT || + baseFormat == GL_DEPTH_STENCIL) && pf_is_depth_and_stencil(stImage->pt->format)) transfer_usage = PIPE_TRANSFER_READ_WRITE; else @@ -1326,7 +1327,7 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level, destX, destY, width, height); if (baseFormat == GL_DEPTH_COMPONENT || - baseFormat == GL_DEPTH24_STENCIL8) { + baseFormat == GL_DEPTH_STENCIL) { const GLboolean scaleOrBias = (ctx->Pixel.DepthScale != 1.0F || ctx->Pixel.DepthBias != 0.0F); GLint row, yStep; @@ -1453,7 +1454,7 @@ st_copy_texsubimage(GLcontext *ctx, struct gl_texture_image *texImage = _mesa_select_tex_image(ctx, texObj, target, level); struct st_texture_image *stImage = st_texture_image(texImage); - const GLenum texBaseFormat = texImage->InternalFormat; + const GLenum texBaseFormat = texImage->_BaseFormat; struct gl_framebuffer *fb = ctx->ReadBuffer; struct st_renderbuffer *strb; struct pipe_context *pipe = ctx->st->pipe; @@ -1474,12 +1475,9 @@ st_copy_texsubimage(GLcontext *ctx, /* determine if copying depth or color data */ if (texBaseFormat == GL_DEPTH_COMPONENT || - texBaseFormat == GL_DEPTH24_STENCIL8) { + texBaseFormat == GL_DEPTH_STENCIL) { strb = st_renderbuffer(fb->_DepthBuffer); } - else if (texBaseFormat == GL_DEPTH_STENCIL_EXT) { - strb = st_renderbuffer(fb->_StencilBuffer); - } else { /* texBaseFormat == GL_RGB, GL_RGBA, GL_ALPHA, etc */ strb = st_renderbuffer(fb->_ColorReadBuffer); -- cgit v1.2.3 From e60ebebb392d1d4c47541766737b5a79685a24d5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 3 Nov 2009 09:30:20 -0700 Subject: st/mesa: don't use util_blit_pixels_writemask() for depth or depth/stencil util_blit_pixels_writemask() only works for color formats at this time. Also, it might never work for depth/stencil surfaces since we can't get handle stencil values in a fragment shader. Fixes glCopyTexSubImage(GL_DEPTH_COMPONENT). --- src/mesa/state_tracker/st_cb_texture.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index e8e81ede00..f45b3e6032 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1560,6 +1560,8 @@ st_copy_texsubimage(GLcontext *ctx, use_fallback = GL_FALSE; } else if (format_writemask && + texBaseFormat != GL_DEPTH_COMPONENT && + texBaseFormat != GL_DEPTH_STENCIL && screen->is_format_supported(screen, src_format, PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_SAMPLER, -- cgit v1.2.3 From a0cd2b7029e1ac6699b807baa255e7fd2abe7f54 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Tue, 3 Nov 2009 16:16:05 +0100 Subject: st/mesa: clip pixels in draw_stencil_pixels to avoid crash Signed-off-by: Brian Paul --- src/mesa/state_tracker/st_cb_drawpixels.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index c655690603..2a227a7fde 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -661,6 +661,15 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, const GLboolean zoom = ctx->Pixel.ZoomX != 1.0 || ctx->Pixel.ZoomY != 1.0; GLint skipPixels; ubyte *stmap; + struct gl_pixelstore_attrib clippedUnpack = *unpack; + + if (!zoom) { + if (!_mesa_clip_drawpixels(ctx, &x, &y, &width, &height, + &clippedUnpack)) { + /* totally clipped */ + return; + } + } strb = st_renderbuffer(ctx->DrawBuffer-> Attachment[BUFFER_STENCIL].Renderbuffer); @@ -681,7 +690,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, stmap = screen->transfer_map(screen, pt); - pixels = _mesa_map_pbo_source(ctx, unpack, pixels); + pixels = _mesa_map_pbo_source(ctx, &clippedUnpack, pixels); assert(pixels); /* if width > MAX_WIDTH, have to process image in chunks */ @@ -694,17 +703,18 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, GLubyte sValues[MAX_WIDTH]; GLuint zValues[MAX_WIDTH]; GLenum destType = GL_UNSIGNED_BYTE; - const GLvoid *source = _mesa_image_address2d(unpack, pixels, + const GLvoid *source = _mesa_image_address2d(&clippedUnpack, pixels, width, height, format, type, row, skipPixels); _mesa_unpack_stencil_span(ctx, spanWidth, destType, sValues, - type, source, unpack, + type, source, &clippedUnpack, ctx->_ImageTransferState); if (format == GL_DEPTH_STENCIL) { _mesa_unpack_depth_span(ctx, spanWidth, GL_UNSIGNED_INT, zValues, - (1 << 24) - 1, type, source, unpack); + (1 << 24) - 1, type, source, + &clippedUnpack); } if (zoom) { @@ -775,7 +785,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, skipPixels += spanWidth; } - _mesa_unmap_pbo_source(ctx, unpack); + _mesa_unmap_pbo_source(ctx, &clippedUnpack); /* unmap the stencil buffer */ screen->transfer_unmap(screen, pt); -- cgit v1.2.3