// Copyright 2016 The Shaderc Authors. All rights reserved.1//2// Licensed under the Apache License, Version 2.0 (the "License");3// you may not use this file except in compliance with the License.4// You may obtain a copy of the License at5//6// http://www.apache.org/licenses/LICENSE-2.07//8// Unless required by applicable law or agreed to in writing, software9// distributed under the License is distributed on an "AS IS" BASIS,10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11// See the License for the specific language governing permissions and12// limitations under the License.1314#ifndef GLSLC_RESOURCE_PARSE_H15#define GLSLC_RESOURCE_PARSE_H1617#include <string>18#include <vector>1920#include "shaderc/shaderc.h"2122namespace glslc {2324// A resource limit setting.25struct ResourceSetting {26shaderc_limit limit;27int value;28};293031// Returns true when two resource setting structures are equal.32inline bool operator==(const ResourceSetting& lhs, const ResourceSetting& rhs) {33return (lhs.limit == rhs.limit) && (lhs.value == rhs.value);34}353637// Parses a resource limit setting string. On success, returns true and populates38// the limits parameter. On failure returns failure and emits a message to err.39// The setting string should be a seqeuence of pairs, where each pair40// is a limit name followed by a decimal integer. Tokens should be separated41// by whitespace. In particular, this function accepts Glslang's configuration42// file syntax. If a limit is mentioned multiple times, then the last setting43// takes effect. Ignore settings for:44// nonInductiveForLoops45// whileLoops46// doWhileLoops47// generalUniformIndexing48// generalAttributeMatrixVectorIndexing49// generalVaryingIndexing50// generalSamplerIndexing51// generalVariableIndexing52// generalConstantMatrixVectorIndexing53bool ParseResourceSettings(const std::string& input,54std::vector<ResourceSetting>* limits,55std::string* err);56} // namespace glslc575859#endif // GLSLC_FILE_H_606162