blob: 7c7f4c4e49be2800578b9db0e44809452e699e7d [file] [log] [blame]
Lei Zhang414eb602016-03-04 16:22:34 -05001//
2// Copyright (C) 2016 Google, Inc.
3//
4// All rights reserved.
5//
6// Redistribution and use in source and binary forms, with or without
7// modification, are permitted provided that the following conditions
8// are met:
9//
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//
22// 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.
34
David Neto2ed1d9b2016-05-20 16:05:21 -040035#include <cstdlib>
36#include <cstring>
Lei Zhang414eb602016-03-04 16:22:34 -050037#include <sstream>
steve-lunarg4e3dd202016-10-20 23:56:45 -060038#include <cctype>
Lei Zhang414eb602016-03-04 16:22:34 -050039
Lei Zhang8a9b1ee2016-05-19 13:31:43 -040040#include "ResourceLimits.h"
Lei Zhang414eb602016-03-04 16:22:34 -050041
42namespace glslang {
43
44const TBuiltInResource DefaultTBuiltInResource = {
45 /* .MaxLights = */ 32,
46 /* .MaxClipPlanes = */ 6,
47 /* .MaxTextureUnits = */ 32,
48 /* .MaxTextureCoords = */ 32,
49 /* .MaxVertexAttribs = */ 64,
50 /* .MaxVertexUniformComponents = */ 4096,
51 /* .MaxVaryingFloats = */ 64,
52 /* .MaxVertexTextureImageUnits = */ 32,
53 /* .MaxCombinedTextureImageUnits = */ 80,
54 /* .MaxTextureImageUnits = */ 32,
55 /* .MaxFragmentUniformComponents = */ 4096,
56 /* .MaxDrawBuffers = */ 32,
57 /* .MaxVertexUniformVectors = */ 128,
58 /* .MaxVaryingVectors = */ 8,
59 /* .MaxFragmentUniformVectors = */ 16,
60 /* .MaxVertexOutputVectors = */ 16,
61 /* .MaxFragmentInputVectors = */ 15,
62 /* .MinProgramTexelOffset = */ -8,
63 /* .MaxProgramTexelOffset = */ 7,
64 /* .MaxClipDistances = */ 8,
65 /* .MaxComputeWorkGroupCountX = */ 65535,
66 /* .MaxComputeWorkGroupCountY = */ 65535,
67 /* .MaxComputeWorkGroupCountZ = */ 65535,
68 /* .MaxComputeWorkGroupSizeX = */ 1024,
69 /* .MaxComputeWorkGroupSizeY = */ 1024,
70 /* .MaxComputeWorkGroupSizeZ = */ 64,
71 /* .MaxComputeUniformComponents = */ 1024,
72 /* .MaxComputeTextureImageUnits = */ 16,
73 /* .MaxComputeImageUniforms = */ 8,
74 /* .MaxComputeAtomicCounters = */ 8,
75 /* .MaxComputeAtomicCounterBuffers = */ 1,
76 /* .MaxVaryingComponents = */ 60,
77 /* .MaxVertexOutputComponents = */ 64,
78 /* .MaxGeometryInputComponents = */ 64,
79 /* .MaxGeometryOutputComponents = */ 128,
80 /* .MaxFragmentInputComponents = */ 128,
81 /* .MaxImageUnits = */ 8,
82 /* .MaxCombinedImageUnitsAndFragmentOutputs = */ 8,
83 /* .MaxCombinedShaderOutputResources = */ 8,
84 /* .MaxImageSamples = */ 0,
85 /* .MaxVertexImageUniforms = */ 0,
86 /* .MaxTessControlImageUniforms = */ 0,
87 /* .MaxTessEvaluationImageUniforms = */ 0,
88 /* .MaxGeometryImageUniforms = */ 0,
89 /* .MaxFragmentImageUniforms = */ 8,
90 /* .MaxCombinedImageUniforms = */ 8,
91 /* .MaxGeometryTextureImageUnits = */ 16,
92 /* .MaxGeometryOutputVertices = */ 256,
93 /* .MaxGeometryTotalOutputComponents = */ 1024,
94 /* .MaxGeometryUniformComponents = */ 1024,
95 /* .MaxGeometryVaryingComponents = */ 64,
96 /* .MaxTessControlInputComponents = */ 128,
97 /* .MaxTessControlOutputComponents = */ 128,
98 /* .MaxTessControlTextureImageUnits = */ 16,
99 /* .MaxTessControlUniformComponents = */ 1024,
100 /* .MaxTessControlTotalOutputComponents = */ 4096,
101 /* .MaxTessEvaluationInputComponents = */ 128,
102 /* .MaxTessEvaluationOutputComponents = */ 128,
103 /* .MaxTessEvaluationTextureImageUnits = */ 16,
104 /* .MaxTessEvaluationUniformComponents = */ 1024,
105 /* .MaxTessPatchComponents = */ 120,
106 /* .MaxPatchVertices = */ 32,
107 /* .MaxTessGenLevel = */ 64,
108 /* .MaxViewports = */ 16,
109 /* .MaxVertexAtomicCounters = */ 0,
110 /* .MaxTessControlAtomicCounters = */ 0,
111 /* .MaxTessEvaluationAtomicCounters = */ 0,
112 /* .MaxGeometryAtomicCounters = */ 0,
113 /* .MaxFragmentAtomicCounters = */ 8,
114 /* .MaxCombinedAtomicCounters = */ 8,
115 /* .MaxAtomicCounterBindings = */ 1,
116 /* .MaxVertexAtomicCounterBuffers = */ 0,
117 /* .MaxTessControlAtomicCounterBuffers = */ 0,
118 /* .MaxTessEvaluationAtomicCounterBuffers = */ 0,
119 /* .MaxGeometryAtomicCounterBuffers = */ 0,
120 /* .MaxFragmentAtomicCounterBuffers = */ 1,
121 /* .MaxCombinedAtomicCounterBuffers = */ 1,
122 /* .MaxAtomicCounterBufferSize = */ 16384,
123 /* .MaxTransformFeedbackBuffers = */ 4,
124 /* .MaxTransformFeedbackInterleavedComponents = */ 64,
125 /* .MaxCullDistances = */ 8,
126 /* .MaxCombinedClipAndCullDistances = */ 8,
127 /* .MaxSamples = */ 4,
Chao Chen3c366992018-09-19 11:41:59 -0700128 /* .maxMeshOutputVerticesNV = */ 256,
129 /* .maxMeshOutputPrimitivesNV = */ 512,
130 /* .maxMeshWorkGroupSizeX_NV = */ 32,
131 /* .maxMeshWorkGroupSizeY_NV = */ 1,
132 /* .maxMeshWorkGroupSizeZ_NV = */ 1,
133 /* .maxTaskWorkGroupSizeX_NV = */ 32,
134 /* .maxTaskWorkGroupSizeY_NV = */ 1,
135 /* .maxTaskWorkGroupSizeZ_NV = */ 1,
136 /* .maxMeshViewCountNV = */ 4,
Pankaj Mistrye05cc202020-04-21 11:33:57 -0700137 /* .maxDualSourceDrawBuffersEXT = */ 1,
Chao Chen3c366992018-09-19 11:41:59 -0700138
Lei Zhang414eb602016-03-04 16:22:34 -0500139 /* .limits = */ {
140 /* .nonInductiveForLoops = */ 1,
141 /* .whileLoops = */ 1,
142 /* .doWhileLoops = */ 1,
143 /* .generalUniformIndexing = */ 1,
144 /* .generalAttributeMatrixVectorIndexing = */ 1,
145 /* .generalVaryingIndexing = */ 1,
146 /* .generalSamplerIndexing = */ 1,
147 /* .generalVariableIndexing = */ 1,
148 /* .generalConstantMatrixVectorIndexing = */ 1,
149 }};
150
151std::string GetDefaultTBuiltInResourceString()
152{
153 std::ostringstream ostream;
154
155 ostream << "MaxLights " << DefaultTBuiltInResource.maxLights << "\n"
156 << "MaxClipPlanes " << DefaultTBuiltInResource.maxClipPlanes << "\n"
157 << "MaxTextureUnits " << DefaultTBuiltInResource.maxTextureUnits << "\n"
158 << "MaxTextureCoords " << DefaultTBuiltInResource.maxTextureCoords << "\n"
159 << "MaxVertexAttribs " << DefaultTBuiltInResource.maxVertexAttribs << "\n"
160 << "MaxVertexUniformComponents " << DefaultTBuiltInResource.maxVertexUniformComponents << "\n"
161 << "MaxVaryingFloats " << DefaultTBuiltInResource.maxVaryingFloats << "\n"
162 << "MaxVertexTextureImageUnits " << DefaultTBuiltInResource.maxVertexTextureImageUnits << "\n"
163 << "MaxCombinedTextureImageUnits " << DefaultTBuiltInResource.maxCombinedTextureImageUnits << "\n"
164 << "MaxTextureImageUnits " << DefaultTBuiltInResource.maxTextureImageUnits << "\n"
165 << "MaxFragmentUniformComponents " << DefaultTBuiltInResource.maxFragmentUniformComponents << "\n"
166 << "MaxDrawBuffers " << DefaultTBuiltInResource.maxDrawBuffers << "\n"
167 << "MaxVertexUniformVectors " << DefaultTBuiltInResource.maxVertexUniformVectors << "\n"
168 << "MaxVaryingVectors " << DefaultTBuiltInResource.maxVaryingVectors << "\n"
169 << "MaxFragmentUniformVectors " << DefaultTBuiltInResource.maxFragmentUniformVectors << "\n"
170 << "MaxVertexOutputVectors " << DefaultTBuiltInResource.maxVertexOutputVectors << "\n"
171 << "MaxFragmentInputVectors " << DefaultTBuiltInResource.maxFragmentInputVectors << "\n"
172 << "MinProgramTexelOffset " << DefaultTBuiltInResource.minProgramTexelOffset << "\n"
173 << "MaxProgramTexelOffset " << DefaultTBuiltInResource.maxProgramTexelOffset << "\n"
174 << "MaxClipDistances " << DefaultTBuiltInResource.maxClipDistances << "\n"
175 << "MaxComputeWorkGroupCountX " << DefaultTBuiltInResource.maxComputeWorkGroupCountX << "\n"
176 << "MaxComputeWorkGroupCountY " << DefaultTBuiltInResource.maxComputeWorkGroupCountY << "\n"
177 << "MaxComputeWorkGroupCountZ " << DefaultTBuiltInResource.maxComputeWorkGroupCountZ << "\n"
178 << "MaxComputeWorkGroupSizeX " << DefaultTBuiltInResource.maxComputeWorkGroupSizeX << "\n"
179 << "MaxComputeWorkGroupSizeY " << DefaultTBuiltInResource.maxComputeWorkGroupSizeY << "\n"
180 << "MaxComputeWorkGroupSizeZ " << DefaultTBuiltInResource.maxComputeWorkGroupSizeZ << "\n"
181 << "MaxComputeUniformComponents " << DefaultTBuiltInResource.maxComputeUniformComponents << "\n"
182 << "MaxComputeTextureImageUnits " << DefaultTBuiltInResource.maxComputeTextureImageUnits << "\n"
183 << "MaxComputeImageUniforms " << DefaultTBuiltInResource.maxComputeImageUniforms << "\n"
184 << "MaxComputeAtomicCounters " << DefaultTBuiltInResource.maxComputeAtomicCounters << "\n"
185 << "MaxComputeAtomicCounterBuffers " << DefaultTBuiltInResource.maxComputeAtomicCounterBuffers << "\n"
186 << "MaxVaryingComponents " << DefaultTBuiltInResource.maxVaryingComponents << "\n"
187 << "MaxVertexOutputComponents " << DefaultTBuiltInResource.maxVertexOutputComponents << "\n"
188 << "MaxGeometryInputComponents " << DefaultTBuiltInResource.maxGeometryInputComponents << "\n"
189 << "MaxGeometryOutputComponents " << DefaultTBuiltInResource.maxGeometryOutputComponents << "\n"
190 << "MaxFragmentInputComponents " << DefaultTBuiltInResource.maxFragmentInputComponents << "\n"
191 << "MaxImageUnits " << DefaultTBuiltInResource.maxImageUnits << "\n"
192 << "MaxCombinedImageUnitsAndFragmentOutputs " << DefaultTBuiltInResource.maxCombinedImageUnitsAndFragmentOutputs << "\n"
193 << "MaxCombinedShaderOutputResources " << DefaultTBuiltInResource.maxCombinedShaderOutputResources << "\n"
194 << "MaxImageSamples " << DefaultTBuiltInResource.maxImageSamples << "\n"
195 << "MaxVertexImageUniforms " << DefaultTBuiltInResource.maxVertexImageUniforms << "\n"
196 << "MaxTessControlImageUniforms " << DefaultTBuiltInResource.maxTessControlImageUniforms << "\n"
197 << "MaxTessEvaluationImageUniforms " << DefaultTBuiltInResource.maxTessEvaluationImageUniforms << "\n"
198 << "MaxGeometryImageUniforms " << DefaultTBuiltInResource.maxGeometryImageUniforms << "\n"
199 << "MaxFragmentImageUniforms " << DefaultTBuiltInResource.maxFragmentImageUniforms << "\n"
200 << "MaxCombinedImageUniforms " << DefaultTBuiltInResource.maxCombinedImageUniforms << "\n"
201 << "MaxGeometryTextureImageUnits " << DefaultTBuiltInResource.maxGeometryTextureImageUnits << "\n"
202 << "MaxGeometryOutputVertices " << DefaultTBuiltInResource.maxGeometryOutputVertices << "\n"
203 << "MaxGeometryTotalOutputComponents " << DefaultTBuiltInResource.maxGeometryTotalOutputComponents << "\n"
204 << "MaxGeometryUniformComponents " << DefaultTBuiltInResource.maxGeometryUniformComponents << "\n"
205 << "MaxGeometryVaryingComponents " << DefaultTBuiltInResource.maxGeometryVaryingComponents << "\n"
206 << "MaxTessControlInputComponents " << DefaultTBuiltInResource.maxTessControlInputComponents << "\n"
207 << "MaxTessControlOutputComponents " << DefaultTBuiltInResource.maxTessControlOutputComponents << "\n"
208 << "MaxTessControlTextureImageUnits " << DefaultTBuiltInResource.maxTessControlTextureImageUnits << "\n"
209 << "MaxTessControlUniformComponents " << DefaultTBuiltInResource.maxTessControlUniformComponents << "\n"
210 << "MaxTessControlTotalOutputComponents " << DefaultTBuiltInResource.maxTessControlTotalOutputComponents << "\n"
211 << "MaxTessEvaluationInputComponents " << DefaultTBuiltInResource.maxTessEvaluationInputComponents << "\n"
212 << "MaxTessEvaluationOutputComponents " << DefaultTBuiltInResource.maxTessEvaluationOutputComponents << "\n"
213 << "MaxTessEvaluationTextureImageUnits " << DefaultTBuiltInResource.maxTessEvaluationTextureImageUnits << "\n"
214 << "MaxTessEvaluationUniformComponents " << DefaultTBuiltInResource.maxTessEvaluationUniformComponents << "\n"
215 << "MaxTessPatchComponents " << DefaultTBuiltInResource.maxTessPatchComponents << "\n"
216 << "MaxPatchVertices " << DefaultTBuiltInResource.maxPatchVertices << "\n"
217 << "MaxTessGenLevel " << DefaultTBuiltInResource.maxTessGenLevel << "\n"
218 << "MaxViewports " << DefaultTBuiltInResource.maxViewports << "\n"
219 << "MaxVertexAtomicCounters " << DefaultTBuiltInResource.maxVertexAtomicCounters << "\n"
220 << "MaxTessControlAtomicCounters " << DefaultTBuiltInResource.maxTessControlAtomicCounters << "\n"
221 << "MaxTessEvaluationAtomicCounters " << DefaultTBuiltInResource.maxTessEvaluationAtomicCounters << "\n"
222 << "MaxGeometryAtomicCounters " << DefaultTBuiltInResource.maxGeometryAtomicCounters << "\n"
223 << "MaxFragmentAtomicCounters " << DefaultTBuiltInResource.maxFragmentAtomicCounters << "\n"
224 << "MaxCombinedAtomicCounters " << DefaultTBuiltInResource.maxCombinedAtomicCounters << "\n"
225 << "MaxAtomicCounterBindings " << DefaultTBuiltInResource.maxAtomicCounterBindings << "\n"
226 << "MaxVertexAtomicCounterBuffers " << DefaultTBuiltInResource.maxVertexAtomicCounterBuffers << "\n"
227 << "MaxTessControlAtomicCounterBuffers " << DefaultTBuiltInResource.maxTessControlAtomicCounterBuffers << "\n"
228 << "MaxTessEvaluationAtomicCounterBuffers " << DefaultTBuiltInResource.maxTessEvaluationAtomicCounterBuffers << "\n"
229 << "MaxGeometryAtomicCounterBuffers " << DefaultTBuiltInResource.maxGeometryAtomicCounterBuffers << "\n"
230 << "MaxFragmentAtomicCounterBuffers " << DefaultTBuiltInResource.maxFragmentAtomicCounterBuffers << "\n"
231 << "MaxCombinedAtomicCounterBuffers " << DefaultTBuiltInResource.maxCombinedAtomicCounterBuffers << "\n"
232 << "MaxAtomicCounterBufferSize " << DefaultTBuiltInResource.maxAtomicCounterBufferSize << "\n"
233 << "MaxTransformFeedbackBuffers " << DefaultTBuiltInResource.maxTransformFeedbackBuffers << "\n"
234 << "MaxTransformFeedbackInterleavedComponents " << DefaultTBuiltInResource.maxTransformFeedbackInterleavedComponents << "\n"
235 << "MaxCullDistances " << DefaultTBuiltInResource.maxCullDistances << "\n"
236 << "MaxCombinedClipAndCullDistances " << DefaultTBuiltInResource.maxCombinedClipAndCullDistances << "\n"
237 << "MaxSamples " << DefaultTBuiltInResource.maxSamples << "\n"
Chao Chen3c366992018-09-19 11:41:59 -0700238 << "MaxMeshOutputVerticesNV " << DefaultTBuiltInResource.maxMeshOutputVerticesNV << "\n"
239 << "MaxMeshOutputPrimitivesNV " << DefaultTBuiltInResource.maxMeshOutputPrimitivesNV << "\n"
240 << "MaxMeshWorkGroupSizeX_NV " << DefaultTBuiltInResource.maxMeshWorkGroupSizeX_NV << "\n"
241 << "MaxMeshWorkGroupSizeY_NV " << DefaultTBuiltInResource.maxMeshWorkGroupSizeY_NV << "\n"
242 << "MaxMeshWorkGroupSizeZ_NV " << DefaultTBuiltInResource.maxMeshWorkGroupSizeZ_NV << "\n"
243 << "MaxTaskWorkGroupSizeX_NV " << DefaultTBuiltInResource.maxTaskWorkGroupSizeX_NV << "\n"
244 << "MaxTaskWorkGroupSizeY_NV " << DefaultTBuiltInResource.maxTaskWorkGroupSizeY_NV << "\n"
245 << "MaxTaskWorkGroupSizeZ_NV " << DefaultTBuiltInResource.maxTaskWorkGroupSizeZ_NV << "\n"
246 << "MaxMeshViewCountNV " << DefaultTBuiltInResource.maxMeshViewCountNV << "\n"
Pankaj Mistrye05cc202020-04-21 11:33:57 -0700247 << "MaxDualSourceDrawBuffersEXT " << DefaultTBuiltInResource.maxDualSourceDrawBuffersEXT << "\n"
Lei Zhang414eb602016-03-04 16:22:34 -0500248 << "nonInductiveForLoops " << DefaultTBuiltInResource.limits.nonInductiveForLoops << "\n"
249 << "whileLoops " << DefaultTBuiltInResource.limits.whileLoops << "\n"
250 << "doWhileLoops " << DefaultTBuiltInResource.limits.doWhileLoops << "\n"
251 << "generalUniformIndexing " << DefaultTBuiltInResource.limits.generalUniformIndexing << "\n"
252 << "generalAttributeMatrixVectorIndexing " << DefaultTBuiltInResource.limits.generalAttributeMatrixVectorIndexing << "\n"
253 << "generalVaryingIndexing " << DefaultTBuiltInResource.limits.generalVaryingIndexing << "\n"
254 << "generalSamplerIndexing " << DefaultTBuiltInResource.limits.generalSamplerIndexing << "\n"
255 << "generalVariableIndexing " << DefaultTBuiltInResource.limits.generalVariableIndexing << "\n"
256 << "generalConstantMatrixVectorIndexing " << DefaultTBuiltInResource.limits.generalConstantMatrixVectorIndexing << "\n"
257 ;
258
259 return ostream.str();
260}
261
John Kessenich7f349c72016-07-08 22:09:10 -0600262void DecodeResourceLimits(TBuiltInResource* resources, char* config)
263{
steve-lunarg4e3dd202016-10-20 23:56:45 -0600264 static const char* delims = " \t\n\r";
265
266 size_t pos = 0;
267 std::string configStr(config);
268
269 while ((pos = configStr.find_first_not_of(delims, pos)) != std::string::npos) {
270 const size_t token_s = pos;
271 const size_t token_e = configStr.find_first_of(delims, token_s);
272 const size_t value_s = configStr.find_first_not_of(delims, token_e);
273 const size_t value_e = configStr.find_first_of(delims, value_s);
274 pos = value_e;
275
276 // Faster to use compare(), but prefering readability.
277 const std::string tokenStr = configStr.substr(token_s, token_e-token_s);
278 const std::string valueStr = configStr.substr(value_s, value_e-value_s);
279
280 if (value_s == std::string::npos || ! (valueStr[0] == '-' || isdigit(valueStr[0]))) {
281 printf("Error: '%s' bad .conf file. Each name must be followed by one number.\n",
282 valueStr.c_str());
Lei Zhang1b141722016-05-19 13:50:49 -0400283 return;
284 }
Lei Zhang1b141722016-05-19 13:50:49 -0400285
David Netoe301f672016-10-31 17:02:45 -0400286 const int value = std::atoi(valueStr.c_str());
steve-lunarg4e3dd202016-10-20 23:56:45 -0600287
288 if (tokenStr == "MaxLights")
Lei Zhang1b141722016-05-19 13:50:49 -0400289 resources->maxLights = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600290 else if (tokenStr == "MaxClipPlanes")
Lei Zhang1b141722016-05-19 13:50:49 -0400291 resources->maxClipPlanes = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600292 else if (tokenStr == "MaxTextureUnits")
Lei Zhang1b141722016-05-19 13:50:49 -0400293 resources->maxTextureUnits = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600294 else if (tokenStr == "MaxTextureCoords")
Lei Zhang1b141722016-05-19 13:50:49 -0400295 resources->maxTextureCoords = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600296 else if (tokenStr == "MaxVertexAttribs")
Lei Zhang1b141722016-05-19 13:50:49 -0400297 resources->maxVertexAttribs = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600298 else if (tokenStr == "MaxVertexUniformComponents")
Lei Zhang1b141722016-05-19 13:50:49 -0400299 resources->maxVertexUniformComponents = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600300 else if (tokenStr == "MaxVaryingFloats")
Lei Zhang1b141722016-05-19 13:50:49 -0400301 resources->maxVaryingFloats = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600302 else if (tokenStr == "MaxVertexTextureImageUnits")
Lei Zhang1b141722016-05-19 13:50:49 -0400303 resources->maxVertexTextureImageUnits = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600304 else if (tokenStr == "MaxCombinedTextureImageUnits")
Lei Zhang1b141722016-05-19 13:50:49 -0400305 resources->maxCombinedTextureImageUnits = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600306 else if (tokenStr == "MaxTextureImageUnits")
Lei Zhang1b141722016-05-19 13:50:49 -0400307 resources->maxTextureImageUnits = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600308 else if (tokenStr == "MaxFragmentUniformComponents")
Lei Zhang1b141722016-05-19 13:50:49 -0400309 resources->maxFragmentUniformComponents = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600310 else if (tokenStr == "MaxDrawBuffers")
Lei Zhang1b141722016-05-19 13:50:49 -0400311 resources->maxDrawBuffers = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600312 else if (tokenStr == "MaxVertexUniformVectors")
Lei Zhang1b141722016-05-19 13:50:49 -0400313 resources->maxVertexUniformVectors = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600314 else if (tokenStr == "MaxVaryingVectors")
Lei Zhang1b141722016-05-19 13:50:49 -0400315 resources->maxVaryingVectors = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600316 else if (tokenStr == "MaxFragmentUniformVectors")
Lei Zhang1b141722016-05-19 13:50:49 -0400317 resources->maxFragmentUniformVectors = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600318 else if (tokenStr == "MaxVertexOutputVectors")
Lei Zhang1b141722016-05-19 13:50:49 -0400319 resources->maxVertexOutputVectors = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600320 else if (tokenStr == "MaxFragmentInputVectors")
Lei Zhang1b141722016-05-19 13:50:49 -0400321 resources->maxFragmentInputVectors = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600322 else if (tokenStr == "MinProgramTexelOffset")
Lei Zhang1b141722016-05-19 13:50:49 -0400323 resources->minProgramTexelOffset = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600324 else if (tokenStr == "MaxProgramTexelOffset")
Lei Zhang1b141722016-05-19 13:50:49 -0400325 resources->maxProgramTexelOffset = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600326 else if (tokenStr == "MaxClipDistances")
Lei Zhang1b141722016-05-19 13:50:49 -0400327 resources->maxClipDistances = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600328 else if (tokenStr == "MaxComputeWorkGroupCountX")
Lei Zhang1b141722016-05-19 13:50:49 -0400329 resources->maxComputeWorkGroupCountX = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600330 else if (tokenStr == "MaxComputeWorkGroupCountY")
Lei Zhang1b141722016-05-19 13:50:49 -0400331 resources->maxComputeWorkGroupCountY = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600332 else if (tokenStr == "MaxComputeWorkGroupCountZ")
Lei Zhang1b141722016-05-19 13:50:49 -0400333 resources->maxComputeWorkGroupCountZ = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600334 else if (tokenStr == "MaxComputeWorkGroupSizeX")
Lei Zhang1b141722016-05-19 13:50:49 -0400335 resources->maxComputeWorkGroupSizeX = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600336 else if (tokenStr == "MaxComputeWorkGroupSizeY")
Lei Zhang1b141722016-05-19 13:50:49 -0400337 resources->maxComputeWorkGroupSizeY = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600338 else if (tokenStr == "MaxComputeWorkGroupSizeZ")
Lei Zhang1b141722016-05-19 13:50:49 -0400339 resources->maxComputeWorkGroupSizeZ = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600340 else if (tokenStr == "MaxComputeUniformComponents")
Lei Zhang1b141722016-05-19 13:50:49 -0400341 resources->maxComputeUniformComponents = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600342 else if (tokenStr == "MaxComputeTextureImageUnits")
Lei Zhang1b141722016-05-19 13:50:49 -0400343 resources->maxComputeTextureImageUnits = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600344 else if (tokenStr == "MaxComputeImageUniforms")
Lei Zhang1b141722016-05-19 13:50:49 -0400345 resources->maxComputeImageUniforms = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600346 else if (tokenStr == "MaxComputeAtomicCounters")
Lei Zhang1b141722016-05-19 13:50:49 -0400347 resources->maxComputeAtomicCounters = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600348 else if (tokenStr == "MaxComputeAtomicCounterBuffers")
Lei Zhang1b141722016-05-19 13:50:49 -0400349 resources->maxComputeAtomicCounterBuffers = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600350 else if (tokenStr == "MaxVaryingComponents")
Lei Zhang1b141722016-05-19 13:50:49 -0400351 resources->maxVaryingComponents = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600352 else if (tokenStr == "MaxVertexOutputComponents")
Lei Zhang1b141722016-05-19 13:50:49 -0400353 resources->maxVertexOutputComponents = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600354 else if (tokenStr == "MaxGeometryInputComponents")
Lei Zhang1b141722016-05-19 13:50:49 -0400355 resources->maxGeometryInputComponents = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600356 else if (tokenStr == "MaxGeometryOutputComponents")
Lei Zhang1b141722016-05-19 13:50:49 -0400357 resources->maxGeometryOutputComponents = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600358 else if (tokenStr == "MaxFragmentInputComponents")
Lei Zhang1b141722016-05-19 13:50:49 -0400359 resources->maxFragmentInputComponents = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600360 else if (tokenStr == "MaxImageUnits")
Lei Zhang1b141722016-05-19 13:50:49 -0400361 resources->maxImageUnits = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600362 else if (tokenStr == "MaxCombinedImageUnitsAndFragmentOutputs")
Lei Zhang1b141722016-05-19 13:50:49 -0400363 resources->maxCombinedImageUnitsAndFragmentOutputs = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600364 else if (tokenStr == "MaxCombinedShaderOutputResources")
Lei Zhang1b141722016-05-19 13:50:49 -0400365 resources->maxCombinedShaderOutputResources = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600366 else if (tokenStr == "MaxImageSamples")
Lei Zhang1b141722016-05-19 13:50:49 -0400367 resources->maxImageSamples = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600368 else if (tokenStr == "MaxVertexImageUniforms")
Lei Zhang1b141722016-05-19 13:50:49 -0400369 resources->maxVertexImageUniforms = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600370 else if (tokenStr == "MaxTessControlImageUniforms")
Lei Zhang1b141722016-05-19 13:50:49 -0400371 resources->maxTessControlImageUniforms = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600372 else if (tokenStr == "MaxTessEvaluationImageUniforms")
Lei Zhang1b141722016-05-19 13:50:49 -0400373 resources->maxTessEvaluationImageUniforms = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600374 else if (tokenStr == "MaxGeometryImageUniforms")
Lei Zhang1b141722016-05-19 13:50:49 -0400375 resources->maxGeometryImageUniforms = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600376 else if (tokenStr == "MaxFragmentImageUniforms")
Lei Zhang1b141722016-05-19 13:50:49 -0400377 resources->maxFragmentImageUniforms = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600378 else if (tokenStr == "MaxCombinedImageUniforms")
Lei Zhang1b141722016-05-19 13:50:49 -0400379 resources->maxCombinedImageUniforms = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600380 else if (tokenStr == "MaxGeometryTextureImageUnits")
Lei Zhang1b141722016-05-19 13:50:49 -0400381 resources->maxGeometryTextureImageUnits = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600382 else if (tokenStr == "MaxGeometryOutputVertices")
Lei Zhang1b141722016-05-19 13:50:49 -0400383 resources->maxGeometryOutputVertices = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600384 else if (tokenStr == "MaxGeometryTotalOutputComponents")
Lei Zhang1b141722016-05-19 13:50:49 -0400385 resources->maxGeometryTotalOutputComponents = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600386 else if (tokenStr == "MaxGeometryUniformComponents")
Lei Zhang1b141722016-05-19 13:50:49 -0400387 resources->maxGeometryUniformComponents = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600388 else if (tokenStr == "MaxGeometryVaryingComponents")
Lei Zhang1b141722016-05-19 13:50:49 -0400389 resources->maxGeometryVaryingComponents = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600390 else if (tokenStr == "MaxTessControlInputComponents")
Lei Zhang1b141722016-05-19 13:50:49 -0400391 resources->maxTessControlInputComponents = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600392 else if (tokenStr == "MaxTessControlOutputComponents")
Lei Zhang1b141722016-05-19 13:50:49 -0400393 resources->maxTessControlOutputComponents = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600394 else if (tokenStr == "MaxTessControlTextureImageUnits")
Lei Zhang1b141722016-05-19 13:50:49 -0400395 resources->maxTessControlTextureImageUnits = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600396 else if (tokenStr == "MaxTessControlUniformComponents")
Lei Zhang1b141722016-05-19 13:50:49 -0400397 resources->maxTessControlUniformComponents = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600398 else if (tokenStr == "MaxTessControlTotalOutputComponents")
Lei Zhang1b141722016-05-19 13:50:49 -0400399 resources->maxTessControlTotalOutputComponents = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600400 else if (tokenStr == "MaxTessEvaluationInputComponents")
Lei Zhang1b141722016-05-19 13:50:49 -0400401 resources->maxTessEvaluationInputComponents = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600402 else if (tokenStr == "MaxTessEvaluationOutputComponents")
Lei Zhang1b141722016-05-19 13:50:49 -0400403 resources->maxTessEvaluationOutputComponents = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600404 else if (tokenStr == "MaxTessEvaluationTextureImageUnits")
Lei Zhang1b141722016-05-19 13:50:49 -0400405 resources->maxTessEvaluationTextureImageUnits = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600406 else if (tokenStr == "MaxTessEvaluationUniformComponents")
Lei Zhang1b141722016-05-19 13:50:49 -0400407 resources->maxTessEvaluationUniformComponents = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600408 else if (tokenStr == "MaxTessPatchComponents")
Lei Zhang1b141722016-05-19 13:50:49 -0400409 resources->maxTessPatchComponents = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600410 else if (tokenStr == "MaxPatchVertices")
Lei Zhang1b141722016-05-19 13:50:49 -0400411 resources->maxPatchVertices = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600412 else if (tokenStr == "MaxTessGenLevel")
Lei Zhang1b141722016-05-19 13:50:49 -0400413 resources->maxTessGenLevel = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600414 else if (tokenStr == "MaxViewports")
Lei Zhang1b141722016-05-19 13:50:49 -0400415 resources->maxViewports = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600416 else if (tokenStr == "MaxVertexAtomicCounters")
Lei Zhang1b141722016-05-19 13:50:49 -0400417 resources->maxVertexAtomicCounters = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600418 else if (tokenStr == "MaxTessControlAtomicCounters")
Lei Zhang1b141722016-05-19 13:50:49 -0400419 resources->maxTessControlAtomicCounters = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600420 else if (tokenStr == "MaxTessEvaluationAtomicCounters")
Lei Zhang1b141722016-05-19 13:50:49 -0400421 resources->maxTessEvaluationAtomicCounters = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600422 else if (tokenStr == "MaxGeometryAtomicCounters")
Lei Zhang1b141722016-05-19 13:50:49 -0400423 resources->maxGeometryAtomicCounters = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600424 else if (tokenStr == "MaxFragmentAtomicCounters")
Lei Zhang1b141722016-05-19 13:50:49 -0400425 resources->maxFragmentAtomicCounters = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600426 else if (tokenStr == "MaxCombinedAtomicCounters")
Lei Zhang1b141722016-05-19 13:50:49 -0400427 resources->maxCombinedAtomicCounters = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600428 else if (tokenStr == "MaxAtomicCounterBindings")
Lei Zhang1b141722016-05-19 13:50:49 -0400429 resources->maxAtomicCounterBindings = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600430 else if (tokenStr == "MaxVertexAtomicCounterBuffers")
Lei Zhang1b141722016-05-19 13:50:49 -0400431 resources->maxVertexAtomicCounterBuffers = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600432 else if (tokenStr == "MaxTessControlAtomicCounterBuffers")
Lei Zhang1b141722016-05-19 13:50:49 -0400433 resources->maxTessControlAtomicCounterBuffers = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600434 else if (tokenStr == "MaxTessEvaluationAtomicCounterBuffers")
Lei Zhang1b141722016-05-19 13:50:49 -0400435 resources->maxTessEvaluationAtomicCounterBuffers = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600436 else if (tokenStr == "MaxGeometryAtomicCounterBuffers")
Lei Zhang1b141722016-05-19 13:50:49 -0400437 resources->maxGeometryAtomicCounterBuffers = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600438 else if (tokenStr == "MaxFragmentAtomicCounterBuffers")
Lei Zhang1b141722016-05-19 13:50:49 -0400439 resources->maxFragmentAtomicCounterBuffers = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600440 else if (tokenStr == "MaxCombinedAtomicCounterBuffers")
Lei Zhang1b141722016-05-19 13:50:49 -0400441 resources->maxCombinedAtomicCounterBuffers = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600442 else if (tokenStr == "MaxAtomicCounterBufferSize")
Lei Zhang1b141722016-05-19 13:50:49 -0400443 resources->maxAtomicCounterBufferSize = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600444 else if (tokenStr == "MaxTransformFeedbackBuffers")
Lei Zhang1b141722016-05-19 13:50:49 -0400445 resources->maxTransformFeedbackBuffers = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600446 else if (tokenStr == "MaxTransformFeedbackInterleavedComponents")
Lei Zhang1b141722016-05-19 13:50:49 -0400447 resources->maxTransformFeedbackInterleavedComponents = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600448 else if (tokenStr == "MaxCullDistances")
Lei Zhang1b141722016-05-19 13:50:49 -0400449 resources->maxCullDistances = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600450 else if (tokenStr == "MaxCombinedClipAndCullDistances")
Lei Zhang1b141722016-05-19 13:50:49 -0400451 resources->maxCombinedClipAndCullDistances = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600452 else if (tokenStr == "MaxSamples")
Lei Zhang1b141722016-05-19 13:50:49 -0400453 resources->maxSamples = value;
Chao Chen3c366992018-09-19 11:41:59 -0700454 else if (tokenStr == "MaxMeshOutputVerticesNV")
455 resources->maxMeshOutputVerticesNV = value;
456 else if (tokenStr == "MaxMeshOutputPrimitivesNV")
457 resources->maxMeshOutputPrimitivesNV = value;
458 else if (tokenStr == "MaxMeshWorkGroupSizeX_NV")
459 resources->maxMeshWorkGroupSizeX_NV = value;
460 else if (tokenStr == "MaxMeshWorkGroupSizeY_NV")
461 resources->maxMeshWorkGroupSizeY_NV = value;
462 else if (tokenStr == "MaxMeshWorkGroupSizeZ_NV")
463 resources->maxMeshWorkGroupSizeZ_NV = value;
464 else if (tokenStr == "MaxTaskWorkGroupSizeX_NV")
465 resources->maxTaskWorkGroupSizeX_NV = value;
466 else if (tokenStr == "MaxTaskWorkGroupSizeY_NV")
467 resources->maxTaskWorkGroupSizeY_NV = value;
468 else if (tokenStr == "MaxTaskWorkGroupSizeZ_NV")
469 resources->maxTaskWorkGroupSizeZ_NV = value;
470 else if (tokenStr == "MaxMeshViewCountNV")
471 resources->maxMeshViewCountNV = value;
steve-lunarg4e3dd202016-10-20 23:56:45 -0600472 else if (tokenStr == "nonInductiveForLoops")
Lei Zhang1b141722016-05-19 13:50:49 -0400473 resources->limits.nonInductiveForLoops = (value != 0);
steve-lunarg4e3dd202016-10-20 23:56:45 -0600474 else if (tokenStr == "whileLoops")
Lei Zhang1b141722016-05-19 13:50:49 -0400475 resources->limits.whileLoops = (value != 0);
steve-lunarg4e3dd202016-10-20 23:56:45 -0600476 else if (tokenStr == "doWhileLoops")
Lei Zhang1b141722016-05-19 13:50:49 -0400477 resources->limits.doWhileLoops = (value != 0);
steve-lunarg4e3dd202016-10-20 23:56:45 -0600478 else if (tokenStr == "generalUniformIndexing")
Lei Zhang1b141722016-05-19 13:50:49 -0400479 resources->limits.generalUniformIndexing = (value != 0);
steve-lunarg4e3dd202016-10-20 23:56:45 -0600480 else if (tokenStr == "generalAttributeMatrixVectorIndexing")
Lei Zhang1b141722016-05-19 13:50:49 -0400481 resources->limits.generalAttributeMatrixVectorIndexing = (value != 0);
steve-lunarg4e3dd202016-10-20 23:56:45 -0600482 else if (tokenStr == "generalVaryingIndexing")
Lei Zhang1b141722016-05-19 13:50:49 -0400483 resources->limits.generalVaryingIndexing = (value != 0);
steve-lunarg4e3dd202016-10-20 23:56:45 -0600484 else if (tokenStr == "generalSamplerIndexing")
Lei Zhang1b141722016-05-19 13:50:49 -0400485 resources->limits.generalSamplerIndexing = (value != 0);
steve-lunarg4e3dd202016-10-20 23:56:45 -0600486 else if (tokenStr == "generalVariableIndexing")
Lei Zhang1b141722016-05-19 13:50:49 -0400487 resources->limits.generalVariableIndexing = (value != 0);
steve-lunarg4e3dd202016-10-20 23:56:45 -0600488 else if (tokenStr == "generalConstantMatrixVectorIndexing")
Lei Zhang1b141722016-05-19 13:50:49 -0400489 resources->limits.generalConstantMatrixVectorIndexing = (value != 0);
490 else
steve-lunarg4e3dd202016-10-20 23:56:45 -0600491 printf("Warning: unrecognized limit (%s) in configuration file.\n", tokenStr.c_str());
Lei Zhang1b141722016-05-19 13:50:49 -0400492
Lei Zhang1b141722016-05-19 13:50:49 -0400493 }
494}
495
Lei Zhang414eb602016-03-04 16:22:34 -0500496} // end namespace glslang