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
37extern gl_format _radeon_texformat_rgba8888;
38extern gl_format _radeon_texformat_argb8888;
39extern gl_format _radeon_texformat_rgb565;
40extern gl_format _radeon_texformat_argb4444;
41extern gl_format _radeon_texformat_argb1555;
42extern gl_format _radeon_texformat_al88;
43
44extern
45void copy_rows(void* dst, GLuint dststride, const void* src, GLuint srcstride,
46	GLuint numrows, GLuint rowsize);
47struct gl_texture_image *radeonNewTextureImage(struct gl_context *ctx);
48void radeonFreeTextureImageBuffer(struct gl_context *ctx, struct gl_texture_image *timage);
49
50void radeon_teximage_map(radeon_texture_image *image, GLboolean write_enable);
51void radeon_teximage_unmap(radeon_texture_image *image);
52int radeon_validate_texture_miptree(struct gl_context * ctx,
53				    struct gl_sampler_object *samp,
54				    struct gl_texture_object *texObj);
55
56
57void radeon_swrast_map_texture_images(struct gl_context *ctx, struct gl_texture_object *texObj);
58void radeon_swrast_unmap_texture_images(struct gl_context *ctx, struct gl_texture_object *texObj);
59
60gl_format radeonChooseTextureFormat_mesa(struct gl_context * ctx,
61                                         GLenum target,
62                                         GLint internalFormat,
63                                         GLenum format,
64                                         GLenum type);
65
66gl_format radeonChooseTextureFormat(struct gl_context * ctx,
67                                    GLint internalFormat,
68                                    GLenum format,
69                                    GLenum type, GLboolean fbo);
70
71void radeonCopyTexSubImage(struct gl_context *ctx, GLuint dims,
72                           struct gl_texture_image *texImage,
73                           GLint xoffset, GLint yoffset, GLint zoffset,
74                           struct gl_renderbuffer *rb,
75                           GLint x, GLint y,
76                           GLsizei width, GLsizei height);
77
78unsigned radeonIsFormatRenderable(gl_format mesa_format);
79
80#if FEATURE_OES_EGL_image
81void radeon_image_target_texture_2d(struct gl_context *ctx, GLenum target,
82				    struct gl_texture_object *texObj,
83				    struct gl_texture_image *texImage,
84				    GLeglImageOES image_handle);
85#endif
86
87void
88radeon_init_common_texture_funcs(radeonContextPtr radeon,
89				 struct dd_function_table *functions);
90
91#endif
92