ContextLimits.js 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. /**
  2. * @private
  3. */
  4. var ContextLimits = {
  5. _maximumCombinedTextureImageUnits: 0,
  6. _maximumCubeMapSize: 0,
  7. _maximumFragmentUniformVectors: 0,
  8. _maximumTextureImageUnits: 0,
  9. _maximumRenderbufferSize: 0,
  10. _maximumTextureSize: 0,
  11. _maximumVaryingVectors: 0,
  12. _maximumVertexAttributes: 0,
  13. _maximumVertexTextureImageUnits: 0,
  14. _maximumVertexUniformVectors: 0,
  15. _minimumAliasedLineWidth: 0,
  16. _maximumAliasedLineWidth: 0,
  17. _minimumAliasedPointSize: 0,
  18. _maximumAliasedPointSize: 0,
  19. _maximumViewportWidth: 0,
  20. _maximumViewportHeight: 0,
  21. _maximumTextureFilterAnisotropy: 0,
  22. _maximumDrawBuffers: 0,
  23. _maximumColorAttachments: 0,
  24. _highpFloatSupported: false,
  25. _highpIntSupported: false,
  26. };
  27. Object.defineProperties(ContextLimits, {
  28. /**
  29. * The maximum number of texture units that can be used from the vertex and fragment
  30. * shader with this WebGL implementation. The minimum is eight. If both shaders access the
  31. * same texture unit, this counts as two texture units.
  32. * @memberof ContextLimits
  33. * @type {Number}
  34. * @see {@link https://www.khronos.org/opengles/sdk/docs/man/xhtml/glGet.xml|glGet} with <code>MAX_COMBINED_TEXTURE_IMAGE_UNITS</code>.
  35. */
  36. maximumCombinedTextureImageUnits: {
  37. get: function () {
  38. return ContextLimits._maximumCombinedTextureImageUnits;
  39. },
  40. },
  41. /**
  42. * The approximate maximum cube mape width and height supported by this WebGL implementation.
  43. * The minimum is 16, but most desktop and laptop implementations will support much larger sizes like 8,192.
  44. * @memberof ContextLimits
  45. * @type {Number}
  46. * @see {@link https://www.khronos.org/opengles/sdk/docs/man/xhtml/glGet.xml|glGet} with <code>MAX_CUBE_MAP_TEXTURE_SIZE</code>.
  47. */
  48. maximumCubeMapSize: {
  49. get: function () {
  50. return ContextLimits._maximumCubeMapSize;
  51. },
  52. },
  53. /**
  54. * The maximum number of <code>vec4</code>, <code>ivec4</code>, and <code>bvec4</code>
  55. * uniforms that can be used by a fragment shader with this WebGL implementation. The minimum is 16.
  56. * @memberof ContextLimits
  57. * @type {Number}
  58. * @see {@link https://www.khronos.org/opengles/sdk/docs/man/xhtml/glGet.xml|glGet} with <code>MAX_FRAGMENT_UNIFORM_VECTORS</code>.
  59. */
  60. maximumFragmentUniformVectors: {
  61. get: function () {
  62. return ContextLimits._maximumFragmentUniformVectors;
  63. },
  64. },
  65. /**
  66. * The maximum number of texture units that can be used from the fragment shader with this WebGL implementation. The minimum is eight.
  67. * @memberof ContextLimits
  68. * @type {Number}
  69. * @see {@link https://www.khronos.org/opengles/sdk/docs/man/xhtml/glGet.xml|glGet} with <code>MAX_TEXTURE_IMAGE_UNITS</code>.
  70. */
  71. maximumTextureImageUnits: {
  72. get: function () {
  73. return ContextLimits._maximumTextureImageUnits;
  74. },
  75. },
  76. /**
  77. * The maximum renderbuffer width and height supported by this WebGL implementation.
  78. * The minimum is 16, but most desktop and laptop implementations will support much larger sizes like 8,192.
  79. * @memberof ContextLimits
  80. * @type {Number}
  81. * @see {@link https://www.khronos.org/opengles/sdk/docs/man/xhtml/glGet.xml|glGet} with <code>MAX_RENDERBUFFER_SIZE</code>.
  82. */
  83. maximumRenderbufferSize: {
  84. get: function () {
  85. return ContextLimits._maximumRenderbufferSize;
  86. },
  87. },
  88. /**
  89. * The approximate maximum texture width and height supported by this WebGL implementation.
  90. * The minimum is 64, but most desktop and laptop implementations will support much larger sizes like 8,192.
  91. * @memberof ContextLimits
  92. * @type {Number}
  93. * @see {@link https://www.khronos.org/opengles/sdk/docs/man/xhtml/glGet.xml|glGet} with <code>MAX_TEXTURE_SIZE</code>.
  94. */
  95. maximumTextureSize: {
  96. get: function () {
  97. return ContextLimits._maximumTextureSize;
  98. },
  99. },
  100. /**
  101. * The maximum number of <code>vec4</code> varying variables supported by this WebGL implementation.
  102. * The minimum is eight. Matrices and arrays count as multiple <code>vec4</code>s.
  103. * @memberof ContextLimits
  104. * @type {Number}
  105. * @see {@link https://www.khronos.org/opengles/sdk/docs/man/xhtml/glGet.xml|glGet} with <code>MAX_VARYING_VECTORS</code>.
  106. */
  107. maximumVaryingVectors: {
  108. get: function () {
  109. return ContextLimits._maximumVaryingVectors;
  110. },
  111. },
  112. /**
  113. * The maximum number of <code>vec4</code> vertex attributes supported by this WebGL implementation. The minimum is eight.
  114. * @memberof ContextLimits
  115. * @type {Number}
  116. * @see {@link https://www.khronos.org/opengles/sdk/docs/man/xhtml/glGet.xml|glGet} with <code>MAX_VERTEX_ATTRIBS</code>.
  117. */
  118. maximumVertexAttributes: {
  119. get: function () {
  120. return ContextLimits._maximumVertexAttributes;
  121. },
  122. },
  123. /**
  124. * The maximum number of texture units that can be used from the vertex shader with this WebGL implementation.
  125. * The minimum is zero, which means the GL does not support vertex texture fetch.
  126. * @memberof ContextLimits
  127. * @type {Number}
  128. * @see {@link https://www.khronos.org/opengles/sdk/docs/man/xhtml/glGet.xml|glGet} with <code>MAX_VERTEX_TEXTURE_IMAGE_UNITS</code>.
  129. */
  130. maximumVertexTextureImageUnits: {
  131. get: function () {
  132. return ContextLimits._maximumVertexTextureImageUnits;
  133. },
  134. },
  135. /**
  136. * The maximum number of <code>vec4</code>, <code>ivec4</code>, and <code>bvec4</code>
  137. * uniforms that can be used by a vertex shader with this WebGL implementation. The minimum is 16.
  138. * @memberof ContextLimits
  139. * @type {Number}
  140. * @see {@link https://www.khronos.org/opengles/sdk/docs/man/xhtml/glGet.xml|glGet} with <code>MAX_VERTEX_UNIFORM_VECTORS</code>.
  141. */
  142. maximumVertexUniformVectors: {
  143. get: function () {
  144. return ContextLimits._maximumVertexUniformVectors;
  145. },
  146. },
  147. /**
  148. * The minimum aliased line width, in pixels, supported by this WebGL implementation. It will be at most one.
  149. * @memberof ContextLimits
  150. * @type {Number}
  151. * @see {@link https://www.khronos.org/opengles/sdk/docs/man/xhtml/glGet.xml|glGet} with <code>ALIASED_LINE_WIDTH_RANGE</code>.
  152. */
  153. minimumAliasedLineWidth: {
  154. get: function () {
  155. return ContextLimits._minimumAliasedLineWidth;
  156. },
  157. },
  158. /**
  159. * The maximum aliased line width, in pixels, supported by this WebGL implementation. It will be at least one.
  160. * @memberof ContextLimits
  161. * @type {Number}
  162. * @see {@link https://www.khronos.org/opengles/sdk/docs/man/xhtml/glGet.xml|glGet} with <code>ALIASED_LINE_WIDTH_RANGE</code>.
  163. */
  164. maximumAliasedLineWidth: {
  165. get: function () {
  166. return ContextLimits._maximumAliasedLineWidth;
  167. },
  168. },
  169. /**
  170. * The minimum aliased point size, in pixels, supported by this WebGL implementation. It will be at most one.
  171. * @memberof ContextLimits
  172. * @type {Number}
  173. * @see {@link https://www.khronos.org/opengles/sdk/docs/man/xhtml/glGet.xml|glGet} with <code>ALIASED_POINT_SIZE_RANGE</code>.
  174. */
  175. minimumAliasedPointSize: {
  176. get: function () {
  177. return ContextLimits._minimumAliasedPointSize;
  178. },
  179. },
  180. /**
  181. * The maximum aliased point size, in pixels, supported by this WebGL implementation. It will be at least one.
  182. * @memberof ContextLimits
  183. * @type {Number}
  184. * @see {@link https://www.khronos.org/opengles/sdk/docs/man/xhtml/glGet.xml|glGet} with <code>ALIASED_POINT_SIZE_RANGE</code>.
  185. */
  186. maximumAliasedPointSize: {
  187. get: function () {
  188. return ContextLimits._maximumAliasedPointSize;
  189. },
  190. },
  191. /**
  192. * The maximum supported width of the viewport. It will be at least as large as the visible width of the associated canvas.
  193. * @memberof ContextLimits
  194. * @type {Number}
  195. * @see {@link https://www.khronos.org/opengles/sdk/docs/man/xhtml/glGet.xml|glGet} with <code>MAX_VIEWPORT_DIMS</code>.
  196. */
  197. maximumViewportWidth: {
  198. get: function () {
  199. return ContextLimits._maximumViewportWidth;
  200. },
  201. },
  202. /**
  203. * The maximum supported height of the viewport. It will be at least as large as the visible height of the associated canvas.
  204. * @memberof ContextLimits
  205. * @type {Number}
  206. * @see {@link https://www.khronos.org/opengles/sdk/docs/man/xhtml/glGet.xml|glGet} with <code>MAX_VIEWPORT_DIMS</code>.
  207. */
  208. maximumViewportHeight: {
  209. get: function () {
  210. return ContextLimits._maximumViewportHeight;
  211. },
  212. },
  213. /**
  214. * The maximum degree of anisotropy for texture filtering
  215. * @memberof ContextLimits
  216. * @type {Number}
  217. */
  218. maximumTextureFilterAnisotropy: {
  219. get: function () {
  220. return ContextLimits._maximumTextureFilterAnisotropy;
  221. },
  222. },
  223. /**
  224. * The maximum number of simultaneous outputs that may be written in a fragment shader.
  225. * @memberof ContextLimits
  226. * @type {Number}
  227. */
  228. maximumDrawBuffers: {
  229. get: function () {
  230. return ContextLimits._maximumDrawBuffers;
  231. },
  232. },
  233. /**
  234. * The maximum number of color attachments supported.
  235. * @memberof ContextLimits
  236. * @type {Number}
  237. */
  238. maximumColorAttachments: {
  239. get: function () {
  240. return ContextLimits._maximumColorAttachments;
  241. },
  242. },
  243. /**
  244. * High precision float supported (<code>highp</code>) in fragment shaders.
  245. * @memberof ContextLimits
  246. * @type {Boolean}
  247. */
  248. highpFloatSupported: {
  249. get: function () {
  250. return ContextLimits._highpFloatSupported;
  251. },
  252. },
  253. /**
  254. * High precision int supported (<code>highp</code>) in fragment shaders.
  255. * @memberof ContextLimits
  256. * @type {Boolean}
  257. */
  258. highpIntSupported: {
  259. get: function () {
  260. return ContextLimits._highpIntSupported;
  261. },
  262. },
  263. });
  264. export default ContextLimits;