14a49301eSmrg/**************************************************************************
24a49301eSmrg *
34a49301eSmrg * Copyright 2009 VMware, Inc.  All Rights Reserved.
44a49301eSmrg *
54a49301eSmrg * Permission is hereby granted, free of charge, to any person obtaining a
64a49301eSmrg * copy of this software and associated documentation files (the
74a49301eSmrg * "Software"), to deal in the Software without restriction, including
84a49301eSmrg * without limitation the rights to use, copy, modify, merge, publish,
94a49301eSmrg * distribute, sub license, and/or sell copies of the Software, and to
104a49301eSmrg * permit persons to whom the Software is furnished to do so, subject to
114a49301eSmrg * the following conditions:
124a49301eSmrg *
134a49301eSmrg * The above copyright notice and this permission notice (including the
144a49301eSmrg * next paragraph) shall be included in all copies or substantial portions
154a49301eSmrg * of the Software.
164a49301eSmrg *
174a49301eSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
184a49301eSmrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
194a49301eSmrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
204a49301eSmrg * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
214a49301eSmrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
224a49301eSmrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
234a49301eSmrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
244a49301eSmrg *
254a49301eSmrg **************************************************************************/
264a49301eSmrg
274a49301eSmrg
284a49301eSmrg#ifndef U_SURFACE_H
294a49301eSmrg#define U_SURFACE_H
304a49301eSmrg
314a49301eSmrg
324a49301eSmrg#include "pipe/p_compiler.h"
33cdc920a0Smrg#include "pipe/p_state.h"
344a49301eSmrg
35af69d88dSmrg#include "util/u_pack_color.h"
36af69d88dSmrg
374a49301eSmrg
383464ebd5Sriastradh#ifdef __cplusplus
393464ebd5Sriastradhextern "C" {
403464ebd5Sriastradh#endif
414a49301eSmrg
424a49301eSmrg
433464ebd5Sriastradhextern void
443464ebd5Sriastradhu_surface_default_template(struct pipe_surface *view,
45af69d88dSmrg                           const struct pipe_resource *texture);
464a49301eSmrg
47af69d88dSmrgextern void
48af69d88dSmrgutil_copy_box(ubyte * dst,
49af69d88dSmrg              enum pipe_format format,
50af69d88dSmrg              unsigned dst_stride, unsigned dst_slice_stride,
51af69d88dSmrg              unsigned dst_x, unsigned dst_y, unsigned dst_z,
52af69d88dSmrg              unsigned width, unsigned height, unsigned depth,
53af69d88dSmrg              const ubyte * src,
54af69d88dSmrg              int src_stride, unsigned src_slice_stride,
55af69d88dSmrg              unsigned src_x, unsigned src_y, unsigned src_z);
564a49301eSmrg
574a49301eSmrgextern void
58af69d88dSmrgutil_fill_rect(ubyte * dst, enum pipe_format format,
59af69d88dSmrg               unsigned dst_stride, unsigned dst_x, unsigned dst_y,
60af69d88dSmrg               unsigned width, unsigned height, union util_color *uc);
614a49301eSmrg
62af69d88dSmrgextern void
63af69d88dSmrgutil_fill_box(ubyte * dst, enum pipe_format format,
64af69d88dSmrg              unsigned stride, unsigned layer_stride,
65af69d88dSmrg              unsigned x, unsigned y, unsigned z,
66af69d88dSmrg              unsigned width, unsigned height, unsigned depth,
67af69d88dSmrg              union util_color *uc);
684a49301eSmrg
697ec681f3Smrgextern void
707ec681f3Smrgutil_fill_zs_box(ubyte *dst, enum pipe_format format,
717ec681f3Smrg                 bool need_rmw, unsigned clear_flags, unsigned stride,
727ec681f3Smrg                 unsigned layer_stride, unsigned width,
737ec681f3Smrg                 unsigned height, unsigned depth,
747ec681f3Smrg                 uint64_t zstencil);
75cdc920a0Smrg
76cdc920a0Smrgextern void
773464ebd5Sriastradhutil_resource_copy_region(struct pipe_context *pipe,
783464ebd5Sriastradh                          struct pipe_resource *dst,
793464ebd5Sriastradh                          unsigned dst_level,
803464ebd5Sriastradh                          unsigned dst_x, unsigned dst_y, unsigned dst_z,
813464ebd5Sriastradh                          struct pipe_resource *src,
823464ebd5Sriastradh                          unsigned src_level,
833464ebd5Sriastradh                          const struct pipe_box *src_box);
84cdc920a0Smrg
8501e04c3fSmrgextern void
8601e04c3fSmrgutil_clear_texture(struct pipe_context *pipe,
8701e04c3fSmrg                   struct pipe_resource *tex,
8801e04c3fSmrg                   unsigned level,
8901e04c3fSmrg                   const struct pipe_box *box,
9001e04c3fSmrg                   const void *data);
9101e04c3fSmrg
923464ebd5Sriastradhextern void
933464ebd5Sriastradhutil_clear_render_target(struct pipe_context *pipe,
943464ebd5Sriastradh                         struct pipe_surface *dst,
95af69d88dSmrg                         const union pipe_color_union *color,
963464ebd5Sriastradh                         unsigned dstx, unsigned dsty,
973464ebd5Sriastradh                         unsigned width, unsigned height);
98cdc920a0Smrg
99cdc920a0Smrgextern void
1003464ebd5Sriastradhutil_clear_depth_stencil(struct pipe_context *pipe,
1013464ebd5Sriastradh                         struct pipe_surface *dst,
1023464ebd5Sriastradh                         unsigned clear_flags,
1033464ebd5Sriastradh                         double depth,
1043464ebd5Sriastradh                         unsigned stencil,
1053464ebd5Sriastradh                         unsigned dstx, unsigned dsty,
1063464ebd5Sriastradh                         unsigned width, unsigned height);
1073464ebd5Sriastradh
10801e04c3fSmrgboolean
10901e04c3fSmrgutil_can_blit_via_copy_region(const struct pipe_blit_info *blit,
11001e04c3fSmrg                              boolean tight_format_check);
11101e04c3fSmrg
112af69d88dSmrgextern boolean
113af69d88dSmrgutil_try_blit_via_copy_region(struct pipe_context *ctx,
114af69d88dSmrg                              const struct pipe_blit_info *blit);
115af69d88dSmrg
1163464ebd5Sriastradh
1173464ebd5Sriastradh#ifdef __cplusplus
1183464ebd5Sriastradh}
1193464ebd5Sriastradh#endif
120cdc920a0Smrg
121cdc920a0Smrg
1224a49301eSmrg#endif /* U_SURFACE_H */
123