genxml: Make Border Color Pointer an address on Gen4-5, not an offset.
[mesa.git] / src / mesa / drivers / dri / i965 / intel_mipmap_tree.h
1 /*
2 * Copyright 2006 VMware, Inc.
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial portions
15 * of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
21 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26 /** @file intel_mipmap_tree.h
27 *
28 * This file defines the structure that wraps a BO and describes how the
29 * mipmap levels and slices of a texture are laid out.
30 *
31 * The hardware has a fixed layout of a texture depending on parameters such
32 * as the target/type (2D, 3D, CUBE), width, height, pitch, and number of
33 * mipmap levels. The individual level/layer slices are each 2D rectangles of
34 * pixels at some x/y offset from the start of the brw_bo.
35 *
36 * Original OpenGL allowed texture miplevels to be specified in arbitrary
37 * order, and a texture may change size over time. Thus, each
38 * intel_texture_image has a reference to a miptree that contains the pixel
39 * data sized appropriately for it, which will later be referenced by/copied
40 * to the intel_texture_object at draw time (intel_finalize_mipmap_tree()) so
41 * that there's a single miptree for the complete texture.
42 */
43
44 #ifndef INTEL_MIPMAP_TREE_H
45 #define INTEL_MIPMAP_TREE_H
46
47 #include <assert.h>
48
49 #include "main/mtypes.h"
50 #include "isl/isl.h"
51 #include "blorp/blorp.h"
52 #include "brw_bufmgr.h"
53 #include <GL/internal/dri_interface.h>
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58
59 struct brw_context;
60 struct intel_renderbuffer;
61
62 struct intel_texture_image;
63
64 /**
65 * This bit extends the set of GL_MAP_*_BIT enums.
66 *
67 * When calling intel_miptree_map() on an ETC-transcoded-to-RGB miptree or a
68 * depthstencil-split-to-separate-stencil miptree, we'll normally make a
69 * temporary and recreate the kind of data requested by Mesa core, since we're
70 * satisfying some glGetTexImage() request or something.
71 *
72 * However, occasionally you want to actually map the miptree's current data
73 * without transcoding back. This flag to intel_miptree_map() gets you that.
74 */
75 #define BRW_MAP_DIRECT_BIT 0x80000000
76
77 struct intel_miptree_map {
78 /** Bitfield of GL_MAP_*_BIT and BRW_MAP_*_BIT. */
79 GLbitfield mode;
80 /** Region of interest for the map. */
81 int x, y, w, h;
82 /** Possibly malloced temporary buffer for the mapping. */
83 void *buffer;
84 /** Possible pointer to a temporary linear miptree for the mapping. */
85 struct intel_mipmap_tree *linear_mt;
86 /** Pointer to the start of (map_x, map_y) returned by the mapping. */
87 void *ptr;
88 /** Stride of the mapping. */
89 int stride;
90 };
91
92 /**
93 * Describes the location of each texture image within a miptree.
94 */
95 struct intel_mipmap_level
96 {
97 /** Offset to this miptree level, used in computing x_offset. */
98 GLuint level_x;
99 /** Offset to this miptree level, used in computing y_offset. */
100 GLuint level_y;
101
102 /**
103 * \brief Is HiZ enabled for this level?
104 *
105 * If \c mt->level[l].has_hiz is set, then (1) \c mt->hiz_mt has been
106 * allocated and (2) the HiZ memory for the slices in this level reside at
107 * \c mt->hiz_mt->level[l].
108 */
109 bool has_hiz;
110
111 /**
112 * \brief List of 2D images in this mipmap level.
113 *
114 * This may be a list of cube faces, array slices in 2D array texture, or
115 * layers in a 3D texture. The list's length is \c depth.
116 */
117 struct intel_mipmap_slice {
118 /**
119 * Mapping information. Persistent for the duration of
120 * intel_miptree_map/unmap on this slice.
121 */
122 struct intel_miptree_map *map;
123 } *slice;
124 };
125
126 /**
127 * Miptree aux buffer. These buffers are associated with a miptree, but the
128 * format is managed by the hardware.
129 *
130 * For Gen7+, we always give the hardware the start of the buffer, and let it
131 * handle all accesses to the buffer. Therefore we don't need the full miptree
132 * layout structure for this buffer.
133 */
134 struct intel_miptree_aux_buffer
135 {
136 struct isl_surf surf;
137
138 /**
139 * Buffer object containing the pixel data.
140 *
141 * @see RENDER_SURFACE_STATE.AuxiliarySurfaceBaseAddress
142 * @see 3DSTATE_HIER_DEPTH_BUFFER.AuxiliarySurfaceBaseAddress
143 */
144 struct brw_bo *bo;
145
146 /**
147 * Offset into bo where the surface starts.
148 *
149 * @see intel_mipmap_aux_buffer::bo
150 *
151 * @see RENDER_SURFACE_STATE.AuxiliarySurfaceBaseAddress
152 * @see 3DSTATE_DEPTH_BUFFER.SurfaceBaseAddress
153 * @see 3DSTATE_HIER_DEPTH_BUFFER.SurfaceBaseAddress
154 * @see 3DSTATE_STENCIL_BUFFER.SurfaceBaseAddress
155 */
156 uint32_t offset;
157
158 /*
159 * Size of the MCS surface.
160 *
161 * This is needed when doing any gtt mapped operations on the buffer (which
162 * will be Y-tiled). It is possible that it will not be the same as bo->size
163 * when the drm allocator rounds up the requested size.
164 */
165 size_t size;
166
167 /**
168 * Pitch in bytes.
169 *
170 * @see RENDER_SURFACE_STATE.AuxiliarySurfacePitch
171 * @see 3DSTATE_HIER_DEPTH_BUFFER.SurfacePitch
172 */
173 uint32_t pitch;
174
175 /**
176 * The distance in rows between array slices.
177 *
178 * @see RENDER_SURFACE_STATE.AuxiliarySurfaceQPitch
179 * @see 3DSTATE_HIER_DEPTH_BUFFER.SurfaceQPitch
180 */
181 uint32_t qpitch;
182 };
183
184 struct intel_mipmap_tree
185 {
186 struct isl_surf surf;
187
188 /**
189 * Buffer object containing the surface.
190 *
191 * @see intel_mipmap_tree::offset
192 * @see RENDER_SURFACE_STATE.SurfaceBaseAddress
193 * @see RENDER_SURFACE_STATE.AuxiliarySurfaceBaseAddress
194 * @see 3DSTATE_DEPTH_BUFFER.SurfaceBaseAddress
195 * @see 3DSTATE_HIER_DEPTH_BUFFER.SurfaceBaseAddress
196 * @see 3DSTATE_STENCIL_BUFFER.SurfaceBaseAddress
197 */
198 struct brw_bo *bo;
199
200 /**
201 * @brief One of GL_TEXTURE_2D, GL_TEXTURE_2D_ARRAY, etc.
202 *
203 * @see RENDER_SURFACE_STATE.SurfaceType
204 * @see RENDER_SURFACE_STATE.SurfaceArray
205 * @see 3DSTATE_DEPTH_BUFFER.SurfaceType
206 */
207 GLenum target;
208
209 /**
210 * Generally, this is just the same as the gl_texture_image->TexFormat or
211 * gl_renderbuffer->Format.
212 *
213 * However, for textures and renderbuffers with packed depth/stencil formats
214 * on hardware where we want or need to use separate stencil, there will be
215 * two miptrees for storing the data. If the depthstencil texture or rb is
216 * MESA_FORMAT_Z32_FLOAT_S8X24_UINT, then mt->format will be
217 * MESA_FORMAT_Z_FLOAT32, otherwise for MESA_FORMAT_Z24_UNORM_S8_UINT objects it will be
218 * MESA_FORMAT_Z24_UNORM_X8_UINT.
219 *
220 * For ETC1/ETC2 textures, this is one of the uncompressed mesa texture
221 * formats if the hardware lacks support for ETC1/ETC2. See @ref etc_format.
222 *
223 * @see RENDER_SURFACE_STATE.SurfaceFormat
224 * @see 3DSTATE_DEPTH_BUFFER.SurfaceFormat
225 */
226 mesa_format format;
227
228 /**
229 * This variable stores the value of ETC compressed texture format
230 *
231 * @see RENDER_SURFACE_STATE.SurfaceFormat
232 */
233 mesa_format etc_format;
234
235 GLuint first_level;
236 GLuint last_level;
237
238 /** Bytes per pixel (or bytes per block if compressed) */
239 GLuint cpp;
240
241 bool compressed;
242
243 /* Includes image offset tables: */
244 struct intel_mipmap_level level[MAX_TEXTURE_LEVELS];
245
246 /**
247 * Offset into bo where the surface starts.
248 *
249 * @see intel_mipmap_tree::bo
250 *
251 * @see RENDER_SURFACE_STATE.AuxiliarySurfaceBaseAddress
252 * @see 3DSTATE_DEPTH_BUFFER.SurfaceBaseAddress
253 * @see 3DSTATE_HIER_DEPTH_BUFFER.SurfaceBaseAddress
254 * @see 3DSTATE_STENCIL_BUFFER.SurfaceBaseAddress
255 */
256 uint32_t offset;
257
258 /**
259 * \brief HiZ aux buffer
260 *
261 * To allocate the hiz buffer, use intel_miptree_alloc_hiz().
262 *
263 * To determine if hiz is enabled, do not check this pointer. Instead, use
264 * intel_miptree_level_has_hiz().
265 */
266 struct intel_miptree_aux_buffer *hiz_buf;
267
268 /**
269 * \brief The type of auxiliary compression used by this miptree.
270 *
271 * This describes the type of auxiliary compression that is intended to be
272 * used by this miptree. An aux usage of ISL_AUX_USAGE_NONE means that
273 * auxiliary compression is permanently disabled. An aux usage other than
274 * ISL_AUX_USAGE_NONE does not imply that the auxiliary buffer has actually
275 * been allocated nor does it imply that auxiliary compression will always
276 * be enabled for this surface. For instance, with CCS_D, we may allocate
277 * the CCS on-the-fly and it may not be used for texturing if the miptree
278 * is fully resolved.
279 */
280 enum isl_aux_usage aux_usage;
281
282 /**
283 * \brief Whether or not this miptree supports fast clears.
284 */
285 bool supports_fast_clear;
286
287 /**
288 * \brief Maps miptree slices to their current aux state
289 *
290 * This two-dimensional array is indexed as [level][layer] and stores an
291 * aux state for each slice.
292 */
293 enum isl_aux_state **aux_state;
294
295 /**
296 * \brief Stencil miptree for depthstencil textures.
297 *
298 * This miptree is used for depthstencil textures and renderbuffers that
299 * require separate stencil. It always has the true copy of the stencil
300 * bits, regardless of mt->format.
301 *
302 * \see 3DSTATE_STENCIL_BUFFER
303 * \see intel_miptree_map_depthstencil()
304 * \see intel_miptree_unmap_depthstencil()
305 */
306 struct intel_mipmap_tree *stencil_mt;
307
308 /**
309 * \brief Stencil texturing miptree for sampling from a stencil texture
310 *
311 * Some hardware doesn't support sampling from the stencil texture as
312 * required by the GL_ARB_stencil_texturing extenion. To workaround this we
313 * blit the texture into a new texture that can be sampled.
314 *
315 * \see intel_update_r8stencil()
316 */
317 struct intel_mipmap_tree *r8stencil_mt;
318 bool r8stencil_needs_update;
319
320 /**
321 * \brief MCS auxiliary buffer.
322 *
323 * This buffer contains the "multisample control surface", which stores
324 * the necessary information to implement compressed MSAA
325 * (INTEL_MSAA_FORMAT_CMS) and "fast color clear" behaviour on Gen7+.
326 *
327 * NULL if no MCS buffer is in use for this surface.
328 */
329 struct intel_miptree_aux_buffer *mcs_buf;
330
331 /**
332 * Planes 1 and 2 in case this is a planar surface.
333 */
334 struct intel_mipmap_tree *plane[2];
335
336 /**
337 * Fast clear color for this surface. For depth surfaces, the clear value
338 * is stored as a float32 in the red component.
339 */
340 union isl_color_value fast_clear_color;
341
342 /**
343 * For external surfaces, this is DRM format modifier that was used to
344 * create or import the surface. For internal surfaces, this will always
345 * be DRM_FORMAT_MOD_INVALID.
346 */
347 uint64_t drm_modifier;
348
349 /* These are also refcounted:
350 */
351 GLuint refcount;
352 };
353
354 bool
355 intel_miptree_alloc_ccs(struct brw_context *brw,
356 struct intel_mipmap_tree *mt);
357
358 enum intel_miptree_create_flags {
359 /** No miptree create flags */
360 MIPTREE_CREATE_DEFAULT = 0,
361
362 /** Miptree creation should try to allocate a currently busy BO
363 *
364 * This may be advantageous if we know the next thing to touch the BO will
365 * be the GPU because the BO will likely already be in the GTT and maybe
366 * even in some caches. If there is a chance that the next thing to touch
367 * the miptree BO will be the CPU, this flag should not be set.
368 */
369 MIPTREE_CREATE_BUSY = 1 << 0,
370
371 /** Create a linear (not tiled) miptree */
372 MIPTREE_CREATE_LINEAR = 1 << 1,
373
374 /** Create the miptree with auxiliary compression disabled
375 *
376 * This does not prevent the caller of intel_miptree_create from coming
377 * along later and turning auxiliary compression back on but it does mean
378 * that the miptree will be created with mt->aux_usage == NONE.
379 */
380 MIPTREE_CREATE_NO_AUX = 1 << 2,
381 };
382
383 struct intel_mipmap_tree *intel_miptree_create(struct brw_context *brw,
384 GLenum target,
385 mesa_format format,
386 GLuint first_level,
387 GLuint last_level,
388 GLuint width0,
389 GLuint height0,
390 GLuint depth0,
391 GLuint num_samples,
392 enum intel_miptree_create_flags flags);
393
394 struct intel_mipmap_tree *
395 intel_miptree_create_for_bo(struct brw_context *brw,
396 struct brw_bo *bo,
397 mesa_format format,
398 uint32_t offset,
399 uint32_t width,
400 uint32_t height,
401 uint32_t depth,
402 int pitch,
403 enum intel_miptree_create_flags flags);
404
405 struct intel_mipmap_tree *
406 intel_miptree_create_for_dri_image(struct brw_context *brw,
407 __DRIimage *image,
408 GLenum target,
409 enum isl_colorspace colorspace,
410 bool is_winsys_image);
411
412 bool
413 intel_update_winsys_renderbuffer_miptree(struct brw_context *intel,
414 struct intel_renderbuffer *irb,
415 struct intel_mipmap_tree *singlesample_mt,
416 uint32_t width, uint32_t height,
417 uint32_t pitch);
418
419 /**
420 * Create a miptree appropriate as the storage for a non-texture renderbuffer.
421 * The miptree has the following properties:
422 * - The target is GL_TEXTURE_2D.
423 * - There are no levels other than the base level 0.
424 * - Depth is 1.
425 */
426 struct intel_mipmap_tree*
427 intel_miptree_create_for_renderbuffer(struct brw_context *brw,
428 mesa_format format,
429 uint32_t width,
430 uint32_t height,
431 uint32_t num_samples);
432
433 mesa_format
434 intel_depth_format_for_depthstencil_format(mesa_format format);
435
436 mesa_format
437 intel_lower_compressed_format(struct brw_context *brw, mesa_format format);
438
439 unsigned
440 brw_get_num_logical_layers(const struct intel_mipmap_tree *mt, unsigned level);
441
442 /** \brief Assert that the level and layer are valid for the miptree. */
443 void
444 intel_miptree_check_level_layer(const struct intel_mipmap_tree *mt,
445 uint32_t level,
446 uint32_t layer);
447
448 void intel_miptree_reference(struct intel_mipmap_tree **dst,
449 struct intel_mipmap_tree *src);
450
451 void intel_miptree_release(struct intel_mipmap_tree **mt);
452
453 /* Check if an image fits an existing mipmap tree layout
454 */
455 bool intel_miptree_match_image(struct intel_mipmap_tree *mt,
456 struct gl_texture_image *image);
457
458 void
459 intel_miptree_get_image_offset(const struct intel_mipmap_tree *mt,
460 GLuint level, GLuint slice,
461 GLuint *x, GLuint *y);
462
463 enum isl_surf_dim
464 get_isl_surf_dim(GLenum target);
465
466 enum isl_dim_layout
467 get_isl_dim_layout(const struct gen_device_info *devinfo,
468 enum isl_tiling tiling, GLenum target);
469
470 enum isl_aux_usage
471 intel_miptree_get_aux_isl_usage(const struct brw_context *brw,
472 const struct intel_mipmap_tree *mt);
473
474 void
475 intel_get_image_dims(struct gl_texture_image *image,
476 int *width, int *height, int *depth);
477
478 void
479 intel_get_tile_masks(enum isl_tiling tiling, uint32_t cpp,
480 uint32_t *mask_x, uint32_t *mask_y);
481
482 void
483 intel_get_tile_dims(enum isl_tiling tiling, uint32_t cpp,
484 uint32_t *tile_w, uint32_t *tile_h);
485
486 uint32_t
487 intel_miptree_get_tile_offsets(const struct intel_mipmap_tree *mt,
488 GLuint level, GLuint slice,
489 uint32_t *tile_x,
490 uint32_t *tile_y);
491 uint32_t
492 intel_miptree_get_aligned_offset(const struct intel_mipmap_tree *mt,
493 uint32_t x, uint32_t y);
494
495 void
496 intel_miptree_copy_slice(struct brw_context *brw,
497 struct intel_mipmap_tree *src_mt,
498 unsigned src_level, unsigned src_layer,
499 struct intel_mipmap_tree *dst_mt,
500 unsigned dst_level, unsigned dst_layer);
501
502 void
503 intel_miptree_copy_teximage(struct brw_context *brw,
504 struct intel_texture_image *intelImage,
505 struct intel_mipmap_tree *dst_mt, bool invalidate);
506
507 /**
508 * \name Miptree HiZ functions
509 * \{
510 *
511 * It is safe to call the "slice_set_need_resolve" and "slice_resolve"
512 * functions on a miptree without HiZ. In that case, each function is a no-op.
513 */
514
515 /**
516 * \brief Allocate the miptree's embedded HiZ miptree.
517 * \see intel_mipmap_tree:hiz_mt
518 * \return false if allocation failed
519 */
520 bool
521 intel_miptree_alloc_hiz(struct brw_context *brw,
522 struct intel_mipmap_tree *mt);
523
524 bool
525 intel_miptree_level_has_hiz(const struct intel_mipmap_tree *mt, uint32_t level);
526
527 /**\}*/
528
529 bool
530 intel_miptree_has_color_unresolved(const struct intel_mipmap_tree *mt,
531 unsigned start_level, unsigned num_levels,
532 unsigned start_layer, unsigned num_layers);
533
534
535 #define INTEL_REMAINING_LAYERS UINT32_MAX
536 #define INTEL_REMAINING_LEVELS UINT32_MAX
537
538 /** Prepare a miptree for access
539 *
540 * This function should be called prior to any access to miptree in order to
541 * perform any needed resolves.
542 *
543 * \param[in] start_level The first mip level to be accessed
544 *
545 * \param[in] num_levels The number of miplevels to be accessed or
546 * INTEL_REMAINING_LEVELS to indicate every level
547 * above start_level will be accessed
548 *
549 * \param[in] start_layer The first array slice or 3D layer to be accessed
550 *
551 * \param[in] num_layers The number of array slices or 3D layers be
552 * accessed or INTEL_REMAINING_LAYERS to indicate
553 * every layer above start_layer will be accessed
554 *
555 * \param[in] aux_supported Whether or not the access will support the
556 * miptree's auxiliary compression format; this
557 * must be false for uncompressed miptrees
558 *
559 * \param[in] fast_clear_supported Whether or not the access will support
560 * fast clears in the miptree's auxiliary
561 * compression format
562 */
563 void
564 intel_miptree_prepare_access(struct brw_context *brw,
565 struct intel_mipmap_tree *mt,
566 uint32_t start_level, uint32_t num_levels,
567 uint32_t start_layer, uint32_t num_layers,
568 enum isl_aux_usage aux_usage,
569 bool fast_clear_supported);
570
571 /** Complete a write operation
572 *
573 * This function should be called after any operation writes to a miptree.
574 * This will update the miptree's compression state so that future resolves
575 * happen correctly. Technically, this function can be called before the
576 * write occurs but the caller must ensure that they don't interlace
577 * intel_miptree_prepare_access and intel_miptree_finish_write calls to
578 * overlapping layer/level ranges.
579 *
580 * \param[in] level The mip level that was written
581 *
582 * \param[in] start_layer The first array slice or 3D layer written
583 *
584 * \param[in] num_layers The number of array slices or 3D layers
585 * written or INTEL_REMAINING_LAYERS to indicate
586 * every layer above start_layer was written
587 *
588 * \param[in] written_with_aux Whether or not the write was done with
589 * auxiliary compression enabled
590 */
591 void
592 intel_miptree_finish_write(struct brw_context *brw,
593 struct intel_mipmap_tree *mt, uint32_t level,
594 uint32_t start_layer, uint32_t num_layers,
595 enum isl_aux_usage aux_usage);
596
597 /** Get the auxiliary compression state of a miptree slice */
598 enum isl_aux_state
599 intel_miptree_get_aux_state(const struct intel_mipmap_tree *mt,
600 uint32_t level, uint32_t layer);
601
602 /** Set the auxiliary compression state of a miptree slice range
603 *
604 * This function directly sets the auxiliary compression state of a slice
605 * range of a miptree. It only modifies data structures and does not do any
606 * resolves. This should only be called by code which directly performs
607 * compression operations such as fast clears and resolves. Most code should
608 * use intel_miptree_prepare_access or intel_miptree_finish_write.
609 */
610 void
611 intel_miptree_set_aux_state(struct brw_context *brw,
612 struct intel_mipmap_tree *mt, uint32_t level,
613 uint32_t start_layer, uint32_t num_layers,
614 enum isl_aux_state aux_state);
615
616 /**
617 * Prepare a miptree for raw access
618 *
619 * This helper prepares the miptree for access that knows nothing about any
620 * sort of compression whatsoever. This is useful when mapping the surface or
621 * using it with the blitter.
622 */
623 static inline void
624 intel_miptree_access_raw(struct brw_context *brw,
625 struct intel_mipmap_tree *mt,
626 uint32_t level, uint32_t layer,
627 bool write)
628 {
629 intel_miptree_prepare_access(brw, mt, level, 1, layer, 1, false, false);
630 if (write)
631 intel_miptree_finish_write(brw, mt, level, layer, 1, false);
632 }
633
634 enum isl_aux_usage
635 intel_miptree_texture_aux_usage(struct brw_context *brw,
636 struct intel_mipmap_tree *mt,
637 enum isl_format view_format);
638 void
639 intel_miptree_prepare_texture(struct brw_context *brw,
640 struct intel_mipmap_tree *mt,
641 enum isl_format view_format,
642 bool *aux_supported_out);
643 void
644 intel_miptree_prepare_image(struct brw_context *brw,
645 struct intel_mipmap_tree *mt);
646 void
647 intel_miptree_prepare_fb_fetch(struct brw_context *brw,
648 struct intel_mipmap_tree *mt, uint32_t level,
649 uint32_t start_layer, uint32_t num_layers);
650 enum isl_aux_usage
651 intel_miptree_render_aux_usage(struct brw_context *brw,
652 struct intel_mipmap_tree *mt,
653 bool srgb_enabled, bool blend_enabled);
654 void
655 intel_miptree_prepare_render(struct brw_context *brw,
656 struct intel_mipmap_tree *mt, uint32_t level,
657 uint32_t start_layer, uint32_t layer_count,
658 bool srgb_enabled, bool blend_enabled);
659 void
660 intel_miptree_finish_render(struct brw_context *brw,
661 struct intel_mipmap_tree *mt, uint32_t level,
662 uint32_t start_layer, uint32_t layer_count,
663 bool srgb_enabled, bool blend_enabled);
664 void
665 intel_miptree_prepare_depth(struct brw_context *brw,
666 struct intel_mipmap_tree *mt, uint32_t level,
667 uint32_t start_layer, uint32_t layer_count);
668 void
669 intel_miptree_finish_depth(struct brw_context *brw,
670 struct intel_mipmap_tree *mt, uint32_t level,
671 uint32_t start_layer, uint32_t layer_count,
672 bool depth_written);
673 void
674 intel_miptree_prepare_external(struct brw_context *brw,
675 struct intel_mipmap_tree *mt);
676
677 void
678 intel_miptree_make_shareable(struct brw_context *brw,
679 struct intel_mipmap_tree *mt);
680
681 void
682 intel_miptree_updownsample(struct brw_context *brw,
683 struct intel_mipmap_tree *src,
684 struct intel_mipmap_tree *dst);
685
686 void
687 intel_update_r8stencil(struct brw_context *brw,
688 struct intel_mipmap_tree *mt);
689
690 void
691 intel_miptree_map(struct brw_context *brw,
692 struct intel_mipmap_tree *mt,
693 unsigned int level,
694 unsigned int slice,
695 unsigned int x,
696 unsigned int y,
697 unsigned int w,
698 unsigned int h,
699 GLbitfield mode,
700 void **out_ptr,
701 ptrdiff_t *out_stride);
702
703 void
704 intel_miptree_unmap(struct brw_context *brw,
705 struct intel_mipmap_tree *mt,
706 unsigned int level,
707 unsigned int slice);
708
709 bool
710 intel_miptree_sample_with_hiz(struct brw_context *brw,
711 struct intel_mipmap_tree *mt);
712
713 #ifdef __cplusplus
714 }
715 #endif
716
717 #endif