void WebGLContext::VertexAttribPointer(GLuint index, GLint size, GLenum type, WebGLboolean normalized, GLsizei stride, WebGLintptr byteOffset) { if (IsContextLost()) return; if (!ValidateAttribIndex(index, "vertexAttribPointer")) return; if (!ValidateAttribPointer(false, index, size, type, normalized, stride, byteOffset, "vertexAttribPointer")) return; MOZ_ASSERT(mBoundVertexArray); InvalidateBufferFetching(); /* XXX make work with bufferSubData & heterogeneous types if (type != mBoundArrayBuffer->GLType()) return ErrorInvalidOperation("vertexAttribPointer: type must match bound VBO type: %d != %d", type, mBoundArrayBuffer->GLType()); */ MakeContextCurrent(); gl->fVertexAttribPointer(index, size, type, normalized, stride, reinterpret_cast<void*>(byteOffset)); WebGLVertexAttribData& vd = mBoundVertexArray->mAttribs[index]; const bool integerFunc = false; vd.VertexAttribPointer(integerFunc, mBoundArrayBuffer, size, type, normalized, stride, byteOffset); }
void WebGL2Context::VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset) { if (IsContextLost()) return; if (!ValidateAttribIndex(index, "vertexAttribIPointer")) return; if (!ValidateAttribPointer(true, index, size, type, LOCAL_GL_FALSE, stride, offset, "vertexAttribIPointer")) { return; } MOZ_ASSERT(mBoundVertexArray); mBoundVertexArray->EnsureAttrib(index); InvalidateBufferFetching(); WebGLVertexAttribData& vd = mBoundVertexArray->mAttribs[index]; vd.buf = mBoundArrayBuffer; vd.stride = stride; vd.size = size; vd.byteOffset = offset; vd.type = type; vd.normalized = false; vd.integer = true; MakeContextCurrent(); gl->fVertexAttribIPointer(index, size, type, stride, reinterpret_cast<void*>(offset)); }