VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/include/state/cr_client.h@ 22284

Last change on this file since 22284 was 22284, checked in by vboxsync, 15 years ago

crOpenGL: add compiled vertex array support

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.0 KB
Line 
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_CLIENT_H
8#define CR_STATE_CLIENT_H
9
10#include "state/cr_statetypes.h"
11#include "state/cr_limits.h"
12#include "state/cr_bufferobject.h"
13#include "cr_bits.h"
14
15#include <iprt/cdefs.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21typedef struct {
22 CRbitvalue dirty[CR_MAX_BITARRAY];
23 /* pixel pack/unpack */
24 CRbitvalue pack[CR_MAX_BITARRAY];
25 CRbitvalue unpack[CR_MAX_BITARRAY];
26 /* vertex array */
27 CRbitvalue enableClientState[CR_MAX_BITARRAY];
28 CRbitvalue clientPointer[CR_MAX_BITARRAY];
29 CRbitvalue *v; /* vertex */
30 CRbitvalue *n; /* normal */
31 CRbitvalue *c; /* color */
32 CRbitvalue *i; /* index */
33 CRbitvalue *t[CR_MAX_TEXTURE_UNITS]; /* texcoord */
34 CRbitvalue *e; /* edgeflag */
35 CRbitvalue *s; /* secondary color */
36 CRbitvalue *f; /* fog coord */
37#ifdef CR_NV_vertex_program
38 CRbitvalue *a[CR_MAX_VERTEX_ATTRIBS]; /* NV_vertex_program */
39#endif
40} CRClientBits;
41
42/*
43 * NOTE!!!! If you change this structure, search through the code for
44 * occurances of 'defaultPacking' and fix the static initializations!!!!
45 */
46typedef struct {
47 GLint rowLength;
48 GLint skipRows;
49 GLint skipPixels;
50 GLint alignment;
51 GLint imageHeight;
52 GLint skipImages;
53 GLboolean swapBytes;
54 GLboolean psLSBFirst; /* don't conflict with crap from Xlib.h */
55} CRPixelPackState;
56
57typedef struct {
58 unsigned char *p;
59 GLint size;
60 GLint type;
61 GLint stride;
62 GLboolean enabled;
63 GLboolean normalized; /* Added with GL_ARB_vertex_program */
64 int bytesPerIndex;
65#ifdef CR_ARB_vertex_buffer_object
66 CRBufferObject *buffer;
67#endif
68#ifdef CR_EXT_compiled_vertex_array
69 GLboolean locked;
70 unsigned char *prevPtr;
71 GLint prevStride;
72#endif
73} CRClientPointer;
74
75typedef struct {
76 CRClientPointer v; /* vertex */
77 CRClientPointer n; /* normal */
78 CRClientPointer c; /* color */
79 CRClientPointer i; /* color index */
80 CRClientPointer t[CR_MAX_TEXTURE_UNITS]; /* texcoords */
81 CRClientPointer e; /* edge flags */
82 CRClientPointer s; /* secondary color */
83 CRClientPointer f; /* fog coord */
84#ifdef CR_NV_vertex_program
85 CRClientPointer a[CR_MAX_VERTEX_ATTRIBS]; /* vertex attribs */
86#endif
87#ifdef CR_NV_vertex_array_range
88 GLboolean arrayRange;
89 GLboolean arrayRangeValid;
90 void *arrayRangePointer;
91 GLuint arrayRangeLength;
92#endif
93#ifdef CR_EXT_compiled_vertex_array
94 GLint lockFirst;
95 GLint lockCount;
96 GLboolean locked;
97# ifdef IN_GUEST
98 GLboolean synced;
99# endif
100#endif
101} CRVertexArrays;
102
103#define CRSTATECLIENT_MAX_VERTEXARRAYS (7+CR_MAX_TEXTURE_UNITS+CR_MAX_VERTEX_ATTRIBS)
104
105typedef struct {
106 /* pixel pack/unpack */
107 CRPixelPackState pack;
108 CRPixelPackState unpack;
109
110 CRVertexArrays array;
111
112 GLint curClientTextureUnit;
113
114 /* state stacks (glPush/PopClientState) */
115 GLint attribStackDepth;
116 CRbitvalue pushMaskStack[CR_MAX_CLIENT_ATTRIB_STACK_DEPTH];
117
118 GLint pixelStoreStackDepth;
119 CRPixelPackState pixelPackStoreStack[CR_MAX_CLIENT_ATTRIB_STACK_DEPTH];
120 CRPixelPackState pixelUnpackStoreStack[CR_MAX_CLIENT_ATTRIB_STACK_DEPTH];
121
122 GLint vertexArrayStackDepth;
123 CRVertexArrays vertexArrayStack[CR_MAX_CLIENT_ATTRIB_STACK_DEPTH];
124} CRClientState;
125
126extern const CRPixelPackState crStateNativePixelPacking;
127
128DECLEXPORT(void) crStateClientInitBits(CRClientBits *c);
129DECLEXPORT(void) crStateClientInit(CRClientState *c);
130DECLEXPORT(void) crStateClientDestroy(CRClientState *c);
131
132DECLEXPORT(GLboolean) crStateUseServerArrays(void);
133DECLEXPORT(GLboolean) crStateUseServerArrayElements(void);
134DECLEXPORT(CRClientPointer*) crStateGetClientPointerByIndex(int index, CRVertexArrays *array);
135
136#ifdef __cplusplus
137}
138#endif
139
140#endif /* CR_CLIENT_H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette