ilo: embed ilo_state_vf in ilo_ve_state
[mesa.git] / src / gallium / drivers / ilo / ilo_blitter.h
1 /*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 2013 LunarG, Inc.
5 *
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:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
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.
23 *
24 * Authors:
25 * Chia-I Wu <olv@lunarg.com>
26 */
27
28 #ifndef ILO_BLITTER_H
29 #define ILO_BLITTER_H
30
31 #include "ilo_common.h"
32 #include "ilo_state.h"
33
34 enum ilo_blitter_uses {
35 ILO_BLITTER_USE_DSA = 1 << 0,
36 ILO_BLITTER_USE_CC = 1 << 1,
37 ILO_BLITTER_USE_VIEWPORT = 1 << 2,
38 ILO_BLITTER_USE_FB_DEPTH = 1 << 3,
39 ILO_BLITTER_USE_FB_STENCIL = 1 << 4,
40 };
41
42 struct blitter_context;
43 struct pipe_resource;
44 struct pipe_surface;
45 struct ilo_context;
46
47 struct ilo_blitter {
48 struct ilo_context *ilo;
49 struct blitter_context *pipe_blitter;
50
51 /*
52 * A minimal context with the goal to send RECTLISTs down the pipeline.
53 */
54 enum ilo_state_raster_earlyz_op earlyz_op;
55 bool earlyz_stencil_clear;
56 uint32_t uses;
57
58 bool initialized;
59
60 float vertices[3][2];
61 struct pipe_draw_info draw;
62
63 uint32_t vf_data[2];
64 struct ilo_state_vf vf;
65 struct ilo_state_sol sol;
66
67 struct ilo_state_viewport vp;
68 uint32_t vp_data[20];
69
70 struct ilo_state_cc cc;
71
72 uint32_t depth_clear_value;
73
74 struct ilo_state_urb urb;
75
76 struct {
77 struct ilo_surface_cso dst;
78 unsigned width, height;
79 unsigned num_samples;
80
81 struct ilo_state_raster rs;
82 } fb;
83 };
84
85 struct ilo_blitter *
86 ilo_blitter_create(struct ilo_context *ilo);
87
88 void
89 ilo_blitter_destroy(struct ilo_blitter *blitter);
90
91 bool
92 ilo_blitter_pipe_blit(struct ilo_blitter *blitter,
93 const struct pipe_blit_info *info);
94
95 bool
96 ilo_blitter_pipe_copy_resource(struct ilo_blitter *blitter,
97 struct pipe_resource *dst, unsigned dst_level,
98 unsigned dst_x, unsigned dst_y, unsigned dst_z,
99 struct pipe_resource *src, unsigned src_level,
100 const struct pipe_box *src_box);
101
102 bool
103 ilo_blitter_pipe_clear_rt(struct ilo_blitter *blitter,
104 struct pipe_surface *rt,
105 const union pipe_color_union *color,
106 unsigned x, unsigned y,
107 unsigned width, unsigned height);
108
109 bool
110 ilo_blitter_pipe_clear_zs(struct ilo_blitter *blitter,
111 struct pipe_surface *zs,
112 unsigned clear_flags,
113 double depth, unsigned stencil,
114 unsigned x, unsigned y,
115 unsigned width, unsigned height);
116
117 bool
118 ilo_blitter_pipe_clear_fb(struct ilo_blitter *blitter,
119 unsigned buffers,
120 const union pipe_color_union *color,
121 double depth, unsigned stencil);
122
123 bool
124 ilo_blitter_blt_copy_resource(struct ilo_blitter *blitter,
125 struct pipe_resource *dst, unsigned dst_level,
126 unsigned dst_x, unsigned dst_y, unsigned dst_z,
127 struct pipe_resource *src, unsigned src_level,
128 const struct pipe_box *src_box);
129
130 bool
131 ilo_blitter_blt_clear_rt(struct ilo_blitter *blitter,
132 struct pipe_surface *rt,
133 const union pipe_color_union *color,
134 unsigned x, unsigned y,
135 unsigned width, unsigned height);
136
137 bool
138 ilo_blitter_blt_clear_zs(struct ilo_blitter *blitter,
139 struct pipe_surface *zs,
140 unsigned clear_flags,
141 double depth, unsigned stencil,
142 unsigned x, unsigned y,
143 unsigned width, unsigned height);
144
145 bool
146 ilo_blitter_rectlist_clear_zs(struct ilo_blitter *blitter,
147 struct pipe_surface *zs,
148 unsigned clear_flags,
149 double depth, unsigned stencil);
150
151 void
152 ilo_blitter_rectlist_resolve_z(struct ilo_blitter *blitter,
153 struct pipe_resource *res,
154 unsigned level, unsigned slice);
155
156 void
157 ilo_blitter_rectlist_resolve_hiz(struct ilo_blitter *blitter,
158 struct pipe_resource *res,
159 unsigned level, unsigned slice);
160
161 #endif /* ILO_BLITTER_H */