From 35e755faa7d0c9e2db079df47804977388c43c99 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 3 Aug 2014 04:36:19 +0200 Subject: [PATCH] st/mesa: make st_init_limits context-independent Reviewed-by: Ilia Mirkin --- src/mesa/state_tracker/st_context.c | 8 +++++++- src/mesa/state_tracker/st_extensions.c | 12 ++++-------- src/mesa/state_tracker/st_extensions.h | 4 +++- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index dc0cdafffed..09b61546582 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -205,7 +205,7 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe, screen->get_param(screen, PIPE_CAP_QUERY_TIME_ELAPSED); /* GL limits and extensions */ - st_init_limits(st); + st_init_limits(st->pipe->screen, &ctx->Const, &ctx->Extensions); st_init_extensions(st->pipe->screen, ctx->API, &ctx->Const, &ctx->Extensions, &st->options, ctx->Mesa_DXTn); @@ -230,6 +230,12 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe, } } + /* called after _mesa_create_context/_mesa_init_point, fix default user + * settable max point size up + */ + st->ctx->Point.MaxSize = MAX2(ctx->Const.MaxPointSize, + ctx->Const.MaxPointSizeAA); + _mesa_compute_version(ctx); _mesa_initialize_dispatch_tables(ctx); diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index c6824d4bd88..2d7b147969a 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -70,10 +70,9 @@ static int _clamp(int a, int min, int max) * Query driver to get implementation limits. * Note that we have to limit/clamp against Mesa's internal limits too. */ -void st_init_limits(struct st_context *st) +void st_init_limits(struct pipe_screen *screen, + struct gl_constants *c, struct gl_extensions *extensions) { - struct pipe_screen *screen = st->pipe->screen; - struct gl_constants *c = &st->ctx->Const; unsigned sh; boolean can_ubo = TRUE; @@ -124,10 +123,7 @@ void st_init_limits(struct st_context *st) c->MaxPointSizeAA = _maxf(1.0f, screen->get_paramf(screen, PIPE_CAPF_MAX_POINT_WIDTH_AA)); - /* called after _mesa_create_context/_mesa_init_point, fix default user - * settable max point size up - */ - st->ctx->Point.MaxSize = MAX2(c->MaxPointSize, c->MaxPointSizeAA); + /* these are not queryable. Note that GL basically mandates a 1.0 minimum * for non-aa sizes, but we can go down to 0.0 for aa points. */ @@ -300,7 +296,7 @@ void st_init_limits(struct st_context *st) screen->get_param(screen, PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS); if (can_ubo) { - st->ctx->Extensions.ARB_uniform_buffer_object = GL_TRUE; + extensions->ARB_uniform_buffer_object = GL_TRUE; c->UniformBufferOffsetAlignment = screen->get_param(screen, PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT); c->MaxCombinedUniformBlocks = c->MaxUniformBufferBindings = diff --git a/src/mesa/state_tracker/st_extensions.h b/src/mesa/state_tracker/st_extensions.h index aa24632577b..8d2724d67f6 100644 --- a/src/mesa/state_tracker/st_extensions.h +++ b/src/mesa/state_tracker/st_extensions.h @@ -33,7 +33,9 @@ struct st_context; struct pipe_screen; -extern void st_init_limits(struct st_context *st); +extern void st_init_limits(struct pipe_screen *screen, + struct gl_constants *c, + struct gl_extensions *extensions); extern void st_init_extensions(struct pipe_screen *screen, gl_api api, -- 2.30.2