diff options
author | Brian Paul <[email protected]> | 2009-06-30 08:56:53 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-06-30 08:56:53 -0600 |
commit | b40dc7e7fcafc30ebaa3778ee847c8983987de83 (patch) | |
tree | b8ed89d7d8ba3fc2c25b3e2f95a62b1820557aac | |
parent | b750b9fc3d12e4c23ef74181a6252e0e054a3985 (diff) | |
parent | 4c31632817a0bde28ad6c9ee8032d838ce4b7bfb (diff) |
Merge branch 'mesa_7_5_branch'
Conflicts:
src/mesa/vbo/vbo_exec_draw.c
-rw-r--r-- | progs/util/shaderutil.c | 7 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_upload_mgr.c | 4 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_defines.h | 1 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_inlines.h | 4 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_screen.h | 20 | ||||
-rw-r--r-- | src/glx/x11/drisw_glx.c | 2 | ||||
-rw-r--r-- | src/glx/x11/glxcmds.c | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_bufferobjects.c | 3 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_exec_draw.c | 28 | ||||
-rw-r--r-- | src/mesa/x86/sse_xform2.S | 1 | ||||
-rw-r--r-- | src/mesa/x86/sse_xform3.S | 1 |
11 files changed, 54 insertions, 19 deletions
diff --git a/progs/util/shaderutil.c b/progs/util/shaderutil.c index 2f1c4e38b30..5cef84eb49c 100644 --- a/progs/util/shaderutil.c +++ b/progs/util/shaderutil.c @@ -9,6 +9,7 @@ #include <assert.h> #include <stdio.h> #include <stdlib.h> +#include <GL/glew.h> #include <GL/glut.h> #include "extfuncs.h" #include "shaderutil.h" @@ -78,8 +79,12 @@ CompileShaderFile(GLenum shaderType, const char *filename) int n; char *buffer = (char*) malloc(max); GLuint shader; + FILE *f; - FILE *f = fopen(filename, "r"); + Init(); + + + f = fopen(filename, "r"); if (!f) { fprintf(stderr, "Unable to open shader file %s\n", filename); return 0; diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c index 2eb98068c86..c90425f3e54 100644 --- a/src/gallium/auxiliary/util/u_upload_mgr.c +++ b/src/gallium/auxiliary/util/u_upload_mgr.c @@ -83,7 +83,9 @@ my_buffer_write(struct pipe_screen *screen, assert(dirty_size >= size); assert(size); - map = pipe_buffer_map_range(screen, buf, offset, size, PIPE_BUFFER_USAGE_CPU_WRITE); + map = pipe_buffer_map_range(screen, buf, offset, size, + PIPE_BUFFER_USAGE_CPU_WRITE | + PIPE_BUFFER_USAGE_FLUSH_EXPLICIT); if (map == NULL) return PIPE_ERROR_OUT_OF_MEMORY; diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 96030e788db..b7857c5be8c 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -210,6 +210,7 @@ enum pipe_transfer_usage { #define PIPE_BUFFER_USAGE_CONSTANT (1 << 7) #define PIPE_BUFFER_USAGE_DISCARD (1 << 8) #define PIPE_BUFFER_USAGE_DONTBLOCK (1 << 9) +#define PIPE_BUFFER_USAGE_FLUSH_EXPLICIT (1 << 10) /**< See pipe_screen::buffer_flush_mapped_range */ /** Pipe driver custom usage flags should be greater or equal to this value */ #define PIPE_BUFFER_USAGE_CUSTOM (1 << 16) diff --git a/src/gallium/include/pipe/p_inlines.h b/src/gallium/include/pipe/p_inlines.h index 1232c879682..cf176c92099 100644 --- a/src/gallium/include/pipe/p_inlines.h +++ b/src/gallium/include/pipe/p_inlines.h @@ -117,7 +117,9 @@ pipe_buffer_write(struct pipe_screen *screen, assert(offset + size <= buf->size); assert(size); - map = pipe_buffer_map_range(screen, buf, offset, size, PIPE_BUFFER_USAGE_CPU_WRITE); + map = pipe_buffer_map_range(screen, buf, offset, size, + PIPE_BUFFER_USAGE_CPU_WRITE | + PIPE_BUFFER_USAGE_FLUSH_EXPLICIT); assert(map); if(map) { memcpy(map + offset, data, size); diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index b449522fac3..6cbdd759434 100644 --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@ -221,23 +221,31 @@ struct pipe_screen { /** * Notify a range that was actually written into. * + * Can only be used if the buffer was mapped with the + * PIPE_BUFFER_USAGE_CPU_WRITE and PIPE_BUFFER_USAGE_FLUSH_EXPLICIT flags + * set. + * * The range is relative to the buffer start, regardless of the range * specified to buffer_map_range. This is different from the * ARB_map_buffer_range semantics because we don't forbid multiple mappings * of the same buffer (yet). * - * If the buffer was mapped for writing and no buffer_flush_mapped_range - * call was done until the buffer_unmap is called then the pipe driver will - * assumed that the whole buffer was written. This is for backward - * compatibility purposes and may affect performance -- the state tracker - * should always specify exactly what got written while the buffer was - * mapped. */ void (*buffer_flush_mapped_range)( struct pipe_screen *screen, struct pipe_buffer *buf, unsigned offset, unsigned length); + /** + * Unmap buffer. + * + * If the buffer was mapped with PIPE_BUFFER_USAGE_CPU_WRITE flag but not + * PIPE_BUFFER_USAGE_FLUSH_EXPLICIT then the pipe driver will + * assume that the whole buffer was written. This is mostly for backward + * compatibility purposes and may affect performance -- the state tracker + * should always specify exactly what got written while the buffer was + * mapped. + */ void (*buffer_unmap)( struct pipe_screen *screen, struct pipe_buffer *buf ); diff --git a/src/glx/x11/drisw_glx.c b/src/glx/x11/drisw_glx.c index b843ce484fb..1c229dde900 100644 --- a/src/glx/x11/drisw_glx.c +++ b/src/glx/x11/drisw_glx.c @@ -401,6 +401,8 @@ driCreateScreen(__GLXscreenConfigs * psc, int screen, psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs); psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs); + free(driver_configs); + psp->destroyScreen = driDestroyScreen; psp->createContext = driCreateContext; psp->createDrawable = driCreateDrawable; diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 77471b8599c..820d8b98685 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -164,7 +164,7 @@ GetGLXScreenConfigs(Display *dpy, int scrn) { __GLXdisplayPrivate * const priv = __glXInitialize(dpy); - return (priv->screenConfigs != NULL) ? &priv->screenConfigs[scrn] : NULL; + return (priv && priv->screenConfigs != NULL) ? &priv->screenConfigs[scrn] : NULL; } diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index 4d9ff01c776..8c1fd5ce025 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -236,6 +236,9 @@ st_bufferobj_map_range(GLcontext *ctx, GLenum target, if (access & GL_MAP_READ_BIT) flags |= PIPE_BUFFER_USAGE_CPU_READ; + if (access & GL_MAP_FLUSH_EXPLICIT_BIT) + flags |= PIPE_BUFFER_USAGE_FLUSH_EXPLICIT; + /* ... other flags ... */ diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index c939b7b6335..5442a409ad4 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -282,9 +282,14 @@ void vbo_exec_vtx_map( struct vbo_exec_context *exec ) { GLcontext *ctx = exec->ctx; - GLenum target = GL_ARRAY_BUFFER_ARB; - GLenum access = GL_READ_WRITE_ARB; - GLenum usage = GL_STREAM_DRAW_ARB; + const GLenum target = GL_ARRAY_BUFFER_ARB; + const GLenum access = GL_READ_WRITE_ARB; /* for MapBuffer */ + const GLenum accessRange = GL_MAP_WRITE_BIT | /* for MapBufferRange */ + GL_MAP_INVALIDATE_RANGE_BIT | + GL_MAP_UNSYNCHRONIZED_BIT | + GL_MAP_FLUSH_EXPLICIT_BIT | + MESA_MAP_NOWAIT_BIT; + const GLenum usage = GL_STREAM_DRAW_ARB; if (exec->vtx.bufferobj->Name == 0) return; @@ -303,10 +308,7 @@ vbo_exec_vtx_map( struct vbo_exec_context *exec ) exec->vtx.buffer_used, (VBO_VERT_BUFFER_SIZE - exec->vtx.buffer_used), - (GL_MAP_WRITE_BIT | - GL_MAP_INVALIDATE_RANGE_BIT | - GL_MAP_UNSYNCHRONIZED_BIT | - MESA_MAP_NOWAIT_BIT), + accessRange, exec->vtx.bufferobj); exec->vtx.buffer_ptr = exec->vtx.buffer_map; } @@ -318,8 +320,16 @@ vbo_exec_vtx_map( struct vbo_exec_context *exec ) VBO_VERT_BUFFER_SIZE, NULL, usage, exec->vtx.bufferobj); - exec->vtx.buffer_map = (GLfloat *) - ctx->Driver.MapBuffer(ctx, target, access, exec->vtx.bufferobj); + + if (ctx->Driver.MapBufferRange) + exec->vtx.buffer_map = + (GLfloat *)ctx->Driver.MapBufferRange(ctx, target, + 0, VBO_VERT_BUFFER_SIZE, + accessRange, + exec->vtx.bufferobj); + else + exec->vtx.buffer_map = + (GLfloat *)ctx->Driver.MapBuffer(ctx, target, access, exec->vtx.bufferobj); exec->vtx.buffer_ptr = exec->vtx.buffer_map; } diff --git a/src/mesa/x86/sse_xform2.S b/src/mesa/x86/sse_xform2.S index 91b82e72971..b490d4c169f 100644 --- a/src/mesa/x86/sse_xform2.S +++ b/src/mesa/x86/sse_xform2.S @@ -186,6 +186,7 @@ GLNAME(_mesa_sse_transform_points2_3d_no_rot): MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ ADD_L( EDI, ECX ) /* count += dest ptr */ + PXOR( XMM0, XMM0 ) ALIGNTEXT32 MOVSS ( M(0), XMM1 ) /* - | - | - | m0 */ diff --git a/src/mesa/x86/sse_xform3.S b/src/mesa/x86/sse_xform3.S index 1fc79ef21bd..8a79eeda18d 100644 --- a/src/mesa/x86/sse_xform3.S +++ b/src/mesa/x86/sse_xform3.S @@ -198,6 +198,7 @@ GLNAME(_mesa_sse_transform_points3_3d_no_rot): MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ ADD_L( EDI, ECX ) /* count += dest ptr */ + PXOR( XMM0, XMM0 ) ALIGNTEXT32 MOVSS ( M(0), XMM1 ) /* - | - | - | m0 */ |