From 5df64685892aea4dabee377352888d8eb58e9446 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Thu, 4 Jun 2009 06:21:10 -0700 Subject: osmesa: Allow building standalone in all three channel widths autoconf had been designating the 8 bit libOSMesa as the default standalone osmesa, but the Makefile expected it to be linked to libGL. Fix up the osmesa Makefile so that it allows any of the combinations of standalone and channel width to be built. Fixes bug #21980. (cherry picked from commit 7441dcd90b01df8351026af8bbb50e11bb86071a) --- src/mesa/drivers/osmesa/Makefile | 36 +++++++++--------------------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/src/mesa/drivers/osmesa/Makefile b/src/mesa/drivers/osmesa/Makefile index 3b3984200a..92d4149466 100644 --- a/src/mesa/drivers/osmesa/Makefile +++ b/src/mesa/drivers/osmesa/Makefile @@ -19,11 +19,12 @@ INCLUDE_DIRS = \ -I$(TOP)/src/mesa \ -I$(TOP)/src/mesa/main +# Standalone osmesa needs to be linked with core Mesa APIs +ifeq ($(DRIVER_DIRS), osmesa) CORE_MESA = $(TOP)/src/mesa/libmesa.a $(TOP)/src/mesa/libglapi.a - - -.PHONY: osmesa8 -.PHONY: osmesa16 +else +CORE_MESA = +endif .c.o: @@ -31,31 +32,12 @@ CORE_MESA = $(TOP)/src/mesa/libmesa.a $(TOP)/src/mesa/libglapi.a default: $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) - @ if [ "${DRIVER_DIRS}" = "osmesa" ] ; then \ - $(MAKE) osmesa16 ; \ - else \ - $(MAKE) osmesa8 ; \ - fi - - - - -# The normal libOSMesa is used in conjuction with libGL -osmesa8: $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) - -$(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME): $(OBJECTS) - $(MKLIB) -o $(OSMESA_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ - -major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \ - -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \ - -id $(INSTALL_LIB_DIR)/lib$(OSMESA_LIB).$(MESA_MAJOR).dylib \ - $(OSMESA_LIB_DEPS) $(OBJECTS) - - -# The libOSMesa16/libOSMesa32 libraries do not use libGL but rather are built -# with all the other Mesa sources (compiled with -DCHAN_BITS=16/32 -osmesa16: $(OBJECTS) $(CORE_MESA) +# libOSMesa can be used in conjuction with libGL or with all other Mesa +# sources. We can also build libOSMesa16/libOSMesa32 by setting +# -DCHAN_BITS=16/32. +$(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME): $(OBJECTS) $(CORE_MESA) $(MKLIB) -o $(OSMESA_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ -major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \ -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \ -- cgit v1.2.3 From 6453605785a3036c7e633400e4bd35bf2297b000 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Thu, 4 Jun 2009 19:42:08 -0700 Subject: osmesa: Link with -ldl for dlopen code Now that the dlopen wrappers are built into libmesa.a, we need to link standalone libOSMesa with libdl to resolve dlopen and friends on platforms that need it. (cherry picked from commit 4795dd5950d4dcd7c8d421c8fb4851c193297ba1) --- configure.ac | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 8110e0f869..48b8022736 100644 --- a/configure.ac +++ b/configure.ac @@ -826,12 +826,12 @@ case "$mesa_driver" in osmesa) # only link libraries with osmesa if shared if test "$enable_static" = no; then - OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS" + OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS" else OSMESA_LIB_DEPS="" fi OSMESA_MESA_DEPS="" - OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS" + OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS" ;; *) # Link OSMesa to libGL otherwise @@ -845,9 +845,6 @@ osmesa) OSMESA_PC_REQ="gl" ;; esac -if test "$enable_static" = no; then - OSMESA_LIB_DEPS="$OSMESA_LIB_DEPS" -fi OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV" AC_SUBST([OSMESA_LIB_DEPS]) AC_SUBST([OSMESA_MESA_DEPS]) -- cgit v1.2.3 From cfff2a6189b38f1ee8c8ca204e223574a5abf760 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 5 Jun 2009 17:16:47 -0600 Subject: mesa: bump version to 7.5-rc3 --- Makefile | 2 +- src/mesa/main/version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d134c4c330..22334d6ee4 100644 --- a/Makefile +++ b/Makefile @@ -182,7 +182,7 @@ ultrix-gcc: # Rules for making release tarballs -VERSION=7.5-rc2 +VERSION=7.5-rc3 DIRECTORY = Mesa-$(VERSION) LIB_NAME = MesaLib-$(VERSION) DEMO_NAME = MesaDemos-$(VERSION) diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h index e109f20df4..015ac71a17 100644 --- a/src/mesa/main/version.h +++ b/src/mesa/main/version.h @@ -31,7 +31,7 @@ #define MESA_MAJOR 7 #define MESA_MINOR 5 #define MESA_PATCH 0 -#define MESA_VERSION_STRING "7.5-rc2" +#define MESA_VERSION_STRING "7.5-rc3" /* To make version comparison easy */ #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -- cgit v1.2.3 From 78dad275646b720511dac31ca6ba0535568af81f Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 4 Jun 2009 10:34:02 -0700 Subject: Revert "scons: Less aggressive optimizations for MSVC 64bit compiler." This reverts commit fc7f92478286041a018ac4e72d2ccedeea7c0eca. --- scons/gallium.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/scons/gallium.py b/scons/gallium.py index 0d5843603e..5b3c9752bc 100644 --- a/scons/gallium.py +++ b/scons/gallium.py @@ -362,23 +362,8 @@ def generate(env): '/GL-', # disable whole program optimization ] else: - if env['machine'] == 'x86_64': - cflags += [ - # Same as /O2, but without global optimizations or auto-inlining - # http://msdn.microsoft.com/en-us/library/8f8h5cxt.aspx - '/Ob1', # enable inline expansion, disable auto-inlining - '/Oi', # enable intrinsic functions - '/Ot', # favors fast code - '/Oy', # omit frame pointer - '/Gs', # enable stack probes - '/GF', # eliminate duplicate strings - '/Gy', # enable function-level linking - ] - else: - cflags += [ - '/O2', # optimize for speed - ] cflags += [ + '/O2', # optimize for speed #'/fp:fast', # fast floating point ] if env['profile']: -- cgit v1.2.3 From 283e84bfb3066a3e3d778d4065b448ddd288fbb4 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 3 Jun 2009 16:33:56 +0200 Subject: progs/tests: Add some scissor tests --- progs/tests/.gitignore | 2 + progs/tests/Makefile | 2 + progs/tests/SConscript | 2 + progs/tests/scissor-viewport.c | 138 +++++++++++++++++++++++++++++++++ progs/tests/scissor.c | 168 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 312 insertions(+) create mode 100644 progs/tests/scissor-viewport.c create mode 100644 progs/tests/scissor.c diff --git a/progs/tests/.gitignore b/progs/tests/.gitignore index 959ddcc51f..d6a8538767 100644 --- a/progs/tests/.gitignore +++ b/progs/tests/.gitignore @@ -62,6 +62,8 @@ readrate readtex.c readtex.h rubberband +scissor +scissor-viewport seccolor shader_api shaderutil.c diff --git a/progs/tests/Makefile b/progs/tests/Makefile index 628ca41535..7604b22788 100644 --- a/progs/tests/Makefile +++ b/progs/tests/Makefile @@ -70,6 +70,8 @@ SOURCES = \ random.c \ readrate.c \ rubberband.c \ + scissor.c \ + scissor-viewport.c \ seccolor.c \ shader_api.c \ sharedtex.c \ diff --git a/progs/tests/SConscript b/progs/tests/SConscript index 453fcecd9c..9d89ff6a0d 100644 --- a/progs/tests/SConscript +++ b/progs/tests/SConscript @@ -95,6 +95,8 @@ progs = [ 'random', 'readrate', 'rubberband', + 'scissor', + 'scissor-viewport', 'seccolor', 'shader_api', 'stencil_twoside', diff --git a/progs/tests/scissor-viewport.c b/progs/tests/scissor-viewport.c new file mode 100644 index 0000000000..582e65fb72 --- /dev/null +++ b/progs/tests/scissor-viewport.c @@ -0,0 +1,138 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * Copyright (c) 2009 VMware, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF + * ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include +#include +#include +#include + +struct program +{ + unsigned width; + unsigned height; + int i; +}; + +struct program prog; + +static void init(void) +{ + fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); + fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); + fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); + + prog.i = 0; +} + +static void reshape(int width, int height) +{ + glViewport(0, 0, 100, 100); + + prog.width = width; + prog.height = height; + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); + glMatrixMode(GL_MODELVIEW); +} + +static void key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + default: + glutPostRedisplay(); + return; + } +} + +static void drawQuad(void) +{ + glBegin(GL_QUADS); + glVertex2d(-1.0, -1.0); + glVertex2d( 1.0, -1.0); + glVertex2d( 1.0, 1.0); + glVertex2d(-1.0, 1.0); + glEnd(); +} + +static void draw(void) +{ + int i; + + glClearColor(0.0, 0.0, 1.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT); + + i = prog.i++; + if (prog.i >= 3) + prog.i = 0; + + glEnable(GL_SCISSOR_TEST); + + { + glColor4d(1.0, 0.0, 0.0, 1.0); + + glScissor(i, i, 10 - 2*i, 10 - 2*i); + drawQuad(); + } + + glDisable(GL_SCISSOR_TEST); + + //glutSwapBuffers(); + glFlush(); +} + +int main(int argc, char **argv) +{ + GLenum type; + + glutInit(&argc, argv); + + prog.width = 200; + prog.height = 200; + + glutInitWindowPosition(100, 0); + glutInitWindowSize(prog.width, prog.height); + + //type = GLUT_RGB | GLUT_DOUBLE; + type = GLUT_RGB | GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow(*argv) == GL_FALSE) { + exit(1); + } + + init(); + + glutReshapeFunc(reshape); + glutKeyboardFunc(key); + glutDisplayFunc(draw); + glutMainLoop(); + return 0; +} diff --git a/progs/tests/scissor.c b/progs/tests/scissor.c new file mode 100644 index 0000000000..2dfd2174e8 --- /dev/null +++ b/progs/tests/scissor.c @@ -0,0 +1,168 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * Copyright (c) 2009 VMware, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF + * ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include +#include +#include +#include + +struct program +{ + unsigned width; + unsigned height; + unsigned quads; +}; + +struct program prog; + +static void init(void) +{ + fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); + fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); + fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); +} + +static void reshape(int width, int height) +{ + + glViewport(0, 0, (GLint)width, (GLint)height); + + prog.width = width; + prog.height = height; + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); + glMatrixMode(GL_MODELVIEW); +} + +static void key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + default: + prog.quads = !prog.quads; + glutPostRedisplay(); + return; + } +} + +static void drawQuad(void) +{ + + if (prog.quads) { + glBegin(GL_QUADS); + glVertex2d(-1.0, -1.0); + glVertex2d( 1.0, -1.0); + glVertex2d( 1.0, 1.0); + glVertex2d(-1.0, 1.0); + glEnd(); + } else { + glClear(GL_COLOR_BUFFER_BIT); + } +} + +static void draw(void) +{ + glClearColor(0.0, 0.0, 1.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT); + + printf("drawing with %s\n", prog.quads ? "quads" : "clears"); + + glEnable(GL_SCISSOR_TEST); + + { + glClearColor(1.0, 0.0, 0.0, 1.0); + glColor4d(1.0, 0.0, 0.0, 1.0); + + glScissor(1, 1, 10, 10); + drawQuad(); + glScissor(1, prog.height - 11, 10, 10); + drawQuad(); + glScissor(prog.width - 11, prog.height - 11, 10, 10); + drawQuad(); + } + + { + glClearColor(0.0, 1.0, 0.0, 1.0); + glColor4d(0.0, 1.0, 0.0, 1.0); + + glScissor(12, 1, 10, 10); + drawQuad(); + glScissor(12, prog.height - 11, 10, 10); + drawQuad(); + glScissor(prog.width - 22, prog.height - 11, 10, 10); + drawQuad(); + } + + { + glClearColor(1.0, 1.0, 0.0, 1.0); + glColor4d(1.0, 1.0, 0.0, 1.0); + + glScissor(1, 12, 10, 10); + drawQuad(); + glScissor(1, prog.height - 22, 10, 10); + drawQuad(); + glScissor(prog.width - 11, prog.height - 22, 10, 10); + drawQuad(); + } + + glDisable(GL_SCISSOR_TEST); + + //glutSwapBuffers(); + glFlush(); +} + +int main(int argc, char **argv) +{ + GLenum type; + + glutInit(&argc, argv); + + prog.width = 200; + prog.height = 200; + + glutInitWindowPosition(100, 0); + glutInitWindowSize(prog.width, prog.height); + + //type = GLUT_RGB | GLUT_DOUBLE; + type = GLUT_RGB | GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow(*argv) == GL_FALSE) { + exit(1); + } + + init(); + + glutReshapeFunc(reshape); + glutKeyboardFunc(key); + glutDisplayFunc(draw); + glutMainLoop(); + return 0; +} -- cgit v1.2.3 From 4d9d0e62306ce1a046ff724936016a4f080cf21a Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Mon, 8 Jun 2009 14:34:16 +0200 Subject: stw: If stfb not set don't call into mesa --- src/gallium/state_trackers/wgl/shared/stw_framebuffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c index de37d135df..f27f4cda21 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c @@ -118,7 +118,8 @@ stw_call_window_proc( * be called from any thread. */ pipe_mutex_lock( fb->mutex ); - st_resize_framebuffer( fb->stfb, width, height ); + if (fb->stfb) + st_resize_framebuffer( fb->stfb, width, height ); pipe_mutex_unlock( fb->mutex ); } } -- cgit v1.2.3 From fce4ee12a620de4ece35cef62a4562bbd4895557 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 8 Jun 2009 07:25:24 -0600 Subject: mesa: EXT_vertex_array_bgra fixes 1) Pass the correct format when calling update_array in _mesa_VertexAttribPointerARB. 2) glVertexAttribPointerNV accepts GL_BGRA format too. 3) raise INVALID_VALUE error when format is BGRA and normalized is false in glVertexAttribPointerARB (cherry picked from commit 4adb190a162c5ed0684a8616331344caadba4010) --- src/mesa/main/varray.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 72b3e834b3..0882e8f37a 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -534,6 +534,7 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, { GLboolean normalized = GL_FALSE; GLsizei elementSize; + GLenum format; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -557,6 +558,21 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, return; } + if (size == GL_BGRA) { + if (type != GL_UNSIGNED_BYTE) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glVertexAttribPointerNV(GL_BGRA/type)"); + return; + } + + format = GL_BGRA; + size = 4; + normalized = GL_TRUE; + } + else { + format = GL_RGBA; + } + /* check for valid 'type' and compute StrideB right away */ switch (type) { case GL_UNSIGNED_BYTE: @@ -579,7 +595,7 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, update_array(ctx, &ctx->Array.ArrayObj->VertexAttrib[index], _NEW_ARRAY_ATTRIB(index), - elementSize, size, type, GL_RGBA, stride, normalized, ptr); + elementSize, size, type, format, stride, normalized, ptr); if (ctx->Driver.VertexAttribPointer) ctx->Driver.VertexAttribPointer( ctx, index, size, type, stride, ptr ); @@ -621,9 +637,14 @@ _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type, "glVertexAttribPointerARB(GL_BGRA/type)"); return; } + if (normalized != GL_TRUE) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glVertexAttribPointerARB(GL_BGRA/normalized)"); + return; + } + format = GL_BGRA; size = 4; - normalized = GL_TRUE; } else { format = GL_RGBA; @@ -668,7 +689,7 @@ _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type, update_array(ctx, &ctx->Array.ArrayObj->VertexAttrib[index], _NEW_ARRAY_ATTRIB(index), - elementSize, size, type, GL_RGBA, stride, normalized, ptr); + elementSize, size, type, format, stride, normalized, ptr); if (ctx->Driver.VertexAttribPointer) ctx->Driver.VertexAttribPointer(ctx, index, size, type, stride, ptr); -- cgit v1.2.3 From 0d3c8fbf12289a8cc081c2d68e810c4bf29d1f8d Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 8 Jun 2009 16:11:29 +0100 Subject: mesa/vbo: drop all references to vbo on destroy We were adding references to the input arrays, but failing to drop them on destruction. This could lead to a 64kb buffer being leaked each context destruction. --- src/mesa/vbo/vbo_exec_api.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 5d35ec9c11..a8a09859a0 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -727,19 +727,32 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec ) void vbo_exec_vtx_destroy( struct vbo_exec_context *exec ) { - if (exec->vtx.bufferobj->Name) { - /* using a real VBO for vertex data */ - GLcontext *ctx = exec->ctx; - _mesa_reference_buffer_object(ctx, &exec->vtx.bufferobj, NULL); - } - else { - /* just using malloc'd space for vertex data */ - if (exec->vtx.buffer_map) { + /* using a real VBO for vertex data */ + GLcontext *ctx = exec->ctx; + unsigned i; + + /* True VBOs should already be unmapped + */ + if (exec->vtx.buffer_map) { + assert (exec->vtx.bufferobj->Name == 0); + if (exec->vtx.bufferobj->Name == 0) { ALIGN_FREE(exec->vtx.buffer_map); exec->vtx.buffer_map = NULL; exec->vtx.buffer_ptr = NULL; } } + + /* Drop any outstanding reference to the vertex buffer + */ + for (i = 0; i < Elements(exec->vtx.arrays); i++) { + _mesa_reference_buffer_object(ctx, + &exec->vtx.arrays[i].BufferObj, + NULL); + } + + /* Free the vertex buffer: + */ + _mesa_reference_buffer_object(ctx, &exec->vtx.bufferobj, NULL); } void vbo_exec_BeginVertices( GLcontext *ctx ) -- cgit v1.2.3 From 0bced6a326e3520d2b280b4f6cdaadf843ce1d2d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 8 Jun 2009 09:42:04 -0600 Subject: mesa: bump MAX_PROGRAM_ENV_PARAMS from 128 to 256 Also, MAX_NV_VERTEX_PROGRAM_PARAMS should be 96, not 128 (or 256). --- src/mesa/main/config.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index 2a9fdf9ca0..bd66a4c231 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -180,7 +180,7 @@ /*@{*/ #define MAX_PROGRAM_INSTRUCTIONS (16 * 1024) #define MAX_PROGRAM_LOCAL_PARAMS 256 /**< per-program constants (power of two) */ -#define MAX_PROGRAM_ENV_PARAMS 128 +#define MAX_PROGRAM_ENV_PARAMS 256 /**< per-context constants (power of two) */ #define MAX_PROGRAM_MATRICES 8 #define MAX_PROGRAM_MATRIX_STACK_DEPTH 4 #define MAX_PROGRAM_CALL_DEPTH 8 @@ -197,7 +197,7 @@ /*@{*/ #define MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS 128 #define MAX_NV_VERTEX_PROGRAM_TEMPS 12 -#define MAX_NV_VERTEX_PROGRAM_PARAMS MAX_PROGRAM_ENV_PARAMS +#define MAX_NV_VERTEX_PROGRAM_PARAMS 96 #define MAX_NV_VERTEX_PROGRAM_INPUTS 16 #define MAX_NV_VERTEX_PROGRAM_OUTPUTS 15 /*@}*/ -- cgit v1.2.3 From 33d63277706aede31559a24c0db76b37609e76ef Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 8 Jun 2009 09:52:31 -0600 Subject: mesa: better error message for invalid texture unit index --- src/mesa/shader/arbprogparse.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index c7a031067e..bb4c5b38d4 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -1014,7 +1014,10 @@ parse_teximage_num (GLcontext * ctx, const GLubyte ** inst, GLint i = parse_integer (inst, Program); if ((i < 0) || (i >= (int)ctx->Const.MaxTextureImageUnits)) { - program_error(ctx, Program->Position, "Invalid texture image index"); + char s[100]; + _mesa_snprintf(s, sizeof(s), "Invalid texture image index %d (%u is max)", + i, ctx->Const.MaxTextureImageUnits); + program_error(ctx, Program->Position, s); return 1; } -- cgit v1.2.3 From 42678dba941b5a734e6aa03b530653d9c5341a70 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 8 Jun 2009 16:27:59 +0100 Subject: mesa: Allocate tokens from the heap. The recent increase ST_MAX_SHADER_TOKENS to 8K causes stack overflows on windows. Failure to allocate is not being propagated to the caller. This is not a regression since the previous _mesa_malloc result wasn't being checked as well. Unfortunately it is not easy to fix, as the callers of these functions do not have failure propagation mechanism either, and so on. So leaving a just fixme note for now. --- src/mesa/state_tracker/st_program.c | 40 ++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 34926101ed..06030f6cd8 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -55,20 +55,6 @@ #define TGSI_DEBUG 0 -/** XXX we should use the version of this from u_memory.h but including - * that header causes symbol collisions. - */ -static INLINE void * -mem_dup(const void *src, uint size) -{ - void *dup = _mesa_malloc(size); - if (dup) - _mesa_memcpy(dup, src, size); - return dup; -} - - - /** * Translate a Mesa vertex shader into a TGSI shader. * \param outputMapping to map vertex program output registers (VERT_RESULT_x) @@ -84,7 +70,7 @@ st_translate_vertex_program(struct st_context *st, const ubyte *outputSemanticIndex) { struct pipe_context *pipe = st->pipe; - struct tgsi_token tokens[ST_MAX_SHADER_TOKENS]; + struct tgsi_token *tokens; GLuint defaultOutputMapping[VERT_RESULT_MAX]; struct pipe_shader_state vs; GLuint attr, i; @@ -102,6 +88,13 @@ st_translate_vertex_program(struct st_context *st, GLbitfield input_flags[MAX_PROGRAM_INPUTS]; GLbitfield output_flags[MAX_PROGRAM_OUTPUTS]; + tokens = (struct tgsi_token *)MALLOC(ST_MAX_SHADER_TOKENS * sizeof *tokens); + if(!tokens) { + /* FIXME: propagate error to the caller */ + assert(0); + return; + } + memset(&vs, 0, sizeof(vs)); memset(input_flags, 0, sizeof(input_flags)); memset(output_flags, 0, sizeof(output_flags)); @@ -347,7 +340,9 @@ st_translate_vertex_program(struct st_context *st, assert(num_tokens < ST_MAX_SHADER_TOKENS); vs.tokens = (struct tgsi_token *) - mem_dup(tokens, num_tokens * sizeof(tokens[0])); + _mesa_realloc(tokens, + ST_MAX_SHADER_TOKENS * sizeof *tokens, + num_tokens * sizeof *tokens); stvp->num_inputs = vs_num_inputs; stvp->state = vs; /* struct copy */ @@ -375,7 +370,7 @@ st_translate_fragment_program(struct st_context *st, const GLuint inputMapping[]) { struct pipe_context *pipe = st->pipe; - struct tgsi_token tokens[ST_MAX_SHADER_TOKENS]; + struct tgsi_token *tokens; GLuint outputMapping[FRAG_RESULT_MAX]; GLuint defaultInputMapping[FRAG_ATTRIB_MAX]; struct pipe_shader_state fs; @@ -395,6 +390,13 @@ st_translate_fragment_program(struct st_context *st, GLbitfield input_flags[MAX_PROGRAM_INPUTS]; GLbitfield output_flags[MAX_PROGRAM_OUTPUTS]; + tokens = (struct tgsi_token *)MALLOC(ST_MAX_SHADER_TOKENS * sizeof *tokens); + if(!tokens) { + /* FIXME: propagate error to the caller */ + assert(0); + return; + } + memset(&fs, 0, sizeof(fs)); memset(input_flags, 0, sizeof(input_flags)); memset(output_flags, 0, sizeof(output_flags)); @@ -536,7 +538,9 @@ st_translate_fragment_program(struct st_context *st, assert(num_tokens < ST_MAX_SHADER_TOKENS); fs.tokens = (struct tgsi_token *) - mem_dup(tokens, num_tokens * sizeof(tokens[0])); + _mesa_realloc(tokens, + ST_MAX_SHADER_TOKENS * sizeof *tokens, + num_tokens * sizeof *tokens); stfp->state = fs; /* struct copy */ stfp->driver_shader = pipe->create_fs_state(pipe, &fs); -- cgit v1.2.3 From e09f78d8dc7f20bb11f84206b6f1d71418332d8a Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 8 Jun 2009 16:29:46 +0100 Subject: mesa: Use matching signedness for the counter as upper bound. --- src/mesa/main/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 2eabcdaf49..b54e47919d 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -282,7 +282,7 @@ write_texture_image(struct gl_texture_object *texObj) case MESA_FORMAT_RGB565: { GLubyte *buf2 = (GLubyte *) _mesa_malloc(img->Width * img->Height * 3); - GLint i; + GLuint i; for (i = 0; i < img->Width * img->Height; i++) { GLint r, g, b; GLushort s = ((GLushort *) img->Data)[i]; -- cgit v1.2.3 From b6753adbc71a2d13e8ec095251f62cb267429de7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 8 Jun 2009 10:44:48 -0600 Subject: st/mesa: remove invalid assertion It's legal for ARB_vertex_program programs to not write to result.position. The results are undefined in that case. This assertion was causing us to abort/exit though. --- src/mesa/state_tracker/st_program.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 06030f6cd8..72ca852458 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -290,9 +290,6 @@ st_translate_vertex_program(struct st_context *st, } } - assert(vs_output_semantic_name[0] == TGSI_SEMANTIC_POSITION); - - if (outputMapping) { /* find max output slot referenced to compute vs_num_outputs */ GLuint maxSlot = 0; -- cgit v1.2.3 From 77c329a2773820c57e7b286858e80a596f89ef94 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Mon, 8 Jun 2009 16:46:06 +0200 Subject: pipebuffer: Silence out of heap space debug print --- src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c index 5a342fbf3b..d8decba49d 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c @@ -200,8 +200,8 @@ mm_bufmgr_create_buffer(struct pb_manager *mgr, mm_buf->block = u_mmAllocMem(mm->heap, size, mm->align2, 0); if(!mm_buf->block) { - debug_printf("warning: heap full\n"); #if 0 + debug_printf("warning: heap full\n"); mmDumpMemInfo(mm->heap); #endif FREE(mm_buf); -- cgit v1.2.3 From 304ba4bba44057aa21f0ae434e49b1e09ab7d039 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 8 Jun 2009 13:53:33 -0600 Subject: glsl: Fix preprocessor define argument parsing for dead sections. (cherry picked from master, commit 19a54d9f1055c366fd77026dd67007a8d5921f58) --- src/mesa/shader/slang/slang_preprocess.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mesa/shader/slang/slang_preprocess.c b/src/mesa/shader/slang/slang_preprocess.c index ff913ad883..fd98fae360 100644 --- a/src/mesa/shader/slang/slang_preprocess.c +++ b/src/mesa/shader/slang/slang_preprocess.c @@ -1035,11 +1035,11 @@ preprocess_source (slang_string *output, const char *source, /* Parse optional macro parameters. */ while (prod[i++] != PARAM_END) { - if (state.cond.top->effective) { - pp_symbol *param; + pp_symbol *param; - id = (const char *) (&prod[i]); - idlen = _mesa_strlen (id); + id = (const char *) (&prod[i]); + idlen = _mesa_strlen (id); + if (state.cond.top->effective) { pp_annotate (output, "%s, ", id); param = pp_symbols_push (&symbol->parameters); if (param == NULL) -- cgit v1.2.3 From 7eed6ab5b525b75f690d05042c90d05827253114 Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Mon, 8 Jun 2009 16:02:18 +0100 Subject: Cygwin build fixes Fix mklib to deal with NOPREFIX and use --enable-auto-image-base for cygwin Teach configure.ac some basic facts about cygwin Signed-off-by: Jon TURNEY --- bin/mklib | 19 ++++++++++++++++--- configure.ac | 5 +++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/bin/mklib b/bin/mklib index 2fd95ba775..2444945006 100755 --- a/bin/mklib +++ b/bin/mklib @@ -885,6 +885,17 @@ case $ARCH in CYGWIN*) # GCC-based environment + if [ $NOPREFIX = 1 ] ; then + # No "lib" or ".so" part + echo "mklib: Making CYGWIN shared library: " ${LIBNAME} + OPTS="-shared -Wl,--enable-auto-image-base" + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi + rm -f ${LIBNAME} + ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS} + FINAL_LIBS=${LIBNAME} + else CYGNAME="cyg${LIBNAME}" # prefix with "cyg" LIBNAME="lib${LIBNAME}" # prefix with "lib" @@ -901,11 +912,11 @@ case $ARCH in # finish up FINAL_LIBS=${LIBNAME}.a else - OPTS="-shared -Wl,-export-all -Wl,--out-implib=${LIBNAME}-${MAJOR}.dll.a" + OPTS="-shared -Wl,--enable-auto-image-base -Wl,-export-all -Wl,--out-implib=${LIBNAME}-${MAJOR}.dll.a" if [ "${ALTOPTS}" ] ; then OPTS=${ALTOPTS} fi - echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}-${MAJOR}.dll + echo "mklib: Making" $ARCH "shared library: " ${CYGNAME}-${MAJOR}.dll if [ $CPLUSPLUS = 1 ] ; then LINK="g++" @@ -914,7 +925,8 @@ case $ARCH in fi # rm any old libs - rm -f ${LIBNAME}-${MAJOR}.dll + rm -f ${CYGNAME}-${MAJOR}.dll + rm -f ${LIBNAME}-${MAJOR}.dll.a rm -f ${LIBNAME}.dll.a rm -f ${LIBNAME}.a @@ -927,6 +939,7 @@ case $ARCH in # special case for installing in bin FINAL_BINS="${CYGNAME}-${MAJOR}.dll" fi + fi ;; 'example') diff --git a/configure.ac b/configure.ac index 48b8022736..2a9ac1ed9c 100644 --- a/configure.ac +++ b/configure.ac @@ -222,6 +222,8 @@ else case "$host_os" in darwin* ) LIB_EXTENSION='dylib' ;; + cygwin* ) + LIB_EXTENSION='dll' ;; * ) LIB_EXTENSION='so' ;; esac @@ -1073,6 +1075,9 @@ if test "x$APP_LIB_DEPS" = x; then solaris*) APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm" ;; + cygwin*) + APP_LIB_DEPS="-lX11" + ;; *) APP_LIB_DEPS="-lm" ;; -- cgit v1.2.3 From 34bb024cf2d02d5d5cb672ead05fa131bdff6dd8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 8 Jun 2009 16:11:17 -0600 Subject: st/mesa: fix incorrect bufObj Length assignment, remove unneeded assertion --- src/mesa/state_tracker/st_cb_bufferobjects.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index a94e11fff1..fbe6aa25de 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -251,7 +251,7 @@ st_bufferobj_map_range(GLcontext *ctx, GLenum target, map = obj->Pointer = pipe_buffer_map_range(pipe->screen, st_obj->buffer, offset, length, flags); if(obj->Pointer) { obj->Offset = 0; - obj->Length = obj->Size; + obj->Length = length; map += offset; } @@ -270,7 +270,6 @@ st_bufferobj_flush_mapped_range(GLcontext *ctx, GLenum target, /* Subrange is relative to mapped range */ assert(offset >= 0); assert(length >= 0); - assert(offset < obj->Length); assert(offset + length <= obj->Length); pipe_buffer_flush_mapped_range(pipe->screen, st_obj->buffer, -- cgit v1.2.3 From cb549775a577cc5c86fefdc7e208b9d5e1d25217 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 9 Jun 2009 09:14:38 -0600 Subject: glsl: Expand nested preprocessor macros. (cherry picked from master, commit ef8caec29ae73bb2bbeb48f0578d839ef29348cd) --- src/mesa/shader/slang/slang_preprocess.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/mesa/shader/slang/slang_preprocess.c b/src/mesa/shader/slang/slang_preprocess.c index fd98fae360..0e95cdb525 100644 --- a/src/mesa/shader/slang/slang_preprocess.c +++ b/src/mesa/shader/slang/slang_preprocess.c @@ -1012,6 +1012,8 @@ preprocess_source (slang_string *output, const char *source, case TOKEN_DEFINE: { pp_symbol *symbol = NULL; + slang_string replacement; + expand_state es; /* Parse macro name. */ id = (const char *) (&prod[i]); @@ -1054,9 +1056,20 @@ preprocess_source (slang_string *output, const char *source, idlen = _mesa_strlen (id); if (state.cond.top->effective) { pp_annotate (output, ") %s", id); - slang_string_pushs (&symbol->replacement, id, idlen); } + slang_string_init(&replacement); + slang_string_pushs(&replacement, id, idlen); i += idlen + 1; + + /* Expand macro replacement. */ + es.output = &symbol->replacement; + es.input = slang_string_cstr(&replacement); + es.state = &state; + if (!expand(&es, &state.symbols)) { + slang_string_free(&replacement); + goto error; + } + slang_string_free(&replacement); } break; -- cgit v1.2.3 From 9192347443bc3db9ebeb4b5cc090133b63396b04 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 9 Jun 2009 16:35:55 +0100 Subject: stw: ignore swapbuffer requests on singlebuffer Return TRUE in this case. Returning FALSE seems to result in mis-rendering -- possibly opengl32.dll is trying to compensate by doing a software blit?? --- src/gallium/state_trackers/wgl/shared/stw_framebuffer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c index f27f4cda21..a601fc5646 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c @@ -380,6 +380,9 @@ stw_swap_buffers( if (fb == NULL) return FALSE; + if (!(fb->pfi->pfd.dwFlags & PFD_DOUBLEBUFFER)) + return TRUE; + pipe_mutex_lock( fb->mutex ); /* If we're swapping the buffer associated with the current context -- cgit v1.2.3 From 76a1017e978f8e51114d765c8c98ff25da13042b Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 9 Jun 2009 18:32:18 +0100 Subject: mesa/st: fix tracking of mapped buffer ranges In st_bufferobj_map_range(), set obj->Offset consistently with its usage elsewhere. --- src/mesa/state_tracker/st_cb_bufferobjects.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index fbe6aa25de..19a0e67362 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -250,7 +250,7 @@ st_bufferobj_map_range(GLcontext *ctx, GLenum target, map = obj->Pointer = pipe_buffer_map_range(pipe->screen, st_obj->buffer, offset, length, flags); if(obj->Pointer) { - obj->Offset = 0; + obj->Offset = offset; obj->Length = length; map += offset; } -- cgit v1.2.3