X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Ftexstore.c;h=b54e03337493a990c909a0975d60dd77808d6e07;hb=30e437bd76c6eb9a8e46b1c96e313b8eafd0b798;hp=e50964e79e4c13ab81f990d98a0670686870f241;hpb=0ad3a475ef81dad3baf607d749b91dfa1700ca23;p=mesa.git diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index e50964e79e4..b54e0333749 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -87,9 +87,6 @@ enum { * Texture image storage function. */ typedef GLboolean (*StoreTexImageFunc)(TEXSTORE_PARAMS); -static const GLubyte map_identity[6] = { 0, 1, 2, 3, ZERO, ONE }; -static const GLubyte map_3210[6] = { 3, 2, 1, 0, ZERO, ONE }; -static const GLubyte map_1032[6] = { 1, 0, 3, 2, ZERO, ONE }; /** @@ -97,16 +94,16 @@ static const GLubyte map_1032[6] = { 1, 0, 3, 2, ZERO, ONE }; * No pixel transfer operations or special texel encodings allowed. * 1D, 2D and 3D images supported. */ -static void -memcpy_texture(struct gl_context *ctx, - GLuint dimensions, - mesa_format dstFormat, - GLint dstRowStride, - GLubyte **dstSlices, - GLint srcWidth, GLint srcHeight, GLint srcDepth, - GLenum srcFormat, GLenum srcType, - const GLvoid *srcAddr, - const struct gl_pixelstore_attrib *srcPacking) +void +_mesa_memcpy_texture(struct gl_context *ctx, + GLuint dimensions, + mesa_format dstFormat, + GLint dstRowStride, + GLubyte **dstSlices, + GLint srcWidth, GLint srcHeight, GLint srcDepth, + GLenum srcFormat, GLenum srcType, + const GLvoid *srcAddr, + const struct gl_pixelstore_attrib *srcPacking) { const GLint srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); @@ -296,11 +293,11 @@ _mesa_texstore_ycbcr(TEXSTORE_PARAMS) assert(baseInternalFormat == GL_YCBCR_MESA); /* always just memcpy since no pixel transfer ops apply */ - memcpy_texture(ctx, dims, - dstFormat, - dstRowStride, dstSlices, - srcWidth, srcHeight, srcDepth, srcFormat, srcType, - srcAddr, srcPacking); + _mesa_memcpy_texture(ctx, dims, + dstFormat, + dstRowStride, dstSlices, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); /* Check if we need byte swapping */ /* XXX the logic here _might_ be wrong */ @@ -899,13 +896,15 @@ _mesa_texstore_memcpy(TEXSTORE_PARAMS) return GL_FALSE; } - memcpy_texture(ctx, dims, - dstFormat, - dstRowStride, dstSlices, - srcWidth, srcHeight, srcDepth, srcFormat, srcType, - srcAddr, srcPacking); + _mesa_memcpy_texture(ctx, dims, + dstFormat, + dstRowStride, dstSlices, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); return GL_TRUE; } + + /** * Store user data into texture memory. * Called via glTex[Sub]Image1/2/3D() @@ -1244,11 +1243,11 @@ _mesa_store_compressed_teximage(struct gl_context *ctx, GLuint dims, return; } - _mesa_store_compressed_texsubimage(ctx, dims, texImage, - 0, 0, 0, - texImage->Width, texImage->Height, texImage->Depth, - texImage->TexFormat, - imageSize, data); + ctx->Driver.CompressedTexSubImage(ctx, dims, texImage, + 0, 0, 0, + texImage->Width, texImage->Height, texImage->Depth, + texImage->TexFormat, + imageSize, data); } @@ -1268,16 +1267,16 @@ _mesa_compute_compressed_pixelstore(GLuint dims, mesa_format texFormat, const struct gl_pixelstore_attrib *packing, struct compressed_pixelstore *store) { - GLuint bw, bh; + GLuint bw, bh, bd; - _mesa_get_format_block_size(texFormat, &bw, &bh); + _mesa_get_format_block_size_3d(texFormat, &bw, &bh, &bd); store->SkipBytes = 0; store->TotalBytesPerRow = store->CopyBytesPerRow = _mesa_format_row_stride(texFormat, width); store->TotalRowsPerSlice = store->CopyRowsPerSlice = (height + bh - 1) / bh; - store->CopySlices = depth; + store->CopySlices = (depth + bd - 1) / bd; if (packing->CompressedBlockWidth && packing->CompressedBlockSize) {