2
* Copyright (C) 2018-2019 Lima Project
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:
11
* The above copyright notice and this permission notice shall be included in
12
* all copies or substantial portions of the Software.
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.
27
static const char *PIPE_COMPARE_FUNC_STRING[] = {
38
static const char *PIPE_STENCIL_OP_STRING[] = {
49
static const char *PIPE_BLEND_FUNC_STRING[] = {
51
"REV_SUBTRACT", /* 1 */
58
static const char *PIPE_BLENDFACTOR_STRING[] = {
61
"CONST_COLOR", /* 2 */
66
"SRC_ALPHA_SAT", /* 7 */
67
"INV_SRC_COLOR", /* 8 */
68
"INV_DST_COLOR", /* 9 */
69
"INV_CONST_COLOR", /* 10 */
71
"UNKNOWN_12", /* 12 */
72
"INV_SRC2_COLOR", /* 13 */
73
"UNKNOWN_14", /* 14 */
74
"UNKNOWN_15", /* 15 */
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 */
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 */
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];
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];
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];
126
static inline const char
127
*lima_get_blendfactor_string(int func) {
128
if ((func >= 0) && (func <= 26))
129
return PIPE_BLENDFACTOR_STRING[func];
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];
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);