]> git.tdb.fi Git - gldbg.git/blob - source/bufferstate.h
Track vertex array state
[gldbg.git] / source / bufferstate.h
1 /* $Id$
2
3 This file is part of gldbg
4 Copyright © 2009-2010  Mikko Rasa, Mikkosoft Productions
5 Distributed under the GPL
6 */
7
8 #ifndef BUFFERSTATE_H_
9 #define BUFFERSTATE_H_
10
11 #include <string>
12 #include <vector>
13 #include <GL/gl.h>
14
15 struct ArrayState;
16
17 struct BufferContent
18 {
19         struct Array
20         {
21                 GLenum kind;
22                 unsigned index;
23                 unsigned size;
24                 GLenum type;
25                 int offset;
26
27                 Array(const ArrayState &);
28         };
29
30         bool consistent;
31         unsigned stride;
32         std::vector<Array> arrays;
33
34         BufferContent();
35         void update(const ArrayState &);
36         std::string describe() const;
37 };
38
39 struct BufferState
40 {
41         unsigned id;
42         GLenum target;
43         GLenum usage;
44         unsigned size;
45         char *data;
46         BufferContent content;
47
48         BufferState();
49         void set_data(unsigned, const void *, GLenum);
50         void set_sub_data(unsigned, unsigned, const void *);
51         std::string describe() const;
52 };
53
54 #endif