@antv/g-webgpu 1.2.0 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -393,11 +393,10 @@
393
393
  }
394
394
 
395
395
  function _setPrototypeOf(o, p) {
396
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
396
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
397
397
  o.__proto__ = p;
398
398
  return o;
399
399
  };
400
-
401
400
  return _setPrototypeOf(o, p);
402
401
  }
403
402
 
@@ -3497,7 +3496,7 @@
3497
3496
  }
3498
3497
 
3499
3498
  function _extends() {
3500
- _extends = Object.assign || function (target) {
3499
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
3501
3500
  for (var i = 1; i < arguments.length; i++) {
3502
3501
  var source = arguments[i];
3503
3502
 
@@ -3510,7 +3509,6 @@
3510
3509
 
3511
3510
  return target;
3512
3511
  };
3513
-
3514
3512
  return _extends.apply(this, arguments);
3515
3513
  }
3516
3514
 
@@ -3522,11 +3520,10 @@
3522
3520
  }
3523
3521
 
3524
3522
  function _setPrototypeOf$1(o, p) {
3525
- _setPrototypeOf$1 = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
3523
+ _setPrototypeOf$1 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
3526
3524
  o.__proto__ = p;
3527
3525
  return o;
3528
3526
  };
3529
-
3530
3527
  return _setPrototypeOf$1(o, p);
3531
3528
  }
3532
3529
 
@@ -10053,6 +10050,29 @@
10053
10050
 
10054
10051
  _this2.renderingService.dirtify();
10055
10052
  });
10053
+ };
10054
+
10055
+ _proto.shouldMergeColor = function shouldMergeColor(o1, o2, name) {
10056
+ // c1: CSSRGB | CSSGradientValue[] | Pattern, c2: CSSRGB | CSSGradientValue[] | Pattern
10057
+ // can't be merged if gradients & pattern used
10058
+ var source = o1.parsedStyle[name];
10059
+ var target = o2.parsedStyle[name]; // constant color value
10060
+
10061
+ if (source instanceof g.CSSRGB && target instanceof g.CSSRGB) {
10062
+ return true;
10063
+ } // pattern
10064
+
10065
+
10066
+ if (g.isPattern(source) && g.isPattern(target) && source.image === target.image) {
10067
+ return true;
10068
+ } // gradients
10069
+
10070
+
10071
+ if (Array.isArray(source) && Array.isArray(target) && o1.style[name] === o2.style[name]) {
10072
+ return true;
10073
+ }
10074
+
10075
+ return false;
10056
10076
  }
