chunk-4E6K4P67.js 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import {
  2. i,
  3. l,
  4. o
  5. } from "./chunk-LGW7TID4.js";
  6. import {
  7. r,
  8. t
  9. } from "./chunk-GZT4BVFP.js";
  10. // node_modules/@arcgis/core/views/webgl/capabilities.js
  11. var n;
  12. var a;
  13. function l2(t2) {
  14. const e = i(t2);
  15. for (; e.length > 1; ) {
  16. const t3 = u(e.shift());
  17. if (t3.available)
  18. return t3;
  19. }
  20. return u(e.shift());
  21. }
  22. function u(t2) {
  23. switch (t2) {
  24. case o.WEBGL1:
  25. return i2();
  26. case o.WEBGL2:
  27. return p();
  28. }
  29. }
  30. function i2() {
  31. return n || (n = x()), n;
  32. }
  33. function p() {
  34. return a || (a = d()), a;
  35. }
  36. var f = class {
  37. constructor() {
  38. this.available = false, this.majorPerformanceCaveat = false, this.maxTextureSize = 0, this.supportsVertexShaderSamplers = false, this.supportsHighPrecisionFragment = false, this.supportsElementIndexUint = false, this.supportsStandardDerivatives = false, this.supportsInstancedArrays = false, this.supportsTextureFloat = false, this.supportsTextureHalfFloat = false, this.supportsColorBufferFloat = false, this.supportsColorBufferFloatBlend = false, this.supportsColorBufferHalfFloat = false;
  39. }
  40. };
  41. var c = class extends f {
  42. constructor() {
  43. super(...arguments), this.type = o.WEBGL1;
  44. }
  45. };
  46. var E = class extends f {
  47. constructor() {
  48. super(...arguments), this.type = o.WEBGL2, this.supportsElementIndexUint = true, this.supportsStandardDerivatives = true, this.supportsInstancedArrays = true, this.supportsTextureFloat = true, this.supportsTextureHalfFloat = true;
  49. }
  50. };
  51. function _(r2, n2) {
  52. if (r2 === o.WEBGL1 && typeof WebGLRenderingContext === void 0 || r2 === o.WEBGL2 && typeof WebGL2RenderingContext === void 0)
  53. return null;
  54. const a2 = document.createElement("canvas");
  55. if (!a2)
  56. return null;
  57. let l3 = l(a2, r2, { failIfMajorPerformanceCaveat: true });
  58. if (t(l3) && (l3 = l(a2, r2), r(l3) && (n2.majorPerformanceCaveat = true)), t(l3))
  59. return l3;
  60. if (r2 === o.WEBGL1) {
  61. const t2 = l3.getParameter(l3.VERSION)?.match(/^WebGL\s+([\d.]*)/);
  62. if (t2) {
  63. const e = parseFloat(t2[1]);
  64. n2.available = e >= 0.94;
  65. }
  66. } else
  67. n2.available = true;
  68. n2.maxTextureSize = l3.getParameter(l3.MAX_TEXTURE_SIZE), n2.supportsVertexShaderSamplers = l3.getParameter(l3.MAX_VERTEX_TEXTURE_IMAGE_UNITS) > 0;
  69. const u2 = l3.getShaderPrecisionFormat(l3.FRAGMENT_SHADER, l3.HIGH_FLOAT);
  70. return u2 && (n2.supportsHighPrecisionFragment = u2.precision > 0), l3;
  71. }
  72. function x() {
  73. const e = new c(), r2 = _(o.WEBGL1, e);
  74. return t(r2) || (e.supportsElementIndexUint = r2.getExtension("OES_element_index_uint") !== null, e.supportsStandardDerivatives = r2.getExtension("OES_standard_derivatives") !== null, e.supportsInstancedArrays = r2.getExtension("ANGLE_instanced_arrays") !== null, e.supportsTextureFloat = r2.getExtension("OES_texture_float") !== null, e.supportsTextureHalfFloat = r2.getExtension("OES_texture_half_float") !== null, e.supportsColorBufferFloat = r2.getExtension("WEBGL_color_buffer_float") !== null, e.supportsColorBufferFloatBlend = r2.getExtension("EXT_float_blend") !== null, e.supportsColorBufferHalfFloat = r2.getExtension("EXT_color_buffer_half_float") !== null), e;
  75. }
  76. function d() {
  77. const e = new E(), r2 = _(o.WEBGL2, e);
  78. return t(r2) || (e.supportsColorBufferFloat = r2.getExtension("EXT_color_buffer_float") !== null, e.supportsColorBufferFloatBlend = r2.getExtension("EXT_float_blend") !== null, e.supportsColorBufferHalfFloat = e.supportsColorBufferFloat || r2.getExtension("EXT_color_buffer_half_float") !== null), e;
  79. }
  80. export {
  81. l2 as l
  82. };
  83. //# sourceMappingURL=chunk-4E6K4P67.js.map