radeon: add missing fallthrough comments
[mesa.git] / src / mesa / main / ff_fragment_shader.cpp
index 2b924f6d1011e9b811b8bdd37fa714578bf875e2..05633d0d7d455b11d9b9db4eedbc2177c6f65c4f 100644 (file)
@@ -1,10 +1,10 @@
 /**************************************************************************
- * 
+ *
  * Copyright 2007 VMware, Inc.
  * All Rights Reserved.
  * Copyright 2009 VMware, Inc.  All Rights Reserved.
  * Copyright © 2010-2011 Intel Corporation
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * "Software"), to deal in the Software without restriction, including
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- * 
+ *
  **************************************************************************/
 
 #include "main/glheader.h"
 #include "main/context.h"
-#include "main/imports.h"
+
 #include "main/macros.h"
 #include "main/samplerobj.h"
 #include "main/shaderobj.h"
@@ -180,7 +180,9 @@ static GLbitfield filter_fp_input_mask( GLbitfield fp_inputs,
       GLbitfield possible_inputs = 0;
 
       /* _NEW_VARYING_VP_INPUTS */
-      GLbitfield64 varying_inputs = ctx->varying_vp_inputs;
+      GLbitfield varying_inputs = ctx->varying_vp_inputs;
+      /* We only update ctx->varying_vp_inputs when in VP_MODE_FF _VPMode */
+      assert(VP_MODE_FF == ctx->VertexProgram._VPMode);
 
       /* These get generated in the setup routine regardless of the
        * vertex program:
@@ -229,7 +231,11 @@ static GLbitfield filter_fp_input_mask( GLbitfield fp_inputs,
     * since vertex shader state validation comes after fragment state
     * validation (see additional comments in state.c).
     */
-   if (vertexShader)
+   if (ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY] != NULL)
+      vprog = ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY];
+   else if (ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL] != NULL)
+      vprog = ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL];
+   else if (vertexShader)
       vprog = ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
    else
       vprog = ctx->VertexProgram.Current;
@@ -268,7 +274,8 @@ static GLuint make_state_key( struct gl_context *ctx,  struct state_key *key )
       i = u_bit_scan(&mask);
       const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
       const struct gl_texture_object *texObj = texUnit->_Current;
-      const struct gl_tex_env_combine_packed *comb = &texUnit->_CurrentCombinePacked;
+      const struct gl_tex_env_combine_packed *comb =
+         &ctx->Texture.FixedFuncUnit[i]._CurrentCombinePacked;
 
       if (!texObj)
          continue;
@@ -496,7 +503,7 @@ static GLboolean args_match( const struct state_key *key, GLuint unit )
            return GL_FALSE;
         }
         break;
-      default: 
+      default:
         return GL_FALSE;       /* impossible */
       }
    }
@@ -580,7 +587,7 @@ emit_combine(texenv_fragment_program *p,
    case TEXENV_MODE_ADD_PRODUCTS_SIGNED_NV:
       return add(add(mul(src[0], src[1]), mul(src[2], src[3])),
                 new(p->mem_ctx) ir_constant(-0.5f));
-   default: 
+   default:
       assert(0);
       return src[0];
    }
@@ -599,7 +606,7 @@ emit_texenv(texenv_fragment_program *p, GLuint unit)
    if (!key->unit[unit].enabled) {
       return get_source(p, TEXENV_SRC_PREVIOUS, 0);
    }
-   
+
    switch (key->unit[unit].ModeRGB) {
    case TEXENV_MODE_DOT3_RGB_EXT:
       alpha_shift = key->unit[unit].ScaleShiftA;
@@ -614,7 +621,7 @@ emit_texenv(texenv_fragment_program *p, GLuint unit)
       alpha_shift = key->unit[unit].ScaleShiftA;
       break;
    }
-   
+
    /* If we'll do rgb/alpha shifting don't saturate in emit_combine().
     * We don't want to clamp twice.
     */
@@ -862,7 +869,7 @@ load_texenv_source(texenv_fragment_program *p,
    case TEXENV_SRC_TEXTURE7:
       load_texture(p, src - TEXENV_SRC_TEXTURE0);
       break;
-      
+
    default:
       /* not a texture src - do nothing */
       break;
@@ -1116,7 +1123,7 @@ create_new_program(struct gl_context *ctx, struct state_key *key)
 
    reparent_ir(p.shader->ir, p.shader->ir);
 
-   p.shader->CompileStatus = compile_success;
+   p.shader->CompileStatus = COMPILE_SUCCESS;
    p.shader->Version = state->language_version;
    p.shader_program->Shaders =
       (gl_shader **)malloc(sizeof(*p.shader_program->Shaders));