Handle negative index in vertex processing by kainino0x · Pull Request #5076 · gpuweb/gpuweb

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't the definition of vertexElementRelativeOffset still allow for negative vertexElementIndex? E.g., consider

|vertexElementIndex| * |vertexBufferLayout|.{{GPUVertexBufferLayout/arrayStride}} +
                |attributeDesc|.{{GPUVertexAttribute/offset}}.

as long as |attributeDesc|.{{GPUVertexAttribute/offset}} >= -|vertexElementIndex| * |vertexBufferLayout|.{{GPUVertexBufferLayout/arrayStride}} then as written I believe vertexElementIndex < 0 would still be allowed.

Is negative vertexElementIndex supported across all APIs? I could only find reference in the GL specification which says it is not. Specifically I would wonder which values are populated in vertex_index on the shader side.