mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-01 15:30:26 +01:00
st/mesa: move some texture size calculation code
This commit is contained in:
parent
682fec0dca
commit
41b8a2e939
1 changed files with 6 additions and 10 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue