Path: blob/21.2-virgl/src/gallium/drivers/lima/lima_parser.h
4565 views
/*1* Copyright (C) 2018-2019 Lima Project2*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 shall be included in11* all copies or substantial portions of the Software.12*13* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR14* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,15* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL16* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR17* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,18* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR19* OTHER DEALINGS IN THE SOFTWARE.20*21*/2223#ifndef H_LIMA_PARSER24#define H_LIMA_PARSER2526static const char *PIPE_COMPARE_FUNC_STRING[] = {27"NEVER", /* 0 */28"LESS", /* 1 */29"EQUAL", /* 2 */30"LEQUAL", /* 3 */31"GREATER", /* 4 */32"NOTEQUAL", /* 5 */33"GEQUAL", /* 6 */34"ALWAYS", /* 7 */35};3637static const char *PIPE_STENCIL_OP_STRING[] = {38"KEEP", /* 0 */39"REPLACE", /* 1 */40"ZERO", /* 2 */41"INVERT", /* 3 */42"INCR_WRAP", /* 4 */43"DECR_WRAP", /* 5 */44"INCR", /* 6 */45"DECR", /* 7 */46};4748static const char *PIPE_BLEND_FUNC_STRING[] = {49"SUBTRACT", /* 0 */50"REV_SUBTRACT", /* 1 */51"ADD", /* 2 */52"UNKNOWN_3", /* 3 */53"BLEND_MIN", /* 4 */54"BLEND_MAX", /* 5 */55};5657static const char *PIPE_BLENDFACTOR_STRING[] = {58"SRC_COLOR", /* 0 */59"DST_COLOR", /* 1 */60"CONST_COLOR", /* 2 */61"ZERO", /* 3 */62"UNKNOWN_4", /* 4 */63"UNKNOWN_5", /* 5 */64"UNKNOWN_6", /* 6 */65"SRC_ALPHA_SAT", /* 7 */66"INV_SRC_COLOR", /* 8 */67"INV_DST_COLOR", /* 9 */68"INV_CONST_COLOR", /* 10 */69"ONE", /* 11 */70"UNKNOWN_12", /* 12 */71"UNKNOWN_13", /* 13 */72"UNKNOWN_14", /* 14 */73"UNKNOWN_15", /* 15 */74"SRC_ALPHA", /* 16 */75"DST_ALPHA", /* 17 */76"CONST_ALPHA", /* 18 */77"UNKNOWN_19", /* 19 */78"UNKNOWN_20", /* 20 */79"UNKNOWN_21", /* 21 */80"UNKNOWN_22", /* 22 */81"UNKNOWN_23", /* 23 */82"INV_SRC_ALPHA", /* 24 */83"INV_DST_ALPHA", /* 25 */84"INV_CONST_ALPHA", /* 26 */8586};8788static inline const char89*lima_get_compare_func_string(int func) {90if ((func >= 0) && (func <= 7))91return PIPE_COMPARE_FUNC_STRING[func];92else93return "UNKNOWN";94}9596static inline const char97*lima_get_stencil_op_string(int func) {98if ((func >= 0) && (func <= 7))99return PIPE_STENCIL_OP_STRING[func];100else101return "UNKNOWN";102}103104static inline const char105*lima_get_blend_func_string(int func) {106if ((func >= 0) && (func <= 5))107return PIPE_BLEND_FUNC_STRING[func];108else109return "UNKNOWN";110}111112static inline const char113*lima_get_blendfactor_string(int func) {114if ((func >= 0) && (func <= 26))115return PIPE_BLENDFACTOR_STRING[func];116else117return "UNKNOWN";118}119120void lima_parse_vs(FILE *fp, uint32_t *data, int size, uint32_t start);121void lima_parse_plbu(FILE *fp, uint32_t *data, int size, uint32_t start);122void lima_parse_render_state(FILE *fp, uint32_t *data, int size, uint32_t start);123void lima_parse_texture_descriptor(FILE *fp, uint32_t *data, int size, uint32_t start, uint32_t offset);124125#endif126127128