VirtualBox

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

最後變更 在這個檔案從61547是 52451,由 vboxsync 提交於 11 年 前

crOpenGL: command blocks flushing

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id
檔案大小: 21.9 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#include "cr_mem.h"
11
12void PACKSPU_APIENTRY packspu_ChromiumParametervCR(GLenum target, GLenum type, GLsizei count, const GLvoid *values)
13{
14
15 CRMessage msg;
16 int len;
17 GLint ai32ServerValues[2];
18 GLboolean fFlush = GL_FALSE;
19 GET_THREAD(thread);
20
21
22 switch(target)
23 {
24 case GL_GATHER_PACK_CR:
25 /* flush the current pack buffer */
26 packspuFlush( (void *) thread );
27
28 /* the connection is thread->server.conn */
29 msg.header.type = CR_MESSAGE_GATHER;
30 msg.gather.offset = 69;
31 len = sizeof(CRMessageGather);
32 crNetSend(thread->netServer.conn, NULL, &msg, len);
33 return;
34
35 case GL_SHARE_LISTS_CR:
36 {
37 ContextInfo *pCtx[2];
38 GLint *ai32Values;
39 int i;
40 if (count != 2)
41 {
42 WARN(("GL_SHARE_LISTS_CR invalid cound %d", count));
43 return;
44 }
45
46 if (type != GL_UNSIGNED_INT && type != GL_INT)
47 {
48 WARN(("GL_SHARE_LISTS_CR invalid type %d", type));
49 return;
50 }
51
52 ai32Values = (GLint*)values;
53
54 for (i = 0; i < 2; ++i)
55 {
56 const int slot = ai32Values[i] - MAGIC_OFFSET;
57
58 if (slot < 0 || slot >= pack_spu.numContexts)
59 {
60 WARN(("GL_SHARE_LISTS_CR invalid value[%d] %d", i, ai32Values[i]));
61 return;
62 }
63
64 pCtx[i] = &pack_spu.context[slot];
65 if (!pCtx[i]->clientState)
66 {
67 WARN(("GL_SHARE_LISTS_CR invalid pCtx1 for value[%d] %d", i, ai32Values[i]));
68 return;
69 }
70
71 ai32ServerValues[i] = pCtx[i]->serverCtx;
72 }
73
74 crStateShareLists(pCtx[0]->clientState, pCtx[1]->clientState);
75
76 values = ai32ServerValues;
77
78 fFlush = GL_TRUE;
79
80 break;
81 }
82
83 default:
84 break;
85 }
86
87 if (pack_spu.swap)
88 crPackChromiumParametervCRSWAP(target, type, count, values);
89 else
90 crPackChromiumParametervCR(target, type, count, values);
91
92 if (fFlush)
93 packspuFlush( (void *) thread );
94}
95
96GLboolean packspuSyncOnFlushes()
97{
98 GLint buffer;
99
100 /*Seems to still cause issues, always sync for now*/
101 return 1;
102
103 crStateGetIntegerv(GL_DRAW_BUFFER, &buffer);
104 /*Usually buffer==GL_BACK, so put this extra check to simplify boolean eval on runtime*/
105 return (buffer != GL_BACK)
106 && (buffer == GL_FRONT_LEFT
107 || buffer == GL_FRONT_RIGHT
108 || buffer == GL_FRONT
109 || buffer == GL_FRONT_AND_BACK
110 || buffer == GL_LEFT
111 || buffer == GL_RIGHT);
112}
113
114void PACKSPU_APIENTRY packspu_DrawBuffer(GLenum mode)
115{
116 GLboolean hadtoflush;
117
118 hadtoflush = packspuSyncOnFlushes();
119
120 crStateDrawBuffer(mode);
121 crPackDrawBuffer(mode);
122
123 if (hadtoflush && !packspuSyncOnFlushes())
124 packspu_Flush();
125}
126
127void PACKSPU_APIENTRY packspu_Finish( void )
128{
129 GET_THREAD(thread);
130 GLint writeback = CRPACKSPU_IS_WDDM_CRHGSMI() ? 1 : pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network;
131
132 if (pack_spu.swap)
133 {
134 crPackFinishSWAP();
135 }
136 else
137 {
138 crPackFinish();
139 }
140
141 if (packspuSyncOnFlushes())
142 {
143 if (writeback)
144 {
145 if (pack_spu.swap)
146 crPackWritebackSWAP(&writeback);
147 else
148 crPackWriteback(&writeback);
149
150 packspuFlush( (void *) thread );
151
152 CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
153 }
154 }
155}
156
157void PACKSPU_APIENTRY packspu_Flush( void )
158{
159 GET_THREAD(thread);
160 int writeback=1;
161 int found=0;
162
163 if (!thread->bInjectThread)
164 {
165 crPackFlush();
166 if (packspuSyncOnFlushes())
167 {
168 crPackWriteback(&writeback);
169 packspuFlush( (void *) thread );
170 CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
171 }
172 }
173 else
174 {
175 int i;
176
177 crLockMutex(&_PackMutex);
178
179 /*Make sure we process commands in order they should appear, so flush other threads first*/
180 for (i=0; i<MAX_THREADS; ++i)
181 {
182 if (pack_spu.thread[i].inUse
183 && (thread != &pack_spu.thread[i]) && pack_spu.thread[i].netServer.conn
184 && pack_spu.thread[i].packer && pack_spu.thread[i].packer->currentBuffer)
185 {
186 packspuFlush((void *) &pack_spu.thread[i]);
187
188 if (pack_spu.thread[i].netServer.conn->u32ClientID == thread->netServer.conn->u32InjectClientID)
189 {
190 found=1;
191 }
192
193 }
194 }
195
196 if (!found)
197 {
198 /*Thread we're supposed to inject commands for has been detached,
199 so there's nothing to sync with and we should just pass commands through our own connection.
200 */
201 thread->netServer.conn->u32InjectClientID=0;
202 }
203
204 packspuFlush((void *) thread);
205
206 crUnlockMutex(&_PackMutex);
207 }
208}
209
210void PACKSPU_APIENTRY packspu_NewList(GLuint list, GLenum mode)
211{
212 crStateNewList(list, mode);
213 crPackNewList(list, mode);
214}
215
216void PACKSPU_APIENTRY packspu_EndList()
217{
218 crStateEndList();
219 crPackEndList();
220}
221
222void PACKSPU_APIENTRY packspu_VBoxWindowDestroy( GLint con, GLint window )
223{
224 if (CRPACKSPU_IS_WDDM_CRHGSMI())
225 {
226 GET_THREAD(thread);
227 if (con)
228 {
229 CRPackContext * curPacker = crPackGetContext();
230 CRASSERT(!thread || !thread->bInjectThread);
231 thread = GET_THREAD_VAL_ID(con);
232 crPackSetContext(thread->packer);
233 crPackWindowDestroy(window);
234 if (curPacker != thread->packer)
235 crPackSetContext(curPacker);
236 return;
237 }
238 CRASSERT(thread);
239 CRASSERT(thread->bInjectThread);
240 }
241 crPackWindowDestroy(window);
242}
243
244GLint PACKSPU_APIENTRY packspu_VBoxWindowCreate( GLint con, const char *dpyName, GLint visBits )
245{
246 GET_THREAD(thread);
247 static int num_calls = 0;
248 int writeback = CRPACKSPU_IS_WDDM_CRHGSMI() ? 1 : pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network;
249 GLint return_val = (GLint) 0;
250 ThreadInfo *curThread = thread;
251 GLint retVal;
252
253 if (CRPACKSPU_IS_WDDM_CRHGSMI())
254 {
255 if (!con)
256 {
257 crError("connection expected!");
258 return 0;
259 }
260 thread = GET_THREAD_VAL_ID(con);
261 }
262 else
263 {
264 CRASSERT(!con);
265 if (!thread) {
266 thread = packspuNewThread(
267#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
268 NULL
269#endif
270 );
271 }
272 }
273 CRASSERT(thread);
274 CRASSERT(thread->packer);
275 CRASSERT(crPackGetContext() == (curThread ? curThread->packer : NULL));
276
277 crPackSetContext(thread->packer);
278
279 if (pack_spu.swap)
280 {
281 crPackWindowCreateSWAP( dpyName, visBits, &return_val, &writeback );
282 }
283 else
284 {
285 crPackWindowCreate( dpyName, visBits, &return_val, &writeback );
286 }
287 packspuFlush(thread);
288 if (!(thread->netServer.conn->actual_network))
289 {
290 retVal = num_calls++;
291 }
292 else
293 {
294 CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
295 if (pack_spu.swap)
296 {
297 return_val = (GLint) SWAP32(return_val);
298 }
299 retVal = return_val;
300 }
301
302 if (CRPACKSPU_IS_WDDM_CRHGSMI())
303 {
304 if (thread != curThread)
305 {
306 if (curThread)
307 crPackSetContext(curThread->packer);
308 else
309 crPackSetContext(NULL);
310 }
311 }
312
313 return retVal;
314}
315
316GLint PACKSPU_APIENTRY packspu_WindowCreate( const char *dpyName, GLint visBits )
317{
318 return packspu_VBoxWindowCreate( 0, dpyName, visBits );
319}
320
321GLboolean PACKSPU_APIENTRY
322packspu_AreTexturesResident( GLsizei n, const GLuint * textures,
323 GLboolean * residences )
324{
325 GET_THREAD(thread);
326 int writeback = 1;
327 GLboolean return_val = GL_TRUE;
328 GLsizei i;
329
330 if (!CRPACKSPU_IS_WDDM_CRHGSMI() && !(pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network))
331 {
332 crError( "packspu_AreTexturesResident doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
333 }
334
335 if (pack_spu.swap)
336 {
337 crPackAreTexturesResidentSWAP( n, textures, residences, &return_val, &writeback );
338 }
339 else
340 {
341 crPackAreTexturesResident( n, textures, residences, &return_val, &writeback );
342 }
343 packspuFlush( (void *) thread );
344
345 CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
346
347 /* Since the Chromium packer/unpacker can't return both 'residences'
348 * and the function's return value, compute the return value here.
349 */
350 for (i = 0; i < n; i++) {
351 if (!residences[i]) {
352 return_val = GL_FALSE;
353 break;
354 }
355 }
356
357 return return_val;
358}
359
360
361GLboolean PACKSPU_APIENTRY
362packspu_AreProgramsResidentNV( GLsizei n, const GLuint * ids,
363 GLboolean * residences )
364{
365 GET_THREAD(thread);
366 int writeback = 1;
367 GLboolean return_val = GL_TRUE;
368 GLsizei i;
369
370 if (!CRPACKSPU_IS_WDDM_CRHGSMI() && !(pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network))
371 {
372 crError( "packspu_AreProgramsResidentNV doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
373 }
374 if (pack_spu.swap)
375 {
376 crPackAreProgramsResidentNVSWAP( n, ids, residences, &return_val, &writeback );
377 }
378 else
379 {
380 crPackAreProgramsResidentNV( n, ids, residences, &return_val, &writeback );
381 }
382 packspuFlush( (void *) thread );
383
384 CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
385
386 /* Since the Chromium packer/unpacker can't return both 'residences'
387 * and the function's return value, compute the return value here.
388 */
389 for (i = 0; i < n; i++) {
390 if (!residences[i]) {
391 return_val = GL_FALSE;
392 break;
393 }
394 }
395
396 return return_val;
397}
398
399void PACKSPU_APIENTRY packspu_GetPolygonStipple( GLubyte * mask )
400{
401 GET_THREAD(thread);
402 int writeback = 1;
403
404 if (pack_spu.swap)
405 {
406 crPackGetPolygonStippleSWAP( mask, &writeback );
407 }
408 else
409 {
410 crPackGetPolygonStipple( mask, &writeback );
411 }
412
413#ifdef CR_ARB_pixel_buffer_object
414 if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
415#endif
416 {
417 packspuFlush( (void *) thread );
418 CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
419 }
420}
421
422void PACKSPU_APIENTRY packspu_GetPixelMapfv( GLenum map, GLfloat * values )
423{
424 GET_THREAD(thread);
425 int writeback = 1;
426
427 if (pack_spu.swap)
428 {
429 crPackGetPixelMapfvSWAP( map, values, &writeback );
430 }
431 else
432 {
433 crPackGetPixelMapfv( map, values, &writeback );
434 }
435
436#ifdef CR_ARB_pixel_buffer_object
437 if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
438#endif
439 {
440 packspuFlush( (void *) thread );
441 CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
442 }
443}
444
445void PACKSPU_APIENTRY packspu_GetPixelMapuiv( GLenum map, GLuint * values )
446{
447 GET_THREAD(thread);
448 int writeback = 1;
449
450 if (pack_spu.swap)
451 {
452 crPackGetPixelMapuivSWAP( map, values, &writeback );
453 }
454 else
455 {
456 crPackGetPixelMapuiv( map, values, &writeback );
457 }
458
459#ifdef CR_ARB_pixel_buffer_object
460 if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
461#endif
462 {
463 packspuFlush( (void *) thread );
464 CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
465 }
466}
467
468void PACKSPU_APIENTRY packspu_GetPixelMapusv( GLenum map, GLushort * values )
469{
470 GET_THREAD(thread);
471 int writeback = 1;
472
473 if (pack_spu.swap)
474 {
475 crPackGetPixelMapusvSWAP( map, values, &writeback );
476 }
477 else
478 {
479 crPackGetPixelMapusv( map, values, &writeback );
480 }
481
482#ifdef CR_ARB_pixel_buffer_object
483 if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
484#endif
485 {
486 packspuFlush( (void *) thread );
487 CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
488 }
489}
490
491static void packspuFluchOnThreadSwitch(GLboolean fEnable)
492{
493 GET_THREAD(thread);
494 if (thread->currentContext->fAutoFlush == fEnable)
495 return;
496
497 thread->currentContext->fAutoFlush = fEnable;
498 thread->currentContext->currentThread = fEnable ? thread : NULL;
499}
500
501static void packspuCheckZerroVertAttr(GLboolean fEnable)
502{
503 GET_THREAD(thread);
504
505 thread->currentContext->fCheckZerroVertAttr = fEnable;
506}
507
508void PACKSPU_APIENTRY packspu_ChromiumParameteriCR(GLenum target, GLint value)
509{
510 switch (target)
511 {
512 case GL_FLUSH_ON_THREAD_SWITCH_CR:
513 /* this is a pure packspu state, don't propagate it any further */
514 packspuFluchOnThreadSwitch(value);
515 return;
516 case GL_CHECK_ZERO_VERT_ARRT:
517 packspuCheckZerroVertAttr(value);
518 return;
519 case GL_SHARE_CONTEXT_RESOURCES_CR:
520 crStateShareContext(value);
521 break;
522 case GL_RCUSAGE_TEXTURE_SET_CR:
523 {
524 Assert(value);
525 crStateSetTextureUsed(value, GL_TRUE);
526 break;
527 }
528 case GL_RCUSAGE_TEXTURE_CLEAR_CR:
529 {
530 Assert(value);
531#ifdef DEBUG
532 {
533 CRContext *pCurState = crStateGetCurrent();
534 CRTextureObj *tobj = (CRTextureObj*)crHashtableSearch(pCurState->shared->textureTable, value);
535 Assert(tobj);
536 }
537#endif
538 crStateSetTextureUsed(value, GL_FALSE);
539 break;
540 }
541 default:
542 break;
543 }
544 crPackChromiumParameteriCR(target, value);
545}
546
547GLenum PACKSPU_APIENTRY packspu_GetError( void )
548{
549 GET_THREAD(thread);
550 int writeback = 1;
551 GLenum return_val = (GLenum) 0;
552 CRContext *pCurState = crStateGetCurrent();
553
554 if (!CRPACKSPU_IS_WDDM_CRHGSMI() && !(pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network))
555 {
556 crError( "packspu_GetError doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
557 }
558 if (pack_spu.swap)
559 {
560 crPackGetErrorSWAP( &return_val, &writeback );
561 }
562 else
563 {
564 crPackGetError( &return_val, &writeback );
565 }
566
567 packspuFlush( (void *) thread );
568 CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
569
570 if (pack_spu.swap)
571 {
572 return_val = (GLenum) SWAP32(return_val);
573 }
574
575 return return_val;
576}
577
578#ifdef CHROMIUM_THREADSAFE
579GLint PACKSPU_APIENTRY packspu_VBoxPackSetInjectThread(struct VBOXUHGSMI *pHgsmi)
580{
581 GLint con = 0;
582 int i;
583 GET_THREAD(thread);
584 CRASSERT(!thread);
585 crLockMutex(&_PackMutex);
586 {
587 CRASSERT(CRPACKSPU_IS_WDDM_CRHGSMI() || (pack_spu.numThreads>0));
588 CRASSERT(pack_spu.numThreads<MAX_THREADS);
589 for (i=0; i<MAX_THREADS; ++i)
590 {
591 if (!pack_spu.thread[i].inUse)
592 {
593 thread = &pack_spu.thread[i];
594 break;
595 }
596 }
597 CRASSERT(thread);
598
599 thread->inUse = GL_TRUE;
600 if (!CRPACKSPU_IS_WDDM_CRHGSMI())
601 thread->id = crThreadID();
602 else
603 thread->id = THREAD_OFFSET_MAGIC + i;
604 thread->currentContext = NULL;
605 thread->bInjectThread = GL_TRUE;
606
607 thread->netServer.name = crStrdup(pack_spu.name);
608 thread->netServer.buffer_size = 64 * 1024;
609
610 packspuConnectToServer(&(thread->netServer)
611#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
612 , pHgsmi
613#endif
614 );
615 CRASSERT(thread->netServer.conn);
616
617 CRASSERT(thread->packer == NULL);
618 thread->packer = crPackNewContext( pack_spu.swap );
619 CRASSERT(thread->packer);
620 crPackInitBuffer(&(thread->buffer), crNetAlloc(thread->netServer.conn),
621 thread->netServer.conn->buffer_size, thread->netServer.conn->mtu);
622 thread->buffer.canBarf = thread->netServer.conn->Barf ? GL_TRUE : GL_FALSE;
623
624 crPackSetBuffer( thread->packer, &thread->buffer );
625 crPackFlushFunc( thread->packer, packspuFlush );
626 crPackFlushArg( thread->packer, (void *) thread );
627 crPackSendHugeFunc( thread->packer, packspuHuge );
628 crPackSetContext( thread->packer );
629
630 crSetTSD(&_PackTSD, thread);
631
632 pack_spu.numThreads++;
633 }
634 crUnlockMutex(&_PackMutex);
635
636 if (CRPACKSPU_IS_WDDM_CRHGSMI())
637 {
638 CRASSERT(thread->id - THREAD_OFFSET_MAGIC < RT_ELEMENTS(pack_spu.thread)
639 && GET_THREAD_VAL_ID(thread->id) == thread);
640 con = thread->id;
641 }
642 return con;
643}
644
645GLuint PACKSPU_APIENTRY packspu_VBoxPackGetInjectID(GLint con)
646{
647 GLuint ret;
648
649 crLockMutex(&_PackMutex);
650 {
651 ThreadInfo *thread = NULL;
652 if (CRPACKSPU_IS_WDDM_CRHGSMI())
653 {
654 if (!con)
655 {
656 crError("connection expected!");
657 return 0;
658 }
659 thread = GET_THREAD_VAL_ID(con);
660 }
661 else
662 {
663 CRASSERT(!con);
664 thread = GET_THREAD_VAL();
665 }
666 CRASSERT(thread && thread->netServer.conn && thread->netServer.conn->type==CR_VBOXHGCM);
667 ret = thread->netServer.conn->u32ClientID;
668 }
669 crUnlockMutex(&_PackMutex);
670
671 return ret;
672}
673
674void PACKSPU_APIENTRY packspu_VBoxPackSetInjectID(GLuint id)
675{
676 crLockMutex(&_PackMutex);
677 {
678 GET_THREAD(thread);
679
680 CRASSERT(thread && thread->netServer.conn && thread->netServer.conn->type==CR_VBOXHGCM && thread->bInjectThread);
681 thread->netServer.conn->u32InjectClientID = id;
682 }
683 crUnlockMutex(&_PackMutex);
684}
685
686void PACKSPU_APIENTRY packspu_VBoxAttachThread()
687{
688#if 0
689 int i;
690 GET_THREAD(thread);
691
692 for (i=0; i<MAX_THREADS; ++i)
693 {
694 if (pack_spu.thread[i].inUse && thread==&pack_spu.thread[i] && thread->id==crThreadID())
695 {
696 crError("2nd attach to same thread");
697 }
698 }
699#endif
700
701 crSetTSD(&_PackTSD, NULL);
702
703 crStateVBoxAttachThread();
704}
705
706void PACKSPU_APIENTRY packspu_VBoxDetachThread()
707{
708 if (CRPACKSPU_IS_WDDM_CRHGSMI())
709 {
710 crPackSetContext(NULL);
711 crSetTSD(&_PackTSD, NULL);
712 }
713 else
714 {
715 int i;
716 GET_THREAD(thread);
717 if (thread)
718 {
719 crLockMutex(&_PackMutex);
720
721 for (i=0; i<MAX_THREADS; ++i)
722 {
723 if (pack_spu.thread[i].inUse && thread==&pack_spu.thread[i]
724 && thread->id==crThreadID() && thread->netServer.conn)
725 {
726 CRASSERT(pack_spu.numThreads>0);
727
728 packspuFlush((void *) thread);
729
730 if (pack_spu.thread[i].packer)
731 {
732 CR_LOCK_PACKER_CONTEXT(thread->packer);
733 crPackSetContext(NULL);
734 CR_UNLOCK_PACKER_CONTEXT(thread->packer);
735 crPackDeleteContext(pack_spu.thread[i].packer);
736
737 if (pack_spu.thread[i].buffer.pack)
738 {
739 crNetFree(pack_spu.thread[i].netServer.conn, pack_spu.thread[i].buffer.pack);
740 pack_spu.thread[i].buffer.pack = NULL;
741 }
742 }
743 crNetFreeConnection(pack_spu.thread[i].netServer.conn);
744
745 if (pack_spu.thread[i].netServer.name)
746 crFree(pack_spu.thread[i].netServer.name);
747
748 pack_spu.numThreads--;
749 /*note can't shift the array here, because other threads have TLS references to array elements*/
750 crMemZero(&pack_spu.thread[i], sizeof(ThreadInfo));
751
752 crSetTSD(&_PackTSD, NULL);
753
754 if (i==pack_spu.idxThreadInUse)
755 {
756 for (i=0; i<MAX_THREADS; ++i)
757 {
758 if (pack_spu.thread[i].inUse)
759 {
760 pack_spu.idxThreadInUse=i;
761 break;
762 }
763 }
764 }
765
766 break;
767 }
768 }
769
770 for (i=0; i<CR_MAX_CONTEXTS; ++i)
771 {
772 ContextInfo *ctx = &pack_spu.context[i];
773 if (ctx->currentThread == thread)
774 {
775 CRASSERT(ctx->fAutoFlush);
776 ctx->currentThread = NULL;
777 }
778 }
779
780 crUnlockMutex(&_PackMutex);
781 }
782 }
783
784 crStateVBoxDetachThread();
785}
786
787#ifdef WINDOWS
788#define WIN32_LEAN_AND_MEAN
789#include <windows.h>
790BOOL WINAPI DllMain(HINSTANCE hDLLInst, DWORD fdwReason, LPVOID lpvReserved)
791{
792 (void) lpvReserved;
793
794 switch (fdwReason)
795 {
796 case DLL_PROCESS_ATTACH:
797 {
798 crInitMutex(&_PackMutex);
799 break;
800 }
801
802 case DLL_PROCESS_DETACH:
803 {
804 crFreeMutex(&_PackMutex);
805 crNetTearDown();
806 break;
807 }
808
809 case DLL_THREAD_ATTACH:
810 case DLL_THREAD_DETACH:
811 default:
812 break;
813 }
814
815 return TRUE;
816}
817#endif
818
819#else /*ifdef CHROMIUM_THREADSAFE*/
820GLint PACKSPU_APIENTRY packspu_VBoxPackSetInjectThread(struct VBOXUHGSMI *pHgsmi)
821{
822}
823
824GLuint PACKSPU_APIENTRY packspu_VBoxPackGetInjectID(GLint con)
825{
826 return 0;
827}
828
829void PACKSPU_APIENTRY packspu_VBoxPackSetInjectID(GLuint id)
830{
831 (void) id;
832}
833
834void PACKSPU_APIENTRY packspu_VBoxPackAttachThread()
835{
836}
837
838void PACKSPU_APIENTRY packspu_VBoxPackDetachThread()
839{
840}
841#endif /*CHROMIUM_THREADSAFE*/
842
843void PACKSPU_APIENTRY packspu_VBoxPresentComposition(GLint win, const struct VBOXVR_SCR_COMPOSITOR * pCompositor, const struct VBOXVR_SCR_COMPOSITOR_ENTRY *pChangedEntry)
844{
845}
846
847void PACKSPU_APIENTRY packspu_StringMarkerGREMEDY(GLsizei len, const GLvoid *string)
848{
849}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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