f3d4a7d05a64d58b2c9f3d04a9378e3012bb41e8
[mesa.git] / src / mesa / main / texstore.h
1 /*
2 * Mesa 3-D graphics library
3 * Version: 6.5.1
4 *
5 * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
6 * Copyright (c) 2008 VMware, Inc.
7 *
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:
14 *
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
17 *
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 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
22 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 * OTHER DEALINGS IN THE SOFTWARE.
25 */
26
27
28 /**
29 * \file texstore.h
30 * Texture image storage routines.
31 *
32 * \author Brian Paul
33 */
34
35
36 #ifndef TEXSTORE_H
37 #define TEXSTORE_H
38
39
40 #include "mtypes.h"
41 #include "formats.h"
42
43
44 /**
45 * This macro defines the (many) parameters to the texstore functions.
46 * \param dims either 1 or 2 or 3
47 * \param baseInternalFormat user-specified base internal format
48 * \param dstFormat destination Mesa texture format
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 dstSlices array of addresses of image slices (for 3D, array texture)
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
57 */
58 #define TEXSTORE_PARAMS \
59 struct gl_context *ctx, GLuint dims, \
60 GLenum baseInternalFormat, \
61 gl_format dstFormat, \
62 GLint dstRowStride, \
63 GLubyte **dstSlices, \
64 GLint srcWidth, GLint srcHeight, GLint srcDepth, \
65 GLenum srcFormat, GLenum srcType, \
66 const GLvoid *srcAddr, \
67 const struct gl_pixelstore_attrib *srcPacking
68
69
70 extern GLboolean
71 _mesa_texstore(TEXSTORE_PARAMS);
72
73 extern GLboolean
74 _mesa_texstore_needs_transfer_ops(struct gl_context *ctx,
75 GLenum baseInternalFormat,
76 gl_format dstFormat);
77
78 extern GLboolean
79 _mesa_texstore_can_use_memcpy(struct gl_context *ctx,
80 GLenum baseInternalFormat, gl_format dstFormat,
81 GLenum srcFormat, GLenum srcType,
82 const struct gl_pixelstore_attrib *srcPacking);
83
84
85 extern GLubyte *
86 _mesa_make_temp_ubyte_image(struct gl_context *ctx, GLuint dims,
87 GLenum logicalBaseFormat,
88 GLenum textureBaseFormat,
89 GLint srcWidth, GLint srcHeight, GLint srcDepth,
90 GLenum srcFormat, GLenum srcType,
91 const GLvoid *srcAddr,
92 const struct gl_pixelstore_attrib *srcPacking);
93
94 GLfloat *
95 _mesa_make_temp_float_image(struct gl_context *ctx, GLuint dims,
96 GLenum logicalBaseFormat,
97 GLenum textureBaseFormat,
98 GLint srcWidth, GLint srcHeight, GLint srcDepth,
99 GLenum srcFormat, GLenum srcType,
100 const GLvoid *srcAddr,
101 const struct gl_pixelstore_attrib *srcPacking,
102 GLbitfield transferOps);
103
104 extern void
105 _mesa_store_teximage(struct gl_context *ctx,
106 GLuint dims,
107 struct gl_texture_image *texImage,
108 GLenum format, GLenum type, const GLvoid *pixels,
109 const struct gl_pixelstore_attrib *packing);
110
111
112 extern void
113 _mesa_store_texsubimage(struct gl_context *ctx, GLuint dims,
114 struct gl_texture_image *texImage,
115 GLint xoffset, GLint yoffset, GLint zoffset,
116 GLint width, GLint height, GLint depth,
117 GLenum format, GLenum type, const GLvoid *pixels,
118 const struct gl_pixelstore_attrib *packing);
119
120
121 extern void
122 _mesa_store_compressed_teximage(struct gl_context *ctx, GLuint dims,
123 struct gl_texture_image *texImage,
124 GLsizei imageSize, const GLvoid *data);
125
126
127 extern void
128 _mesa_store_compressed_texsubimage(struct gl_context *ctx, GLuint dims,
129 struct gl_texture_image *texImage,
130 GLint xoffset, GLint yoffset, GLint zoffset,
131 GLsizei width, GLsizei height, GLsizei depth,
132 GLenum format,
133 GLsizei imageSize, const GLvoid *data);
134
135
136 #endif