blob: 261cec346f21e0955c41e67955d6ec6711403fe5 [file] [log] [blame]
steve-lunarg1868b142016-10-20 13:07:10 -06001//
John Kessenich927608b2017-01-06 12:34:14 -07002// Copyright (C) 2016 LunarG, Inc.
steve-lunarg1868b142016-10-20 13:07:10 -06003//
John Kessenich927608b2017-01-06 12:34:14 -07004// All rights reserved.
steve-lunarg1868b142016-10-20 13:07:10 -06005//
John Kessenich927608b2017-01-06 12:34:14 -07006// Redistribution and use in source and binary forms, with or without
7// modification, are permitted provided that the following conditions
8// are met:
steve-lunarg1868b142016-10-20 13:07:10 -06009//
10// Redistributions of source code must retain the above copyright
11// notice, this list of conditions and the following disclaimer.
12//
13// Redistributions in binary form must reproduce the above
14// copyright notice, this list of conditions and the following
15// disclaimer in the documentation and/or other materials provided
16// with the distribution.
17//
18// Neither the name of Google, Inc., nor the names of its
19// contributors may be used to endorse or promote products derived
20// from this software without specific prior written permission.
21//
John Kessenich927608b2017-01-06 12:34:14 -070022// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33// POSSIBILITY OF SUCH DAMAGE.
steve-lunarg1868b142016-10-20 13:07:10 -060034//
35
36#include "hlslAttributes.h"
John Kesseniche18fd202018-01-30 11:01:39 -070037#include "hlslParseHelper.h"
steve-lunarg1868b142016-10-20 13:07:10 -060038
39namespace glslang {
40 // Map the given string to an attribute enum from TAttributeType,
41 // or EatNone if invalid.
John Kesseniche18fd202018-01-30 11:01:39 -070042 TAttributeType HlslParseContext::attributeFromName(const TString& nameSpace, const TString& name) const
steve-lunarg1868b142016-10-20 13:07:10 -060043 {
John Kessenich77ea30b2017-09-30 14:34:50 -060044 // handle names within a namespace
45
John Kesseniche18fd202018-01-30 11:01:39 -070046 if (nameSpace == "vk") {
47 if (name == "input_attachment_index")
John Kessenich77ea30b2017-09-30 14:34:50 -060048 return EatInputAttachment;
John Kesseniche18fd202018-01-30 11:01:39 -070049 else if (name == "location")
John Kessenich77ea30b2017-09-30 14:34:50 -060050 return EatLocation;
John Kesseniche18fd202018-01-30 11:01:39 -070051 else if (name == "binding")
John Kessenich77ea30b2017-09-30 14:34:50 -060052 return EatBinding;
John Kesseniche18fd202018-01-30 11:01:39 -070053 else if (name == "global_cbuffer_binding")
John Kessenich1b46f132017-10-19 16:54:25 -060054 return EatGlobalBinding;
John Kesseniche18fd202018-01-30 11:01:39 -070055 else if (name == "builtin")
John Kessenichcc951f82017-12-06 07:33:36 -070056 return EatBuiltIn;
John Kesseniche18fd202018-01-30 11:01:39 -070057 else if (name == "constant_id")
John Kessenich046bae02017-12-23 17:29:45 -070058 return EatConstantId;
John Kesseniche18fd202018-01-30 11:01:39 -070059 else if (name == "push_constant")
John Kessenich046bae02017-12-23 17:29:45 -070060 return EatPushConstant;
John Kesseniche18fd202018-01-30 11:01:39 -070061 } else if (nameSpace.size() > 0)
John Kessenich77ea30b2017-09-30 14:34:50 -060062 return EatNone;
63
64 // handle names with no namespace
steve-lunarg1868b142016-10-20 13:07:10 -060065
John Kesseniche18fd202018-01-30 11:01:39 -070066 if (name == "allow_uav_condition")
steve-lunarg1868b142016-10-20 13:07:10 -060067 return EatAllow_uav_condition;
John Kesseniche18fd202018-01-30 11:01:39 -070068 else if (name == "branch")
steve-lunarg1868b142016-10-20 13:07:10 -060069 return EatBranch;
John Kesseniche18fd202018-01-30 11:01:39 -070070 else if (name == "call")
steve-lunarg1868b142016-10-20 13:07:10 -060071 return EatCall;
John Kesseniche18fd202018-01-30 11:01:39 -070072 else if (name == "domain")
steve-lunarg1868b142016-10-20 13:07:10 -060073 return EatDomain;
John Kesseniche18fd202018-01-30 11:01:39 -070074 else if (name == "earlydepthstencil")
steve-lunargf49cdf42016-11-17 15:04:20 -070075 return EatEarlyDepthStencil;
John Kesseniche18fd202018-01-30 11:01:39 -070076 else if (name == "fastopt")
steve-lunargf49cdf42016-11-17 15:04:20 -070077 return EatFastOpt;
John Kesseniche18fd202018-01-30 11:01:39 -070078 else if (name == "flatten")
steve-lunarg1868b142016-10-20 13:07:10 -060079 return EatFlatten;
John Kesseniche18fd202018-01-30 11:01:39 -070080 else if (name == "forcecase")
steve-lunargf49cdf42016-11-17 15:04:20 -070081 return EatForceCase;
John Kesseniche18fd202018-01-30 11:01:39 -070082 else if (name == "instance")
steve-lunarg1868b142016-10-20 13:07:10 -060083 return EatInstance;
John Kesseniche18fd202018-01-30 11:01:39 -070084 else if (name == "maxtessfactor")
steve-lunargf49cdf42016-11-17 15:04:20 -070085 return EatMaxTessFactor;
John Kesseniche18fd202018-01-30 11:01:39 -070086 else if (name == "maxvertexcount")
steve-lunargf49cdf42016-11-17 15:04:20 -070087 return EatMaxVertexCount;
John Kesseniche18fd202018-01-30 11:01:39 -070088 else if (name == "numthreads")
steve-lunargf49cdf42016-11-17 15:04:20 -070089 return EatNumThreads;
John Kesseniche18fd202018-01-30 11:01:39 -070090 else if (name == "outputcontrolpoints")
steve-lunargf49cdf42016-11-17 15:04:20 -070091 return EatOutputControlPoints;
John Kesseniche18fd202018-01-30 11:01:39 -070092 else if (name == "outputtopology")
steve-lunargf49cdf42016-11-17 15:04:20 -070093 return EatOutputTopology;
John Kesseniche18fd202018-01-30 11:01:39 -070094 else if (name == "partitioning")
steve-lunarg1868b142016-10-20 13:07:10 -060095 return EatPartitioning;
John Kesseniche18fd202018-01-30 11:01:39 -070096 else if (name == "patchconstantfunc")
steve-lunargf49cdf42016-11-17 15:04:20 -070097 return EatPatchConstantFunc;
John Kesseniche18fd202018-01-30 11:01:39 -070098 else if (name == "unroll")
steve-lunarg1868b142016-10-20 13:07:10 -060099 return EatUnroll;
John Kesseniche18fd202018-01-30 11:01:39 -0700100 else if (name == "loop")
steve-lunargf1709e72017-05-02 20:14:50 -0600101 return EatLoop;
steve-lunarg1868b142016-10-20 13:07:10 -0600102 else
103 return EatNone;
104 }
105
steve-lunarg1868b142016-10-20 13:07:10 -0600106} // end namespace glslang