Commit 5c691739 authored by Marek Olšák's avatar Marek Olšák

st/mesa: make st_init_extensions context-independent

Setting Const.MaxSamples needed a rework, so that it doesn't call
st_choose_format, which depends on st_context.

Other than that, there is no change in functionality.
Reviewed-by: Ilia Mirkin's avatarIlia Mirkin <>
parent d9a6f436
......@@ -201,10 +201,34 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
!!(screen->get_param(screen, PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK) &
st->has_time_elapsed =
screen->get_param(screen, PIPE_CAP_QUERY_TIME_ELAPSED);
/* GL limits and extensions */
st_init_extensions(st->pipe->screen, ctx->API, &ctx->Const,
&ctx->Extensions, &st->options, ctx->Mesa_DXTn);
/* Enable shader-based fallbacks for ARB_color_buffer_float if needed. */
if (screen->get_param(screen, PIPE_CAP_VERTEX_COLOR_UNCLAMPED)) {
if (!screen->get_param(screen, PIPE_CAP_VERTEX_COLOR_CLAMPED)) {
st->clamp_vert_color_in_shader = GL_TRUE;
if (!screen->get_param(screen, PIPE_CAP_FRAGMENT_COLOR_CLAMPED)) {
st->clamp_frag_color_in_shader = GL_TRUE;
/* For drivers which cannot do color clamping, it's better to just
* disable ARB_color_buffer_float in the core profile, because
* the clamping is deprecated there anyway. */
if (ctx->API == API_OPENGL_CORE &&
(st->clamp_frag_color_in_shader || st->clamp_vert_color_in_shader)) {
st->clamp_vert_color_in_shader = GL_FALSE;
st->clamp_frag_color_in_shader = GL_FALSE;
ctx->Extensions.ARB_color_buffer_float = GL_FALSE;
This diff is collapsed.
......@@ -31,10 +31,16 @@
struct st_context;
struct pipe_screen;
extern void st_init_limits(struct st_context *st);
extern void st_init_extensions(struct st_context *st);
extern void st_init_extensions(struct pipe_screen *screen,
gl_api api,
struct gl_constants *consts,
struct gl_extensions *extensions,
struct st_config_options *options,
boolean has_lib_dxtc);
#endif /* ST_EXTENSIONS_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment