diff options
author | Brian <brian.paul@tungstengraphics.com> | 2008-02-06 08:44:19 -0700 |
---|---|---|
committer | Ben Skeggs <skeggsb@gmail.com> | 2008-02-15 13:50:32 +1100 |
commit | 20f16a6ae44f55c2efa03a2c9deb07b66fe1b0e0 (patch) | |
tree | dbde50b58d459e91179fb8ec449b15fd55e456b8 /src/mesa | |
parent | 30c9e12f8d20a950b39577ea2b4a2e7a850dfe10 (diff) |
clean-ups in guess_and_alloc_texture()
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_cb_texture.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 15c5359360..8db4a804ab 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -284,7 +284,12 @@ logbase2(int n) } -/* Otherwise, store it in memory if (Border != 0) or (any dimension == +/** + * Allocate a pipe_texture object for the given st_texture_object using + * the given st_texture_image to guess the mipmap size/levels. + * + * [comments...] + * Otherwise, store it in memory if (Border != 0) or (any dimension == * 1). * * Otherwise, if max_level >= level >= min_level, create texture with @@ -303,11 +308,12 @@ guess_and_alloc_texture(struct st_context *st, GLuint width = stImage->base.Width; GLuint height = stImage->base.Height; GLuint depth = stImage->base.Depth; - GLuint l2width, l2height, l2depth; GLuint i, comp_byte = 0; DBG("%s\n", __FUNCTION__); + assert(!stObj->pt); + if (stImage->base.Border) return; @@ -349,15 +355,15 @@ guess_and_alloc_texture(struct st_context *st, lastLevel = firstLevel; } else { - l2width = logbase2(width); - l2height = logbase2(height); - l2depth = logbase2(depth); + GLuint l2width = logbase2(width); + GLuint l2height = logbase2(height); + GLuint l2depth = logbase2(depth); lastLevel = firstLevel + MAX2(MAX2(l2width, l2height), l2depth); } - assert(!stObj->pt); if (stImage->base.IsCompressed) comp_byte = compressed_num_bytes(stImage->base.TexFormat->MesaFormat); + stObj->pt = st_texture_create(st, gl_target_to_pipe(stObj->base.Target), st_mesa_format_to_pipe_format(stImage->base.TexFormat->MesaFormat), |