VirtualBox

source: vbox/trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c@ 20148

最後變更 在這個檔案從20148是 20148,由 vboxsync 提交於 16 年 前

crOpenGL: fix warning

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id
檔案大小: 5.7 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 "cr_packfunctions.h"
8#include "packspu.h"
9#include "packspu_proto.h"
10
11void PACKSPU_APIENTRY packspu_ChromiumParametervCR(GLenum target, GLenum type, GLsizei count, const GLvoid *values)
12{
13
14 CRMessage msg;
15 int len;
16
17 GET_THREAD(thread);
18
19
20 switch(target)
21 {
22 case GL_GATHER_PACK_CR:
23 /* flush the current pack buffer */
24 packspuFlush( (void *) thread );
25
26 /* the connection is thread->server.conn */
27 msg.header.type = CR_MESSAGE_GATHER;
28 msg.gather.offset = 69;
29 len = sizeof(CRMessageGather);
30 crNetSend(thread->netServer.conn, NULL, &msg, len);
31 break;
32
33 default:
34 if (pack_spu.swap)
35 crPackChromiumParametervCRSWAP(target, type, count, values);
36 else
37 crPackChromiumParametervCR(target, type, count, values);
38 }
39
40
41}
42
43GLboolean packspuSyncOnFlushes()
44{
45 GLint buffer;
46 crStateGetIntegerv(GL_DRAW_BUFFER, &buffer);
47 /*Usually buffer==GL_BACK, so put this extra check to simplify boolean eval on runtime*/
48 return (buffer != GL_BACK)
49 && (buffer == GL_FRONT_LEFT
50 || buffer == GL_FRONT_RIGHT
51 || buffer == GL_FRONT
52 || buffer == GL_FRONT_AND_BACK
53 || buffer == GL_LEFT
54 || buffer == GL_RIGHT);
55}
56
57void PACKSPU_APIENTRY packspu_DrawBuffer(GLenum mode)
58{
59 crStateDrawBuffer(mode);
60 crPackDrawBuffer(mode);
61}
62
63void PACKSPU_APIENTRY packspu_Finish( void )
64{
65 GET_THREAD(thread);
66 GLint writeback = pack_spu.thread[0].netServer.conn->actual_network;
67
68 if (pack_spu.swap)
69 {
70 crPackFinishSWAP();
71 }
72 else
73 {
74 crPackFinish();
75 }
76
77 if (packspuSyncOnFlushes())
78 {
79 packspuFlush( (void *) thread );
80
81 if (writeback)
82 {
83 if (pack_spu.swap)
84 crPackWritebackSWAP(&writeback);
85 else
86 crPackWriteback(&writeback);
87 }
88
89 while (writeback)
90 crNetRecv();
91 }
92}
93
94void PACKSPU_APIENTRY packspu_Flush( void )
95{
96 GET_THREAD(thread);
97 if (pack_spu.swap)
98 {
99 crPackFlushSWAP();
100 }
101 else
102 {
103 crPackFlush();
104 }
105
106 if (packspuSyncOnFlushes())
107 {
108 packspuFlush( (void *) thread );
109 }
110}
111
112GLint PACKSPU_APIENTRY packspu_WindowCreate( const char *dpyName, GLint visBits )
113{
114 static int num_calls = 0;
115 int writeback = pack_spu.thread[0].netServer.conn->actual_network;
116 GLint return_val = (GLint) 0;
117
118 /* WindowCreate is special - just like CreateContext.
119 * GET_THREAD(thread) doesn't work as the thread won't have called
120 * MakeCurrent yet, so we've got to use the first thread's packer
121 * buffer.
122 */
123
124 crPackSetContext( pack_spu.thread[0].packer );
125
126 if (pack_spu.swap)
127 {
128 crPackWindowCreateSWAP( dpyName, visBits, &return_val, &writeback );
129 }
130 else
131 {
132 crPackWindowCreate( dpyName, visBits, &return_val, &writeback );
133 }
134 packspuFlush( &pack_spu.thread[0] );
135 if (!(pack_spu.thread[0].netServer.conn->actual_network))
136 {
137 return num_calls++;
138 }
139 else
140 {
141 while (writeback)
142 crNetRecv();
143 if (pack_spu.swap)
144 {
145 return_val = (GLint) SWAP32(return_val);
146 }
147 return return_val;
148 }
149}
150
151
152
153GLboolean PACKSPU_APIENTRY
154packspu_AreTexturesResident( GLsizei n, const GLuint * textures,
155 GLboolean * residences )
156{
157 GET_THREAD(thread);
158 int writeback = 1;
159 GLboolean return_val = GL_TRUE;
160 GLsizei i;
161
162 if (!(pack_spu.thread[0].netServer.conn->actual_network))
163 {
164 crError( "packspu_AreTexturesResident doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
165 }
166
167 if (pack_spu.swap)
168 {
169 crPackAreTexturesResidentSWAP( n, textures, residences, &return_val, &writeback );
170 }
171 else
172 {
173 crPackAreTexturesResident( n, textures, residences, &return_val, &writeback );
174 }
175 packspuFlush( (void *) thread );
176
177 while (writeback)
178 crNetRecv();
179
180 /* Since the Chromium packer/unpacker can't return both 'residences'
181 * and the function's return value, compute the return value here.
182 */
183 for (i = 0; i < n; i++) {
184 if (!residences[i]) {
185 return_val = GL_FALSE;
186 break;
187 }
188 }
189
190 return return_val;
191}
192
193
194GLboolean PACKSPU_APIENTRY
195packspu_AreProgramsResidentNV( GLsizei n, const GLuint * ids,
196 GLboolean * residences )
197{
198 GET_THREAD(thread);
199 int writeback = 1;
200 GLboolean return_val = GL_TRUE;
201 GLsizei i;
202
203 if (!(pack_spu.thread[0].netServer.conn->actual_network))
204 {
205 crError( "packspu_AreProgramsResidentNV doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
206 }
207 if (pack_spu.swap)
208 {
209 crPackAreProgramsResidentNVSWAP( n, ids, residences, &return_val, &writeback );
210 }
211 else
212 {
213 crPackAreProgramsResidentNV( n, ids, residences, &return_val, &writeback );
214 }
215 packspuFlush( (void *) thread );
216
217 while (writeback)
218 crNetRecv();
219
220 /* Since the Chromium packer/unpacker can't return both 'residences'
221 * and the function's return value, compute the return value here.
222 */
223 for (i = 0; i < n; i++) {
224 if (!residences[i]) {
225 return_val = GL_FALSE;
226 break;
227 }
228 }
229
230 return return_val;
231}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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