mesa/st: enable carry/borrow lowering pass
[mesa.git] / src / mesa / main / ff_fragment_shader.cpp
index e41dcefb0c66c5b3ac577f9a610461641157147d..8c360970f87b6ee6d4ca26cfebcd918900669818 100644 (file)
@@ -42,6 +42,7 @@ extern "C" {
 #include "program/prog_statevars.h"
 #include "program/programopt.h"
 #include "texenvprogram.h"
+#include "texobj.h"
 }
 #include "main/uniforms.h"
 #include "../glsl/glsl_types.h"
@@ -290,18 +291,6 @@ need_saturate( GLuint mode )
    }
 }
 
-
-
-/**
- * Translate TEXTURE_x_BIT to TEXTURE_x_INDEX.
- */
-static GLuint translate_tex_src_bit( GLbitfield bit )
-{
-   ASSERT(bit);
-   return ffs(bit) - 1;
-}
-
-
 #define VERT_BIT_TEX_ANY    (0xff << VERT_ATTRIB_TEX0)
 
 /**
@@ -430,7 +419,7 @@ static GLuint make_state_key( struct gl_context *ctx,  struct state_key *key )
       const struct gl_sampler_object *samp;
       GLenum format;
 
-      if (!texUnit->_ReallyEnabled || !texUnit->Enabled)
+      if (!texUnit->_Current || !texUnit->Enabled)
          continue;
 
       samp = _mesa_get_samplerobj(ctx, i);
@@ -441,8 +430,8 @@ static GLuint make_state_key( struct gl_context *ctx,  struct state_key *key )
       key->nr_enabled_units = i + 1;
       inputs_referenced |= VARYING_BIT_TEX(i);
 
-      key->unit[i].source_index =
-         translate_tex_src_bit(texUnit->_ReallyEnabled);
+      key->unit[i].source_index = _mesa_tex_target_to_index(ctx,
+                                                            texObj->Target);
 
       key->unit[i].shadow =
          ((samp->CompareMode == GL_COMPARE_R_TO_TEXTURE) &&
@@ -1310,7 +1299,7 @@ create_new_program(struct gl_context *ctx, struct state_key *key)
     * fixed function program in a GLES2 context at all, but that's a
     * big mess to clean up.
     */
-   p.shader_program->InternalSeparateShader = GL_TRUE;
+   p.shader_program->SeparateShader = GL_TRUE;
 
    state->language_version = 130;
    state->es_shader = false;
@@ -1344,7 +1333,7 @@ create_new_program(struct gl_context *ctx, struct state_key *key)
    const struct gl_shader_compiler_options *options =
       &ctx->ShaderCompilerOptions[MESA_SHADER_FRAGMENT];
 
-   while (do_common_optimization(p.shader->ir, false, false, 32, options,
+   while (do_common_optimization(p.shader->ir, false, false, options,
                                  ctx->Const.NativeIntegers))
       ;
    reparent_ir(p.shader->ir, p.shader->ir);