Closed dmnsgn closed 3 months ago
From this:
if (!gl.drawElementsInstanced) {
const ext = gl.getExtension("ANGLE_instanced_arrays");
if (!ext) {
// TODO: this._caps[CAPS_INSTANCED_ARRAYS] = false;
gl.drawElementsInstanced = () => {
throw new Error(
"gl.drawElementsInstanced not available. ANGLE_instanced_arrays not supported"
);
};
gl.drawArraysInstanced = () => {
throw new Error(
"gl.drawArraysInstanced not available. ANGLE_instanced_arrays not supported"
);
};
gl.vertexAttribDivisor = () => {
throw new Error(
"gl.vertexAttribDivisor not available. ANGLE_instanced_arrays not supported"
);
};
} else {
// TODO: this._caps[CAPS_INSTANCED_ARRAYS] = true;
gl.drawElementsInstanced = ext.drawElementsInstancedANGLE.bind(ext);
gl.drawArraysInstanced = ext.drawArraysInstancedANGLE.bind(ext);
gl.vertexAttribDivisor = ext.vertexAttribDivisorANGLE.bind(ext);
capabilities.instancedArrays = true;
capabilities.instancing = true; // TODO: deprecate
}
} else {
capabilities.instancedArrays = true;
capabilities.instancing = true; // TODO: deprecate
}
to this:
if (!gl.drawElementsInstanced) {
const ext = gl.getExtension("ANGLE_instanced_arrays");
gl.drawElementsInstanced = ext.drawElementsInstancedANGLE.bind(ext);
gl.drawArraysInstanced = ext.drawArraysInstancedANGLE.bind(ext);
gl.vertexAttribDivisor = ext.vertexAttribDivisorANGLE.bind(ext);
}
and removing capabilities.instancing/instancedArrays/vertexArrayObject.
Looks good
OES_element_index_uint and OES_standard_derivatives still need a call to get activated.
According to MDN WebGL_best_practices,
ANGLE_instanced_arrays
,OES_standard_derivatives
,OES_element_index_uint
andOES_vertex_array_object
are universally supported in WebGL 1.So we could remove the checks for their existence and just polyfill directly.
Related #114.