Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  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.    "FRAG",
  38.    "VERT",
  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.    "RES",
  58.    "SVIEW"
  59. };
  60.  
  61. const char *tgsi_semantic_names[TGSI_SEMANTIC_COUNT] =
  62. {
  63.    "POSITION",
  64.    "COLOR",
  65.    "BCOLOR",
  66.    "FOG",
  67.    "PSIZE",
  68.    "GENERIC",
  69.    "NORMAL",
  70.    "FACE",
  71.    "EDGEFLAG",
  72.    "PRIM_ID",
  73.    "INSTANCEID",
  74.    "VERTEXID",
  75.    "STENCIL",
  76.    "CLIPDIST",
  77.    "CLIPVERTEX",
  78.    "GRID_SIZE",
  79.    "BLOCK_ID",
  80.    "BLOCK_SIZE",
  81.    "THREAD_ID",
  82.    "TEXCOORD",
  83.    "PCOORD",
  84.    "VIEWPORT_INDEX",
  85.    "LAYER",
  86.    "CULLDIST",
  87.    "SAMPLEID",
  88.    "SAMPLEPOS",
  89.    "SAMPLEMASK",
  90.    "INVOCATIONID",
  91.    "VERTEXID_NOBASE",
  92.    "BASEVERTEX",
  93.    "PATCH",
  94.    "TESSCOORD",
  95.    "TESSOUTER",
  96.    "TESSINNER",
  97.    "VERTICESIN",
  98. };
  99.  
  100. const char *tgsi_texture_names[TGSI_TEXTURE_COUNT] =
  101. {
  102.    "BUFFER",
  103.    "1D",
  104.    "2D",
  105.    "3D",
  106.    "CUBE",
  107.    "RECT",
  108.    "SHADOW1D",
  109.    "SHADOW2D",
  110.    "SHADOWRECT",
  111.    "1D_ARRAY",
  112.    "2D_ARRAY",
  113.    "SHADOW1D_ARRAY",
  114.    "SHADOW2D_ARRAY",
  115.    "SHADOWCUBE",
  116.    "2D_MSAA",
  117.    "2D_ARRAY_MSAA",
  118.    "CUBEARRAY",
  119.    "SHADOWCUBEARRAY",
  120.    "UNKNOWN",
  121. };
  122.  
  123. const char *tgsi_property_names[TGSI_PROPERTY_COUNT] =
  124. {
  125.    "GS_INPUT_PRIMITIVE",
  126.    "GS_OUTPUT_PRIMITIVE",
  127.    "GS_MAX_OUTPUT_VERTICES",
  128.    "FS_COORD_ORIGIN",
  129.    "FS_COORD_PIXEL_CENTER",
  130.    "FS_COLOR0_WRITES_ALL_CBUFS",
  131.    "FS_DEPTH_LAYOUT",
  132.    "VS_PROHIBIT_UCPS",
  133.    "GS_INVOCATIONS",
  134.    "VS_WINDOW_SPACE_POSITION",
  135.    "TCS_VERTICES_OUT",
  136.    "TES_PRIM_MODE",
  137.    "TES_SPACING",
  138.    "TES_VERTEX_ORDER_CW",
  139.    "TES_POINT_MODE",
  140. };
  141.  
  142. const char *tgsi_return_type_names[TGSI_RETURN_TYPE_COUNT] =
  143. {
  144.    "UNORM",
  145.    "SNORM",
  146.    "SINT",
  147.    "UINT",
  148.    "FLOAT"
  149. };
  150.  
  151. const char *tgsi_interpolate_names[TGSI_INTERPOLATE_COUNT] =
  152. {
  153.    "CONSTANT",
  154.    "LINEAR",
  155.    "PERSPECTIVE",
  156.    "COLOR"
  157. };
  158.  
  159. const char *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT] =
  160. {
  161.    "CENTER",
  162.    "CENTROID",
  163.    "SAMPLE",
  164. };
  165.  
  166. const char *tgsi_primitive_names[PIPE_PRIM_MAX] =
  167. {
  168.    "POINTS",
  169.    "LINES",
  170.    "LINE_LOOP",
  171.    "LINE_STRIP",
  172.    "TRIANGLES",
  173.    "TRIANGLE_STRIP",
  174.    "TRIANGLE_FAN",
  175.    "QUADS",
  176.    "QUAD_STRIP",
  177.    "POLYGON",
  178.    "LINES_ADJACENCY",
  179.    "LINE_STRIP_ADJACENCY",
  180.    "TRIANGLES_ADJACENCY",
  181.    "TRIANGLE_STRIP_ADJACENCY",
  182.    "PATCHES",
  183. };
  184.  
  185. const char *tgsi_fs_coord_origin_names[2] =
  186. {
  187.    "UPPER_LEFT",
  188.    "LOWER_LEFT"
  189. };
  190.  
  191. const char *tgsi_fs_coord_pixel_center_names[2] =
  192. {
  193.    "HALF_INTEGER",
  194.    "INTEGER"
  195. };
  196.  
  197. const char *tgsi_immediate_type_names[4] =
  198. {
  199.    "FLT32",
  200.    "UINT32",
  201.    "INT32",
  202.    "FLT64"
  203. };
  204.  
  205.  
  206. static INLINE void
  207. tgsi_strings_check(void)
  208. {
  209.    STATIC_ASSERT(Elements(tgsi_semantic_names) == TGSI_SEMANTIC_COUNT);
  210.    STATIC_ASSERT(Elements(tgsi_texture_names) == TGSI_TEXTURE_COUNT);
  211.    STATIC_ASSERT(Elements(tgsi_property_names) == TGSI_PROPERTY_COUNT);
  212.    STATIC_ASSERT(Elements(tgsi_primitive_names) == PIPE_PRIM_MAX);
  213.    STATIC_ASSERT(Elements(tgsi_interpolate_names) == TGSI_INTERPOLATE_COUNT);
  214.    STATIC_ASSERT(Elements(tgsi_return_type_names) == TGSI_RETURN_TYPE_COUNT);
  215.    (void) tgsi_processor_type_names;
  216.    (void) tgsi_return_type_names;
  217.    (void) tgsi_immediate_type_names;
  218.    (void) tgsi_fs_coord_origin_names;
  219.    (void) tgsi_fs_coord_pixel_center_names;
  220. }
  221.  
  222.  
  223. const char *
  224. tgsi_file_name(unsigned file)
  225. {
  226.    STATIC_ASSERT(Elements(tgsi_file_names) == TGSI_FILE_COUNT);
  227.    if (file < Elements(tgsi_file_names))
  228.       return tgsi_file_names[file];
  229.    else
  230.       return "invalid file";
  231. }
  232.