1bf215546Sopenharmony_ci/**************************************************************************
2bf215546Sopenharmony_ci *
3bf215546Sopenharmony_ci * Copyright 2009 VMware, Inc.  All Rights Reserved.
4bf215546Sopenharmony_ci *
5bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
6bf215546Sopenharmony_ci * copy of this software and associated documentation files (the
7bf215546Sopenharmony_ci * "Software"), to deal in the Software without restriction, including
8bf215546Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish,
9bf215546Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to
10bf215546Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to
11bf215546Sopenharmony_ci * the following conditions:
12bf215546Sopenharmony_ci *
13bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the
14bf215546Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions
15bf215546Sopenharmony_ci * of the Software.
16bf215546Sopenharmony_ci *
17bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18bf215546Sopenharmony_ci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19bf215546Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
20bf215546Sopenharmony_ci * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
21bf215546Sopenharmony_ci * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22bf215546Sopenharmony_ci * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23bf215546Sopenharmony_ci * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24bf215546Sopenharmony_ci *
25bf215546Sopenharmony_ci **************************************************************************/
26bf215546Sopenharmony_ci
27bf215546Sopenharmony_ci
28bf215546Sopenharmony_ci#ifndef U_SURFACE_H
29bf215546Sopenharmony_ci#define U_SURFACE_H
30bf215546Sopenharmony_ci
31bf215546Sopenharmony_ci
32bf215546Sopenharmony_ci#include "pipe/p_compiler.h"
33bf215546Sopenharmony_ci#include "pipe/p_state.h"
34bf215546Sopenharmony_ci
35bf215546Sopenharmony_ci#include "util/u_pack_color.h"
36bf215546Sopenharmony_ci
37bf215546Sopenharmony_ci
38bf215546Sopenharmony_ci#ifdef __cplusplus
39bf215546Sopenharmony_ciextern "C" {
40bf215546Sopenharmony_ci#endif
41bf215546Sopenharmony_ci
42bf215546Sopenharmony_ci
43bf215546Sopenharmony_ciextern void
44bf215546Sopenharmony_ciu_surface_default_template(struct pipe_surface *view,
45bf215546Sopenharmony_ci                           const struct pipe_resource *texture);
46bf215546Sopenharmony_ci
47bf215546Sopenharmony_ciextern void
48bf215546Sopenharmony_ciutil_copy_box(ubyte * dst,
49bf215546Sopenharmony_ci              enum pipe_format format,
50bf215546Sopenharmony_ci              unsigned dst_stride, unsigned dst_slice_stride,
51bf215546Sopenharmony_ci              unsigned dst_x, unsigned dst_y, unsigned dst_z,
52bf215546Sopenharmony_ci              unsigned width, unsigned height, unsigned depth,
53bf215546Sopenharmony_ci              const ubyte * src,
54bf215546Sopenharmony_ci              int src_stride, unsigned src_slice_stride,
55bf215546Sopenharmony_ci              unsigned src_x, unsigned src_y, unsigned src_z);
56bf215546Sopenharmony_ci
57bf215546Sopenharmony_ciextern void
58bf215546Sopenharmony_ciutil_fill_rect(ubyte * dst, enum pipe_format format,
59bf215546Sopenharmony_ci               unsigned dst_stride, unsigned dst_x, unsigned dst_y,
60bf215546Sopenharmony_ci               unsigned width, unsigned height, union util_color *uc);
61bf215546Sopenharmony_ci
62bf215546Sopenharmony_ciextern void
63bf215546Sopenharmony_ciutil_fill_box(ubyte * dst, enum pipe_format format,
64bf215546Sopenharmony_ci              unsigned stride, unsigned layer_stride,
65bf215546Sopenharmony_ci              unsigned x, unsigned y, unsigned z,
66bf215546Sopenharmony_ci              unsigned width, unsigned height, unsigned depth,
67bf215546Sopenharmony_ci              union util_color *uc);
68bf215546Sopenharmony_ci
69bf215546Sopenharmony_ciextern void
70bf215546Sopenharmony_ciutil_fill_zs_box(ubyte *dst, enum pipe_format format,
71bf215546Sopenharmony_ci                 bool need_rmw, unsigned clear_flags, unsigned stride,
72bf215546Sopenharmony_ci                 unsigned layer_stride, unsigned width,
73bf215546Sopenharmony_ci                 unsigned height, unsigned depth,
74bf215546Sopenharmony_ci                 uint64_t zstencil);
75bf215546Sopenharmony_ci
76bf215546Sopenharmony_ciextern void
77bf215546Sopenharmony_ciutil_resource_copy_region(struct pipe_context *pipe,
78bf215546Sopenharmony_ci                          struct pipe_resource *dst,
79bf215546Sopenharmony_ci                          unsigned dst_level,
80bf215546Sopenharmony_ci                          unsigned dst_x, unsigned dst_y, unsigned dst_z,
81bf215546Sopenharmony_ci                          struct pipe_resource *src,
82bf215546Sopenharmony_ci                          unsigned src_level,
83bf215546Sopenharmony_ci                          const struct pipe_box *src_box);
84bf215546Sopenharmony_ci
85bf215546Sopenharmony_ciextern void
86bf215546Sopenharmony_ciutil_clear_texture(struct pipe_context *pipe,
87bf215546Sopenharmony_ci                   struct pipe_resource *tex,
88bf215546Sopenharmony_ci                   unsigned level,
89bf215546Sopenharmony_ci                   const struct pipe_box *box,
90bf215546Sopenharmony_ci                   const void *data);
91bf215546Sopenharmony_ci
92bf215546Sopenharmony_ciextern void
93bf215546Sopenharmony_ciutil_clear_render_target(struct pipe_context *pipe,
94bf215546Sopenharmony_ci                         struct pipe_surface *dst,
95bf215546Sopenharmony_ci                         const union pipe_color_union *color,
96bf215546Sopenharmony_ci                         unsigned dstx, unsigned dsty,
97bf215546Sopenharmony_ci                         unsigned width, unsigned height);
98bf215546Sopenharmony_ci
99bf215546Sopenharmony_ciextern void
100bf215546Sopenharmony_ciutil_clear_depth_stencil(struct pipe_context *pipe,
101bf215546Sopenharmony_ci                         struct pipe_surface *dst,
102bf215546Sopenharmony_ci                         unsigned clear_flags,
103bf215546Sopenharmony_ci                         double depth,
104bf215546Sopenharmony_ci                         unsigned stencil,
105bf215546Sopenharmony_ci                         unsigned dstx, unsigned dsty,
106bf215546Sopenharmony_ci                         unsigned width, unsigned height);
107bf215546Sopenharmony_ci
108bf215546Sopenharmony_cibool
109bf215546Sopenharmony_ciutil_can_blit_via_copy_region(const struct pipe_blit_info *blit,
110bf215546Sopenharmony_ci                              bool tight_format_check,
111bf215546Sopenharmony_ci                              bool render_condition_bound);
112bf215546Sopenharmony_ci
113bf215546Sopenharmony_ciextern bool
114bf215546Sopenharmony_ciutil_try_blit_via_copy_region(struct pipe_context *ctx,
115bf215546Sopenharmony_ci                              const struct pipe_blit_info *blit,
116bf215546Sopenharmony_ci                              bool render_condition_bound);
117bf215546Sopenharmony_ci
118bf215546Sopenharmony_ci
119bf215546Sopenharmony_ci#ifdef __cplusplus
120bf215546Sopenharmony_ci}
121bf215546Sopenharmony_ci#endif
122bf215546Sopenharmony_ci
123bf215546Sopenharmony_ci
124bf215546Sopenharmony_ci#endif /* U_SURFACE_H */
125