VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/packer/pack_arrays.c@ 21523

Last change on this file since 21523 was 21422, checked in by vboxsync, 16 years ago

crOpenGL: fix VBOs support on 32/64 or 64/32 guest/host combinations

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.5 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#include "packer.h"
8#include "cr_opcodes.h"
9#include "cr_error.h"
10
11#define UNUSED(x) ((void)(x))
12/**
13 * \mainpage Packer
14 *
15 * \section PackerIntroduction Introduction
16 *
17 * Chromium consists of all the top-level files in the cr
18 * directory. The packer module basically takes care of API dispatch,
19 * and OpenGL state management.
20 *
21 */
22
23void PACK_APIENTRY crPackVertexPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
24{
25 /* Packing this command is only useful if we have server-side vertex
26 * arrays - GL_ARB_vertex_buffer_object. Note that pointer will really
27 * be an offset into a server-side buffer.
28 * @todo Because of that we'd only transfer lowest 32bit as there're no 4gb+VBOs (yet?).
29 * Look at glgets regarding max vertices in arrays.
30 */
31 GET_PACKER_CONTEXT(pc);
32 unsigned char *data_ptr;
33 int packet_length = 24;
34 GET_BUFFERED_POINTER( pc, packet_length );
35 WRITE_DATA( 0, GLint, packet_length );
36 WRITE_DATA( 4, GLenum, CR_VERTEXPOINTER_EXTEND_OPCODE );
37 WRITE_DATA( 8, GLint, size );
38 WRITE_DATA( 12, GLenum, type );
39 WRITE_DATA( 16, GLsizei, stride );
40 WRITE_DATA( 20, GLuint, (GLuint) pointer );
41 WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
42}
43
44void PACK_APIENTRY crPackColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
45{
46 GET_PACKER_CONTEXT(pc);
47 unsigned char *data_ptr;
48 int packet_length = 24;
49 GET_BUFFERED_POINTER( pc, packet_length );
50 WRITE_DATA( 0, GLint, packet_length );
51 WRITE_DATA( 4, GLenum, CR_COLORPOINTER_EXTEND_OPCODE );
52 WRITE_DATA( 8, GLint, size );
53 WRITE_DATA( 12, GLenum, type );
54 WRITE_DATA( 16, GLsizei, stride );
55 WRITE_DATA( 20, GLuint, (GLuint) pointer );
56 WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
57}
58
59void PACK_APIENTRY crPackNormalPointer( GLenum type, GLsizei stride, const GLvoid *pointer )
60{
61 GET_PACKER_CONTEXT(pc);
62 unsigned char *data_ptr;
63 int packet_length = 20;
64 GET_BUFFERED_POINTER( pc, packet_length );
65 WRITE_DATA( 0, GLint, packet_length );
66 WRITE_DATA( 4, GLenum, CR_NORMALPOINTER_EXTEND_OPCODE );
67 WRITE_DATA( 8, GLenum, type );
68 WRITE_DATA( 12, GLsizei, stride );
69 WRITE_DATA( 16, GLuint, (GLuint) pointer );
70 WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
71}
72
73void PACK_APIENTRY crPackTexCoordPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
74{
75 GET_PACKER_CONTEXT(pc);
76 unsigned char *data_ptr;
77 int packet_length = 24;
78 GET_BUFFERED_POINTER( pc, packet_length );
79 WRITE_DATA( 0, GLint, packet_length );
80 WRITE_DATA( 4, GLenum, CR_TEXCOORDPOINTER_EXTEND_OPCODE );
81 WRITE_DATA( 8, GLint, size );
82 WRITE_DATA( 12, GLenum, type );
83 WRITE_DATA( 16, GLsizei, stride );
84 WRITE_DATA( 20, GLuint, (GLuint) pointer );
85 WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
86}
87
88void PACK_APIENTRY crPackEdgeFlagPointer( GLsizei stride, const GLvoid *pointer )
89{
90 GET_PACKER_CONTEXT(pc);
91 unsigned char *data_ptr;
92 int packet_length = 16;
93 GET_BUFFERED_POINTER( pc, packet_length );
94 WRITE_DATA( 0, GLint, packet_length );
95 WRITE_DATA( 4, GLenum, CR_EDGEFLAGPOINTER_EXTEND_OPCODE );
96 WRITE_DATA( 8, GLsizei, stride );
97 WRITE_DATA( 12, GLuint, (GLuint) pointer );
98 WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
99}
100
101void PACK_APIENTRY crPackIndexPointer( GLenum type, GLsizei stride, const GLvoid *pointer )
102{
103 GET_PACKER_CONTEXT(pc);
104 unsigned char *data_ptr;
105 int packet_length = 20;
106 GET_BUFFERED_POINTER( pc, packet_length );
107 WRITE_DATA( 0, GLint, packet_length );
108 WRITE_DATA( 4, GLenum, CR_INDEXPOINTER_EXTEND_OPCODE );
109 WRITE_DATA( 8, GLenum, type );
110 WRITE_DATA( 12, GLsizei, stride );
111 WRITE_DATA( 16, GLuint, (GLuint) pointer );
112 WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
113}
114
115void PACK_APIENTRY crPackSecondaryColorPointerEXT( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
116{
117 GET_PACKER_CONTEXT(pc);
118 unsigned char *data_ptr;
119 int packet_length = 24;
120 GET_BUFFERED_POINTER( pc, packet_length );
121 WRITE_DATA( 0, GLint, packet_length );
122 WRITE_DATA( 4, GLenum, CR_SECONDARYCOLORPOINTEREXT_EXTEND_OPCODE );
123 WRITE_DATA( 8, GLint, size );
124 WRITE_DATA( 12, GLenum, type );
125 WRITE_DATA( 16, GLsizei, stride );
126 WRITE_DATA( 20, GLuint, (GLuint) pointer );
127 WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
128}
129
130void PACK_APIENTRY crPackFogCoordPointerEXT( GLenum type, GLsizei stride, const GLvoid * pointer )
131{
132 GET_PACKER_CONTEXT(pc);
133 unsigned char *data_ptr;
134 int packet_length = 20;
135 GET_BUFFERED_POINTER( pc, packet_length );
136 WRITE_DATA( 0, GLint, packet_length );
137 WRITE_DATA( 4, GLenum, CR_FOGCOORDPOINTEREXT_EXTEND_OPCODE );
138 WRITE_DATA( 8, GLenum, type );
139 WRITE_DATA( 12, GLsizei, stride );
140 WRITE_DATA( 16, GLuint, (GLuint) pointer );
141 WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
142}
143
144void PACK_APIENTRY crPackVertexAttribPointerARB( GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer )
145{
146 GET_PACKER_CONTEXT(pc);
147 unsigned char *data_ptr;
148 int packet_length = 32;
149 GET_BUFFERED_POINTER( pc, packet_length );
150 WRITE_DATA( 0, GLint, packet_length );
151 WRITE_DATA( 4, GLenum, CR_VERTEXATTRIBPOINTERARB_EXTEND_OPCODE );
152 WRITE_DATA( 8, GLint, index );
153 WRITE_DATA( 12, GLint, size );
154 WRITE_DATA( 16, GLenum, type );
155 WRITE_DATA( 20, GLboolean, normalized );
156 WRITE_DATA( 24, GLsizei, stride );
157 WRITE_DATA( 28, GLuint, (GLuint) pointer );
158 WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
159}
160
161void PACK_APIENTRY crPackVertexAttribPointerNV( GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
162{
163 GET_PACKER_CONTEXT(pc);
164 unsigned char *data_ptr;
165 int packet_length = 28;
166 GET_BUFFERED_POINTER( pc, packet_length );
167 WRITE_DATA( 0, GLint, packet_length );
168 WRITE_DATA( 4, GLenum, CR_VERTEXATTRIBPOINTERNV_EXTEND_OPCODE );
169 WRITE_DATA( 8, GLint, index );
170 WRITE_DATA( 12, GLint, size );
171 WRITE_DATA( 16, GLenum, type );
172 WRITE_DATA( 20, GLsizei, stride );
173 WRITE_DATA( 24, GLuint, (GLuint) pointer );
174 WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
175}
176
177void PACK_APIENTRY crPackInterleavedArrays( GLenum format, GLsizei stride, const GLvoid *pointer )
178{
179 GET_PACKER_CONTEXT(pc);
180 unsigned char *data_ptr;
181 int packet_length = 20;
182 GET_BUFFERED_POINTER( pc, packet_length );
183 WRITE_DATA( 0, GLint, packet_length );
184 WRITE_DATA( 4, GLenum, CR_INTERLEAVEDARRAYS_EXTEND_OPCODE );
185 WRITE_DATA( 8, GLenum, format );
186 WRITE_DATA( 12, GLsizei, stride );
187 WRITE_DATA( 16, GLuint, (GLuint) pointer );
188 WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
189}
190
191
192void PACK_APIENTRY crPackVertexArrayRangeNV( GLsizei length, const GLvoid *pointer )
193{
194 UNUSED( length );
195 UNUSED( pointer );
196 crWarning( "Unimplemented crPackVertexArrayRangeNV" );
197}
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