diff options
author | Marek Olšák <[email protected]> | 2012-01-24 22:23:01 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-01-29 02:16:00 +0100 |
commit | 171be755223d99f8cc5cc1bdaf8bd7b4caa04b4f (patch) | |
tree | 4fa7b708b29027241eda8262dfa0c0e50fc8b2b4 /src/mesa/state_tracker/st_extensions.c | |
parent | 1d01429c6a1ae679d0cc0cb61db1948fca5ced4c (diff) |
st/mesa: add PIPE_CAP_GLSL_FEATURE_LEVEL, cleanup st_extensions.c
v2: handle the cap in r300 and r600 as well
Additional info for r600g:
The env var R600_GLSL130=1 enables GLSL 1.3.
Along with R600_STREAMOUT=1, it enables full GL 3.
Diffstat (limited to 'src/mesa/state_tracker/st_extensions.c')
-rw-r--r-- | src/mesa/state_tracker/st_extensions.c | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 49709d34260..f8b9ff879eb 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -258,10 +258,7 @@ void st_init_extensions(struct st_context *st) { struct pipe_screen *screen = st->pipe->screen; struct gl_context *ctx = st->ctx; - int i; - - ctx->Const.GLSLVersion = 120; - _mesa_override_glsl_version(st->ctx); + int i, glsl_feature_level; /* * Extensions that are supported by all Gallium drivers: @@ -330,6 +327,33 @@ void st_init_extensions(struct st_context *st) ctx->Extensions.OES_draw_texture = GL_TRUE; #endif + /* Figure out GLSL support. */ + glsl_feature_level = screen->get_param(screen, PIPE_CAP_GLSL_FEATURE_LEVEL); + + if (glsl_feature_level >= 130) { + ctx->Const.GLSLVersion = 130; + } else { + ctx->Const.GLSLVersion = 120; + } + + _mesa_override_glsl_version(st->ctx); + + if (ctx->Const.GLSLVersion >= 130) { + ctx->Const.NativeIntegers = GL_TRUE; + ctx->Const.MaxClipPlanes = 8; + + /* Extensions that only depend on GLSL 1.3. */ + ctx->Extensions.ARB_conservative_depth = GL_TRUE; + } else { + /* Optional integer support for GLSL 1.2. */ + if (screen->get_shader_param(screen, PIPE_SHADER_VERTEX, + PIPE_SHADER_CAP_INTEGERS) && + screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT, + PIPE_SHADER_CAP_INTEGERS)) { + ctx->Const.NativeIntegers = GL_TRUE; + } + } + /* * Extensions that depend on the driver/hardware: */ @@ -578,23 +602,6 @@ void st_init_extensions(struct st_context *st) #endif } - if (screen->get_shader_param(screen, PIPE_SHADER_VERTEX, - PIPE_SHADER_CAP_INTEGERS) && - screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT, - PIPE_SHADER_CAP_INTEGERS)) { - ctx->Const.NativeIntegers = GL_TRUE; - } - - if (ctx->Const.NativeIntegers) - ctx->Const.GLSLVersion = 130; - - /* Extensions that only depend on the GLSL version: - */ - if (ctx->Const.GLSLVersion >= 130) { - ctx->Extensions.ARB_conservative_depth = GL_TRUE; - ctx->Const.MaxClipPlanes = 8; - } - ctx->Extensions.NV_primitive_restart = GL_TRUE; if (!screen->get_param(screen, PIPE_CAP_PRIMITIVE_RESTART)) { st->sw_primitive_restart = GL_TRUE; |