VirtualBox

source: vbox/trunk/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu_init.c@ 28347

Last change on this file since 28347 was 19099, checked in by vboxsync, 16 years ago

crOpenGL: fix multicontext crashes (public bug #3762)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.1 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 "cr_spu.h"
8#include "cr_environment.h"
9#include "cr_string.h"
10#include "cr_error.h"
11#include "cr_mem.h"
12#include "cr_server.h"
13#include "feedbackspu.h"
14#include <fcntl.h>
15#ifndef WINDOWS
16#include <unistd.h>
17#endif
18
19feedbackSPU feedback_spu;
20
21static SPUFunctions feedback_functions = {
22 NULL, /* CHILD COPY */
23 NULL, /* DATA */
24 _cr_feedback_table /* THE ACTUAL FUNCTIONS */
25};
26
27static SPUFunctions *feedbackSPUInit( int id, SPU *child, SPU *self,
28 unsigned int context_id,
29 unsigned int num_contexts )
30{
31 CRContext *ctx;
32 (void) context_id;
33 (void) num_contexts;
34
35#ifdef CHROMIUM_THREADSAFE
36 crInitMutex(&feedback_spu.mutex);
37#endif
38
39 feedback_spu.id = id;
40 feedback_spu.has_child = 0;
41 if (child)
42 {
43 crSPUInitDispatchTable( &(feedback_spu.child) );
44 crSPUCopyDispatchTable( &(feedback_spu.child), &(child->dispatch_table) );
45 feedback_spu.has_child = 1;
46 }
47 crSPUInitDispatchTable( &(feedback_spu.super) );
48 crSPUCopyDispatchTable( &(feedback_spu.super), &(self->superSPU->dispatch_table) );
49 feedbackspuGatherConfiguration();
50
51 /* create/init default state tracker */
52 crStateInit();
53
54 feedback_spu.defaultctx = crStateCreateContext(NULL, 0, NULL);
55 crStateSetCurrent(feedback_spu.defaultctx);
56
57 feedback_spu.numContexts = 0;
58 crMemZero(feedback_spu.context, CR_MAX_CONTEXTS * sizeof(ContextInfo));
59
60 return &feedback_functions;
61}
62
63static void feedbackSPUSelfDispatch(SPUDispatchTable *self)
64{
65 crSPUInitDispatchTable( &(feedback_spu.self) );
66 crSPUCopyDispatchTable( &(feedback_spu.self), self );
67}
68
69static int feedbackSPUCleanup(void)
70{
71 return 1;
72}
73
74int SPULoad( char **name, char **super, SPUInitFuncPtr *init,
75 SPUSelfDispatchFuncPtr *self, SPUCleanupFuncPtr *cleanup,
76 SPUOptionsPtr *options, int *flags )
77{
78 *name = "feedback";
79 *super = "passthrough";
80 *init = feedbackSPUInit;
81 *self = feedbackSPUSelfDispatch;
82 *cleanup = feedbackSPUCleanup;
83 *options = feedbackSPUOptions;
84 *flags = (SPU_NO_PACKER|SPU_NOT_TERMINAL|SPU_MAX_SERVERS_ZERO);
85
86 return 1;
87}
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