2016-10-20 19:07:10 +00:00
|
|
|
//
|
2017-01-06 19:34:14 +00:00
|
|
|
// Copyright (C) 2016 LunarG, Inc.
|
2016-10-20 19:07:10 +00:00
|
|
|
//
|
2017-01-06 19:34:14 +00:00
|
|
|
// All rights reserved.
|
2016-10-20 19:07:10 +00:00
|
|
|
//
|
2017-01-06 19:34:14 +00:00
|
|
|
// Redistribution and use in source and binary forms, with or without
|
|
|
|
// modification, are permitted provided that the following conditions
|
|
|
|
// are met:
|
2016-10-20 19:07:10 +00:00
|
|
|
//
|
|
|
|
// Redistributions of source code must retain the above copyright
|
|
|
|
// notice, this list of conditions and the following disclaimer.
|
|
|
|
//
|
|
|
|
// Redistributions in binary form must reproduce the above
|
|
|
|
// copyright notice, this list of conditions and the following
|
|
|
|
// disclaimer in the documentation and/or other materials provided
|
|
|
|
// with the distribution.
|
|
|
|
//
|
|
|
|
// Neither the name of Google, Inc., nor the names of its
|
|
|
|
// contributors may be used to endorse or promote products derived
|
|
|
|
// from this software without specific prior written permission.
|
|
|
|
//
|
2017-01-06 19:34:14 +00:00
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
|
|
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
|
|
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
// POSSIBILITY OF SUCH DAMAGE.
|
2016-10-20 19:07:10 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#include "hlslAttributes.h"
|
2018-01-30 18:01:39 +00:00
|
|
|
#include "hlslParseHelper.h"
|
2016-10-20 19:07:10 +00:00
|
|
|
|
|
|
|
namespace glslang {
|
|
|
|
// Map the given string to an attribute enum from TAttributeType,
|
|
|
|
// or EatNone if invalid.
|
2018-01-30 18:01:39 +00:00
|
|
|
TAttributeType HlslParseContext::attributeFromName(const TString& nameSpace, const TString& name) const
|
2016-10-20 19:07:10 +00:00
|
|
|
{
|
2017-09-30 20:34:50 +00:00
|
|
|
// handle names within a namespace
|
|
|
|
|
2018-01-30 18:01:39 +00:00
|
|
|
if (nameSpace == "vk") {
|
|
|
|
if (name == "input_attachment_index")
|
2017-09-30 20:34:50 +00:00
|
|
|
return EatInputAttachment;
|
2018-01-30 18:01:39 +00:00
|
|
|
else if (name == "location")
|
2017-09-30 20:34:50 +00:00
|
|
|
return EatLocation;
|
2018-01-30 18:01:39 +00:00
|
|
|
else if (name == "binding")
|
2017-09-30 20:34:50 +00:00
|
|
|
return EatBinding;
|
2018-01-30 18:01:39 +00:00
|
|
|
else if (name == "global_cbuffer_binding")
|
2017-10-19 22:54:25 +00:00
|
|
|
return EatGlobalBinding;
|
2018-01-30 18:01:39 +00:00
|
|
|
else if (name == "builtin")
|
2017-12-06 14:33:36 +00:00
|
|
|
return EatBuiltIn;
|
2018-01-30 18:01:39 +00:00
|
|
|
else if (name == "constant_id")
|
2017-12-24 00:29:45 +00:00
|
|
|
return EatConstantId;
|
2018-01-30 18:01:39 +00:00
|
|
|
else if (name == "push_constant")
|
2017-12-24 00:29:45 +00:00
|
|
|
return EatPushConstant;
|
2018-01-30 18:01:39 +00:00
|
|
|
} else if (nameSpace.size() > 0)
|
2017-09-30 20:34:50 +00:00
|
|
|
return EatNone;
|
|
|
|
|
|
|
|
// handle names with no namespace
|
2016-10-20 19:07:10 +00:00
|
|
|
|
2018-01-30 18:01:39 +00:00
|
|
|
if (name == "allow_uav_condition")
|
2016-10-20 19:07:10 +00:00
|
|
|
return EatAllow_uav_condition;
|
2018-01-30 18:01:39 +00:00
|
|
|
else if (name == "branch")
|
2016-10-20 19:07:10 +00:00
|
|
|
return EatBranch;
|
2018-01-30 18:01:39 +00:00
|
|
|
else if (name == "call")
|
2016-10-20 19:07:10 +00:00
|
|
|
return EatCall;
|
2018-01-30 18:01:39 +00:00
|
|
|
else if (name == "domain")
|
2016-10-20 19:07:10 +00:00
|
|
|
return EatDomain;
|
2018-01-30 18:01:39 +00:00
|
|
|
else if (name == "earlydepthstencil")
|
2016-11-17 22:04:20 +00:00
|
|
|
return EatEarlyDepthStencil;
|
2018-01-30 18:01:39 +00:00
|
|
|
else if (name == "fastopt")
|
2016-11-17 22:04:20 +00:00
|
|
|
return EatFastOpt;
|
2018-01-30 18:01:39 +00:00
|
|
|
else if (name == "flatten")
|
2016-10-20 19:07:10 +00:00
|
|
|
return EatFlatten;
|
2018-01-30 18:01:39 +00:00
|
|
|
else if (name == "forcecase")
|
2016-11-17 22:04:20 +00:00
|
|
|
return EatForceCase;
|
2018-01-30 18:01:39 +00:00
|
|
|
else if (name == "instance")
|
2016-10-20 19:07:10 +00:00
|
|
|
return EatInstance;
|
2018-01-30 18:01:39 +00:00
|
|
|
else if (name == "maxtessfactor")
|
2016-11-17 22:04:20 +00:00
|
|
|
return EatMaxTessFactor;
|
2018-01-30 18:01:39 +00:00
|
|
|
else if (name == "maxvertexcount")
|
2016-11-17 22:04:20 +00:00
|
|
|
return EatMaxVertexCount;
|
2018-01-30 18:01:39 +00:00
|
|
|
else if (name == "numthreads")
|
2016-11-17 22:04:20 +00:00
|
|
|
return EatNumThreads;
|
2018-01-30 18:01:39 +00:00
|
|
|
else if (name == "outputcontrolpoints")
|
2016-11-17 22:04:20 +00:00
|
|
|
return EatOutputControlPoints;
|
2018-01-30 18:01:39 +00:00
|
|
|
else if (name == "outputtopology")
|
2016-11-17 22:04:20 +00:00
|
|
|
return EatOutputTopology;
|
2018-01-30 18:01:39 +00:00
|
|
|
else if (name == "partitioning")
|
2016-10-20 19:07:10 +00:00
|
|
|
return EatPartitioning;
|
2018-01-30 18:01:39 +00:00
|
|
|
else if (name == "patchconstantfunc")
|
2016-11-17 22:04:20 +00:00
|
|
|
return EatPatchConstantFunc;
|
2018-01-30 18:01:39 +00:00
|
|
|
else if (name == "unroll")
|
2016-10-20 19:07:10 +00:00
|
|
|
return EatUnroll;
|
2018-01-30 18:01:39 +00:00
|
|
|
else if (name == "loop")
|
2017-05-03 02:14:50 +00:00
|
|
|
return EatLoop;
|
2016-10-20 19:07:10 +00:00
|
|
|
else
|
|
|
|
return EatNone;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // end namespace glslang
|