Use write posting in the kickoff function too.
[mesa.git] / src / mesa / state_tracker / st_mipmap_tree.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_MIPMAP_TREE_H
29 #define ST_MIPMAP_TREE_H
30
31
32 #include "main/mtypes.h"
33
34 struct pipe_context;
35 struct pipe_mipmap_tree;
36 struct pipe_region;
37
38
39 extern struct pipe_mipmap_tree *
40 st_miptree_create(struct pipe_context *pipe,
41 GLenum target,
42 GLenum internal_format,
43 GLuint first_level,
44 GLuint last_level,
45 GLuint width0,
46 GLuint height0,
47 GLuint depth0,
48 GLuint cpp,
49 GLuint compress_byte);
50
51 extern void
52 st_miptree_reference(struct pipe_mipmap_tree **dst,
53 struct pipe_mipmap_tree *src);
54
55 extern void
56 st_miptree_release(struct pipe_context *pipe, struct pipe_mipmap_tree **mt);
57
58
59 /* Check if an image fits an existing mipmap tree layout
60 */
61 extern GLboolean
62 st_miptree_match_image(struct pipe_mipmap_tree *mt,
63 struct gl_texture_image *image,
64 GLuint face, GLuint level);
65
66 /* Return a pointer to an image within a tree. Return image stride as
67 * well.
68 */
69 extern GLubyte *
70 st_miptree_image_map(struct pipe_context *pipe,
71 struct pipe_mipmap_tree *mt,
72 GLuint face, GLuint level,
73 GLuint * row_stride, GLuint * image_stride);
74
75 extern void
76 st_miptree_image_unmap(struct pipe_context *pipe,
77 struct pipe_mipmap_tree *mt);
78
79
80 /* Return pointers to each 2d slice within an image. Indexed by depth
81 * value.
82 */
83 extern const GLuint *
84 st_miptree_depth_offsets(struct pipe_mipmap_tree *mt, GLuint level);
85
86
87 /* Return the linear offset of an image relative to the start of the
88 * tree:
89 */
90 extern GLuint
91 st_miptree_image_offset(const struct pipe_mipmap_tree *mt,
92 GLuint face, GLuint level);
93
94 extern GLuint
95 st_miptree_texel_offset(const struct pipe_mipmap_tree * mt,
96 GLuint face, GLuint level,
97 GLuint col, GLuint row, GLuint img);
98
99
100 /* Upload an image into a tree
101 */
102 extern void
103 st_miptree_image_data(struct pipe_context *pipe,
104 struct pipe_mipmap_tree *dst,
105 GLuint face, GLuint level, void *src,
106 GLuint src_row_pitch, GLuint src_image_pitch);
107
108
109 /* Copy an image between two trees
110 */
111 extern void
112 st_miptree_image_copy(struct pipe_context *pipe,
113 struct pipe_mipmap_tree *dst,
114 GLuint face, GLuint level,
115 struct pipe_mipmap_tree *src);
116
117
118 #endif