diff options
author | Brian Paul <brianp@vmware.com> | 2009-11-17 21:16:16 -0700 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2009-11-17 22:28:49 -0700 |
commit | 935799d1286aceaefcc21dcfec4c26922e4f281f (patch) | |
tree | ebd1aaaa2339b86b25a3caabd9a62acf37b93435 | |
parent | f5ffe5e531f560b9f3707170d0ec331d63487217 (diff) |
st/mesa: simplify st_texture_image_map() calls
Return void, set gl_texture_image::Map.Data field.
-rw-r--r-- | src/mesa/state_tracker/st_cb_texture.c | 52 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_texture.c | 8 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_texture.h | 5 |
3 files changed, 24 insertions, 41 deletions
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index f596b491db..56fe73051b 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -680,10 +680,8 @@ st_TexImage(GLcontext * ctx, else transfer_usage = PIPE_TRANSFER_WRITE; - texImage->Map.Data = st_texture_image_map(ctx->st, stImage, 0, - transfer_usage, 0, 0, - stImage->base.Width, - stImage->base.Height); + st_texture_image_map(ctx->st, stImage, 0, transfer_usage, 0, 0, + stImage->base.Width, stImage->base.Height); if (stImage->transfer) dstRowStride = stImage->transfer->stride; } @@ -733,10 +731,9 @@ st_TexImage(GLcontext * ctx, /* unmap this slice */ st_texture_image_unmap(ctx->st, stImage); /* map next slice of 3D texture */ - texImage->Map.Data = st_texture_image_map(ctx->st, stImage, i + 1, - transfer_usage, 0, 0, - stImage->base.Width, - stImage->base.Height); + st_texture_image_map(ctx->st, stImage, i + 1, + transfer_usage, 0, 0, + stImage->base.Width, stImage->base.Height); src += srcImageStride; } } @@ -938,10 +935,9 @@ st_get_tex_image(GLcontext * ctx, GLenum target, GLint level, st_teximage_flush_before_map(ctx->st, stImage->pt, face, level, PIPE_TRANSFER_READ); - texImage->Map.Data = st_texture_image_map(ctx->st, stImage, 0, - PIPE_TRANSFER_READ, 0, 0, - stImage->base.Width, - stImage->base.Height); + st_texture_image_map(ctx->st, stImage, 0, + PIPE_TRANSFER_READ, 0, 0, + stImage->base.Width, stImage->base.Height); texImage->Map.RowStride = stImage->transfer->stride / stImage->pt->block.size; } else { @@ -975,10 +971,9 @@ st_get_tex_image(GLcontext * ctx, GLenum target, GLint level, /* unmap this slice */ st_texture_image_unmap(ctx->st, stImage); /* map next slice of 3D texture */ - texImage->Map.Data = st_texture_image_map(ctx->st, stImage, i + 1, - PIPE_TRANSFER_READ, 0, 0, - stImage->base.Width, - stImage->base.Height); + st_texture_image_map(ctx->st, stImage, i + 1, + PIPE_TRANSFER_READ, 0, 0, + stImage->base.Width, stImage->base.Height); dest += dstImageStride; } } @@ -1074,10 +1069,8 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, st_teximage_flush_before_map(ctx->st, stImage->pt, face, level, transfer_usage); - texImage->Map.Data = st_texture_image_map(ctx->st, stImage, zoffset, - transfer_usage, - xoffset, yoffset, - width, height); + st_texture_image_map(ctx->st, stImage, zoffset, transfer_usage, + xoffset, yoffset, width, height); } if (!texImage->Map.Data) { @@ -1104,11 +1097,9 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, /* unmap this slice */ st_texture_image_unmap(ctx->st, stImage); /* map next slice of 3D texture */ - texImage->Map.Data = st_texture_image_map(ctx->st, stImage, - zoffset + i + 1, - transfer_usage, - xoffset, yoffset, - width, height); + st_texture_image_map(ctx->st, stImage, + zoffset + i + 1, transfer_usage, + xoffset, yoffset, width, height); src += srcImageStride; } } @@ -1198,10 +1189,8 @@ st_CompressedTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, st_teximage_flush_before_map(ctx->st, stImage->pt, face, level, PIPE_TRANSFER_WRITE); - texImage->Map.Data = st_texture_image_map(ctx->st, stImage, 0, - PIPE_TRANSFER_WRITE, - xoffset, yoffset, - width, height); + st_texture_image_map(ctx->st, stImage, 0, PIPE_TRANSFER_WRITE, + xoffset, yoffset, width, height); block = stImage->pt->block; srcBlockStride = pf_get_stride(&block, width); @@ -1298,9 +1287,8 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level, st_teximage_flush_before_map(ctx->st, stImage->pt, 0, 0, transfer_usage); - texImage->Map.Data = st_texture_image_map(ctx->st, stImage, - 0, transfer_usage, - destX, destY, width, height); + st_texture_image_map(ctx->st, stImage, 0, transfer_usage, + destX, destY, width, height); if (baseFormat == GL_DEPTH_COMPONENT || baseFormat == GL_DEPTH_STENCIL) { diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index 52fb7a3705..f2c92fe412 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -182,11 +182,9 @@ st_texture_image_offset(const struct pipe_texture * pt, /** * Map a teximage in a mipmap texture. - * \param row_stride returns row stride in bytes - * \param image_stride returns image stride in bytes (for 3D textures). - * \return address of mapping + * This sets the texture image's Map.Data field. */ -GLubyte * +void st_texture_image_map(struct st_context *st, struct st_texture_image *stImage, GLuint zoffset, enum pipe_transfer_usage usage, GLuint x, GLuint y, GLuint w, GLuint h) @@ -205,7 +203,7 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage, if (stImage->transfer) map = screen->transfer_map(screen, stImage->transfer); - return map; + stImage->base.Map.Data = map; } diff --git a/src/mesa/state_tracker/st_texture.h b/src/mesa/state_tracker/st_texture.h index 60868ce067..894f2dc89d 100644 --- a/src/mesa/state_tracker/st_texture.h +++ b/src/mesa/state_tracker/st_texture.h @@ -123,10 +123,7 @@ st_texture_match_image(const struct pipe_texture *pt, const struct gl_texture_image *image, GLuint face, GLuint level); -/* Return a pointer to an image within a texture. Return image stride as - * well. - */ -extern GLubyte * +extern void st_texture_image_map(struct st_context *st, struct st_texture_image *stImage, GLuint zoffset, |