@itwin/core-frontend 3.1.0-dev.15 → 3.1.0-dev.19

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.
@@ -1677,12 +1677,14 @@ class MRTCompositor extends Compositor {
1677
1677
  });
1678
1678
  }
1679
1679
  renderOpaque(commands, compositeFlags, renderForReadPixels) {
1680
- // Output the first 2 passes to color and pick data buffers. (All 3 in the case of rendering for readPixels()).
1681
- this._readPickDataFromPingPong = true;
1682
1680
  const needComposite = 0 /* None */ !== compositeFlags;
1683
1681
  const needAO = 0 /* None */ !== (compositeFlags & 4 /* AmbientOcclusion */);
1684
1682
  const fbStack = System_1.System.instance.frameBufferStack;
1685
- fbStack.execute(needComposite ? this._fbos.opaqueAndCompositeAll : this._fbos.opaqueAll, true, this.useMsBuffers, () => {
1683
+ // Output the first 2 passes to color and pick data buffers. (All 3 in the case of rendering for readPixels() or ambient occlusion).
1684
+ let fbo = (needComposite ? this._fbos.opaqueAndCompositeAll : this._fbos.opaqueAll);
1685
+ const useMsBuffers = fbo.isMultisampled && this.useMsBuffers;
1686
+ this._readPickDataFromPingPong = !useMsBuffers; // if multisampling then can read pick textures directly.
1687
+ fbStack.execute(fbo, true, useMsBuffers, () => {
1686
1688
  this.drawPass(commands, 2 /* OpaqueLinear */);
1687
1689
  this.drawPass(commands, 3 /* OpaquePlanar */, true);
1688
1690
  if (needAO || renderForReadPixels) {
@@ -1690,33 +1692,32 @@ class MRTCompositor extends Compositor {
1690
1692
  this._primitiveDrawState = PrimitiveDrawState.Pickable;
1691
1693
  this.drawPass(commands, 4 /* OpaqueGeneral */, true);
1692
1694
  this._primitiveDrawState = PrimitiveDrawState.Both;
1693
- if (this.useMsBuffers) {
1694
- const fbo = (needComposite ? this._fbos.opaqueAndCompositeAll : this._fbos.opaqueAll);
1695
+ if (useMsBuffers)
1695
1696
  fbo.blitMsBuffersToTextures(true);
1696
- }
1697
1697
  }
1698
1698
  });
1699
1699
  this._readPickDataFromPingPong = false;
1700
1700
  // The general pass (and following) will not bother to write to pick buffers and so can read from the actual pick buffers.
1701
1701
  if (!renderForReadPixels) {
1702
- fbStack.execute(needComposite ? this._fbos.opaqueAndCompositeColor : this._fbos.opaqueColor, true, this.useMsBuffers, () => {
1702
+ fbo = (needComposite ? this._fbos.opaqueAndCompositeColor : this._fbos.opaqueColor);
1703
+ fbStack.execute(fbo, true, useMsBuffers, () => {
1703
1704
  if (needAO)
1704
1705
  this._primitiveDrawState = PrimitiveDrawState.NonPickable;
1705
1706
  this.drawPass(commands, 4 /* OpaqueGeneral */, false);
1706
1707
  this._primitiveDrawState = PrimitiveDrawState.Both;
1707
1708
  this.drawPass(commands, 8 /* HiddenEdge */, false);
1708
1709
  });
1709
- if (this.useMsBuffers) {
1710
- const fbo = (needComposite ? this._fbos.opaqueAndCompositeColor : this._fbos.opaqueColor);
1710
+ if (useMsBuffers)
1711
1711
  fbo.blitMsBuffersToTextures(needComposite);
1712
- }
1713
1712
  }
1714
1713
  if (needAO)
1715
1714
  this.renderAmbientOcclusion();
1716
1715
  }
1717
1716
  renderLayers(commands, needComposite, pass) {
1718
- this._readPickDataFromPingPong = true;
1719
- System_1.System.instance.frameBufferStack.execute(needComposite ? this._fbos.opaqueAndCompositeAll : this._fbos.opaqueAll, true, 1 /* OpaqueLayers */ === pass && this.useMsBuffers, () => {
1717
+ const fbo = (needComposite ? this._fbos.opaqueAndCompositeAll : this._fbos.opaqueAll);
1718
+ const useMsBuffers = 1 /* OpaqueLayers */ === pass && fbo.isMultisampled && this.useMsBuffers;
1719
+ this._readPickDataFromPingPong = !useMsBuffers;
1720
+ System_1.System.instance.frameBufferStack.execute(fbo, true, useMsBuffers, () => {
1720
1721
  this.drawPass(commands, pass, true);
1721
1722
  });
1722
1723
  this._readPickDataFromPingPong = false;
@@ -1762,7 +1763,7 @@ class MRTCompositor extends Compositor {
1762
1763
  }
1763
1764
  pingPong() {
1764
1765
  if (this._fbos.opaqueAll.isMultisampled && this.useMsBuffers) {
1765
- // If we are multisampling we can just blit the FeatureId and DepthAndOrder buffers to their textures.
1766
+ // If we are multisampling we can just blit the FeatureId and DepthAndOrder MS buffers to their textures.
1766
1767
  this._fbos.opaqueAll.blitMsBuffersToTextures(false, 1);
1767
1768
  this._fbos.opaqueAll.blitMsBuffersToTextures(false, 2);
1768
1769
  }