void crStateMakeCurrent( CRContext *ctx ) { CRContext *current = GetCurrentContext(); if (ctx == NULL) ctx = defaultContext; if (current == ctx) return; /* no-op */ CRASSERT(ctx); if (current) { /* Check to see if the differencer exists first, we may not have one, aka the packspu */ if (diff_api.AlphaFunc) crStateSwitchContext( current, ctx ); } #ifdef CHROMIUM_THREADSAFE crSetTSD(&__contextTSD, ctx); #else __currentContext = ctx; #endif /* ensure matrix state is also current */ crStateMatrixMode(ctx->transform.matrixMode); }
void crStateDestroyContext( CRContext *ctx ) { CRContext *current = GetCurrentContext(); if (current == ctx) { /* destroying the current context - have to be careful here */ CRASSERT(defaultContext); /* Check to see if the differencer exists first, we may not have one, aka the packspu */ if (diff_api.AlphaFunc) crStateSwitchContext(current, defaultContext); #ifdef CHROMIUM_THREADSAFE SetCurrentContext(defaultContext); #else __currentContext = defaultContext; #endif /* ensure matrix state is also current */ crStateMatrixMode(defaultContext->transform.matrixMode); } g_availableContexts[ctx->id] = 0; #ifdef CHROMIUM_THREADSAFE VBoxTlsRefRelease(ctx); #else crStateFreeContext(ctx); #endif }
/* * As above, but don't call crStateSwitchContext(). */ void crStateSetCurrent( CRContext *ctx ) { CRContext *current = GetCurrentContext(); if (ctx == NULL) ctx = defaultContext; if (current == ctx) return; /* no-op */ CRASSERT(ctx); #ifdef CHROMIUM_THREADSAFE crSetTSD(&__contextTSD, ctx); #else __currentContext = ctx; #endif /* ensure matrix state is also current */ crStateMatrixMode(ctx->transform.matrixMode); }
void FEEDBACKSPU_APIENTRY feedbackspu_MatrixMode( GLenum mode ) { crStateMatrixMode( mode ); feedback_spu.super.MatrixMode( mode ); }
int32_t crVBoxServerClientWrite(uint32_t u32ClientID, uint8_t *pBuffer, uint32_t cbBuffer) { CRClient *pClient = NULL; int32_t i; #ifdef VBOXCR_LOGFPS uint64_t tstart, tend; #endif /*crDebug("=>crServer: ClientWrite u32ClientID=%d", u32ClientID);*/ for (i = 0; i < cr_server.numClients; i++) { if (cr_server.clients[i] && cr_server.clients[i]->conn && cr_server.clients[i]->conn->u32ClientID==u32ClientID) { pClient = cr_server.clients[i]; break; } } if (!pClient) return VERR_INVALID_PARAMETER; if (!pClient->conn->vMajor) return VERR_NOT_SUPPORTED; #ifdef VBOXCR_LOGFPS tstart = RTTimeNanoTS(); #endif CRASSERT(pBuffer); /* This should never fire unless we start to multithread */ CRASSERT(pClient->conn->pBuffer==NULL && pClient->conn->cbBuffer==0); /* Check if there's a blocker in queue and it's not this client */ if (cr_server.run_queue->client != pClient && crServerClientInBeginEnd(cr_server.run_queue->client)) { crDebug("crServer: client %d blocked, allow_redir_ptr = 0", u32ClientID); pClient->conn->allow_redir_ptr = 0; } else { pClient->conn->allow_redir_ptr = 1; } pClient->conn->pBuffer = pBuffer; pClient->conn->cbBuffer = cbBuffer; crNetRecv(); CRASSERT(pClient->conn->pBuffer==NULL && pClient->conn->cbBuffer==0); crServerServiceClients(); #if 0 if (pClient->currentMural) { crStateViewport( 0, 0, 500, 500 ); pClient->currentMural->viewportValidated = GL_FALSE; cr_server.head_spu->dispatch_table.Viewport( 0, 0, 500, 500 ); crStateViewport( 0, 0, 600, 600 ); pClient->currentMural->viewportValidated = GL_FALSE; cr_server.head_spu->dispatch_table.Viewport( 0, 0, 600, 600 ); crStateMatrixMode(GL_PROJECTION); cr_server.head_spu->dispatch_table.MatrixMode(GL_PROJECTION); crServerDispatchLoadIdentity(); crStateFrustum(-0.6, 0.6, -0.5, 0.5, 1.5, 150.0); cr_server.head_spu->dispatch_table.Frustum(-0.6, 0.6, -0.5, 0.5, 1.5, 150.0); crServerDispatchLoadIdentity(); crStateFrustum(-0.5, 0.5, -0.5, 0.5, 1.5, 150.0); cr_server.head_spu->dispatch_table.Frustum(-0.5, 0.5, -0.5, 0.5, 1.5, 150.0); crStateMatrixMode(GL_MODELVIEW); cr_server.head_spu->dispatch_table.MatrixMode(GL_MODELVIEW); crServerDispatchLoadIdentity(); crStateFrustum(-0.5, 0.5, -0.5, 0.5, 1.5, 150.0); cr_server.head_spu->dispatch_table.Frustum(-0.5, 0.5, -0.5, 0.5, 1.5, 150.0); crServerDispatchLoadIdentity(); } #endif crStateResetCurrentPointers(&cr_server.current); CRASSERT(!pClient->conn->allow_redir_ptr || crNetNumMessages(pClient->conn)==0); #ifdef VBOXCR_LOGFPS tend = RTTimeNanoTS(); pClient->timeUsed += tend-tstart; #endif /*crDebug("<=crServer: ClientWrite u32ClientID=%d", u32ClientID);*/ return VINF_SUCCESS; }