renderspu_init.c revision 48789466bb54e3c47247eeda779b2e7943f1391a
/* Copyright (c) 2001, Stanford University
* All rights reserved
*
* See the file LICENSE.txt for information on redistributing this software.
*/
#include "cr_mem.h"
#include "cr_spu.h"
#include "cr_error.h"
#include "cr_string.h"
#include "cr_url.h"
#include "renderspu.h"
#include <stdio.h>
#ifdef RT_OS_DARWIN
# include <iprt/semaphore.h>
#endif /* RT_OS_DARWIN */
NULL, /* CHILD COPY */
NULL, /* DATA */
_cr_render_table /* THE ACTUAL FUNCTIONS */
};
#ifdef CHROMIUM_THREADSAFE
#endif
static void swapsyncConnect(void)
{
unsigned short port;
&port, 9876))
if (render_spu.is_swap_master)
{
int a;
for (a=0; a<render_spu.num_swap_clients; a++)
{
}
}
else
{
if (!render_spu.swap_conns[0])
crError("Failed connection");
}
}
#ifdef RT_OS_WINDOWS
{
bool bRet;
(void) unused;
/* Force system to create the message queue.
* Else, there's a chance that render spu will issue PostThreadMessage
* before this thread calls GetMessage for first time.
*/
{
if (bRet == -1)
{
break;
}
else
{
{
}
{
}
else
{
}
}
}
render_spu.dwWinThreadId = 0;
return 0;
}
#endif
static SPUFunctions *
unsigned int context_id, unsigned int num_contexts )
{
int numFuncs, numSpecial;
(void) child;
(void) context_id;
(void) num_contexts;
#ifdef CHROMIUM_THREADSAFE
crDebug("Render SPU: thread-safe");
#endif
/* Get our special functions. */
#ifdef RT_OS_WINDOWS
/* Start thread to create windows and process window messages */
crDebug("RenderSPU: Starting windows serving thread");
{
return NULL;
}
{
return NULL;
}
#endif
/* Get the OpenGL functions. */
if (numFuncs == 0) {
crError("The render SPU was unable to load the native OpenGL library");
return NULL;
}
numFuncs += numSpecial;
#ifdef GLX
if (!render_spu.use_glxchoosevisual) {
/* sometimes want to set this option with ATI drivers */
}
#endif
render_spu.window_id = 0;
render_spu.context_id = 0;
#ifdef USE_OSMESA
if (render_spu.use_osmesa) {
crError("Unable to load OSMesa library");
}
}
#endif
#ifdef DARWIN
# ifdef VBOX_WITH_COCOA_QT
# else /* VBOX_WITH_COCOA_QT */
render_spu.uiDockUpdateTS = 0;
/* Create a mutex for syncronizing events from the main Qt thread & this
thread */
/* Create our window groups */
CreateWindowGroup(kWindowGroupAttrMoveTogether | kWindowGroupAttrLayerTogether | kWindowGroupAttrSharedActivation | kWindowGroupAttrHideOnCollapse | kWindowGroupAttrFixedLevel, &render_spu.pMasterGroup);
CreateWindowGroup(kWindowGroupAttrMoveTogether | kWindowGroupAttrLayerTogether | kWindowGroupAttrSharedActivation | kWindowGroupAttrHideOnCollapse | kWindowGroupAttrFixedLevel, &render_spu.pParentGroup);
/* Make the correct z-layering */
/* and set the gParentGroup as parent for gMasterGroup. */
/* Install the event handlers */
{
{kEventClassVBox, kEventVBoxBoundsChanged} /* Clip/Pos the OpenGL windows when the main window is changed in pos/size */
};
/* We need to process events from our main window */
render_spu.fInit = true;
# endif /* VBOX_WITH_COCOA_QT */
#endif /* DARWIN */
/*
* Create the default window and context. Their indexes are zero and
* a client can use them without calling CreateContext or WindowCreate.
*/
crDebug("Render SPU: Creating default window (visBits=0x%x, id=0)",
if (defaultWin != 0) {
crError("Render SPU: Couldn't get a double-buffered, RGB visual with Z!");
return NULL;
}
crDebug("Render SPU: Creating default context, visBits=0x%x",
CRASSERT(defaultCtx == 0);
/* Get windowInfo for the default window */
/*
* Get the OpenGL extension functions.
* SIGH -- we have to wait until the very bitter end to load the
* extensions, because the context has to be bound before
* wglGetProcAddress will work correctly. No such issue with GLX though.
*/
#ifdef WINDOWS
/*
* Same problem as above, these are extensions so we need to
* load them after a context has been bound. As they're WGL
* extensions too, we can't simply tag them into the spu_loader.
* So we do them here for now.
* Grrr, NVIDIA driver uses EXT for GetExtensionsStringEXT,
* but ARB for others. Need furthur testing here....
*/
{
_cr_render_table[numFuncs].fn = (SPUGenericFunction) render_spu.ws.wglGetProcAddress("glCopyTexSubImage3D");
++numFuncs;
crDebug("Render SPU: Found glCopyTexSubImage3D function");
}
{
_cr_render_table[numFuncs].fn = (SPUGenericFunction) render_spu.ws.wglGetProcAddress("glDrawRangeElements");
++numFuncs;
crDebug("Render SPU: Found glDrawRangeElements function");
}
{
_cr_render_table[numFuncs].fn = (SPUGenericFunction) render_spu.ws.wglGetProcAddress("glTexSubImage3D");
++numFuncs;
crDebug("Render SPU: Found glTexSubImage3D function");
}
{
_cr_render_table[numFuncs].fn = (SPUGenericFunction) render_spu.ws.wglGetProcAddress("glTexImage3D");
++numFuncs;
crDebug("Render SPU: Found glTexImage3D function");
}
crDebug("WGL - found wglGetExtensionsStringEXT\n");
}
crDebug("WGL - found wglChoosePixelFormatEXT\n");
}
#endif
render_spu.cursorX = 0;
render_spu.cursorY = 0;
render_spu.use_L2 = 0;
crDebug("Render SPU: ---------- End of Init -------------");
return &render_functions;
}
{
}
static void DeleteContextCallback( void *data )
{
}
static void DeleteWindowCallback( void *data )
{
}
static int renderSPUCleanup(void)
{
#ifdef RT_OS_DARWIN
# ifndef VBOX_WITH_COCOA_QT
render_spu.fInit = false;
{
}
render_spu.uiDockUpdateTS = 0;
# else /* VBOX_WITH_COCOA_QT */
# endif /* VBOX_WITH_COCOA_QT */
#endif /* RT_OS_DARWIN */
#ifdef RT_OS_WINDOWS
if (render_spu.dwWinThreadId)
{
}
#endif
return 1;
}
extern SPUOptions renderSPUOptions[];
{
*name = "render";
*init = renderSPUInit;
return 1;
}
{
}
{
}
{
#ifdef RT_OS_DARWIN
#endif
}
#ifndef RT_OS_DARWIN
{
}
#endif