10057
10077
  /**
10058
10078
  * should be merged into current InstancedMesh
@@ -10073,6 +10093,10 @@
10073
10093
  return false;
10074
10094
  }
10075
10095
 
10096
+ if (!this.shouldMergeColor(this.instance, object, 'fill') || !this.shouldMergeColor(this.instance, object, 'stroke')) {
10097
+ return false;
10098
+ }
10099
+
10076
10100
  return true;
10077
10101
  };
10078
10102
 
@@ -11058,18 +11082,6 @@
11058
11082
 
11059
11083
  if (!shouldMerge) {
11060
11084
  return false;
11061
- } // should split when using gradient & pattern
11062
-
11063
-
11064
- var instance = this.instance;
11065
-
11066
- if (instance.nodeName === g.Shape.LINE) {
11067
- var source = instance.parsedStyle.stroke;
11068
- var target = object.parsedStyle.stroke; // can't be merged if stroke's types are different
11069
-
11070
- if (source.toString() !== target.toString()) {
11071
- return false;
11072
- }
11073
11085
  }
11074
11086
 
11075
11087
  return true;
@@ -11619,7 +11631,7 @@
11619
11631
  return piMod(Math.atan2(dy, dx));
11620
11632
  }
11621
11633
  };
11622
- var frag$2 = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4 u_FillColor;\n vec4 u_StrokeColor;\n float u_StrokeWidth;\n float u_Opacity;\n float u_FillOpacity;\n float u_StrokeOpacity;\n float u_Expand;\n float u_MiterLimit;\n float u_ScaleMode;\n float u_Alignment;\n vec3 u_PickingColor;\n float u_Dash;\n float u_Gap;\n float u_DashOffset;\n float u_Visible;\n float u_ZIndex;\n float u_IncreasedLineWidthForHitTesting;\n};\n\nin vec4 v_Distance;\nin vec4 v_Arc;\nin float v_Type;\nin float v_Travel;\n\nout vec4 outputColor;\n\n#define COLOR_SCALE 1. / 255.\n\nvoid main(){\n if (u_Visible < 0.5) {\n discard;\n }\n\n float alpha = 1.0;\n float lineWidth = v_Distance.w;\n if (v_Type < 0.5) {\n float left = max(v_Distance.x - 0.5, -v_Distance.w);\n float right = min(v_Distance.x + 0.5, v_Distance.w);\n float near = v_Distance.y - 0.5;\n float far = min(v_Distance.y + 0.5, 0.0);\n float top = v_Distance.z - 0.5;\n float bottom = min(v_Distance.z + 0.5, 0.0);\n alpha = max(right - left, 0.0) * max(bottom - top, 0.0) * max(far - near, 0.0);\n } else if (v_Type < 1.5) {\n float a1 = clamp(v_Distance.x + 0.5 - lineWidth, 0.0, 1.0);\n float a2 = clamp(v_Distance.x + 0.5 + lineWidth, 0.0, 1.0);\n float b1 = clamp(v_Distance.y + 0.5 - lineWidth, 0.0, 1.0);\n float b2 = clamp(v_Distance.y + 0.5 + lineWidth, 0.0, 1.0);\n alpha = a2 * b2 - a1 * b1;\n } else if (v_Type < 2.5) {\n alpha *= max(min(v_Distance.x + 0.5, 1.0), 0.0);\n alpha *= max(min(v_Distance.y + 0.5, 1.0), 0.0);\n alpha *= max(min(v_Distance.z + 0.5, 1.0), 0.0);\n } else if (v_Type < 3.5) {\n float a1 = clamp(v_Distance.x + 0.5 - lineWidth, 0.0, 1.0);\n float a2 = clamp(v_Distance.x + 0.5 + lineWidth, 0.0, 1.0);\n float b1 = clamp(v_Distance.y + 0.5 - lineWidth, 0.0, 1.0);\n float b2 = clamp(v_Distance.y + 0.5 + lineWidth, 0.0, 1.0);\n float alpha_miter = a2 * b2 - a1 * b1;\n float alpha_plane = max(min(v_Distance.z + 0.5, 1.0), 0.0);\n float d = length(v_Arc.xy);\n float circle_hor = max(min(v_Arc.w, d + 0.5) - max(-v_Arc.w, d - 0.5), 0.0);\n float circle_vert = min(v_Arc.w * 2.0, 1.0);\n float alpha_circle = circle_hor * circle_vert;\n alpha = min(alpha_miter, max(alpha_circle, alpha_plane));\n } else {\n float a1 = clamp(v_Distance.x + 0.5 - lineWidth, 0.0, 1.0);\n float a2 = clamp(v_Distance.x + 0.5 + lineWidth, 0.0, 1.0);\n float b1 = clamp(v_Distance.y + 0.5 - lineWidth, 0.0, 1.0);\n float b2 = clamp(v_Distance.y + 0.5 + lineWidth, 0.0, 1.0);\n alpha = a2 * b2 - a1 * b1;\n alpha *= max(min(v_Distance.z + 0.5, 1.0), 0.0);\n }\n\n if (u_Dash + u_Gap > 1.0) {\n float travel = mod(v_Travel + u_Gap * 0.5 + u_DashOffset, u_Dash + u_Gap) - (u_Gap * 0.5);\n float left = max(travel - 0.5, -0.5);\n float right = min(travel + 0.5, u_Gap + 0.5);\n alpha *= max(0.0, right - left);\n }\n\n if (u_IsPicking > 0.5) {\n vec3 pickingColor = COLOR_SCALE * u_PickingColor;\n if (pickingColor.x == 0.0 && pickingColor.y == 0.0 && pickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(pickingColor, 1.0);\n } else {\n outputColor = u_StrokeColor;\n outputColor.a *= alpha * u_Opacity * u_StrokeOpacity;\n }\n}"; // eslint-disable-line
11634
+ var frag$2 = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4 u_FillColor;\n vec4 u_StrokeColor;\n float u_StrokeWidth;\n float u_Opacity;\n float u_FillOpacity;\n float u_StrokeOpacity;\n float u_Expand;\n float u_MiterLimit;\n float u_ScaleMode;\n float u_Alignment;\n vec3 u_PickingColor;\n float u_Dash;\n float u_Gap;\n float u_DashOffset;\n float u_Visible;\n float u_ZIndex;\n float u_IncreasedLineWidthForHitTesting;\n};\n\nin vec4 v_Distance;\nin vec4 v_Arc;\nin float v_Type;\nin float v_Travel;\n\nout vec4 outputColor;\n\n#define COLOR_SCALE 1. / 255.\n\nvoid main(){\n if (u_Visible < 0.5) {\n discard;\n }\n\n float alpha = 1.0;\n float lineWidth = v_Distance.w;\n if (v_Type < 0.5) {\n float left = max(v_Distance.x - 0.5, -v_Distance.w);\n float right = min(v_Distance.x + 0.5, v_Distance.w);\n float near = v_Distance.y - 0.5;\n float far = min(v_Distance.y + 0.5, 0.0);\n float top = v_Distance.z - 0.5;\n float bottom = min(v_Distance.z + 0.5, 0.0);\n alpha = max(right - left, 0.0) * max(bottom - top, 0.0) * max(far - near, 0.0);\n } else if (v_Type < 1.5) {\n float a1 = clamp(v_Distance.x + 0.5 - lineWidth, 0.0, 1.0);\n float a2 = clamp(v_Distance.x + 0.5 + lineWidth, 0.0, 1.0);\n float b1 = clamp(v_Distance.y + 0.5 - lineWidth, 0.0, 1.0);\n float b2 = clamp(v_Distance.y + 0.5 + lineWidth, 0.0, 1.0);\n alpha = a2 * b2 - a1 * b1;\n } else if (v_Type < 2.5) {\n alpha *= max(min(v_Distance.x + 0.5, 1.0), 0.0);\n alpha *= max(min(v_Distance.y + 0.5, 1.0), 0.0);\n alpha *= max(min(v_Distance.z + 0.5, 1.0), 0.0);\n } else if (v_Type < 3.5) {\n float a1 = clamp(v_Distance.x + 0.5 - lineWidth, 0.0, 1.0);\n float a2 = clamp(v_Distance.x + 0.5 + lineWidth, 0.0, 1.0);\n float b1 = clamp(v_Distance.y + 0.5 - lineWidth, 0.0, 1.0);\n float b2 = clamp(v_Distance.y + 0.5 + lineWidth, 0.0, 1.0);\n float alpha_miter = a2 * b2 - a1 * b1;\n float alpha_plane = max(min(v_Distance.z + 0.5, 1.0), 0.0);\n float d = length(v_Arc.xy);\n float circle_hor = max(min(v_Arc.w, d + 0.5) - max(-v_Arc.w, d - 0.5), 0.0);\n float circle_vert = min(v_Arc.w * 2.0, 1.0);\n float alpha_circle = circle_hor * circle_vert;\n alpha = min(alpha_miter, max(alpha_circle, alpha_plane));\n } else {\n float a1 = clamp(v_Distance.x + 0.5 - lineWidth, 0.0, 1.0);\n float a2 = clamp(v_Distance.x + 0.5 + lineWidth, 0.0, 1.0);\n float b1 = clamp(v_Distance.y + 0.5 - lineWidth, 0.0, 1.0);\n float b2 = clamp(v_Distance.y + 0.5 + lineWidth, 0.0, 1.0);\n alpha = a2 * b2 - a1 * b1;\n alpha *= max(min(v_Distance.z + 0.5, 1.0), 0.0);\n }\n\n if (u_Dash + u_Gap > 1.0) {\n float scalingFactor = sqrt(u_ModelMatrix[0][0] * u_ModelMatrix[0][0] + u_ModelMatrix[0][1] * u_ModelMatrix[0][1] + u_ModelMatrix[0][2] * u_ModelMatrix[0][2]);\n float travel = mod(v_Travel + u_Gap * scalingFactor * 0.5 + u_DashOffset, u_Dash * scalingFactor + u_Gap * scalingFactor) - (u_Gap * scalingFactor * 0.5);\n float left = max(travel - 0.5, -0.5);\n float right = min(travel + 0.5, u_Gap * scalingFactor + 0.5);\n alpha *= max(0.0, right - left);\n }\n\n if (u_IsPicking > 0.5) {\n vec3 pickingColor = COLOR_SCALE * u_PickingColor;\n if (pickingColor.x == 0.0 && pickingColor.y == 0.0 && pickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(pickingColor, 1.0);\n } else {\n outputColor = u_StrokeColor;\n outputColor.a *= alpha * u_Opacity * u_StrokeOpacity;\n }\n}"; // eslint-disable-line
11623
11635
 
11624
11636
  var vert$2 = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4 u_FillColor;\n vec4 u_StrokeColor;\n float u_StrokeWidth;\n float u_Opacity;\n float u_FillOpacity;\n float u_StrokeOpacity;\n float u_Expand;\n float u_MiterLimit;\n float u_ScaleMode;\n float u_Alignment;\n vec3 u_PickingColor;\n float u_Dash;\n float u_Gap;\n float u_DashOffset;\n float u_Visible;\n float u_ZIndex;\n float u_IncreasedLineWidthForHitTesting;\n};\n\nlayout(location = PREV) in vec2 a_Prev;\nlayout(location = POINT1) in vec2 a_Point1;\nlayout(location = POINT2) in vec2 a_Point2;\nlayout(location = NEXT) in vec2 a_Next;\nlayout(location = VERTEX_JOINT) in float a_VertexJoint;\nlayout(location = VERTEX_NUM) in float a_VertexNum;\nlayout(location = TRAVEL) in float a_Travel;\n\nconst float FILL = 1.0;\nconst float BEVEL = 4.0;\nconst float MITER = 8.0;\nconst float ROUND = 12.0;\nconst float JOINT_CAP_BUTT = 16.0;\nconst float JOINT_CAP_SQUARE = 18.0;\nconst float JOINT_CAP_ROUND = 20.0;\nconst float FILL_EXPAND = 24.0;\nconst float CAP_BUTT = 1.0;\nconst float CAP_SQUARE = 2.0;\nconst float CAP_ROUND = 3.0;\nconst float CAP_BUTT2 = 4.0;\n\nout vec4 v_Distance;\nout vec4 v_Arc;\nout float v_Type;\nout float v_Travel;\n\nvec2 doBisect(\n vec2 norm, float len, vec2 norm2, float len2, float dy, float inner\n) {\n vec2 bisect = (norm + norm2) / 2.0;\n bisect /= dot(norm, bisect);\n vec2 shift = dy * bisect;\n if (inner > 0.5) {\n if (len < len2) {\n if (abs(dy * (bisect.x * norm.y - bisect.y * norm.x)) > len) {\n return dy * norm;\n }\n } else {\n if (abs(dy * (bisect.x * norm2.y - bisect.y * norm2.x)) > len2) {\n return dy * norm;\n }\n }\n }\n return dy * bisect;\n}\n\nvoid main() {\n vec2 pointA = (u_ModelMatrix * vec4(a_Point1, 0., 1.0)).xy;\n vec2 pointB = (u_ModelMatrix * vec4(a_Point2, 0., 1.0)).xy;\n\n vec2 xBasis = pointB - pointA;\n float len = length(xBasis);\n vec2 forward = xBasis / len;\n vec2 norm = vec2(forward.y, -forward.x);\n\n float type = a_VertexJoint;\n\n float lineWidth;\n if (u_IsPicking > 0.5) {\n lineWidth = u_IncreasedLineWidthForHitTesting + u_StrokeWidth;\n } else {\n lineWidth = u_StrokeWidth;\n }\n\n if (u_ScaleMode > 2.5) {\n lineWidth *= length(u_ModelMatrix * vec4(1.0, 0.0, 0.0, 0.0));\n } else if (u_ScaleMode > 1.5) {\n lineWidth *= length(u_ModelMatrix * vec4(0.0, 1.0, 0.0, 0.0));\n } else if (u_ScaleMode > 0.5) {\n vec2 avgDiag = (u_ModelMatrix * vec4(1.0, 1.0, 0.0, 0.0)).xy;\n lineWidth *= sqrt(dot(avgDiag, avgDiag) * 0.5);\n }\n float capType = floor(type / 32.0);\n type -= capType * 32.0;\n v_Arc = vec4(0.0);\n lineWidth *= 0.5;\n float lineAlignment = 2.0 * u_Alignment - 1.0;\n\n vec2 pos;\n\n if (capType == CAP_ROUND) {\n if (a_VertexNum < 3.5) {\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n return;\n }\n type = JOINT_CAP_ROUND;\n capType = 0.0;\n }\n\n if (type >= BEVEL) {\n float dy = lineWidth + u_Expand;\n float inner = 0.0;\n if (a_VertexNum >= 1.5) {\n dy = -dy;\n inner = 1.0;\n }\n\n vec2 base, next, xBasis2, bisect;\n float flag = 0.0;\n float sign2 = 1.0;\n if (a_VertexNum < 0.5 || a_VertexNum > 2.5 && a_VertexNum < 3.5) {\n next = (u_ModelMatrix * vec4(a_Prev, 0.0, 1.0)).xy;\n base = pointA;\n flag = type - floor(type / 2.0) * 2.0;\n sign2 = -1.0;\n\n } else {\n next = (u_ModelMatrix * vec4(a_Next, 0.0, 1.0)).xy;\n base = pointB;\n if (type >= MITER && type < MITER + 3.5) {\n flag = step(MITER + 1.5, type);\n // check miter limit here?\n }\n }\n xBasis2 = next - base;\n float len2 = length(xBasis2);\n vec2 norm2 = vec2(xBasis2.y, -xBasis2.x) / len2;\n float D = norm.x * norm2.y - norm.y * norm2.x;\n if (D < 0.0) {\n inner = 1.0 - inner;\n }\n norm2 *= sign2;\n\n if (abs(lineAlignment) > 0.01) {\n float shift = lineWidth * lineAlignment;\n pointA += norm * shift;\n pointB += norm * shift;\n if (abs(D) < 0.01) {\n base += norm * shift;\n } else {\n base += doBisect(norm, len, norm2, len2, shift, 0.0);\n }\n }\n\n float collinear = step(0.0, dot(norm, norm2));\n v_Type = 0.0;\n float dy2 = -1000.0;\n float dy3 = -1000.0;\n if (abs(D) < 0.01 && collinear < 0.5) {\n if (type >= ROUND && type < ROUND + 1.5) {\n type = JOINT_CAP_ROUND;\n }\n //TODO: BUTT here too\n }\n\n if (a_VertexNum < 3.5) {\n if (abs(D) < 0.01) {\n pos = dy * norm;\n } else {\n if (flag < 0.5 && inner < 0.5) {\n pos = dy * norm;\n } else {\n pos = doBisect(norm, len, norm2, len2, dy, inner);\n }\n }\n if (capType >= CAP_BUTT && capType < CAP_ROUND) {\n float extra = step(CAP_SQUARE, capType) * lineWidth;\n vec2 back = -forward;\n if (a_VertexNum < 0.5 || a_VertexNum > 2.5) {\n pos += back * (u_Expand + extra);\n dy2 = u_Expand;\n } else {\n dy2 = dot(pos + base - pointA, back) - extra;\n }\n }\n if (type >= JOINT_CAP_BUTT && type < JOINT_CAP_SQUARE + 0.5) {\n float extra = step(JOINT_CAP_SQUARE, type) * lineWidth;\n if (a_VertexNum < 0.5 || a_VertexNum > 2.5) {\n dy3 = dot(pos + base - pointB, forward) - extra;\n } else {\n pos += forward * (u_Expand + extra);\n dy3 = u_Expand;\n if (capType >= CAP_BUTT) {\n dy2 -= u_Expand + extra;\n }\n }\n }\n } else if (type >= JOINT_CAP_ROUND && type < JOINT_CAP_ROUND + 1.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n vec2 d2 = abs(dy) * forward;\n if (a_VertexNum < 4.5) {\n dy = -dy;\n pos = dy * norm;\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum < 6.5) {\n pos = dy * norm + d2;\n v_Arc.x = abs(dy);\n } else {\n dy = -dy;\n pos = dy * norm + d2;\n v_Arc.x = abs(dy);\n }\n dy2 = 0.0;\n v_Arc.y = dy;\n v_Arc.z = 0.0;\n v_Arc.w = lineWidth;\n v_Type = 3.0;\n } else if (abs(D) < 0.01) {\n pos = dy * norm;\n } else {\n if (type >= ROUND && type < ROUND + 1.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n if (a_VertexNum < 4.5) {\n pos = doBisect(norm, len, norm2, len2, -dy, 1.0);\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum > 7.5) {\n pos = dy * norm2;\n } else {\n pos = doBisect(norm, len, norm2, len2, dy, 0.0);\n float d2 = abs(dy);\n if (length(pos) > abs(dy) * 1.5) {\n if (a_VertexNum < 6.5) {\n pos.x = dy * norm.x - d2 * norm.y;\n pos.y = dy * norm.y + d2 * norm.x;\n } else {\n pos.x = dy * norm2.x + d2 * norm2.y;\n pos.y = dy * norm2.y - d2 * norm2.x;\n }\n }\n }\n vec2 norm3 = normalize(norm + norm2);\n float sign = step(0.0, dy) * 2.0 - 1.0;\n v_Arc.x = sign * dot(pos, norm3);\n v_Arc.y = pos.x * norm3.y - pos.y * norm3.x;\n v_Arc.z = dot(norm, norm3) * lineWidth;\n v_Arc.w = lineWidth;\n dy = -sign * dot(pos, norm);\n dy2 = -sign * dot(pos, norm2);\n dy3 = v_Arc.z - v_Arc.x;\n v_Type = 3.0;\n } else {\n float hit = 0.0;\n if (type >= BEVEL && type < BEVEL + 1.5) {\n if (dot(norm, norm2) > 0.0) {\n type = MITER;\n }\n }\n if (type >= MITER && type < MITER + 3.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n float sign = step(0.0, dy) * 2.0 - 1.0;\n pos = doBisect(norm, len, norm2, len2, dy, 0.0);\n if (length(pos) > abs(dy) * u_MiterLimit) {\n type = BEVEL;\n } else {\n if (a_VertexNum < 4.5) {\n dy = -dy;\n pos = doBisect(norm, len, norm2, len2, dy, 1.0);\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum > 6.5) {\n pos = dy * norm2;\n }\n v_Type = 1.0;\n dy = -sign * dot(pos, norm);\n dy2 = -sign * dot(pos, norm2);\n hit = 1.0;\n }\n }\n if (type >= BEVEL && type < BEVEL + 1.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n float d2 = abs(dy);\n vec2 pos3 = vec2(dy * norm.x - d2 * norm.y, dy * norm.y + d2 * norm.x);\n vec2 pos4 = vec2(dy * norm2.x + d2 * norm2.y, dy * norm2.y - d2 * norm2.x);\n if (a_VertexNum < 4.5) {\n pos = doBisect(norm, len, norm2, len2, -dy, 1.0);\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum > 7.5) {\n pos = dy * norm2;\n } else {\n if (a_VertexNum < 6.5) {\n pos = pos3;\n } else {\n pos = pos4;\n }\n }\n vec2 norm3 = normalize(norm + norm2);\n float sign = step(0.0, dy) * 2.0 - 1.0;\n dy = -sign * dot(pos, norm);\n dy2 = -sign * dot(pos, norm2);\n dy3 = (-sign * dot(pos, norm3)) + lineWidth;\n v_Type = 4.0;\n hit = 1.0;\n }\n if (hit < 0.5) {\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n return;\n }\n }\n }\n pos += base;\n v_Distance = vec4(dy, dy2, dy3, lineWidth) * u_DevicePixelRatio;\n v_Arc = v_Arc * u_DevicePixelRatio;\n v_Travel = a_Travel + dot(pos - pointA, vec2(-norm.y, norm.x));\n }\n\n gl_Position = u_ProjectionMatrix * u_ViewMatrix * vec4(pos, u_ZIndex, 1.0);\n}"; // eslint-disable-line
11625
11637
 
@@ -11991,7 +12003,7 @@
11991
12003
  var triangles = [];
11992
12004
 
11993
12005
  if (object.nodeName === g.Shape.POLYLINE || object.nodeName === g.Shape.POLYGON) {
11994
- points = object.parsedStyle.points.points.reduce(function (prev, cur) {
12006
+ points[0] = object.parsedStyle.points.points.reduce(function (prev, cur) {
11995
12007
  prev.push(cur[0] - defX, cur[1] - defY);
11996
12008
  return prev;
11997
12009
  }, []); // close polygon, dealing with extra joint
@@ -11999,19 +12011,19 @@
11999
12011
  if (object.nodeName === g.Shape.POLYGON) {
12000
12012
  if (needEarcut) {
12001
12013
  // use earcut for triangulation
12002
- triangles = earcut_1(points, [], 2);
12014
+ triangles = earcut_1(points[0], [], 2);
12003
12015
  return {
12004
- pointsBuffer: points,
12016
+ pointsBuffer: points[0],
12005
12017
  travelBuffer: [],
12006
12018
  triangles: triangles,
12007
- instancedCount: Math.round(points.length / stridePoints)
12019
+ instancedCount: Math.round(points[0].length / stridePoints)
12008
12020
  };
12009
12021
  } else {
12010
- var _points;
12022
+ var _points$;
12011
12023
 
12012
- points.push(points[0], points[1]);
12024
+ points[0].push(points[0][0], points[0][1]);
12013
12025
 
12014
- (_points = points).push.apply(_points, addTailSegment(points[0], points[1], points[2], points[3]));
12026
+ (_points$ = points[0]).push.apply(_points$, addTailSegment(points[0][0], points[0][1], points[0][2], points[0][3]));
12015
12027
  }
12016
12028
  }
12017
12029
  } else if (object.nodeName === g.Shape.PATH || object.nodeName === g.Shape.CIRCLE || object.nodeName === g.Shape.ELLIPSE || object.nodeName === g.Shape.RECT) {
@@ -12045,36 +12057,43 @@
12045
12057
  return zCommandIndexes.includes(i) ? ['Z'] : c;
12046
12058
  });
12047
12059
  var startPointIndex = -1;
12060
+ var mCommandsNum = -1;
12048
12061
  curve.forEach(function (_ref) {
12049
12062
  var command = _ref[0],
12050
12063
  params = _ref.slice(1);
12051
12064
 
12052
12065
  if (command === 'M') {
12053
- startPointIndex = points.length;
12054
- points.push(params[0] - defX, params[1] - defY);
12066
+ mCommandsNum++;
12067
+ points[mCommandsNum] = [];
12068
+ startPointIndex = points[mCommandsNum].length;
12069
+ points[mCommandsNum].push(params[0] - defX, params[1] - defY);
12055
12070
  } else if (command === 'C') {
12056
- curveTo(params[0] - defX, params[1] - defY, params[2] - defX, params[3] - defY, params[4] - defX, params[5] - defY, points);
12071
+ curveTo(params[0] - defX, params[1] - defY, params[2] - defX, params[3] - defY, params[4] - defX, params[5] - defY, points[mCommandsNum]);
12057
12072
  } else if (command === 'Z' && (object.nodeName === g.Shape.PATH || object.nodeName === g.Shape.RECT)) {
12058
- var _points2;
12073
+ var _points$mCommandsNum;
12059
12074
 
12060
12075
  var epsilon = 0.0001; // skip if already closed
12061
12076
 
12062
- if (Math.abs(points[points.length - 2] - points[startPointIndex]) > epsilon || Math.abs(points[points.length - 1] - points[startPointIndex + 1]) > epsilon) {
12063
- points.push(points[startPointIndex], points[startPointIndex + 1]);
12077
+ if (Math.abs(points[mCommandsNum][points[mCommandsNum].length - 2] - points[mCommandsNum][startPointIndex]) > epsilon || Math.abs(points[mCommandsNum][points[mCommandsNum].length - 1] - points[mCommandsNum][startPointIndex + 1]) > epsilon) {
12078
+ points[mCommandsNum].push(points[mCommandsNum][startPointIndex], points[mCommandsNum][startPointIndex + 1]);
12064
12079
  }
12065
12080
 
12066
- (_points2 = points).push.apply(_points2, addTailSegment(points[startPointIndex], points[startPointIndex + 1], points[startPointIndex + 2], points[startPointIndex + 3]));
12081
+ (_points$mCommandsNum = points[mCommandsNum]).push.apply(_points$mCommandsNum, addTailSegment(points[mCommandsNum][startPointIndex], points[mCommandsNum][startPointIndex + 1], points[mCommandsNum][startPointIndex + 2], points[mCommandsNum][startPointIndex + 3]));
12067
12082
  }
12068
12083
  });
12069
12084
 
12070
12085
  if (needEarcut) {
12071
- // use earcut for triangulation
12072
- triangles = earcut_1(points, [], 2);
12086
+ var pointsBuffer = points.reduce(function (prev, cur) {
12087
+ prev.push.apply(prev, cur);
12088
+ return prev;
12089
+ }, []); // use earcut for triangulation
12090
+
12091
+ triangles = earcut_1(pointsBuffer, [], 2);
12073
12092
  return {
12074
- pointsBuffer: points,
12093
+ pointsBuffer: pointsBuffer,
12075
12094
  travelBuffer: [],
12076
12095
  triangles: triangles,
12077
- instancedCount: Math.round(points.length / stridePoints)
12096
+ instancedCount: Math.round(pointsBuffer.length / stridePoints)
12078
12097
  };
12079
12098
  }
12080
12099
  }
@@ -12095,56 +12114,72 @@
12095
12114
  endJoint = JOINT_TYPE.JOINT_CAP_SQUARE;
12096
12115
  }
12097
12116
 
12098
- var j = (Math.round(0 / stridePoints) + 2) * strideFloats; // const needDash = !isNil(lineDash);
12117
+ return points.map(function (points) {
12118
+ var j = (Math.round(0 / stridePoints) + 2) * strideFloats; // const needDash = !isNil(lineDash);
12099
12119
 
12100
- var dist = 0;
12101
- var pointsBuffer = [];
12102
- var travelBuffer = [];
12120
+ var dist = 0;
12121
+ var pointsBuffer = [];
12122
+ var travelBuffer = [];
12103
12123
 
12104
- for (var i = 0; i < points.length; i += stridePoints) {
12105
- // calc travel
12106
- // if (needDash) {
12107
- if (i > 1) {
12108
- dist += Math.sqrt(Math.pow(points[i] - points[i - 2], 2) + Math.pow(points[i + 1] - points[i + 1 - 2], 2));
12109
- }
12124
+ for (var i = 0; i < points.length; i += stridePoints) {
12125
+ // calc travel
12126
+ // if (needDash) {
12127
+ if (i > 1) {
12128
+ dist += Math.sqrt(Math.pow(points[i] - points[i - 2], 2) + Math.pow(points[i + 1] - points[i + 1 - 2], 2));
12129
+ }
12110
12130
 
12111
- travelBuffer.push(dist); // } else {
12112
- // travelBuffer.push(0);
12113
- // }
12131
+ travelBuffer.push(dist); // } else {
12132
+ // travelBuffer.push(0);
12133
+ // }
12114
12134
 
12115
- pointsBuffer[j++] = points[i];
12116
- pointsBuffer[j++] = points[i + 1];
12117
- pointsBuffer[j] = jointType;
12135
+ pointsBuffer[j++] = points[i];
12136
+ pointsBuffer[j++] = points[i + 1];
12137
+ pointsBuffer[j] = jointType;
12118
12138
 
12119
- if (i == 0 && capType !== JOINT_TYPE.CAP_ROUND) {
12120
- pointsBuffer[j] += capType;
12121
- }
12139
+ if (i == 0 && capType !== JOINT_TYPE.CAP_ROUND) {
12140
+ pointsBuffer[j] += capType;
12141
+ }
12142
+
12143
+ if (i + stridePoints * 2 >= points.length) {
12144
+ pointsBuffer[j] += endJoint - jointType;
12145
+ } else if (i + stridePoints >= points.length) {
12146
+ pointsBuffer[j] = 0;
12147
+ }
12122
12148
 
12123
- if (i + stridePoints * 2 >= points.length) {
12124
- pointsBuffer[j] += endJoint - jointType;
12125
- } else if (i + stridePoints >= points.length) {
12126
- pointsBuffer[j] = 0;
12149
+ j++;
12127
12150
  }
12128
12151
 
12129
- j++;
12130
- }
12152
+ pointsBuffer[j++] = points[points.length - 4];
12153
+ pointsBuffer[j++] = points[points.length - 3];
12154
+ pointsBuffer[j++] = 0;
12155
+ pointsBuffer[0] = points[0];
12156
+ pointsBuffer[1] = points[1];
12157
+ pointsBuffer[2] = 0;
12158
+ pointsBuffer[3] = points[2];
12159
+ pointsBuffer[4] = points[3];
12160
+ pointsBuffer[5] = capType === JOINT_TYPE.CAP_ROUND ? capType : 0;
12161
+ var instancedCount = Math.round(points.length / stridePoints);
12162
+ return {
12163
+ pointsBuffer: pointsBuffer,
12164
+ travelBuffer: travelBuffer,
12165
+ triangles: triangles,
12166
+ instancedCount: instancedCount
12167
+ };
12168
+ }).reduce(function (prev, cur) {
12169
+ var _prev$pointsBuffer, _prev$travelBuffer;
12131
12170
 
12132
- pointsBuffer[j++] = points[points.length - 4];
12133
- pointsBuffer[j++] = points[points.length - 3];
12134
- pointsBuffer[j++] = 0;
12135
- pointsBuffer[0] = points[0];
12136
- pointsBuffer[1] = points[1];
12137
- pointsBuffer[2] = 0;
12138
- pointsBuffer[3] = points[2];
12139
- pointsBuffer[4] = points[3];
12140
- pointsBuffer[5] = capType === JOINT_TYPE.CAP_ROUND ? capType : 0;
12141
- var instancedCount = Math.round(points.length / stridePoints);
12142
- return {
12143
- pointsBuffer: pointsBuffer,
12144
- travelBuffer: travelBuffer,
12171
+ (_prev$pointsBuffer = prev.pointsBuffer).push.apply(_prev$pointsBuffer, cur.pointsBuffer);
12172
+
12173
+ (_prev$travelBuffer = prev.travelBuffer).push.apply(_prev$travelBuffer, cur.travelBuffer);
12174
+
12175
+ prev.instancedCount += cur.instancedCount;
12176
+ return prev;
12177
+ }, {
12178
+ pointsBuffer: [],
12179
+ travelBuffer: [],
12145
12180
  triangles: triangles,
12146
- instancedCount: instancedCount
12147
- };
12181
+ instancedCount: 0
12182
+ });
12148
12183
  }
12149
12184
 
12150
12185
  function getJointType(lineJoin) {
@@ -13907,6 +13942,10 @@
13907
13942
  picking: new RenderInstList()
13908
13943
  };
13909
13944
  this.builder = void 0;
13945
+ this.enableCapture = void 0;
13946
+ this.captureOptions = void 0;
13947
+ this.capturePromise = void 0;
13948
+ this.resolveCapturePromise = void 0;
13910
13949
  }
13911
13950
 
13912
13951
  var _proto = RenderGraphPlugin.prototype;
@@ -14149,7 +14188,22 @@
14149
14188
 
14150
14189
  renderInstManager.resetRenderInsts(); // output to screen
14151
14190
 
14152
- _this.swapChain.present();
14191
+ _this.swapChain.present(); // capture here since we don't preserve drawing buffer
14192
+
14193
+
14194
+ if (_this.enableCapture && _this.resolveCapturePromise) {
14195
+ var _this$captureOptions = _this.captureOptions,
14196
+ type = _this$captureOptions.type,
14197
+ encoderOptions = _this$captureOptions.encoderOptions;
14198
+
14199
+ var dataURL = _this.contextService.getDomElement().toDataURL(type, encoderOptions);
14200
+
14201
+ _this.resolveCapturePromise(dataURL);
14202
+
14203
+ _this.enableCapture = false;
14204
+ _this.captureOptions = undefined;
14205
+ _this.resolveCapturePromise = undefined;
14206
+ }
14153
14207
  });
14154
14208
  }
14155
14209
  /**
@@ -14165,6 +14219,39 @@
14165
14219
  });
14166
14220
  };
14167
14221
 
14222
+ _proto.toDataURL = /*#__PURE__*/function () {
14223
+ var _toDataURL = _asyncToGenerator$2( /*#__PURE__*/_regeneratorRuntime$2().mark(function _callee2(options) {
14224
+ var _this2 = this;
14225
+
14226
+ return _regeneratorRuntime$2().wrap(function _callee2$(_context2) {
14227
+ while (1) {
14228
+ switch (_context2.prev = _context2.next) {
14229
+ case 0:
14230
+ // trigger re-render
14231
+ this.enableCapture = true;
14232
+ this.captureOptions = options;
14233
+ this.capturePromise = new Promise(function (resolve) {
14234
+ _this2.resolveCapturePromise = function (dataURL) {
14235
+ resolve(dataURL);
14236
+ };
14237
+ });
14238
+ return _context2.abrupt("return", this.capturePromise);
14239
+
14240
+ case 4:
14241
+ case "end":
14242
+ return _context2.stop();
14243
+ }
14244
+ }
14245
+ }, _callee2, this);
14246
+ }));
14247
+
14248
+ function toDataURL(_x) {
14249
+ return _toDataURL.apply(this, arguments);
14250
+ }
14251
+
14252
+ return toDataURL;
14253
+ }();
14254
+
14168
14255
  return RenderGraphPlugin;
14169
14256
  }(), _class$1.tag = 'RenderGraph', _class$1);
14170
14257
 
@@ -14800,6 +14887,10 @@
14800
14887
  return this.container.get(RenderGraphPlugin).loadTexture(src, descriptor, successCallback);
14801
14888
  };
14802
14889
 
14890
+ _proto.toDataURL = function toDataURL(options) {
14891
+ return this.container.get(RenderGraphPlugin).toDataURL(options);
14892
+ };
14893
+
14803
14894
  return Plugin;
14804
14895
  }();
14805
14896
 
@@ -16622,7 +16713,7 @@
16622
16713
  }
16623
16714
 
16624
16715
  function _extends$1() {
16625
- _extends$1 = Object.assign || function (target) {
16716
+ _extends$1 = Object.assign ? Object.assign.bind() : function (target) {
16626
16717
  for (var i = 1; i < arguments.length; i++) {
16627
16718
  var source = arguments[i];
16628
16719
 
@@ -16635,7 +16726,6 @@
16635
16726
 
16636
16727
  return target;
16637
16728
  };
16638
-
16639
16729
  return _extends$1.apply(this, arguments);
16640
16730
  }
16641
16731
 
@@ -16647,11 +16737,10 @@
16647
16737
  }
16648
16738
 
16649
16739
  function _setPrototypeOf$2(o, p) {
16650
- _setPrototypeOf$2 = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
16740
+ _setPrototypeOf$2 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
16651
16741
  o.__proto__ = p;
16652
16742
  return o;
16653
16743
  };
16654
-
16655
16744
  return _setPrototypeOf$2(o, p);
16656
16745
  }
