diff options
author | Brian Paul <[email protected]> | 2010-05-03 15:39:40 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2010-05-03 15:39:40 -0600 |
commit | 41b8a2e9391cd85a65ba30a7e5f5068b5767d58a (patch) | |
tree | ba1d6ddf338cfdeede160afad07390e1a024e1fc /src/mesa | |
parent | 682fec0dca5bfd38ff9943663b7647e600fc4c1d (diff) |
st/mesa: move some texture size calculation code
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_cb_texture.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 60e1d4208a8..cd15e3a1457 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -526,7 +526,6 @@ st_TexImage(GLcontext * ctx, struct pipe_screen *screen = st->pipe->screen; struct st_texture_object *stObj = st_texture_object(texObj); struct st_texture_image *stImage = st_texture_image(texImage); - GLint texelBytes, sizeInBytes; GLuint dstRowStride = 0; struct gl_pixelstore_attrib unpackNB; enum pipe_transfer_usage transfer_usage = 0; @@ -562,14 +561,6 @@ st_TexImage(GLcontext * ctx, _mesa_set_fetch_functions(texImage, dims); - if (_mesa_is_format_compressed(texImage->TexFormat)) { - /* must be a compressed format */ - texelBytes = 0; - } - else { - texelBytes = _mesa_get_format_bytes(texImage->TexFormat); - } - /* Release the reference to a potentially orphaned buffer. * Release any old malloced memory. */ @@ -667,6 +658,7 @@ st_TexImage(GLcontext * ctx, } if (stImage->pt) { + /* Store the image in the gallium texture memory buffer */ if (format == GL_DEPTH_COMPONENT && util_format_is_depth_and_stencil(stImage->pt->format)) transfer_usage = PIPE_TRANSFER_READ_WRITE; @@ -682,6 +674,8 @@ st_TexImage(GLcontext * ctx, } else { /* Allocate regular memory and store the image there temporarily. */ + GLint sizeInBytes; + if (_mesa_is_format_compressed(texImage->TexFormat)) { sizeInBytes = _mesa_format_image_size(texImage->TexFormat, texImage->Width, @@ -691,6 +685,8 @@ st_TexImage(GLcontext * ctx, assert(dims != 3); } else { + GLint texelBytes; + texelBytes = _mesa_get_format_bytes(texImage->TexFormat); dstRowStride = width * texelBytes; sizeInBytes = depth * dstRowStride * height; } @@ -707,7 +703,7 @@ st_TexImage(GLcontext * ctx, goto done; DBG("Upload image %dx%dx%d row_len %x pitch %x\n", - width, height, depth, width * texelBytes, dstRowStride); + width, height, depth, width, dstRowStride); /* Copy data. Would like to know when it's ok for us to eg. use * the blitter to copy. Or, use the hardware to do the format |