diff options
author | Brian Paul <[email protected]> | 2009-06-24 08:54:37 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-06-24 08:54:37 -0600 |
commit | a04af335a42ce3b28e59ff9b85b2bd433a9d7b12 (patch) | |
tree | 768262f4e8e4a9f49c64b76882c48f1ede445dd5 /src/mesa/main | |
parent | d60b2c68552a2729dfdb33c2bac4822453cf8ae2 (diff) | |
parent | c25534f30d326c15dff845775d9bd55ba6064049 (diff) |
Merge branch 'mesa_7_5_branch'
Conflicts:
src/mesa/drivers/dri/i915/i915_tex_layout.c
src/mesa/drivers/dri/i965/brw_wm_glsl.c
src/mesa/drivers/dri/intel/intel_buffer_objects.c
src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
src/mesa/drivers/dri/intel/intel_pixel_draw.c
src/mesa/main/enums.c
src/mesa/main/texstate.c
src/mesa/vbo/vbo_exec_array.c
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/compiler.h | 4 | ||||
-rw-r--r-- | src/mesa/main/context.c | 41 | ||||
-rw-r--r-- | src/mesa/main/context.h | 3 | ||||
-rw-r--r-- | src/mesa/main/enums.c | 4 | ||||
-rw-r--r-- | src/mesa/main/mipmap.c | 3 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 2 | ||||
-rw-r--r-- | src/mesa/main/teximage.c | 2 |
7 files changed, 40 insertions, 19 deletions
diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h index 93103fe878d..e79bbc2ac5f 100644 --- a/src/mesa/main/compiler.h +++ b/src/mesa/main/compiler.h @@ -468,9 +468,9 @@ do { \ #endif - +#ifndef Elements #define Elements(x) (sizeof(x)/sizeof(*(x))) - +#endif diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index eafe292a1f2..a0681c84149 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1259,6 +1259,24 @@ initialize_framebuffer_size(GLcontext *ctx, GLframebuffer *fb) /** + * Check if the viewport/scissor size has not yet been initialized. + * Initialize the size if the given width and height are non-zero. + */ +void +_mesa_check_init_viewport(GLcontext *ctx, GLuint width, GLuint height) +{ + if (!ctx->ViewportInitialized && width > 0 && height > 0) { + /* Note: set flag here, before calling _mesa_set_viewport(), to prevent + * potential infinite recursion. + */ + ctx->ViewportInitialized = GL_TRUE; + _mesa_set_viewport(ctx, 0, 0, width, height); + _mesa_set_scissor(ctx, 0, 0, width, height); + } +} + + +/** * Bind the given context to the given drawBuffer and readBuffer and * make it the current context for the calling thread. * We'll render into the drawBuffer and read pixels from the @@ -1375,25 +1393,24 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer, ASSERT(drawBuffer->Height > 0); #endif - if (newCtx->FirstTimeCurrent) { - /* set initial viewport and scissor size now */ - _mesa_set_viewport(newCtx, 0, 0, - drawBuffer->Width, drawBuffer->Height); - _mesa_set_scissor(newCtx, 0, 0, - drawBuffer->Width, drawBuffer->Height ); - check_context_limits(newCtx); + if (drawBuffer) { + _mesa_check_init_viewport(newCtx, + drawBuffer->Width, drawBuffer->Height); } } - /* We can use this to help debug user's problems. Tell them to set - * the MESA_INFO env variable before running their app. Then the - * first time each context is made current we'll print some useful - * information. - */ if (newCtx->FirstTimeCurrent) { + check_context_limits(newCtx); + + /* We can use this to help debug user's problems. Tell them to set + * the MESA_INFO env variable before running their app. Then the + * first time each context is made current we'll print some useful + * information. + */ if (_mesa_getenv("MESA_INFO")) { _mesa_print_info(); } + newCtx->FirstTimeCurrent = GL_FALSE; } } diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index 6b3e1b2b973..0531ae8ee86 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -130,6 +130,9 @@ extern void _mesa_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask); +extern void +_mesa_check_init_viewport(GLcontext *ctx, GLuint width, GLuint height); + extern GLboolean _mesa_make_current( GLcontext *ctx, GLframebuffer *drawBuffer, GLframebuffer *readBuffer ); diff --git a/src/mesa/main/enums.c b/src/mesa/main/enums.c index 2745fb3d66d..87ff67dd112 100644 --- a/src/mesa/main/enums.c +++ b/src/mesa/main/enums.c @@ -958,8 +958,8 @@ LONGSTRING static const char enum_string_table[] = "GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV\0" "GL_MAX_VARYING_FLOATS\0" "GL_MAX_VARYING_FLOATS_ARB\0" - "GL_MAX_VERTEX_ATTRIBS\0" - "GL_MAX_VERTEX_ATTRIBS_ARB\0" + "GL_MAX_VERTEX_GENERIC_ATTRIBS\0" + "GL_MAX_VERTEX_GENERIC_ATTRIBS_ARB\0" "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS\0" "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB\0" "GL_MAX_VERTEX_UNIFORM_COMPONENTS\0" diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 872982fa430..3dca09d9f28 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1601,9 +1601,6 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, return; } - if (dstImage->ImageOffsets) - _mesa_free(dstImage->ImageOffsets); - /* Free old image data */ if (dstImage->Data) ctx->Driver.FreeTexImageData(ctx, dstImage); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 0c071ee19a0..d1614af7364 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2979,6 +2979,8 @@ struct __GLcontextRec GLenum RenderMode; /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */ GLbitfield NewState; /**< bitwise-or of _NEW_* flags */ + GLboolean ViewportInitialized; /**< has viewport size been initialized? */ + GLbitfield varying_vp_inputs; /**< mask of VERT_BIT_* flags */ /** \name Derived state */ diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 76b46d700b5..6e21066537b 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1250,6 +1250,8 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target, * We allocate the array for 1D/2D textures too in order to avoid special- * case code in the texstore routines. */ + if (img->ImageOffsets) + _mesa_free(img->ImageOffsets); img->ImageOffsets = (GLuint *) _mesa_malloc(depth * sizeof(GLuint)); for (i = 0; i < depth; i++) { img->ImageOffsets[i] = i * width * height; |