1bf215546Sopenharmony_ci/************************************************************************** 2bf215546Sopenharmony_ci * 3bf215546Sopenharmony_ci * Copyright 2007-2008 VMware, Inc. 4bf215546Sopenharmony_ci * Copyright 2012 VMware, Inc. 5bf215546Sopenharmony_ci * All Rights Reserved. 6bf215546Sopenharmony_ci * 7bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 8bf215546Sopenharmony_ci * copy of this software and associated documentation files (the 9bf215546Sopenharmony_ci * "Software"), to deal in the Software without restriction, including 10bf215546Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish, 11bf215546Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to 12bf215546Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to 13bf215546Sopenharmony_ci * the following conditions: 14bf215546Sopenharmony_ci * 15bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the 16bf215546Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions 17bf215546Sopenharmony_ci * of the Software. 18bf215546Sopenharmony_ci * 19bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 20bf215546Sopenharmony_ci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21bf215546Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 22bf215546Sopenharmony_ci * IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR 23bf215546Sopenharmony_ci * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24bf215546Sopenharmony_ci * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25bf215546Sopenharmony_ci * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26bf215546Sopenharmony_ci * 27bf215546Sopenharmony_ci **************************************************************************/ 28bf215546Sopenharmony_ci 29bf215546Sopenharmony_ci 30bf215546Sopenharmony_ci#include "pipe/p_compiler.h" 31bf215546Sopenharmony_ci#include "util/u_memory.h" 32bf215546Sopenharmony_ci#include "tgsi_strings.h" 33bf215546Sopenharmony_ci 34bf215546Sopenharmony_ci 35bf215546Sopenharmony_ciconst char *tgsi_processor_type_names[6] = 36bf215546Sopenharmony_ci{ 37bf215546Sopenharmony_ci "VERT", 38bf215546Sopenharmony_ci "FRAG", 39bf215546Sopenharmony_ci "GEOM", 40bf215546Sopenharmony_ci "TESS_CTRL", 41bf215546Sopenharmony_ci "TESS_EVAL", 42bf215546Sopenharmony_ci "COMP" 43bf215546Sopenharmony_ci}; 44bf215546Sopenharmony_ci 45bf215546Sopenharmony_cistatic const char *tgsi_file_names[] = 46bf215546Sopenharmony_ci{ 47bf215546Sopenharmony_ci "NULL", 48bf215546Sopenharmony_ci "CONST", 49bf215546Sopenharmony_ci "IN", 50bf215546Sopenharmony_ci "OUT", 51bf215546Sopenharmony_ci "TEMP", 52bf215546Sopenharmony_ci "SAMP", 53bf215546Sopenharmony_ci "ADDR", 54bf215546Sopenharmony_ci "IMM", 55bf215546Sopenharmony_ci "SV", 56bf215546Sopenharmony_ci "IMAGE", 57bf215546Sopenharmony_ci "SVIEW", 58bf215546Sopenharmony_ci "BUFFER", 59bf215546Sopenharmony_ci "MEMORY", 60bf215546Sopenharmony_ci "CONSTBUF", 61bf215546Sopenharmony_ci "HWATOMIC", 62bf215546Sopenharmony_ci}; 63bf215546Sopenharmony_ci 64bf215546Sopenharmony_ciconst char *tgsi_semantic_names[TGSI_SEMANTIC_COUNT] = 65bf215546Sopenharmony_ci{ 66bf215546Sopenharmony_ci "POSITION", 67bf215546Sopenharmony_ci "COLOR", 68bf215546Sopenharmony_ci "BCOLOR", 69bf215546Sopenharmony_ci "FOG", 70bf215546Sopenharmony_ci "PSIZE", 71bf215546Sopenharmony_ci "GENERIC", 72bf215546Sopenharmony_ci "NORMAL", 73bf215546Sopenharmony_ci "FACE", 74bf215546Sopenharmony_ci "EDGEFLAG", 75bf215546Sopenharmony_ci "PRIM_ID", 76bf215546Sopenharmony_ci "INSTANCEID", 77bf215546Sopenharmony_ci "VERTEXID", 78bf215546Sopenharmony_ci "STENCIL", 79bf215546Sopenharmony_ci "CLIPDIST", 80bf215546Sopenharmony_ci "CLIPVERTEX", 81bf215546Sopenharmony_ci "GRID_SIZE", 82bf215546Sopenharmony_ci "BLOCK_ID", 83bf215546Sopenharmony_ci "BLOCK_SIZE", 84bf215546Sopenharmony_ci "THREAD_ID", 85bf215546Sopenharmony_ci "TEXCOORD", 86bf215546Sopenharmony_ci "PCOORD", 87bf215546Sopenharmony_ci "VIEWPORT_INDEX", 88bf215546Sopenharmony_ci "LAYER", 89bf215546Sopenharmony_ci "SAMPLEID", 90bf215546Sopenharmony_ci "SAMPLEPOS", 91bf215546Sopenharmony_ci "SAMPLEMASK", 92bf215546Sopenharmony_ci "INVOCATIONID", 93bf215546Sopenharmony_ci "VERTEXID_NOBASE", 94bf215546Sopenharmony_ci "BASEVERTEX", 95bf215546Sopenharmony_ci "PATCH", 96bf215546Sopenharmony_ci "TESSCOORD", 97bf215546Sopenharmony_ci "TESSOUTER", 98bf215546Sopenharmony_ci "TESSINNER", 99bf215546Sopenharmony_ci "VERTICESIN", 100bf215546Sopenharmony_ci "HELPER_INVOCATION", 101bf215546Sopenharmony_ci "BASEINSTANCE", 102bf215546Sopenharmony_ci "DRAWID", 103bf215546Sopenharmony_ci "WORK_DIM", 104bf215546Sopenharmony_ci "SUBGROUP_SIZE", 105bf215546Sopenharmony_ci "SUBGROUP_INVOCATION", 106bf215546Sopenharmony_ci "SUBGROUP_EQ_MASK", 107bf215546Sopenharmony_ci "SUBGROUP_GE_MASK", 108bf215546Sopenharmony_ci "SUBGROUP_GT_MASK", 109bf215546Sopenharmony_ci "SUBGROUP_LE_MASK", 110bf215546Sopenharmony_ci "SUBGROUP_LT_MASK", 111bf215546Sopenharmony_ci "CS_USER_DATA_AMD", 112bf215546Sopenharmony_ci "VIEWPORT_MASK", 113bf215546Sopenharmony_ci}; 114bf215546Sopenharmony_ci 115bf215546Sopenharmony_ciconst char *tgsi_texture_names[TGSI_TEXTURE_COUNT] = 116bf215546Sopenharmony_ci{ 117bf215546Sopenharmony_ci "BUFFER", 118bf215546Sopenharmony_ci "1D", 119bf215546Sopenharmony_ci "2D", 120bf215546Sopenharmony_ci "3D", 121bf215546Sopenharmony_ci "CUBE", 122bf215546Sopenharmony_ci "RECT", 123bf215546Sopenharmony_ci "SHADOW1D", 124bf215546Sopenharmony_ci "SHADOW2D", 125bf215546Sopenharmony_ci "SHADOWRECT", 126bf215546Sopenharmony_ci "1D_ARRAY", 127bf215546Sopenharmony_ci "2D_ARRAY", 128bf215546Sopenharmony_ci "SHADOW1D_ARRAY", 129bf215546Sopenharmony_ci "SHADOW2D_ARRAY", 130bf215546Sopenharmony_ci "SHADOWCUBE", 131bf215546Sopenharmony_ci "2D_MSAA", 132bf215546Sopenharmony_ci "2D_ARRAY_MSAA", 133bf215546Sopenharmony_ci "CUBEARRAY", 134bf215546Sopenharmony_ci "SHADOWCUBEARRAY", 135bf215546Sopenharmony_ci "UNKNOWN", 136bf215546Sopenharmony_ci}; 137bf215546Sopenharmony_ci 138bf215546Sopenharmony_ciconst char *tgsi_property_names[TGSI_PROPERTY_COUNT] = 139bf215546Sopenharmony_ci{ 140bf215546Sopenharmony_ci "GS_INPUT_PRIMITIVE", 141bf215546Sopenharmony_ci "GS_OUTPUT_PRIMITIVE", 142bf215546Sopenharmony_ci "GS_MAX_OUTPUT_VERTICES", 143bf215546Sopenharmony_ci "FS_COORD_ORIGIN", 144bf215546Sopenharmony_ci "FS_COORD_PIXEL_CENTER", 145bf215546Sopenharmony_ci "FS_COLOR0_WRITES_ALL_CBUFS", 146bf215546Sopenharmony_ci "FS_DEPTH_LAYOUT", 147bf215546Sopenharmony_ci "VS_PROHIBIT_UCPS", 148bf215546Sopenharmony_ci "GS_INVOCATIONS", 149bf215546Sopenharmony_ci "VS_WINDOW_SPACE_POSITION", 150bf215546Sopenharmony_ci "TCS_VERTICES_OUT", 151bf215546Sopenharmony_ci "TES_PRIM_MODE", 152bf215546Sopenharmony_ci "TES_SPACING", 153bf215546Sopenharmony_ci "TES_VERTEX_ORDER_CW", 154bf215546Sopenharmony_ci "TES_POINT_MODE", 155bf215546Sopenharmony_ci "NUM_CLIPDIST_ENABLED", 156bf215546Sopenharmony_ci "NUM_CULLDIST_ENABLED", 157bf215546Sopenharmony_ci "FS_EARLY_DEPTH_STENCIL", 158bf215546Sopenharmony_ci "FS_POST_DEPTH_COVERAGE", 159bf215546Sopenharmony_ci "NEXT_SHADER", 160bf215546Sopenharmony_ci "CS_FIXED_BLOCK_WIDTH", 161bf215546Sopenharmony_ci "CS_FIXED_BLOCK_HEIGHT", 162bf215546Sopenharmony_ci "CS_FIXED_BLOCK_DEPTH", 163bf215546Sopenharmony_ci "LEGACY_MATH_RULES", 164bf215546Sopenharmony_ci "VS_BLIT_SGPRS_AMD", 165bf215546Sopenharmony_ci "CS_USER_DATA_COMPONENTS_AMD", 166bf215546Sopenharmony_ci "LAYER_VIEWPORT_RELATIVE", 167bf215546Sopenharmony_ci "FS_BLEND_EQUATION_ADVANCED", 168bf215546Sopenharmony_ci "SEPARABLE_PROGRAM", 169bf215546Sopenharmony_ci}; 170bf215546Sopenharmony_ci 171bf215546Sopenharmony_ciconst char *tgsi_return_type_names[TGSI_RETURN_TYPE_COUNT] = 172bf215546Sopenharmony_ci{ 173bf215546Sopenharmony_ci "UNORM", 174bf215546Sopenharmony_ci "SNORM", 175bf215546Sopenharmony_ci "SINT", 176bf215546Sopenharmony_ci "UINT", 177bf215546Sopenharmony_ci "FLOAT" 178bf215546Sopenharmony_ci}; 179bf215546Sopenharmony_ci 180bf215546Sopenharmony_ciconst char *tgsi_interpolate_names[TGSI_INTERPOLATE_COUNT] = 181bf215546Sopenharmony_ci{ 182bf215546Sopenharmony_ci "CONSTANT", 183bf215546Sopenharmony_ci "LINEAR", 184bf215546Sopenharmony_ci "PERSPECTIVE", 185bf215546Sopenharmony_ci "COLOR" 186bf215546Sopenharmony_ci}; 187bf215546Sopenharmony_ci 188bf215546Sopenharmony_ciconst char *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT] = 189bf215546Sopenharmony_ci{ 190bf215546Sopenharmony_ci "CENTER", 191bf215546Sopenharmony_ci "CENTROID", 192bf215546Sopenharmony_ci "SAMPLE", 193bf215546Sopenharmony_ci}; 194bf215546Sopenharmony_ci 195bf215546Sopenharmony_ciconst char *tgsi_invariant_name = "INVARIANT"; 196bf215546Sopenharmony_ci 197bf215546Sopenharmony_ciconst char *tgsi_primitive_names[PIPE_PRIM_MAX] = 198bf215546Sopenharmony_ci{ 199bf215546Sopenharmony_ci "POINTS", 200bf215546Sopenharmony_ci "LINES", 201bf215546Sopenharmony_ci "LINE_LOOP", 202bf215546Sopenharmony_ci "LINE_STRIP", 203bf215546Sopenharmony_ci "TRIANGLES", 204bf215546Sopenharmony_ci "TRIANGLE_STRIP", 205bf215546Sopenharmony_ci "TRIANGLE_FAN", 206bf215546Sopenharmony_ci "QUADS", 207bf215546Sopenharmony_ci "QUAD_STRIP", 208bf215546Sopenharmony_ci "POLYGON", 209bf215546Sopenharmony_ci "LINES_ADJACENCY", 210bf215546Sopenharmony_ci "LINE_STRIP_ADJACENCY", 211bf215546Sopenharmony_ci "TRIANGLES_ADJACENCY", 212bf215546Sopenharmony_ci "TRIANGLE_STRIP_ADJACENCY", 213bf215546Sopenharmony_ci "PATCHES", 214bf215546Sopenharmony_ci}; 215bf215546Sopenharmony_ci 216bf215546Sopenharmony_ciconst char *tgsi_fs_coord_origin_names[2] = 217bf215546Sopenharmony_ci{ 218bf215546Sopenharmony_ci "UPPER_LEFT", 219bf215546Sopenharmony_ci "LOWER_LEFT" 220bf215546Sopenharmony_ci}; 221bf215546Sopenharmony_ci 222bf215546Sopenharmony_ciconst char *tgsi_fs_coord_pixel_center_names[2] = 223bf215546Sopenharmony_ci{ 224bf215546Sopenharmony_ci "HALF_INTEGER", 225bf215546Sopenharmony_ci "INTEGER" 226bf215546Sopenharmony_ci}; 227bf215546Sopenharmony_ci 228bf215546Sopenharmony_ciconst char *tgsi_immediate_type_names[6] = 229bf215546Sopenharmony_ci{ 230bf215546Sopenharmony_ci "FLT32", 231bf215546Sopenharmony_ci "UINT32", 232bf215546Sopenharmony_ci "INT32", 233bf215546Sopenharmony_ci "FLT64", 234bf215546Sopenharmony_ci "UINT64", 235bf215546Sopenharmony_ci "INT64", 236bf215546Sopenharmony_ci}; 237bf215546Sopenharmony_ci 238bf215546Sopenharmony_ciconst char *tgsi_memory_names[4] = 239bf215546Sopenharmony_ci{ 240bf215546Sopenharmony_ci "COHERENT", 241bf215546Sopenharmony_ci "RESTRICT", 242bf215546Sopenharmony_ci "VOLATILE", 243bf215546Sopenharmony_ci "STREAM_CACHE_POLICY", 244bf215546Sopenharmony_ci}; 245bf215546Sopenharmony_ci 246bf215546Sopenharmony_ci 247bf215546Sopenharmony_ciUNUSED static inline void 248bf215546Sopenharmony_citgsi_strings_check(void) 249bf215546Sopenharmony_ci{ 250bf215546Sopenharmony_ci STATIC_ASSERT(ARRAY_SIZE(tgsi_semantic_names) == TGSI_SEMANTIC_COUNT); 251bf215546Sopenharmony_ci STATIC_ASSERT(ARRAY_SIZE(tgsi_texture_names) == TGSI_TEXTURE_COUNT); 252bf215546Sopenharmony_ci STATIC_ASSERT(ARRAY_SIZE(tgsi_property_names) == TGSI_PROPERTY_COUNT); 253bf215546Sopenharmony_ci STATIC_ASSERT(ARRAY_SIZE(tgsi_primitive_names) == PIPE_PRIM_MAX); 254bf215546Sopenharmony_ci STATIC_ASSERT(ARRAY_SIZE(tgsi_interpolate_names) == TGSI_INTERPOLATE_COUNT); 255bf215546Sopenharmony_ci STATIC_ASSERT(ARRAY_SIZE(tgsi_return_type_names) == TGSI_RETURN_TYPE_COUNT); 256bf215546Sopenharmony_ci (void) tgsi_processor_type_names; 257bf215546Sopenharmony_ci (void) tgsi_return_type_names; 258bf215546Sopenharmony_ci (void) tgsi_immediate_type_names; 259bf215546Sopenharmony_ci (void) tgsi_fs_coord_origin_names; 260bf215546Sopenharmony_ci (void) tgsi_fs_coord_pixel_center_names; 261bf215546Sopenharmony_ci} 262bf215546Sopenharmony_ci 263bf215546Sopenharmony_ci 264bf215546Sopenharmony_ciconst char * 265bf215546Sopenharmony_citgsi_file_name(unsigned file) 266bf215546Sopenharmony_ci{ 267bf215546Sopenharmony_ci STATIC_ASSERT(ARRAY_SIZE(tgsi_file_names) == TGSI_FILE_COUNT); 268bf215546Sopenharmony_ci if (file < ARRAY_SIZE(tgsi_file_names)) 269bf215546Sopenharmony_ci return tgsi_file_names[file]; 270bf215546Sopenharmony_ci else 271bf215546Sopenharmony_ci return "invalid file"; 272bf215546Sopenharmony_ci} 273