@galacean/engine-rhi-webgl 2.0.0-alpha.2 → 2.0.0-alpha.21
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/main.js +220 -30
- package/dist/main.js.map +1 -1
- package/dist/module.js +220 -30
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/types/GLBuffer.d.ts +1 -1
- package/types/GLRenderTarget.d.ts +1 -0
- package/types/GLTransformFeedback.d.ts +1 -0
- package/types/GLTransformFeedbackPrimitive.d.ts +1 -0
- package/types/WebGLGraphicDevice.d.ts +16 -1
package/dist/module.js
CHANGED
|
@@ -286,6 +286,14 @@ var GLBuffer = /*#__PURE__*/ function() {
|
|
|
286
286
|
throw "Buffer is write-only on WebGL1.0 platforms.";
|
|
287
287
|
}
|
|
288
288
|
};
|
|
289
|
+
_proto.copyFromBuffer = function copyFromBuffer(srcBuffer, srcByteOffset, dstByteOffset, byteLength) {
|
|
290
|
+
var gl = this._gl;
|
|
291
|
+
gl.bindBuffer(gl.COPY_READ_BUFFER, srcBuffer._glBuffer);
|
|
292
|
+
gl.bindBuffer(gl.COPY_WRITE_BUFFER, this._glBuffer);
|
|
293
|
+
gl.copyBufferSubData(gl.COPY_READ_BUFFER, gl.COPY_WRITE_BUFFER, srcByteOffset, dstByteOffset, byteLength);
|
|
294
|
+
gl.bindBuffer(gl.COPY_READ_BUFFER, null);
|
|
295
|
+
gl.bindBuffer(gl.COPY_WRITE_BUFFER, null);
|
|
296
|
+
};
|
|
289
297
|
_proto.destroy = function destroy() {
|
|
290
298
|
this._gl.deleteBuffer(this._glBuffer);
|
|
291
299
|
this._gl = null;
|
|
@@ -902,7 +910,7 @@ var GLBuffer = /*#__PURE__*/ function() {
|
|
|
902
910
|
return {
|
|
903
911
|
internalFormat: isSRGBColorSpace ? gl.SRGB8 : isWebGL2 ? gl.RGB8 : gl.RGB,
|
|
904
912
|
baseFormat: isSRGBColorSpace ? isWebGL2 ? gl.RGB : gl.SRGB8 : gl.RGB,
|
|
905
|
-
readFormat: gl.RGB,
|
|
913
|
+
readFormat: isWebGL2 ? gl.RGBA : gl.RGB,
|
|
906
914
|
dataType: gl.UNSIGNED_BYTE,
|
|
907
915
|
isCompressed: false,
|
|
908
916
|
alignment: 1
|
|
@@ -977,6 +985,7 @@ var GLBuffer = /*#__PURE__*/ function() {
|
|
|
977
985
|
return {
|
|
978
986
|
internalFormat: gl.R11F_G11F_B10F,
|
|
979
987
|
baseFormat: gl.RGB,
|
|
988
|
+
readFormat: gl.RGBA,
|
|
980
989
|
dataType: gl.FLOAT,
|
|
981
990
|
isCompressed: false,
|
|
982
991
|
alignment: 4
|
|
@@ -1409,11 +1418,6 @@ var GLBuffer = /*#__PURE__*/ function() {
|
|
|
1409
1418
|
})) {
|
|
1410
1419
|
throw new Error("MRT+Cube+[,MSAA] is not supported");
|
|
1411
1420
|
}
|
|
1412
|
-
var maxAntiAliasing = rhi.capability.maxAntiAliasing;
|
|
1413
|
-
if (target.antiAliasing > maxAntiAliasing) {
|
|
1414
|
-
Logger.warn("MSAA antiAliasing exceeds the limit and is automatically downgraded to:" + maxAntiAliasing);
|
|
1415
|
-
/** @ts-ignore */ target._antiAliasing = maxAntiAliasing;
|
|
1416
|
-
}
|
|
1417
1421
|
this._frameBuffer = this._gl.createFramebuffer();
|
|
1418
1422
|
// bind main FBO
|
|
1419
1423
|
this._bindMainFBO();
|
|
@@ -1503,7 +1507,7 @@ var GLBuffer = /*#__PURE__*/ function() {
|
|
|
1503
1507
|
_proto._bindMainFBO = function _bindMainFBO() {
|
|
1504
1508
|
var gl = this._gl;
|
|
1505
1509
|
var isWebGL2 = this._isWebGL2;
|
|
1506
|
-
/** @ts-ignore */ var _this__target = this._target, _depth = _this__target._depth, colorTextureCount = _this__target.colorTextureCount
|
|
1510
|
+
/** @ts-ignore */ var _this__target = this._target, _depth = _this__target._depth, colorTextureCount = _this__target.colorTextureCount; _this__target.width; _this__target.height;
|
|
1507
1511
|
var drawBuffers = new Array(colorTextureCount);
|
|
1508
1512
|
gl.bindFramebuffer(gl.FRAMEBUFFER, this._frameBuffer);
|
|
1509
1513
|
/** color render buffer */ for(var i = 0; i < colorTextureCount; i++){
|
|
@@ -1525,11 +1529,7 @@ var GLBuffer = /*#__PURE__*/ function() {
|
|
|
1525
1529
|
gl.framebufferTexture2D(gl.FRAMEBUFFER, platformTexture._formatDetail.attachment, gl.TEXTURE_2D, platformTexture._glTexture, 0);
|
|
1526
1530
|
} else if (this._target.antiAliasing <= 1) {
|
|
1527
1531
|
var _GLTexture__getRenderBufferDepthFormatDetail = GLTexture._getRenderBufferDepthFormatDetail(_depth, gl, isWebGL2), internalFormat = _GLTexture__getRenderBufferDepthFormatDetail.internalFormat, attachment1 = _GLTexture__getRenderBufferDepthFormatDetail.attachment;
|
|
1528
|
-
|
|
1529
|
-
this._depthRenderBuffer = depthRenderBuffer;
|
|
1530
|
-
gl.bindRenderbuffer(gl.RENDERBUFFER, depthRenderBuffer);
|
|
1531
|
-
gl.renderbufferStorage(gl.RENDERBUFFER, internalFormat, width, height);
|
|
1532
|
-
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment1, gl.RENDERBUFFER, depthRenderBuffer);
|
|
1532
|
+
this._depthRenderBuffer = this._createRenderBuffer(internalFormat, attachment1);
|
|
1533
1533
|
}
|
|
1534
1534
|
}
|
|
1535
1535
|
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
@@ -1538,32 +1538,38 @@ var GLBuffer = /*#__PURE__*/ function() {
|
|
|
1538
1538
|
_proto._bindMSAAFBO = function _bindMSAAFBO() {
|
|
1539
1539
|
var gl = this._gl;
|
|
1540
1540
|
var isWebGL2 = this._isWebGL2;
|
|
1541
|
-
var
|
|
1542
|
-
/** @ts-ignore */ var _this__target = this._target, _depth = _this__target._depth, colorTextureCount = _this__target.colorTextureCount, antiAliasing = _this__target.antiAliasing, width = _this__target.width, height = _this__target.height;
|
|
1541
|
+
/** @ts-ignore */ var _this__target = this._target, _depth = _this__target._depth, colorTextureCount = _this__target.colorTextureCount;
|
|
1543
1542
|
this._blitDrawBuffers = new Array(colorTextureCount);
|
|
1544
|
-
this._MSAADepthRenderBuffer = MSAADepthRenderBuffer;
|
|
1545
1543
|
gl.bindFramebuffer(gl.FRAMEBUFFER, this._MSAAFrameBuffer);
|
|
1546
1544
|
// prepare MRT+MSAA color RBOs
|
|
1547
1545
|
for(var i = 0; i < colorTextureCount; i++){
|
|
1548
|
-
var MSAAColorRenderBuffer = gl.createRenderbuffer();
|
|
1549
|
-
this._MSAAColorRenderBuffers[i] = MSAAColorRenderBuffer;
|
|
1550
1546
|
this._blitDrawBuffers[i] = gl.NONE;
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + i, gl.RENDERBUFFER, MSAAColorRenderBuffer);
|
|
1547
|
+
var internalFormat = /** @ts-ignore */ this._target.getColorTexture(i)._platformTexture._formatDetail.internalFormat;
|
|
1548
|
+
this._MSAAColorRenderBuffers[i] = this._createRenderBuffer(internalFormat, gl.COLOR_ATTACHMENT0 + i);
|
|
1554
1549
|
}
|
|
1555
1550
|
gl.drawBuffers(this._oriDrawBuffers);
|
|
1556
1551
|
// prepare MSAA depth RBO
|
|
1557
1552
|
if (_depth !== null) {
|
|
1558
|
-
var _ref = _instanceof(_depth, Texture) ? /** @ts-ignore */ _depth._platformTexture._formatDetail : GLTexture._getRenderBufferDepthFormatDetail(_depth, gl, isWebGL2),
|
|
1559
|
-
|
|
1560
|
-
gl.renderbufferStorageMultisample(gl.RENDERBUFFER, antiAliasing, internalFormat, width, height);
|
|
1561
|
-
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, MSAADepthRenderBuffer);
|
|
1553
|
+
var _ref = _instanceof(_depth, Texture) ? /** @ts-ignore */ _depth._platformTexture._formatDetail : GLTexture._getRenderBufferDepthFormatDetail(_depth, gl, isWebGL2), internalFormat1 = _ref.internalFormat, attachment = _ref.attachment;
|
|
1554
|
+
this._MSAADepthRenderBuffer = this._createRenderBuffer(internalFormat1, attachment);
|
|
1562
1555
|
}
|
|
1563
1556
|
this._checkFrameBuffer();
|
|
1564
1557
|
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
1565
1558
|
gl.bindRenderbuffer(gl.RENDERBUFFER, null);
|
|
1566
1559
|
};
|
|
1560
|
+
_proto._createRenderBuffer = function _createRenderBuffer(internalFormat, attachment) {
|
|
1561
|
+
var gl = this._gl;
|
|
1562
|
+
var _this__target = this._target, width = _this__target.width, height = _this__target.height, antiAliasing = _this__target.antiAliasing;
|
|
1563
|
+
var renderBuffer = gl.createRenderbuffer();
|
|
1564
|
+
gl.bindRenderbuffer(gl.RENDERBUFFER, renderBuffer);
|
|
1565
|
+
if (antiAliasing > 1) {
|
|
1566
|
+
gl.renderbufferStorageMultisample(gl.RENDERBUFFER, antiAliasing, internalFormat, width, height);
|
|
1567
|
+
} else {
|
|
1568
|
+
gl.renderbufferStorage(gl.RENDERBUFFER, internalFormat, width, height);
|
|
1569
|
+
}
|
|
1570
|
+
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, renderBuffer);
|
|
1571
|
+
return renderBuffer;
|
|
1572
|
+
};
|
|
1567
1573
|
_proto._checkFrameBuffer = function _checkFrameBuffer() {
|
|
1568
1574
|
var gl = this._gl;
|
|
1569
1575
|
var e = gl.checkFramebufferStatus(gl.FRAMEBUFFER);
|
|
@@ -1681,12 +1687,12 @@ var GLBuffer = /*#__PURE__*/ function() {
|
|
|
1681
1687
|
height = height || Math.max(1, this._texture.height >> mipLevel) - y;
|
|
1682
1688
|
length = length || this._texture.length;
|
|
1683
1689
|
this._bind();
|
|
1684
|
-
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, 0);
|
|
1685
|
-
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0);
|
|
1686
|
-
gl.pixelStorei(gl.UNPACK_ALIGNMENT, formatDetail.alignment);
|
|
1687
1690
|
if (isCompressed) {
|
|
1688
1691
|
gl.compressedTexSubImage3D(target, mipLevel, x, y, offsetIndex, width, height, length, internalFormat, colorBuffer);
|
|
1689
1692
|
} else {
|
|
1693
|
+
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, 0);
|
|
1694
|
+
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0);
|
|
1695
|
+
gl.pixelStorei(gl.UNPACK_ALIGNMENT, formatDetail.alignment);
|
|
1690
1696
|
gl.texSubImage3D(target, mipLevel, x, y, offsetIndex, width, height, length, baseFormat, dataType, colorBuffer);
|
|
1691
1697
|
}
|
|
1692
1698
|
};
|
|
@@ -1761,9 +1767,6 @@ var GLBuffer = /*#__PURE__*/ function() {
|
|
|
1761
1767
|
width = width || mipSize - x;
|
|
1762
1768
|
height = height || mipSize - y;
|
|
1763
1769
|
this._bind();
|
|
1764
|
-
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, 0);
|
|
1765
|
-
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0);
|
|
1766
|
-
gl.pixelStorei(gl.UNPACK_ALIGNMENT, formatDetail.alignment);
|
|
1767
1770
|
if (isCompressed) {
|
|
1768
1771
|
var mipBit = 1 << mipLevel;
|
|
1769
1772
|
if (isWebGL2 || this._compressedFaceFilled[face] & mipBit) {
|
|
@@ -1773,6 +1776,9 @@ var GLBuffer = /*#__PURE__*/ function() {
|
|
|
1773
1776
|
this._compressedFaceFilled[face] |= mipBit;
|
|
1774
1777
|
}
|
|
1775
1778
|
} else {
|
|
1779
|
+
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, 0);
|
|
1780
|
+
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0);
|
|
1781
|
+
gl.pixelStorei(gl.UNPACK_ALIGNMENT, formatDetail.alignment);
|
|
1776
1782
|
gl.texSubImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + face, mipLevel, x, y, width, height, baseFormat, dataType, colorBuffer);
|
|
1777
1783
|
}
|
|
1778
1784
|
};
|
|
@@ -1797,6 +1803,159 @@ var GLBuffer = /*#__PURE__*/ function() {
|
|
|
1797
1803
|
return GLTextureCube;
|
|
1798
1804
|
}(GLTexture);
|
|
1799
1805
|
|
|
1806
|
+
/**
|
|
1807
|
+
* @internal
|
|
1808
|
+
* WebGL2 implementation of Transform Feedback.
|
|
1809
|
+
*/ var GLTransformFeedback = /*#__PURE__*/ function() {
|
|
1810
|
+
function GLTransformFeedback(rhi) {
|
|
1811
|
+
var gl = rhi.gl;
|
|
1812
|
+
this._gl = gl;
|
|
1813
|
+
this._glTransformFeedback = gl.createTransformFeedback();
|
|
1814
|
+
}
|
|
1815
|
+
var _proto = GLTransformFeedback.prototype;
|
|
1816
|
+
_proto.bindBufferRange = function bindBufferRange(index, buffer, byteOffset, byteSize) {
|
|
1817
|
+
var gl = this._gl;
|
|
1818
|
+
gl.bindBufferRange(gl.TRANSFORM_FEEDBACK_BUFFER, index, buffer._glBuffer, byteOffset, byteSize);
|
|
1819
|
+
};
|
|
1820
|
+
_proto.unbindBuffer = function unbindBuffer(index) {
|
|
1821
|
+
var gl = this._gl;
|
|
1822
|
+
gl.bindBufferBase(gl.TRANSFORM_FEEDBACK_BUFFER, index, null);
|
|
1823
|
+
};
|
|
1824
|
+
_proto.begin = function begin(primitiveMode) {
|
|
1825
|
+
this._gl.beginTransformFeedback(primitiveMode);
|
|
1826
|
+
};
|
|
1827
|
+
_proto.end = function end() {
|
|
1828
|
+
this._gl.endTransformFeedback();
|
|
1829
|
+
};
|
|
1830
|
+
_proto.bind = function bind() {
|
|
1831
|
+
var gl = this._gl;
|
|
1832
|
+
gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, this._glTransformFeedback);
|
|
1833
|
+
};
|
|
1834
|
+
_proto.unbind = function unbind() {
|
|
1835
|
+
var gl = this._gl;
|
|
1836
|
+
gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, null);
|
|
1837
|
+
};
|
|
1838
|
+
_proto.destroy = function destroy() {
|
|
1839
|
+
if (this._glTransformFeedback) {
|
|
1840
|
+
this._gl.deleteTransformFeedback(this._glTransformFeedback);
|
|
1841
|
+
this._glTransformFeedback = null;
|
|
1842
|
+
}
|
|
1843
|
+
};
|
|
1844
|
+
return GLTransformFeedback;
|
|
1845
|
+
}();
|
|
1846
|
+
|
|
1847
|
+
function _array_like_to_array(arr, len) {
|
|
1848
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
1849
|
+
|
|
1850
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
1851
|
+
|
|
1852
|
+
return arr2;
|
|
1853
|
+
}
|
|
1854
|
+
|
|
1855
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
1856
|
+
if (!o) return;
|
|
1857
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
1858
|
+
|
|
1859
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1860
|
+
|
|
1861
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1862
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
1863
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1866
|
+
function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
1867
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
1868
|
+
|
|
1869
|
+
if (it) return (it = it.call(o)).next.bind(it);
|
|
1870
|
+
// Fallback for engines without symbol support
|
|
1871
|
+
if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
1872
|
+
if (it) o = it;
|
|
1873
|
+
|
|
1874
|
+
var i = 0;
|
|
1875
|
+
|
|
1876
|
+
return function() {
|
|
1877
|
+
if (i >= o.length) return { done: true };
|
|
1878
|
+
|
|
1879
|
+
return { done: false, value: o[i++] };
|
|
1880
|
+
};
|
|
1881
|
+
}
|
|
1882
|
+
|
|
1883
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1884
|
+
}
|
|
1885
|
+
|
|
1886
|
+
/**
|
|
1887
|
+
* @internal
|
|
1888
|
+
* WebGL2 implementation of Transform Feedback primitive.
|
|
1889
|
+
* Maintains two VAOs (one per read direction), auto-rebuilds when program changes.
|
|
1890
|
+
*/ var GLTransformFeedbackPrimitive = /*#__PURE__*/ function() {
|
|
1891
|
+
function GLTransformFeedbackPrimitive(gl) {
|
|
1892
|
+
this._lastProgramId = -1;
|
|
1893
|
+
this._gl = gl;
|
|
1894
|
+
}
|
|
1895
|
+
var _proto = GLTransformFeedbackPrimitive.prototype;
|
|
1896
|
+
_proto.updateVertexLayout = function updateVertexLayout(program, readBinding, writeBinding, feedbackElements, inputBinding, inputElements) {
|
|
1897
|
+
if (program.id === this._lastProgramId) return;
|
|
1898
|
+
this._deleteVAOs();
|
|
1899
|
+
var attribs = program.attributeLocation;
|
|
1900
|
+
this._vaoA = this._createVAO(attribs, readBinding, feedbackElements, inputBinding, inputElements);
|
|
1901
|
+
this._vaoB = this._createVAO(attribs, writeBinding, feedbackElements, inputBinding, inputElements);
|
|
1902
|
+
this._lastProgramId = program.id;
|
|
1903
|
+
this._gl.bindVertexArray(null);
|
|
1904
|
+
};
|
|
1905
|
+
_proto.bind = function bind(readIsA) {
|
|
1906
|
+
this._gl.bindVertexArray(readIsA ? this._vaoA : this._vaoB);
|
|
1907
|
+
};
|
|
1908
|
+
_proto.unbind = function unbind() {
|
|
1909
|
+
this._gl.bindVertexArray(null);
|
|
1910
|
+
};
|
|
1911
|
+
_proto.draw = function draw(mode, first, count) {
|
|
1912
|
+
this._gl.drawArrays(mode, first, count);
|
|
1913
|
+
};
|
|
1914
|
+
_proto.invalidate = function invalidate() {
|
|
1915
|
+
this._deleteVAOs();
|
|
1916
|
+
};
|
|
1917
|
+
_proto.destroy = function destroy() {
|
|
1918
|
+
this._deleteVAOs();
|
|
1919
|
+
};
|
|
1920
|
+
_proto._deleteVAOs = function _deleteVAOs() {
|
|
1921
|
+
var gl = this._gl;
|
|
1922
|
+
if (this._vaoA) {
|
|
1923
|
+
gl.deleteVertexArray(this._vaoA);
|
|
1924
|
+
this._vaoA = null;
|
|
1925
|
+
}
|
|
1926
|
+
if (this._vaoB) {
|
|
1927
|
+
gl.deleteVertexArray(this._vaoB);
|
|
1928
|
+
this._vaoB = null;
|
|
1929
|
+
}
|
|
1930
|
+
this._lastProgramId = -1;
|
|
1931
|
+
};
|
|
1932
|
+
_proto._createVAO = function _createVAO(attribs, feedbackBinding, feedbackElements, inputBinding, inputElements) {
|
|
1933
|
+
var gl = this._gl;
|
|
1934
|
+
var vao = gl.createVertexArray();
|
|
1935
|
+
gl.bindVertexArray(vao);
|
|
1936
|
+
// @ts-ignore: Access internal _platformBuffer across packages
|
|
1937
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, feedbackBinding.buffer._platformBuffer._glBuffer);
|
|
1938
|
+
this._bindElements(gl, attribs, feedbackElements, feedbackBinding.stride);
|
|
1939
|
+
// @ts-ignore: Access internal _platformBuffer across packages
|
|
1940
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, inputBinding.buffer._platformBuffer._glBuffer);
|
|
1941
|
+
this._bindElements(gl, attribs, inputElements, inputBinding.stride);
|
|
1942
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
1943
|
+
return vao;
|
|
1944
|
+
};
|
|
1945
|
+
_proto._bindElements = function _bindElements(gl, attribs, elements, stride) {
|
|
1946
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(elements), _step; !(_step = _iterator()).done;){
|
|
1947
|
+
var element = _step.value;
|
|
1948
|
+
var loc = attribs[element.attribute];
|
|
1949
|
+
if (loc !== undefined && loc !== -1) {
|
|
1950
|
+
var info = element._formatMetaInfo;
|
|
1951
|
+
gl.enableVertexAttribArray(loc);
|
|
1952
|
+
gl.vertexAttribPointer(loc, info.size, info.type, info.normalized, stride, element.offset);
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
};
|
|
1956
|
+
return GLTransformFeedbackPrimitive;
|
|
1957
|
+
}();
|
|
1958
|
+
|
|
1800
1959
|
/**
|
|
1801
1960
|
* WebGL mode.
|
|
1802
1961
|
*/ var WebGLMode = /*#__PURE__*/ function(WebGLMode) {
|
|
@@ -1918,6 +2077,37 @@ var GLBuffer = /*#__PURE__*/ function() {
|
|
|
1918
2077
|
if (bufferUsage === void 0) bufferUsage = BufferUsage.Static;
|
|
1919
2078
|
return new GLBuffer(this, type, byteLength, bufferUsage, data);
|
|
1920
2079
|
};
|
|
2080
|
+
_proto.createPlatformTransformFeedback = function createPlatformTransformFeedback() {
|
|
2081
|
+
return new GLTransformFeedback(this);
|
|
2082
|
+
};
|
|
2083
|
+
_proto.createPlatformTransformFeedbackPrimitive = function createPlatformTransformFeedbackPrimitive() {
|
|
2084
|
+
return new GLTransformFeedbackPrimitive(this._gl);
|
|
2085
|
+
};
|
|
2086
|
+
/**
|
|
2087
|
+
* Enable GL_RASTERIZER_DISCARD (WebGL2 only).
|
|
2088
|
+
*/ _proto.enableRasterizerDiscard = function enableRasterizerDiscard() {
|
|
2089
|
+
if (this._isWebGL2) {
|
|
2090
|
+
var gl = this._gl;
|
|
2091
|
+
gl.enable(gl.RASTERIZER_DISCARD);
|
|
2092
|
+
}
|
|
2093
|
+
};
|
|
2094
|
+
/**
|
|
2095
|
+
* Disable GL_RASTERIZER_DISCARD (WebGL2 only).
|
|
2096
|
+
*/ _proto.disableRasterizerDiscard = function disableRasterizerDiscard() {
|
|
2097
|
+
if (this._isWebGL2) {
|
|
2098
|
+
var gl = this._gl;
|
|
2099
|
+
gl.disable(gl.RASTERIZER_DISCARD);
|
|
2100
|
+
}
|
|
2101
|
+
};
|
|
2102
|
+
/**
|
|
2103
|
+
* Invalidate the cached shader program state.
|
|
2104
|
+
* Call this after using a custom program (e.g., Transform Feedback) outside the engine's pipeline.
|
|
2105
|
+
*/ _proto.invalidateShaderProgramState = function invalidateShaderProgramState() {
|
|
2106
|
+
if (this._currentBindShaderProgram) {
|
|
2107
|
+
this._gl.useProgram(null);
|
|
2108
|
+
this._currentBindShaderProgram = null;
|
|
2109
|
+
}
|
|
2110
|
+
};
|
|
1921
2111
|
_proto.requireExtension = function requireExtension(ext) {
|
|
1922
2112
|
return this._extensions.requireExtension(ext);
|
|
1923
2113
|
};
|