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_environment.h"
|
---|
8 | #include "cr_string.h"
|
---|
9 | #include "cr_error.h"
|
---|
10 | #include "cr_mem.h"
|
---|
11 | #include "cr_spu.h"
|
---|
12 | #include "renderspu.h"
|
---|
13 | #include "cr_extstring.h"
|
---|
14 |
|
---|
15 |
|
---|
16 | static void
|
---|
17 | DoSync(void)
|
---|
18 | {
|
---|
19 | CRMessage *in, out;
|
---|
20 |
|
---|
21 | out.header.type = CR_MESSAGE_OOB;
|
---|
22 |
|
---|
23 | if (render_spu.is_swap_master)
|
---|
24 | {
|
---|
25 | int a;
|
---|
26 |
|
---|
27 | for (a = 0; a < render_spu.num_swap_clients; a++)
|
---|
28 | {
|
---|
29 | crNetGetMessage( render_spu.swap_conns[a], &in );
|
---|
30 | crNetFree( render_spu.swap_conns[a], in);
|
---|
31 | }
|
---|
32 |
|
---|
33 | for (a = 0; a < render_spu.num_swap_clients; a++)
|
---|
34 | crNetSend( render_spu.swap_conns[a], NULL, &out, sizeof(CRMessage));
|
---|
35 | }
|
---|
36 | else
|
---|
37 | {
|
---|
38 | crNetSend( render_spu.swap_conns[0], NULL, &out, sizeof(CRMessage));
|
---|
39 |
|
---|
40 | crNetGetMessage( render_spu.swap_conns[0], &in );
|
---|
41 | crNetFree( render_spu.swap_conns[0], in);
|
---|
42 | }
|
---|
43 | }
|
---|
44 |
|
---|
45 |
|
---|
46 |
|
---|
47 | /*
|
---|
48 | * Visual functions
|
---|
49 | */
|
---|
50 |
|
---|
51 | /**
|
---|
52 | * used for debugging and giving info to the user.
|
---|
53 | */
|
---|
54 | void
|
---|
55 | renderspuMakeVisString( GLbitfield visAttribs, char *s )
|
---|
56 | {
|
---|
57 | s[0] = 0;
|
---|
58 |
|
---|
59 | if (visAttribs & CR_RGB_BIT)
|
---|
60 | crStrcat(s, "RGB");
|
---|
61 | if (visAttribs & CR_ALPHA_BIT)
|
---|
62 | crStrcat(s, "A");
|
---|
63 | if (visAttribs & CR_DOUBLE_BIT)
|
---|
64 | crStrcat(s, ", Doublebuffer");
|
---|
65 | if (visAttribs & CR_STEREO_BIT)
|
---|
66 | crStrcat(s, ", Stereo");
|
---|
67 | if (visAttribs & CR_DEPTH_BIT)
|
---|
68 | crStrcat(s, ", Z");
|
---|
69 | if (visAttribs & CR_STENCIL_BIT)
|
---|
70 | crStrcat(s, ", Stencil");
|
---|
71 | if (visAttribs & CR_ACCUM_BIT)
|
---|
72 | crStrcat(s, ", Accum");
|
---|
73 | if (visAttribs & CR_MULTISAMPLE_BIT)
|
---|
74 | crStrcat(s, ", Multisample");
|
---|
75 | if (visAttribs & CR_OVERLAY_BIT)
|
---|
76 | crStrcat(s, ", Overlay");
|
---|
77 | if (visAttribs & CR_PBUFFER_BIT)
|
---|
78 | crStrcat(s, ", PBuffer");
|
---|
79 | }
|
---|
80 |
|
---|
81 |
|
---|
82 | /*
|
---|
83 | * Find a VisualInfo which matches the given display name and attribute
|
---|
84 | * bitmask, or return a pointer to a new visual.
|
---|
85 | */
|
---|
86 | VisualInfo *
|
---|
87 | renderspuFindVisual(const char *displayName, GLbitfield visAttribs)
|
---|
88 | {
|
---|
89 | int i;
|
---|
90 |
|
---|
91 | if (!displayName)
|
---|
92 | displayName = "";
|
---|
93 |
|
---|
94 | /* first, try to find a match */
|
---|
95 | #if defined(WINDOWS) || defined(DARWIN)
|
---|
96 | for (i = 0; i < render_spu.numVisuals; i++) {
|
---|
97 | if (visAttribs == render_spu.visuals[i].visAttribs) {
|
---|
98 | return &(render_spu.visuals[i]);
|
---|
99 | }
|
---|
100 | }
|
---|
101 | #elif defined(GLX)
|
---|
102 | for (i = 0; i < render_spu.numVisuals; i++) {
|
---|
103 | if (crStrcmp(displayName, render_spu.visuals[i].displayName) == 0
|
---|
104 | && visAttribs == render_spu.visuals[i].visAttribs) {
|
---|
105 | return &(render_spu.visuals[i]);
|
---|
106 | }
|
---|
107 | }
|
---|
108 | #endif
|
---|
109 |
|
---|
110 | if (render_spu.numVisuals >= MAX_VISUALS)
|
---|
111 | {
|
---|
112 | crWarning("Render SPU: Couldn't create a visual, too many visuals already");
|
---|
113 | return NULL;
|
---|
114 | }
|
---|
115 |
|
---|
116 | /* create a new visual */
|
---|
117 | i = render_spu.numVisuals;
|
---|
118 | render_spu.visuals[i].displayName = crStrdup(displayName);
|
---|
119 | render_spu.visuals[i].visAttribs = visAttribs;
|
---|
120 | if (renderspu_SystemInitVisual(&(render_spu.visuals[i]))) {
|
---|
121 | render_spu.numVisuals++;
|
---|
122 | return &(render_spu.visuals[i]);
|
---|
123 | }
|
---|
124 | else {
|
---|
125 | crWarning("Render SPU: Couldn't get a visual, renderspu_SystemInitVisual failed");
|
---|
126 | return NULL;
|
---|
127 | }
|
---|
128 | }
|
---|
129 |
|
---|
130 | /*
|
---|
131 | * Context functions
|
---|
132 | */
|
---|
133 |
|
---|
134 | GLint RENDER_APIENTRY
|
---|
135 | renderspuCreateContext(const char *dpyName, GLint visBits, GLint shareCtx)
|
---|
136 | {
|
---|
137 | ContextInfo *context, *sharedContext = NULL;
|
---|
138 | VisualInfo *visual;
|
---|
139 |
|
---|
140 | if (shareCtx > 0) {
|
---|
141 | sharedContext
|
---|
142 | = (ContextInfo *) crHashtableSearch(render_spu.contextTable, shareCtx);
|
---|
143 | }
|
---|
144 |
|
---|
145 | if (!dpyName || crStrlen(render_spu.display_string)>0)
|
---|
146 | dpyName = render_spu.display_string;
|
---|
147 |
|
---|
148 | visual = renderspuFindVisual(dpyName, visBits);
|
---|
149 | if (!visual)
|
---|
150 | return -1;
|
---|
151 |
|
---|
152 | context = (ContextInfo *) crCalloc(sizeof(ContextInfo));
|
---|
153 | if (!context)
|
---|
154 | return -1;
|
---|
155 | context->id = render_spu.context_id;
|
---|
156 | context->shared = sharedContext;
|
---|
157 | if (!renderspu_SystemCreateContext(visual, context, sharedContext))
|
---|
158 | return -1;
|
---|
159 |
|
---|
160 | crHashtableAdd(render_spu.contextTable, render_spu.context_id, context);
|
---|
161 | render_spu.context_id++;
|
---|
162 |
|
---|
163 | /*
|
---|
164 | crDebug("Render SPU: CreateContext(%s, 0x%x) returning %d",
|
---|
165 | dpyName, visBits, context->id);
|
---|
166 | */
|
---|
167 |
|
---|
168 | return context->id;
|
---|
169 | }
|
---|
170 |
|
---|
171 |
|
---|
172 | static void RENDER_APIENTRY
|
---|
173 | renderspuDestroyContext( GLint ctx )
|
---|
174 | {
|
---|
175 | ContextInfo *context;
|
---|
176 |
|
---|
177 | CRASSERT(ctx);
|
---|
178 |
|
---|
179 | context = (ContextInfo *) crHashtableSearch(render_spu.contextTable, ctx);
|
---|
180 | CRASSERT(context);
|
---|
181 | renderspu_SystemDestroyContext( context );
|
---|
182 | if (context->extensionString) {
|
---|
183 | crFree(context->extensionString);
|
---|
184 | context->extensionString = NULL;
|
---|
185 | }
|
---|
186 | crHashtableDelete(render_spu.contextTable, ctx, crFree);
|
---|
187 | }
|
---|
188 |
|
---|
189 |
|
---|
190 | void RENDER_APIENTRY
|
---|
191 | renderspuMakeCurrent(GLint crWindow, GLint nativeWindow, GLint ctx)
|
---|
192 | {
|
---|
193 | WindowInfo *window;
|
---|
194 | ContextInfo *context;
|
---|
195 |
|
---|
196 | /*
|
---|
197 | crDebug("%s win=%d native=0x%x ctx=%d", __FUNCTION__, crWindow, (int) nativeWindow, ctx);
|
---|
198 | */
|
---|
199 |
|
---|
200 | window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, crWindow);
|
---|
201 | context = (ContextInfo *) crHashtableSearch(render_spu.contextTable, ctx);
|
---|
202 |
|
---|
203 | if (window && context)
|
---|
204 | {
|
---|
205 | #ifdef CHROMIUM_THREADSAFE
|
---|
206 | crSetTSD(&_RenderTSD, context);
|
---|
207 | #else
|
---|
208 | render_spu.currentContext = context;
|
---|
209 | #endif
|
---|
210 | context->currentWindow = window;
|
---|
211 | if (!window)
|
---|
212 | {
|
---|
213 | crDebug("Render SPU: MakeCurrent invalid window id: %d", crWindow);
|
---|
214 | return;
|
---|
215 | }
|
---|
216 | if (!context)
|
---|
217 | {
|
---|
218 | crDebug("Render SPU: MakeCurrent invalid context id: %d", ctx);
|
---|
219 | return;
|
---|
220 | }
|
---|
221 |
|
---|
222 | renderspu_SystemMakeCurrent( window, nativeWindow, context );
|
---|
223 | if (!context->everCurrent) {
|
---|
224 | /* print OpenGL info */
|
---|
225 | const char *extString = (const char *) render_spu.ws.glGetString( GL_EXTENSIONS );
|
---|
226 | /*
|
---|
227 | crDebug( "Render SPU: GL_EXTENSIONS: %s", render_spu.ws.glGetString( GL_EXTENSIONS ) );
|
---|
228 | */
|
---|
229 | crInfo( "Render SPU: GL_VENDOR: %s", render_spu.ws.glGetString( GL_VENDOR ) );
|
---|
230 | crInfo( "Render SPU: GL_RENDERER: %s", render_spu.ws.glGetString( GL_RENDERER ) );
|
---|
231 | crInfo( "Render SPU: GL_VERSION: %s", render_spu.ws.glGetString( GL_VERSION ) );
|
---|
232 | if (crStrstr(extString, "GL_ARB_window_pos"))
|
---|
233 | context->haveWindowPosARB = GL_TRUE;
|
---|
234 | else
|
---|
235 | context->haveWindowPosARB = GL_FALSE;
|
---|
236 | context->everCurrent = GL_TRUE;
|
---|
237 | }
|
---|
238 | if (crWindow == 0 && window->mapPending &&
|
---|
239 | !render_spu.render_to_app_window && !render_spu.render_to_crut_window) {
|
---|
240 | /* Window[0] is special, it's the default window and normally hidden.
|
---|
241 | * If the mapPending flag is set, then we should now make the window
|
---|
242 | * visible.
|
---|
243 | */
|
---|
244 | renderspu_SystemShowWindow( window, GL_TRUE );
|
---|
245 | window->mapPending = GL_FALSE;
|
---|
246 | }
|
---|
247 | window->everCurrent = GL_TRUE;
|
---|
248 | }
|
---|
249 | else
|
---|
250 | {
|
---|
251 | #ifdef CHROMIUM_THREADSAFE
|
---|
252 | crSetTSD(&_RenderTSD, NULL);
|
---|
253 | #else
|
---|
254 | render_spu.currentContext = NULL;
|
---|
255 | #endif
|
---|
256 | }
|
---|
257 | }
|
---|
258 |
|
---|
259 |
|
---|
260 | /*
|
---|
261 | * Window functions
|
---|
262 | */
|
---|
263 |
|
---|
264 | GLint RENDER_APIENTRY
|
---|
265 | renderspuWindowCreate( const char *dpyName, GLint visBits )
|
---|
266 | {
|
---|
267 | WindowInfo *window;
|
---|
268 | VisualInfo *visual;
|
---|
269 | GLboolean showIt;
|
---|
270 |
|
---|
271 | if (!dpyName || crStrlen(render_spu.display_string) > 0)
|
---|
272 | dpyName = render_spu.display_string;
|
---|
273 |
|
---|
274 | visual = renderspuFindVisual( dpyName, visBits );
|
---|
275 | if (!visual)
|
---|
276 | {
|
---|
277 | crWarning( "Render SPU: Couldn't create a window, renderspuFindVisual returned NULL" );
|
---|
278 | return -1;
|
---|
279 | }
|
---|
280 |
|
---|
281 | /* Allocate WindowInfo */
|
---|
282 | window = (WindowInfo *) crCalloc(sizeof(WindowInfo));
|
---|
283 | if (!window)
|
---|
284 | {
|
---|
285 | crWarning( "Render SPU: Couldn't create a window" );
|
---|
286 | return -1;
|
---|
287 | }
|
---|
288 |
|
---|
289 | crHashtableAdd(render_spu.windowTable, render_spu.window_id, window);
|
---|
290 | window->id = render_spu.window_id;
|
---|
291 | render_spu.window_id++;
|
---|
292 |
|
---|
293 | window->x = render_spu.defaultX;
|
---|
294 | window->y = render_spu.defaultY;
|
---|
295 | window->width = render_spu.defaultWidth;
|
---|
296 | window->height = render_spu.defaultHeight;
|
---|
297 |
|
---|
298 | if ((render_spu.render_to_app_window || render_spu.render_to_crut_window) && !crGetenv("CRNEWSERVER"))
|
---|
299 | showIt = 0;
|
---|
300 | else
|
---|
301 | showIt = window->id > 0;
|
---|
302 |
|
---|
303 | /* Set window->title, replacing %i with the window ID number */
|
---|
304 | {
|
---|
305 | const char *s = crStrstr(render_spu.window_title, "%i");
|
---|
306 | if (s) {
|
---|
307 | int i, j, k;
|
---|
308 | window->title = crAlloc(crStrlen(render_spu.window_title) + 10);
|
---|
309 | for (i = 0; render_spu.window_title[i] != '%'; i++)
|
---|
310 | window->title[i] = render_spu.window_title[i];
|
---|
311 | k = sprintf(window->title + i, "%d", window->id);
|
---|
312 | CRASSERT(k < 10);
|
---|
313 | i++; /* skip the 'i' after the '%' */
|
---|
314 | j = i + k;
|
---|
315 | for (; (window->title[j] = s[i]) != 0; i++, j++)
|
---|
316 | ;
|
---|
317 | }
|
---|
318 | else {
|
---|
319 | window->title = crStrdup(render_spu.window_title);
|
---|
320 | }
|
---|
321 | }
|
---|
322 |
|
---|
323 | /*
|
---|
324 | crDebug("Render SPU: Creating window (visBits=0x%x, id=%d)", visBits, window->id);
|
---|
325 | */
|
---|
326 | /* Have GLX/WGL/AGL create the window */
|
---|
327 | if (!renderspu_SystemVBoxCreateWindow( visual, showIt, window ))
|
---|
328 | {
|
---|
329 | crFree(window);
|
---|
330 | crWarning( "Render SPU: Couldn't create a window, renderspu_SystemCreateWindow failed" );
|
---|
331 | return -1;
|
---|
332 | }
|
---|
333 |
|
---|
334 | CRASSERT(window->visual == visual);
|
---|
335 |
|
---|
336 | return window->id;
|
---|
337 | }
|
---|
338 |
|
---|
339 |
|
---|
340 | static void
|
---|
341 | RENDER_APIENTRY renderspuWindowDestroy( GLint win )
|
---|
342 | {
|
---|
343 | WindowInfo *window;
|
---|
344 | CRASSERT(win >= 0);
|
---|
345 | window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, win);
|
---|
346 | if (window) {
|
---|
347 | crDebug("Render SPU: Destroy window (%d)", win);
|
---|
348 | renderspu_SystemDestroyWindow( window );
|
---|
349 | /* remove window info from hash table, and free it */
|
---|
350 | crHashtableDelete(render_spu.windowTable, win, crFree);
|
---|
351 | }
|
---|
352 | else {
|
---|
353 | crDebug("Render SPU: Attempt to destroy invalid window (%d)", win);
|
---|
354 | }
|
---|
355 | }
|
---|
356 |
|
---|
357 |
|
---|
358 | static void RENDER_APIENTRY
|
---|
359 | renderspuWindowSize( GLint win, GLint w, GLint h )
|
---|
360 | {
|
---|
361 | WindowInfo *window;
|
---|
362 | CRASSERT(win >= 0);
|
---|
363 | window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, win);
|
---|
364 | if (window) {
|
---|
365 | renderspu_SystemWindowSize( window, w, h );
|
---|
366 | }
|
---|
367 | else {
|
---|
368 | crDebug("Render SPU: Attempt to resize invalid window (%d)", win);
|
---|
369 | }
|
---|
370 | }
|
---|
371 |
|
---|
372 |
|
---|
373 | static void RENDER_APIENTRY
|
---|
374 | renderspuWindowPosition( GLint win, GLint x, GLint y )
|
---|
375 | {
|
---|
376 | if (!render_spu.ignore_window_moves) {
|
---|
377 | WindowInfo *window;
|
---|
378 | CRASSERT(win >= 0);
|
---|
379 | window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, win);
|
---|
380 | if (window) {
|
---|
381 | renderspu_SystemWindowPosition( window, x, y );
|
---|
382 | window->x = x;
|
---|
383 | window->y = y;
|
---|
384 | }
|
---|
385 | else {
|
---|
386 | crDebug("Render SPU: Attempt to move invalid window (%d)", win);
|
---|
387 | }
|
---|
388 | }
|
---|
389 | }
|
---|
390 |
|
---|
391 | static void RENDER_APIENTRY
|
---|
392 | renderspuWindowVisibleRegion(GLint win, GLint cRects, GLint *pRects)
|
---|
393 | {
|
---|
394 | WindowInfo *window;
|
---|
395 | CRASSERT(win >= 0);
|
---|
396 | window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, win);
|
---|
397 | if (window) {
|
---|
398 | renderspu_SystemWindowVisibleRegion( window, cRects, pRects );
|
---|
399 | }
|
---|
400 | else {
|
---|
401 | crDebug("Render SPU: Attempt to set VisibleRegion for invalid window (%d)", win);
|
---|
402 | }
|
---|
403 | }
|
---|
404 |
|
---|
405 | static void RENDER_APIENTRY
|
---|
406 | renderspuWindowShow( GLint win, GLint flag )
|
---|
407 | {
|
---|
408 | WindowInfo *window;
|
---|
409 | CRASSERT(win >= 0);
|
---|
410 | window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, win);
|
---|
411 | if (window) {
|
---|
412 | if (window->nativeWindow) {
|
---|
413 | /* We're rendering back to the native app window instead of the
|
---|
414 | * new window which we (the Render SPU) created earlier.
|
---|
415 | * So, we never want to show the Render SPU's window.
|
---|
416 | */
|
---|
417 | flag = 0;
|
---|
418 | }
|
---|
419 | renderspu_SystemShowWindow( window, (GLboolean) flag );
|
---|
420 | }
|
---|
421 | else {
|
---|
422 | crDebug("Render SPU: Attempt to hide/show invalid window (%d)", win);
|
---|
423 | }
|
---|
424 | }
|
---|
425 |
|
---|
426 |
|
---|
427 | /*
|
---|
428 | * Set the current raster position to the given window coordinate.
|
---|
429 | */
|
---|
430 | static void
|
---|
431 | SetRasterPos( GLint winX, GLint winY )
|
---|
432 | {
|
---|
433 | GLfloat fx, fy;
|
---|
434 |
|
---|
435 | /* Push current matrix mode and viewport attributes */
|
---|
436 | render_spu.self.PushAttrib( GL_TRANSFORM_BIT | GL_VIEWPORT_BIT );
|
---|
437 |
|
---|
438 | /* Setup projection parameters */
|
---|
439 | render_spu.self.MatrixMode( GL_PROJECTION );
|
---|
440 | render_spu.self.PushMatrix();
|
---|
441 | render_spu.self.LoadIdentity();
|
---|
442 | render_spu.self.MatrixMode( GL_MODELVIEW );
|
---|
443 | render_spu.self.PushMatrix();
|
---|
444 | render_spu.self.LoadIdentity();
|
---|
445 |
|
---|
446 | render_spu.self.Viewport( winX - 1, winY - 1, 2, 2 );
|
---|
447 |
|
---|
448 | /* set the raster (window) position */
|
---|
449 | /* huh ? */
|
---|
450 | fx = (GLfloat) (winX - (int) winX);
|
---|
451 | fy = (GLfloat) (winY - (int) winY);
|
---|
452 | render_spu.self.RasterPos4f( fx, fy, 0.0, 1.0 );
|
---|
453 |
|
---|
454 | /* restore matrices, viewport and matrix mode */
|
---|
455 | render_spu.self.PopMatrix();
|
---|
456 | render_spu.self.MatrixMode( GL_PROJECTION );
|
---|
457 | render_spu.self.PopMatrix();
|
---|
458 |
|
---|
459 | render_spu.self.PopAttrib();
|
---|
460 | }
|
---|
461 |
|
---|
462 |
|
---|
463 | /*
|
---|
464 | * Draw the mouse pointer bitmap at (x,y) in window coords.
|
---|
465 | */
|
---|
466 | static void DrawCursor( GLint x, GLint y )
|
---|
467 | {
|
---|
468 | #define POINTER_WIDTH 32
|
---|
469 | #define POINTER_HEIGHT 32
|
---|
470 | /* Somebody artistic could probably do better here */
|
---|
471 | static const char *pointerImage[POINTER_HEIGHT] =
|
---|
472 | {
|
---|
473 | "XX..............................",
|
---|
474 | "XXXX............................",
|
---|
475 | ".XXXXX..........................",
|
---|
476 | ".XXXXXXX........................",
|
---|
477 | "..XXXXXXXX......................",
|
---|
478 | "..XXXXXXXXXX....................",
|
---|
479 | "...XXXXXXXXXXX..................",
|
---|
480 | "...XXXXXXXXXXXXX................",
|
---|
481 | "....XXXXXXXXXXXXXX..............",
|
---|
482 | "....XXXXXXXXXXXXXXXX............",
|
---|
483 | ".....XXXXXXXXXXXXXXXXX..........",
|
---|
484 | ".....XXXXXXXXXXXXXXXXXXX........",
|
---|
485 | "......XXXXXXXXXXXXXXXXXXXX......",
|
---|
486 | "......XXXXXXXXXXXXXXXXXXXXXX....",
|
---|
487 | ".......XXXXXXXXXXXXXXXXXXXXXXX..",
|
---|
488 | ".......XXXXXXXXXXXXXXXXXXXXXXXX.",
|
---|
489 | "........XXXXXXXXXXXXX...........",
|
---|
490 | "........XXXXXXXX.XXXXX..........",
|
---|
491 | ".........XXXXXX...XXXXX.........",
|
---|
492 | ".........XXXXX.....XXXXX........",
|
---|
493 | "..........XXX.......XXXXX.......",
|
---|
494 | "..........XX.........XXXXX......",
|
---|
495 | "......................XXXXX.....",
|
---|
496 | ".......................XXXXX....",
|
---|
497 | "........................XXX.....",
|
---|
498 | ".........................X......",
|
---|
499 | "................................",
|
---|
500 | "................................",
|
---|
501 | "................................",
|
---|
502 | "................................",
|
---|
503 | "................................",
|
---|
504 | "................................"
|
---|
505 |
|
---|
506 | };
|
---|
507 | static GLubyte pointerBitmap[POINTER_HEIGHT][POINTER_WIDTH / 8];
|
---|
508 | static GLboolean firstCall = GL_TRUE;
|
---|
509 | GLboolean lighting, depthTest, scissorTest;
|
---|
510 |
|
---|
511 | if (firstCall) {
|
---|
512 | /* Convert pointerImage into pointerBitmap */
|
---|
513 | GLint i, j;
|
---|
514 | for (i = 0; i < POINTER_HEIGHT; i++) {
|
---|
515 | for (j = 0; j < POINTER_WIDTH; j++) {
|
---|
516 | if (pointerImage[POINTER_HEIGHT - i - 1][j] == 'X') {
|
---|
517 | GLubyte bit = 128 >> (j & 0x7);
|
---|
518 | pointerBitmap[i][j / 8] |= bit;
|
---|
519 | }
|
---|
520 | }
|
---|
521 | }
|
---|
522 | firstCall = GL_FALSE;
|
---|
523 | }
|
---|
524 |
|
---|
525 | render_spu.self.GetBooleanv(GL_LIGHTING, &lighting);
|
---|
526 | render_spu.self.GetBooleanv(GL_DEPTH_TEST, &depthTest);
|
---|
527 | render_spu.self.GetBooleanv(GL_SCISSOR_TEST, &scissorTest);
|
---|
528 | render_spu.self.Disable(GL_LIGHTING);
|
---|
529 | render_spu.self.Disable(GL_DEPTH_TEST);
|
---|
530 | render_spu.self.Disable(GL_SCISSOR_TEST);
|
---|
531 | render_spu.self.PixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
---|
532 |
|
---|
533 | render_spu.self.Color3f(1, 1, 1);
|
---|
534 |
|
---|
535 | /* save current raster pos */
|
---|
536 | render_spu.self.PushAttrib(GL_CURRENT_BIT);
|
---|
537 | SetRasterPos(x, y);
|
---|
538 | render_spu.self.Bitmap(POINTER_WIDTH, POINTER_HEIGHT, 1.0, 31.0, 0, 0,
|
---|
539 | (const GLubyte *) pointerBitmap);
|
---|
540 | /* restore current raster pos */
|
---|
541 | render_spu.self.PopAttrib();
|
---|
542 |
|
---|
543 | if (lighting)
|
---|
544 | render_spu.self.Enable(GL_LIGHTING);
|
---|
545 | if (depthTest)
|
---|
546 | render_spu.self.Enable(GL_DEPTH_TEST);
|
---|
547 | if (scissorTest)
|
---|
548 | render_spu.self.Enable(GL_SCISSOR_TEST);
|
---|
549 | }
|
---|
550 |
|
---|
551 | void RENDER_APIENTRY renderspuSwapBuffers( GLint window, GLint flags )
|
---|
552 | {
|
---|
553 | WindowInfo *w = (WindowInfo *) crHashtableSearch(render_spu.windowTable, window);
|
---|
554 |
|
---|
555 | if (!w)
|
---|
556 | {
|
---|
557 | crDebug("Render SPU: SwapBuffers invalid window id: %d", window);
|
---|
558 | return;
|
---|
559 | }
|
---|
560 |
|
---|
561 | if (flags & CR_SUPPRESS_SWAP_BIT)
|
---|
562 | {
|
---|
563 | render_spu.self.Finish();
|
---|
564 | return;
|
---|
565 | }
|
---|
566 |
|
---|
567 | if (render_spu.drawCursor)
|
---|
568 | DrawCursor( render_spu.cursorX, render_spu.cursorY );
|
---|
569 |
|
---|
570 | if (render_spu.swap_master_url)
|
---|
571 | DoSync();
|
---|
572 |
|
---|
573 | renderspu_SystemSwapBuffers( w, flags );
|
---|
574 | }
|
---|
575 |
|
---|
576 |
|
---|
577 | /*
|
---|
578 | * Barrier functions
|
---|
579 | * Normally, we'll have a crserver somewhere that handles the barrier calls.
|
---|
580 | * However, if we're running the render SPU on the client node, then we
|
---|
581 | * should handle barriers here. The threadtest demo illustrates this.
|
---|
582 | * If we have N threads calling using this SPU we need these barrier
|
---|
583 | * functions to synchronize them.
|
---|
584 | */
|
---|
585 |
|
---|
586 | static void RENDER_APIENTRY renderspuBarrierCreateCR( GLuint name, GLuint count )
|
---|
587 | {
|
---|
588 | Barrier *b;
|
---|
589 |
|
---|
590 | if (render_spu.ignore_papi)
|
---|
591 | return;
|
---|
592 |
|
---|
593 | b = (Barrier *) crHashtableSearch( render_spu.barrierHash, name );
|
---|
594 | if (b) {
|
---|
595 | /* HACK -- this allows everybody to create a barrier, and all
|
---|
596 | but the first creation are ignored, assuming the count
|
---|
597 | match. */
|
---|
598 | if ( b->count != count ) {
|
---|
599 | crError( "Render SPU: Barrier name=%u created with count=%u, but already "
|
---|
600 | "exists with count=%u", name, count, b->count );
|
---|
601 | }
|
---|
602 | }
|
---|
603 | else {
|
---|
604 | b = (Barrier *) crAlloc( sizeof(Barrier) );
|
---|
605 | b->count = count;
|
---|
606 | crInitBarrier( &b->barrier, count );
|
---|
607 | crHashtableAdd( render_spu.barrierHash, name, b );
|
---|
608 | }
|
---|
609 | }
|
---|
610 |
|
---|
611 | static void RENDER_APIENTRY renderspuBarrierDestroyCR( GLuint name )
|
---|
612 | {
|
---|
613 | if (render_spu.ignore_papi)
|
---|
614 | return;
|
---|
615 | crHashtableDelete( render_spu.barrierHash, name, crFree );
|
---|
616 | }
|
---|
617 |
|
---|
618 | static void RENDER_APIENTRY renderspuBarrierExecCR( GLuint name )
|
---|
619 | {
|
---|
620 | Barrier *b;
|
---|
621 |
|
---|
622 | if (render_spu.ignore_papi)
|
---|
623 | return;
|
---|
624 |
|
---|
625 | b = (Barrier *) crHashtableSearch( render_spu.barrierHash, name );
|
---|
626 | if (b) {
|
---|
627 | crWaitBarrier( &(b->barrier) );
|
---|
628 | }
|
---|
629 | else {
|
---|
630 | crWarning("Render SPU: Bad barrier name %d in BarrierExec()", name);
|
---|
631 | }
|
---|
632 | }
|
---|
633 |
|
---|
634 |
|
---|
635 | /*
|
---|
636 | * Semaphore functions
|
---|
637 | * XXX we should probably implement these too, for the same reason as
|
---|
638 | * barriers (see above).
|
---|
639 | */
|
---|
640 |
|
---|
641 | static void RENDER_APIENTRY renderspuSemaphoreCreateCR( GLuint name, GLuint count )
|
---|
642 | {
|
---|
643 | (void) name;
|
---|
644 | (void) count;
|
---|
645 | }
|
---|
646 |
|
---|
647 | static void RENDER_APIENTRY renderspuSemaphoreDestroyCR( GLuint name )
|
---|
648 | {
|
---|
649 | (void) name;
|
---|
650 | }
|
---|
651 |
|
---|
652 | static void RENDER_APIENTRY renderspuSemaphorePCR( GLuint name )
|
---|
653 | {
|
---|
654 | (void) name;
|
---|
655 | }
|
---|
656 |
|
---|
657 | static void RENDER_APIENTRY renderspuSemaphoreVCR( GLuint name )
|
---|
658 | {
|
---|
659 | (void) name;
|
---|
660 | }
|
---|
661 |
|
---|
662 |
|
---|
663 | /*
|
---|
664 | * Misc functions
|
---|
665 | */
|
---|
666 |
|
---|
667 |
|
---|
668 |
|
---|
669 | static void RENDER_APIENTRY renderspuChromiumParameteriCR(GLenum target, GLint value)
|
---|
670 | {
|
---|
671 | (void) target;
|
---|
672 | (void) value;
|
---|
673 |
|
---|
674 |
|
---|
675 | #if 0
|
---|
676 | switch (target)
|
---|
677 | {
|
---|
678 | default:
|
---|
679 | crWarning("Unhandled target in renderspuChromiumParameteriCR()");
|
---|
680 | break;
|
---|
681 | }
|
---|
682 | #endif
|
---|
683 | }
|
---|
684 |
|
---|
685 | static void RENDER_APIENTRY
|
---|
686 | renderspuChromiumParameterfCR(GLenum target, GLfloat value)
|
---|
687 | {
|
---|
688 | (void) target;
|
---|
689 | (void) value;
|
---|
690 |
|
---|
691 | #if 0
|
---|
692 | switch (target) {
|
---|
693 | default:
|
---|
694 | crWarning("Unhandled target in renderspuChromiumParameterfCR()");
|
---|
695 | break;
|
---|
696 | }
|
---|
697 | #endif
|
---|
698 | }
|
---|
699 |
|
---|
700 |
|
---|
701 | static void RENDER_APIENTRY
|
---|
702 | renderspuChromiumParametervCR(GLenum target, GLenum type, GLsizei count,
|
---|
703 | const GLvoid *values)
|
---|
704 | {
|
---|
705 | int client_num;
|
---|
706 | unsigned short port;
|
---|
707 | CRMessage *msg, pingback;
|
---|
708 | unsigned char *privbuf = NULL;
|
---|
709 |
|
---|
710 | switch (target) {
|
---|
711 |
|
---|
712 | case GL_GATHER_CONNECT_CR:
|
---|
713 | if (render_spu.gather_userbuf_size)
|
---|
714 | privbuf = (unsigned char *)crAlloc(1024*768*4);
|
---|
715 |
|
---|
716 | port = ((GLint *) values)[0];
|
---|
717 |
|
---|
718 | if (render_spu.gather_conns == NULL)
|
---|
719 | render_spu.gather_conns = crAlloc(render_spu.server->numClients*sizeof(CRConnection *));
|
---|
720 | else
|
---|
721 | {
|
---|
722 | crError("Oh bother! duplicate GL_GATHER_CONNECT_CR getting through");
|
---|
723 | }
|
---|
724 |
|
---|
725 | for (client_num=0; client_num< render_spu.server->numClients; client_num++)
|
---|
726 | {
|
---|
727 | switch (render_spu.server->clients[client_num]->conn->type)
|
---|
728 | {
|
---|
729 | case CR_TCPIP:
|
---|
730 | crDebug("Render SPU: AcceptClient from %s on %d",
|
---|
731 | render_spu.server->clients[client_num]->conn->hostname, render_spu.gather_port);
|
---|
732 | render_spu.gather_conns[client_num] =
|
---|
733 | crNetAcceptClient("tcpip", NULL, port, 1024*1024, 1);
|
---|
734 | break;
|
---|
735 |
|
---|
736 | case CR_GM:
|
---|
737 | render_spu.gather_conns[client_num] =
|
---|
738 | crNetAcceptClient("gm", NULL, port, 1024*1024, 1);
|
---|
739 | break;
|
---|
740 |
|
---|
741 | default:
|
---|
742 | crError("Render SPU: Unknown Network Type to Open Gather Connection");
|
---|
743 | }
|
---|
744 |
|
---|
745 |
|
---|
746 | if (render_spu.gather_userbuf_size)
|
---|
747 | {
|
---|
748 | render_spu.gather_conns[client_num]->userbuf = privbuf;
|
---|
749 | render_spu.gather_conns[client_num]->userbuf_len = render_spu.gather_userbuf_size;
|
---|
750 | }
|
---|
751 | else
|
---|
752 | {
|
---|
753 | render_spu.gather_conns[client_num]->userbuf = NULL;
|
---|
754 | render_spu.gather_conns[client_num]->userbuf_len = 0;
|
---|
755 | }
|
---|
756 |
|
---|
757 | if (render_spu.gather_conns[client_num])
|
---|
758 | {
|
---|
759 | crDebug("Render SPU: success! from %s", render_spu.gather_conns[client_num]->hostname);
|
---|
760 | }
|
---|
761 | }
|
---|
762 |
|
---|
763 | break;
|
---|
764 |
|
---|
765 | case GL_GATHER_DRAWPIXELS_CR:
|
---|
766 | pingback.header.type = CR_MESSAGE_OOB;
|
---|
767 |
|
---|
768 | for (client_num=0; client_num< render_spu.server->numClients; client_num++)
|
---|
769 | {
|
---|
770 | crNetGetMessage(render_spu.gather_conns[client_num], &msg);
|
---|
771 | if (msg->header.type == CR_MESSAGE_GATHER)
|
---|
772 | {
|
---|
773 | crNetFree(render_spu.gather_conns[client_num], msg);
|
---|
774 | }
|
---|
775 | else
|
---|
776 | {
|
---|
777 | crError("Render SPU: expecting MESSAGE_GATHER. got crap! (%d of %d)",
|
---|
778 | client_num, render_spu.server->numClients-1);
|
---|
779 | }
|
---|
780 | }
|
---|
781 |
|
---|
782 | /*
|
---|
783 | * We're only hitting the case if we're not actually calling
|
---|
784 | * child.SwapBuffers from readback, so a switch about which
|
---|
785 | * call to DoSync() we really want [this one, or the one
|
---|
786 | * in SwapBuffers above] is not necessary -- karl
|
---|
787 | */
|
---|
788 |
|
---|
789 | if (render_spu.swap_master_url)
|
---|
790 | DoSync();
|
---|
791 |
|
---|
792 | for (client_num=0; client_num< render_spu.server->numClients; client_num++)
|
---|
793 | crNetSend(render_spu.gather_conns[client_num], NULL, &pingback,
|
---|
794 | sizeof(CRMessageHeader));
|
---|
795 |
|
---|
796 | render_spu.self.RasterPos2i(((GLint *)values)[0], ((GLint *)values)[1]);
|
---|
797 | render_spu.self.DrawPixels( ((GLint *)values)[2], ((GLint *)values)[3],
|
---|
798 | ((GLint *)values)[4], ((GLint *)values)[5],
|
---|
799 | render_spu.gather_conns[0]->userbuf);
|
---|
800 |
|
---|
801 |
|
---|
802 | render_spu.self.SwapBuffers(((GLint *)values)[6], 0);
|
---|
803 | break;
|
---|
804 |
|
---|
805 | case GL_CURSOR_POSITION_CR:
|
---|
806 | if (type == GL_INT && count == 2) {
|
---|
807 | render_spu.cursorX = ((GLint *) values)[0];
|
---|
808 | render_spu.cursorY = ((GLint *) values)[1];
|
---|
809 | crDebug("Render SPU: GL_CURSOR_POSITION_CR (%d, %d)", render_spu.cursorX, render_spu.cursorY);
|
---|
810 | }
|
---|
811 | else {
|
---|
812 | crWarning("Render SPU: Bad type or count for ChromiumParametervCR(GL_CURSOR_POSITION_CR)");
|
---|
813 | }
|
---|
814 | break;
|
---|
815 |
|
---|
816 | case GL_WINDOW_SIZE_CR:
|
---|
817 | /* XXX this is old code that should be removed.
|
---|
818 | * NOTE: we can only resize the default (id=0) window!!!
|
---|
819 | */
|
---|
820 | {
|
---|
821 | GLint w, h;
|
---|
822 | WindowInfo *window;
|
---|
823 | CRASSERT(type == GL_INT);
|
---|
824 | CRASSERT(count == 2);
|
---|
825 | CRASSERT(values);
|
---|
826 | w = ((GLint*)values)[0];
|
---|
827 | h = ((GLint*)values)[1];
|
---|
828 | window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, 0);
|
---|
829 | if (window)
|
---|
830 | {
|
---|
831 | renderspu_SystemWindowSize(window, w, h);
|
---|
832 | }
|
---|
833 | }
|
---|
834 | break;
|
---|
835 |
|
---|
836 | default:
|
---|
837 | #if 0
|
---|
838 | crWarning("Unhandled target in renderspuChromiumParametervCR(0x%x)", (int) target);
|
---|
839 | #endif
|
---|
840 | break;
|
---|
841 | }
|
---|
842 | }
|
---|
843 |
|
---|
844 |
|
---|
845 | static void RENDER_APIENTRY
|
---|
846 | renderspuGetChromiumParametervCR(GLenum target, GLuint index, GLenum type,
|
---|
847 | GLsizei count, GLvoid *values)
|
---|
848 | {
|
---|
849 | switch (target) {
|
---|
850 | case GL_WINDOW_SIZE_CR:
|
---|
851 | {
|
---|
852 | GLint x, y, w, h, *size = (GLint *) values;
|
---|
853 | WindowInfo *window;
|
---|
854 | CRASSERT(type == GL_INT);
|
---|
855 | CRASSERT(count == 2);
|
---|
856 | CRASSERT(values);
|
---|
857 | size[0] = size[1] = 0; /* default */
|
---|
858 | window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, index);
|
---|
859 | if (window)
|
---|
860 | {
|
---|
861 | renderspu_SystemGetWindowGeometry(window, &x, &y, &w, &h);
|
---|
862 | size[0] = w;
|
---|
863 | size[1] = h;
|
---|
864 | }
|
---|
865 | }
|
---|
866 | break;
|
---|
867 | case GL_WINDOW_POSITION_CR:
|
---|
868 | /* return window position, as a screen coordinate */
|
---|
869 | {
|
---|
870 | GLint *pos = (GLint *) values;
|
---|
871 | GLint x, y, w, h;
|
---|
872 | WindowInfo *window;
|
---|
873 | CRASSERT(type == GL_INT);
|
---|
874 | CRASSERT(count == 2);
|
---|
875 | CRASSERT(values);
|
---|
876 | pos[0] = pos[1] = 0; /* default */
|
---|
877 | window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, index);
|
---|
878 | if (window)
|
---|
879 | {
|
---|
880 | renderspu_SystemGetWindowGeometry(window, &x, &y, &w, &h);
|
---|
881 | pos[0] = x;/*window->x;*/
|
---|
882 | pos[1] = y;/*window->y;*/
|
---|
883 | }
|
---|
884 | }
|
---|
885 | break;
|
---|
886 | case GL_MAX_WINDOW_SIZE_CR:
|
---|
887 | {
|
---|
888 | GLint *maxSize = (GLint *) values;
|
---|
889 | WindowInfo *window;
|
---|
890 | CRASSERT(type == GL_INT);
|
---|
891 | CRASSERT(count == 2);
|
---|
892 | CRASSERT(values);
|
---|
893 | window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, index);
|
---|
894 | if (window)
|
---|
895 | {
|
---|
896 | renderspu_SystemGetMaxWindowSize(window, maxSize + 0, maxSize + 1);
|
---|
897 | }
|
---|
898 | }
|
---|
899 | break;
|
---|
900 | default:
|
---|
901 | ; /* nothing - silence compiler */
|
---|
902 | }
|
---|
903 | }
|
---|
904 |
|
---|
905 |
|
---|
906 | static void RENDER_APIENTRY
|
---|
907 | renderspuBoundsInfoCR( CRrecti *bounds, GLbyte *payload, GLint len,
|
---|
908 | GLint num_opcodes )
|
---|
909 | {
|
---|
910 | (void) bounds;
|
---|
911 | (void) payload;
|
---|
912 | (void) len;
|
---|
913 | (void) num_opcodes;
|
---|
914 | /* draw the bounding box */
|
---|
915 | if (render_spu.draw_bbox) {
|
---|
916 | GET_CONTEXT(context);
|
---|
917 | WindowInfo *window = context->currentWindow;
|
---|
918 | GLint x, y, w, h;
|
---|
919 |
|
---|
920 | renderspu_SystemGetWindowGeometry(window, &x, &y, &w, &h);
|
---|
921 |
|
---|
922 | render_spu.self.PushMatrix();
|
---|
923 | render_spu.self.LoadIdentity();
|
---|
924 | render_spu.self.MatrixMode(GL_PROJECTION);
|
---|
925 | render_spu.self.PushMatrix();
|
---|
926 | render_spu.self.LoadIdentity();
|
---|
927 | render_spu.self.Ortho(0, w, 0, h, -1, 1);
|
---|
928 | render_spu.self.Color3f(1, 1, 1);
|
---|
929 | render_spu.self.Begin(GL_LINE_LOOP);
|
---|
930 | render_spu.self.Vertex2i(bounds->x1, bounds->y1);
|
---|
931 | render_spu.self.Vertex2i(bounds->x2, bounds->y1);
|
---|
932 | render_spu.self.Vertex2i(bounds->x2, bounds->y2);
|
---|
933 | render_spu.self.Vertex2i(bounds->x1, bounds->y2);
|
---|
934 | render_spu.self.End();
|
---|
935 | render_spu.self.PopMatrix();
|
---|
936 | render_spu.self.MatrixMode(GL_MODELVIEW);
|
---|
937 | render_spu.self.PopMatrix();
|
---|
938 | }
|
---|
939 | }
|
---|
940 |
|
---|
941 |
|
---|
942 | static void RENDER_APIENTRY
|
---|
943 | renderspuWriteback( GLint *writeback )
|
---|
944 | {
|
---|
945 | (void) writeback;
|
---|
946 | }
|
---|
947 |
|
---|
948 |
|
---|
949 | static void
|
---|
950 | remove_trailing_space(char *s)
|
---|
951 | {
|
---|
952 | int k = crStrlen(s);
|
---|
953 | while (k > 0 && s[k-1] == ' ')
|
---|
954 | k--;
|
---|
955 | s[k] = 0;
|
---|
956 | }
|
---|
957 |
|
---|
958 | static const GLubyte * RENDER_APIENTRY
|
---|
959 | renderspuGetString(GLenum pname)
|
---|
960 | {
|
---|
961 | static char tempStr[1000];
|
---|
962 | GET_CONTEXT(context);
|
---|
963 |
|
---|
964 | if (pname == GL_EXTENSIONS)
|
---|
965 | {
|
---|
966 | const char *nativeExt;
|
---|
967 | char *crExt, *s1, *s2;
|
---|
968 |
|
---|
969 | if (!render_spu.ws.glGetString)
|
---|
970 | return NULL;
|
---|
971 |
|
---|
972 | nativeExt = (const char *) render_spu.ws.glGetString(GL_EXTENSIONS);
|
---|
973 | if (!nativeExt) {
|
---|
974 | /* maybe called w/out current context. */
|
---|
975 | return NULL;
|
---|
976 | }
|
---|
977 |
|
---|
978 | crExt = crStrjoin3(crExtensions, " ", crAppOnlyExtensions);
|
---|
979 | s1 = crStrIntersect(nativeExt, crExt);
|
---|
980 | remove_trailing_space(s1);
|
---|
981 | s2 = crStrjoin3(s1, " ", crChromiumExtensions);
|
---|
982 | remove_trailing_space(s2);
|
---|
983 | crFree(crExt);
|
---|
984 | crFree(s1);
|
---|
985 | if (context->extensionString)
|
---|
986 | crFree(context->extensionString);
|
---|
987 | context->extensionString = s2;
|
---|
988 | return (const GLubyte *) s2;
|
---|
989 | }
|
---|
990 | else if (pname == GL_VENDOR)
|
---|
991 | return (const GLubyte *) CR_VENDOR;
|
---|
992 | else if (pname == GL_VERSION)
|
---|
993 | return render_spu.ws.glGetString(GL_VERSION);
|
---|
994 | else if (pname == GL_RENDERER) {
|
---|
995 | sprintf(tempStr, "Chromium (%s)", (char *) render_spu.ws.glGetString(GL_RENDERER));
|
---|
996 | return (const GLubyte *) tempStr;
|
---|
997 | }
|
---|
998 | else
|
---|
999 | return NULL;
|
---|
1000 | }
|
---|
1001 |
|
---|
1002 |
|
---|
1003 | #if defined(DARWIN)
|
---|
1004 | void renderspuFlush()
|
---|
1005 | {
|
---|
1006 | glFlush();
|
---|
1007 | }
|
---|
1008 |
|
---|
1009 | void renderspuFinish()
|
---|
1010 | {
|
---|
1011 | glFinish();
|
---|
1012 | }
|
---|
1013 | #endif
|
---|
1014 |
|
---|
1015 | #define FILLIN( NAME, FUNC ) \
|
---|
1016 | table[i].name = crStrdup(NAME); \
|
---|
1017 | table[i].fn = (SPUGenericFunction) FUNC; \
|
---|
1018 | i++;
|
---|
1019 |
|
---|
1020 |
|
---|
1021 | /* These are the functions which the render SPU implements, not OpenGL.
|
---|
1022 | */
|
---|
1023 | int
|
---|
1024 | renderspuCreateFunctions(SPUNamedFunctionTable table[])
|
---|
1025 | {
|
---|
1026 | int i = 0;
|
---|
1027 | FILLIN( "SwapBuffers", renderspuSwapBuffers );
|
---|
1028 | FILLIN( "CreateContext", renderspuCreateContext );
|
---|
1029 | FILLIN( "DestroyContext", renderspuDestroyContext );
|
---|
1030 | FILLIN( "MakeCurrent", renderspuMakeCurrent );
|
---|
1031 | FILLIN( "WindowCreate", renderspuWindowCreate );
|
---|
1032 | FILLIN( "WindowDestroy", renderspuWindowDestroy );
|
---|
1033 | FILLIN( "WindowSize", renderspuWindowSize );
|
---|
1034 | FILLIN( "WindowPosition", renderspuWindowPosition );
|
---|
1035 | FILLIN( "WindowVisibleRegion", renderspuWindowVisibleRegion );
|
---|
1036 | FILLIN( "WindowShow", renderspuWindowShow );
|
---|
1037 | FILLIN( "BarrierCreateCR", renderspuBarrierCreateCR );
|
---|
1038 | FILLIN( "BarrierDestroyCR", renderspuBarrierDestroyCR );
|
---|
1039 | FILLIN( "BarrierExecCR", renderspuBarrierExecCR );
|
---|
1040 | FILLIN( "BoundsInfoCR", renderspuBoundsInfoCR );
|
---|
1041 | FILLIN( "SemaphoreCreateCR", renderspuSemaphoreCreateCR );
|
---|
1042 | FILLIN( "SemaphoreDestroyCR", renderspuSemaphoreDestroyCR );
|
---|
1043 | FILLIN( "SemaphorePCR", renderspuSemaphorePCR );
|
---|
1044 | FILLIN( "SemaphoreVCR", renderspuSemaphoreVCR );
|
---|
1045 | FILLIN( "Writeback", renderspuWriteback );
|
---|
1046 | FILLIN( "ChromiumParameteriCR", renderspuChromiumParameteriCR );
|
---|
1047 | FILLIN( "ChromiumParameterfCR", renderspuChromiumParameterfCR );
|
---|
1048 | FILLIN( "ChromiumParametervCR", renderspuChromiumParametervCR );
|
---|
1049 | FILLIN( "GetChromiumParametervCR", renderspuGetChromiumParametervCR );
|
---|
1050 | FILLIN( "GetString", renderspuGetString );
|
---|
1051 | #if defined(DARWIN)
|
---|
1052 | FILLIN( "Finish", renderspuFinish );
|
---|
1053 | FILLIN( "Flush", renderspuFlush );
|
---|
1054 | #endif
|
---|
1055 | return i;
|
---|
1056 | }
|
---|