Merge branch 'lp-offset-twoside'
[mesa.git] / src / mesa / drivers / dri / radeon / radeon_texture.h
1 /*
2 * Copyright (C) 2008 Nicolai Haehnle.
3 * Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
4 *
5 * The Weather Channel (TM) funded Tungsten Graphics to develop the
6 * initial release of the Radeon 8500 driver under the XFree86 license.
7 * This notice must be preserved.
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining
10 * a copy of this software and associated documentation files (the
11 * "Software"), to deal in the Software without restriction, including
12 * without limitation the rights to use, copy, modify, merge, publish,
13 * distribute, sublicense, and/or sell copies of the Software, and to
14 * permit persons to whom the Software is furnished to do so, subject to
15 * the following conditions:
16 *
17 * The above copyright notice and this permission notice (including the
18 * next paragraph) shall be included in all copies or substantial
19 * portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
25 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 *
29 */
30
31 #ifndef RADEON_TEXTURE_H
32 #define RADEON_TEXTURE_H
33
34 #include "main/formats.h"
35
36 void copy_rows(void* dst, GLuint dststride, const void* src, GLuint srcstride,
37 GLuint numrows, GLuint rowsize);
38 struct gl_texture_image *radeonNewTextureImage(struct gl_context *ctx);
39 void radeonFreeTexImageData(struct gl_context *ctx, struct gl_texture_image *timage);
40
41 void radeon_teximage_map(radeon_texture_image *image, GLboolean write_enable);
42 void radeon_teximage_unmap(radeon_texture_image *image);
43 void radeonMapTexture(struct gl_context *ctx, struct gl_texture_object *texObj);
44 void radeonUnmapTexture(struct gl_context *ctx, struct gl_texture_object *texObj);
45 void radeonGenerateMipmap(struct gl_context* ctx, GLenum target, struct gl_texture_object *texObj);
46 int radeon_validate_texture_miptree(struct gl_context * ctx, struct gl_texture_object *texObj);
47
48 gl_format radeonChooseTextureFormat_mesa(struct gl_context * ctx,
49 GLint internalFormat,
50 GLenum format,
51 GLenum type);
52
53 gl_format radeonChooseTextureFormat(struct gl_context * ctx,
54 GLint internalFormat,
55 GLenum format,
56 GLenum type, GLboolean fbo);
57
58 void radeonTexImage1D(struct gl_context * ctx, GLenum target, GLint level,
59 GLint internalFormat,
60 GLint width, GLint border,
61 GLenum format, GLenum type, const GLvoid * pixels,
62 const struct gl_pixelstore_attrib *packing,
63 struct gl_texture_object *texObj,
64 struct gl_texture_image *texImage);
65 void radeonTexImage2D(struct gl_context * ctx, GLenum target, GLint level,
66 GLint internalFormat,
67 GLint width, GLint height, GLint border,
68 GLenum format, GLenum type, const GLvoid * pixels,
69 const struct gl_pixelstore_attrib *packing,
70 struct gl_texture_object *texObj,
71 struct gl_texture_image *texImage);
72 void radeonCompressedTexImage2D(struct gl_context * ctx, GLenum target,
73 GLint level, GLint internalFormat,
74 GLint width, GLint height, GLint border,
75 GLsizei imageSize, const GLvoid * data,
76 struct gl_texture_object *texObj,
77 struct gl_texture_image *texImage);
78 void radeonTexImage3D(struct gl_context * ctx, GLenum target, GLint level,
79 GLint internalFormat,
80 GLint width, GLint height, GLint depth,
81 GLint border,
82 GLenum format, GLenum type, const GLvoid * pixels,
83 const struct gl_pixelstore_attrib *packing,
84 struct gl_texture_object *texObj,
85 struct gl_texture_image *texImage);
86 void radeonTexSubImage1D(struct gl_context * ctx, GLenum target, GLint level,
87 GLint xoffset,
88 GLsizei width,
89 GLenum format, GLenum type,
90 const GLvoid * pixels,
91 const struct gl_pixelstore_attrib *packing,
92 struct gl_texture_object *texObj,
93 struct gl_texture_image *texImage);
94 void radeonTexSubImage2D(struct gl_context * ctx, GLenum target, GLint level,
95 GLint xoffset, GLint yoffset,
96 GLsizei width, GLsizei height,
97 GLenum format, GLenum type,
98 const GLvoid * pixels,
99 const struct gl_pixelstore_attrib *packing,
100 struct gl_texture_object *texObj,
101 struct gl_texture_image *texImage);
102 void radeonCompressedTexSubImage2D(struct gl_context * ctx, GLenum target,
103 GLint level, GLint xoffset,
104 GLint yoffset, GLsizei width,
105 GLsizei height, GLenum format,
106 GLsizei imageSize, const GLvoid * data,
107 struct gl_texture_object *texObj,
108 struct gl_texture_image *texImage);
109
110 void radeonTexSubImage3D(struct gl_context * ctx, GLenum target, GLint level,
111 GLint xoffset, GLint yoffset, GLint zoffset,
112 GLsizei width, GLsizei height, GLsizei depth,
113 GLenum format, GLenum type,
114 const GLvoid * pixels,
115 const struct gl_pixelstore_attrib *packing,
116 struct gl_texture_object *texObj,
117 struct gl_texture_image *texImage);
118
119 void radeonGetTexImage(struct gl_context * ctx, GLenum target, GLint level,
120 GLenum format, GLenum type, GLvoid * pixels,
121 struct gl_texture_object *texObj,
122 struct gl_texture_image *texImage);
123 void radeonGetCompressedTexImage(struct gl_context *ctx, GLenum target, GLint level,
124 GLvoid *pixels,
125 struct gl_texture_object *texObj,
126 struct gl_texture_image *texImage);
127
128 void radeonCopyTexImage2D(struct gl_context *ctx, GLenum target, GLint level,
129 GLenum internalFormat,
130 GLint x, GLint y, GLsizei width, GLsizei height,
131 GLint border);
132
133 void radeonCopyTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level,
134 GLint xoffset, GLint yoffset,
135 GLint x, GLint y,
136 GLsizei width, GLsizei height);
137
138 unsigned radeonIsFormatRenderable(gl_format mesa_format);
139
140 #if FEATURE_OES_EGL_image
141 void radeon_image_target_texture_2d(struct gl_context *ctx, GLenum target,
142 struct gl_texture_object *texObj,
143 struct gl_texture_image *texImage,
144 GLeglImageOES image_handle);
145 #endif
146
147 #endif