1848b8605Smrg/**************************************************************************
2848b8605Smrg *
3848b8605Smrg * Copyright 2009 VMware, Inc.  All Rights Reserved.
4848b8605Smrg *
5848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a
6848b8605Smrg * copy of this software and associated documentation files (the
7848b8605Smrg * "Software"), to deal in the Software without restriction, including
8848b8605Smrg * without limitation the rights to use, copy, modify, merge, publish,
9848b8605Smrg * distribute, sub license, and/or sell copies of the Software, and to
10848b8605Smrg * permit persons to whom the Software is furnished to do so, subject to
11848b8605Smrg * the following conditions:
12848b8605Smrg *
13848b8605Smrg * The above copyright notice and this permission notice (including the
14848b8605Smrg * next paragraph) shall be included in all copies or substantial portions
15848b8605Smrg * of the Software.
16848b8605Smrg *
17848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18848b8605Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19848b8605Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
20848b8605Smrg * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
21848b8605Smrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22848b8605Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23848b8605Smrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24848b8605Smrg *
25848b8605Smrg **************************************************************************/
26848b8605Smrg
27848b8605Smrg
28848b8605Smrg#ifndef U_SURFACE_H
29848b8605Smrg#define U_SURFACE_H
30848b8605Smrg
31848b8605Smrg
32848b8605Smrg#include "pipe/p_compiler.h"
33848b8605Smrg#include "pipe/p_state.h"
34848b8605Smrg
35848b8605Smrg#include "util/u_pack_color.h"
36848b8605Smrg
37848b8605Smrg
38848b8605Smrg#ifdef __cplusplus
39848b8605Smrgextern "C" {
40848b8605Smrg#endif
41848b8605Smrg
42848b8605Smrg
43848b8605Smrgextern void
44848b8605Smrgu_surface_default_template(struct pipe_surface *view,
45848b8605Smrg                           const struct pipe_resource *texture);
46848b8605Smrg
47848b8605Smrgextern void
48848b8605Smrgutil_copy_rect(ubyte * dst, enum pipe_format format,
49848b8605Smrg               unsigned dst_stride, unsigned dst_x, unsigned dst_y,
50848b8605Smrg               unsigned width, unsigned height, const ubyte * src,
51848b8605Smrg               int src_stride, unsigned src_x, unsigned src_y);
52848b8605Smrg
53848b8605Smrgextern void
54848b8605Smrgutil_copy_box(ubyte * dst,
55848b8605Smrg              enum pipe_format format,
56848b8605Smrg              unsigned dst_stride, unsigned dst_slice_stride,
57848b8605Smrg              unsigned dst_x, unsigned dst_y, unsigned dst_z,
58848b8605Smrg              unsigned width, unsigned height, unsigned depth,
59848b8605Smrg              const ubyte * src,
60848b8605Smrg              int src_stride, unsigned src_slice_stride,
61848b8605Smrg              unsigned src_x, unsigned src_y, unsigned src_z);
62848b8605Smrg
63848b8605Smrgextern void
64848b8605Smrgutil_fill_rect(ubyte * dst, enum pipe_format format,
65848b8605Smrg               unsigned dst_stride, unsigned dst_x, unsigned dst_y,
66848b8605Smrg               unsigned width, unsigned height, union util_color *uc);
67848b8605Smrg
68848b8605Smrgextern void
69848b8605Smrgutil_fill_box(ubyte * dst, enum pipe_format format,
70848b8605Smrg              unsigned stride, unsigned layer_stride,
71848b8605Smrg              unsigned x, unsigned y, unsigned z,
72848b8605Smrg              unsigned width, unsigned height, unsigned depth,
73848b8605Smrg              union util_color *uc);
74848b8605Smrg
75848b8605Smrg
76848b8605Smrgextern void
77848b8605Smrgutil_resource_copy_region(struct pipe_context *pipe,
78848b8605Smrg                          struct pipe_resource *dst,
79848b8605Smrg                          unsigned dst_level,
80848b8605Smrg                          unsigned dst_x, unsigned dst_y, unsigned dst_z,
81848b8605Smrg                          struct pipe_resource *src,
82848b8605Smrg                          unsigned src_level,
83848b8605Smrg                          const struct pipe_box *src_box);
84848b8605Smrg
85b8e80941Smrgextern void
86b8e80941Smrgutil_clear_texture(struct pipe_context *pipe,
87b8e80941Smrg                   struct pipe_resource *tex,
88b8e80941Smrg                   unsigned level,
89b8e80941Smrg                   const struct pipe_box *box,
90b8e80941Smrg                   const void *data);
91b8e80941Smrg
92848b8605Smrgextern void
93848b8605Smrgutil_clear_render_target(struct pipe_context *pipe,
94848b8605Smrg                         struct pipe_surface *dst,
95848b8605Smrg                         const union pipe_color_union *color,
96848b8605Smrg                         unsigned dstx, unsigned dsty,
97848b8605Smrg                         unsigned width, unsigned height);
98848b8605Smrg
99848b8605Smrgextern void
100848b8605Smrgutil_clear_depth_stencil(struct pipe_context *pipe,
101848b8605Smrg                         struct pipe_surface *dst,
102848b8605Smrg                         unsigned clear_flags,
103848b8605Smrg                         double depth,
104848b8605Smrg                         unsigned stencil,
105848b8605Smrg                         unsigned dstx, unsigned dsty,
106848b8605Smrg                         unsigned width, unsigned height);
107848b8605Smrg
108b8e80941Smrgboolean
109b8e80941Smrgutil_can_blit_via_copy_region(const struct pipe_blit_info *blit,
110b8e80941Smrg                              boolean tight_format_check);
111b8e80941Smrg
112848b8605Smrgextern boolean
113848b8605Smrgutil_try_blit_via_copy_region(struct pipe_context *ctx,
114848b8605Smrg                              const struct pipe_blit_info *blit);
115848b8605Smrg
116848b8605Smrg
117848b8605Smrg#ifdef __cplusplus
118848b8605Smrg}
119848b8605Smrg#endif
120848b8605Smrg
121848b8605Smrg
122848b8605Smrg#endif /* U_SURFACE_H */
123