mesa: consolidate internal glTexSubImage1/2/3D code
[mesa.git] / src / mesa / state_tracker / st_texture.h
index 903e30df52f413d982a99dcccd5d7575aadc955b..62e975bb457753de14c96b94170de68677d04398 100644 (file)
@@ -45,13 +45,13 @@ struct st_texture_image
 {
    struct gl_texture_image base;
 
-   /* These aren't stored in gl_texture_image 
+   /** Used to store texture data that doesn't fit in the parent
+    * object's mipmap buffer.
     */
-   GLuint level;
-   GLuint face;
+   GLubyte *TexData;
 
    /* If stImage->pt != NULL, image data is stored here.
-    * Else if stImage->base.Data != NULL, image is stored there.
+    * Else if stImage->TexData != NULL, image is stored there.
     * Else there is no image data.
     */
    struct pipe_resource *pt;
@@ -122,18 +122,6 @@ st_get_stobj_resource(struct st_texture_object *stObj)
 }
 
 
-static INLINE struct pipe_sampler_view *
-st_create_texture_sampler_view(struct pipe_context *pipe,
-                               struct pipe_resource *texture)
-{
-   struct pipe_sampler_view templ;
-
-   u_sampler_view_default_template(&templ, texture, texture->format);
-
-   return pipe->create_sampler_view(pipe, texture, &templ);
-}
-
-
 static INLINE struct pipe_sampler_view *
 st_create_texture_sampler_view_format(struct pipe_context *pipe,
                                       struct pipe_resource *texture,
@@ -146,37 +134,15 @@ st_create_texture_sampler_view_format(struct pipe_context *pipe,
    return pipe->create_sampler_view(pipe, texture, &templ);
 }
 
-
 static INLINE struct pipe_sampler_view *
-st_get_texture_sampler_view(struct st_texture_object *stObj,
-                            struct pipe_context *pipe)
+st_create_texture_sampler_view(struct pipe_context *pipe,
+                               struct pipe_resource *texture)
 {
-   if (!stObj || !stObj->pt) {
-      return NULL;
-   }
-
-   if (!stObj->sampler_view) {
-      stObj->sampler_view = st_create_texture_sampler_view(pipe, stObj->pt);
-   }
-
-   return stObj->sampler_view;
+   return st_create_texture_sampler_view_format(pipe, texture,
+                                                texture->format);
 }
 
 
-/**
- * Get pointer to the active sampler object for the given texture unit.
- * This will either be a user-defined sampler object or the texture
- * object's own sampler state.
- */
-static INLINE struct gl_sampler_object *
-st_get_mesa_sampler(const struct gl_context *ctx, GLuint unit)
-{
-   if (ctx->Texture.Unit[unit].Sampler)
-      return ctx->Texture.Unit[unit].Sampler;
-   else
-      return &ctx->Texture.Unit[unit]._Current->Sampler;
-}
-
 
 extern struct pipe_resource *
 st_texture_create(struct st_context *st,
@@ -204,8 +170,7 @@ st_gl_texture_dims_to_pipe_dims(GLenum texture,
  */
 extern GLboolean
 st_texture_match_image(const struct pipe_resource *pt,
-                       const struct gl_texture_image *image,
-                       GLuint face, GLuint level);
+                       const struct gl_texture_image *image);
 
 /* Return a pointer to an image within a texture.  Return image stride as
  * well.
@@ -247,4 +212,8 @@ st_texture_image_copy(struct pipe_context *pipe,
                       struct pipe_resource *src, GLuint srcLevel,
                       GLuint face);
 
+
+extern struct pipe_resource *
+st_create_color_map_texture(struct gl_context *ctx);
+
 #endif