[Mesa-dev] [PATCH 2/2] st/mesa: enable GLSL 1.3 for drivers with PIPE_CAP_GLSL130

Christoph Bumiller e0425955 at student.tuwien.ac.at
Mon Jan 9 16:15:45 PST 2012


---
 src/mesa/state_tracker/st_extensions.c     |    8 ++++++++
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp |   14 +++++++++++---
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index a9d4054..c8171ef 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -261,6 +261,8 @@ void st_init_extensions(struct st_context *st)
    int i;
 
    ctx->Const.GLSLVersion = 120;
+   if (screen->get_param(screen, PIPE_CAP_GLSL130))
+      ctx->Const.GLSLVersion = 130;
    _mesa_override_glsl_version(st->ctx);
 
    /* Extensions that only depend on the GLSL version:
@@ -268,6 +270,12 @@ void st_init_extensions(struct st_context *st)
    if (ctx->Const.GLSLVersion >= 130) {
       ctx->Extensions.ARB_conservative_depth = GL_TRUE;
    }
+   /* Limits / preferences that only depend on the GLSL version:
+    */
+   if (ctx->Const.GLSLVersion >= 130) {
+      ctx->Const.NativeIntegers = GL_TRUE;
+      ctx->Const.MaxClipPlanes = 8;
+   }
 
    /*
     * Extensions that are supported by all Gallium drivers:
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 3b8e2fe..be9a422d 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -5010,13 +5010,21 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
       num_clip_distances[i] = get_clip_distance_size(ir);
 
       do {
+         unsigned what_to_lower =
+            MOD_TO_FRACT |
+            DIV_TO_MUL_RCP |
+            EXP_TO_EXP2 |
+            LOG_TO_LOG2;
+         if (options->EmitNoPow)
+            what_to_lower |= POW_TO_EXP2;
+         if (!ctx->Const.NativeIntegers)
+            what_to_lower |= INT_DIV_TO_MUL_RCP;
+
          progress = false;
 
          /* Lowering */
          do_mat_op_to_vec(ir);
-         lower_instructions(ir, (MOD_TO_FRACT | DIV_TO_MUL_RCP | EXP_TO_EXP2
-				 | LOG_TO_LOG2 | INT_DIV_TO_MUL_RCP
-        			 | ((options->EmitNoPow) ? POW_TO_EXP2 : 0)));
+         lower_instructions(ir, what_to_lower);
 
          progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, options->EmitNoCont, options->EmitNoLoops) || progress;
 
-- 
1.7.3.4



More information about the mesa-dev mailing list