gallium: check if surface has defined status in check_clear_depth_with_quad()
[mesa.git] / src / mesa / state_tracker / st_texture.h
1 /**************************************************************************
2 *
3 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * 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
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28 #ifndef ST_TEXTURE_H
29 #define ST_TEXTURE_H
30
31
32 #include "main/mtypes.h"
33
34 struct pipe_context;
35 struct pipe_texture;
36
37
38 extern struct pipe_texture *
39 st_texture_create(struct st_context *st,
40 enum pipe_texture_target target,
41 enum pipe_format format,
42 GLuint first_level,
43 GLuint last_level,
44 GLuint width0,
45 GLuint height0,
46 GLuint depth0,
47 GLuint compress_byte);
48
49
50 /* Check if an image fits an existing texture
51 */
52 extern GLboolean
53 st_texture_match_image(struct pipe_texture *pt,
54 struct gl_texture_image *image,
55 GLuint face, GLuint level);
56
57 /* Return a pointer to an image within a texture. Return image stride as
58 * well.
59 */
60 extern GLubyte *
61 st_texture_image_map(struct st_context *st,
62 struct st_texture_image *stImage,
63 GLuint zoffset);
64
65 extern void
66 st_texture_image_unmap(struct st_texture_image *stImage);
67
68
69 /* Return pointers to each 2d slice within an image. Indexed by depth
70 * value.
71 */
72 extern const GLuint *
73 st_texture_depth_offsets(struct pipe_texture *pt, GLuint level);
74
75
76 /* Return the linear offset of an image relative to the start of its region:
77 */
78 extern GLuint
79 st_texture_image_offset(const struct pipe_texture *pt,
80 GLuint face, GLuint level);
81
82 extern GLuint
83 st_texture_texel_offset(const struct pipe_texture * pt,
84 GLuint face, GLuint level,
85 GLuint col, GLuint row, GLuint img);
86
87
88 /* Upload an image into a texture
89 */
90 extern void
91 st_texture_image_data(struct pipe_context *pipe,
92 struct pipe_texture *dst,
93 GLuint face, GLuint level, void *src,
94 GLuint src_row_pitch, GLuint src_image_pitch);
95
96
97 /* Copy an image between two textures
98 */
99 extern void
100 st_texture_image_copy(struct pipe_context *pipe,
101 struct pipe_texture *dst,
102 GLuint face, GLuint level,
103 struct pipe_texture *src);
104
105
106 #endif