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_SAMPLER_H
     29 #define ILO_STATE_SAMPLER_H
     30 
     31 #include "genhw/genhw.h"
     32 
     33 #include "ilo_core.h"
     34 #include "ilo_dev.h"
     35 
     36 struct ilo_state_surface;
     37 
     38 struct ilo_state_sampler_info {
     39    bool non_normalized;
     40 
     41    float lod_bias;
     42    float min_lod;
     43    float max_lod;
     44 
     45    enum gen_mip_filter mip_filter;
     46    enum gen_map_filter min_filter;
     47    enum gen_map_filter mag_filter;
     48    enum gen_aniso_ratio max_anisotropy;
     49 
     50    enum gen_texcoord_mode tcx_ctrl;
     51    enum gen_texcoord_mode tcy_ctrl;
     52    enum gen_texcoord_mode tcz_ctrl;
     53 
     54    enum gen_prefilter_op shadow_func;
     55 };
     56 
     57 struct ilo_state_sampler_border_info {
     58    union {
     59       float f[4];
     60       uint32_t ui[4];
     61    } rgba;
     62 
     63    bool is_integer;
     64 };
     65 
     66 struct ilo_state_sampler {
     67    uint32_t sampler[3];
     68 
     69    uint32_t filter_integer;
     70    uint32_t filter_3d;
     71 
     72    uint32_t addr_ctrl_1d;
     73    uint32_t addr_ctrl_2d_3d;
     74    uint32_t addr_ctrl_cube;
     75 
     76    bool non_normalized;
     77    bool base_to_surf_min_lod;
     78 };
     79 
     80 struct ilo_state_sampler_border {
     81    uint32_t color[12];
     82 };
     83 
     84 bool
     85 ilo_state_sampler_init(struct ilo_state_sampler *sampler,
     86                        const struct ilo_dev *dev,
     87                        const struct ilo_state_sampler_info *info);
     88 
     89 bool
     90 ilo_state_sampler_init_disabled(struct ilo_state_sampler *sampler,
     91                                 const struct ilo_dev *dev);
     92 
     93 bool
     94 ilo_state_sampler_set_surface(struct ilo_state_sampler *sampler,
     95                               const struct ilo_dev *dev,
     96                               const struct ilo_state_surface *surf);
     97 
     98 bool
     99 ilo_state_sampler_border_init(struct ilo_state_sampler_border *border,
    100                               const struct ilo_dev *dev,
    101                               const struct ilo_state_sampler_border_info *info);
    102 
    103 #endif /* ILO_STATE_SAMPLER_H */
    104