projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mesa/get: Add TYPE_UINT for casting through a GLuint.
[mesa.git]
/
src
/
mesa
/
main
/
texstore.c
diff --git
a/src/mesa/main/texstore.c
b/src/mesa/main/texstore.c
index 539402668c45c6314ff981695ef20318b30c71b0..615ba63362efe3012adc9a9fb58fc553652d4c20 100644
(file)
--- a/
src/mesa/main/texstore.c
+++ b/
src/mesa/main/texstore.c
@@
-73,8
+73,8
@@
#include "enums.h"
#include "glformats.h"
#include "pixeltransfer.h"
#include "enums.h"
#include "glformats.h"
#include "pixeltransfer.h"
-#include "
../../gallium/auxiliary/util/u_
format_rgb9e5.h"
-#include "
../../gallium/auxiliary/util/u_
format_r11g11b10f.h"
+#include "
util/
format_rgb9e5.h"
+#include "
util/
format_r11g11b10f.h"
enum {
enum {
@@
-87,9
+87,6
@@
enum {
* Texture image storage function.
*/
typedef GLboolean (*StoreTexImageFunc)(TEXSTORE_PARAMS);
* 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.
*/
* 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);
{
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 */
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 */
/* Check if we need byte swapping */
/* XXX the logic here _might_ be wrong */
@@
-727,19
+724,25
@@
texstore_rgba(TEXSTORE_PARAMS)
*/
GLint swapSize = _mesa_sizeof_packed_type(srcType);
if (swapSize == 2 || swapSize == 4) {
*/
GLint swapSize = _mesa_sizeof_packed_type(srcType);
if (swapSize == 2 || swapSize == 4) {
- int bytesPerPixel = _mesa_bytes_per_pixel(srcFormat, srcType);
- int swapsPerPixel = bytesPerPixel / swapSize;
- int elementCount = srcWidth * srcHeight * srcDepth;
- assert(bytesPerPixel % swapSize == 0);
- tempImage = malloc(elementCount * bytesPerPixel);
+ int imageStride = _mesa_image_image_stride(srcPacking, srcWidth, srcHeight, srcFormat, srcType);
+ int bufferSize = imageStride * srcDepth;
+ int layer;
+ const uint8_t *src;
+ uint8_t *dst;
+
+ tempImage = malloc(bufferSize);
if (!tempImage)
return GL_FALSE;
if (!tempImage)
return GL_FALSE;
- if (swapSize == 2)
- _mesa_swap2_copy(tempImage, (GLushort *) srcAddr,
- elementCount * swapsPerPixel);
- else
- _mesa_swap4_copy(tempImage, (GLuint *) srcAddr,
- elementCount * swapsPerPixel);
+ src = srcAddr;
+ dst = tempImage;
+ for (layer = 0; layer < srcDepth; layer++) {
+ _mesa_swap_bytes_2d_image(srcFormat, srcType,
+ srcPacking,
+ srcWidth, srcHeight,
+ dst, src);
+ src += imageStride;
+ dst += imageStride;
+ }
srcAddr = tempImage;
}
}
srcAddr = tempImage;
}
}
@@
-893,13
+896,15
@@
_mesa_texstore_memcpy(TEXSTORE_PARAMS)
return GL_FALSE;
}
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;
}
return GL_TRUE;
}
+
+
/**
* Store user data into texture memory.
* Called via glTex[Sub]Image1/2/3D()
/**
* Store user data into texture memory.
* Called via glTex[Sub]Image1/2/3D()
@@
-1238,11
+1243,11
@@
_mesa_store_compressed_teximage(struct gl_context *ctx, GLuint dims,
return;
}
return;
}
-
_mesa_store_compressed_texsubi
mage(ctx, dims, texImage,
-
0, 0, 0,
-
texImage->Width, texImage->Height, texImage->Depth,
-
texImage->TexFormat,
-
imageSize, data);
+
ctx->Driver.CompressedTexSubI
mage(ctx, dims, texImage,
+ 0, 0, 0,
+ texImage->Width, texImage->Height, texImage->Depth,
+ texImage->TexFormat,
+ imageSize, data);
}
}
@@
-1262,16
+1267,16
@@
_mesa_compute_compressed_pixelstore(GLuint dims, mesa_format texFormat,
const struct gl_pixelstore_attrib *packing,
struct compressed_pixelstore *store)
{
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->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) {
if (packing->CompressedBlockWidth &&
packing->CompressedBlockSize) {