1 /**************************************************************************
3 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
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:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
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.
26 **************************************************************************/
28 #ifndef ST_MIPMAP_TREE_H
29 #define ST_MIPMAP_TREE_H
32 #include "main/mtypes.h"
35 struct pipe_mipmap_tree
;
39 extern struct pipe_mipmap_tree
*
40 st_miptree_create(struct pipe_context
*pipe
,
42 GLenum internal_format
,
49 GLuint compress_byte
);
52 st_miptree_reference(struct pipe_mipmap_tree
**dst
,
53 struct pipe_mipmap_tree
*src
);
56 st_miptree_release(struct pipe_context
*pipe
, struct pipe_mipmap_tree
**mt
);
59 /* Check if an image fits an existing mipmap tree layout
62 st_miptree_match_image(struct pipe_mipmap_tree
*mt
,
63 struct gl_texture_image
*image
,
64 GLuint face
, GLuint level
);
66 /* Return a pointer to an image within a tree. Return image stride as
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
);
76 st_miptree_image_unmap(struct pipe_context
*pipe
,
77 struct pipe_mipmap_tree
*mt
);
80 /* Return pointers to each 2d slice within an image. Indexed by depth
84 st_miptree_depth_offsets(struct pipe_mipmap_tree
*mt
, GLuint level
);
87 /* Return the linear offset of an image relative to the start of the
91 st_miptree_image_offset(const struct pipe_mipmap_tree
*mt
,
92 GLuint face
, GLuint level
);
95 st_miptree_texel_offset(const struct pipe_mipmap_tree
* mt
,
96 GLuint face
, GLuint level
,
97 GLuint col
, GLuint row
, GLuint img
);
100 /* Upload an image into a tree
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
);
109 /* Copy an image between two trees
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
);