16657
16746
 
@@ -17540,6 +17629,100 @@
17540
17629
  return Buffer_WebGPU;
17541
17630
  }(ResourceBase_WebGPU);
17542
17631
 
17632
+ var ComputePass_WebGPU = /*#__PURE__*/function () {
17633
+ function ComputePass_WebGPU() {
17634
+ this.commandEncoder = null;
17635
+ this.descriptor = void 0;
17636
+ this.gpuComputePassDescriptor = void 0;
17637
+ this.gpuComputePassEncoder = null;
17638
+ }
17639
+
17640
+ var _proto = ComputePass_WebGPU.prototype;
17641
+ /**
17642
+ * @see https://www.w3.org/TR/webgpu/#dom-gpucomputepassencoder-dispatch
17643
+ */
17644
+
17645
+ _proto.dispatch = function dispatch(x, y, z) {
17646
+ this.gpuComputePassEncoder.dispatch(x, y, z); // TODO: dispatchIndirect read from GPUBuffer
17647
+ };
17648
+
17649
+ _proto.finish = function finish() {
17650
+ this.gpuComputePassEncoder.end();
17651
+ this.gpuComputePassEncoder = null;
17652
+ return this.commandEncoder.finish();
17653
+ }
17654
+ /**
17655
+ * @see https://www.w3.org/TR/webgpu/#dom-gpucommandencoder-begincomputepass
17656
+ */
17657
+ ;
17658
+
17659
+ _proto.beginComputePass = function beginComputePass(computePassDescriptor) {
17660
+ assert(this.gpuComputePassEncoder === null);
17661
+ this.setComputePassDescriptor(computePassDescriptor);
17662
+ this.gpuComputePassEncoder = this.commandEncoder.beginComputePass(this.gpuComputePassDescriptor);
17663
+ };
17664
+
17665
+ _proto.setPipeline = function setPipeline(pipeline_) {
17666
+ var pipeline = pipeline_;
17667
+ var gpuComputePipeline = assertExists(pipeline.gpuComputePipeline);
17668
+ this.gpuComputePassEncoder.setPipeline(gpuComputePipeline);
17669
+ };
17670
+
17671
+ _proto.setBindings = function setBindings(bindingLayoutIndex, bindings_) {
17672
+ var bindings = bindings_;
17673
+ this.gpuComputePassEncoder.setBindGroup(bindingLayoutIndex, bindings.gpuBindGroup[0]);
17674
+ };
17675
+
17676
+ _proto.setComputePassDescriptor = function setComputePassDescriptor(descriptor) {
17677
+ this.descriptor = descriptor;
17678
+ };
17679
+
17680
+ return ComputePass_WebGPU;
17681
+ }();
17682
+
17683
+ var ComputePipeline_WebGPU = /*#__PURE__*/function (_ResourceBase_WebGPU) {
17684
+ _inheritsLoose$2(ComputePipeline_WebGPU, _ResourceBase_WebGPU);
17685
+
17686
+ function ComputePipeline_WebGPU(_ref) {
17687
+ var _this;
17688
+
17689
+ var id = _ref.id,
17690
+ device = _ref.device,
17691
+ descriptor = _ref.descriptor;
17692
+ _this = _ResourceBase_WebGPU.call(this, {
17693
+ id: id,
17694
+ device: device
17695
+ }) || this;
17696
+ _this.type = ResourceType.ComputePipeline;
17697
+ _this.descriptor = void 0;
17698
+ _this.gpuComputePipeline = null;
17699
+ _this.descriptor = descriptor;
17700
+ var program = descriptor.program;
17701
+ var computeStage = program.computeStage;
17702
+ if (computeStage === null) return _assertThisInitialized$1(_this);
17703
+ var gpuComputePipeline = {
17704
+ compute: _extends$1({}, computeStage),
17705
+ layout: undefined
17706
+ }; // @see https://www.w3.org/TR/webgpu/#dom-gpudevice-createrenderpipeline
17707
+
17708
+ _this.gpuComputePipeline = _this.device.device.createComputePipeline(gpuComputePipeline);
17709
+
17710
+ if (_this.name !== undefined) {
17711
+ _this.gpuComputePipeline.label = _this.name;
17712
+ }
17713
+
17714
+ return _this;
17715
+ }
17716
+
17717
+ var _proto = ComputePipeline_WebGPU.prototype;
17718
+
17719
+ _proto.getBindGroupLayout = function getBindGroupLayout(index) {
17720
+ return this.gpuComputePipeline.getBindGroupLayout(index);
17721
+ };
17722
+
17723
+ return ComputePipeline_WebGPU;
17724
+ }(ResourceBase_WebGPU);
17725
+
17543
17726
  var InputLayout_WebGPU = /*#__PURE__*/function (_ResourceBase_WebGPU) {
17544
17727
  _inheritsLoose$2(InputLayout_WebGPU, _ResourceBase_WebGPU);
17545
17728
 
@@ -17593,6 +17776,34 @@
17593
17776
  return InputLayout_WebGPU;
17594
17777
  }(ResourceBase_WebGPU);
17595
17778
 
17779
+ var InputState_WebGPU = /*#__PURE__*/function (_ResourceBase_WebGPU) {
17780
+ _inheritsLoose$2(InputState_WebGPU, _ResourceBase_WebGPU);
17781
+
17782
+ function InputState_WebGPU(_ref) {
17783
+ var _this;
17784
+
17785
+ var id = _ref.id,
17786
+ device = _ref.device,
17787
+ inputLayout = _ref.inputLayout,
17788
+ vertexBuffers = _ref.vertexBuffers,
17789
+ indexBuffer = _ref.indexBuffer;
17790
+ _this = _ResourceBase_WebGPU.call(this, {
17791
+ id: id,
17792
+ device: device
17793
+ }) || this;
17794
+ _this.type = ResourceType.InputState;
17795
+ _this.inputLayout = void 0;
17796
+ _this.vertexBuffers = void 0;
17797
+ _this.indexBuffer = void 0;
17798
+ _this.inputLayout = inputLayout;
17799
+ _this.vertexBuffers = vertexBuffers;
17800
+ _this.indexBuffer = indexBuffer;
17801
+ return _this;
17802
+ }
17803
+
17804
+ return InputState_WebGPU;
17805
+ }(ResourceBase_WebGPU);
17806
+
17596
17807
  var Program_WebGPU = /*#__PURE__*/function (_ResourceBase_WebGPU) {
17597
17808
  _inheritsLoose$2(Program_WebGPU, _ResourceBase_WebGPU);
17598
17809
 
@@ -17673,397 +17884,37 @@
17673
17884
  return Program_WebGPU;
17674
17885
  }(ResourceBase_WebGPU);
17675
17886
 
