()
| 1786 | } |
| 1787 | |
| 1788 | async finishDraw() { |
| 1789 | this.flushDraw(); |
| 1790 | |
| 1791 | const states = []; |
| 1792 | |
| 1793 | // Only blit if we promoted to framebuffer this frame |
| 1794 | if (this._frameState === FRAME_STATE.PROMOTED) { |
| 1795 | while (this.activeFramebuffers.length > 0) { |
| 1796 | const fbo = this.activeFramebuffers.pop(); |
| 1797 | states.unshift({ fbo, diff: { ...this.states } }); |
| 1798 | } |
| 1799 | this.flushDraw(); |
| 1800 | |
| 1801 | this._pInst.push(); |
| 1802 | this.states.setValue('enableLighting', false); |
| 1803 | this.states.setValue('activeImageLight', null); |
| 1804 | this._pInst.setCamera(this.finalCamera); |
| 1805 | this._pInst.shader(this._getBlitShader()); |
| 1806 | this._pInst.resetMatrix(); |
| 1807 | this._pInst.imageMode(this._pInst.CENTER); |
| 1808 | this._pInst.image(this.mainFramebuffer, 0, 0); |
| 1809 | this._pInst.pop(); |
| 1810 | this.flushDraw(); |
| 1811 | } |
| 1812 | |
| 1813 | // Return all uniform buffers to their pools |
| 1814 | this._returnUniformBuffersToPool(); |
| 1815 | |
| 1816 | // Mark all geometry buffers for return after frame is complete |
| 1817 | for (const geometry of this._geometriesWithPools) { |
| 1818 | this._markGeometryBuffersForReturn(geometry); |
| 1819 | } |
| 1820 | |
| 1821 | // this.uniformBufferPool.push(...(await Promise.all(this.resettingUniformBuffers))); |
| 1822 | this.resettingUniformBuffers = []; |
| 1823 | |
| 1824 | // Return all vertex buffers to their pools |
| 1825 | this._returnVertexBuffersToPool(); |
| 1826 | |
| 1827 | // Destroy all retired buffers |
| 1828 | const retired = this._retiredBuffers; |
| 1829 | this._postSubmitCallbacks.push(() => { |
| 1830 | for (const buffer of retired) { |
| 1831 | if (buffer && buffer.destroy) { |
| 1832 | buffer.destroy(); |
| 1833 | } |
| 1834 | } |
| 1835 | }); |
| 1836 | this._retiredBuffers = []; |
| 1837 | |
| 1838 | if (this._frameState === FRAME_STATE.PROMOTED) { |
| 1839 | for (const { fbo, diff } of states) { |
| 1840 | if (fbo !== this.mainFramebuffer || this._frameState !== FRAME_STATE.PROMOTED) { |
| 1841 | fbo.begin(); |
| 1842 | } |
| 1843 | for (const key in diff) { |
| 1844 | this.states.setValue(key, diff[key]); |
| 1845 | } |
nothing calls this directly
no test coverage detected