Merge branch 'glsl-to-tgsi'
[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 void copy_rows(void* dst, GLuint dststride, const void* src, GLuint srcstride,
38 GLuint numrows, GLuint rowsize);
39 struct gl_texture_image *radeonNewTextureImage(struct gl_context *ctx);
40 void radeonFreeTexImageData(struct gl_context *ctx, struct gl_texture_image *timage);
41
42 void radeon_teximage_map(radeon_texture_image *image, GLboolean write_enable);
43 void radeon_teximage_unmap(radeon_texture_image *image);
44 void radeonMapTexture(struct gl_context *ctx, struct gl_texture_object *texObj);
45 void radeonUnmapTexture(struct gl_context *ctx, struct gl_texture_object *texObj);
46 void radeonGenerateMipmap(struct gl_context* ctx, GLenum target, struct gl_texture_object *texObj);
47 int radeon_validate_texture_miptree(struct gl_context * ctx, struct gl_texture_object *texObj);
48
49 gl_format radeonChooseTextureFormat_mesa(struct gl_context * ctx,
50 GLint internalFormat,
51 GLenum format,
52 GLenum type);
53
54 gl_format radeonChooseTextureFormat(struct gl_context * ctx,
55 GLint internalFormat,
56 GLenum format,
57 GLenum type, GLboolean fbo);
58
59 void radeonTexImage1D(struct gl_context * ctx, GLenum target, GLint level,
60 GLint internalFormat,
61 GLint width, GLint border,
62 GLenum format, GLenum type, const GLvoid * pixels,
63 const struct gl_pixelstore_attrib *packing,
64 struct gl_texture_object *texObj,
65 struct gl_texture_image *texImage);
66 void radeonTexImage2D(struct gl_context * ctx, GLenum target, GLint level,
67 GLint internalFormat,
68 GLint width, GLint height, GLint border,
69 GLenum format, GLenum type, const GLvoid * pixels,
70 const struct gl_pixelstore_attrib *packing,
71 struct gl_texture_object *texObj,
72 struct gl_texture_image *texImage);
73 void radeonCompressedTexImage2D(struct gl_context * ctx, GLenum target,
74 GLint level, GLint internalFormat,
75 GLint width, GLint height, GLint border,
76 GLsizei imageSize, const GLvoid * data,
77 struct gl_texture_object *texObj,
78 struct gl_texture_image *texImage);
79 void radeonTexImage3D(struct gl_context * ctx, GLenum target, GLint level,
80 GLint internalFormat,
81 GLint width, GLint height, GLint depth,
82 GLint border,
83 GLenum format, GLenum type, const GLvoid * pixels,
84 const struct gl_pixelstore_attrib *packing,
85 struct gl_texture_object *texObj,
86 struct gl_texture_image *texImage);
87 void radeonTexSubImage1D(struct gl_context * ctx, GLenum target, GLint level,
88 GLint xoffset,
89 GLsizei width,
90 GLenum format, GLenum type,
91 const GLvoid * pixels,
92 const struct gl_pixelstore_attrib *packing,
93 struct gl_texture_object *texObj,
94 struct gl_texture_image *texImage);
95 void radeonTexSubImage2D(struct gl_context * ctx, GLenum target, GLint level,
96 GLint xoffset, GLint yoffset,
97 GLsizei width, GLsizei height,
98 GLenum format, GLenum type,
99 const GLvoid * pixels,
100 const struct gl_pixelstore_attrib *packing,
101 struct gl_texture_object *texObj,
102 struct gl_texture_image *texImage);
103 void radeonCompressedTexSubImage2D(struct gl_context * ctx, GLenum target,
104 GLint level, GLint xoffset,
105 GLint yoffset, GLsizei width,
106 GLsizei height, GLenum format,
107 GLsizei imageSize, const GLvoid * data,
108 struct gl_texture_object *texObj,
109 struct gl_texture_image *texImage);
110
111 void radeonTexSubImage3D(struct gl_context * ctx, GLenum target, GLint level,
112 GLint xoffset, GLint yoffset, GLint zoffset,
113 GLsizei width, GLsizei height, GLsizei depth,
114 GLenum format, GLenum type,
115 const GLvoid * pixels,
116 const struct gl_pixelstore_attrib *packing,
117 struct gl_texture_object *texObj,
118 struct gl_texture_image *texImage);
119
120 void radeonGetTexImage(struct gl_context * ctx, GLenum target, GLint level,
121 GLenum format, GLenum type, GLvoid * pixels,
122 struct gl_texture_object *texObj,
123 struct gl_texture_image *texImage);
124 void radeonGetCompressedTexImage(struct gl_context *ctx, GLenum target, GLint level,
125 GLvoid *pixels,
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 #endif