17676
- var RenderPass_WebGPU = /*#__PURE__*/function () {
17677
- function RenderPass_WebGPU() {
17678
- this.commandEncoder = null;
17679
- this.descriptor = void 0;
17680
- this.gpuRenderPassEncoder = null;
17681
- this.gpuRenderPassDescriptor = void 0;
17682
- this.gpuColorAttachments = void 0;
17683
- this.gpuDepthStencilAttachment = void 0;
17684
- this.gfxColorAttachment = [];
17685
- this.gfxColorResolveTo = [];
17686
- this.gfxDepthStencilAttachment = null;
17687
- this.gfxDepthStencilResolveTo = null;
17688
- this.gpuColorAttachments = [];
17689
- this.gpuDepthStencilAttachment = {
17690
- view: null,
17691
- depthLoadOp: 'load',
17692
- depthStoreOp: 'store',
17693
- stencilLoadOp: 'load',
17694
- stencilStoreOp: 'store'
17695
- };
17696
- this.gpuRenderPassDescriptor = {
17697
- colorAttachments: this.gpuColorAttachments,
17698
- depthStencilAttachment: this.gpuDepthStencilAttachment
17699
- };
17700
- }
17887
+ var QueryPool_WebGPU = /*#__PURE__*/function (_ResourceBase_WebGPU) {
17888
+ _inheritsLoose$2(QueryPool_WebGPU, _ResourceBase_WebGPU);
17701
17889
 
17702
- var _proto = RenderPass_WebGPU.prototype;
17890
+ function QueryPool_WebGPU(_ref) {
17891
+ var _this;
17703
17892
 
17704
- _proto.setRenderPassDescriptor = function setRenderPassDescriptor(descriptor) {
17705
- this.descriptor = descriptor;
17706
- this.gpuRenderPassDescriptor.colorAttachments = this.gpuColorAttachments;
17707
- var numColorAttachments = descriptor.colorAttachment.length;
17708
- this.gfxColorAttachment.length = numColorAttachments;
17709
- this.gfxColorResolveTo.length = numColorAttachments;
17893
+ var id = _ref.id,
17894
+ device = _ref.device,
17895
+ descriptor = _ref.descriptor;
17896
+ _this = _ResourceBase_WebGPU.call(this, {
17897
+ id: id,
17898
+ device: device
17899
+ }) || this;
17900
+ _this.type = ResourceType.QueryPool;
17901
+ _this.querySet = void 0;
17902
+ var elemCount = descriptor.elemCount,
17903
+ type = descriptor.type;
17904
+ _this.querySet = _this.device.device.createQuerySet({
17905
+ type: translateQueryPoolType(type),
17906
+ count: elemCount
17907
+ });
17908
+ return _this;
17909
+ }
17710
17910
 
17711
- for (var i = 0; i < descriptor.colorAttachment.length; i++) {
17712
- var colorAttachment = descriptor.colorAttachment[i];
17713
- var colorResolveTo = descriptor.colorResolveTo[i]; // Do some dumb juggling...
17911
+ var _proto = QueryPool_WebGPU.prototype;
17714
17912
 
17715
- if (colorAttachment === null && colorResolveTo !== null) {
17716
- colorAttachment = colorResolveTo;
17717
- colorResolveTo = null;
17718
- }
17913
+ _proto.queryResultOcclusion = function queryResultOcclusion(dstOffs) {
17914
+ return true;
17915
+ };
17719
17916
 
17720
- this.gfxColorAttachment[i] = colorAttachment;
17721
- this.gfxColorResolveTo[i] = colorResolveTo;
17722
-
17723
- if (colorAttachment !== null) {
17724
- if (this.gpuColorAttachments[i] === undefined) {
17725
- this.gpuColorAttachments[i] = {};
17726
- }
17727
-
17728
- var dstAttachment = this.gpuColorAttachments[i];
17729
- dstAttachment.view = colorAttachment.gpuTextureView;
17730
- var clearColor = descriptor.colorClearColor[i];
17731
-
17732
- if (clearColor === 'load') {
17733
- dstAttachment.loadOp = 'load';
17734
- } else {
17735
- dstAttachment.loadOp = 'clear';
17736
- dstAttachment.clearValue = clearColor;
17737
- }
17738
-
17739
- dstAttachment.storeOp = descriptor.colorStore[i] ? 'store' : 'discard';
17740
- dstAttachment.resolveTarget = undefined;
17741
-
17742
- if (colorResolveTo !== null) {
17743
- if (colorAttachment.sampleCount > 1) {
17744
- dstAttachment.resolveTarget = colorResolveTo.gpuTextureView;
17745
- } else {
17746
- dstAttachment.storeOp = 'store';
17747
- }
17748
- }
17749
- } else {
17750
- // https://github.com/gpuweb/gpuweb/issues/1250
17751
- this.gpuColorAttachments.length = i;
17752
- this.gfxColorAttachment.length = i;
17753
- this.gfxColorResolveTo.length = i;
17754
- break;
17755
- }
17756
- }
17757
-
17758
- this.gfxDepthStencilAttachment = descriptor.depthStencilAttachment;
17759
- this.gfxDepthStencilResolveTo = descriptor.depthStencilResolveTo;
17760
-
17761
- if (descriptor.depthStencilAttachment !== null) {
17762
- var dsAttachment = descriptor.depthStencilAttachment;
17763
- var _dstAttachment = this.gpuDepthStencilAttachment;
17764
- _dstAttachment.view = dsAttachment.gpuTextureView;
17765
-
17766
- if (descriptor.depthClearValue === 'load') {
17767
- _dstAttachment.depthLoadOp = 'load';
17768
- } else {
17769
- _dstAttachment.depthLoadOp = 'clear';
17770
- _dstAttachment.depthClearValue = descriptor.depthClearValue;
17771
- }
17772
-
17773
- if (descriptor.stencilClearValue === 'load') {
17774
- _dstAttachment.stencilLoadOp = 'load';
17775
- } else {
17776
- _dstAttachment.stencilLoadOp = 'clear';
17777
- _dstAttachment.stencilClearValue = descriptor.stencilClearValue;
17778
- }
17779
-
17780
- _dstAttachment.depthStoreOp = descriptor.depthStencilStore ? 'store' : 'discard';
17781
- _dstAttachment.stencilStoreOp = descriptor.depthStencilStore ? 'store' : 'discard';
17782
- this.gpuRenderPassDescriptor.depthStencilAttachment = this.gpuDepthStencilAttachment;
17783
-
17784
- if (this.gfxDepthStencilResolveTo !== null) {
17785
- _dstAttachment.depthStoreOp = 'store';
17786
- _dstAttachment.stencilStoreOp = 'store';
17787
- }
17788
- } else {
17789
- this.gpuRenderPassDescriptor.depthStencilAttachment = undefined;
17790
- }
17791
-
17792
- this.gpuRenderPassDescriptor.occlusionQuerySet = descriptor.occlusionQueryPool !== null ? getPlatformQuerySet(descriptor.occlusionQueryPool) : undefined;
17793
- };
17794
-
17795
- _proto.beginRenderPass = function beginRenderPass(renderPassDescriptor) {
17796
- assert(this.gpuRenderPassEncoder === null);
17797
- this.setRenderPassDescriptor(renderPassDescriptor);
17798
- this.gpuRenderPassEncoder = this.commandEncoder.beginRenderPass(this.gpuRenderPassDescriptor);
17799
- };
17800
-
17801
- _proto.setViewport = function setViewport(x, y, w, h) {
17802
- this.gpuRenderPassEncoder.setViewport(x, y, w, h, 0, 1);
17803
- };
17804
-
17805
- _proto.setScissor = function setScissor(x, y, w, h) {
17806
- this.gpuRenderPassEncoder.setScissorRect(x, y, w, h);
17807
- };
17808
-
17809
- _proto.setPipeline = function setPipeline(pipeline_) {
17810
- var pipeline = pipeline_;
17811
- var gpuRenderPipeline = assertExists(pipeline.gpuRenderPipeline);
17812
- this.gpuRenderPassEncoder.setPipeline(gpuRenderPipeline);
17813
- };
17814
-
17815
- _proto.setInputState = function setInputState(inputState_) {
17816
- if (inputState_ === null) return;
17817
- var inputState = inputState_;
17818
-
17819
- if (inputState.indexBuffer !== null) {
17820
- var inputLayout = inputState.inputLayout;
17821
- var indexBuffer = inputState.indexBuffer;
17822
- this.gpuRenderPassEncoder.setIndexBuffer(getPlatformBuffer(indexBuffer.buffer), assertExists(inputLayout.indexFormat), indexBuffer.byteOffset);
17823
- }
17824
-
17825
- for (var i = 0; i < inputState.vertexBuffers.length; i++) {
17826
- var b = inputState.vertexBuffers[i];
17827
- if (g.isNil(b)) continue;
17828
- this.gpuRenderPassEncoder.setVertexBuffer(i, getPlatformBuffer(b.buffer), b.byteOffset);
17829
- }
17830
- };
17831
-
17832
- _proto.setBindings = function setBindings(bindingLayoutIndex, bindings_, dynamicByteOffsets) {
17833
- var bindings = bindings_;
17834
- this.gpuRenderPassEncoder.setBindGroup(bindingLayoutIndex + 0, bindings.gpuBindGroup[0], dynamicByteOffsets.slice(0, bindings.bindingLayout.numUniformBuffers));
17835
- this.gpuRenderPassEncoder.setBindGroup(bindingLayoutIndex + 1, bindings.gpuBindGroup[1]);
17836
- };
17837
-
17838
- _proto.setStencilRef = function setStencilRef(ref) {
17839
- this.gpuRenderPassEncoder.setStencilReference(ref);
17840
- };
17841
-
17842
- _proto.draw = function draw(vertexCount, firstVertex) {
17843
- this.gpuRenderPassEncoder.draw(vertexCount, 1, firstVertex, 0);
17844
- };
17845
-
17846
- _proto.drawIndexed = function drawIndexed(indexCount, firstIndex) {
17847
- this.gpuRenderPassEncoder.drawIndexed(indexCount, 1, firstIndex, 0, 0);
17848
- };
17849
-
17850
- _proto.drawIndexedInstanced = function drawIndexedInstanced(indexCount, firstIndex, instanceCount) {
17851
- this.gpuRenderPassEncoder.drawIndexed(indexCount, instanceCount, firstIndex, 0, 0);
17852
- };
17853
-
17854
- _proto.beginOcclusionQuery = function beginOcclusionQuery(dstOffs) {
17855
- this.gpuRenderPassEncoder.beginOcclusionQuery(dstOffs);
17856
- };
17857
-
17858
- _proto.endOcclusionQuery = function endOcclusionQuery(dstOffs) {
17859
- this.gpuRenderPassEncoder.endOcclusionQuery();
17860
- };
17861
-
17862
- _proto.beginDebugGroup = function beginDebugGroup(name) {
17863
- // FIREFOX MISSING
17864
- if (this.gpuRenderPassEncoder.pushDebugGroup === undefined) return;
17865
- this.gpuRenderPassEncoder.pushDebugGroup(name);
17866
- };
17867
-
17868
- _proto.endDebugGroup = function endDebugGroup() {
17869
- // FIREFOX MISSING
17870
- if (this.gpuRenderPassEncoder.popDebugGroup === undefined) return;
17871
- this.gpuRenderPassEncoder.popDebugGroup();
17872
- };
17873
-
17874
- _proto.finish = function finish() {
17875
- this.gpuRenderPassEncoder.end();
17876
- this.gpuRenderPassEncoder = null; // Fake a resolve with a copy for non-MSAA.
17877
-
17878
- for (var i = 0; i < this.gfxColorAttachment.length; i++) {
17879
- var colorAttachment = this.gfxColorAttachment[i];
17880
- var colorResolveTo = this.gfxColorResolveTo[i];
17881
-
17882
- if (colorAttachment !== null && colorResolveTo !== null && colorAttachment.sampleCount === 1) {
17883
- this.copyAttachment(colorResolveTo, colorAttachment);
17884
- }
17885
- }
17886
-
17887
- if (this.gfxDepthStencilAttachment !== null && this.gfxDepthStencilResolveTo !== null) {
17888
- if (this.gfxDepthStencilAttachment.sampleCount > 1) ;else {
17889
- this.copyAttachment(this.gfxDepthStencilResolveTo, this.gfxDepthStencilAttachment);
17890
- }
17891
- }
17892
-
17893
- return this.commandEncoder.finish();
17894
- };
17895
-
17896
- _proto.copyAttachment = function copyAttachment(dst, src) {
17897
- assert(src.sampleCount === 1);
17898
- var srcCopy = {
17899
- texture: src.gpuTexture
17900
- };
17901
- var dstCopy = {
17902
- texture: dst.gpuTexture
17903
- };
17904
- assert(src.width === dst.width);
17905
- assert(src.height === dst.height);
17906
- assert(!!(src.usage & GPUTextureUsage.COPY_SRC));
17907
- assert(!!(dst.usage & GPUTextureUsage.COPY_DST));
17908
- this.commandEncoder.copyTextureToTexture(srcCopy, dstCopy, [dst.width, dst.height, 1]);
17909
- };
17910
-
17911
- return RenderPass_WebGPU;
17912
- }();
17913
-
17914
- var Sampler_WebGPU = /*#__PURE__*/function (_ResourceBase_WebGPU) {
17915
- _inheritsLoose$2(Sampler_WebGPU, _ResourceBase_WebGPU); // @see https://www.w3.org/TR/webgpu/#gpusampler
17916
-
17917
-
17918
- function Sampler_WebGPU(_ref) {
17919
- var _descriptor$maxAnisot, _descriptor$wrapQ;
17920
-
17921
- var _this;
17922
-
17923
- var id = _ref.id,
17924
- device = _ref.device,
17925
- descriptor = _ref.descriptor;
17926
- _this = _ResourceBase_WebGPU.call(this, {
17927
- id: id,
17928
- device: device
17929
- }) || this;
17930
- _this.type = ResourceType.Sampler;
17931
- _this.gpuSampler = void 0;
17932
- var lodMinClamp = descriptor.minLOD;
17933
- var lodMaxClamp = descriptor.mipFilter === MipFilterMode.NoMip ? descriptor.minLOD : descriptor.maxLOD;
17934
- var maxAnisotropy = (_descriptor$maxAnisot = descriptor.maxAnisotropy) !== null && _descriptor$maxAnisot !== void 0 ? _descriptor$maxAnisot : 1;
17935
- if (maxAnisotropy > 1) assert(descriptor.minFilter === TexFilterMode.Bilinear && descriptor.magFilter === TexFilterMode.Bilinear && descriptor.mipFilter === MipFilterMode.Linear);
17936
- _this.gpuSampler = _this.device.device.createSampler({
17937
- addressModeU: translateWrapMode(descriptor.wrapS),
17938
- addressModeV: translateWrapMode(descriptor.wrapT),
17939
- addressModeW: translateWrapMode((_descriptor$wrapQ = descriptor.wrapQ) !== null && _descriptor$wrapQ !== void 0 ? _descriptor$wrapQ : descriptor.wrapS),
17940
- lodMinClamp: lodMinClamp,
17941
- lodMaxClamp: lodMaxClamp,
17942
- minFilter: translateMinMagFilter(descriptor.minFilter),
17943
- magFilter: translateMinMagFilter(descriptor.magFilter),
17944
- mipmapFilter: translateMipFilter(descriptor.mipFilter),
17945
- maxAnisotropy: maxAnisotropy
17946
- });
17947
- return _this;
17948
- }
17949
-
17950
- return Sampler_WebGPU;
17951
- }(ResourceBase_WebGPU);
17952
-
17953
- var Texture_WebGPU = /*#__PURE__*/function (_ResourceBase_WebGPU) {
17954
- _inheritsLoose$2(Texture_WebGPU, _ResourceBase_WebGPU);
17955
-
17956
- function Texture_WebGPU(_ref) {
17957
- var _this;
17958
-
17959
- var id = _ref.id,
17960
- device = _ref.device,
17961
- descriptor = _ref.descriptor,
17962
- skipCreate = _ref.skipCreate;
17963
- _this = _ResourceBase_WebGPU.call(this, {
17964
- id: id,
17965
- device: device
17966
- }) || this;
17967
- _this.type = ResourceType.Texture;
17968
- _this.pixelFormat = void 0;
17969
- _this.dimension = void 0;
17970
- _this.format = void 0;
17971
- _this.width = void 0;
17972
- _this.height = void 0;
17973
- _this.depthOrArrayLayers = void 0;
17974
- _this.numLevels = void 0;
17975
- _this.sampleCount = void 0;
17976
- _this.usage = void 0;
17977
- _this.gpuTexture = void 0;
17978
- _this.gpuTextureView = void 0;
17979
-
17980
- _this.device.createTextureShared({
17981
- pixelFormat: descriptor.pixelFormat,
17982
- dimension: descriptor.dimension,
17983
- width: descriptor.width,
17984
- height: descriptor.height,
17985
- depthOrArrayLayers: descriptor.depth,
17986
- numLevels: descriptor.numLevels,
17987
- usage: descriptor.usage,
17988
- sampleCount: 1
17989
- }, _assertThisInitialized$1(_this), skipCreate);
17990
-
17991
- return _this;
17992
- }
17993
-
17994
- var _proto = Texture_WebGPU.prototype;
17995
-
17996
- _proto.setImageData = function setImageData(data, level) {// TODO: https://www.w3.org/TR/webgpu/#image-copies
17997
- };
17998
-
17999
- _proto.destroy = function destroy() {
18000
- // @see https://www.w3.org/TR/webgpu/#dom-gputexture-destroy
18001
- this.gpuTexture.destroy();
18002
- };
18003
-
18004
- return Texture_WebGPU;
18005
- }(ResourceBase_WebGPU);
18006
-
18007
- var InputState_WebGPU = /*#__PURE__*/function (_ResourceBase_WebGPU) {
18008
- _inheritsLoose$2(InputState_WebGPU, _ResourceBase_WebGPU);
18009
-
18010
- function InputState_WebGPU(_ref) {
18011
- var _this;
18012
-
18013
- var id = _ref.id,
18014
- device = _ref.device,
18015
- inputLayout = _ref.inputLayout,
18016
- vertexBuffers = _ref.vertexBuffers,
18017
- indexBuffer = _ref.indexBuffer;
18018
- _this = _ResourceBase_WebGPU.call(this, {
18019
- id: id,
18020
- device: device
18021
- }) || this;
18022
- _this.type = ResourceType.InputState;
18023
- _this.inputLayout = void 0;
18024
- _this.vertexBuffers = void 0;
18025
- _this.indexBuffer = void 0;
18026
- _this.inputLayout = inputLayout;
18027
- _this.vertexBuffers = vertexBuffers;
18028
- _this.indexBuffer = indexBuffer;
18029
- return _this;
18030
- }
18031
-
18032
- return InputState_WebGPU;
18033
- }(ResourceBase_WebGPU);
18034
-
18035
- var RenderPipeline_WebGPU = /*#__PURE__*/function (_ResourceBase_WebGPU) {
18036
- _inheritsLoose$2(RenderPipeline_WebGPU, _ResourceBase_WebGPU);
18037
-
18038
- function RenderPipeline_WebGPU(_ref) {
18039
- var _this;
18040
-
18041
- var id = _ref.id,
18042
- device = _ref.device,
18043
- descriptor = _ref.descriptor;
18044
- _this = _ResourceBase_WebGPU.call(this, {
18045
- id: id,
18046
- device: device
18047
- }) || this;
18048
- _this.type = ResourceType.RenderPipeline;
18049
- _this.descriptor = void 0;
18050
- _this.isCreating = false;
18051
- _this.isCreatingAsync = false;
18052
- _this.gpuRenderPipeline = null;
18053
- _this.descriptor = descriptor;
18054
-
18055
- _this.device._createRenderPipeline(_assertThisInitialized$1(_this), false);
18056
-
18057
- return _this;
18058
- }
18059
-
18060
- var _proto = RenderPipeline_WebGPU.prototype;
18061
-
18062
- _proto.getBindGroupLayout = function getBindGroupLayout(index) {
18063
- return this.gpuRenderPipeline.getBindGroupLayout(index);
18064
- };
18065
-
18066
- return RenderPipeline_WebGPU;
17917
+ return QueryPool_WebGPU;
18067
17918
  }(ResourceBase_WebGPU);
18068
17919
 
18069
17920
  var Readback_WebGPU = /*#__PURE__*/function (_ResourceBase_WebGPU) {
@@ -18379,13 +18230,8 @@
18379
18230
  height: 1,
18380
18231
  length: 4
18381
18232
  };
18382
-
18383
- case 'depth24unorm-stencil8':
18384
- return {
18385
- width: 1,
18386
- height: 1,
18387
- length: 4
18388
- };
18233
+ // case 'depth24unorm-stencil8':
18234
+ // return { width: 1, height: 1, length: 4 };
18389
18235
 
18390
18236
  case 'depth32float-stencil8':
18391
18237
  return {
@@ -18422,73 +18268,260 @@
18422
18268
  length: 8
18423
18269
  };
18424
18270
 
18425
- default:
18426
- return {
18427
- width: 1,
18428
- height: 1,
18429
- length: 4
18430
- };
18271
+ default:
18272
+ return {
18273
+ width: 1,
18274
+ height: 1,
18275
+ length: 4
18276
+ };
18277
+ }
18278
+ };
18279
+
18280
+ return Readback_WebGPU;
18281
+ }(ResourceBase_WebGPU);
18282
+
18283
+ var RenderPass_WebGPU = /*#__PURE__*/function () {
18284
+ function RenderPass_WebGPU() {
18285
+ this.commandEncoder = null;
18286
+ this.descriptor = void 0;
18287
+ this.gpuRenderPassEncoder = null;
18288
+ this.gpuRenderPassDescriptor = void 0;
18289
+ this.gpuColorAttachments = void 0;
18290
+ this.gpuDepthStencilAttachment = void 0;
18291
+ this.gfxColorAttachment = [];
18292
+ this.gfxColorResolveTo = [];
18293
+ this.gfxDepthStencilAttachment = null;
18294
+ this.gfxDepthStencilResolveTo = null;
18295
+ this.gpuColorAttachments = [];
18296
+ this.gpuDepthStencilAttachment = {
18297
+ view: null,
18298
+ depthLoadOp: 'load',
18299
+ depthStoreOp: 'store',
18300
+ stencilLoadOp: 'load',
18301
+ stencilStoreOp: 'store'
18302
+ };
18303
+ this.gpuRenderPassDescriptor = {
18304
+ colorAttachments: this.gpuColorAttachments,
18305
+ depthStencilAttachment: this.gpuDepthStencilAttachment
18306
+ };
18307
+ }
18308
+
18309
+ var _proto = RenderPass_WebGPU.prototype;
18310
+
18311
+ _proto.setRenderPassDescriptor = function setRenderPassDescriptor(descriptor) {
18312
+ this.descriptor = descriptor;
18313
+ this.gpuRenderPassDescriptor.colorAttachments = this.gpuColorAttachments;
18314
+ var numColorAttachments = descriptor.colorAttachment.length;
18315
+ this.gfxColorAttachment.length = numColorAttachments;
18316
+ this.gfxColorResolveTo.length = numColorAttachments;
18317
+
18318
+ for (var i = 0; i < descriptor.colorAttachment.length; i++) {
18319
+ var colorAttachment = descriptor.colorAttachment[i];
18320
+ var colorResolveTo = descriptor.colorResolveTo[i]; // Do some dumb juggling...
18321
+
18322
+ if (colorAttachment === null && colorResolveTo !== null) {
18323
+ colorAttachment = colorResolveTo;
18324
+ colorResolveTo = null;
18325
+ }
18326
+
18327
+ this.gfxColorAttachment[i] = colorAttachment;
18328
+ this.gfxColorResolveTo[i] = colorResolveTo;
18329
+
18330
+ if (colorAttachment !== null) {
18331
+ if (this.gpuColorAttachments[i] === undefined) {
18332
+ this.gpuColorAttachments[i] = {};
18333
+ }
18334
+
18335
+ var dstAttachment = this.gpuColorAttachments[i];
18336
+ dstAttachment.view = colorAttachment.gpuTextureView;
18337
+ var clearColor = descriptor.colorClearColor[i];
18338
+
18339
+ if (clearColor === 'load') {
18340
+ dstAttachment.loadOp = 'load';
18341
+ } else {
18342
+ dstAttachment.loadOp = 'clear';
18343
+ dstAttachment.clearValue = clearColor;
18344
+ }
18345
+
18346
+ dstAttachment.storeOp = descriptor.colorStore[i] ? 'store' : 'discard';
18347
+ dstAttachment.resolveTarget = undefined;
18348
+
18349
+ if (colorResolveTo !== null) {
18350
+ if (colorAttachment.sampleCount > 1) {
18351
+ dstAttachment.resolveTarget = colorResolveTo.gpuTextureView;
18352
+ } else {
18353
+ dstAttachment.storeOp = 'store';
18354
+ }
18355
+ }
18356
+ } else {
18357
+ // https://github.com/gpuweb/gpuweb/issues/1250
18358
+ this.gpuColorAttachments.length = i;
18359
+ this.gfxColorAttachment.length = i;
18360
+ this.gfxColorResolveTo.length = i;
18361
+ break;
18362
+ }
18363
+ }
18364
+
18365
+ this.gfxDepthStencilAttachment = descriptor.depthStencilAttachment;
18366
+ this.gfxDepthStencilResolveTo = descriptor.depthStencilResolveTo;
18367
+
18368
+ if (descriptor.depthStencilAttachment !== null) {
18369
+ var dsAttachment = descriptor.depthStencilAttachment;
18370
+ var _dstAttachment = this.gpuDepthStencilAttachment;
18371
+ _dstAttachment.view = dsAttachment.gpuTextureView;
18372
+
18373
+ if (descriptor.depthClearValue === 'load') {
18374
+ _dstAttachment.depthLoadOp = 'load';
18375
+ } else {
18376
+ _dstAttachment.depthLoadOp = 'clear';
18377
+ _dstAttachment.depthClearValue = descriptor.depthClearValue;
18378
+ }
18379
+
18380
+ if (descriptor.stencilClearValue === 'load') {
18381
+ _dstAttachment.stencilLoadOp = 'load';
18382
+ } else {
18383
+ _dstAttachment.stencilLoadOp = 'clear';
18384
+ _dstAttachment.stencilClearValue = descriptor.stencilClearValue;
18385
+ }
18386
+
18387
+ _dstAttachment.depthStoreOp = descriptor.depthStencilStore ? 'store' : 'discard';
18388
+ _dstAttachment.stencilStoreOp = descriptor.depthStencilStore ? 'store' : 'discard';
18389
+ this.gpuRenderPassDescriptor.depthStencilAttachment = this.gpuDepthStencilAttachment;
18390
+
18391
+ if (this.gfxDepthStencilResolveTo !== null) {
18392
+ _dstAttachment.depthStoreOp = 'store';
18393
+ _dstAttachment.stencilStoreOp = 'store';
18394
+ }
18395
+ } else {
18396
+ this.gpuRenderPassDescriptor.depthStencilAttachment = undefined;
18397
+ }
18398
+
18399
+ this.gpuRenderPassDescriptor.occlusionQuerySet = descriptor.occlusionQueryPool !== null ? getPlatformQuerySet(descriptor.occlusionQueryPool) : undefined;
18400
+ };
18401
+
18402
+ _proto.beginRenderPass = function beginRenderPass(renderPassDescriptor) {
18403
+ assert(this.gpuRenderPassEncoder === null);
18404
+ this.setRenderPassDescriptor(renderPassDescriptor);
18405
+ this.gpuRenderPassEncoder = this.commandEncoder.beginRenderPass(this.gpuRenderPassDescriptor);
18406
+ };
18407
+
18408
+ _proto.setViewport = function setViewport(x, y, w, h) {
18409
+ this.gpuRenderPassEncoder.setViewport(x, y, w, h, 0, 1);
18410
+ };
18411
+
18412
+ _proto.setScissor = function setScissor(x, y, w, h) {
18413
+ this.gpuRenderPassEncoder.setScissorRect(x, y, w, h);
18414
+ };
18415
+
18416
+ _proto.setPipeline = function setPipeline(pipeline_) {
18417
+ var pipeline = pipeline_;
18418
+ var gpuRenderPipeline = assertExists(pipeline.gpuRenderPipeline);
18419
+ this.gpuRenderPassEncoder.setPipeline(gpuRenderPipeline);
18420
+ };
18421
+
18422
+ _proto.setInputState = function setInputState(inputState_) {
18423
+ if (inputState_ === null) return;
18424
+ var inputState = inputState_;
18425
+
18426
+ if (inputState.indexBuffer !== null) {
18427
+ var inputLayout = inputState.inputLayout;
18428
+ var indexBuffer = inputState.indexBuffer;
18429
+ this.gpuRenderPassEncoder.setIndexBuffer(getPlatformBuffer(indexBuffer.buffer), assertExists(inputLayout.indexFormat), indexBuffer.byteOffset);
18430
+ }
18431
+
18432
+ for (var i = 0; i < inputState.vertexBuffers.length; i++) {
18433
+ var b = inputState.vertexBuffers[i];
18434
+ if (g.isNil(b)) continue;
18435
+ this.gpuRenderPassEncoder.setVertexBuffer(i, getPlatformBuffer(b.buffer), b.byteOffset);
18431
18436
  }
18432
18437
  };
18433
18438
 
18434
- return Readback_WebGPU;
18435
- }(ResourceBase_WebGPU);
18439
+ _proto.setBindings = function setBindings(bindingLayoutIndex, bindings_, dynamicByteOffsets) {
18440
+ var bindings = bindings_;
18441
+ this.gpuRenderPassEncoder.setBindGroup(bindingLayoutIndex + 0, bindings.gpuBindGroup[0], dynamicByteOffsets.slice(0, bindings.bindingLayout.numUniformBuffers));
18442
+ this.gpuRenderPassEncoder.setBindGroup(bindingLayoutIndex + 1, bindings.gpuBindGroup[1]);
18443
+ };
18436
18444
 
