Home | History | Annotate | Download | only in core
      1 /*
      2  * Mesa 3-D graphics library
      3  *
      4  * Copyright (C) 2015 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 (at) lunarg.com>
     26  */
     27 
     28 #ifndef ILO_STATE_ZS_H
     29 #define ILO_STATE_ZS_H
     30 
     31 #include "genhw/genhw.h"
     32 
     33 #include "ilo_core.h"
     34 #include "ilo_dev.h"
     35 
     36 struct ilo_vma;
     37 struct ilo_image;
     38 
     39 struct ilo_state_zs_info {
     40    /* both optional */
     41    const struct ilo_image *z_img;
     42    const struct ilo_image *s_img;
     43    uint8_t level;
     44    uint16_t slice_base;
     45    uint16_t slice_count;
     46 
     47    const struct ilo_vma *z_vma;
     48    const struct ilo_vma *s_vma;
     49    const struct ilo_vma *hiz_vma;
     50 
     51    enum gen_surface_type type;
     52    enum gen_depth_format format;
     53 
     54    /* ignored prior to Gen7 */
     55    bool z_readonly;
     56    bool s_readonly;
     57 };
     58 
     59 struct ilo_state_zs {
     60    uint32_t depth[5];
     61    uint32_t stencil[3];
     62    uint32_t hiz[3];
     63 
     64    const struct ilo_vma *z_vma;
     65    const struct ilo_vma *s_vma;
     66    const struct ilo_vma *hiz_vma;
     67 
     68    bool z_readonly;
     69    bool s_readonly;
     70 };
     71 
     72 bool
     73 ilo_state_zs_init(struct ilo_state_zs *zs,
     74                   const struct ilo_dev *dev,
     75                   const struct ilo_state_zs_info *info);
     76 
     77 bool
     78 ilo_state_zs_init_for_null(struct ilo_state_zs *zs,
     79                            const struct ilo_dev *dev);
     80 
     81 bool
     82 ilo_state_zs_disable_hiz(struct ilo_state_zs *zs,
     83                          const struct ilo_dev *dev);
     84 
     85 #endif /* ILO_STATE_ZS_H */
     86