From: Brian Date: Fri, 10 Aug 2007 19:11:47 +0000 (-0600) Subject: don't hardcode cpp X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6ccdd5bb15d03b7eadc0f1e3ddba8848de4f146e;p=mesa.git don't hardcode cpp --- diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index afe03429579..81b48859f0c 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -102,16 +102,18 @@ make_mipmap_tree(struct st_context *st, { struct pipe_context *pipe = st->pipe; const struct gl_texture_format *mformat; - GLuint pipeFormat = st_choose_pipe_format(st->pipe, GL_RGBA, format, type); - int cpp = 4; - struct pipe_mipmap_tree *mt = CALLOC_STRUCT(pipe_mipmap_tree); - GLbitfield flags = PIPE_SURFACE_FLAG_TEXTURE; + const GLbitfield flags = PIPE_SURFACE_FLAG_TEXTURE; + struct pipe_mipmap_tree *mt; + GLuint pipeFormat, cpp; mformat = st_ChooseTextureFormat(st->ctx, GL_RGBA, format, type); - assert(format); + assert(mformat); pipeFormat = st_mesa_format_to_pipe_format(mformat->MesaFormat); assert(pipeFormat); + cpp = st_sizeof_format(pipeFormat); + + mt = CALLOC_STRUCT(pipe_mipmap_tree); if (unpack->BufferObj && unpack->BufferObj->Name) { /* @@ -137,7 +139,7 @@ make_mipmap_tree(struct st_context *st, mformat, /* gl_texture_format */ dest, /* dest */ 0, 0, 0, /* dstX/Y/Zoffset */ - pitch * cpp, /* dstRowStride */ + pitch * cpp, /* dstRowStride, bytes */ &dstImageOffsets, /* dstImageOffsets */ width, height, 1, /* size */ format, type, /* src format/type */