f1af109707fdaf8269074c76b53fd0bd191fcbe8
[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 #include "main/mfeatures.h"
36
37 extern gl_format _radeon_texformat_rgba8888;
38 extern gl_format _radeon_texformat_argb8888;
39 extern gl_format _radeon_texformat_rgb565;
40 extern gl_format _radeon_texformat_argb4444;
41 extern gl_format _radeon_texformat_argb1555;
42 extern gl_format _radeon_texformat_al88;
43
44 extern
45 void copy_rows(void* dst, GLuint dststride, const void* src, GLuint srcstride,
46 GLuint numrows, GLuint rowsize);
47 struct gl_texture_image *radeonNewTextureImage(struct gl_context *ctx);
48 void radeonFreeTextureImageBuffer(struct gl_context *ctx, struct gl_texture_image *timage);
49
50 void radeon_teximage_map(radeon_texture_image *image, GLboolean write_enable);
51 void radeon_teximage_unmap(radeon_texture_image *image);
52 int radeon_validate_texture_miptree(struct gl_context * ctx, struct gl_texture_object *texObj);
53
54
55 void radeon_swrast_map_texture_images(struct gl_context *ctx, struct gl_texture_object *texObj);
56 void radeon_swrast_unmap_texture_images(struct gl_context *ctx, struct gl_texture_object *texObj);
57
58 gl_format radeonChooseTextureFormat_mesa(struct gl_context * ctx,
59 GLint internalFormat,
60 GLenum format,
61 GLenum type);
62
63 gl_format radeonChooseTextureFormat(struct gl_context * ctx,
64 GLint internalFormat,
65 GLenum format,
66 GLenum type, GLboolean fbo);
67
68 void radeonTexImage1D(struct gl_context * ctx, GLenum target, GLint level,
69 GLint internalFormat,
70 GLint width, GLint border,
71 GLenum format, GLenum type, const GLvoid * pixels,
72 const struct gl_pixelstore_attrib *packing,
73 struct gl_texture_object *texObj,
74 struct gl_texture_image *texImage);
75 void radeonTexImage2D(struct gl_context * ctx, GLenum target, GLint level,
76 GLint internalFormat,
77 GLint width, GLint height, GLint border,
78 GLenum format, GLenum type, const GLvoid * pixels,
79 const struct gl_pixelstore_attrib *packing,
80 struct gl_texture_object *texObj,
81 struct gl_texture_image *texImage);
82 void radeonCompressedTexImage2D(struct gl_context * ctx, GLenum target,
83 GLint level, GLint internalFormat,
84 GLint width, GLint height, GLint border,
85 GLsizei imageSize, const GLvoid * data,
86 struct gl_texture_object *texObj,
87 struct gl_texture_image *texImage);
88 void radeonTexImage3D(struct gl_context * ctx, GLenum target, GLint level,
89 GLint internalFormat,
90 GLint width, GLint height, GLint depth,
91 GLint border,
92 GLenum format, GLenum type, const GLvoid * pixels,
93 const struct gl_pixelstore_attrib *packing,
94 struct gl_texture_object *texObj,
95 struct gl_texture_image *texImage);
96 void radeonTexSubImage1D(struct gl_context * ctx, GLenum target, GLint level,
97 GLint xoffset,
98 GLsizei width,
99 GLenum format, GLenum type,
100 const GLvoid * pixels,
101 const struct gl_pixelstore_attrib *packing,
102 struct gl_texture_object *texObj,
103 struct gl_texture_image *texImage);
104 void radeonTexSubImage2D(struct gl_context * ctx, GLenum target, GLint level,
105 GLint xoffset, GLint yoffset,
106 GLsizei width, GLsizei height,
107 GLenum format, GLenum type,
108 const GLvoid * pixels,
109 const struct gl_pixelstore_attrib *packing,
110 struct gl_texture_object *texObj,
111 struct gl_texture_image *texImage);
112 void radeonCompressedTexSubImage2D(struct gl_context * ctx, GLenum target,
113 GLint level, GLint xoffset,
114 GLint yoffset, GLsizei width,
115 GLsizei height, GLenum format,
116 GLsizei imageSize, const GLvoid * data,
117 struct gl_texture_object *texObj,
118 struct gl_texture_image *texImage);
119
120 void radeonTexSubImage3D(struct gl_context * ctx, GLenum target, GLint level,
121 GLint xoffset, GLint yoffset, GLint zoffset,
122 GLsizei width, GLsizei height, GLsizei depth,
123 GLenum format, GLenum type,
124 const GLvoid * pixels,
125 const struct gl_pixelstore_attrib *packing,
126 struct gl_texture_object *texObj,
127 struct gl_texture_image *texImage);
128
129 void radeonCopyTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level,
130 GLint xoffset, GLint yoffset,
131 GLint x, GLint y,
132 GLsizei width, GLsizei height);
133
134 unsigned radeonIsFormatRenderable(gl_format mesa_format);
135
136 #if FEATURE_OES_EGL_image
137 void radeon_image_target_texture_2d(struct gl_context *ctx, GLenum target,
138 struct gl_texture_object *texObj,
139 struct gl_texture_image *texImage,
140 GLeglImageOES image_handle);
141 #endif
142
143 void
144 radeon_init_common_texture_funcs(radeonContextPtr radeon,
145 struct dd_function_table *functions);
146
147 #endif