@galacean/engine-rhi-webgl 2.0.0-alpha.33 → 2.0.0-alpha.35

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 CHANGED
@@ -240,7 +240,18 @@ var GLBuffer = /*#__PURE__*/ function() {
240
240
  var gl = rhi.gl;
241
241
  var glBuffer = gl.createBuffer();
242
242
  var glBufferUsage = this._getGLBufferUsage(gl, bufferUsage);
243
- var glBindTarget = type === engineCore.BufferBindFlag.VertexBuffer ? gl.ARRAY_BUFFER : gl.ELEMENT_ARRAY_BUFFER;
243
+ var glBindTarget;
244
+ switch(type){
245
+ case engineCore.BufferBindFlag.VertexBuffer:
246
+ glBindTarget = gl.ARRAY_BUFFER;
247
+ break;
248
+ case engineCore.BufferBindFlag.IndexBuffer:
249
+ glBindTarget = gl.ELEMENT_ARRAY_BUFFER;
250
+ break;
251
+ case engineCore.BufferBindFlag.ConstantBuffer:
252
+ glBindTarget = gl.UNIFORM_BUFFER;
253
+ break;
254
+ }
244
255
  this._gl = gl;
245
256
  this._glBuffer = glBuffer;
246
257
  this._glBufferUsage = glBufferUsage;
@@ -2087,6 +2098,18 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
2087
2098
  _proto.createPlatformTransformFeedbackPrimitive = function createPlatformTransformFeedbackPrimitive() {
2088
2099
  return new GLTransformFeedbackPrimitive(this._gl);
2089
2100
  };
2101
+ _proto.bindUniformBufferBase = function bindUniformBufferBase(bindingPoint, buffer) {
2102
+ var gl = this._gl;
2103
+ gl.bindBufferBase(gl.UNIFORM_BUFFER, bindingPoint, buffer._glBuffer);
2104
+ };
2105
+ _proto.bindUniformBlock = function bindUniformBlock(program, blockName, bindingPoint) {
2106
+ var gl = this._gl;
2107
+ var blockIndex = gl.getUniformBlockIndex(program, blockName);
2108
+ if (blockIndex !== gl.INVALID_INDEX) {
2109
+ gl.uniformBlockBinding(program, blockIndex, bindingPoint);
2110
+ }
2111
+ return blockIndex;
2112
+ };
2090
2113
  /**
2091
2114
  * Enable GL_RASTERIZER_DISCARD (WebGL2 only).
2092
2115
  */ _proto.enableRasterizerDiscard = function enableRasterizerDiscard() {
@@ -2352,6 +2375,9 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
2352
2375
  if (debugRenderInfo != null) {
2353
2376
  this._renderer = gl.getParameter(debugRenderInfo.UNMASKED_RENDERER_WEBGL);
2354
2377
  }
2378
+ if (this._isWebGL2) {
2379
+ this.maxUniformBlockSize = gl.getParameter(gl.MAX_UNIFORM_BLOCK_SIZE);
2380
+ }
2355
2381
  };
2356
2382
  _proto.destroy = function destroy() {
2357
2383
  var webCanvas = this._webCanvas;