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