VirtualBox

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

最後變更 在這個檔案從34356是 33475,由 vboxsync 提交於 14 年 前

crOpenGL/wddm: multithreading fix

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

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