ResourceLimits.cpp 28 KB

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