2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
6 * Copyright (c) 2008 VMware, Inc.
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR 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 dstAddr destination image address
49 * \param dstX/Y/Zoffset destination x/y/z offset (ala TexSubImage), in texels
50 * \param dstRowStride destination image row stride, in bytes
51 * \param dstImageOffsets offset of each 2D slice within 3D texture, in texels
52 * \param srcWidth/Height/Depth source image size, in pixels
53 * \param srcFormat incoming image format
54 * \param srcType incoming image data type
55 * \param srcAddr source image address
56 * \param srcPacking source image packing parameters
58 #define TEXSTORE_PARAMS \
59 GLcontext *ctx, GLuint dims, \
60 GLenum baseInternalFormat, \
61 const struct gl_texture_format *dstFormat, \
63 GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, \
64 GLint dstRowStride, const GLuint *dstImageOffsets, \
65 GLint srcWidth, GLint srcHeight, GLint srcDepth, \
66 GLenum srcFormat, GLenum srcType, \
67 const GLvoid *srcAddr, \
68 const struct gl_pixelstore_attrib *srcPacking
73 * Texture image storage function.
75 typedef GLboolean (*StoreTexImageFunc
)(TEXSTORE_PARAMS
);
79 _mesa_make_temp_chan_image(GLcontext
*ctx
, GLuint dims
,
80 GLenum logicalBaseFormat
,
81 GLenum textureBaseFormat
,
82 GLint srcWidth
, GLint srcHeight
, GLint srcDepth
,
83 GLenum srcFormat
, GLenum srcType
,
84 const GLvoid
*srcAddr
,
85 const struct gl_pixelstore_attrib
*srcPacking
);
89 _mesa_set_fetch_functions(struct gl_texture_image
*texImage
, GLuint dims
);
93 _mesa_store_teximage1d(GLcontext
*ctx
, GLenum target
, GLint level
,
95 GLint width
, GLint border
,
96 GLenum format
, GLenum type
, const GLvoid
*pixels
,
97 const struct gl_pixelstore_attrib
*packing
,
98 struct gl_texture_object
*texObj
,
99 struct gl_texture_image
*texImage
);
103 _mesa_store_teximage2d(GLcontext
*ctx
, GLenum target
, GLint level
,
104 GLint internalFormat
,
105 GLint width
, GLint height
, GLint border
,
106 GLenum format
, GLenum type
, const GLvoid
*pixels
,
107 const struct gl_pixelstore_attrib
*packing
,
108 struct gl_texture_object
*texObj
,
109 struct gl_texture_image
*texImage
);
113 _mesa_store_teximage3d(GLcontext
*ctx
, GLenum target
, GLint level
,
114 GLint internalFormat
,
115 GLint width
, GLint height
, GLint depth
, GLint border
,
116 GLenum format
, GLenum type
, const GLvoid
*pixels
,
117 const struct gl_pixelstore_attrib
*packing
,
118 struct gl_texture_object
*texObj
,
119 struct gl_texture_image
*texImage
);
123 _mesa_store_texsubimage1d(GLcontext
*ctx
, GLenum target
, GLint level
,
124 GLint xoffset
, GLint width
,
125 GLenum format
, GLenum type
, const GLvoid
*pixels
,
126 const struct gl_pixelstore_attrib
*packing
,
127 struct gl_texture_object
*texObj
,
128 struct gl_texture_image
*texImage
);
132 _mesa_store_texsubimage2d(GLcontext
*ctx
, GLenum target
, GLint level
,
133 GLint xoffset
, GLint yoffset
,
134 GLint width
, GLint height
,
135 GLenum format
, GLenum type
, const GLvoid
*pixels
,
136 const struct gl_pixelstore_attrib
*packing
,
137 struct gl_texture_object
*texObj
,
138 struct gl_texture_image
*texImage
);
142 _mesa_store_texsubimage3d(GLcontext
*ctx
, GLenum target
, GLint level
,
143 GLint xoffset
, GLint yoffset
, GLint zoffset
,
144 GLint width
, GLint height
, GLint depth
,
145 GLenum format
, GLenum type
, const GLvoid
*pixels
,
146 const struct gl_pixelstore_attrib
*packing
,
147 struct gl_texture_object
*texObj
,
148 struct gl_texture_image
*texImage
);
151 extern StoreTexImageFunc
152 _mesa_get_texstore_func(gl_format format
);
155 _mesa_texstore(TEXSTORE_PARAMS
);
159 _mesa_store_compressed_teximage1d(GLcontext
*ctx
, GLenum target
, GLint level
,
160 GLint internalFormat
,
161 GLint width
, GLint border
,
162 GLsizei imageSize
, const GLvoid
*data
,
163 struct gl_texture_object
*texObj
,
164 struct gl_texture_image
*texImage
);
167 _mesa_store_compressed_teximage2d(GLcontext
*ctx
, GLenum target
, GLint level
,
168 GLint internalFormat
,
169 GLint width
, GLint height
, GLint border
,
170 GLsizei imageSize
, const GLvoid
*data
,
171 struct gl_texture_object
*texObj
,
172 struct gl_texture_image
*texImage
);
175 _mesa_store_compressed_teximage3d(GLcontext
*ctx
, GLenum target
, GLint level
,
176 GLint internalFormat
,
177 GLint width
, GLint height
, GLint depth
,
179 GLsizei imageSize
, const GLvoid
*data
,
180 struct gl_texture_object
*texObj
,
181 struct gl_texture_image
*texImage
);
185 _mesa_store_compressed_texsubimage1d(GLcontext
*ctx
, GLenum target
,
187 GLint xoffset
, GLsizei width
,
189 GLsizei imageSize
, const GLvoid
*data
,
190 struct gl_texture_object
*texObj
,
191 struct gl_texture_image
*texImage
);
194 _mesa_store_compressed_texsubimage2d(GLcontext
*ctx
, GLenum target
,
196 GLint xoffset
, GLint yoffset
,
197 GLsizei width
, GLsizei height
,
199 GLsizei imageSize
, const GLvoid
*data
,
200 struct gl_texture_object
*texObj
,
201 struct gl_texture_image
*texImage
);
204 _mesa_store_compressed_texsubimage3d(GLcontext
*ctx
, GLenum target
,
206 GLint xoffset
, GLint yoffset
, GLint zoffset
,
207 GLsizei width
, GLsizei height
, GLsizei depth
,
209 GLsizei imageSize
, const GLvoid
*data
,
210 struct gl_texture_object
*texObj
,
211 struct gl_texture_image
*texImage
);
214 extern const GLvoid
*
215 _mesa_validate_pbo_teximage(GLcontext
*ctx
, GLuint dimensions
,
216 GLsizei width
, GLsizei height
, GLsizei depth
,
217 GLenum format
, GLenum type
, const GLvoid
*pixels
,
218 const struct gl_pixelstore_attrib
*unpack
,
219 const char *funcName
);
221 extern const GLvoid
*
222 _mesa_validate_pbo_compressed_teximage(GLcontext
*ctx
,
223 GLsizei imageSize
, const GLvoid
*pixels
,
224 const struct gl_pixelstore_attrib
*packing
,
225 const char *funcName
);
228 _mesa_unmap_teximage_pbo(GLcontext
*ctx
,
229 const struct gl_pixelstore_attrib
*unpack
);