ContextLimits.js 9.6 KB

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