/* Constants, may be overriden (usually only reduced) by device drivers */
consts->MaxTextureMbytes = MAX_TEXTURE_MBYTES;
- consts->MaxTextureLevels = MAX_TEXTURE_LEVELS;
+ consts->MaxTextureSize = 1 << (MAX_TEXTURE_LEVELS - 1);
consts->Max3DTextureLevels = MAX_3D_TEXTURE_LEVELS;
consts->MaxCubeTextureLevels = MAX_CUBE_TEXTURE_LEVELS;
consts->MaxTextureRectSize = MAX_TEXTURE_RECT_SIZE;
/* Texture size checks */
- assert(ctx->Const.MaxTextureLevels <= MAX_TEXTURE_LEVELS);
+ assert(ctx->Const.MaxTextureSize <= (1 << (MAX_TEXTURE_LEVELS - 1)));
assert(ctx->Const.Max3DTextureLevels <= MAX_3D_TEXTURE_LEVELS);
assert(ctx->Const.MaxCubeTextureLevels <= MAX_CUBE_TEXTURE_LEVELS);
assert(ctx->Const.MaxTextureRectSize <= MAX_TEXTURE_RECT_SIZE);
assert(MAX_TEXTURE_LEVELS >= MAX_CUBE_TEXTURE_LEVELS);
/* Max texture size should be <= max viewport size (render to texture) */
- assert((1U << (ctx->Const.MaxTextureLevels - 1))
- <= ctx->Const.MaxViewportWidth);
- assert((1U << (ctx->Const.MaxTextureLevels - 1))
- <= ctx->Const.MaxViewportHeight);
+ assert(ctx->Const.MaxTextureSize <= ctx->Const.MaxViewportWidth);
+ assert(ctx->Const.MaxTextureSize <= ctx->Const.MaxViewportHeight);
assert(ctx->Const.MaxDrawBuffers <= MAX_DRAW_BUFFERS);
/* misc one-time initializations */
one_time_init(ctx);
+ _mesa_init_shader_compiler_types();
+
/* Plug in driver functions and context pointer here.
* This is important because when we call alloc_shared_state() below
* we'll call ctx->Driver.NewTextureObject() to create the default
* \sa _mesa_initialize_context() and init_attrib_groups().
*/
void
-_mesa_free_context_data( struct gl_context *ctx )
+_mesa_free_context_data(struct gl_context *ctx, bool destroy_compiler_types)
{
if (!_mesa_get_current_context()){
/* No current context, but we may need one in order to delete
free(ctx->VersionString);
+ if (destroy_compiler_types)
+ _mesa_destroy_shader_compiler_types();
+
/* unbind the context if it's currently bound */
if (ctx == _mesa_get_current_context()) {
_mesa_make_current(NULL, NULL, NULL);
_mesa_destroy_context( struct gl_context *ctx )
{
if (ctx) {
- _mesa_free_context_data(ctx);
+ _mesa_free_context_data(ctx, true);
free( (void *) ctx );
}
}