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.
41 #include "util/macros.h"
44 struct gl_pixelstore_attrib
;
45 struct gl_texture_image
;
48 * This macro defines the (many) parameters to the texstore functions.
49 * \param dims either 1 or 2 or 3
50 * \param baseInternalFormat user-specified base internal format
51 * \param dstFormat destination Mesa texture format
52 * \param dstX/Y/Zoffset destination x/y/z offset (ala TexSubImage), in texels
53 * \param dstRowStride destination image row stride, in bytes
54 * \param dstSlices array of addresses of image slices (for 3D, array texture)
55 * \param srcWidth/Height/Depth source image size, in pixels
56 * \param srcFormat incoming image format
57 * \param srcType incoming image data type
58 * \param srcAddr source image address
59 * \param srcPacking source image packing parameters
61 #define TEXSTORE_PARAMS \
62 struct gl_context *ctx, GLuint dims, \
63 MAYBE_UNUSED GLenum baseInternalFormat, \
64 MAYBE_UNUSED mesa_format dstFormat, \
66 GLubyte **dstSlices, \
67 GLint srcWidth, GLint srcHeight, GLint srcDepth, \
68 GLenum srcFormat, GLenum srcType, \
69 const GLvoid *srcAddr, \
70 const struct gl_pixelstore_attrib *srcPacking
72 /* This macro must be kept in sync with TEXSTORE_PARAMS. It is used in the
73 * few places where none of the parameters are used (i.e., the ETC texstore
76 #define UNUSED_TEXSTORE_PARAMS \
77 UNUSED struct gl_context *ctx, UNUSED GLuint dims, \
78 UNUSED GLenum baseInternalFormat, \
79 UNUSED mesa_format dstFormat, \
80 UNUSED GLint dstRowStride, \
81 UNUSED GLubyte **dstSlices, \
82 UNUSED GLint srcWidth, UNUSED GLint srcHeight, UNUSED GLint srcDepth, \
83 UNUSED GLenum srcFormat, UNUSED GLenum srcType, \
84 UNUSED const GLvoid *srcAddr, \
85 UNUSED const struct gl_pixelstore_attrib *srcPacking
88 _mesa_texstore(TEXSTORE_PARAMS
);
91 _mesa_texstore_needs_transfer_ops(struct gl_context
*ctx
,
92 GLenum baseInternalFormat
,
93 mesa_format dstFormat
);
96 _mesa_memcpy_texture(struct gl_context
*ctx
,
98 mesa_format dstFormat
,
101 GLint srcWidth
, GLint srcHeight
, GLint srcDepth
,
102 GLenum srcFormat
, GLenum srcType
,
103 const GLvoid
*srcAddr
,
104 const struct gl_pixelstore_attrib
*srcPacking
);
107 _mesa_texstore_can_use_memcpy(struct gl_context
*ctx
,
108 GLenum baseInternalFormat
, mesa_format dstFormat
,
109 GLenum srcFormat
, GLenum srcType
,
110 const struct gl_pixelstore_attrib
*srcPacking
);
114 _mesa_store_teximage(struct gl_context
*ctx
,
116 struct gl_texture_image
*texImage
,
117 GLenum format
, GLenum type
, const GLvoid
*pixels
,
118 const struct gl_pixelstore_attrib
*packing
);
122 _mesa_store_texsubimage(struct gl_context
*ctx
, GLuint dims
,
123 struct gl_texture_image
*texImage
,
124 GLint xoffset
, GLint yoffset
, GLint zoffset
,
125 GLint width
, GLint height
, GLint depth
,
126 GLenum format
, GLenum type
, const GLvoid
*pixels
,
127 const struct gl_pixelstore_attrib
*packing
);
131 _mesa_store_cleartexsubimage(struct gl_context
*ctx
,
132 struct gl_texture_image
*texImage
,
133 GLint xoffset
, GLint yoffset
, GLint zoffset
,
134 GLsizei width
, GLsizei height
, GLsizei depth
,
135 const GLvoid
*clearValue
);
138 _mesa_store_compressed_teximage(struct gl_context
*ctx
, GLuint dims
,
139 struct gl_texture_image
*texImage
,
140 GLsizei imageSize
, const GLvoid
*data
);
144 _mesa_store_compressed_texsubimage(struct gl_context
*ctx
, GLuint dims
,
145 struct gl_texture_image
*texImage
,
146 GLint xoffset
, GLint yoffset
, GLint zoffset
,
147 GLsizei width
, GLsizei height
, GLsizei depth
,
149 GLsizei imageSize
, const GLvoid
*data
);
152 struct compressed_pixelstore
{
155 int CopyRowsPerSlice
;
156 int TotalBytesPerRow
;
157 int TotalRowsPerSlice
;
163 _mesa_compute_compressed_pixelstore(GLuint dims
, mesa_format texFormat
,
164 GLsizei width
, GLsizei height
,
166 const struct gl_pixelstore_attrib
*packing
,
167 struct compressed_pixelstore
*store
);