main: remove extern C around #includes in ff_fragment_shader.cpp
[mesa.git] / src / mesa / main / texstate.c
index 3a7e2273f90d70a3dab256cf7862140458b61285..e0f085218320d543f89204410ed1546c2dc62a0b 100644 (file)
@@ -91,10 +91,6 @@ _mesa_copy_texture_state( const struct gl_context *src, struct gl_context *dst )
       /* GL_EXT_texture_env_combine */
       dst->Texture.Unit[u].Combine = src->Texture.Unit[u].Combine;
 
-      /* GL_ATI_envmap_bumpmap - need this? */
-      dst->Texture.Unit[u].BumpTarget = src->Texture.Unit[u].BumpTarget;
-      COPY_4V(dst->Texture.Unit[u].RotMatrix, src->Texture.Unit[u].RotMatrix);
-
       /*
        * XXX strictly speaking, we should compare texture names/ids and
        * bind textures in the dest context according to id.  For now, only
@@ -108,7 +104,12 @@ _mesa_copy_texture_state( const struct gl_context *src, struct gl_context *dst )
          for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) {
             _mesa_reference_texobj(&dst->Texture.Unit[u].CurrentTex[tex],
                                    src->Texture.Unit[u].CurrentTex[tex]);
+            if (src->Texture.Unit[u].CurrentTex[tex]) {
+               dst->Texture.NumCurrentTexUsed =
+                  MAX2(dst->Texture.NumCurrentTexUsed, u + 1);
+            }
          }
+         dst->Texture.Unit[u]._BoundTextures = src->Texture.Unit[u]._BoundTextures;
          _mesa_unlock_context_textures(dst);
       }
    }
@@ -183,7 +184,6 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state,
    case GL_RG:
    case GL_RGB:
    case GL_YCBCR_MESA:
-   case GL_DUDV_ATI:
       state->SourceA[0] = GL_PREVIOUS;
       break;
       
@@ -225,7 +225,6 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state,
       case GL_RG:
       case GL_RGB:
       case GL_YCBCR_MESA:
-      case GL_DUDV_ATI:
         mode_rgb = GL_REPLACE;
         break;
       case GL_RGBA:
@@ -254,7 +253,6 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state,
       case GL_LUMINANCE_ALPHA:
       case GL_RGBA:
       case GL_YCBCR_MESA:
-      case GL_DUDV_ATI:
         state->SourceRGB[2] = GL_TEXTURE;
         state->SourceA[2]   = GL_TEXTURE;
         state->SourceRGB[0] = GL_CONSTANT;
@@ -438,10 +436,6 @@ update_tex_combine(struct gl_context *ctx, struct gl_texture_unit *texUnit)
    case GL_MODULATE_SUBTRACT_ATI:
       combine->_NumArgsRGB = 3;
       break;
-   case GL_BUMP_ENVMAP_ATI:
-      /* no real arguments for this case */
-      combine->_NumArgsRGB = 0;
-      break;
    default:
       combine->_NumArgsRGB = 0;
       _mesa_problem(ctx, "invalid RGB combine mode in update_texture_state");
@@ -522,6 +516,7 @@ update_single_program_texture(struct gl_context *ctx, struct gl_program *prog,
    gl_texture_index target_index;
    struct gl_texture_unit *texUnit;
    struct gl_texture_object *texObj;
+   struct gl_sampler_object *sampler;
    int unit;
 
    if (!(prog->SamplersUsed & (1 << s)))
@@ -543,7 +538,7 @@ update_single_program_texture(struct gl_context *ctx, struct gl_program *prog,
    target_index = ffs(prog->TexturesUsed[unit]) - 1;
    texObj = texUnit->CurrentTex[target_index];
 
-   struct gl_sampler_object *sampler = texUnit->Sampler ?
+   sampler = texUnit->Sampler ?
       texUnit->Sampler : &texObj->Sampler;
 
    if (likely(texObj)) {
@@ -842,7 +837,6 @@ init_texture_unit( struct gl_context *ctx, GLuint unit )
    texUnit->Combine = default_combine_state;
    texUnit->_EnvMode = default_combine_state;
    texUnit->_CurrentCombine = & texUnit->_EnvMode;
-   texUnit->BumpTarget = GL_TEXTURE0;
 
    texUnit->TexGenEnabled = 0x0;
    texUnit->GenS.Mode = GL_EYE_LINEAR;
@@ -864,14 +858,13 @@ init_texture_unit( struct gl_context *ctx, GLuint unit )
    ASSIGN_4V( texUnit->GenR.EyePlane, 0.0, 0.0, 0.0, 0.0 );
    ASSIGN_4V( texUnit->GenQ.EyePlane, 0.0, 0.0, 0.0, 0.0 );
 
-   /* no mention of this in spec, but maybe id matrix expected? */
-   ASSIGN_4V( texUnit->RotMatrix, 1.0, 0.0, 0.0, 1.0 );
-
    /* initialize current texture object ptrs to the shared default objects */
    for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) {
       _mesa_reference_texobj(&texUnit->CurrentTex[tex],
                              ctx->Shared->DefaultTex[tex]);
    }
+
+   texUnit->_BoundTextures = 0;
 }
 
 
@@ -912,6 +905,8 @@ _mesa_init_texture(struct gl_context *ctx)
    _mesa_reference_buffer_object(ctx, &ctx->Texture.BufferObject,
                                  ctx->Shared->NullBufferObj);
 
+   ctx->Texture.NumCurrentTexUsed = 0;
+
    return GL_TRUE;
 }