@galacean/engine-rhi-webgl 2.0.0-alpha.51 → 2.0.0-alpha.52
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 +51 -63
- package/dist/main.js.map +1 -1
- package/dist/module.js +51 -63
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/types/GLBuffer.d.ts +1 -1
- package/types/GLTransformFeedbackPrimitive.d.ts +7 -6
package/dist/module.js
CHANGED
|
@@ -1897,65 +1897,44 @@ var GLBuffer = /*#__PURE__*/ function() {
|
|
|
1897
1897
|
return GLTransformFeedback;
|
|
1898
1898
|
}();
|
|
1899
1899
|
|
|
1900
|
-
function _array_like_to_array(arr, len) {
|
|
1901
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
1902
|
-
|
|
1903
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
1904
|
-
|
|
1905
|
-
return arr2;
|
|
1906
|
-
}
|
|
1907
|
-
|
|
1908
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
1909
|
-
if (!o) return;
|
|
1910
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
1911
|
-
|
|
1912
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1913
|
-
|
|
1914
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1915
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
1916
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
1917
|
-
}
|
|
1918
|
-
|
|
1919
|
-
function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
1920
|
-
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
1921
|
-
|
|
1922
|
-
if (it) return (it = it.call(o)).next.bind(it);
|
|
1923
|
-
// Fallback for engines without symbol support
|
|
1924
|
-
if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
1925
|
-
if (it) o = it;
|
|
1926
|
-
|
|
1927
|
-
var i = 0;
|
|
1928
|
-
|
|
1929
|
-
return function() {
|
|
1930
|
-
if (i >= o.length) return { done: true };
|
|
1931
|
-
|
|
1932
|
-
return { done: false, value: o[i++] };
|
|
1933
|
-
};
|
|
1934
|
-
}
|
|
1935
|
-
|
|
1936
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1937
|
-
}
|
|
1938
|
-
|
|
1939
1900
|
/**
|
|
1940
1901
|
* @internal
|
|
1941
1902
|
* WebGL2 implementation of Transform Feedback primitive.
|
|
1942
|
-
* Maintains two VAOs (one per read direction),
|
|
1903
|
+
* Maintains two VAOs (one per read direction), rebuilding when the program or input bindings change.
|
|
1943
1904
|
*/ var GLTransformFeedbackPrimitive = /*#__PURE__*/ function() {
|
|
1944
1905
|
function GLTransformFeedbackPrimitive(gl) {
|
|
1945
1906
|
this._lastProgramId = -1;
|
|
1907
|
+
this._lastInputBindings = [];
|
|
1946
1908
|
this._gl = gl;
|
|
1947
1909
|
}
|
|
1948
1910
|
var _proto = GLTransformFeedbackPrimitive.prototype;
|
|
1949
|
-
_proto.
|
|
1950
|
-
|
|
1951
|
-
this.
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1911
|
+
_proto.bind = function bind(program, bindingA, bindingB, feedbackElements, inputBindings, inputElements, readIsA) {
|
|
1912
|
+
var layoutChanged = program.id !== this._lastProgramId;
|
|
1913
|
+
var lastInputBindings = this._lastInputBindings;
|
|
1914
|
+
if (!layoutChanged) {
|
|
1915
|
+
if (inputBindings.length !== lastInputBindings.length) {
|
|
1916
|
+
layoutChanged = true;
|
|
1917
|
+
} else {
|
|
1918
|
+
for(var i = 0, n = inputBindings.length; i < n; i++){
|
|
1919
|
+
if (inputBindings[i] !== lastInputBindings[i]) {
|
|
1920
|
+
layoutChanged = true;
|
|
1921
|
+
break;
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
if (layoutChanged) {
|
|
1927
|
+
this._deleteVAOs();
|
|
1928
|
+
var attribs = program.attributeLocation;
|
|
1929
|
+
this._vaoA = this._createVAO(attribs, bindingA, feedbackElements, inputBindings, inputElements);
|
|
1930
|
+
this._vaoB = this._createVAO(attribs, bindingB, feedbackElements, inputBindings, inputElements);
|
|
1931
|
+
this._lastProgramId = program.id;
|
|
1932
|
+
lastInputBindings.length = inputBindings.length;
|
|
1933
|
+
for(var i1 = 0, n1 = inputBindings.length; i1 < n1; i1++){
|
|
1934
|
+
lastInputBindings[i1] = inputBindings[i1];
|
|
1935
|
+
}
|
|
1936
|
+
this._gl.bindVertexArray(null);
|
|
1937
|
+
}
|
|
1959
1938
|
this._gl.bindVertexArray(readIsA ? this._vaoA : this._vaoB);
|
|
1960
1939
|
};
|
|
1961
1940
|
_proto.unbind = function unbind() {
|
|
@@ -1981,27 +1960,36 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
|
1981
1960
|
this._vaoB = null;
|
|
1982
1961
|
}
|
|
1983
1962
|
this._lastProgramId = -1;
|
|
1963
|
+
this._lastInputBindings.length = 0;
|
|
1984
1964
|
};
|
|
1985
|
-
_proto._createVAO = function _createVAO(attribs, feedbackBinding, feedbackElements,
|
|
1965
|
+
_proto._createVAO = function _createVAO(attribs, feedbackBinding, feedbackElements, inputBindings, inputElements) {
|
|
1986
1966
|
var gl = this._gl;
|
|
1987
1967
|
var vao = gl.createVertexArray();
|
|
1988
1968
|
gl.bindVertexArray(vao);
|
|
1989
1969
|
gl.bindBuffer(gl.ARRAY_BUFFER, feedbackBinding.buffer._platformBuffer._glBuffer);
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1970
|
+
for(var i = 0, n = feedbackElements.length; i < n; i++){
|
|
1971
|
+
this._bindElement(attribs, feedbackElements[i], feedbackBinding.stride);
|
|
1972
|
+
}
|
|
1973
|
+
var lastInputBinding;
|
|
1974
|
+
for(var i1 = 0, n1 = inputElements.length; i1 < n1; i1++){
|
|
1975
|
+
var element = inputElements[i1];
|
|
1976
|
+
var inputBinding = inputBindings[element.bindingIndex];
|
|
1977
|
+
if (inputBinding !== lastInputBinding) {
|
|
1978
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, inputBinding.buffer._platformBuffer._glBuffer);
|
|
1979
|
+
lastInputBinding = inputBinding;
|
|
1980
|
+
}
|
|
1981
|
+
this._bindElement(attribs, element, inputBinding.stride);
|
|
1982
|
+
}
|
|
1993
1983
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
1994
1984
|
return vao;
|
|
1995
1985
|
};
|
|
1996
|
-
_proto.
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
gl.vertexAttribPointer(loc, info.size, info.type, info.normalized, stride, element.offset);
|
|
2004
|
-
}
|
|
1986
|
+
_proto._bindElement = function _bindElement(attribs, element, stride) {
|
|
1987
|
+
var gl = this._gl;
|
|
1988
|
+
var loc = attribs[element.attribute];
|
|
1989
|
+
if (loc !== undefined && loc !== -1) {
|
|
1990
|
+
var info = element._formatMetaInfo;
|
|
1991
|
+
gl.enableVertexAttribArray(loc);
|
|
1992
|
+
gl.vertexAttribPointer(loc, info.size, info.type, info.normalized, stride, element.offset);
|
|
2005
1993
|
}
|
|
2006
1994
|
};
|
|
2007
1995
|
return GLTransformFeedbackPrimitive;
|