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* getBuffer(GLuint index) const; 39 GLuint getBufferName(GLuint index) const; 40 int getOffset(GLuint index) const; 41 int getSize(GLuint index) const; 42 bool isActive() const; 43 bool isPaused() const; 44 GLenum primitiveMode() const; 45 int vertexOffset() const; 46 47 void setBuffer(GLuint index, Buffer* buffer); 48 void setBuffer(GLuint index, Buffer* buffer, GLintptr offset, GLsizeiptr size); 49 void detachBuffer(GLuint buffer); 50 void begin(GLenum primitiveMode); 51 void end(); 52 void setPaused(bool paused); 53 void addVertexOffset(int count); 54 55 private: 56 BufferBinding mBuffer[MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS]; 57 58 bool mActive; 59 bool mPaused; 60 GLenum mPrimitiveMode; 61 int mVertexOffset; 62 }; 63 64 } 65 66 #endif // LIBGLESV2_TRANSFORM_FEEDBACK_H_ 67