1 | /* Copyright (c) 2001, Stanford University
|
---|
2 | * All rights reserved.
|
---|
3 | *
|
---|
4 | * See the file LICENSE.txt for information on redistributing this software.
|
---|
5 | */
|
---|
6 |
|
---|
7 | #ifndef CR_STATE_BUFFEROBJECT_H
|
---|
8 | #define CR_STATE_BUFFEROBJECT_H
|
---|
9 |
|
---|
10 | #include "cr_hash.h"
|
---|
11 | #include "state/cr_statetypes.h"
|
---|
12 | #include "state/cr_statefuncs.h"
|
---|
13 |
|
---|
14 | #ifdef __cplusplus
|
---|
15 | extern "C" {
|
---|
16 | #endif
|
---|
17 |
|
---|
18 | typedef struct {
|
---|
19 | CRbitvalue dirty[CR_MAX_BITARRAY];
|
---|
20 | CRbitvalue arrayBinding[CR_MAX_BITARRAY];
|
---|
21 | CRbitvalue elementsBinding[CR_MAX_BITARRAY];
|
---|
22 | CRbitvalue packBinding[CR_MAX_BITARRAY];
|
---|
23 | CRbitvalue unpackBinding[CR_MAX_BITARRAY];
|
---|
24 | } CRBufferObjectBits;
|
---|
25 |
|
---|
26 |
|
---|
27 | /*
|
---|
28 | * Buffer object, like a texture object, but encapsulates arbitrary
|
---|
29 | * data (vertex, image, etc).
|
---|
30 | */
|
---|
31 | typedef struct {
|
---|
32 | GLuint refCount;
|
---|
33 | GLuint id;
|
---|
34 | GLuint hwid;
|
---|
35 | GLenum usage;
|
---|
36 | GLenum access;
|
---|
37 | GLuint size; /* buffer size in bytes */
|
---|
38 | GLvoid *pointer; /* only valid while buffer is mapped */
|
---|
39 | GLvoid *data; /* the buffer data, if retainBufferData is true */
|
---|
40 | GLboolean bResyncOnRead; /* buffer data could be changed on server side,
|
---|
41 | so we need to resync every time guest wants to read from it*/
|
---|
42 | CRbitvalue dirty[CR_MAX_BITARRAY]; /* dirty data or state */
|
---|
43 | GLintptrARB dirtyStart, dirtyLength; /* dirty region */
|
---|
44 | } CRBufferObject;
|
---|
45 |
|
---|
46 | typedef struct {
|
---|
47 | GLboolean retainBufferData; /* should state tracker retain buffer data? */
|
---|
48 | CRBufferObject *arrayBuffer;
|
---|
49 | CRBufferObject *elementsBuffer;
|
---|
50 | CRBufferObject *packBuffer;
|
---|
51 | CRBufferObject *unpackBuffer;
|
---|
52 |
|
---|
53 | CRBufferObject *nullBuffer; /* name = 0 */
|
---|
54 | } CRBufferObjectState;
|
---|
55 |
|
---|
56 | DECLEXPORT(CRBufferObject *) crStateGetBoundBufferObject(GLenum target, CRBufferObjectState *b);
|
---|
57 | DECLEXPORT(GLboolean) crStateIsBufferBound(GLenum target);
|
---|
58 |
|
---|
59 | DECLEXPORT(GLuint) STATE_APIENTRY crStateBufferHWIDtoID(GLuint hwid);
|
---|
60 | DECLEXPORT(GLuint) STATE_APIENTRY crStateGetBufferHWID(GLuint id);
|
---|
61 |
|
---|
62 | #ifdef __cplusplus
|
---|
63 | }
|
---|
64 | #endif
|
---|
65 |
|
---|
66 | #endif /* CR_STATE_BUFFEROBJECT_H */
|
---|