Remove internal_format field from struct pipe_texture.
authorMichel Dänzer <michel@tungstengraphics.com>
Tue, 11 Dec 2007 18:02:26 +0000 (19:02 +0100)
committerMichel Dänzer <michel@tungstengraphics.com>
Tue, 11 Dec 2007 18:10:56 +0000 (19:10 +0100)
It's state tracker specific / not really necessary anyway.

src/mesa/pipe/p_state.h
src/mesa/state_tracker/st_cb_drawpixels.c
src/mesa/state_tracker/st_cb_texture.c
src/mesa/state_tracker/st_texture.c
src/mesa/state_tracker/st_texture.h

index 109913b..4e42838 100644 (file)
@@ -264,10 +264,9 @@ struct pipe_texture
 { 
    /* Effectively the key:
     */
-   unsigned target;            /* XXX convert to PIPE_TEXTURE_x */
-   unsigned internal_format;   /* XXX convert to PIPE_FORMAT_x */
-
+   unsigned target;            /**< PIPE_TEXTURE_x */
    enum pipe_format format;    /**< PIPE_FORMAT_x */
+
    unsigned first_level;
    unsigned last_level;
 
index 5d4c443..0bc48b7 100644 (file)
@@ -469,8 +469,8 @@ make_texture(struct st_context *st,
    assert(pipeFormat);
    cpp = st_sizeof_format(pipeFormat);
 
-   pt = st_texture_create(st, PIPE_TEXTURE_2D, pipeFormat, baseFormat, 0, 0,
-                         width, height, 1, 0);
+   pt = st_texture_create(st, PIPE_TEXTURE_2D, pipeFormat, 0, 0, width, height,
+                         1, 0);
    if (!pt)
       return NULL;
 
@@ -987,7 +987,6 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
    struct pipe_context *pipe = ctx->st->pipe;
    struct pipe_surface *surface;
    uint format = 0, cpp, comp;
-   GLenum internal_format;
    ubyte *dest;
    struct pipe_texture *pt;
    int row, col;
@@ -995,13 +994,11 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
    /* find a texture format we know */
    if (pipe->is_format_supported( pipe, PIPE_FORMAT_U_I8, PIPE_TEXTURE )) {
       format = PIPE_FORMAT_U_I8;
-      internal_format = GL_INTENSITY8;
       cpp = 1;
       comp = 0;
    }
    else if (pipe->is_format_supported( pipe, PIPE_FORMAT_A8R8G8B8_UNORM, PIPE_TEXTURE )) {
       format = PIPE_FORMAT_A8R8G8B8_UNORM;
-      internal_format = GL_RGBA8;
       cpp = 4;
       comp = 3; /* alpha channel */ /*XXX little-endian dependency */
    }
@@ -1013,8 +1010,8 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
    /**
     * Create a texture.
     */
-   pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, format, internal_format,
-                         0, 0, width, height, 1, 0);
+   pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, format, 0, 0, width, height,
+                         1, 0);
    if (!pt)
       return NULL;
 
@@ -1237,8 +1234,8 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
    psRead = rbRead->surface;
    format = psRead->format;
 
-   pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, format,
-                         rbRead->Base.InternalFormat, 0, 0, width, height, 1, 0);
+   pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, format, 0, 0, width, height,
+                         1, 0);
    if (!pt)
       return;
 
index 39dd21d..e813bdb 100644 (file)
@@ -366,7 +366,6 @@ guess_and_alloc_texture(struct st_context *st,
    stObj->pt = st_texture_create(st,
                                  gl_target_to_pipe(stObj->base.Target),
                                  st_mesa_format_to_pipe_format(stImage->base.TexFormat->MesaFormat),
-                                stImage->base.InternalFormat,
                                  firstLevel,
                                  lastLevel,
                                  width,
@@ -1481,7 +1480,8 @@ st_finalize_texture(GLcontext *ctx,
     */
    if (stObj->pt &&
        (stObj->pt->target != gl_target_to_pipe(stObj->base.Target) ||
-       stObj->pt->internal_format != firstImage->base.InternalFormat ||
+       stObj->pt->format !=
+       st_mesa_format_to_pipe_format(firstImage->base.TexFormat->MesaFormat) ||
        stObj->pt->first_level != stObj->firstLevel ||
        stObj->pt->last_level != stObj->lastLevel ||
        stObj->pt->width[0] != firstImage->base.Width ||
@@ -1499,7 +1499,6 @@ st_finalize_texture(GLcontext *ctx,
       stObj->pt = st_texture_create(ctx->st,
                                     gl_target_to_pipe(stObj->base.Target),
                                     st_mesa_format_to_pipe_format(firstImage->base.TexFormat->MesaFormat),
-                                   firstImage->base.InternalFormat,
                                     stObj->firstLevel,
                                     stObj->lastLevel,
                                     firstImage->base.Width,
index 1ec4514..c7d28ee 100644 (file)
@@ -63,7 +63,6 @@ struct pipe_texture *
 st_texture_create(struct st_context *st,
                   unsigned target,
                  unsigned format,
-                 GLenum internal_format,
                  GLuint first_level,
                  GLuint last_level,
                  GLuint width0,
@@ -77,7 +76,7 @@ st_texture_create(struct st_context *st,
 
    DBG("%s target %s format %s level %d..%d\n", __FUNCTION__,
        _mesa_lookup_enum_by_nr(target),
-       _mesa_lookup_enum_by_nr(internal_format), first_level, last_level);
+       _mesa_lookup_enum_by_nr(format), first_level, last_level);
 
    if (!pt)
       return NULL;
@@ -86,7 +85,6 @@ st_texture_create(struct st_context *st,
 
    pt->target = target;
    pt->format = format;
-   pt->internal_format = internal_format;
    pt->first_level = first_level;
    pt->last_level = last_level;
    pt->width[0] = width0;
@@ -119,7 +117,7 @@ st_texture_match_image(struct pipe_texture *pt,
    if (image->Border) 
       return GL_FALSE;
 
-   if (image->InternalFormat != pt->internal_format ||
+   if (st_mesa_format_to_pipe_format(image->TexFormat->MesaFormat) != pt->format ||
        image->IsCompressed != pt->compressed)
       return GL_FALSE;
 
index 2be53ab..7524c21 100644 (file)
@@ -39,7 +39,6 @@ extern struct pipe_texture *
 st_texture_create(struct st_context *st,
                   unsigned target,
                  unsigned format,
-                  GLenum internal_format,
                   GLuint first_level,
                   GLuint last_level,
                   GLuint width0,