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