blob: 80198634e0631c573a2aeba9241244c18d6104ea [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>
38
Lei Zhang8a9b1ee2016-05-19 13:31:43 -040039#include "ResourceLimits.h"
Lei Zhang414eb602016-03-04 16:22:34 -050040
41namespace glslang {
42
43const TBuiltInResource DefaultTBuiltInResource = {
44 /* .MaxLights = */ 32,
45 /* .MaxClipPlanes = */ 6,
46 /* .MaxTextureUnits = */ 32,
47 /* .MaxTextureCoords = */ 32,
48 /* .MaxVertexAttribs = */ 64,
49 /* .MaxVertexUniformComponents = */ 4096,
50 /* .MaxVaryingFloats = */ 64,
51 /* .MaxVertexTextureImageUnits = */ 32,
52 /* .MaxCombinedTextureImageUnits = */ 80,
53 /* .MaxTextureImageUnits = */ 32,
54 /* .MaxFragmentUniformComponents = */ 4096,
55 /* .MaxDrawBuffers = */ 32,
56 /* .MaxVertexUniformVectors = */ 128,
57 /* .MaxVaryingVectors = */ 8,
58 /* .MaxFragmentUniformVectors = */ 16,
59 /* .MaxVertexOutputVectors = */ 16,
60 /* .MaxFragmentInputVectors = */ 15,
61 /* .MinProgramTexelOffset = */ -8,
62 /* .MaxProgramTexelOffset = */ 7,
63 /* .MaxClipDistances = */ 8,
64 /* .MaxComputeWorkGroupCountX = */ 65535,
65 /* .MaxComputeWorkGroupCountY = */ 65535,
66 /* .MaxComputeWorkGroupCountZ = */ 65535,
67 /* .MaxComputeWorkGroupSizeX = */ 1024,
68 /* .MaxComputeWorkGroupSizeY = */ 1024,
69 /* .MaxComputeWorkGroupSizeZ = */ 64,
70 /* .MaxComputeUniformComponents = */ 1024,
71 /* .MaxComputeTextureImageUnits = */ 16,
72 /* .MaxComputeImageUniforms = */ 8,
73 /* .MaxComputeAtomicCounters = */ 8,
74 /* .MaxComputeAtomicCounterBuffers = */ 1,
75 /* .MaxVaryingComponents = */ 60,
76 /* .MaxVertexOutputComponents = */ 64,
77 /* .MaxGeometryInputComponents = */ 64,
78 /* .MaxGeometryOutputComponents = */ 128,
79 /* .MaxFragmentInputComponents = */ 128,
80 /* .MaxImageUnits = */ 8,
81 /* .MaxCombinedImageUnitsAndFragmentOutputs = */ 8,
82 /* .MaxCombinedShaderOutputResources = */ 8,
83 /* .MaxImageSamples = */ 0,
84 /* .MaxVertexImageUniforms = */ 0,
85 /* .MaxTessControlImageUniforms = */ 0,
86 /* .MaxTessEvaluationImageUniforms = */ 0,
87 /* .MaxGeometryImageUniforms = */ 0,
88 /* .MaxFragmentImageUniforms = */ 8,
89 /* .MaxCombinedImageUniforms = */ 8,
90 /* .MaxGeometryTextureImageUnits = */ 16,
91 /* .MaxGeometryOutputVertices = */ 256,
92 /* .MaxGeometryTotalOutputComponents = */ 1024,
93 /* .MaxGeometryUniformComponents = */ 1024,
94 /* .MaxGeometryVaryingComponents = */ 64,
95 /* .MaxTessControlInputComponents = */ 128,
96 /* .MaxTessControlOutputComponents = */ 128,
97 /* .MaxTessControlTextureImageUnits = */ 16,
98 /* .MaxTessControlUniformComponents = */ 1024,
99 /* .MaxTessControlTotalOutputComponents = */ 4096,
100 /* .MaxTessEvaluationInputComponents = */ 128,
101 /* .MaxTessEvaluationOutputComponents = */ 128,
102 /* .MaxTessEvaluationTextureImageUnits = */ 16,
103 /* .MaxTessEvaluationUniformComponents = */ 1024,
104 /* .MaxTessPatchComponents = */ 120,
105 /* .MaxPatchVertices = */ 32,
106 /* .MaxTessGenLevel = */ 64,
107 /* .MaxViewports = */ 16,
108 /* .MaxVertexAtomicCounters = */ 0,
109 /* .MaxTessControlAtomicCounters = */ 0,
110 /* .MaxTessEvaluationAtomicCounters = */ 0,
111 /* .MaxGeometryAtomicCounters = */ 0,
112 /* .MaxFragmentAtomicCounters = */ 8,
113 /* .MaxCombinedAtomicCounters = */ 8,
114 /* .MaxAtomicCounterBindings = */ 1,
115 /* .MaxVertexAtomicCounterBuffers = */ 0,
116 /* .MaxTessControlAtomicCounterBuffers = */ 0,
117 /* .MaxTessEvaluationAtomicCounterBuffers = */ 0,
118 /* .MaxGeometryAtomicCounterBuffers = */ 0,
119 /* .MaxFragmentAtomicCounterBuffers = */ 1,
120 /* .MaxCombinedAtomicCounterBuffers = */ 1,
121 /* .MaxAtomicCounterBufferSize = */ 16384,
122 /* .MaxTransformFeedbackBuffers = */ 4,
123 /* .MaxTransformFeedbackInterleavedComponents = */ 64,
124 /* .MaxCullDistances = */ 8,
125 /* .MaxCombinedClipAndCullDistances = */ 8,
126 /* .MaxSamples = */ 4,
127 /* .limits = */ {
128 /* .nonInductiveForLoops = */ 1,
129 /* .whileLoops = */ 1,
130 /* .doWhileLoops = */ 1,
131 /* .generalUniformIndexing = */ 1,
132 /* .generalAttributeMatrixVectorIndexing = */ 1,
133 /* .generalVaryingIndexing = */ 1,
134 /* .generalSamplerIndexing = */ 1,
135 /* .generalVariableIndexing = */ 1,
136 /* .generalConstantMatrixVectorIndexing = */ 1,
137 }};
138
139std::string GetDefaultTBuiltInResourceString()
140{
141 std::ostringstream ostream;
142
143 ostream << "MaxLights " << DefaultTBuiltInResource.maxLights << "\n"
144 << "MaxClipPlanes " << DefaultTBuiltInResource.maxClipPlanes << "\n"
145 << "MaxTextureUnits " << DefaultTBuiltInResource.maxTextureUnits << "\n"
146 << "MaxTextureCoords " << DefaultTBuiltInResource.maxTextureCoords << "\n"
147 << "MaxVertexAttribs " << DefaultTBuiltInResource.maxVertexAttribs << "\n"
148 << "MaxVertexUniformComponents " << DefaultTBuiltInResource.maxVertexUniformComponents << "\n"
149 << "MaxVaryingFloats " << DefaultTBuiltInResource.maxVaryingFloats << "\n"
150 << "MaxVertexTextureImageUnits " << DefaultTBuiltInResource.maxVertexTextureImageUnits << "\n"
151 << "MaxCombinedTextureImageUnits " << DefaultTBuiltInResource.maxCombinedTextureImageUnits << "\n"
152 << "MaxTextureImageUnits " << DefaultTBuiltInResource.maxTextureImageUnits << "\n"
153 << "MaxFragmentUniformComponents " << DefaultTBuiltInResource.maxFragmentUniformComponents << "\n"
154 << "MaxDrawBuffers " << DefaultTBuiltInResource.maxDrawBuffers << "\n"
155 << "MaxVertexUniformVectors " << DefaultTBuiltInResource.maxVertexUniformVectors << "\n"
156 << "MaxVaryingVectors " << DefaultTBuiltInResource.maxVaryingVectors << "\n"
157 << "MaxFragmentUniformVectors " << DefaultTBuiltInResource.maxFragmentUniformVectors << "\n"
158 << "MaxVertexOutputVectors " << DefaultTBuiltInResource.maxVertexOutputVectors << "\n"
159 << "MaxFragmentInputVectors " << DefaultTBuiltInResource.maxFragmentInputVectors << "\n"
160 << "MinProgramTexelOffset " << DefaultTBuiltInResource.minProgramTexelOffset << "\n"
161 << "MaxProgramTexelOffset " << DefaultTBuiltInResource.maxProgramTexelOffset << "\n"
162 << "MaxClipDistances " << DefaultTBuiltInResource.maxClipDistances << "\n"
163 << "MaxComputeWorkGroupCountX " << DefaultTBuiltInResource.maxComputeWorkGroupCountX << "\n"
164 << "MaxComputeWorkGroupCountY " << DefaultTBuiltInResource.maxComputeWorkGroupCountY << "\n"
165 << "MaxComputeWorkGroupCountZ " << DefaultTBuiltInResource.maxComputeWorkGroupCountZ << "\n"
166 << "MaxComputeWorkGroupSizeX " << DefaultTBuiltInResource.maxComputeWorkGroupSizeX << "\n"
167 << "MaxComputeWorkGroupSizeY " << DefaultTBuiltInResource.maxComputeWorkGroupSizeY << "\n"
168 << "MaxComputeWorkGroupSizeZ " << DefaultTBuiltInResource.maxComputeWorkGroupSizeZ << "\n"
169 << "MaxComputeUniformComponents " << DefaultTBuiltInResource.maxComputeUniformComponents << "\n"
170 << "MaxComputeTextureImageUnits " << DefaultTBuiltInResource.maxComputeTextureImageUnits << "\n"
171 << "MaxComputeImageUniforms " << DefaultTBuiltInResource.maxComputeImageUniforms << "\n"
172 << "MaxComputeAtomicCounters " << DefaultTBuiltInResource.maxComputeAtomicCounters << "\n"
173 << "MaxComputeAtomicCounterBuffers " << DefaultTBuiltInResource.maxComputeAtomicCounterBuffers << "\n"
174 << "MaxVaryingComponents " << DefaultTBuiltInResource.maxVaryingComponents << "\n"
175 << "MaxVertexOutputComponents " << DefaultTBuiltInResource.maxVertexOutputComponents << "\n"
176 << "MaxGeometryInputComponents " << DefaultTBuiltInResource.maxGeometryInputComponents << "\n"
177 << "MaxGeometryOutputComponents " << DefaultTBuiltInResource.maxGeometryOutputComponents << "\n"
178 << "MaxFragmentInputComponents " << DefaultTBuiltInResource.maxFragmentInputComponents << "\n"
179 << "MaxImageUnits " << DefaultTBuiltInResource.maxImageUnits << "\n"
180 << "MaxCombinedImageUnitsAndFragmentOutputs " << DefaultTBuiltInResource.maxCombinedImageUnitsAndFragmentOutputs << "\n"
181 << "MaxCombinedShaderOutputResources " << DefaultTBuiltInResource.maxCombinedShaderOutputResources << "\n"
182 << "MaxImageSamples " << DefaultTBuiltInResource.maxImageSamples << "\n"
183 << "MaxVertexImageUniforms " << DefaultTBuiltInResource.maxVertexImageUniforms << "\n"
184 << "MaxTessControlImageUniforms " << DefaultTBuiltInResource.maxTessControlImageUniforms << "\n"
185 << "MaxTessEvaluationImageUniforms " << DefaultTBuiltInResource.maxTessEvaluationImageUniforms << "\n"
186 << "MaxGeometryImageUniforms " << DefaultTBuiltInResource.maxGeometryImageUniforms << "\n"
187 << "MaxFragmentImageUniforms " << DefaultTBuiltInResource.maxFragmentImageUniforms << "\n"
188 << "MaxCombinedImageUniforms " << DefaultTBuiltInResource.maxCombinedImageUniforms << "\n"
189 << "MaxGeometryTextureImageUnits " << DefaultTBuiltInResource.maxGeometryTextureImageUnits << "\n"
190 << "MaxGeometryOutputVertices " << DefaultTBuiltInResource.maxGeometryOutputVertices << "\n"
191 << "MaxGeometryTotalOutputComponents " << DefaultTBuiltInResource.maxGeometryTotalOutputComponents << "\n"
192 << "MaxGeometryUniformComponents " << DefaultTBuiltInResource.maxGeometryUniformComponents << "\n"
193 << "MaxGeometryVaryingComponents " << DefaultTBuiltInResource.maxGeometryVaryingComponents << "\n"
194 << "MaxTessControlInputComponents " << DefaultTBuiltInResource.maxTessControlInputComponents << "\n"
195 << "MaxTessControlOutputComponents " << DefaultTBuiltInResource.maxTessControlOutputComponents << "\n"
196 << "MaxTessControlTextureImageUnits " << DefaultTBuiltInResource.maxTessControlTextureImageUnits << "\n"
197 << "MaxTessControlUniformComponents " << DefaultTBuiltInResource.maxTessControlUniformComponents << "\n"
198 << "MaxTessControlTotalOutputComponents " << DefaultTBuiltInResource.maxTessControlTotalOutputComponents << "\n"
199 << "MaxTessEvaluationInputComponents " << DefaultTBuiltInResource.maxTessEvaluationInputComponents << "\n"
200 << "MaxTessEvaluationOutputComponents " << DefaultTBuiltInResource.maxTessEvaluationOutputComponents << "\n"
201 << "MaxTessEvaluationTextureImageUnits " << DefaultTBuiltInResource.maxTessEvaluationTextureImageUnits << "\n"
202 << "MaxTessEvaluationUniformComponents " << DefaultTBuiltInResource.maxTessEvaluationUniformComponents << "\n"
203 << "MaxTessPatchComponents " << DefaultTBuiltInResource.maxTessPatchComponents << "\n"
204 << "MaxPatchVertices " << DefaultTBuiltInResource.maxPatchVertices << "\n"
205 << "MaxTessGenLevel " << DefaultTBuiltInResource.maxTessGenLevel << "\n"
206 << "MaxViewports " << DefaultTBuiltInResource.maxViewports << "\n"
207 << "MaxVertexAtomicCounters " << DefaultTBuiltInResource.maxVertexAtomicCounters << "\n"
208 << "MaxTessControlAtomicCounters " << DefaultTBuiltInResource.maxTessControlAtomicCounters << "\n"
209 << "MaxTessEvaluationAtomicCounters " << DefaultTBuiltInResource.maxTessEvaluationAtomicCounters << "\n"
210 << "MaxGeometryAtomicCounters " << DefaultTBuiltInResource.maxGeometryAtomicCounters << "\n"
211 << "MaxFragmentAtomicCounters " << DefaultTBuiltInResource.maxFragmentAtomicCounters << "\n"
212 << "MaxCombinedAtomicCounters " << DefaultTBuiltInResource.maxCombinedAtomicCounters << "\n"
213 << "MaxAtomicCounterBindings " << DefaultTBuiltInResource.maxAtomicCounterBindings << "\n"
214 << "MaxVertexAtomicCounterBuffers " << DefaultTBuiltInResource.maxVertexAtomicCounterBuffers << "\n"
215 << "MaxTessControlAtomicCounterBuffers " << DefaultTBuiltInResource.maxTessControlAtomicCounterBuffers << "\n"
216 << "MaxTessEvaluationAtomicCounterBuffers " << DefaultTBuiltInResource.maxTessEvaluationAtomicCounterBuffers << "\n"
217 << "MaxGeometryAtomicCounterBuffers " << DefaultTBuiltInResource.maxGeometryAtomicCounterBuffers << "\n"
218 << "MaxFragmentAtomicCounterBuffers " << DefaultTBuiltInResource.maxFragmentAtomicCounterBuffers << "\n"
219 << "MaxCombinedAtomicCounterBuffers " << DefaultTBuiltInResource.maxCombinedAtomicCounterBuffers << "\n"
220 << "MaxAtomicCounterBufferSize " << DefaultTBuiltInResource.maxAtomicCounterBufferSize << "\n"
221 << "MaxTransformFeedbackBuffers " << DefaultTBuiltInResource.maxTransformFeedbackBuffers << "\n"
222 << "MaxTransformFeedbackInterleavedComponents " << DefaultTBuiltInResource.maxTransformFeedbackInterleavedComponents << "\n"
223 << "MaxCullDistances " << DefaultTBuiltInResource.maxCullDistances << "\n"
224 << "MaxCombinedClipAndCullDistances " << DefaultTBuiltInResource.maxCombinedClipAndCullDistances << "\n"
225 << "MaxSamples " << DefaultTBuiltInResource.maxSamples << "\n"
226
227 << "nonInductiveForLoops " << DefaultTBuiltInResource.limits.nonInductiveForLoops << "\n"
228 << "whileLoops " << DefaultTBuiltInResource.limits.whileLoops << "\n"
229 << "doWhileLoops " << DefaultTBuiltInResource.limits.doWhileLoops << "\n"
230 << "generalUniformIndexing " << DefaultTBuiltInResource.limits.generalUniformIndexing << "\n"
231 << "generalAttributeMatrixVectorIndexing " << DefaultTBuiltInResource.limits.generalAttributeMatrixVectorIndexing << "\n"
232 << "generalVaryingIndexing " << DefaultTBuiltInResource.limits.generalVaryingIndexing << "\n"
233 << "generalSamplerIndexing " << DefaultTBuiltInResource.limits.generalSamplerIndexing << "\n"
234 << "generalVariableIndexing " << DefaultTBuiltInResource.limits.generalVariableIndexing << "\n"
235 << "generalConstantMatrixVectorIndexing " << DefaultTBuiltInResource.limits.generalConstantMatrixVectorIndexing << "\n"
236 ;
237
238 return ostream.str();
239}
240
John Kessenich7f349c72016-07-08 22:09:10 -0600241void DecodeResourceLimits(TBuiltInResource* resources, char* config)
242{
Lei Zhang1b141722016-05-19 13:50:49 -0400243 const char* delims = " \t\n\r";
244 const char* token = strtok(config, delims);
245 while (token) {
246 const char* valueStr = strtok(0, delims);
247 if (valueStr == 0 || ! (valueStr[0] == '-' || (valueStr[0] >= '0' && valueStr[0] <= '9'))) {
248 printf("Error: '%s' bad .conf file. Each name must be followed by one number.\n", valueStr ? valueStr : "");
249 return;
250 }
251 int value = atoi(valueStr);
252
253 if (strcmp(token, "MaxLights") == 0)
254 resources->maxLights = value;
255 else if (strcmp(token, "MaxClipPlanes") == 0)
256 resources->maxClipPlanes = value;
257 else if (strcmp(token, "MaxTextureUnits") == 0)
258 resources->maxTextureUnits = value;
259 else if (strcmp(token, "MaxTextureCoords") == 0)
260 resources->maxTextureCoords = value;
261 else if (strcmp(token, "MaxVertexAttribs") == 0)
262 resources->maxVertexAttribs = value;
263 else if (strcmp(token, "MaxVertexUniformComponents") == 0)
264 resources->maxVertexUniformComponents = value;
265 else if (strcmp(token, "MaxVaryingFloats") == 0)
266 resources->maxVaryingFloats = value;
267 else if (strcmp(token, "MaxVertexTextureImageUnits") == 0)
268 resources->maxVertexTextureImageUnits = value;
269 else if (strcmp(token, "MaxCombinedTextureImageUnits") == 0)
270 resources->maxCombinedTextureImageUnits = value;
271 else if (strcmp(token, "MaxTextureImageUnits") == 0)
272 resources->maxTextureImageUnits = value;
273 else if (strcmp(token, "MaxFragmentUniformComponents") == 0)
274 resources->maxFragmentUniformComponents = value;
275 else if (strcmp(token, "MaxDrawBuffers") == 0)
276 resources->maxDrawBuffers = value;
277 else if (strcmp(token, "MaxVertexUniformVectors") == 0)
278 resources->maxVertexUniformVectors = value;
279 else if (strcmp(token, "MaxVaryingVectors") == 0)
280 resources->maxVaryingVectors = value;
281 else if (strcmp(token, "MaxFragmentUniformVectors") == 0)
282 resources->maxFragmentUniformVectors = value;
283 else if (strcmp(token, "MaxVertexOutputVectors") == 0)
284 resources->maxVertexOutputVectors = value;
285 else if (strcmp(token, "MaxFragmentInputVectors") == 0)
286 resources->maxFragmentInputVectors = value;
287 else if (strcmp(token, "MinProgramTexelOffset") == 0)
288 resources->minProgramTexelOffset = value;
289 else if (strcmp(token, "MaxProgramTexelOffset") == 0)
290 resources->maxProgramTexelOffset = value;
291 else if (strcmp(token, "MaxClipDistances") == 0)
292 resources->maxClipDistances = value;
293 else if (strcmp(token, "MaxComputeWorkGroupCountX") == 0)
294 resources->maxComputeWorkGroupCountX = value;
295 else if (strcmp(token, "MaxComputeWorkGroupCountY") == 0)
296 resources->maxComputeWorkGroupCountY = value;
297 else if (strcmp(token, "MaxComputeWorkGroupCountZ") == 0)
298 resources->maxComputeWorkGroupCountZ = value;
299 else if (strcmp(token, "MaxComputeWorkGroupSizeX") == 0)
300 resources->maxComputeWorkGroupSizeX = value;
301 else if (strcmp(token, "MaxComputeWorkGroupSizeY") == 0)
302 resources->maxComputeWorkGroupSizeY = value;
303 else if (strcmp(token, "MaxComputeWorkGroupSizeZ") == 0)
304 resources->maxComputeWorkGroupSizeZ = value;
305 else if (strcmp(token, "MaxComputeUniformComponents") == 0)
306 resources->maxComputeUniformComponents = value;
307 else if (strcmp(token, "MaxComputeTextureImageUnits") == 0)
308 resources->maxComputeTextureImageUnits = value;
309 else if (strcmp(token, "MaxComputeImageUniforms") == 0)
310 resources->maxComputeImageUniforms = value;
311 else if (strcmp(token, "MaxComputeAtomicCounters") == 0)
312 resources->maxComputeAtomicCounters = value;
313 else if (strcmp(token, "MaxComputeAtomicCounterBuffers") == 0)
314 resources->maxComputeAtomicCounterBuffers = value;
315 else if (strcmp(token, "MaxVaryingComponents") == 0)
316 resources->maxVaryingComponents = value;
317 else if (strcmp(token, "MaxVertexOutputComponents") == 0)
318 resources->maxVertexOutputComponents = value;
319 else if (strcmp(token, "MaxGeometryInputComponents") == 0)
320 resources->maxGeometryInputComponents = value;
321 else if (strcmp(token, "MaxGeometryOutputComponents") == 0)
322 resources->maxGeometryOutputComponents = value;
323 else if (strcmp(token, "MaxFragmentInputComponents") == 0)
324 resources->maxFragmentInputComponents = value;
325 else if (strcmp(token, "MaxImageUnits") == 0)
326 resources->maxImageUnits = value;
327 else if (strcmp(token, "MaxCombinedImageUnitsAndFragmentOutputs") == 0)
328 resources->maxCombinedImageUnitsAndFragmentOutputs = value;
329 else if (strcmp(token, "MaxCombinedShaderOutputResources") == 0)
330 resources->maxCombinedShaderOutputResources = value;
331 else if (strcmp(token, "MaxImageSamples") == 0)
332 resources->maxImageSamples = value;
333 else if (strcmp(token, "MaxVertexImageUniforms") == 0)
334 resources->maxVertexImageUniforms = value;
335 else if (strcmp(token, "MaxTessControlImageUniforms") == 0)
336 resources->maxTessControlImageUniforms = value;
337 else if (strcmp(token, "MaxTessEvaluationImageUniforms") == 0)
338 resources->maxTessEvaluationImageUniforms = value;
339 else if (strcmp(token, "MaxGeometryImageUniforms") == 0)
340 resources->maxGeometryImageUniforms = value;
341 else if (strcmp(token, "MaxFragmentImageUniforms") == 0)
342 resources->maxFragmentImageUniforms = value;
343 else if (strcmp(token, "MaxCombinedImageUniforms") == 0)
344 resources->maxCombinedImageUniforms = value;
345 else if (strcmp(token, "MaxGeometryTextureImageUnits") == 0)
346 resources->maxGeometryTextureImageUnits = value;
347 else if (strcmp(token, "MaxGeometryOutputVertices") == 0)
348 resources->maxGeometryOutputVertices = value;
349 else if (strcmp(token, "MaxGeometryTotalOutputComponents") == 0)
350 resources->maxGeometryTotalOutputComponents = value;
351 else if (strcmp(token, "MaxGeometryUniformComponents") == 0)
352 resources->maxGeometryUniformComponents = value;
353 else if (strcmp(token, "MaxGeometryVaryingComponents") == 0)
354 resources->maxGeometryVaryingComponents = value;
355 else if (strcmp(token, "MaxTessControlInputComponents") == 0)
356 resources->maxTessControlInputComponents = value;
357 else if (strcmp(token, "MaxTessControlOutputComponents") == 0)
358 resources->maxTessControlOutputComponents = value;
359 else if (strcmp(token, "MaxTessControlTextureImageUnits") == 0)
360 resources->maxTessControlTextureImageUnits = value;
361 else if (strcmp(token, "MaxTessControlUniformComponents") == 0)
362 resources->maxTessControlUniformComponents = value;
363 else if (strcmp(token, "MaxTessControlTotalOutputComponents") == 0)
364 resources->maxTessControlTotalOutputComponents = value;
365 else if (strcmp(token, "MaxTessEvaluationInputComponents") == 0)
366 resources->maxTessEvaluationInputComponents = value;
367 else if (strcmp(token, "MaxTessEvaluationOutputComponents") == 0)
368 resources->maxTessEvaluationOutputComponents = value;
369 else if (strcmp(token, "MaxTessEvaluationTextureImageUnits") == 0)
370 resources->maxTessEvaluationTextureImageUnits = value;
371 else if (strcmp(token, "MaxTessEvaluationUniformComponents") == 0)
372 resources->maxTessEvaluationUniformComponents = value;
373 else if (strcmp(token, "MaxTessPatchComponents") == 0)
374 resources->maxTessPatchComponents = value;
375 else if (strcmp(token, "MaxPatchVertices") == 0)
376 resources->maxPatchVertices = value;
377 else if (strcmp(token, "MaxTessGenLevel") == 0)
378 resources->maxTessGenLevel = value;
379 else if (strcmp(token, "MaxViewports") == 0)
380 resources->maxViewports = value;
381 else if (strcmp(token, "MaxVertexAtomicCounters") == 0)
382 resources->maxVertexAtomicCounters = value;
383 else if (strcmp(token, "MaxTessControlAtomicCounters") == 0)
384 resources->maxTessControlAtomicCounters = value;
385 else if (strcmp(token, "MaxTessEvaluationAtomicCounters") == 0)
386 resources->maxTessEvaluationAtomicCounters = value;
387 else if (strcmp(token, "MaxGeometryAtomicCounters") == 0)
388 resources->maxGeometryAtomicCounters = value;
389 else if (strcmp(token, "MaxFragmentAtomicCounters") == 0)
390 resources->maxFragmentAtomicCounters = value;
391 else if (strcmp(token, "MaxCombinedAtomicCounters") == 0)
392 resources->maxCombinedAtomicCounters = value;
393 else if (strcmp(token, "MaxAtomicCounterBindings") == 0)
394 resources->maxAtomicCounterBindings = value;
395 else if (strcmp(token, "MaxVertexAtomicCounterBuffers") == 0)
396 resources->maxVertexAtomicCounterBuffers = value;
397 else if (strcmp(token, "MaxTessControlAtomicCounterBuffers") == 0)
398 resources->maxTessControlAtomicCounterBuffers = value;
399 else if (strcmp(token, "MaxTessEvaluationAtomicCounterBuffers") == 0)
400 resources->maxTessEvaluationAtomicCounterBuffers = value;
401 else if (strcmp(token, "MaxGeometryAtomicCounterBuffers") == 0)
402 resources->maxGeometryAtomicCounterBuffers = value;
403 else if (strcmp(token, "MaxFragmentAtomicCounterBuffers") == 0)
404 resources->maxFragmentAtomicCounterBuffers = value;
405 else if (strcmp(token, "MaxCombinedAtomicCounterBuffers") == 0)
406 resources->maxCombinedAtomicCounterBuffers = value;
407 else if (strcmp(token, "MaxAtomicCounterBufferSize") == 0)
408 resources->maxAtomicCounterBufferSize = value;
409 else if (strcmp(token, "MaxTransformFeedbackBuffers") == 0)
410 resources->maxTransformFeedbackBuffers = value;
411 else if (strcmp(token, "MaxTransformFeedbackInterleavedComponents") == 0)
412 resources->maxTransformFeedbackInterleavedComponents = value;
413 else if (strcmp(token, "MaxCullDistances") == 0)
414 resources->maxCullDistances = value;
415 else if (strcmp(token, "MaxCombinedClipAndCullDistances") == 0)
416 resources->maxCombinedClipAndCullDistances = value;
417 else if (strcmp(token, "MaxSamples") == 0)
418 resources->maxSamples = value;
419
420 else if (strcmp(token, "nonInductiveForLoops") == 0)
421 resources->limits.nonInductiveForLoops = (value != 0);
422 else if (strcmp(token, "whileLoops") == 0)
423 resources->limits.whileLoops = (value != 0);
424 else if (strcmp(token, "doWhileLoops") == 0)
425 resources->limits.doWhileLoops = (value != 0);
426 else if (strcmp(token, "generalUniformIndexing") == 0)
427 resources->limits.generalUniformIndexing = (value != 0);
428 else if (strcmp(token, "generalAttributeMatrixVectorIndexing") == 0)
429 resources->limits.generalAttributeMatrixVectorIndexing = (value != 0);
430 else if (strcmp(token, "generalVaryingIndexing") == 0)
431 resources->limits.generalVaryingIndexing = (value != 0);
432 else if (strcmp(token, "generalSamplerIndexing") == 0)
433 resources->limits.generalSamplerIndexing = (value != 0);
434 else if (strcmp(token, "generalVariableIndexing") == 0)
435 resources->limits.generalVariableIndexing = (value != 0);
436 else if (strcmp(token, "generalConstantMatrixVectorIndexing") == 0)
437 resources->limits.generalConstantMatrixVectorIndexing = (value != 0);
438 else
439 printf("Warning: unrecognized limit (%s) in configuration file.\n", token);
440
441 token = strtok(0, delims);
442 }
443}
444
Lei Zhang414eb602016-03-04 16:22:34 -0500445} // end namespace glslang