ilo: embed ilo_state_sol in ilo_shader
[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 ilo_ve_state ve;
62 struct pipe_draw_info draw;
63
64 struct ilo_state_sol sol;
65
66 struct ilo_state_viewport vp;
67 uint32_t vp_data[20];
68
69 struct ilo_state_cc cc;
70
71 uint32_t depth_clear_value;
72
73 struct {
74 struct ilo_surface_cso dst;
75 unsigned width, height;
76 unsigned num_samples;
77
78 struct ilo_state_raster rs;
79 } fb;
80 };
81
82 struct ilo_blitter *
83 ilo_blitter_create(struct ilo_context *ilo);
84
85 void
86 ilo_blitter_destroy(struct ilo_blitter *blitter);
87
88 bool
89 ilo_blitter_pipe_blit(struct ilo_blitter *blitter,
90 const struct pipe_blit_info *info);
91
92 bool
93 ilo_blitter_pipe_copy_resource(struct ilo_blitter *blitter,
94 struct pipe_resource *dst, unsigned dst_level,
95 unsigned dst_x, unsigned dst_y, unsigned dst_z,
96 struct pipe_resource *src, unsigned src_level,
97 const struct pipe_box *src_box);
98
99 bool
100 ilo_blitter_pipe_clear_rt(struct ilo_blitter *blitter,
101 struct pipe_surface *rt,
102 const union pipe_color_union *color,
103 unsigned x, unsigned y,
104 unsigned width, unsigned height);
105
106 bool
107 ilo_blitter_pipe_clear_zs(struct ilo_blitter *blitter,
108 struct pipe_surface *zs,
109 unsigned clear_flags,
110 double depth, unsigned stencil,
111 unsigned x, unsigned y,
112 unsigned width, unsigned height);
113
114 bool
115 ilo_blitter_pipe_clear_fb(struct ilo_blitter *blitter,
116 unsigned buffers,
117 const union pipe_color_union *color,
118 double depth, unsigned stencil);
119
120 bool
121 ilo_blitter_blt_copy_resource(struct ilo_blitter *blitter,
122 struct pipe_resource *dst, unsigned dst_level,
123 unsigned dst_x, unsigned dst_y, unsigned dst_z,
124 struct pipe_resource *src, unsigned src_level,
125 const struct pipe_box *src_box);
126
127 bool
128 ilo_blitter_blt_clear_rt(struct ilo_blitter *blitter,
129 struct pipe_surface *rt,
130 const union pipe_color_union *color,
131 unsigned x, unsigned y,
132 unsigned width, unsigned height);
133
134 bool
135 ilo_blitter_blt_clear_zs(struct ilo_blitter *blitter,
136 struct pipe_surface *zs,
137 unsigned clear_flags,
138 double depth, unsigned stencil,
139 unsigned x, unsigned y,
140 unsigned width, unsigned height);
141
142 bool
143 ilo_blitter_rectlist_clear_zs(struct ilo_blitter *blitter,
144 struct pipe_surface *zs,
145 unsigned clear_flags,
146 double depth, unsigned stencil);
147
148 void
149 ilo_blitter_rectlist_resolve_z(struct ilo_blitter *blitter,
150 struct pipe_resource *res,
151 unsigned level, unsigned slice);
152
153 void
154 ilo_blitter_rectlist_resolve_hiz(struct ilo_blitter *blitter,
155 struct pipe_resource *res,
156 unsigned level, unsigned slice);
157
158 #endif /* ILO_BLITTER_H */