Merge code from Draw* and Draw*Instanced methods

This made me realise we weren't supporting OES_element_index_uint in the
ANGLE_instanced_arrays extension.
This commit is contained in:
Anthony Ramine 2018-08-02 22:54:39 +02:00
parent c5aaae7333
commit 04c81c5cc3
3 changed files with 30 additions and 128 deletions

View file

@ -701,10 +701,6 @@ impl WebGLImpl {
ctx.gl().front_face(mode),
WebGLCommand::DisableVertexAttribArray(attrib_id) =>
ctx.gl().disable_vertex_attrib_array(attrib_id),
WebGLCommand::DrawArrays(mode, first, count) =>
ctx.gl().draw_arrays(mode, first, count),
WebGLCommand::DrawElements(mode, count, type_, offset) =>
ctx.gl().draw_elements(mode, count, type_, offset as u32),
WebGLCommand::EnableVertexAttribArray(attrib_id) =>
ctx.gl().enable_vertex_attrib_array(attrib_id),
WebGLCommand::Hint(name, val) =>
@ -957,9 +953,15 @@ impl WebGLImpl {
WebGLCommand::UseProgram(program_id) => {
ctx.gl().use_program(program_id.map_or(0, |p| p.get()))
}
WebGLCommand::DrawArrays { mode, first, count } => {
ctx.gl().draw_arrays(mode, first, count)
}
WebGLCommand::DrawArraysInstanced { mode, first, count, primcount } => {
ctx.gl().draw_arrays_instanced(mode, first, count, primcount)
}
WebGLCommand::DrawElements { mode, count, type_, offset } => {
ctx.gl().draw_elements(mode, count, type_, offset)
}
WebGLCommand::DrawElementsInstanced { mode, count, type_, offset, primcount } => {
ctx.gl().draw_elements_instanced(mode, count, type_, offset, primcount)
}