2 * Copyright © 2012 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
33 struct brw_stage_prog_data
;
42 struct blorp_context
{
45 const struct isl_device
*isl_dev
;
47 const struct brw_compiler
*compiler
;
55 bool (*lookup_shader
)(struct blorp_context
*blorp
,
56 const void *key
, uint32_t key_size
,
57 uint32_t *kernel_out
, void *prog_data_out
);
58 void (*upload_shader
)(struct blorp_context
*blorp
,
59 const void *key
, uint32_t key_size
,
60 const void *kernel
, uint32_t kernel_size
,
61 const struct brw_stage_prog_data
*prog_data
,
62 uint32_t prog_data_size
,
63 uint32_t *kernel_out
, void *prog_data_out
);
64 void (*exec
)(struct blorp_batch
*batch
, const struct blorp_params
*params
);
67 void blorp_init(struct blorp_context
*blorp
, void *driver_ctx
,
68 struct isl_device
*isl_dev
);
69 void blorp_finish(struct blorp_context
*blorp
);
71 enum blorp_batch_flags
{
73 * This flag indicates that blorp should *not* re-emit the depth and
74 * stencil buffer packets. Instead, the driver guarantees that all depth
75 * and stencil images passed in will match what is currently set in the
78 BLORP_BATCH_NO_EMIT_DEPTH_STENCIL
= (1 << 0),
82 struct blorp_context
*blorp
;
84 enum blorp_batch_flags flags
;
87 void blorp_batch_init(struct blorp_context
*blorp
, struct blorp_batch
*batch
,
88 void *driver_batch
, enum blorp_batch_flags flags
);
89 void blorp_batch_finish(struct blorp_batch
*batch
);
91 struct blorp_address
{
93 uint32_t read_domains
;
94 uint32_t write_domain
;
100 const struct isl_surf
*surf
;
101 struct blorp_address addr
;
103 const struct isl_surf
*aux_surf
;
104 struct blorp_address aux_addr
;
105 enum isl_aux_usage aux_usage
;
107 union isl_color_value clear_color
;
111 blorp_blit(struct blorp_batch
*batch
,
112 const struct blorp_surf
*src_surf
,
113 unsigned src_level
, unsigned src_layer
,
114 enum isl_format src_format
, struct isl_swizzle src_swizzle
,
115 const struct blorp_surf
*dst_surf
,
116 unsigned dst_level
, unsigned dst_layer
,
117 enum isl_format dst_format
, struct isl_swizzle dst_swizzle
,
118 float src_x0
, float src_y0
,
119 float src_x1
, float src_y1
,
120 float dst_x0
, float dst_y0
,
121 float dst_x1
, float dst_y1
,
122 uint32_t filter
, bool mirror_x
, bool mirror_y
);
125 blorp_copy(struct blorp_batch
*batch
,
126 const struct blorp_surf
*src_surf
,
127 unsigned src_level
, unsigned src_layer
,
128 const struct blorp_surf
*dst_surf
,
129 unsigned dst_level
, unsigned dst_layer
,
130 uint32_t src_x
, uint32_t src_y
,
131 uint32_t dst_x
, uint32_t dst_y
,
132 uint32_t src_width
, uint32_t src_height
);
135 blorp_fast_clear(struct blorp_batch
*batch
,
136 const struct blorp_surf
*surf
, enum isl_format format
,
137 uint32_t level
, uint32_t start_layer
, uint32_t num_layers
,
138 uint32_t x0
, uint32_t y0
, uint32_t x1
, uint32_t y1
);
141 blorp_clear(struct blorp_batch
*batch
,
142 const struct blorp_surf
*surf
,
143 enum isl_format format
, struct isl_swizzle swizzle
,
144 uint32_t level
, uint32_t start_layer
, uint32_t num_layers
,
145 uint32_t x0
, uint32_t y0
, uint32_t x1
, uint32_t y1
,
146 union isl_color_value clear_color
,
147 const bool color_write_disable
[4]);
150 blorp_clear_depth_stencil(struct blorp_batch
*batch
,
151 const struct blorp_surf
*depth
,
152 const struct blorp_surf
*stencil
,
153 uint32_t level
, uint32_t start_layer
,
155 uint32_t x0
, uint32_t y0
, uint32_t x1
, uint32_t y1
,
156 bool clear_depth
, float depth_value
,
157 uint8_t stencil_mask
, uint8_t stencil_value
);
160 blorp_clear_attachments(struct blorp_batch
*batch
,
161 uint32_t binding_table_offset
,
162 enum isl_format depth_format
,
163 uint32_t num_samples
,
164 uint32_t start_layer
, uint32_t num_layers
,
165 uint32_t x0
, uint32_t y0
, uint32_t x1
, uint32_t y1
,
166 bool clear_color
, union isl_color_value color_value
,
167 bool clear_depth
, float depth_value
,
168 uint8_t stencil_mask
, uint8_t stencil_value
);
170 enum blorp_fast_clear_op
{
171 BLORP_FAST_CLEAR_OP_NONE
= 0,
172 BLORP_FAST_CLEAR_OP_CLEAR
,
173 BLORP_FAST_CLEAR_OP_RESOLVE_PARTIAL
,
174 BLORP_FAST_CLEAR_OP_RESOLVE_FULL
,
178 blorp_ccs_resolve(struct blorp_batch
*batch
,
179 struct blorp_surf
*surf
, uint32_t level
, uint32_t layer
,
180 enum isl_format format
,
181 enum blorp_fast_clear_op resolve_op
);
184 * For an overview of the HiZ operations, see the following sections of the
185 * Sandy Bridge PRM, Volume 1, Part2:
186 * - 7.5.3.1 Depth Buffer Clear
187 * - 7.5.3.2 Depth Buffer Resolve
188 * - 7.5.3.3 Hierarchical Depth Buffer Resolve
190 * Of these, two get entered in the resolve map as needing to be done to the
191 * buffer: depth resolve and hiz resolve.
195 BLORP_HIZ_OP_DEPTH_CLEAR
,
196 BLORP_HIZ_OP_DEPTH_RESOLVE
,
197 BLORP_HIZ_OP_HIZ_RESOLVE
,
201 blorp_gen6_hiz_op(struct blorp_batch
*batch
,
202 struct blorp_surf
*surf
, unsigned level
, unsigned layer
,
203 enum blorp_hiz_op op
);
206 } /* end extern "C" */
207 #endif /* __cplusplus */