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_SBE_H
     29 #define ILO_STATE_SBE_H
     30 
     31 #include "genhw/genhw.h"
     32 
     33 #include "ilo_core.h"
     34 #include "ilo_dev.h"
     35 
     36 /*
     37  * From the Sandy Bridge PRM, volume 2 part 1, page 264:
     38  *
     39  *     "Number of SF Output Attributes sets the number of attributes that will
     40  *      be output from the SF stage, not including position. This can be used
     41  *      to specify up to 32, and may differ from the number of input
     42  *      attributes."
     43  *
     44  *     "The first or last set of 16 attributes can be swizzled according to
     45  *      certain state fields."
     46  */
     47 #define ILO_STATE_SBE_MAX_ATTR_COUNT 32
     48 #define ILO_STATE_SBE_MAX_SWIZZLE_COUNT 16
     49 
     50 struct ilo_state_sbe_swizzle_info {
     51    /* select an attribute from read ones */
     52    enum gen_inputattr_select attr_select;
     53    uint8_t attr;
     54 
     55    bool force_zeros;
     56 };
     57 
     58 struct ilo_state_sbe_info {
     59    uint8_t attr_count;
     60 
     61    /* which VUE attributes to read */
     62    uint8_t cv_vue_attr_count;
     63    uint8_t vue_read_base;
     64    uint8_t vue_read_count;
     65    bool has_min_read_count;
     66 
     67    bool cv_is_point;
     68    bool point_sprite_origin_lower_left;
     69    /* force sprite coordinates to the four corner vertices of the point */
     70    uint32_t point_sprite_enables;
     71 
     72    /* force attr at the provoking vertex to a0 and zero to a1/a2 */
     73    uint32_t const_interp_enables;
     74 
     75    bool swizzle_enable;
     76    /* swizzle attribute 16 to 31 instead; Gen7+ only */
     77    bool swizzle_16_31;
     78    uint8_t swizzle_count;
     79    const struct ilo_state_sbe_swizzle_info *swizzles;
     80 };
     81 
     82 struct ilo_state_sbe {
     83    uint32_t sbe[3];
     84    uint32_t swiz[8];
     85 };
     86 
     87 bool
     88 ilo_state_sbe_init(struct ilo_state_sbe *sbe,
     89                    const struct ilo_dev *dev,
     90                    const struct ilo_state_sbe_info *info);
     91 
     92 bool
     93 ilo_state_sbe_init_for_rectlist(struct ilo_state_sbe *sbe,
     94                                 const struct ilo_dev *dev,
     95                                 uint8_t read_base,
     96                                 uint8_t read_count);
     97 
     98 bool
     99 ilo_state_sbe_set_info(struct ilo_state_sbe *sbe,
    100                        const struct ilo_dev *dev,
    101                        const struct ilo_state_sbe_info *info);
    102 
    103 #endif /* ILO_STATE_SBE_H */
    104