When the GL backend processes an UpdateBuffer command, it always binds the buffer using buffer::Role::Vertex. When using WebGL, updating an index buffer this way causes a runtime error: INVALID_OPERATION: bindBuffer: element array buffers can not be bound to a different target.
Passing the buffer's actual role into gfx::core::command::Buffer::update_buffer() resolves this, but I realize this isn't ideal, since it modifies the public interface for command::Buffer. Is there a simpler way to accomplish this that I'm just missing? You can see my changes in this PR: tangmi/gfx#4
(I'm happy to PR changes here as well if we land on a good approach)
Short info header:
When the GL backend processes an UpdateBuffer command, it always binds the buffer using buffer::Role::Vertex. When using WebGL, updating an index buffer this way causes a runtime error:
INVALID_OPERATION: bindBuffer: element array buffers can not be bound to a different target
.Passing the buffer's actual role into
gfx::core::command::Buffer::update_buffer()
resolves this, but I realize this isn't ideal, since it modifies the public interface forcommand::Buffer
. Is there a simpler way to accomplish this that I'm just missing? You can see my changes in this PR: tangmi/gfx#4(I'm happy to PR changes here as well if we land on a good approach)