]> git.tdb.fi Git - gldbg.git/blob - flavors/gl/source/bufferstate.h
Fix several problems reported by valgrind
[gldbg.git] / flavors / gl / source / bufferstate.h
1 #ifndef BUFFERSTATE_H_
2 #define BUFFERSTATE_H_
3
4 #include <string>
5 #include <vector>
6 #include "autoconstptr.h"
7 #include "opengl.h"
8
9 struct ArrayState;
10
11 struct BufferContent
12 {
13         struct Array
14         {
15                 GLenum kind;
16                 unsigned index;
17                 unsigned size;
18                 GLenum type;
19                 int offset;
20
21                 Array();
22                 Array(const ArrayState &);
23         };
24
25         bool consistent;
26         unsigned stride;
27         std::vector<Array> arrays;
28
29         BufferContent();
30
31         void update(const ArrayState &);
32         void update_elements(GLenum);
33         std::string describe() const;
34 };
35
36 struct BufferState
37 {
38         unsigned id;
39         GLenum target;
40         GLenum usage;
41         unsigned size;
42         char *data;
43         BufferContent content;
44
45         BufferState();
46         ~BufferState();
47
48         void set_data(unsigned, const void *, GLenum);
49         void set_sub_data(unsigned, unsigned, const void *);
50         std::string describe() const;
51 };
52
53 struct BufferBindingState
54 {
55         AutoConstPtr<BufferState> buffer;
56         unsigned offset;
57         unsigned size;
58
59         BufferBindingState();
60 };
61
62 #endif