1 // 2 // Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 7 // VertexDataManager.h: Defines the VertexDataManager, a class that 8 // runs the Buffer translation process. 9 10 #ifndef LIBGLESV2_RENDERER_VERTEXDATAMANAGER_H_ 11 #define LIBGLESV2_RENDERER_VERTEXDATAMANAGER_H_ 12 13 #include "libGLESv2/Constants.h" 14 #include "common/angleutils.h" 15 16 namespace gl 17 { 18 class VertexAttribute; 19 class ProgramBinary; 20 } 21 22 namespace rx 23 { 24 class BufferStorage; 25 class StreamingVertexBufferInterface; 26 class VertexBuffer; 27 class Renderer; 28 29 struct TranslatedAttribute 30 { 31 bool active; 32 33 const gl::VertexAttribute *attribute; 34 unsigned int offset; 35 unsigned int stride; // 0 means not to advance the read pointer at all 36 37 VertexBuffer *vertexBuffer; 38 BufferStorage *storage; 39 unsigned int serial; 40 unsigned int divisor; 41 }; 42 43 class VertexDataManager 44 { 45 public: 46 VertexDataManager(rx::Renderer *renderer); 47 virtual ~VertexDataManager(); 48 49 GLenum prepareVertexData(const gl::VertexAttribute attribs[], gl::ProgramBinary *programBinary, GLint start, GLsizei count, TranslatedAttribute *outAttribs, GLsizei instances); 50 51 private: 52 DISALLOW_COPY_AND_ASSIGN(VertexDataManager); 53 54 rx::Renderer *const mRenderer; 55 56 StreamingVertexBufferInterface *mStreamingBuffer; 57 58 float mCurrentValue[gl::MAX_VERTEX_ATTRIBS][4]; 59 StreamingVertexBufferInterface *mCurrentValueBuffer[gl::MAX_VERTEX_ATTRIBS]; 60 std::size_t mCurrentValueOffsets[gl::MAX_VERTEX_ATTRIBS]; 61 }; 62 63 } 64 65 #endif // LIBGLESV2_RENDERER_VERTEXDATAMANAGER_H_ 66