Webgl / remove handling of element_index_uint extension
From now on we will assume this extension is always enabled. An error message have been added in the unlikely scenario of a lack of support.
This commit is contained in:
@@ -2,12 +2,10 @@
|
||||
* @module ol/webgl/Helper
|
||||
*/
|
||||
import {getUid} from '../util.js';
|
||||
import {EXTENSIONS as WEBGL_EXTENSIONS} from '../webgl.js';
|
||||
import Disposable from '../Disposable.js';
|
||||
import {includes} from '../array.js';
|
||||
import {listen, unlistenAll} from '../events.js';
|
||||
import {clear} from '../obj.js';
|
||||
import {TEXTURE_2D, TEXTURE_WRAP_S, TEXTURE_WRAP_T} from '../webgl.js';
|
||||
import {TEXTURE_2D, TEXTURE_WRAP_S, TEXTURE_WRAP_T, EXTENSIONS as WEBGL_EXTENSIONS} from '../webgl.js';
|
||||
import ContextEventType from '../webgl/ContextEventType.js';
|
||||
import {
|
||||
create as createTransform,
|
||||
@@ -19,6 +17,8 @@ import {
|
||||
import {create, fromTransform} from '../vec/mat4.js';
|
||||
import WebGLPostProcessingPass from './PostProcessingPass.js';
|
||||
import {getContext} from '../webgl.js';
|
||||
import {includes} from '../array.js';
|
||||
import {assert} from '../asserts.js';
|
||||
|
||||
|
||||
/**
|
||||
@@ -258,16 +258,8 @@ class WebGLHelper extends Disposable {
|
||||
*/
|
||||
this.currentProgram_ = null;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
this.hasOESElementIndexUint_ = includes(WEBGL_EXTENSIONS, 'OES_element_index_uint');
|
||||
|
||||
// use the OES_element_index_uint extension if available
|
||||
if (this.hasOESElementIndexUint_) {
|
||||
gl.getExtension('OES_element_index_uint');
|
||||
}
|
||||
assert(includes(WEBGL_EXTENSIONS, 'OES_element_index_uint'), 63);
|
||||
gl.getExtension('OES_element_index_uint');
|
||||
|
||||
listen(this.canvas_, ContextEventType.LOST,
|
||||
this.handleWebGLContextLost, this);
|
||||
@@ -453,9 +445,8 @@ class WebGLHelper extends Disposable {
|
||||
*/
|
||||
drawElements(start, end) {
|
||||
const gl = this.getGL();
|
||||
const elementType = this.hasOESElementIndexUint_ ?
|
||||
gl.UNSIGNED_INT : gl.UNSIGNED_SHORT;
|
||||
const elementSize = this.hasOESElementIndexUint_ ? 4 : 2;
|
||||
const elementType = gl.UNSIGNED_INT;
|
||||
const elementSize = 4;
|
||||
|
||||
const numItems = end - start;
|
||||
const offsetInBytes = start * elementSize;
|
||||
@@ -747,16 +738,6 @@ class WebGLHelper extends Disposable {
|
||||
handleWebGLContextRestored() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the `OES_element_index_uint` WebGL extension is enabled for this context.
|
||||
* @return {boolean} If true, Uint16Array should be used for element array buffers
|
||||
* instead of Uint8Array.
|
||||
* @api
|
||||
*/
|
||||
getElementIndexUintEnabled() {
|
||||
return this.hasOESElementIndexUint_;
|
||||
}
|
||||
|
||||
// TODO: shutdown program
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user