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 | #ifndef IN_GUEST
|
---|
45 | /* bitfield representing the object usage. 1 means the object is used by the context with the given bitid */
|
---|
46 | CRbitvalue ctxUsage[CR_MAX_BITARRAY];
|
---|
47 | #endif
|
---|
48 | } CRBufferObject;
|
---|
49 |
|
---|
50 | typedef struct {
|
---|
51 | GLboolean retainBufferData; /* should state tracker retain buffer data? */
|
---|
52 | CRBufferObject *arrayBuffer;
|
---|
53 | CRBufferObject *elementsBuffer;
|
---|
54 | CRBufferObject *packBuffer;
|
---|
55 | CRBufferObject *unpackBuffer;
|
---|
56 |
|
---|
57 | CRBufferObject *nullBuffer; /* name = 0 */
|
---|
58 | } CRBufferObjectState;
|
---|
59 |
|
---|
60 | DECLEXPORT(CRBufferObject *) crStateGetBoundBufferObject(GLenum target, CRBufferObjectState *b);
|
---|
61 | DECLEXPORT(GLboolean) crStateIsBufferBound(GLenum target);
|
---|
62 |
|
---|
63 | DECLEXPORT(GLuint) STATE_APIENTRY crStateBufferHWIDtoID(GLuint hwid);
|
---|
64 | DECLEXPORT(GLuint) STATE_APIENTRY crStateGetBufferHWID(GLuint id);
|
---|
65 |
|
---|
66 | #ifdef __cplusplus
|
---|
67 | }
|
---|
68 | #endif
|
---|
69 |
|
---|
70 | #endif /* CR_STATE_BUFFEROBJECT_H */
|
---|