• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
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 
35 #include <cstdlib>
36 #include <cstring>
37 #include <sstream>
38 #include <cctype>
39 
40 #include "ResourceLimits.h"
41 
42 namespace glslang {
43 
44 const 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,
128     /* .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,
137 
138     /* .limits = */ {
139         /* .nonInductiveForLoops = */ 1,
140         /* .whileLoops = */ 1,
141         /* .doWhileLoops = */ 1,
142         /* .generalUniformIndexing = */ 1,
143         /* .generalAttributeMatrixVectorIndexing = */ 1,
144         /* .generalVaryingIndexing = */ 1,
145         /* .generalSamplerIndexing = */ 1,
146         /* .generalVariableIndexing = */ 1,
147         /* .generalConstantMatrixVectorIndexing = */ 1,
148     }};
149 
GetDefaultTBuiltInResourceString()150 std::string GetDefaultTBuiltInResourceString()
151 {
152     std::ostringstream ostream;
153 
154     ostream << "MaxLights "                                 << DefaultTBuiltInResource.maxLights << "\n"
155             << "MaxClipPlanes "                             << DefaultTBuiltInResource.maxClipPlanes << "\n"
156             << "MaxTextureUnits "                           << DefaultTBuiltInResource.maxTextureUnits << "\n"
157             << "MaxTextureCoords "                          << DefaultTBuiltInResource.maxTextureCoords << "\n"
158             << "MaxVertexAttribs "                          << DefaultTBuiltInResource.maxVertexAttribs << "\n"
159             << "MaxVertexUniformComponents "                << DefaultTBuiltInResource.maxVertexUniformComponents << "\n"
160             << "MaxVaryingFloats "                          << DefaultTBuiltInResource.maxVaryingFloats << "\n"
161             << "MaxVertexTextureImageUnits "                << DefaultTBuiltInResource.maxVertexTextureImageUnits << "\n"
162             << "MaxCombinedTextureImageUnits "              << DefaultTBuiltInResource.maxCombinedTextureImageUnits << "\n"
163             << "MaxTextureImageUnits "                      << DefaultTBuiltInResource.maxTextureImageUnits << "\n"
164             << "MaxFragmentUniformComponents "              << DefaultTBuiltInResource.maxFragmentUniformComponents << "\n"
165             << "MaxDrawBuffers "                            << DefaultTBuiltInResource.maxDrawBuffers << "\n"
166             << "MaxVertexUniformVectors "                   << DefaultTBuiltInResource.maxVertexUniformVectors << "\n"
167             << "MaxVaryingVectors "                         << DefaultTBuiltInResource.maxVaryingVectors << "\n"
168             << "MaxFragmentUniformVectors "                 << DefaultTBuiltInResource.maxFragmentUniformVectors << "\n"
169             << "MaxVertexOutputVectors "                    << DefaultTBuiltInResource.maxVertexOutputVectors << "\n"
170             << "MaxFragmentInputVectors "                   << DefaultTBuiltInResource.maxFragmentInputVectors << "\n"
171             << "MinProgramTexelOffset "                     << DefaultTBuiltInResource.minProgramTexelOffset << "\n"
172             << "MaxProgramTexelOffset "                     << DefaultTBuiltInResource.maxProgramTexelOffset << "\n"
173             << "MaxClipDistances "                          << DefaultTBuiltInResource.maxClipDistances << "\n"
174             << "MaxComputeWorkGroupCountX "                 << DefaultTBuiltInResource.maxComputeWorkGroupCountX << "\n"
175             << "MaxComputeWorkGroupCountY "                 << DefaultTBuiltInResource.maxComputeWorkGroupCountY << "\n"
176             << "MaxComputeWorkGroupCountZ "                 << DefaultTBuiltInResource.maxComputeWorkGroupCountZ << "\n"
177             << "MaxComputeWorkGroupSizeX "                  << DefaultTBuiltInResource.maxComputeWorkGroupSizeX << "\n"
178             << "MaxComputeWorkGroupSizeY "                  << DefaultTBuiltInResource.maxComputeWorkGroupSizeY << "\n"
179             << "MaxComputeWorkGroupSizeZ "                  << DefaultTBuiltInResource.maxComputeWorkGroupSizeZ << "\n"
180             << "MaxComputeUniformComponents "               << DefaultTBuiltInResource.maxComputeUniformComponents << "\n"
181             << "MaxComputeTextureImageUnits "               << DefaultTBuiltInResource.maxComputeTextureImageUnits << "\n"
182             << "MaxComputeImageUniforms "                   << DefaultTBuiltInResource.maxComputeImageUniforms << "\n"
183             << "MaxComputeAtomicCounters "                  << DefaultTBuiltInResource.maxComputeAtomicCounters << "\n"
184             << "MaxComputeAtomicCounterBuffers "            << DefaultTBuiltInResource.maxComputeAtomicCounterBuffers << "\n"
185             << "MaxVaryingComponents "                      << DefaultTBuiltInResource.maxVaryingComponents << "\n"
186             << "MaxVertexOutputComponents "                 << DefaultTBuiltInResource.maxVertexOutputComponents << "\n"
187             << "MaxGeometryInputComponents "                << DefaultTBuiltInResource.maxGeometryInputComponents << "\n"
188             << "MaxGeometryOutputComponents "               << DefaultTBuiltInResource.maxGeometryOutputComponents << "\n"
189             << "MaxFragmentInputComponents "                << DefaultTBuiltInResource.maxFragmentInputComponents << "\n"
190             << "MaxImageUnits "                             << DefaultTBuiltInResource.maxImageUnits << "\n"
191             << "MaxCombinedImageUnitsAndFragmentOutputs "   << DefaultTBuiltInResource.maxCombinedImageUnitsAndFragmentOutputs << "\n"
192             << "MaxCombinedShaderOutputResources "          << DefaultTBuiltInResource.maxCombinedShaderOutputResources << "\n"
193             << "MaxImageSamples "                           << DefaultTBuiltInResource.maxImageSamples << "\n"
194             << "MaxVertexImageUniforms "                    << DefaultTBuiltInResource.maxVertexImageUniforms << "\n"
195             << "MaxTessControlImageUniforms "               << DefaultTBuiltInResource.maxTessControlImageUniforms << "\n"
196             << "MaxTessEvaluationImageUniforms "            << DefaultTBuiltInResource.maxTessEvaluationImageUniforms << "\n"
197             << "MaxGeometryImageUniforms "                  << DefaultTBuiltInResource.maxGeometryImageUniforms << "\n"
198             << "MaxFragmentImageUniforms "                  << DefaultTBuiltInResource.maxFragmentImageUniforms << "\n"
199             << "MaxCombinedImageUniforms "                  << DefaultTBuiltInResource.maxCombinedImageUniforms << "\n"
200             << "MaxGeometryTextureImageUnits "              << DefaultTBuiltInResource.maxGeometryTextureImageUnits << "\n"
201             << "MaxGeometryOutputVertices "                 << DefaultTBuiltInResource.maxGeometryOutputVertices << "\n"
202             << "MaxGeometryTotalOutputComponents "          << DefaultTBuiltInResource.maxGeometryTotalOutputComponents << "\n"
203             << "MaxGeometryUniformComponents "              << DefaultTBuiltInResource.maxGeometryUniformComponents << "\n"
204             << "MaxGeometryVaryingComponents "              << DefaultTBuiltInResource.maxGeometryVaryingComponents << "\n"
205             << "MaxTessControlInputComponents "             << DefaultTBuiltInResource.maxTessControlInputComponents << "\n"
206             << "MaxTessControlOutputComponents "            << DefaultTBuiltInResource.maxTessControlOutputComponents << "\n"
207             << "MaxTessControlTextureImageUnits "           << DefaultTBuiltInResource.maxTessControlTextureImageUnits << "\n"
208             << "MaxTessControlUniformComponents "           << DefaultTBuiltInResource.maxTessControlUniformComponents << "\n"
209             << "MaxTessControlTotalOutputComponents "       << DefaultTBuiltInResource.maxTessControlTotalOutputComponents << "\n"
210             << "MaxTessEvaluationInputComponents "          << DefaultTBuiltInResource.maxTessEvaluationInputComponents << "\n"
211             << "MaxTessEvaluationOutputComponents "         << DefaultTBuiltInResource.maxTessEvaluationOutputComponents << "\n"
212             << "MaxTessEvaluationTextureImageUnits "        << DefaultTBuiltInResource.maxTessEvaluationTextureImageUnits << "\n"
213             << "MaxTessEvaluationUniformComponents "        << DefaultTBuiltInResource.maxTessEvaluationUniformComponents << "\n"
214             << "MaxTessPatchComponents "                    << DefaultTBuiltInResource.maxTessPatchComponents << "\n"
215             << "MaxPatchVertices "                          << DefaultTBuiltInResource.maxPatchVertices << "\n"
216             << "MaxTessGenLevel "                           << DefaultTBuiltInResource.maxTessGenLevel << "\n"
217             << "MaxViewports "                              << DefaultTBuiltInResource.maxViewports << "\n"
218             << "MaxVertexAtomicCounters "                   << DefaultTBuiltInResource.maxVertexAtomicCounters << "\n"
219             << "MaxTessControlAtomicCounters "              << DefaultTBuiltInResource.maxTessControlAtomicCounters << "\n"
220             << "MaxTessEvaluationAtomicCounters "           << DefaultTBuiltInResource.maxTessEvaluationAtomicCounters << "\n"
221             << "MaxGeometryAtomicCounters "                 << DefaultTBuiltInResource.maxGeometryAtomicCounters << "\n"
222             << "MaxFragmentAtomicCounters "                 << DefaultTBuiltInResource.maxFragmentAtomicCounters << "\n"
223             << "MaxCombinedAtomicCounters "                 << DefaultTBuiltInResource.maxCombinedAtomicCounters << "\n"
224             << "MaxAtomicCounterBindings "                  << DefaultTBuiltInResource.maxAtomicCounterBindings << "\n"
225             << "MaxVertexAtomicCounterBuffers "             << DefaultTBuiltInResource.maxVertexAtomicCounterBuffers << "\n"
226             << "MaxTessControlAtomicCounterBuffers "        << DefaultTBuiltInResource.maxTessControlAtomicCounterBuffers << "\n"
227             << "MaxTessEvaluationAtomicCounterBuffers "     << DefaultTBuiltInResource.maxTessEvaluationAtomicCounterBuffers << "\n"
228             << "MaxGeometryAtomicCounterBuffers "           << DefaultTBuiltInResource.maxGeometryAtomicCounterBuffers << "\n"
229             << "MaxFragmentAtomicCounterBuffers "           << DefaultTBuiltInResource.maxFragmentAtomicCounterBuffers << "\n"
230             << "MaxCombinedAtomicCounterBuffers "           << DefaultTBuiltInResource.maxCombinedAtomicCounterBuffers << "\n"
231             << "MaxAtomicCounterBufferSize "                << DefaultTBuiltInResource.maxAtomicCounterBufferSize << "\n"
232             << "MaxTransformFeedbackBuffers "               << DefaultTBuiltInResource.maxTransformFeedbackBuffers << "\n"
233             << "MaxTransformFeedbackInterleavedComponents " << DefaultTBuiltInResource.maxTransformFeedbackInterleavedComponents << "\n"
234             << "MaxCullDistances "                          << DefaultTBuiltInResource.maxCullDistances << "\n"
235             << "MaxCombinedClipAndCullDistances "           << DefaultTBuiltInResource.maxCombinedClipAndCullDistances << "\n"
236             << "MaxSamples "                                << DefaultTBuiltInResource.maxSamples << "\n"
237 #ifdef NV_EXTENSIONS
238             << "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"
247 #endif
248             << "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 
DecodeResourceLimits(TBuiltInResource * resources,char * config)262 void DecodeResourceLimits(TBuiltInResource* resources, char* config)
263 {
264     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());
283             return;
284         }
285 
286         const int value = std::atoi(valueStr.c_str());
287 
288         if (tokenStr == "MaxLights")
289             resources->maxLights = value;
290         else if (tokenStr == "MaxClipPlanes")
291             resources->maxClipPlanes = value;
292         else if (tokenStr == "MaxTextureUnits")
293             resources->maxTextureUnits = value;
294         else if (tokenStr == "MaxTextureCoords")
295             resources->maxTextureCoords = value;
296         else if (tokenStr == "MaxVertexAttribs")
297             resources->maxVertexAttribs = value;
298         else if (tokenStr == "MaxVertexUniformComponents")
299             resources->maxVertexUniformComponents = value;
300         else if (tokenStr == "MaxVaryingFloats")
301             resources->maxVaryingFloats = value;
302         else if (tokenStr == "MaxVertexTextureImageUnits")
303             resources->maxVertexTextureImageUnits = value;
304         else if (tokenStr == "MaxCombinedTextureImageUnits")
305             resources->maxCombinedTextureImageUnits = value;
306         else if (tokenStr == "MaxTextureImageUnits")
307             resources->maxTextureImageUnits = value;
308         else if (tokenStr == "MaxFragmentUniformComponents")
309             resources->maxFragmentUniformComponents = value;
310         else if (tokenStr == "MaxDrawBuffers")
311             resources->maxDrawBuffers = value;
312         else if (tokenStr == "MaxVertexUniformVectors")
313             resources->maxVertexUniformVectors = value;
314         else if (tokenStr == "MaxVaryingVectors")
315             resources->maxVaryingVectors = value;
316         else if (tokenStr == "MaxFragmentUniformVectors")
317             resources->maxFragmentUniformVectors = value;
318         else if (tokenStr == "MaxVertexOutputVectors")
319             resources->maxVertexOutputVectors = value;
320         else if (tokenStr == "MaxFragmentInputVectors")
321             resources->maxFragmentInputVectors = value;
322         else if (tokenStr == "MinProgramTexelOffset")
323             resources->minProgramTexelOffset = value;
324         else if (tokenStr == "MaxProgramTexelOffset")
325             resources->maxProgramTexelOffset = value;
326         else if (tokenStr == "MaxClipDistances")
327             resources->maxClipDistances = value;
328         else if (tokenStr == "MaxComputeWorkGroupCountX")
329             resources->maxComputeWorkGroupCountX = value;
330         else if (tokenStr == "MaxComputeWorkGroupCountY")
331             resources->maxComputeWorkGroupCountY = value;
332         else if (tokenStr == "MaxComputeWorkGroupCountZ")
333             resources->maxComputeWorkGroupCountZ = value;
334         else if (tokenStr == "MaxComputeWorkGroupSizeX")
335             resources->maxComputeWorkGroupSizeX = value;
336         else if (tokenStr == "MaxComputeWorkGroupSizeY")
337             resources->maxComputeWorkGroupSizeY = value;
338         else if (tokenStr == "MaxComputeWorkGroupSizeZ")
339             resources->maxComputeWorkGroupSizeZ = value;
340         else if (tokenStr == "MaxComputeUniformComponents")
341             resources->maxComputeUniformComponents = value;
342         else if (tokenStr == "MaxComputeTextureImageUnits")
343             resources->maxComputeTextureImageUnits = value;
344         else if (tokenStr == "MaxComputeImageUniforms")
345             resources->maxComputeImageUniforms = value;
346         else if (tokenStr == "MaxComputeAtomicCounters")
347             resources->maxComputeAtomicCounters = value;
348         else if (tokenStr == "MaxComputeAtomicCounterBuffers")
349             resources->maxComputeAtomicCounterBuffers = value;
350         else if (tokenStr == "MaxVaryingComponents")
351             resources->maxVaryingComponents = value;
352         else if (tokenStr == "MaxVertexOutputComponents")
353             resources->maxVertexOutputComponents = value;
354         else if (tokenStr == "MaxGeometryInputComponents")
355             resources->maxGeometryInputComponents = value;
356         else if (tokenStr == "MaxGeometryOutputComponents")
357             resources->maxGeometryOutputComponents = value;
358         else if (tokenStr == "MaxFragmentInputComponents")
359             resources->maxFragmentInputComponents = value;
360         else if (tokenStr == "MaxImageUnits")
361             resources->maxImageUnits = value;
362         else if (tokenStr == "MaxCombinedImageUnitsAndFragmentOutputs")
363             resources->maxCombinedImageUnitsAndFragmentOutputs = value;
364         else if (tokenStr == "MaxCombinedShaderOutputResources")
365             resources->maxCombinedShaderOutputResources = value;
366         else if (tokenStr == "MaxImageSamples")
367             resources->maxImageSamples = value;
368         else if (tokenStr == "MaxVertexImageUniforms")
369             resources->maxVertexImageUniforms = value;
370         else if (tokenStr == "MaxTessControlImageUniforms")
371             resources->maxTessControlImageUniforms = value;
372         else if (tokenStr == "MaxTessEvaluationImageUniforms")
373             resources->maxTessEvaluationImageUniforms = value;
374         else if (tokenStr == "MaxGeometryImageUniforms")
375             resources->maxGeometryImageUniforms = value;
376         else if (tokenStr == "MaxFragmentImageUniforms")
377             resources->maxFragmentImageUniforms = value;
378         else if (tokenStr == "MaxCombinedImageUniforms")
379             resources->maxCombinedImageUniforms = value;
380         else if (tokenStr == "MaxGeometryTextureImageUnits")
381             resources->maxGeometryTextureImageUnits = value;
382         else if (tokenStr == "MaxGeometryOutputVertices")
383             resources->maxGeometryOutputVertices = value;
384         else if (tokenStr == "MaxGeometryTotalOutputComponents")
385             resources->maxGeometryTotalOutputComponents = value;
386         else if (tokenStr == "MaxGeometryUniformComponents")
387             resources->maxGeometryUniformComponents = value;
388         else if (tokenStr == "MaxGeometryVaryingComponents")
389             resources->maxGeometryVaryingComponents = value;
390         else if (tokenStr == "MaxTessControlInputComponents")
391             resources->maxTessControlInputComponents = value;
392         else if (tokenStr == "MaxTessControlOutputComponents")
393             resources->maxTessControlOutputComponents = value;
394         else if (tokenStr == "MaxTessControlTextureImageUnits")
395             resources->maxTessControlTextureImageUnits = value;
396         else if (tokenStr == "MaxTessControlUniformComponents")
397             resources->maxTessControlUniformComponents = value;
398         else if (tokenStr == "MaxTessControlTotalOutputComponents")
399             resources->maxTessControlTotalOutputComponents = value;
400         else if (tokenStr == "MaxTessEvaluationInputComponents")
401             resources->maxTessEvaluationInputComponents = value;
402         else if (tokenStr == "MaxTessEvaluationOutputComponents")
403             resources->maxTessEvaluationOutputComponents = value;
404         else if (tokenStr == "MaxTessEvaluationTextureImageUnits")
405             resources->maxTessEvaluationTextureImageUnits = value;
406         else if (tokenStr == "MaxTessEvaluationUniformComponents")
407             resources->maxTessEvaluationUniformComponents = value;
408         else if (tokenStr == "MaxTessPatchComponents")
409             resources->maxTessPatchComponents = value;
410         else if (tokenStr == "MaxPatchVertices")
411             resources->maxPatchVertices = value;
412         else if (tokenStr == "MaxTessGenLevel")
413             resources->maxTessGenLevel = value;
414         else if (tokenStr == "MaxViewports")
415             resources->maxViewports = value;
416         else if (tokenStr == "MaxVertexAtomicCounters")
417             resources->maxVertexAtomicCounters = value;
418         else if (tokenStr == "MaxTessControlAtomicCounters")
419             resources->maxTessControlAtomicCounters = value;
420         else if (tokenStr == "MaxTessEvaluationAtomicCounters")
421             resources->maxTessEvaluationAtomicCounters = value;
422         else if (tokenStr == "MaxGeometryAtomicCounters")
423             resources->maxGeometryAtomicCounters = value;
424         else if (tokenStr == "MaxFragmentAtomicCounters")
425             resources->maxFragmentAtomicCounters = value;
426         else if (tokenStr == "MaxCombinedAtomicCounters")
427             resources->maxCombinedAtomicCounters = value;
428         else if (tokenStr == "MaxAtomicCounterBindings")
429             resources->maxAtomicCounterBindings = value;
430         else if (tokenStr == "MaxVertexAtomicCounterBuffers")
431             resources->maxVertexAtomicCounterBuffers = value;
432         else if (tokenStr == "MaxTessControlAtomicCounterBuffers")
433             resources->maxTessControlAtomicCounterBuffers = value;
434         else if (tokenStr == "MaxTessEvaluationAtomicCounterBuffers")
435             resources->maxTessEvaluationAtomicCounterBuffers = value;
436         else if (tokenStr == "MaxGeometryAtomicCounterBuffers")
437             resources->maxGeometryAtomicCounterBuffers = value;
438         else if (tokenStr == "MaxFragmentAtomicCounterBuffers")
439             resources->maxFragmentAtomicCounterBuffers = value;
440         else if (tokenStr == "MaxCombinedAtomicCounterBuffers")
441             resources->maxCombinedAtomicCounterBuffers = value;
442         else if (tokenStr == "MaxAtomicCounterBufferSize")
443             resources->maxAtomicCounterBufferSize = value;
444         else if (tokenStr == "MaxTransformFeedbackBuffers")
445             resources->maxTransformFeedbackBuffers = value;
446         else if (tokenStr == "MaxTransformFeedbackInterleavedComponents")
447             resources->maxTransformFeedbackInterleavedComponents = value;
448         else if (tokenStr == "MaxCullDistances")
449             resources->maxCullDistances = value;
450         else if (tokenStr == "MaxCombinedClipAndCullDistances")
451             resources->maxCombinedClipAndCullDistances = value;
452         else if (tokenStr == "MaxSamples")
453             resources->maxSamples = value;
454 #ifdef NV_EXTENSIONS
455         else if (tokenStr == "MaxMeshOutputVerticesNV")
456             resources->maxMeshOutputVerticesNV = value;
457         else if (tokenStr == "MaxMeshOutputPrimitivesNV")
458             resources->maxMeshOutputPrimitivesNV = value;
459         else if (tokenStr == "MaxMeshWorkGroupSizeX_NV")
460             resources->maxMeshWorkGroupSizeX_NV = value;
461         else if (tokenStr == "MaxMeshWorkGroupSizeY_NV")
462             resources->maxMeshWorkGroupSizeY_NV = value;
463         else if (tokenStr == "MaxMeshWorkGroupSizeZ_NV")
464             resources->maxMeshWorkGroupSizeZ_NV = value;
465         else if (tokenStr == "MaxTaskWorkGroupSizeX_NV")
466             resources->maxTaskWorkGroupSizeX_NV = value;
467         else if (tokenStr == "MaxTaskWorkGroupSizeY_NV")
468             resources->maxTaskWorkGroupSizeY_NV = value;
469         else if (tokenStr == "MaxTaskWorkGroupSizeZ_NV")
470             resources->maxTaskWorkGroupSizeZ_NV = value;
471         else if (tokenStr == "MaxMeshViewCountNV")
472             resources->maxMeshViewCountNV = value;
473 #endif
474         else if (tokenStr == "nonInductiveForLoops")
475             resources->limits.nonInductiveForLoops = (value != 0);
476         else if (tokenStr == "whileLoops")
477             resources->limits.whileLoops = (value != 0);
478         else if (tokenStr == "doWhileLoops")
479             resources->limits.doWhileLoops = (value != 0);
480         else if (tokenStr == "generalUniformIndexing")
481             resources->limits.generalUniformIndexing = (value != 0);
482         else if (tokenStr == "generalAttributeMatrixVectorIndexing")
483             resources->limits.generalAttributeMatrixVectorIndexing = (value != 0);
484         else if (tokenStr == "generalVaryingIndexing")
485             resources->limits.generalVaryingIndexing = (value != 0);
486         else if (tokenStr == "generalSamplerIndexing")
487             resources->limits.generalSamplerIndexing = (value != 0);
488         else if (tokenStr == "generalVariableIndexing")
489             resources->limits.generalVariableIndexing = (value != 0);
490         else if (tokenStr == "generalConstantMatrixVectorIndexing")
491             resources->limits.generalConstantMatrixVectorIndexing = (value != 0);
492         else
493             printf("Warning: unrecognized limit (%s) in configuration file.\n", tokenStr.c_str());
494 
495     }
496 }
497 
498 }  // end namespace glslang
499