2 * Mesa 3-D graphics library
4 * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
5 * Copyright (c) 2008 VMware, Inc.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
29 * Texture image storage routines.
44 * This macro defines the (many) parameters to the texstore functions.
45 * \param dims either 1 or 2 or 3
46 * \param baseInternalFormat user-specified base internal format
47 * \param dstFormat destination Mesa texture format
48 * \param dstX/Y/Zoffset destination x/y/z offset (ala TexSubImage), in texels
49 * \param dstRowStride destination image row stride, in bytes
50 * \param dstSlices array of addresses of image slices (for 3D, array texture)
51 * \param srcWidth/Height/Depth source image size, in pixels
52 * \param srcFormat incoming image format
53 * \param srcType incoming image data type
54 * \param srcAddr source image address
55 * \param srcPacking source image packing parameters
57 #define TEXSTORE_PARAMS \
58 struct gl_context *ctx, GLuint dims, \
59 GLenum baseInternalFormat, \
60 mesa_format dstFormat, \
62 GLubyte **dstSlices, \
63 GLint srcWidth, GLint srcHeight, GLint srcDepth, \
64 GLenum srcFormat, GLenum srcType, \
65 const GLvoid *srcAddr, \
66 const struct gl_pixelstore_attrib *srcPacking
70 _mesa_texstore(TEXSTORE_PARAMS
);
73 _mesa_texstore_needs_transfer_ops(struct gl_context
*ctx
,
74 GLenum baseInternalFormat
,
75 mesa_format dstFormat
);
78 _mesa_memcpy_texture(struct gl_context
*ctx
,
80 mesa_format dstFormat
,
83 GLint srcWidth
, GLint srcHeight
, GLint srcDepth
,
84 GLenum srcFormat
, GLenum srcType
,
85 const GLvoid
*srcAddr
,
86 const struct gl_pixelstore_attrib
*srcPacking
);
89 _mesa_texstore_can_use_memcpy(struct gl_context
*ctx
,
90 GLenum baseInternalFormat
, mesa_format dstFormat
,
91 GLenum srcFormat
, GLenum srcType
,
92 const struct gl_pixelstore_attrib
*srcPacking
);
96 _mesa_store_teximage(struct gl_context
*ctx
,
98 struct gl_texture_image
*texImage
,
99 GLenum format
, GLenum type
, const GLvoid
*pixels
,
100 const struct gl_pixelstore_attrib
*packing
);
104 _mesa_store_texsubimage(struct gl_context
*ctx
, GLuint dims
,
105 struct gl_texture_image
*texImage
,
106 GLint xoffset
, GLint yoffset
, GLint zoffset
,
107 GLint width
, GLint height
, GLint depth
,
108 GLenum format
, GLenum type
, const GLvoid
*pixels
,
109 const struct gl_pixelstore_attrib
*packing
);
113 _mesa_store_cleartexsubimage(struct gl_context
*ctx
,
114 struct gl_texture_image
*texImage
,
115 GLint xoffset
, GLint yoffset
, GLint zoffset
,
116 GLsizei width
, GLsizei height
, GLsizei depth
,
117 const GLvoid
*clearValue
);
120 _mesa_store_compressed_teximage(struct gl_context
*ctx
, GLuint dims
,
121 struct gl_texture_image
*texImage
,
122 GLsizei imageSize
, const GLvoid
*data
);
126 _mesa_store_compressed_texsubimage(struct gl_context
*ctx
, GLuint dims
,
127 struct gl_texture_image
*texImage
,
128 GLint xoffset
, GLint yoffset
, GLint zoffset
,
129 GLsizei width
, GLsizei height
, GLsizei depth
,
131 GLsizei imageSize
, const GLvoid
*data
);
134 struct compressed_pixelstore
{
137 int CopyRowsPerSlice
;
138 int TotalBytesPerRow
;
139 int TotalRowsPerSlice
;
145 _mesa_compute_compressed_pixelstore(GLuint dims
, mesa_format texFormat
,
146 GLsizei width
, GLsizei height
,
148 const struct gl_pixelstore_attrib
*packing
,
149 struct compressed_pixelstore
*store
);