Path: blob/21.2-virgl/src/gallium/auxiliary/tgsi/tgsi_lowering.h
4565 views
/*1* Copyright (C) 2014 Rob Clark <[email protected]>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, ARISING FROM,19* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE20* SOFTWARE.21*22* Authors:23* Rob Clark <[email protected]>24*/2526#ifndef TGSI_LOWERING_H_27#define TGSI_LOWERING_H_2829#include "pipe/p_shader_tokens.h"30#include "tgsi/tgsi_scan.h"3132struct tgsi_lowering_config33{34/* For fragment shaders, generate a shader that emulates two35* sided color by inserting a BGCOLOR input for each COLOR36* input, and insert a CMP instruction to select the correct37* color to use based on the TGSI_SEMANTIC_FACE input.38*39* Note that drivers which use this to emulate two sided color40* will:41* a) need to generate (on demand) alternate shaders to use42* depending on the rasterizer state (ie. whether two43* sided shading enabled)44* b) expect to see the BGCOLOR semantic name in fragment45* shaders. During linkage, the driver should simply46* map VS.OUT.BGCOLOR[n] to FS.IN.BGCOLOR[n] (in the47* same was as linking other outs/ins).48*/49unsigned color_two_side:1;5051/* TODO support for alpha_to_one as well?? */5253/* Individual OPC lowerings, if lower_<opc> is TRUE then54* enable lowering of TGSI_OPCODE_<opc>55*/56unsigned lower_DST:1;57unsigned lower_LRP:1;58unsigned lower_FRC:1;59unsigned lower_POW:1;60unsigned lower_LIT:1;61unsigned lower_EXP:1;62unsigned lower_LOG:1;63unsigned lower_DP4:1;64unsigned lower_DP3:1;65unsigned lower_DP2:1;66unsigned lower_FLR:1;67unsigned lower_CEIL:1;68unsigned lower_TRUNC:1;6970/* bitmask of (1 << TGSI_TEXTURE_type): */71unsigned lower_TXP;7273/* To emulate certain texture wrap modes, this can be used74* to saturate the specified tex coord to [0.0, 1.0]. The75* bits are according to sampler #, ie. if, for example:76*77* (conf->saturate_s & (1 << n))78*79* is true, then the s coord for sampler n is saturated.80*/81unsigned saturate_s, saturate_t, saturate_r;82};8384const struct tgsi_token *85tgsi_transform_lowering(const struct tgsi_lowering_config *config,86const struct tgsi_token *tokens,87struct tgsi_shader_info *info);8889#endif /* FREEDRENO_LOWERING_H_ */909192