Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/shaderc
Path: blob/main/glslc/src/resource_parse.h
1560 views
1
// Copyright 2016 The Shaderc Authors. All rights reserved.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#ifndef GLSLC_RESOURCE_PARSE_H
16
#define GLSLC_RESOURCE_PARSE_H
17
18
#include <string>
19
#include <vector>
20
21
#include "shaderc/shaderc.h"
22
23
namespace glslc {
24
25
// A resource limit setting.
26
struct ResourceSetting {
27
shaderc_limit limit;
28
int value;
29
};
30
31
32
// Returns true when two resource setting structures are equal.
33
inline bool operator==(const ResourceSetting& lhs, const ResourceSetting& rhs) {
34
return (lhs.limit == rhs.limit) && (lhs.value == rhs.value);
35
}
36
37
38
// Parses a resource limit setting string. On success, returns true and populates
39
// the limits parameter. On failure returns failure and emits a message to err.
40
// The setting string should be a seqeuence of pairs, where each pair
41
// is a limit name followed by a decimal integer. Tokens should be separated
42
// by whitespace. In particular, this function accepts Glslang's configuration
43
// file syntax. If a limit is mentioned multiple times, then the last setting
44
// takes effect. Ignore settings for:
45
// nonInductiveForLoops
46
// whileLoops
47
// doWhileLoops
48
// generalUniformIndexing
49
// generalAttributeMatrixVectorIndexing
50
// generalVaryingIndexing
51
// generalSamplerIndexing
52
// generalVariableIndexing
53
// generalConstantMatrixVectorIndexing
54
bool ParseResourceSettings(const std::string& input,
55
std::vector<ResourceSetting>* limits,
56
std::string* err);
57
} // namespace glslc
58
59
60
#endif // GLSLC_FILE_H_
61
62