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 extern GLboolean
_mesa_texstore_rgba(TEXSTORE_PARAMS
);
80 extern GLboolean
_mesa_texstore_color_index(TEXSTORE_PARAMS
);
81 extern GLboolean
_mesa_texstore_rgba8888(TEXSTORE_PARAMS
);
82 extern GLboolean
_mesa_texstore_argb8888(TEXSTORE_PARAMS
);
83 extern GLboolean
_mesa_texstore_rgb888(TEXSTORE_PARAMS
);
84 extern GLboolean
_mesa_texstore_bgr888(TEXSTORE_PARAMS
);
85 extern GLboolean
_mesa_texstore_rgb565(TEXSTORE_PARAMS
);
86 extern GLboolean
_mesa_texstore_rgb565_rev(TEXSTORE_PARAMS
);
87 extern GLboolean
_mesa_texstore_rgba4444(TEXSTORE_PARAMS
);
88 extern GLboolean
_mesa_texstore_argb4444(TEXSTORE_PARAMS
);
89 extern GLboolean
_mesa_texstore_argb4444_rev(TEXSTORE_PARAMS
);
90 extern GLboolean
_mesa_texstore_rgba5551(TEXSTORE_PARAMS
);
91 extern GLboolean
_mesa_texstore_argb1555(TEXSTORE_PARAMS
);
92 extern GLboolean
_mesa_texstore_argb1555_rev(TEXSTORE_PARAMS
);
93 extern GLboolean
_mesa_texstore_al88(TEXSTORE_PARAMS
);
94 extern GLboolean
_mesa_texstore_al88_rev(TEXSTORE_PARAMS
);
95 extern GLboolean
_mesa_texstore_rgb332(TEXSTORE_PARAMS
);
96 extern GLboolean
_mesa_texstore_a8(TEXSTORE_PARAMS
);
97 extern GLboolean
_mesa_texstore_ci8(TEXSTORE_PARAMS
);
98 extern GLboolean
_mesa_texstore_ycbcr(TEXSTORE_PARAMS
);
99 extern GLboolean
_mesa_texstore_z24_s8(TEXSTORE_PARAMS
);
100 extern GLboolean
_mesa_texstore_s8_z24(TEXSTORE_PARAMS
);
101 extern GLboolean
_mesa_texstore_z16(TEXSTORE_PARAMS
);
102 extern GLboolean
_mesa_texstore_z32(TEXSTORE_PARAMS
);
103 extern GLboolean
_mesa_texstore_rgba_float32(TEXSTORE_PARAMS
);
104 extern GLboolean
_mesa_texstore_rgba_float16(TEXSTORE_PARAMS
);
105 extern GLboolean
_mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS
);
106 extern GLboolean
_mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS
);
107 extern GLboolean
_mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS
);
108 extern GLboolean
_mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS
);
109 extern GLboolean
_mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS
);
110 extern GLboolean
_mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS
);
111 #if FEATURE_EXT_texture_sRGB
112 extern GLboolean
_mesa_texstore_srgb8(TEXSTORE_PARAMS
);
113 extern GLboolean
_mesa_texstore_srgba8(TEXSTORE_PARAMS
);
114 extern GLboolean
_mesa_texstore_sargb8(TEXSTORE_PARAMS
);
115 extern GLboolean
_mesa_texstore_sl8(TEXSTORE_PARAMS
);
116 extern GLboolean
_mesa_texstore_sla8(TEXSTORE_PARAMS
);
118 extern GLboolean
_mesa_texstore_dudv8(TEXSTORE_PARAMS
);
119 extern GLboolean
_mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS
);
122 _mesa_make_temp_chan_image(GLcontext
*ctx
, GLuint dims
,
123 GLenum logicalBaseFormat
,
124 GLenum textureBaseFormat
,
125 GLint srcWidth
, GLint srcHeight
, GLint srcDepth
,
126 GLenum srcFormat
, GLenum srcType
,
127 const GLvoid
*srcAddr
,
128 const struct gl_pixelstore_attrib
*srcPacking
);
132 _mesa_set_fetch_functions(struct gl_texture_image
*texImage
, GLuint dims
);
136 _mesa_store_teximage1d(GLcontext
*ctx
, GLenum target
, GLint level
,
137 GLint internalFormat
,
138 GLint width
, GLint border
,
139 GLenum format
, GLenum type
, const GLvoid
*pixels
,
140 const struct gl_pixelstore_attrib
*packing
,
141 struct gl_texture_object
*texObj
,
142 struct gl_texture_image
*texImage
);
146 _mesa_store_teximage2d(GLcontext
*ctx
, GLenum target
, GLint level
,
147 GLint internalFormat
,
148 GLint width
, GLint height
, GLint border
,
149 GLenum format
, GLenum type
, const GLvoid
*pixels
,
150 const struct gl_pixelstore_attrib
*packing
,
151 struct gl_texture_object
*texObj
,
152 struct gl_texture_image
*texImage
);
156 _mesa_store_teximage3d(GLcontext
*ctx
, GLenum target
, GLint level
,
157 GLint internalFormat
,
158 GLint width
, GLint height
, GLint depth
, GLint border
,
159 GLenum format
, GLenum type
, const GLvoid
*pixels
,
160 const struct gl_pixelstore_attrib
*packing
,
161 struct gl_texture_object
*texObj
,
162 struct gl_texture_image
*texImage
);
166 _mesa_store_texsubimage1d(GLcontext
*ctx
, GLenum target
, GLint level
,
167 GLint xoffset
, GLint width
,
168 GLenum format
, GLenum type
, const GLvoid
*pixels
,
169 const struct gl_pixelstore_attrib
*packing
,
170 struct gl_texture_object
*texObj
,
171 struct gl_texture_image
*texImage
);
175 _mesa_store_texsubimage2d(GLcontext
*ctx
, GLenum target
, GLint level
,
176 GLint xoffset
, GLint yoffset
,
177 GLint width
, GLint height
,
178 GLenum format
, GLenum type
, const GLvoid
*pixels
,
179 const struct gl_pixelstore_attrib
*packing
,
180 struct gl_texture_object
*texObj
,
181 struct gl_texture_image
*texImage
);
185 _mesa_store_texsubimage3d(GLcontext
*ctx
, GLenum target
, GLint level
,
186 GLint xoffset
, GLint yoffset
, GLint zoffset
,
187 GLint width
, GLint height
, GLint depth
,
188 GLenum format
, GLenum type
, const GLvoid
*pixels
,
189 const struct gl_pixelstore_attrib
*packing
,
190 struct gl_texture_object
*texObj
,
191 struct gl_texture_image
*texImage
);
194 extern StoreTexImageFunc
195 _mesa_get_texstore_func(gl_format format
);
198 _mesa_texstore(TEXSTORE_PARAMS
);
202 _mesa_store_compressed_teximage1d(GLcontext
*ctx
, GLenum target
, GLint level
,
203 GLint internalFormat
,
204 GLint width
, GLint border
,
205 GLsizei imageSize
, const GLvoid
*data
,
206 struct gl_texture_object
*texObj
,
207 struct gl_texture_image
*texImage
);
210 _mesa_store_compressed_teximage2d(GLcontext
*ctx
, GLenum target
, GLint level
,
211 GLint internalFormat
,
212 GLint width
, GLint height
, GLint border
,
213 GLsizei imageSize
, const GLvoid
*data
,
214 struct gl_texture_object
*texObj
,
215 struct gl_texture_image
*texImage
);
218 _mesa_store_compressed_teximage3d(GLcontext
*ctx
, GLenum target
, GLint level
,
219 GLint internalFormat
,
220 GLint width
, GLint height
, GLint depth
,
222 GLsizei imageSize
, const GLvoid
*data
,
223 struct gl_texture_object
*texObj
,
224 struct gl_texture_image
*texImage
);
228 _mesa_store_compressed_texsubimage1d(GLcontext
*ctx
, GLenum target
,
230 GLint xoffset
, GLsizei width
,
232 GLsizei imageSize
, const GLvoid
*data
,
233 struct gl_texture_object
*texObj
,
234 struct gl_texture_image
*texImage
);
237 _mesa_store_compressed_texsubimage2d(GLcontext
*ctx
, GLenum target
,
239 GLint xoffset
, GLint yoffset
,
240 GLsizei width
, GLsizei height
,
242 GLsizei imageSize
, const GLvoid
*data
,
243 struct gl_texture_object
*texObj
,
244 struct gl_texture_image
*texImage
);
247 _mesa_store_compressed_texsubimage3d(GLcontext
*ctx
, GLenum target
,
249 GLint xoffset
, GLint yoffset
, GLint zoffset
,
250 GLsizei width
, GLsizei height
, GLsizei depth
,
252 GLsizei imageSize
, const GLvoid
*data
,
253 struct gl_texture_object
*texObj
,
254 struct gl_texture_image
*texImage
);
257 extern const GLvoid
*
258 _mesa_validate_pbo_teximage(GLcontext
*ctx
, GLuint dimensions
,
259 GLsizei width
, GLsizei height
, GLsizei depth
,
260 GLenum format
, GLenum type
, const GLvoid
*pixels
,
261 const struct gl_pixelstore_attrib
*unpack
,
262 const char *funcName
);
264 extern const GLvoid
*
265 _mesa_validate_pbo_compressed_teximage(GLcontext
*ctx
,
266 GLsizei imageSize
, const GLvoid
*pixels
,
267 const struct gl_pixelstore_attrib
*packing
,
268 const char *funcName
);
271 _mesa_unmap_teximage_pbo(GLcontext
*ctx
,
272 const struct gl_pixelstore_attrib
*unpack
);