Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mesa
Path: blob/21.2-virgl/src/gallium/auxiliary/tgsi/tgsi_lowering.h
4565 views
1
/*
2
* Copyright (C) 2014 Rob Clark <[email protected]>
3
*
4
* Permission is hereby granted, free of charge, to any person obtaining a
5
* copy of this software and associated documentation files (the "Software"),
6
* to deal in the Software without restriction, including without limitation
7
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8
* and/or sell copies of the Software, and to permit persons to whom the
9
* Software is furnished to do so, subject to the following conditions:
10
*
11
* The above copyright notice and this permission notice (including the next
12
* paragraph) shall be included in all copies or substantial portions of the
13
* Software.
14
*
15
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
* SOFTWARE.
22
*
23
* Authors:
24
* Rob Clark <[email protected]>
25
*/
26
27
#ifndef TGSI_LOWERING_H_
28
#define TGSI_LOWERING_H_
29
30
#include "pipe/p_shader_tokens.h"
31
#include "tgsi/tgsi_scan.h"
32
33
struct tgsi_lowering_config
34
{
35
/* For fragment shaders, generate a shader that emulates two
36
* sided color by inserting a BGCOLOR input for each COLOR
37
* input, and insert a CMP instruction to select the correct
38
* color to use based on the TGSI_SEMANTIC_FACE input.
39
*
40
* Note that drivers which use this to emulate two sided color
41
* will:
42
* a) need to generate (on demand) alternate shaders to use
43
* depending on the rasterizer state (ie. whether two
44
* sided shading enabled)
45
* b) expect to see the BGCOLOR semantic name in fragment
46
* shaders. During linkage, the driver should simply
47
* map VS.OUT.BGCOLOR[n] to FS.IN.BGCOLOR[n] (in the
48
* same was as linking other outs/ins).
49
*/
50
unsigned color_two_side:1;
51
52
/* TODO support for alpha_to_one as well?? */
53
54
/* Individual OPC lowerings, if lower_<opc> is TRUE then
55
* enable lowering of TGSI_OPCODE_<opc>
56
*/
57
unsigned lower_DST:1;
58
unsigned lower_LRP:1;
59
unsigned lower_FRC:1;
60
unsigned lower_POW:1;
61
unsigned lower_LIT:1;
62
unsigned lower_EXP:1;
63
unsigned lower_LOG:1;
64
unsigned lower_DP4:1;
65
unsigned lower_DP3:1;
66
unsigned lower_DP2:1;
67
unsigned lower_FLR:1;
68
unsigned lower_CEIL:1;
69
unsigned lower_TRUNC:1;
70
71
/* bitmask of (1 << TGSI_TEXTURE_type): */
72
unsigned lower_TXP;
73
74
/* To emulate certain texture wrap modes, this can be used
75
* to saturate the specified tex coord to [0.0, 1.0]. The
76
* bits are according to sampler #, ie. if, for example:
77
*
78
* (conf->saturate_s & (1 << n))
79
*
80
* is true, then the s coord for sampler n is saturated.
81
*/
82
unsigned saturate_s, saturate_t, saturate_r;
83
};
84
85
const struct tgsi_token *
86
tgsi_transform_lowering(const struct tgsi_lowering_config *config,
87
const struct tgsi_token *tokens,
88
struct tgsi_shader_info *info);
89
90
#endif /* FREEDRENO_LOWERING_H_ */
91
92