1// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//    http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// VertexArray.h: Defines the es2::VertexArray class
16
17#ifndef LIBGLESV2_VERTEX_ARRAY_H_
18#define LIBGLESV2_VERTEX_ARRAY_H_
19
20#include "Buffer.h"
21#include "Context.h"
22
23#include <GLES2/gl2.h>
24
25namespace es2
26{
27
28class VertexArray : public gl::NamedObject
29{
30public:
31	VertexArray(GLuint name);
32	~VertexArray();
33
34	const VertexAttribute& getVertexAttribute(size_t attributeIndex) const;
35	VertexAttributeArray& getVertexAttributes() { return mVertexAttributes; }
36
37	void detachBuffer(GLuint bufferName);
38	void setVertexAttribDivisor(GLuint index, GLuint divisor);
39	void enableAttribute(unsigned int attributeIndex, bool enabledState);
40	void setAttributeState(unsigned int attributeIndex, Buffer *boundBuffer, GLint size, GLenum type,
41	                       bool normalized, bool pureInteger, GLsizei stride, const void *pointer);
42
43	Buffer *getElementArrayBuffer() const { return mElementArrayBuffer; }
44	void setElementArrayBuffer(Buffer *buffer);
45
46private:
47	VertexAttributeArray mVertexAttributes;
48	gl::BindingPointer<Buffer> mElementArrayBuffer;
49};
50
51}
52
53#endif // LIBGLESV2_VERTEX_ARRAY_H_
54