• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // TransformFeedback.h: Defines the es2::TransformFeedback class
16 
17 #ifndef LIBGLESV2_TRANSFORM_FEEDBACK_H_
18 #define LIBGLESV2_TRANSFORM_FEEDBACK_H_
19 
20 #include "Buffer.h"
21 #include "Context.h"
22 #include "common/Object.hpp"
23 #include "Renderer/Renderer.hpp"
24 
25 #include <GLES2/gl2.h>
26 
27 namespace es2
28 {
29 
30 class TransformFeedback : public gl::NamedObject
31 {
32 public:
33 	TransformFeedback(GLuint name);
34 	~TransformFeedback();
35 
getBuffers()36 	BufferBinding* getBuffers() { return mBuffer; }
37 
38 	Buffer* getGenericBuffer() const;
39 	Buffer* getBuffer(GLuint index) const;
40 	GLuint getGenericBufferName() const;
41 	GLuint getBufferName(GLuint index) const;
42 	int getOffset(GLuint index) const;
43 	int getSize(GLuint index) const;
44 	bool isActive() const;
45 	bool isPaused() const;
46 	GLenum primitiveMode() const;
47 	int vertexOffset() const;
48 
49 	void setGenericBuffer(Buffer* buffer);
50 	void setBuffer(GLuint index, Buffer* buffer);
51 	void setBuffer(GLuint index, Buffer* buffer, GLintptr offset, GLsizeiptr size);
52 	void detachBuffer(GLuint buffer);
53 	void begin(GLenum primitiveMode);
54 	void end();
55 	void setPaused(bool paused);
56 	void addVertexOffset(int count);
57 
58 private:
59 	gl::BindingPointer<Buffer> mGenericBuffer;
60 	BufferBinding mBuffer[MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS];
61 
62 	bool mActive;
63 	bool mPaused;
64 	GLenum mPrimitiveMode;
65 	int mVertexOffset;
66 };
67 
68 }
69 
70 #endif // LIBGLESV2_TRANSFORM_FEEDBACK_H_
71