Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 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 | |
David Neto | 2ed1d9b | 2016-05-20 16:05:21 -0400 | [diff] [blame^] | 35 | #include <cstdlib> |
| 36 | #include <cstring> |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 37 | #include <sstream> |
| 38 | |
Lei Zhang | 8a9b1ee | 2016-05-19 13:31:43 -0400 | [diff] [blame] | 39 | #include "ResourceLimits.h" |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 40 | |
| 41 | namespace glslang { |
| 42 | |
| 43 | const 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 | |
| 139 | std::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 | |
Lei Zhang | 1b14172 | 2016-05-19 13:50:49 -0400 | [diff] [blame] | 241 | void DecodeResourceLimits(TBuiltInResource* resources, char* config) { |
| 242 | const char* delims = " \t\n\r"; |
| 243 | const char* token = strtok(config, delims); |
| 244 | while (token) { |
| 245 | const char* valueStr = strtok(0, delims); |
| 246 | if (valueStr == 0 || ! (valueStr[0] == '-' || (valueStr[0] >= '0' && valueStr[0] <= '9'))) { |
| 247 | printf("Error: '%s' bad .conf file. Each name must be followed by one number.\n", valueStr ? valueStr : ""); |
| 248 | return; |
| 249 | } |
| 250 | int value = atoi(valueStr); |
| 251 | |
| 252 | if (strcmp(token, "MaxLights") == 0) |
| 253 | resources->maxLights = value; |
| 254 | else if (strcmp(token, "MaxClipPlanes") == 0) |
| 255 | resources->maxClipPlanes = value; |
| 256 | else if (strcmp(token, "MaxTextureUnits") == 0) |
| 257 | resources->maxTextureUnits = value; |
| 258 | else if (strcmp(token, "MaxTextureCoords") == 0) |
| 259 | resources->maxTextureCoords = value; |
| 260 | else if (strcmp(token, "MaxVertexAttribs") == 0) |
| 261 | resources->maxVertexAttribs = value; |
| 262 | else if (strcmp(token, "MaxVertexUniformComponents") == 0) |
| 263 | resources->maxVertexUniformComponents = value; |
| 264 | else if (strcmp(token, "MaxVaryingFloats") == 0) |
| 265 | resources->maxVaryingFloats = value; |
| 266 | else if (strcmp(token, "MaxVertexTextureImageUnits") == 0) |
| 267 | resources->maxVertexTextureImageUnits = value; |
| 268 | else if (strcmp(token, "MaxCombinedTextureImageUnits") == 0) |
| 269 | resources->maxCombinedTextureImageUnits = value; |
| 270 | else if (strcmp(token, "MaxTextureImageUnits") == 0) |
| 271 | resources->maxTextureImageUnits = value; |
| 272 | else if (strcmp(token, "MaxFragmentUniformComponents") == 0) |
| 273 | resources->maxFragmentUniformComponents = value; |
| 274 | else if (strcmp(token, "MaxDrawBuffers") == 0) |
| 275 | resources->maxDrawBuffers = value; |
| 276 | else if (strcmp(token, "MaxVertexUniformVectors") == 0) |
| 277 | resources->maxVertexUniformVectors = value; |
| 278 | else if (strcmp(token, "MaxVaryingVectors") == 0) |
| 279 | resources->maxVaryingVectors = value; |
| 280 | else if (strcmp(token, "MaxFragmentUniformVectors") == 0) |
| 281 | resources->maxFragmentUniformVectors = value; |
| 282 | else if (strcmp(token, "MaxVertexOutputVectors") == 0) |
| 283 | resources->maxVertexOutputVectors = value; |
| 284 | else if (strcmp(token, "MaxFragmentInputVectors") == 0) |
| 285 | resources->maxFragmentInputVectors = value; |
| 286 | else if (strcmp(token, "MinProgramTexelOffset") == 0) |
| 287 | resources->minProgramTexelOffset = value; |
| 288 | else if (strcmp(token, "MaxProgramTexelOffset") == 0) |
| 289 | resources->maxProgramTexelOffset = value; |
| 290 | else if (strcmp(token, "MaxClipDistances") == 0) |
| 291 | resources->maxClipDistances = value; |
| 292 | else if (strcmp(token, "MaxComputeWorkGroupCountX") == 0) |
| 293 | resources->maxComputeWorkGroupCountX = value; |
| 294 | else if (strcmp(token, "MaxComputeWorkGroupCountY") == 0) |
| 295 | resources->maxComputeWorkGroupCountY = value; |
| 296 | else if (strcmp(token, "MaxComputeWorkGroupCountZ") == 0) |
| 297 | resources->maxComputeWorkGroupCountZ = value; |
| 298 | else if (strcmp(token, "MaxComputeWorkGroupSizeX") == 0) |
| 299 | resources->maxComputeWorkGroupSizeX = value; |
| 300 | else if (strcmp(token, "MaxComputeWorkGroupSizeY") == 0) |
| 301 | resources->maxComputeWorkGroupSizeY = value; |
| 302 | else if (strcmp(token, "MaxComputeWorkGroupSizeZ") == 0) |
| 303 | resources->maxComputeWorkGroupSizeZ = value; |
| 304 | else if (strcmp(token, "MaxComputeUniformComponents") == 0) |
| 305 | resources->maxComputeUniformComponents = value; |
| 306 | else if (strcmp(token, "MaxComputeTextureImageUnits") == 0) |
| 307 | resources->maxComputeTextureImageUnits = value; |
| 308 | else if (strcmp(token, "MaxComputeImageUniforms") == 0) |
| 309 | resources->maxComputeImageUniforms = value; |
| 310 | else if (strcmp(token, "MaxComputeAtomicCounters") == 0) |
| 311 | resources->maxComputeAtomicCounters = value; |
| 312 | else if (strcmp(token, "MaxComputeAtomicCounterBuffers") == 0) |
| 313 | resources->maxComputeAtomicCounterBuffers = value; |
| 314 | else if (strcmp(token, "MaxVaryingComponents") == 0) |
| 315 | resources->maxVaryingComponents = value; |
| 316 | else if (strcmp(token, "MaxVertexOutputComponents") == 0) |
| 317 | resources->maxVertexOutputComponents = value; |
| 318 | else if (strcmp(token, "MaxGeometryInputComponents") == 0) |
| 319 | resources->maxGeometryInputComponents = value; |
| 320 | else if (strcmp(token, "MaxGeometryOutputComponents") == 0) |
| 321 | resources->maxGeometryOutputComponents = value; |
| 322 | else if (strcmp(token, "MaxFragmentInputComponents") == 0) |
| 323 | resources->maxFragmentInputComponents = value; |
| 324 | else if (strcmp(token, "MaxImageUnits") == 0) |
| 325 | resources->maxImageUnits = value; |
| 326 | else if (strcmp(token, "MaxCombinedImageUnitsAndFragmentOutputs") == 0) |
| 327 | resources->maxCombinedImageUnitsAndFragmentOutputs = value; |
| 328 | else if (strcmp(token, "MaxCombinedShaderOutputResources") == 0) |
| 329 | resources->maxCombinedShaderOutputResources = value; |
| 330 | else if (strcmp(token, "MaxImageSamples") == 0) |
| 331 | resources->maxImageSamples = value; |
| 332 | else if (strcmp(token, "MaxVertexImageUniforms") == 0) |
| 333 | resources->maxVertexImageUniforms = value; |
| 334 | else if (strcmp(token, "MaxTessControlImageUniforms") == 0) |
| 335 | resources->maxTessControlImageUniforms = value; |
| 336 | else if (strcmp(token, "MaxTessEvaluationImageUniforms") == 0) |
| 337 | resources->maxTessEvaluationImageUniforms = value; |
| 338 | else if (strcmp(token, "MaxGeometryImageUniforms") == 0) |
| 339 | resources->maxGeometryImageUniforms = value; |
| 340 | else if (strcmp(token, "MaxFragmentImageUniforms") == 0) |
| 341 | resources->maxFragmentImageUniforms = value; |
| 342 | else if (strcmp(token, "MaxCombinedImageUniforms") == 0) |
| 343 | resources->maxCombinedImageUniforms = value; |
| 344 | else if (strcmp(token, "MaxGeometryTextureImageUnits") == 0) |
| 345 | resources->maxGeometryTextureImageUnits = value; |
| 346 | else if (strcmp(token, "MaxGeometryOutputVertices") == 0) |
| 347 | resources->maxGeometryOutputVertices = value; |
| 348 | else if (strcmp(token, "MaxGeometryTotalOutputComponents") == 0) |
| 349 | resources->maxGeometryTotalOutputComponents = value; |
| 350 | else if (strcmp(token, "MaxGeometryUniformComponents") == 0) |
| 351 | resources->maxGeometryUniformComponents = value; |
| 352 | else if (strcmp(token, "MaxGeometryVaryingComponents") == 0) |
| 353 | resources->maxGeometryVaryingComponents = value; |
| 354 | else if (strcmp(token, "MaxTessControlInputComponents") == 0) |
| 355 | resources->maxTessControlInputComponents = value; |
| 356 | else if (strcmp(token, "MaxTessControlOutputComponents") == 0) |
| 357 | resources->maxTessControlOutputComponents = value; |
| 358 | else if (strcmp(token, "MaxTessControlTextureImageUnits") == 0) |
| 359 | resources->maxTessControlTextureImageUnits = value; |
| 360 | else if (strcmp(token, "MaxTessControlUniformComponents") == 0) |
| 361 | resources->maxTessControlUniformComponents = value; |
| 362 | else if (strcmp(token, "MaxTessControlTotalOutputComponents") == 0) |
| 363 | resources->maxTessControlTotalOutputComponents = value; |
| 364 | else if (strcmp(token, "MaxTessEvaluationInputComponents") == 0) |
| 365 | resources->maxTessEvaluationInputComponents = value; |
| 366 | else if (strcmp(token, "MaxTessEvaluationOutputComponents") == 0) |
| 367 | resources->maxTessEvaluationOutputComponents = value; |
| 368 | else if (strcmp(token, "MaxTessEvaluationTextureImageUnits") == 0) |
| 369 | resources->maxTessEvaluationTextureImageUnits = value; |
| 370 | else if (strcmp(token, "MaxTessEvaluationUniformComponents") == 0) |
| 371 | resources->maxTessEvaluationUniformComponents = value; |
| 372 | else if (strcmp(token, "MaxTessPatchComponents") == 0) |
| 373 | resources->maxTessPatchComponents = value; |
| 374 | else if (strcmp(token, "MaxPatchVertices") == 0) |
| 375 | resources->maxPatchVertices = value; |
| 376 | else if (strcmp(token, "MaxTessGenLevel") == 0) |
| 377 | resources->maxTessGenLevel = value; |
| 378 | else if (strcmp(token, "MaxViewports") == 0) |
| 379 | resources->maxViewports = value; |
| 380 | else if (strcmp(token, "MaxVertexAtomicCounters") == 0) |
| 381 | resources->maxVertexAtomicCounters = value; |
| 382 | else if (strcmp(token, "MaxTessControlAtomicCounters") == 0) |
| 383 | resources->maxTessControlAtomicCounters = value; |
| 384 | else if (strcmp(token, "MaxTessEvaluationAtomicCounters") == 0) |
| 385 | resources->maxTessEvaluationAtomicCounters = value; |
| 386 | else if (strcmp(token, "MaxGeometryAtomicCounters") == 0) |
| 387 | resources->maxGeometryAtomicCounters = value; |
| 388 | else if (strcmp(token, "MaxFragmentAtomicCounters") == 0) |
| 389 | resources->maxFragmentAtomicCounters = value; |
| 390 | else if (strcmp(token, "MaxCombinedAtomicCounters") == 0) |
| 391 | resources->maxCombinedAtomicCounters = value; |
| 392 | else if (strcmp(token, "MaxAtomicCounterBindings") == 0) |
| 393 | resources->maxAtomicCounterBindings = value; |
| 394 | else if (strcmp(token, "MaxVertexAtomicCounterBuffers") == 0) |
| 395 | resources->maxVertexAtomicCounterBuffers = value; |
| 396 | else if (strcmp(token, "MaxTessControlAtomicCounterBuffers") == 0) |
| 397 | resources->maxTessControlAtomicCounterBuffers = value; |
| 398 | else if (strcmp(token, "MaxTessEvaluationAtomicCounterBuffers") == 0) |
| 399 | resources->maxTessEvaluationAtomicCounterBuffers = value; |
| 400 | else if (strcmp(token, "MaxGeometryAtomicCounterBuffers") == 0) |
| 401 | resources->maxGeometryAtomicCounterBuffers = value; |
| 402 | else if (strcmp(token, "MaxFragmentAtomicCounterBuffers") == 0) |
| 403 | resources->maxFragmentAtomicCounterBuffers = value; |
| 404 | else if (strcmp(token, "MaxCombinedAtomicCounterBuffers") == 0) |
| 405 | resources->maxCombinedAtomicCounterBuffers = value; |
| 406 | else if (strcmp(token, "MaxAtomicCounterBufferSize") == 0) |
| 407 | resources->maxAtomicCounterBufferSize = value; |
| 408 | else if (strcmp(token, "MaxTransformFeedbackBuffers") == 0) |
| 409 | resources->maxTransformFeedbackBuffers = value; |
| 410 | else if (strcmp(token, "MaxTransformFeedbackInterleavedComponents") == 0) |
| 411 | resources->maxTransformFeedbackInterleavedComponents = value; |
| 412 | else if (strcmp(token, "MaxCullDistances") == 0) |
| 413 | resources->maxCullDistances = value; |
| 414 | else if (strcmp(token, "MaxCombinedClipAndCullDistances") == 0) |
| 415 | resources->maxCombinedClipAndCullDistances = value; |
| 416 | else if (strcmp(token, "MaxSamples") == 0) |
| 417 | resources->maxSamples = value; |
| 418 | |
| 419 | else if (strcmp(token, "nonInductiveForLoops") == 0) |
| 420 | resources->limits.nonInductiveForLoops = (value != 0); |
| 421 | else if (strcmp(token, "whileLoops") == 0) |
| 422 | resources->limits.whileLoops = (value != 0); |
| 423 | else if (strcmp(token, "doWhileLoops") == 0) |
| 424 | resources->limits.doWhileLoops = (value != 0); |
| 425 | else if (strcmp(token, "generalUniformIndexing") == 0) |
| 426 | resources->limits.generalUniformIndexing = (value != 0); |
| 427 | else if (strcmp(token, "generalAttributeMatrixVectorIndexing") == 0) |
| 428 | resources->limits.generalAttributeMatrixVectorIndexing = (value != 0); |
| 429 | else if (strcmp(token, "generalVaryingIndexing") == 0) |
| 430 | resources->limits.generalVaryingIndexing = (value != 0); |
| 431 | else if (strcmp(token, "generalSamplerIndexing") == 0) |
| 432 | resources->limits.generalSamplerIndexing = (value != 0); |
| 433 | else if (strcmp(token, "generalVariableIndexing") == 0) |
| 434 | resources->limits.generalVariableIndexing = (value != 0); |
| 435 | else if (strcmp(token, "generalConstantMatrixVectorIndexing") == 0) |
| 436 | resources->limits.generalConstantMatrixVectorIndexing = (value != 0); |
| 437 | else |
| 438 | printf("Warning: unrecognized limit (%s) in configuration file.\n", token); |
| 439 | |
| 440 | token = strtok(0, delims); |
| 441 | } |
| 442 | } |
| 443 | |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 444 | } // end namespace glslang |