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