~mmach/netext73/mesa-haswell

« back to all changes in this revision

Viewing changes to src/gallium/drivers/lima/lima_parser.h

  • Committer: mmach
  • Date: 2022-09-22 19:56:13 UTC
  • Revision ID: netbit73@gmail.com-20220922195613-wtik9mmy20tmor0i
2022-09-22 21:17:09

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (C) 2018-2019 Lima Project
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 shall be included in
12
 
 * all copies or substantial portions of the Software.
13
 
 *
14
 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
 
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
 
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17
 
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18
 
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19
 
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20
 
 * OTHER DEALINGS IN THE SOFTWARE.
21
 
 *
22
 
 */
23
 
 
24
 
#ifndef H_LIMA_PARSER
25
 
#define H_LIMA_PARSER
26
 
 
27
 
static const char *PIPE_COMPARE_FUNC_STRING[] = {
28
 
   "NEVER",    /* 0 */
29
 
   "LESS",     /* 1 */
30
 
   "EQUAL",    /* 2 */
31
 
   "LEQUAL",   /* 3 */
32
 
   "GREATER",  /* 4 */
33
 
   "NOTEQUAL", /* 5 */
34
 
   "GEQUAL",   /* 6 */
35
 
   "ALWAYS",   /* 7 */
36
 
};
37
 
 
38
 
static const char *PIPE_STENCIL_OP_STRING[] = {
39
 
   "KEEP",      /* 0 */
40
 
   "REPLACE",   /* 1 */
41
 
   "ZERO",      /* 2 */
42
 
   "INVERT",    /* 3 */
43
 
   "INCR_WRAP", /* 4 */
44
 
   "DECR_WRAP", /* 5 */
45
 
   "INCR",      /* 6 */
46
 
   "DECR",      /* 7 */
47
 
};
48
 
 
49
 
static const char *PIPE_BLEND_FUNC_STRING[] = {
50
 
   "SUBTRACT",     /* 0 */
51
 
   "REV_SUBTRACT", /* 1 */
52
 
   "ADD",          /* 2 */
53
 
   "UNKNOWN_3",    /* 3 */
54
 
   "BLEND_MIN",    /* 4 */
55
 
   "BLEND_MAX",    /* 5 */
56
 
};
57
 
 
58
 
static const char *PIPE_BLENDFACTOR_STRING[] = {
59
 
   "SRC_COLOR",        /* 0 */
60
 
   "DST_COLOR",        /* 1 */
61
 
   "CONST_COLOR",      /* 2 */
62
 
   "ZERO",             /* 3 */
63
 
   "UNKNOWN_4",        /* 4 */
64
 
   "SRC2_COLOR",       /* 5 */
65
 
   "UNKNOWN_6",        /* 6 */
66
 
   "SRC_ALPHA_SAT",    /* 7 */
67
 
   "INV_SRC_COLOR",    /* 8 */
68
 
   "INV_DST_COLOR",    /* 9 */
69
 
   "INV_CONST_COLOR",  /* 10 */
70
 
   "ONE",              /* 11 */
71
 
   "UNKNOWN_12",       /* 12 */
72
 
   "INV_SRC2_COLOR",   /* 13 */
73
 
   "UNKNOWN_14",       /* 14 */
74
 
   "UNKNOWN_15",       /* 15 */
75
 
   "SRC_ALPHA",        /* 16 */
76
 
   "DST_ALPHA",        /* 17 */
77
 
   "CONST_ALPHA",      /* 18 */
78
 
   "UNKNOWN_19",       /* 19 */
79
 
   "UNKNOWN_20",       /* 20 */
80
 
   "SRC2_ALPHA",       /* 21 */
81
 
   "UNKNOWN_22",       /* 22 */
82
 
   "UNKNOWN_23",       /* 23 */
83
 
   "INV_SRC_ALPHA",    /* 24 */
84
 
   "INV_DST_ALPHA",    /* 25 */
85
 
   "INV_CONST_ALPHA",  /* 26 */
86
 
   "UNKNOWN_27",       /* 27 */
87
 
   "UNKNOWN_28",       /* 28 */
88
 
   "INV_SRC2_ALPHA",   /* 29 */
89
 
};
90
 
 
91
 
static const char *LIMA_WRAP_MODE_STRING[] = {
92
 
   "TEX_WRAP_REPEAT",                  /* 0 */
93
 
   "TEX_WRAP_CLAMP_TO_EDGE",           /* 1 */
94
 
   "TEX_WRAP_CLAMP",                   /* 2 */
95
 
   "TEX_WRAP_CLAMP_TO_BORDER",         /* 3 */
96
 
   "TEX_WRAP_MIRROR_REPEAT",           /* 4 */
97
 
   "TEX_WRAP_MIRROR_CLAMP_TO_EDGE",    /* 5 */
98
 
   "TEX_WRAP_MIRROR_CLAMP",            /* 6 */
99
 
   "TEX_WRAP_MIRROR_CLAMP_TO_BORDER",  /* 7 */
100
 
};
101
 
 
102
 
static inline const char
103
 
*lima_get_compare_func_string(int func) {
104
 
   if ((func >= 0) && (func <= 7))
105
 
      return PIPE_COMPARE_FUNC_STRING[func];
106
 
   else
107
 
      return "UNKNOWN";
108
 
}
109
 
 
110
 
static inline const char
111
 
*lima_get_stencil_op_string(int func) {
112
 
   if ((func >= 0) && (func <= 7))
113
 
      return PIPE_STENCIL_OP_STRING[func];
114
 
   else
115
 
      return "UNKNOWN";
116
 
}
117
 
 
118
 
static inline const char
119
 
*lima_get_blend_func_string(int func) {
120
 
   if ((func >= 0) && (func <= 5))
121
 
      return PIPE_BLEND_FUNC_STRING[func];
122
 
   else
123
 
      return "UNKNOWN";
124
 
}
125
 
 
126
 
static inline const char
127
 
*lima_get_blendfactor_string(int func) {
128
 
   if ((func >= 0) && (func <= 26))
129
 
      return PIPE_BLENDFACTOR_STRING[func];
130
 
   else
131
 
      return "UNKNOWN";
132
 
}
133
 
 
134
 
static inline const char
135
 
*lima_get_wrap_mode_string(int mode) {
136
 
   if ((mode >= 0) && (mode <= 7))
137
 
      return LIMA_WRAP_MODE_STRING[mode];
138
 
   else
139
 
      return "UNKNOWN";
140
 
}
141
 
 
142
 
void lima_parse_shader(FILE *fp, uint32_t *data, int size, bool is_frag);
143
 
void lima_parse_vs(FILE *fp, uint32_t *data, int size, uint32_t start);
144
 
void lima_parse_plbu(FILE *fp, uint32_t *data, int size, uint32_t start);
145
 
void lima_parse_render_state(FILE *fp, uint32_t *data, int size, uint32_t start);
146
 
void lima_parse_texture_descriptor(FILE *fp, uint32_t *data, int size, uint32_t start, uint32_t offset);
147
 
 
148
 
#endif