@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/module.js CHANGED
@@ -236,7 +236,18 @@ var GLBuffer = /*#__PURE__*/ function() {
236
236
  var gl = rhi.gl;
237
237
  var glBuffer = gl.createBuffer();
238
238
  var glBufferUsage = this._getGLBufferUsage(gl, bufferUsage);
239
- var glBindTarget = type === BufferBindFlag.VertexBuffer ? gl.ARRAY_BUFFER : gl.ELEMENT_ARRAY_BUFFER;
239
+ var glBindTarget;
240
+ switch(type){
241
+ case BufferBindFlag.VertexBuffer:
242
+ glBindTarget = gl.ARRAY_BUFFER;
243
+ break;
244
+ case BufferBindFlag.IndexBuffer:
245
+ glBindTarget = gl.ELEMENT_ARRAY_BUFFER;
246
+ break;
247
+ case BufferBindFlag.ConstantBuffer:
248
+ glBindTarget = gl.UNIFORM_BUFFER;
249
+ break;
250
+ }
240
251
  this._gl = gl;
241
252
  this._glBuffer = glBuffer;
242
253
  this._glBufferUsage = glBufferUsage;
@@ -2083,6 +2094,18 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
2083
2094
  _proto.createPlatformTransformFeedbackPrimitive = function createPlatformTransformFeedbackPrimitive() {
2084
2095
  return new GLTransformFeedbackPrimitive(this._gl);
2085
2096
  };
2097
+ _proto.bindUniformBufferBase = function bindUniformBufferBase(bindingPoint, buffer) {
2098
+ var gl = this._gl;
2099
+ gl.bindBufferBase(gl.UNIFORM_BUFFER, bindingPoint, buffer._glBuffer);
2100
+ };
2101
+ _proto.bindUniformBlock = function bindUniformBlock(program, blockName, bindingPoint) {
2102
+ var gl = this._gl;
2103
+ var blockIndex = gl.getUniformBlockIndex(program, blockName);
2104
+ if (blockIndex !== gl.INVALID_INDEX) {
2105
+ gl.uniformBlockBinding(program, blockIndex, bindingPoint);
2106
+ }
2107
+ return blockIndex;
2108
+ };
2086
2109
  /**
2087
2110
  * Enable GL_RASTERIZER_DISCARD (WebGL2 only).
2088
2111
  */ _proto.enableRasterizerDiscard = function enableRasterizerDiscard() {
@@ -2348,6 +2371,9 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
2348
2371
  if (debugRenderInfo != null) {
2349
2372
  this._renderer = gl.getParameter(debugRenderInfo.UNMASKED_RENDERER_WEBGL);
2350
2373
  }
2374
+ if (this._isWebGL2) {
2375
+ this.maxUniformBlockSize = gl.getParameter(gl.MAX_UNIFORM_BLOCK_SIZE);
2376
+ }
2351
2377
  };
2352
2378
  _proto.destroy = function destroy() {
2353
2379
  var webCanvas = this._webCanvas;