VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/packer/pack_matrices.c@ 16469

Last change on this file since 16469 was 15532, checked in by vboxsync, 16 years ago

crOpenGL: export to OSE

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 8.7 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
10void PACK_APIENTRY crPackMultMatrixd( const GLdouble *m )
11{
12 GET_PACKER_CONTEXT(pc);
13 unsigned char *data_ptr;
14 int packet_length = 16*sizeof( *m );
15 GET_BUFFERED_POINTER(pc, packet_length );
16 WRITE_DOUBLE( 0*sizeof(double), m[ 0] );
17 WRITE_DOUBLE( 1*sizeof(double), m[ 1] );
18 WRITE_DOUBLE( 2*sizeof(double), m[ 2] );
19 WRITE_DOUBLE( 3*sizeof(double), m[ 3] );
20 WRITE_DOUBLE( 4*sizeof(double), m[ 4] );
21 WRITE_DOUBLE( 5*sizeof(double), m[ 5] );
22 WRITE_DOUBLE( 6*sizeof(double), m[ 6] );
23 WRITE_DOUBLE( 7*sizeof(double), m[ 7] );
24 WRITE_DOUBLE( 8*sizeof(double), m[ 8] );
25 WRITE_DOUBLE( 9*sizeof(double), m[ 9] );
26 WRITE_DOUBLE( 10*sizeof(double), m[10] );
27 WRITE_DOUBLE( 11*sizeof(double), m[11] );
28 WRITE_DOUBLE( 12*sizeof(double), m[12] );
29 WRITE_DOUBLE( 13*sizeof(double), m[13] );
30 WRITE_DOUBLE( 14*sizeof(double), m[14] );
31 WRITE_DOUBLE( 15*sizeof(double), m[15] );
32 WRITE_OPCODE( pc, CR_MULTMATRIXD_OPCODE );
33}
34
35void PACK_APIENTRY crPackMultMatrixf( const GLfloat *m )
36{
37 GET_PACKER_CONTEXT(pc);
38 unsigned char *data_ptr;
39 int packet_length = 16*sizeof( *m );
40 GET_BUFFERED_POINTER(pc, packet_length );
41 WRITE_DATA( 0*sizeof(GLfloat), GLfloat, m[ 0] );
42 WRITE_DATA( 1*sizeof(GLfloat), GLfloat, m[ 1] );
43 WRITE_DATA( 2*sizeof(GLfloat), GLfloat, m[ 2] );
44 WRITE_DATA( 3*sizeof(GLfloat), GLfloat, m[ 3] );
45 WRITE_DATA( 4*sizeof(GLfloat), GLfloat, m[ 4] );
46 WRITE_DATA( 5*sizeof(GLfloat), GLfloat, m[ 5] );
47 WRITE_DATA( 6*sizeof(GLfloat), GLfloat, m[ 6] );
48 WRITE_DATA( 7*sizeof(GLfloat), GLfloat, m[ 7] );
49 WRITE_DATA( 8*sizeof(GLfloat), GLfloat, m[ 8] );
50 WRITE_DATA( 9*sizeof(GLfloat), GLfloat, m[ 9] );
51 WRITE_DATA( 10*sizeof(GLfloat), GLfloat, m[10] );
52 WRITE_DATA( 11*sizeof(GLfloat), GLfloat, m[11] );
53 WRITE_DATA( 12*sizeof(GLfloat), GLfloat, m[12] );
54 WRITE_DATA( 13*sizeof(GLfloat), GLfloat, m[13] );
55 WRITE_DATA( 14*sizeof(GLfloat), GLfloat, m[14] );
56 WRITE_DATA( 15*sizeof(GLfloat), GLfloat, m[15] );
57 WRITE_OPCODE( pc, CR_MULTMATRIXF_OPCODE );
58}
59
60void PACK_APIENTRY crPackLoadMatrixd( const GLdouble *m )
61{
62 GET_PACKER_CONTEXT(pc);
63 unsigned char *data_ptr;
64 int packet_length = 16*sizeof( *m );
65 GET_BUFFERED_POINTER(pc, packet_length );
66 WRITE_DOUBLE( 0*sizeof(double), m[ 0] );
67 WRITE_DOUBLE( 1*sizeof(double), m[ 1] );
68 WRITE_DOUBLE( 2*sizeof(double), m[ 2] );
69 WRITE_DOUBLE( 3*sizeof(double), m[ 3] );
70 WRITE_DOUBLE( 4*sizeof(double), m[ 4] );
71 WRITE_DOUBLE( 5*sizeof(double), m[ 5] );
72 WRITE_DOUBLE( 6*sizeof(double), m[ 6] );
73 WRITE_DOUBLE( 7*sizeof(double), m[ 7] );
74 WRITE_DOUBLE( 8*sizeof(double), m[ 8] );
75 WRITE_DOUBLE( 9*sizeof(double), m[ 9] );
76 WRITE_DOUBLE( 10*sizeof(double), m[10] );
77 WRITE_DOUBLE( 11*sizeof(double), m[11] );
78 WRITE_DOUBLE( 12*sizeof(double), m[12] );
79 WRITE_DOUBLE( 13*sizeof(double), m[13] );
80 WRITE_DOUBLE( 14*sizeof(double), m[14] );
81 WRITE_DOUBLE( 15*sizeof(double), m[15] );
82 WRITE_OPCODE( pc, CR_LOADMATRIXD_OPCODE );
83}
84
85void PACK_APIENTRY crPackLoadMatrixf( const GLfloat *m )
86{
87 GET_PACKER_CONTEXT(pc);
88 unsigned char *data_ptr;
89 int packet_length = 16*sizeof( *m );
90 GET_BUFFERED_POINTER(pc, packet_length );
91 WRITE_DATA( 0*sizeof(GLfloat), GLfloat, m[ 0] );
92 WRITE_DATA( 1*sizeof(GLfloat), GLfloat, m[ 1] );
93 WRITE_DATA( 2*sizeof(GLfloat), GLfloat, m[ 2] );
94 WRITE_DATA( 3*sizeof(GLfloat), GLfloat, m[ 3] );
95 WRITE_DATA( 4*sizeof(GLfloat), GLfloat, m[ 4] );
96 WRITE_DATA( 5*sizeof(GLfloat), GLfloat, m[ 5] );
97 WRITE_DATA( 6*sizeof(GLfloat), GLfloat, m[ 6] );
98 WRITE_DATA( 7*sizeof(GLfloat), GLfloat, m[ 7] );
99 WRITE_DATA( 8*sizeof(GLfloat), GLfloat, m[ 8] );
100 WRITE_DATA( 9*sizeof(GLfloat), GLfloat, m[ 9] );
101 WRITE_DATA( 10*sizeof(GLfloat), GLfloat, m[10] );
102 WRITE_DATA( 11*sizeof(GLfloat), GLfloat, m[11] );
103 WRITE_DATA( 12*sizeof(GLfloat), GLfloat, m[12] );
104 WRITE_DATA( 13*sizeof(GLfloat), GLfloat, m[13] );
105 WRITE_DATA( 14*sizeof(GLfloat), GLfloat, m[14] );
106 WRITE_DATA( 15*sizeof(GLfloat), GLfloat, m[15] );
107 WRITE_OPCODE( pc, CR_LOADMATRIXF_OPCODE );
108}
109
110void PACK_APIENTRY crPackMultTransposeMatrixdARB( const GLdouble *m )
111{
112 GET_PACKER_CONTEXT(pc);
113 unsigned char *data_ptr;
114 int packet_length = 16*sizeof( *m ) + sizeof(GLint) + sizeof(GLenum);
115 GET_BUFFERED_POINTER(pc, packet_length );
116 WRITE_DATA( 0, GLint, packet_length );
117 WRITE_DATA( 4, GLenum, CR_MULTTRANSPOSEMATRIXDARB_EXTEND_OPCODE );
118 WRITE_DOUBLE( 8 + 0*sizeof(double), m[ 0] );
119 WRITE_DOUBLE( 8 + 1*sizeof(double), m[ 1] );
120 WRITE_DOUBLE( 8 + 2*sizeof(double), m[ 2] );
121 WRITE_DOUBLE( 8 + 3*sizeof(double), m[ 3] );
122 WRITE_DOUBLE( 8 + 4*sizeof(double), m[ 4] );
123 WRITE_DOUBLE( 8 + 5*sizeof(double), m[ 5] );
124 WRITE_DOUBLE( 8 + 6*sizeof(double), m[ 6] );
125 WRITE_DOUBLE( 8 + 7*sizeof(double), m[ 7] );
126 WRITE_DOUBLE( 8 + 8*sizeof(double), m[ 8] );
127 WRITE_DOUBLE( 8 + 9*sizeof(double), m[ 9] );
128 WRITE_DOUBLE( 8 + 10*sizeof(double), m[10] );
129 WRITE_DOUBLE( 8 + 11*sizeof(double), m[11] );
130 WRITE_DOUBLE( 8 + 12*sizeof(double), m[12] );
131 WRITE_DOUBLE( 8 + 13*sizeof(double), m[13] );
132 WRITE_DOUBLE( 8 + 14*sizeof(double), m[14] );
133 WRITE_DOUBLE( 8 + 15*sizeof(double), m[15] );
134 WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
135}
136
137void PACK_APIENTRY crPackMultTransposeMatrixfARB( const GLfloat *m )
138{
139 GET_PACKER_CONTEXT(pc);
140 unsigned char *data_ptr;
141 int packet_length = 16*sizeof( *m ) + sizeof(GLint) + sizeof(GLenum);
142 GET_BUFFERED_POINTER(pc, packet_length );
143 WRITE_DATA( 0, GLint, packet_length );
144 WRITE_DATA( 4, GLenum, CR_MULTTRANSPOSEMATRIXFARB_EXTEND_OPCODE );
145 WRITE_DATA( 8 + 0*sizeof(GLfloat), GLfloat, m[ 0] );
146 WRITE_DATA( 8 + 1*sizeof(GLfloat), GLfloat, m[ 1] );
147 WRITE_DATA( 8 + 2*sizeof(GLfloat), GLfloat, m[ 2] );
148 WRITE_DATA( 8 + 3*sizeof(GLfloat), GLfloat, m[ 3] );
149 WRITE_DATA( 8 + 4*sizeof(GLfloat), GLfloat, m[ 4] );
150 WRITE_DATA( 8 + 5*sizeof(GLfloat), GLfloat, m[ 5] );
151 WRITE_DATA( 8 + 6*sizeof(GLfloat), GLfloat, m[ 6] );
152 WRITE_DATA( 8 + 7*sizeof(GLfloat), GLfloat, m[ 7] );
153 WRITE_DATA( 8 + 8*sizeof(GLfloat), GLfloat, m[ 8] );
154 WRITE_DATA( 8 + 9*sizeof(GLfloat), GLfloat, m[ 9] );
155 WRITE_DATA( 8 + 10*sizeof(GLfloat), GLfloat, m[10] );
156 WRITE_DATA( 8 + 11*sizeof(GLfloat), GLfloat, m[11] );
157 WRITE_DATA( 8 + 12*sizeof(GLfloat), GLfloat, m[12] );
158 WRITE_DATA( 8 + 13*sizeof(GLfloat), GLfloat, m[13] );
159 WRITE_DATA( 8 + 14*sizeof(GLfloat), GLfloat, m[14] );
160 WRITE_DATA( 8 + 15*sizeof(GLfloat), GLfloat, m[15] );
161 WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
162}
163
164void PACK_APIENTRY crPackLoadTransposeMatrixdARB( const GLdouble *m )
165{
166 GET_PACKER_CONTEXT(pc);
167 unsigned char *data_ptr;
168 int packet_length = 16*sizeof( *m ) + sizeof(GLint) + sizeof(GLenum);
169 GET_BUFFERED_POINTER(pc, packet_length );
170 WRITE_DATA( 0, GLint, packet_length );
171 WRITE_DATA( 4, GLenum, CR_LOADTRANSPOSEMATRIXDARB_EXTEND_OPCODE );
172 WRITE_DOUBLE( 8 + 0*sizeof(double), m[ 0] );
173 WRITE_DOUBLE( 8 + 1*sizeof(double), m[ 1] );
174 WRITE_DOUBLE( 8 + 2*sizeof(double), m[ 2] );
175 WRITE_DOUBLE( 8 + 3*sizeof(double), m[ 3] );
176 WRITE_DOUBLE( 8 + 4*sizeof(double), m[ 4] );
177 WRITE_DOUBLE( 8 + 5*sizeof(double), m[ 5] );
178 WRITE_DOUBLE( 8 + 6*sizeof(double), m[ 6] );
179 WRITE_DOUBLE( 8 + 7*sizeof(double), m[ 7] );
180 WRITE_DOUBLE( 8 + 8*sizeof(double), m[ 8] );
181 WRITE_DOUBLE( 8 + 9*sizeof(double), m[ 9] );
182 WRITE_DOUBLE( 8 + 10*sizeof(double), m[10] );
183 WRITE_DOUBLE( 8 + 11*sizeof(double), m[11] );
184 WRITE_DOUBLE( 8 + 12*sizeof(double), m[12] );
185 WRITE_DOUBLE( 8 + 13*sizeof(double), m[13] );
186 WRITE_DOUBLE( 8 + 14*sizeof(double), m[14] );
187 WRITE_DOUBLE( 8 + 15*sizeof(double), m[15] );
188 WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
189}
190
191void PACK_APIENTRY crPackLoadTransposeMatrixfARB( const GLfloat *m )
192{
193 GET_PACKER_CONTEXT(pc);
194 unsigned char *data_ptr;
195 int packet_length = 16*sizeof( *m ) + sizeof(GLint) + sizeof(GLenum);
196 GET_BUFFERED_POINTER(pc, packet_length );
197 WRITE_DATA( 0, GLint, packet_length );
198 WRITE_DATA( 4, GLenum, CR_LOADTRANSPOSEMATRIXFARB_EXTEND_OPCODE );
199 WRITE_DATA( 8 + 0*sizeof(GLfloat), GLfloat, m[ 0] );
200 WRITE_DATA( 8 + 1*sizeof(GLfloat), GLfloat, m[ 1] );
201 WRITE_DATA( 8 + 2*sizeof(GLfloat), GLfloat, m[ 2] );
202 WRITE_DATA( 8 + 3*sizeof(GLfloat), GLfloat, m[ 3] );
203 WRITE_DATA( 8 + 4*sizeof(GLfloat), GLfloat, m[ 4] );
204 WRITE_DATA( 8 + 5*sizeof(GLfloat), GLfloat, m[ 5] );
205 WRITE_DATA( 8 + 6*sizeof(GLfloat), GLfloat, m[ 6] );
206 WRITE_DATA( 8 + 7*sizeof(GLfloat), GLfloat, m[ 7] );
207 WRITE_DATA( 8 + 8*sizeof(GLfloat), GLfloat, m[ 8] );
208 WRITE_DATA( 8 + 9*sizeof(GLfloat), GLfloat, m[ 9] );
209 WRITE_DATA( 8 + 10*sizeof(GLfloat), GLfloat, m[10] );
210 WRITE_DATA( 8 + 11*sizeof(GLfloat), GLfloat, m[11] );
211 WRITE_DATA( 8 + 12*sizeof(GLfloat), GLfloat, m[12] );
212 WRITE_DATA( 8 + 13*sizeof(GLfloat), GLfloat, m[13] );
213 WRITE_DATA( 8 + 14*sizeof(GLfloat), GLfloat, m[14] );
214 WRITE_DATA( 8 + 15*sizeof(GLfloat), GLfloat, m[15] );
215 WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
216}
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