Exemplo n.º 1
0
/*
 * Just return the current buffer size.
 * There's no window to track the size of.
 */
static void
get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height )
{
   /* don't use GET_CURRENT_CONTEXT(ctx) here - it's a problem on Windows */
   GLcontext *ctx = (GLcontext *) _glapi_get_context();
   (void) buffer;
   if (ctx) {
      OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
      *width = osmesa->width;
      *height = osmesa->height;
   }
}
Exemplo n.º 2
0
void glEndTraceMESA(void)
{
	GLcontext * ctx;

	ctx = (GLcontext *)_glapi_get_context();
	assert(ctx);
	assert(ctx->TraceCtx);
	assert(ctx->TraceDispatch);

        /* Do we even have a context ? */
        /* Are we currently between glBegin and glEnd ? */
        /* Are we sure the current dispatch _is_ the TraceDispatch ? */
	if (!ctx ||
            (ctx->TraceCtx->betweenBeginEnd == GL_TRUE)  ||
	    (ctx->TraceDispatch != _glapi_get_override_dispatch(1)) ) {
		_mesa_error(ctx, GL_INVALID_OPERATION, __FUNCTION__ );
		return;
	}

#if 0
	/* Always dump the max indices */
// But not yet...
	trWriteCMD( VAR_COLORPOINTER );
	trWritei( ctx->TraceCtx->trColorPtrState.maxIndex );
	trWriteCMD( VAR_EDGEFLAGPOINTER );
	trWritei( ctx->TraceCtx->trEdgeFlagPtrState.maxIndex );
	trWriteCMD( VAR_INDEXPOINTER );
	trWritei( ctx->TraceCtx->trIndexPtrState.maxIndex );
	trWriteCMD( VAR_NORMALPOINTER );
	trWritei( ctx->TraceCtx->trNormalPtrState.maxIndex );
	trWriteCMD( VAR_TEXCOORDPOINTER );
	trWritei( ctx->TraceCtx->trTexCoordPtrState.maxIndex );
	trWriteCMD( VAR_VERTEXPOINTER );
	trWritei( ctx->TraceCtx->trVertexPtrState.maxIndex );
#endif

	trCloseLogFile();
	trSetOriginalDispatch();
}
Exemplo n.º 3
0
void glNewTraceMESA( GLbitfield logbits, const GLubyte * traceName )
{
	char * newname;
	GLint     length;
	GLcontext * ctx;
	const char * defaultName = "traceGL";

	ctx = (GLcontext *)_glapi_get_context();

	assert(ctx);
	assert(ctx->TraceCtx);
	assert(ctx->TraceDispatch);
	if( !ctx ||                                      /* Do we even have a context ? */
		(ctx->TraceCtx->betweenBeginEnd == GL_TRUE)   || /* Are we currently between glBegin and glEnd ? */
	   (ctx->TraceDispatch == _glapi_get_override_dispatch(1)) ) {  /* Has a trace already started ? */
		_mesa_error(ctx, GL_INVALID_OPERATION, __FUNCTION__ );
		return;
	}

	/* FIXME!!! When do we free tracename after the app is finished? */
	if( ctx->TraceCtx->traceName ) {
		free( ctx->TraceCtx->traceName );
	}

	length = strlen((char *)traceName) + 1;
	if( length != 1 ) {
		newname = (char *)malloc( length );
		strncpy( (char *)newname, (char *)traceName, length );
	} else {
		length = strlen( defaultName );
		newname = (char *)malloc( length );
		strncpy( (char *)newname, defaultName, length );
	}
	ctx->TraceCtx->traceName          = newname;
	ctx->TraceCtx->traceAttribLogBits = logbits;

	trOpenLogFile();
	trSetTraceDispatch();
}
Exemplo n.º 4
0
/**
 * \return pointer to the current GL context for this thread.
 * 
 * Calls _glapi_get_context(). This isn't the fastest way to get the current
 * context.  If you need speed, see the #GET_CURRENT_CONTEXT macro in
 * context.h.
 */
GLcontext *
_mesa_get_current_context( void )
{
   return (GLcontext *) _glapi_get_context();
}