Edit

kc3-lang/angle/src/compiler/translator/ImmutableString_ESSL_autogen.cpp

Branch :

  • Show log

    Commit

  • Author : shrekshao
    Date : 2019-06-25 14:22:41
    Hash : cd31f286
    Message : Implement Draw base vertex and base instance functions This patch implements functionality of glDrawArraysInstancedBaseInstanceANGLE, glDrawElementsInstancedBaseVertexBaseInstanceANGLE, glMultiDrawArraysInstancedBaseInstanceANGLE, and glMultiDrawElementsInstancedBaseVertexBaseInstanceANGLE Workaround for OpenGL driver on Mac: gl_VertexID on Mac with AMD GPU doesn't include baseVertex value. So replace gl_VertexID with (gl_VertexID + angle_BaseVertex) if any. Workaround for Vulkan GLSL: gl_InstanceIndex on Vulkan includes baseInstance. So replace gl_InstanceIndex with (gl_InstanceIndex - angle_BaseInstance) when angle_BaseInstance is declared. Bug: chromium:891861, angleproject:3402 Change-Id: Ia1d94b5d4d7da7e635468c05c962c4f7eb1b1919 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1750126 Commit-Queue: Shrek Shao <shrekshao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>

  • src/compiler/translator/ImmutableString_ESSL_autogen.cpp
  • // GENERATED FILE - DO NOT EDIT.
    // Generated by gen_builtin_symbols.py using data from builtin_variables.json and
    // builtin_function_declarations.txt.
    //
    // Copyright 2019 The ANGLE Project Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style license that can be
    // found in the LICENSE file.
    //
    // ImmutableString_ESSL_autogen.cpp: Wrapper for static or pool allocated char arrays, that are
    // guaranteed to be valid and unchanged for the duration of the compilation. Implements
    // mangledNameHash using perfect hash function from gen_builtin_symbols.py
    
    #include "compiler/translator/ImmutableString.h"
    
    std::ostream &operator<<(std::ostream &os, const sh::ImmutableString &str)
    {
        return os.write(str.data(), str.length());
    }
    
    #if defined(_MSC_VER)
    #    pragma warning(disable : 4309)  // truncation of constant value
    #endif
    
    namespace
    {
    
    constexpr int mangledkT1[] = {1020, 929,  545,  1331, 801,  1100, 1139, 842, 1699, 67,
                                  225,  1267, 666,  508,  1168, 594,  856,  281, 1787, 368,
                                  997,  1262, 515,  1643, 1506, 866,  806,  387, 804,  870,
                                  1398, 1795, 1133, 726,  613,  1067, 1179};
    constexpr int mangledkT2[] = {850,  1442, 459,  989,  793,  414,  841,  438, 619,  508,
                                  969,  1234, 1369, 1399, 335,  1835, 1703, 106, 655,  1386,
                                  748,  1589, 354,  1029, 1042, 1181, 295,  513, 1068, 1237,
                                  1019, 748,  1321, 485,  1211, 1623, 1586};
    constexpr int mangledkG[]  = {
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    1628,
        0,    0,    0,    0,    0,    0,    0,    0,    943,  0,    0,    0,    0,    0,    0,    1793,
        0,    0,    0,    0,    1601, 733,  0,    0,    0,    740,  0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    1160, 0,    0,    1093, 955,  0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    273,  0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    1602, 0,    166,  0,    1389, 125,  0,    0,    0,    0,    0,
        0,    0,    0,    21,   0,    637,  0,    0,    0,    0,    520,  0,    0,    0,    0,    0,
        0,    0,    0,    0,    597,  0,    0,    0,    197,  0,    0,    310,  0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    843,  0,    0,    901,  0,    1809, 1225, 0,    0,    654,
        678,  0,    0,    0,    54,   1565, 0,    0,    0,    0,    0,    0,    0,    0,    1836, 0,
        402,  1585, 0,    0,    0,    0,    0,    0,    0,    1539, 117,  382,  685,  0,    0,    1635,
        604,  0,    0,    0,    518,  421,  0,    0,    0,    0,    1104, 584,  1779, 1065, 756,  0,
        0,    0,    0,    0,    0,    1259, 0,    432,  0,    0,    1354, 0,    249,  884,  69,   0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    50,   1728, 0,    466,  48,
        0,    0,    72,   271,  1583, 0,    0,    165,  0,    0,    0,    371,  1560, 0,    0,    0,
        0,    1456, 0,    304,  0,    0,    0,    0,    0,    0,    842,  0,    0,    444,  132,  791,
        0,    0,    0,    0,    0,    0,    1516, 162,  265,  0,    0,    0,    0,    0,    0,    0,
        0,    0,    683,  0,    758,  0,    0,    75,   1703, 0,    0,    0,    0,    688,  767,  0,
        1715, 0,    605,  0,    0,    1528, 1319, 0,    0,    0,    0,    0,    0,    0,    0,    507,
        1774, 0,    0,    0,    1534, 471,  0,    426,  84,   0,    0,    0,    0,    0,    64,   1485,
        0,    0,    0,    412,  555,  0,    0,    0,    1227, 0,    0,    0,    0,    0,    0,    0,
        912,  0,    978,  0,    1312, 0,    0,    0,    0,    435,  0,    0,    0,    0,    308,  562,
        0,    0,    0,    1355, 1110, 0,    0,    1663, 135,  1533, 0,    0,    662,  0,    1338, 0,
        0,    57,   355,  0,    1365, 0,    1077, 0,    0,    312,  0,    0,    533,  551,  749,  730,
        0,    0,    377,  0,    0,    0,    1406, 738,  0,    0,    0,    114,  0,    770,  0,    0,
        0,    556,  113,  0,    440,  0,    0,    0,    0,    0,    1053, 98,   1640, 0,    0,    1619,
        117,  398,  0,    281,  1481, 0,    0,    0,    0,    0,    0,    0,    0,    478,  0,    0,
        532,  0,    367,  1751, 1515, 0,    0,    0,    0,    1064, 0,    0,    0,    642,  0,    27,
        0,    444,  1619, 0,    0,    0,    0,    0,    0,    516,  0,    0,    0,    0,    698,  1219,
        0,    130,  1356, 0,    326,  0,    0,    0,    0,    0,    655,  1786, 1228, 49,   1594, 909,
        441,  709,  1703, 460,  0,    875,  0,    0,    0,    309,  0,    1060, 0,    753,  0,    0,
        0,    335,  0,    0,    1207, 244,  0,    131,  154,  683,  448,  385,  903,  0,    0,    0,
        334,  0,    0,    803,  0,    0,    0,    3,    0,    1037, 349,  1264, 258,  0,    1491, 0,
        1634, 1472, 0,    0,    0,    0,    402,  805,  0,    0,    0,    0,    921,  0,    0,    0,
        801,  0,    876,  0,    0,    0,    1540, 0,    0,    0,    0,    3,    1694, 745,  1691, 515,
        1647, 717,  0,    516,  0,    0,    712,  0,    0,    197,  0,    0,    0,    0,    0,    1632,
        17,   1809, 74,   0,    0,    501,  0,    594,  0,    18,   601,  117,  280,  0,    1200, 1832,
        0,    0,    262,  1157, 0,    164,  0,    0,    0,    618,  494,  0,    0,    41,   336,  896,
        0,    736,  0,    0,    0,    1759, 0,    0,    0,    0,    1123, 144,  0,    0,    0,    810,
        392,  752,  1273, 538,  0,    0,    587,  0,    1553, 0,    987,  827,  26,   44,   187,  8,
        0,    113,  392,  1580, 866,  0,    927,  1535, 1780, 1760, 200,  0,    0,    1105, 989,  0,
        474,  0,    873,  0,    0,    558,  0,    42,   0,    0,    882,  1600, 818,  817,  377,  0,
        328,  0,    0,    0,    385,  1665, 0,    0,    0,    500,  0,    0,    1135, 414,  0,    0,
        407,  0,    343,  454,  0,    255,  314,  1347, 1755, 0,    0,    0,    1762, 0,    619,  329,
        1160, 0,    0,    0,    0,    0,    1757, 0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    831,  491,  0,    0,    1351, 598,  157,  0,    0,    0,    0,    0,    1194, 135,
        606,  0,    0,    0,    0,    0,    245,  0,    726,  0,    0,    204,  0,    0,    0,    1776,
        0,    0,    0,    0,    381,  161,  1832, 34,   39,   0,    0,    445,  0,    190,  0,    379,
        1485, 1276, 1792, 0,    376,  650,  375,  6,    0,    1052, 0,    290,  0,    1674, 0,    0,
        1481, 0,    60,   1087, 928,  0,    0,    0,    782,  563,  31,   728,  257,  0,    1608, 0,
        0,    958,  1532, 1227, 0,    0,    0,    0,    0,    0,    0,    392,  0,    666,  0,    0,
        319,  903,  507,  0,    0,    971,  903,  0,    13,   683,  1534, 0,    406,  0,    1254, 0,
        0,    302,  722,  0,    0,    162,  950,  313,  356,  0,    475,  1470, 1736, 169,  0,    694,
        111,  46,   58,   747,  1433, 0,    1765, 0,    646,  0,    503,  115,  715,  1497, 0,    1507,
        349,  0,    678,  447,  205,  0,    0,    0,    0,    563,  0,    1577, 0,    192,  0,    0,
        5,    0,    596,  0,    0,    0,    0,    0,    214,  0,    501,  1456, 28,   0,    0,    904,
        0,    776,  0,    0,    1703, 910,  1732, 0,    856,  0,    0,    236,  1611, 503,  0,    0,
        0,    339,  274,  0,    552,  0,    1462, 772,  282,  0,    0,    595,  0,    204,  487,  0,
        1651, 0,    551,  0,    0,    702,  1610, 589,  0,    0,    175,  285,  351,  0,    113,  1091,
        802,  0,    755,  0,    0,    1805, 294,  0,    0,    0,    0,    0,    0,    0,    0,    0,
        237,  0,    0,    338,  0,    149,  1254, 0,    947,  302,  0,    0,    310,  0,    1750, 0,
        0,    830,  1681, 322,  0,    73,   370,  100,  188,  1323, 0,    0,    0,    920,  0,    0,
        1839, 1218, 0,    1494, 1364, 0,    0,    0,    791,  542,  1611, 1741, 838,  114,  1500, 0,
        0,    0,    0,    506,  1299, 982,  885,  12,   1649, 753,  0,    261,  0,    51,   0,    640,
        0,    0,    1347, 442,  532,  0,    731,  0,    0,    1033, 0,    42,   0,    0,    0,    0,
        78,   1073, 169,  414,  1236, 0,    1392, 0,    0,    0,    852,  359,  1586, 935,  0,    0,
        1072, 628,  0,    1546, 0,    0,    1471, 608,  557,  0,    0,    1277, 1681, 686,  309,  0,
        0,    0,    0,    617,  244,  0,    0,    423,  629,  0,    866,  672,  0,    772,  0,    133,
        1409, 0,    707,  203,  820,  103,  1529, 146,  0,    1042, 771,  58,   372,  102,  10,   105,
        154,  28,   0,    0,    0,    683,  389,  207,  0,    0,    837,  1470, 416,  0,    373,  0,
        0,    0,    0,    1764, 232,  252,  0,    837,  0,    0,    1762, 0,    1765, 0,    146,  0,
        1133, 656,  592,  0,    259,  0,    735,  0,    1361, 0,    0,    410,  1211, 788,  440,  0,
        0,    842,  1480, 291,  944,  559,  0,    1403, 931,  0,    1493, 1761, 0,    0,    386,  0,
        0,    0,    0,    349,  0,    652,  572,  489,  611,  51,   0,    0,    35,   537,  1183, 188,
        754,  227,  0,    489,  0,    1427, 0,    0,    696,  29,   0,    1364, 65,   438,  1086, 1378,
        0,    1757, 76,   0,    400,  337,  0,    412,  0,    965,  136,  668,  1174, 0,    23,   0,
        774,  433,  115,  459,  0,    811,  0,    0,    0,    1191, 950,  81,   0,    0,    710,  995,
        0,    1515, 718,  549,  634,  616,  775,  0,    447,  0,    0,    38,   437,  624,  0,    0,
        0,    706,  0,    0,    0,    1755, 640,  0,    134,  1461, 0,    676,  363,  105,  348,  162,
        0,    0,    685,  0,    0,    379,  1381, 1189, 0,    595,  654,  465,  0,    0,    528,  817,
        554,  0,    0,    0,    0,    398,  428,  903,  479,  980,  1287, 1631, 0,    626,  493,  19,
        0,    0,    582,  0,    1688, 251,  652,  0,    173,  543,  0,    0,    0,    0,    0,    1040,
        0,    0,    0,    0,    978,  359,  0,    0,    376,  1288, 519,  0,    1092, 1598, 875,  819,
        88,   1614, 1157, 385,  0,    782,  1635, 996,  0,    1535, 132,  0,    0,    919,  0,    13,
        523,  382,  0,    0,    0,    150,  0,    0,    1135, 99,   357,  0,    0,    600,  460,  193,
        281,  0,    1518, 0,    1187, 1149, 237,  0,    881,  0,    0,    144,  784,  145,  371,  828,
        1378, 6,    1705, 0,    0,    79,   0,    170,  0,    0,    36,   0,    0,    767,  703,  0,
        0,    488,  86,   427,  393,  0,    57,   671,  739,  0,    875,  70,   553,  0,    557,  828,
        0,    34,   319,  0,    860,  359,  0,    634,  1727, 370,  230,  1655, 0,    1746, 24,   741,
        0,    673,  467,  0,    0,    450,  0,    699,  905,  0,    871,  75,   0,    0,    0,    0,
        1203, 0,    795,  922,  851,  0,    0,    0,    1475, 1098, 0,    1231, 0,    0,    1597, 278,
        0,    0,    104,  501,  1416, 0,    0,    679,  1375, 0,    424,  0,    0,    1210, 0,    304,
        0,    112,  977,  1301, 139,  33,   0,    456,  0,    841,  283,  1117, 0,    1119, 1721, 897,
        1726, 0,    945,  699,  0,    684,  825,  1706, 804,  799,  635,  679,  0,    0,    0,    0,
        0,    0,    0,    1211, 269,  0,    1687, 1583, 0,    259,  0,    0,    938,  1211, 0,    0,
        0,    1807, 1657, 116,  1822, 0,    0,    1633, 938,  928,  1268, 201,  782,  315,  0,    482,
        128,  1021, 0,    449,  822,  484,  224,  1791, 0,    677,  0,    0,    1267, 0,    0,    0,
        584,  0,    0,    509,  354,  43,   0,    1590, 222,  0,    30,   830,  0,    179,  0,    0,
        0,    607,  0,    140,  0,    0,    0,    378,  84,   0,    322,  1545, 1241, 0,    1578, 828,
        336,  154,  0,    19,   854,  309,  1145, 0,    0,    1819, 0,    602,  422,  0,    0,    1719,
        818,  0,    0,    141,  0,    0,    1600, 153,  1650, 0,    780,  932,  0,    0,    1386, 295,
        97,   153,  801,  1303, 81,   1198, 0,    81,   1143, 0,    646,  544,  750,  435,  444,  339,
        0,    0,    39,   0,    0,    892,  794,  0,    177,  0,    850,  1745, 476,  0,    0,    691,
        0,    1288, 1520, 1590, 0,    0,    0,    147,  846,  89,   0,    0,    622,  92,   763,  0,
        0,    1668, 0,    1820, 714,  958,  0,    725,  432,  669,  657,  510,  0,    303,  279,  0,
        1195, 0,    109,  973,  887,  1302, 0,    1748, 917,  811,  635,  1205, 0,    1358, 1555, 1730,
        531,  583,  0,    443,  395,  0,    888,  0,    1634, 0,    120,  0,    530,  0,    0,    275,
        796,  0,    357,  82,   886,  870,  332,  852,  0,    1336, 38,   441,  68,   1411, 228,  387,
        0,    103,  0,    0,    1646, 431,  910,  0,    0,    0,    0,    0,    115,  674,  831,  815,
        0,    1288, 888,  1697, 394,  0,    0,    0,    260,  570,  0,    790,  265,  163,  0,    0,
        0,    442,  436,  722,  316,  688,  605,  1658, 885,  634,  0,    1398, 1340, 166,  1826, 1438,
        215,  463,  0,    0,    445,  936,  129,  0,    774,  664,  48,   0,    22,   133,  0,    406,
        70,   651,  46,   0,    175,  340,  400,  0,    0,    0,    1075, 1316, 420,  0,    1592, 1347,
        0,    9,    0,    1387, 513,  1198, 1655, 0,    0,    0,    1063, 421,  701,  179,  0,    572,
        1712, 0,    1506, 1728, 0,    744,  404,  1102, 0,    1421, 865,  1551, 0,    1717, 0,    0,
        0};
    
    int MangledHashG(const char *key, const int *T)
    {
        int sum = 0;
    
        for (int i = 0; key[i] != '\0'; i++)
        {
            sum += T[i] * key[i];
            sum %= 1841;
        }
        return mangledkG[sum];
    }
    
    int MangledPerfectHash(const char *key)
    {
        if (strlen(key) > 37)
            return 0;
    
        return (MangledHashG(key, mangledkT1) + MangledHashG(key, mangledkT2)) % 1841;
    }
    
    constexpr int unmangledkT1[] = {89,  67, 164, 90,  208, 12,  42, 160, 54, 202, 34,  42, 183,
                                    199, 87, 83,  105, 35,  134, 80, 132, 57, 49,  158, 5,  60};
    constexpr int unmangledkT2[] = {159, 88, 35,  79,  181, 132, 45,  85, 237, 60,  14,  103, 116,
                                    85,  78, 164, 123, 28,  85,  167, 46, 29,  204, 166, 227, 102};
    constexpr int unmangledkG[]  = {
        0,   0,   0,   0,   0,   0,   83,  0,   0,   0,   145, 0,   0,   0,   0,   0,   0,   9,   4,
        0,   230, 0,   0,   126, 0,   0,   0,   64,  41,  0,   217, 0,   71,  0,   0,   224, 0,   14,
        0,   28,  9,   140, 0,   184, 0,   195, 0,   0,   0,   0,   4,   0,   0,   100, 110, 65,  96,
        0,   144, 0,   0,   69,  0,   197, 4,   6,   47,  162, 0,   125, 56,  149, 0,   22,  30,  138,
        21,  0,   115, 33,  0,   104, 0,   233, 59,  0,   0,   78,  176, 0,   0,   142, 175, 107, 76,
        33,  75,  3,   0,   222, 8,   97,  0,   143, 7,   35,  0,   0,   0,   0,   147, 230, 50,  0,
        0,   0,   174, 123, 26,  192, 109, 23,  66,  195, 214, 0,   157, 0,   115, 1,   0,   167, 146,
        233, 53,  185, 0,   186, 60,  210, 124, 217, 234, 0,   44,  222, 232, 112, 0,   135, 32,  236,
        161, 0,   60,  20,  61,  28,  0,   0,   0,   98,  0,   0,   68,  197, 44,  0,   73,  68,  18,
        67,  0,   6,   131, 0,   0,   0,   78,  109, 20,  114, 37,  25,  201, 110, 87,  72,  149, 63,
        153, 0,   36,  104, 0,   100, 145, 126, 148, 118, 47,  0,   72,  0,   0,   147, 48,  209, 63,
        28,  75,  79,  169, 0,   0,   32,  201, 92,  79,  130, 0,   0,   0,   98,  197, 0,   52,  181,
        25,  0,   8,   150, 0,   224, 0,   5,   16,  40};
    
    int UnmangledHashG(const char *key, const int *T)
    {
        int sum = 0;
    
        for (int i = 0; key[i] != '\0'; i++)
        {
            sum += T[i] * key[i];
            sum %= 238;
        }
        return unmangledkG[sum];
    }
    
    int UnmangledPerfectHash(const char *key)
    {
        if (strlen(key) > 26)
            return 0;
    
        return (UnmangledHashG(key, unmangledkT1) + UnmangledHashG(key, unmangledkT2)) % 238;
    }
    
    }  // namespace
    
    namespace sh
    {
    
    template <>
    const size_t ImmutableString::FowlerNollVoHash<4>::kFnvPrime = 16777619u;
    
    template <>
    const size_t ImmutableString::FowlerNollVoHash<4>::kFnvOffsetBasis = 0x811c9dc5u;
    
    template <>
    const size_t ImmutableString::FowlerNollVoHash<8>::kFnvPrime =
        static_cast<size_t>(1099511628211ull);
    
    template <>
    const size_t ImmutableString::FowlerNollVoHash<8>::kFnvOffsetBasis =
        static_cast<size_t>(0xcbf29ce484222325ull);
    
    uint32_t ImmutableString::mangledNameHash() const
    {
        return MangledPerfectHash(data());
    }
    
    uint32_t ImmutableString::unmangledNameHash() const
    {
        return UnmangledPerfectHash(data());
    }
    
    }  // namespace sh