2 * Mesa 3-D graphics library
4 * Copyright (C) 2013 LunarG, Inc.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
25 * Chia-I Wu <olv@lunarg.com>
31 #include "ilo_common.h"
32 #include "ilo_context.h"
35 enum ilo_blitter_uses
{
36 ILO_BLITTER_USE_DSA
= 1 << 0,
37 ILO_BLITTER_USE_CC
= 1 << 1,
38 ILO_BLITTER_USE_VIEWPORT
= 1 << 2,
39 ILO_BLITTER_USE_FB_DEPTH
= 1 << 3,
40 ILO_BLITTER_USE_FB_STENCIL
= 1 << 4,
43 enum ilo_blitter_rectlist_op
{
44 ILO_BLITTER_RECTLIST_CLEAR_ZS
,
45 ILO_BLITTER_RECTLIST_RESOLVE_Z
,
46 ILO_BLITTER_RECTLIST_RESOLVE_HIZ
,
49 struct blitter_context
;
54 struct ilo_context
*ilo
;
55 struct blitter_context
*pipe_blitter
;
58 * A minimal context with the goal to send RECTLISTs down the pipeline.
60 enum ilo_blitter_rectlist_op op
;
66 struct pipe_resource
*res
;
67 unsigned offset
, size
;
70 struct ilo_ve_state ve
;
71 struct ilo_vb_state vb
;
72 struct pipe_draw_info draw
;
74 struct ilo_viewport_cso viewport
;
75 struct ilo_dsa_state dsa
;
78 struct pipe_stencil_ref stencil_ref
;
80 struct pipe_blend_color blend_color
;
83 uint32_t depth_clear_value
;
86 struct ilo_surface_cso dst
;
87 unsigned width
, height
;
93 ilo_blitter_create(struct ilo_context
*ilo
);
96 ilo_blitter_destroy(struct ilo_blitter
*blitter
);
99 ilo_blitter_pipe_blit(struct ilo_blitter
*blitter
,
100 const struct pipe_blit_info
*info
);
103 ilo_blitter_pipe_copy_resource(struct ilo_blitter
*blitter
,
104 struct pipe_resource
*dst
, unsigned dst_level
,
105 unsigned dst_x
, unsigned dst_y
, unsigned dst_z
,
106 struct pipe_resource
*src
, unsigned src_level
,
107 const struct pipe_box
*src_box
);
110 ilo_blitter_pipe_clear_rt(struct ilo_blitter
*blitter
,
111 struct pipe_surface
*rt
,
112 const union pipe_color_union
*color
,
113 unsigned x
, unsigned y
,
114 unsigned width
, unsigned height
);
117 ilo_blitter_pipe_clear_zs(struct ilo_blitter
*blitter
,
118 struct pipe_surface
*zs
,
119 unsigned clear_flags
,
120 double depth
, unsigned stencil
,
121 unsigned x
, unsigned y
,
122 unsigned width
, unsigned height
);
125 ilo_blitter_pipe_clear_fb(struct ilo_blitter
*blitter
,
127 const union pipe_color_union
*color
,
128 double depth
, unsigned stencil
);
131 ilo_blitter_blt_copy_resource(struct ilo_blitter
*blitter
,
132 struct pipe_resource
*dst
, unsigned dst_level
,
133 unsigned dst_x
, unsigned dst_y
, unsigned dst_z
,
134 struct pipe_resource
*src
, unsigned src_level
,
135 const struct pipe_box
*src_box
);
138 ilo_blitter_blt_clear_rt(struct ilo_blitter
*blitter
,
139 struct pipe_surface
*rt
,
140 const union pipe_color_union
*color
,
141 unsigned x
, unsigned y
,
142 unsigned width
, unsigned height
);
145 ilo_blitter_blt_clear_zs(struct ilo_blitter
*blitter
,
146 struct pipe_surface
*zs
,
147 unsigned clear_flags
,
148 double depth
, unsigned stencil
,
149 unsigned x
, unsigned y
,
150 unsigned width
, unsigned height
);
153 ilo_blitter_rectlist_clear_zs(struct ilo_blitter
*blitter
,
154 struct pipe_surface
*zs
,
155 unsigned clear_flags
,
156 double depth
, unsigned stencil
);
159 ilo_blitter_rectlist_resolve_z(struct ilo_blitter
*blitter
,
160 struct pipe_resource
*res
,
161 unsigned level
, unsigned slice
);
164 ilo_blitter_rectlist_resolve_hiz(struct ilo_blitter
*blitter
,
165 struct pipe_resource
*res
,
166 unsigned level
, unsigned slice
);
168 #endif /* ILO_BLITTER_H */