18437
- var ComputePass_WebGPU = /*#__PURE__*/function () {
18438
- function ComputePass_WebGPU() {
18439
- this.commandEncoder = null;
18440
- this.descriptor = void 0;
18441
- this.gpuComputePassDescriptor = void 0;
18442
- this.gpuComputePassEncoder = null;
18443
- }
18445
+ _proto.setStencilRef = function setStencilRef(ref) {
18446
+ this.gpuRenderPassEncoder.setStencilReference(ref);
18447
+ };
18444
18448
 
18445
- var _proto = ComputePass_WebGPU.prototype;
18446
- /**
18447
- * @see https://www.w3.org/TR/webgpu/#dom-gpucomputepassencoder-dispatch
18448
- */
18449
+ _proto.draw = function draw(vertexCount, firstVertex) {
18450
+ this.gpuRenderPassEncoder.draw(vertexCount, 1, firstVertex, 0);
18451
+ };
18449
18452
 
18450
- _proto.dispatch = function dispatch(x, y, z) {
18451
- this.gpuComputePassEncoder.dispatch(x, y, z); // TODO: dispatchIndirect read from GPUBuffer
18453
+ _proto.drawIndexed = function drawIndexed(indexCount, firstIndex) {
18454
+ this.gpuRenderPassEncoder.drawIndexed(indexCount, 1, firstIndex, 0, 0);
18452
18455
  };
18453
18456
 
18454
- _proto.finish = function finish() {
18455
- this.gpuComputePassEncoder.end();
18456
- this.gpuComputePassEncoder = null;
18457
- return this.commandEncoder.finish();
18458
- }
18459
- /**
18460
- * @see https://www.w3.org/TR/webgpu/#dom-gpucommandencoder-begincomputepass
18461
- */
18462
- ;
18457
+ _proto.drawIndexedInstanced = function drawIndexedInstanced(indexCount, firstIndex, instanceCount) {
18458
+ this.gpuRenderPassEncoder.drawIndexed(indexCount, instanceCount, firstIndex, 0, 0);
18459
+ };
18463
18460
 
18464
- _proto.beginComputePass = function beginComputePass(computePassDescriptor) {
18465
- assert(this.gpuComputePassEncoder === null);
18466
- this.setComputePassDescriptor(computePassDescriptor);
18467
- this.gpuComputePassEncoder = this.commandEncoder.beginComputePass(this.gpuComputePassDescriptor);
18461
+ _proto.beginOcclusionQuery = function beginOcclusionQuery(dstOffs) {
18462
+ this.gpuRenderPassEncoder.beginOcclusionQuery(dstOffs);
18468
18463
  };
18469
18464
 
18470
- _proto.setPipeline = function setPipeline(pipeline_) {
18471
- var pipeline = pipeline_;
18472
- var gpuComputePipeline = assertExists(pipeline.gpuComputePipeline);
18473
- this.gpuComputePassEncoder.setPipeline(gpuComputePipeline);
18465
+ _proto.endOcclusionQuery = function endOcclusionQuery(dstOffs) {
18466
+ this.gpuRenderPassEncoder.endOcclusionQuery();
18474
18467
  };
18475
18468
 
18476
- _proto.setBindings = function setBindings(bindingLayoutIndex, bindings_) {
18477
- var bindings = bindings_;
18478
- this.gpuComputePassEncoder.setBindGroup(bindingLayoutIndex, bindings.gpuBindGroup[0]);
18469
+ _proto.beginDebugGroup = function beginDebugGroup(name) {
18470
+ // FIREFOX MISSING
18471
+ if (this.gpuRenderPassEncoder.pushDebugGroup === undefined) return;
18472
+ this.gpuRenderPassEncoder.pushDebugGroup(name);
18479
18473
  };
18480
18474
 
18481
- _proto.setComputePassDescriptor = function setComputePassDescriptor(descriptor) {
18482
- this.descriptor = descriptor;
18475
+ _proto.endDebugGroup = function endDebugGroup() {
18476
+ // FIREFOX MISSING
18477
+ if (this.gpuRenderPassEncoder.popDebugGroup === undefined) return;
18478
+ this.gpuRenderPassEncoder.popDebugGroup();
18483
18479
  };
18484
18480
 
18485
- return ComputePass_WebGPU;
18481
+ _proto.finish = function finish() {
18482
+ this.gpuRenderPassEncoder.end();
18483
+ this.gpuRenderPassEncoder = null; // Fake a resolve with a copy for non-MSAA.
18484
+
18485
+ for (var i = 0; i < this.gfxColorAttachment.length; i++) {
18486
+ var colorAttachment = this.gfxColorAttachment[i];
18487
+ var colorResolveTo = this.gfxColorResolveTo[i];
18488
+
18489
+ if (colorAttachment !== null && colorResolveTo !== null && colorAttachment.sampleCount === 1) {
18490
+ this.copyAttachment(colorResolveTo, colorAttachment);
18491
+ }
18492
+ }
18493
+
18494
+ if (this.gfxDepthStencilAttachment !== null && this.gfxDepthStencilResolveTo !== null) {
18495
+ if (this.gfxDepthStencilAttachment.sampleCount > 1) ;else {
18496
+ this.copyAttachment(this.gfxDepthStencilResolveTo, this.gfxDepthStencilAttachment);
18497
+ }
18498
+ }
18499
+
18500
+ return this.commandEncoder.finish();
18501
+ };
18502
+
18503
+ _proto.copyAttachment = function copyAttachment(dst, src) {
18504
+ assert(src.sampleCount === 1);
18505
+ var srcCopy = {
18506
+ texture: src.gpuTexture
18507
+ };
18508
+ var dstCopy = {
18509
+ texture: dst.gpuTexture
18510
+ };
18511
+ assert(src.width === dst.width);
18512
+ assert(src.height === dst.height);
18513
+ assert(!!(src.usage & GPUTextureUsage.COPY_SRC));
18514
+ assert(!!(dst.usage & GPUTextureUsage.COPY_DST));
18515
+ this.commandEncoder.copyTextureToTexture(srcCopy, dstCopy, [dst.width, dst.height, 1]);
18516
+ };
18517
+
18518
+ return RenderPass_WebGPU;
18486
18519
  }();
18487
18520
 
18488
- var ComputePipeline_WebGPU = /*#__PURE__*/function (_ResourceBase_WebGPU) {
18489
- _inheritsLoose$2(ComputePipeline_WebGPU, _ResourceBase_WebGPU);
18521
+ var RenderPipeline_WebGPU = /*#__PURE__*/function (_ResourceBase_WebGPU) {
18522
+ _inheritsLoose$2(RenderPipeline_WebGPU, _ResourceBase_WebGPU);
18490
18523
 
18491
- function ComputePipeline_WebGPU(_ref) {
18524
+ function RenderPipeline_WebGPU(_ref) {
18492
18525
  var _this;
18493
18526
 
18494
18527
  var id = _ref.id,
@@ -18498,40 +18531,34 @@
18498
18531
  id: id,
18499
18532
  device: device
18500
18533
  }) || this;
18501
- _this.type = ResourceType.ComputePipeline;
18534
+ _this.type = ResourceType.RenderPipeline;
18502
18535
  _this.descriptor = void 0;
18503
- _this.gpuComputePipeline = null;
18536
+ _this.isCreating = false;
18537
+ _this.isCreatingAsync = false;
18538
+ _this.gpuRenderPipeline = null;
18504
18539
  _this.descriptor = descriptor;
18505
- var program = descriptor.program;
18506
- var computeStage = program.computeStage;
18507
- if (computeStage === null) return _assertThisInitialized$1(_this);
18508
- var gpuComputePipeline = {
18509
- compute: _extends$1({}, computeStage),
18510
- layout: undefined
18511
- }; // @see https://www.w3.org/TR/webgpu/#dom-gpudevice-createrenderpipeline
18512
-
18513
- _this.gpuComputePipeline = _this.device.device.createComputePipeline(gpuComputePipeline);
18514
18540
 
18515
- if (_this.name !== undefined) {
18516
- _this.gpuComputePipeline.label = _this.name;
18517
- }
18541
+ _this.device._createRenderPipeline(_assertThisInitialized$1(_this), false);
18518
18542
 
18519
18543
  return _this;
18520
18544
  }
18521
18545
 
18522
- var _proto = ComputePipeline_WebGPU.prototype;
18546
+ var _proto = RenderPipeline_WebGPU.prototype;
18523
18547
 
18524
18548
  _proto.getBindGroupLayout = function getBindGroupLayout(index) {
18525
- return this.gpuComputePipeline.getBindGroupLayout(index);
18549
+ return this.gpuRenderPipeline.getBindGroupLayout(index);
18526
18550
  };
18527
18551
 
18528
- return ComputePipeline_WebGPU;
18552
+ return RenderPipeline_WebGPU;
18529
18553
  }(ResourceBase_WebGPU);
18530
18554
 
18531
- var QueryPool_WebGPU = /*#__PURE__*/function (_ResourceBase_WebGPU) {
18532
- _inheritsLoose$2(QueryPool_WebGPU, _ResourceBase_WebGPU);
18555
+ var Sampler_WebGPU = /*#__PURE__*/function (_ResourceBase_WebGPU) {
18556
+ _inheritsLoose$2(Sampler_WebGPU, _ResourceBase_WebGPU); // @see https://www.w3.org/TR/webgpu/#gpusampler
18557
+
18558
+
18559
+ function Sampler_WebGPU(_ref) {
18560
+ var _descriptor$maxAnisot, _descriptor$wrapQ;
18533
18561
 
18534
- function QueryPool_WebGPU(_ref) {
18535
18562
  var _this;
18536
18563
 
18537
18564
  var id = _ref.id,
@@ -18541,24 +18568,81 @@
18541
18568
  id: id,
18542
18569
  device: device
18543
18570
  }) || this;
18544
- _this.type = ResourceType.QueryPool;
18545
- _this.querySet = void 0;
18546
- var elemCount = descriptor.elemCount,
18547
- type = descriptor.type;
18548
- _this.querySet = _this.device.device.createQuerySet({
18549
- type: translateQueryPoolType(type),
18550
- count: elemCount
18571
+ _this.type = ResourceType.Sampler;
18572
+ _this.gpuSampler = void 0;
18573
+ var lodMinClamp = descriptor.minLOD;
18574
+ var lodMaxClamp = descriptor.mipFilter === MipFilterMode.NoMip ? descriptor.minLOD : descriptor.maxLOD;
18575
+ var maxAnisotropy = (_descriptor$maxAnisot = descriptor.maxAnisotropy) !== null && _descriptor$maxAnisot !== void 0 ? _descriptor$maxAnisot : 1;
18576
+ if (maxAnisotropy > 1) assert(descriptor.minFilter === TexFilterMode.Bilinear && descriptor.magFilter === TexFilterMode.Bilinear && descriptor.mipFilter === MipFilterMode.Linear);
18577
+ _this.gpuSampler = _this.device.device.createSampler({
18578
+ addressModeU: translateWrapMode(descriptor.wrapS),
18579
+ addressModeV: translateWrapMode(descriptor.wrapT),
18580
+ addressModeW: translateWrapMode((_descriptor$wrapQ = descriptor.wrapQ) !== null && _descriptor$wrapQ !== void 0 ? _descriptor$wrapQ : descriptor.wrapS),
18581
+ lodMinClamp: lodMinClamp,
18582
+ lodMaxClamp: lodMaxClamp,
18583
+ minFilter: translateMinMagFilter(descriptor.minFilter),
18584
+ magFilter: translateMinMagFilter(descriptor.magFilter),
18585
+ mipmapFilter: translateMipFilter(descriptor.mipFilter),
18586
+ maxAnisotropy: maxAnisotropy
18551
18587
  });
18552
18588
  return _this;
18553
18589
  }
18554
18590
 
18555
- var _proto = QueryPool_WebGPU.prototype;
18591
+ return Sampler_WebGPU;
18592
+ }(ResourceBase_WebGPU);
18556
18593
 
18557
- _proto.queryResultOcclusion = function queryResultOcclusion(dstOffs) {
18558
- return true;
18594
+ var Texture_WebGPU = /*#__PURE__*/function (_ResourceBase_WebGPU) {
18595
+ _inheritsLoose$2(Texture_WebGPU, _ResourceBase_WebGPU);
18596
+
18597
+ function Texture_WebGPU(_ref) {
18598
+ var _this;
18599
+
18600
+ var id = _ref.id,
18601
+ device = _ref.device,
18602
+ descriptor = _ref.descriptor,
18603
+ skipCreate = _ref.skipCreate;
18604
+ _this = _ResourceBase_WebGPU.call(this, {
18605
+ id: id,
18606
+ device: device
18607
+ }) || this;
18608
+ _this.type = ResourceType.Texture;
18609
+ _this.pixelFormat = void 0;
18610
+ _this.dimension = void 0;
18611
+ _this.format = void 0;
18612
+ _this.width = void 0;
18613
+ _this.height = void 0;
18614
+ _this.depthOrArrayLayers = void 0;
18615
+ _this.numLevels = void 0;
18616
+ _this.sampleCount = void 0;
18617
+ _this.usage = void 0;
18618
+ _this.gpuTexture = void 0;
18619
+ _this.gpuTextureView = void 0;
18620
+
18621
+ _this.device.createTextureShared({
18622
+ pixelFormat: descriptor.pixelFormat,
18623
+ dimension: descriptor.dimension,
18624
+ width: descriptor.width,
18625
+ height: descriptor.height,
18626
+ depthOrArrayLayers: descriptor.depth,
18627
+ numLevels: descriptor.numLevels,
18628
+ usage: descriptor.usage,
18629
+ sampleCount: 1
18630
+ }, _assertThisInitialized$1(_this), skipCreate);
18631
+
18632
+ return _this;
18633
+ }
18634
+
18635
+ var _proto = Texture_WebGPU.prototype;
18636
+
18637
+ _proto.setImageData = function setImageData(data, level) {// TODO: https://www.w3.org/TR/webgpu/#image-copies
18559
18638
  };
18560
18639
 
18561
- return QueryPool_WebGPU;
18640
+ _proto.destroy = function destroy() {
18641
+ // @see https://www.w3.org/TR/webgpu/#dom-gputexture-destroy
18642
+ this.gpuTexture.destroy();
18643
+ };
18644
+
18645
+ return Texture_WebGPU;
18562
18646
  }(ResourceBase_WebGPU);
18563
18647
 
18564
18648
  var Device_WebGPU = /*#__PURE__*/function () {
@@ -19076,6 +19160,15 @@
19076
19160
  return this.featureTextureCompressionBC;
19077
19161
  }
19078
19162
 
19163
+ switch (format) {
19164
+ case Format.U16_RGBA_NORM:
19165
+ return false;
19166
+
19167
+ case Format.F32_RGBA:
19168
+ return false;
19169
+ // unfilterable
19170
+ }
19171
+
19079
19172
  return true;
19080
19173
  };
19081
19174
 
@@ -19191,7 +19284,8 @@
19191
19284
 
19192
19285
  case 14:
19193
19286
  // @see https://www.w3.org/TR/webgpu/#dom-gpudevicedescriptor-requiredfeatures
19194
- optionalFeatures = ['depth24unorm-stencil8', 'depth32float-stencil8', 'texture-compression-bc'];
19287
+ optionalFeatures = [// 'depth24unorm-stencil8',
19288
+ 'depth32float-stencil8', 'texture-compression-bc'];
19195
19289
  requiredFeatures = optionalFeatures.filter(function (feature) {
19196
19290
  return adapter.features.has(feature);
19197
19291
  });
@@ -19296,16 +19390,18 @@
19296
19390
  Plugin: Plugin$4
19297
19391
  });
19298
19392
 
19299
- var WebGLContextService = /*#__PURE__*/function () {
19300
- function WebGLContextService() {
19393
+ var DeviceRendererPlugin = g.Syringe.defineToken('DeviceRendererPlugin');
19394
+
19395
+ var WebGPUContextService = /*#__PURE__*/function () {
19396
+ function WebGPUContextService() {
19301
19397
  this.$container = void 0;
19302
19398
  this.$canvas = void 0;
19303
19399
  this.dpr = void 0;
19304
- this.context = void 0;
19305
19400
  this.canvasConfig = void 0;
19401
+ this.deviceRendererPlugin = void 0;
19306
19402
  }
19307
19403
 
19308
- var _proto = WebGLContextService.prototype;
19404
+ var _proto = WebGPUContextService.prototype;
19309
19405
 
19310
19406
  _proto.init = /*#__PURE__*/function () {
19311
19407
  var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
@@ -19368,7 +19464,8 @@
19368
19464
  };
19369
19465
 
19370
19466
  _proto.getContext = function getContext() {
19371
- return this.context;
19467
+ // @ts-ignore
19468
+ return this.deviceRendererPlugin.getDevice().canvasContext;
19372
19469
  };
19373
19470
 
19374
19471
  _proto.getBoundingClientRect = function getBoundingClientRect() {
@@ -19406,34 +19503,65 @@
19406
19503
  }
19407
19504
  };
19408
19505
 
19409
- return WebGLContextService;
19506
+ _proto.toDataURL = /*#__PURE__*/function () {
19507
+ var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
19508
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
19509
+ while (1) {
19510
+ switch (_context2.prev = _context2.next) {
19511
+ case 0:
19512
+ return _context2.abrupt("return", '');
19513
+
19514
+ case 1:
19515
+ case "end":
19516
+ return _context2.stop();
19517
+ }
19518
+ }
19519
+ }, _callee2);
19520
+ }));
19521
+
19522
+ function toDataURL(_x) {
19523
+ return _toDataURL.apply(this, arguments);
19524
+ }
19525
+
19526
+ return toDataURL;
19527
+ }();
19528
+
19529
+ return WebGPUContextService;
19410
19530
  }();
19411
19531
 
19412
- __decorate([g.inject(g.CanvasConfig), __metadata("design:type", Object)], WebGLContextService.prototype, "canvasConfig", void 0);
19532
+ __decorate([g.inject(g.CanvasConfig), __metadata("design:type", Object)], WebGPUContextService.prototype, "canvasConfig", void 0);
19413
19533
 
19414
- WebGLContextService = __decorate([g.singleton({
19534
+ __decorate([g.inject(DeviceRendererPlugin), __metadata("design:type", Plugin$1)], WebGPUContextService.prototype, "deviceRendererPlugin", void 0);
19535
+
19536
+ WebGPUContextService = __decorate([g.singleton({
19415
19537
  token: g.ContextService
19416
- })], WebGLContextService);
19538
+ })], WebGPUContextService);
19417
19539
 
19418
19540
  var containerModule$5 = g.Module(function (register) {
19419
19541
  /**
19420
19542
  * implements ContextService
19421
19543
  */
19422
- register(WebGLContextService);
19544
+ register(WebGPUContextService);
19423
19545
  });
19424
19546
  var ContextRegisterPlugin = /*#__PURE__*/function () {
19425
- function ContextRegisterPlugin() {
19547
+ function ContextRegisterPlugin(rendererPlugin) {
19548
+ this.rendererPlugin = void 0;
19426
19549
  this.name = 'webgpu-context-register';
19550
+ this.rendererPlugin = rendererPlugin;
19427
19551
  }
19428
19552
 
19429
19553
  var _proto = ContextRegisterPlugin.prototype;
19430
19554
 
19431
19555
  _proto.init = function init(container) {
19556
+ container.register(DeviceRendererPlugin, {
19557
+ useValue: this.rendererPlugin
19558
+ });
19432
19559
  container.load(containerModule$5, true);
19433
19560
  };
19434
19561
 
19435
19562
  _proto.destroy = function destroy(container) {
19436
19563
  container.unload(containerModule$5);
19564
+ container.remove(DeviceRendererPlugin);
19437
19565
  };
19438
19566
 
19439
19567
  return ContextRegisterPlugin;
@@ -19446,14 +19574,15 @@
19446
19574
  var _this;
19447
19575
 
19448
19576
  _this = _AbstractRenderer.call(this, config) || this;
19577
+ var deviceRendererPlugin = new Plugin$1();
19449
19578
 
19450
- _this.registerPlugin(new ContextRegisterPlugin());
19579
+ _this.registerPlugin(new ContextRegisterPlugin(deviceRendererPlugin));
19451
19580
 
19452
19581
  _this.registerPlugin(new Plugin());
19453
19582
 
19454
19583
  _this.registerPlugin(new Plugin$4());
19455
19584
 
19456
- _this.registerPlugin(new Plugin$1());
19585
+ _this.registerPlugin(deviceRendererPlugin);
19457
19586
 
19458
19587
  _this.registerPlugin(new Plugin$2());
19459
19588