Path: blob/21.2-virgl/src/amd/common/ac_shader_util.h
7233 views
/*1* Copyright 2012 Advanced Micro Devices, Inc.2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS20* IN THE SOFTWARE.21*/2223#ifndef AC_SHADER_UTIL_H24#define AC_SHADER_UTIL_H2526#include "ac_binary.h"27#include "amd_family.h"28#include "compiler/nir/nir.h"2930#include <stdbool.h>31#include <stdint.h>3233#ifdef __cplusplus34extern "C" {35#endif3637enum ac_image_dim38{39ac_image_1d,40ac_image_2d,41ac_image_3d,42ac_image_cube, // includes cube arrays43ac_image_1darray,44ac_image_2darray,45ac_image_2dmsaa,46ac_image_2darraymsaa,47};4849struct ac_data_format_info {50uint8_t element_size;51uint8_t num_channels;52uint8_t chan_byte_size;53uint8_t chan_format;54};5556struct ac_spi_color_formats {57unsigned normal : 8;58unsigned alpha : 8;59unsigned blend : 8;60unsigned blend_alpha : 8;61};6263/* For ac_build_fetch_format.64*65* Note: FLOAT must be 0 (used for convenience of encoding in radeonsi).66*/67enum ac_fetch_format68{69AC_FETCH_FORMAT_FLOAT = 0,70AC_FETCH_FORMAT_FIXED,71AC_FETCH_FORMAT_UNORM,72AC_FETCH_FORMAT_SNORM,73AC_FETCH_FORMAT_USCALED,74AC_FETCH_FORMAT_SSCALED,75AC_FETCH_FORMAT_UINT,76AC_FETCH_FORMAT_SINT,77AC_FETCH_FORMAT_NONE,78};7980unsigned ac_get_spi_shader_z_format(bool writes_z, bool writes_stencil, bool writes_samplemask);8182unsigned ac_get_cb_shader_mask(unsigned spi_shader_col_format);8384uint32_t ac_vgt_gs_mode(unsigned gs_max_vert_out, enum chip_class chip_class);8586unsigned ac_get_tbuffer_format(enum chip_class chip_class, unsigned dfmt, unsigned nfmt);8788const struct ac_data_format_info *ac_get_data_format_info(unsigned dfmt);8990enum ac_image_dim ac_get_sampler_dim(enum chip_class chip_class, enum glsl_sampler_dim dim,91bool is_array);9293enum ac_image_dim ac_get_image_dim(enum chip_class chip_class, enum glsl_sampler_dim sdim,94bool is_array);9596unsigned ac_get_fs_input_vgpr_cnt(const struct ac_shader_config *config,97signed char *face_vgpr_index, signed char *ancillary_vgpr_index);9899void ac_choose_spi_color_formats(unsigned format, unsigned swap, unsigned ntype,100bool is_depth, bool use_rbplus,101struct ac_spi_color_formats *formats);102103void ac_compute_late_alloc(const struct radeon_info *info, bool ngg, bool ngg_culling,104bool uses_scratch, unsigned *late_alloc_wave64, unsigned *cu_mask);105106#ifdef __cplusplus107}108#endif109110#endif111112113