added _mesa_initialize_buffer/visual()
This commit is contained in:
parent
9ad2ce070e
commit
178a1c5a25
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: context.c,v 1.60 2000/04/17 17:57:04 brianp Exp $ */
|
/* $Id: context.c,v 1.61 2000/04/22 01:05:00 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
|
@ -87,164 +87,6 @@ struct immediate *_mesa_CurrentInput = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************/
|
|
||||||
/***** Profiling functions *****/
|
|
||||||
/**********************************************************************/
|
|
||||||
|
|
||||||
#ifdef PROFILE
|
|
||||||
|
|
||||||
#include <sys/times.h>
|
|
||||||
#include <sys/param.h>
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Return system time in seconds.
|
|
||||||
* NOTE: this implementation may not be very portable!
|
|
||||||
*/
|
|
||||||
GLdouble gl_time( void )
|
|
||||||
{
|
|
||||||
static GLdouble prev_time = 0.0;
|
|
||||||
static GLdouble time;
|
|
||||||
struct tms tm;
|
|
||||||
clock_t clk;
|
|
||||||
|
|
||||||
clk = times(&tm);
|
|
||||||
|
|
||||||
#ifdef CLK_TCK
|
|
||||||
time = (double)clk / (double)CLK_TCK;
|
|
||||||
#else
|
|
||||||
time = (double)clk / (double)HZ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (time>prev_time) {
|
|
||||||
prev_time = time;
|
|
||||||
return time;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return prev_time;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Reset the timing/profiling counters
|
|
||||||
*/
|
|
||||||
static void init_timings( GLcontext *ctx )
|
|
||||||
{
|
|
||||||
ctx->BeginEndCount = 0;
|
|
||||||
ctx->BeginEndTime = 0.0;
|
|
||||||
ctx->VertexCount = 0;
|
|
||||||
ctx->VertexTime = 0.0;
|
|
||||||
ctx->PointCount = 0;
|
|
||||||
ctx->PointTime = 0.0;
|
|
||||||
ctx->LineCount = 0;
|
|
||||||
ctx->LineTime = 0.0;
|
|
||||||
ctx->PolygonCount = 0;
|
|
||||||
ctx->PolygonTime = 0.0;
|
|
||||||
ctx->ClearCount = 0;
|
|
||||||
ctx->ClearTime = 0.0;
|
|
||||||
ctx->SwapCount = 0;
|
|
||||||
ctx->SwapTime = 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Print the accumulated timing/profiling data.
|
|
||||||
*/
|
|
||||||
static void print_timings( GLcontext *ctx )
|
|
||||||
{
|
|
||||||
GLdouble beginendrate;
|
|
||||||
GLdouble vertexrate;
|
|
||||||
GLdouble pointrate;
|
|
||||||
GLdouble linerate;
|
|
||||||
GLdouble polygonrate;
|
|
||||||
GLdouble overhead;
|
|
||||||
GLdouble clearrate;
|
|
||||||
GLdouble swaprate;
|
|
||||||
GLdouble avgvertices;
|
|
||||||
|
|
||||||
if (ctx->BeginEndTime>0.0) {
|
|
||||||
beginendrate = ctx->BeginEndCount / ctx->BeginEndTime;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
beginendrate = 0.0;
|
|
||||||
}
|
|
||||||
if (ctx->VertexTime>0.0) {
|
|
||||||
vertexrate = ctx->VertexCount / ctx->VertexTime;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
vertexrate = 0.0;
|
|
||||||
}
|
|
||||||
if (ctx->PointTime>0.0) {
|
|
||||||
pointrate = ctx->PointCount / ctx->PointTime;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
pointrate = 0.0;
|
|
||||||
}
|
|
||||||
if (ctx->LineTime>0.0) {
|
|
||||||
linerate = ctx->LineCount / ctx->LineTime;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
linerate = 0.0;
|
|
||||||
}
|
|
||||||
if (ctx->PolygonTime>0.0) {
|
|
||||||
polygonrate = ctx->PolygonCount / ctx->PolygonTime;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
polygonrate = 0.0;
|
|
||||||
}
|
|
||||||
if (ctx->ClearTime>0.0) {
|
|
||||||
clearrate = ctx->ClearCount / ctx->ClearTime;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
clearrate = 0.0;
|
|
||||||
}
|
|
||||||
if (ctx->SwapTime>0.0) {
|
|
||||||
swaprate = ctx->SwapCount / ctx->SwapTime;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
swaprate = 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ctx->BeginEndCount>0) {
|
|
||||||
avgvertices = (GLdouble) ctx->VertexCount / (GLdouble) ctx->BeginEndCount;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
avgvertices = 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
overhead = ctx->BeginEndTime - ctx->VertexTime - ctx->PointTime
|
|
||||||
- ctx->LineTime - ctx->PolygonTime;
|
|
||||||
|
|
||||||
|
|
||||||
printf(" Count Time (s) Rate (/s) \n");
|
|
||||||
printf("--------------------------------------------------------\n");
|
|
||||||
printf("glBegin/glEnd %7d %8.3f %10.3f\n",
|
|
||||||
ctx->BeginEndCount, ctx->BeginEndTime, beginendrate);
|
|
||||||
printf(" vertexes transformed %7d %8.3f %10.3f\n",
|
|
||||||
ctx->VertexCount, ctx->VertexTime, vertexrate );
|
|
||||||
printf(" points rasterized %7d %8.3f %10.3f\n",
|
|
||||||
ctx->PointCount, ctx->PointTime, pointrate );
|
|
||||||
printf(" lines rasterized %7d %8.3f %10.3f\n",
|
|
||||||
ctx->LineCount, ctx->LineTime, linerate );
|
|
||||||
printf(" polygons rasterized %7d %8.3f %10.3f\n",
|
|
||||||
ctx->PolygonCount, ctx->PolygonTime, polygonrate );
|
|
||||||
printf(" overhead %8.3f\n", overhead );
|
|
||||||
printf("glClear %7d %8.3f %10.3f\n",
|
|
||||||
ctx->ClearCount, ctx->ClearTime, clearrate );
|
|
||||||
printf("SwapBuffers %7d %8.3f %10.3f\n",
|
|
||||||
ctx->SwapCount, ctx->SwapTime, swaprate );
|
|
||||||
printf("\n");
|
|
||||||
|
|
||||||
printf("Average number of vertices per begin/end: %8.3f\n", avgvertices );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
/***** GL Visual allocation/destruction *****/
|
/***** GL Visual allocation/destruction *****/
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
|
@ -286,7 +128,48 @@ _mesa_create_visual( GLboolean rgbFlag,
|
||||||
GLint accumAlphaBits,
|
GLint accumAlphaBits,
|
||||||
GLint numSamples )
|
GLint numSamples )
|
||||||
{
|
{
|
||||||
GLvisual *vis;
|
GLvisual *vis = (GLvisual *) CALLOC( sizeof(GLvisual) );
|
||||||
|
if (vis) {
|
||||||
|
if (!_mesa_initialize_visual(vis, rgbFlag, alphaFlag, dbFlag, stereoFlag,
|
||||||
|
redBits, greenBits, blueBits, alphaBits,
|
||||||
|
indexBits, depthBits, stencilBits,
|
||||||
|
accumRedBits, accumGreenBits,
|
||||||
|
accumBlueBits, accumAlphaBits,
|
||||||
|
numSamples )) {
|
||||||
|
FREE(vis);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return vis;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize the fields of the given GLvisual.
|
||||||
|
* Input: see _mesa_create_visual() above.
|
||||||
|
* Return: GL_TRUE = success
|
||||||
|
* GL_FALSE = failure.
|
||||||
|
*/
|
||||||
|
GLboolean
|
||||||
|
_mesa_initialize_visual( GLvisual *vis,
|
||||||
|
GLboolean rgbFlag,
|
||||||
|
GLboolean alphaFlag,
|
||||||
|
GLboolean dbFlag,
|
||||||
|
GLboolean stereoFlag,
|
||||||
|
GLint redBits,
|
||||||
|
GLint greenBits,
|
||||||
|
GLint blueBits,
|
||||||
|
GLint alphaBits,
|
||||||
|
GLint indexBits,
|
||||||
|
GLint depthBits,
|
||||||
|
GLint stencilBits,
|
||||||
|
GLint accumRedBits,
|
||||||
|
GLint accumGreenBits,
|
||||||
|
GLint accumBlueBits,
|
||||||
|
GLint accumAlphaBits,
|
||||||
|
GLint numSamples )
|
||||||
|
{
|
||||||
|
assert(vis);
|
||||||
|
|
||||||
/* This is to catch bad values from device drivers not updated for
|
/* This is to catch bad values from device drivers not updated for
|
||||||
* Mesa 3.3. Some device drivers just passed 1. That's a REALLY
|
* Mesa 3.3. Some device drivers just passed 1. That's a REALLY
|
||||||
|
@ -295,27 +178,22 @@ _mesa_create_visual( GLboolean rgbFlag,
|
||||||
assert(depthBits == 0 || depthBits > 1);
|
assert(depthBits == 0 || depthBits > 1);
|
||||||
|
|
||||||
if (depthBits < 0 || depthBits > 32) {
|
if (depthBits < 0 || depthBits > 32) {
|
||||||
return NULL;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
if (stencilBits < 0 || stencilBits > (GLint) (8 * sizeof(GLstencil))) {
|
if (stencilBits < 0 || stencilBits > (GLint) (8 * sizeof(GLstencil))) {
|
||||||
return NULL;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
if (accumRedBits < 0 || accumRedBits > (GLint) (8 * sizeof(GLaccum))) {
|
if (accumRedBits < 0 || accumRedBits > (GLint) (8 * sizeof(GLaccum))) {
|
||||||
return NULL;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
if (accumGreenBits < 0 || accumGreenBits > (GLint) (8 * sizeof(GLaccum))) {
|
if (accumGreenBits < 0 || accumGreenBits > (GLint) (8 * sizeof(GLaccum))) {
|
||||||
return NULL;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
if (accumBlueBits < 0 || accumBlueBits > (GLint) (8 * sizeof(GLaccum))) {
|
if (accumBlueBits < 0 || accumBlueBits > (GLint) (8 * sizeof(GLaccum))) {
|
||||||
return NULL;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
if (accumAlphaBits < 0 || accumAlphaBits > (GLint) (8 * sizeof(GLaccum))) {
|
if (accumAlphaBits < 0 || accumAlphaBits > (GLint) (8 * sizeof(GLaccum))) {
|
||||||
return NULL;
|
return GL_FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
vis = (GLvisual *) CALLOC( sizeof(GLvisual) );
|
|
||||||
if (!vis) {
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vis->RGBAflag = rgbFlag;
|
vis->RGBAflag = rgbFlag;
|
||||||
|
@ -348,23 +226,24 @@ _mesa_create_visual( GLboolean rgbFlag,
|
||||||
vis->DepthMaxF = (GLfloat) vis->DepthMax;
|
vis->DepthMaxF = (GLfloat) vis->DepthMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
return vis;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* This function should no longer be used. Use _mesa_create_visual() instead */
|
/* This function should no longer be used. Use _mesa_create_visual() instead */
|
||||||
GLvisual *gl_create_visual( GLboolean rgbFlag,
|
GLvisual *
|
||||||
GLboolean alphaFlag,
|
gl_create_visual( GLboolean rgbFlag,
|
||||||
GLboolean dbFlag,
|
GLboolean alphaFlag,
|
||||||
GLboolean stereoFlag,
|
GLboolean dbFlag,
|
||||||
GLint depthBits,
|
GLboolean stereoFlag,
|
||||||
GLint stencilBits,
|
GLint depthBits,
|
||||||
GLint accumBits,
|
GLint stencilBits,
|
||||||
GLint indexBits,
|
GLint accumBits,
|
||||||
GLint redBits,
|
GLint indexBits,
|
||||||
GLint greenBits,
|
GLint redBits,
|
||||||
GLint blueBits,
|
GLint greenBits,
|
||||||
GLint alphaBits )
|
GLint blueBits,
|
||||||
|
GLint alphaBits )
|
||||||
{
|
{
|
||||||
return _mesa_create_visual(rgbFlag, alphaFlag, dbFlag, stereoFlag,
|
return _mesa_create_visual(rgbFlag, alphaFlag, dbFlag, stereoFlag,
|
||||||
redBits, greenBits, blueBits, alphaBits,
|
redBits, greenBits, blueBits, alphaBits,
|
||||||
|
@ -381,7 +260,8 @@ _mesa_destroy_visual( GLvisual *vis )
|
||||||
|
|
||||||
|
|
||||||
/* obsolete */
|
/* obsolete */
|
||||||
void gl_destroy_visual( GLvisual *vis )
|
void
|
||||||
|
gl_destroy_visual( GLvisual *vis )
|
||||||
{
|
{
|
||||||
_mesa_destroy_visual(vis);
|
_mesa_destroy_visual(vis);
|
||||||
}
|
}
|
||||||
|
@ -405,18 +285,38 @@ void gl_destroy_visual( GLvisual *vis )
|
||||||
|
|
||||||
* Return: pointer to new GLframebuffer struct or NULL if error.
|
* Return: pointer to new GLframebuffer struct or NULL if error.
|
||||||
*/
|
*/
|
||||||
GLframebuffer *gl_create_framebuffer( GLvisual *visual,
|
GLframebuffer *
|
||||||
GLboolean softwareDepth,
|
gl_create_framebuffer( GLvisual *visual,
|
||||||
GLboolean softwareStencil,
|
GLboolean softwareDepth,
|
||||||
GLboolean softwareAccum,
|
GLboolean softwareStencil,
|
||||||
GLboolean softwareAlpha )
|
GLboolean softwareAccum,
|
||||||
|
GLboolean softwareAlpha )
|
||||||
{
|
{
|
||||||
GLframebuffer *buffer;
|
GLframebuffer *buffer = CALLOC_STRUCT(gl_frame_buffer);
|
||||||
|
assert(visual);
|
||||||
buffer = CALLOC_STRUCT(gl_frame_buffer);
|
if (buffer) {
|
||||||
if (!buffer) {
|
_mesa_initialize_framebuffer(buffer, visual,
|
||||||
return NULL;
|
softwareDepth, softwareStencil,
|
||||||
|
softwareAccum, softwareAlpha );
|
||||||
}
|
}
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize a GLframebuffer object.
|
||||||
|
* Input: See gl_create_framebuffer() above.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
_mesa_initialize_framebuffer( GLframebuffer *buffer,
|
||||||
|
GLvisual *visual,
|
||||||
|
GLboolean softwareDepth,
|
||||||
|
GLboolean softwareStencil,
|
||||||
|
GLboolean softwareAccum,
|
||||||
|
GLboolean softwareAlpha )
|
||||||
|
{
|
||||||
|
assert(buffer);
|
||||||
|
assert(visual);
|
||||||
|
|
||||||
/* sanity checks */
|
/* sanity checks */
|
||||||
if (softwareDepth ) {
|
if (softwareDepth ) {
|
||||||
|
@ -441,16 +341,14 @@ GLframebuffer *gl_create_framebuffer( GLvisual *visual,
|
||||||
buffer->UseSoftwareStencilBuffer = softwareStencil;
|
buffer->UseSoftwareStencilBuffer = softwareStencil;
|
||||||
buffer->UseSoftwareAccumBuffer = softwareAccum;
|
buffer->UseSoftwareAccumBuffer = softwareAccum;
|
||||||
buffer->UseSoftwareAlphaBuffers = softwareAlpha;
|
buffer->UseSoftwareAlphaBuffers = softwareAlpha;
|
||||||
|
|
||||||
return buffer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Free a framebuffer struct and its buffers.
|
* Free a framebuffer struct and its buffers.
|
||||||
*/
|
*/
|
||||||
void gl_destroy_framebuffer( GLframebuffer *buffer )
|
void
|
||||||
|
gl_destroy_framebuffer( GLframebuffer *buffer )
|
||||||
{
|
{
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
if (buffer->DepthBuffer) {
|
if (buffer->DepthBuffer) {
|
||||||
|
@ -491,7 +389,8 @@ _glthread_DECLARE_STATIC_MUTEX(OneTimeLock);
|
||||||
/*
|
/*
|
||||||
* This function just calls all the various one-time-init functions in Mesa.
|
* This function just calls all the various one-time-init functions in Mesa.
|
||||||
*/
|
*/
|
||||||
static void one_time_init( void )
|
static void
|
||||||
|
one_time_init( void )
|
||||||
{
|
{
|
||||||
static GLboolean alreadyCalled = GL_FALSE;
|
static GLboolean alreadyCalled = GL_FALSE;
|
||||||
_glthread_LOCK_MUTEX(OneTimeLock);
|
_glthread_LOCK_MUTEX(OneTimeLock);
|
||||||
|
@ -538,7 +437,8 @@ static void one_time_init( void )
|
||||||
/*
|
/*
|
||||||
* Allocate and initialize a shared context state structure.
|
* Allocate and initialize a shared context state structure.
|
||||||
*/
|
*/
|
||||||
static struct gl_shared_state *alloc_shared_state( void )
|
static struct gl_shared_state *
|
||||||
|
alloc_shared_state( void )
|
||||||
{
|
{
|
||||||
GLuint d;
|
GLuint d;
|
||||||
struct gl_shared_state *ss;
|
struct gl_shared_state *ss;
|
||||||
|
@ -587,7 +487,8 @@ static struct gl_shared_state *alloc_shared_state( void )
|
||||||
/*
|
/*
|
||||||
* Deallocate a shared state context and all children structures.
|
* Deallocate a shared state context and all children structures.
|
||||||
*/
|
*/
|
||||||
static void free_shared_state( GLcontext *ctx, struct gl_shared_state *ss )
|
static void
|
||||||
|
free_shared_state( GLcontext *ctx, struct gl_shared_state *ss )
|
||||||
{
|
{
|
||||||
/* Free display lists */
|
/* Free display lists */
|
||||||
while (1) {
|
while (1) {
|
||||||
|
@ -620,7 +521,8 @@ static void free_shared_state( GLcontext *ctx, struct gl_shared_state *ss )
|
||||||
* Initialize the nth light. Note that the defaults for light 0 are
|
* Initialize the nth light. Note that the defaults for light 0 are
|
||||||
* different than the other lights.
|
* different than the other lights.
|
||||||
*/
|
*/
|
||||||
static void init_light( struct gl_light *l, GLuint n )
|
static void
|
||||||
|
init_light( struct gl_light *l, GLuint n )
|
||||||
{
|
{
|
||||||
make_empty_list( l );
|
make_empty_list( l );
|
||||||
|
|
||||||
|
@ -647,7 +549,8 @@ static void init_light( struct gl_light *l, GLuint n )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void init_lightmodel( struct gl_lightmodel *lm )
|
static void
|
||||||
|
init_lightmodel( struct gl_lightmodel *lm )
|
||||||
{
|
{
|
||||||
ASSIGN_4V( lm->Ambient, 0.2, 0.2, 0.2, 1.0 );
|
ASSIGN_4V( lm->Ambient, 0.2, 0.2, 0.2, 1.0 );
|
||||||
lm->LocalViewer = GL_FALSE;
|
lm->LocalViewer = GL_FALSE;
|
||||||
|
@ -656,7 +559,8 @@ static void init_lightmodel( struct gl_lightmodel *lm )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void init_material( struct gl_material *m )
|
static void
|
||||||
|
init_material( struct gl_material *m )
|
||||||
{
|
{
|
||||||
ASSIGN_4V( m->Ambient, 0.2, 0.2, 0.2, 1.0 );
|
ASSIGN_4V( m->Ambient, 0.2, 0.2, 0.2, 1.0 );
|
||||||
ASSIGN_4V( m->Diffuse, 0.8, 0.8, 0.8, 1.0 );
|
ASSIGN_4V( m->Diffuse, 0.8, 0.8, 0.8, 1.0 );
|
||||||
|
@ -670,7 +574,8 @@ static void init_material( struct gl_material *m )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void init_texture_unit( GLcontext *ctx, GLuint unit )
|
static void
|
||||||
|
init_texture_unit( GLcontext *ctx, GLuint unit )
|
||||||
{
|
{
|
||||||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
|
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
|
||||||
|
|
||||||
|
@ -697,7 +602,8 @@ static void init_texture_unit( GLcontext *ctx, GLuint unit )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void init_fallback_arrays( GLcontext *ctx )
|
static void
|
||||||
|
init_fallback_arrays( GLcontext *ctx )
|
||||||
{
|
{
|
||||||
struct gl_client_array *cl;
|
struct gl_client_array *cl;
|
||||||
GLuint i;
|
GLuint i;
|
||||||
|
@ -747,7 +653,8 @@ static void init_fallback_arrays( GLcontext *ctx )
|
||||||
|
|
||||||
|
|
||||||
/* Initialize a 1-D evaluator map */
|
/* Initialize a 1-D evaluator map */
|
||||||
static void init_1d_map( struct gl_1d_map *map, int n, const float *initial )
|
static void
|
||||||
|
init_1d_map( struct gl_1d_map *map, int n, const float *initial )
|
||||||
{
|
{
|
||||||
map->Order = 1;
|
map->Order = 1;
|
||||||
map->u1 = 0.0;
|
map->u1 = 0.0;
|
||||||
|
@ -762,7 +669,8 @@ static void init_1d_map( struct gl_1d_map *map, int n, const float *initial )
|
||||||
|
|
||||||
|
|
||||||
/* Initialize a 2-D evaluator map */
|
/* Initialize a 2-D evaluator map */
|
||||||
static void init_2d_map( struct gl_2d_map *map, int n, const float *initial )
|
static void
|
||||||
|
init_2d_map( struct gl_2d_map *map, int n, const float *initial )
|
||||||
{
|
{
|
||||||
map->Uorder = 1;
|
map->Uorder = 1;
|
||||||
map->Vorder = 1;
|
map->Vorder = 1;
|
||||||
|
@ -782,7 +690,8 @@ static void init_2d_map( struct gl_2d_map *map, int n, const float *initial )
|
||||||
/*
|
/*
|
||||||
* Initialize the attribute groups in a GLcontext.
|
* Initialize the attribute groups in a GLcontext.
|
||||||
*/
|
*/
|
||||||
static void init_attrib_groups( GLcontext *ctx )
|
static void
|
||||||
|
init_attrib_groups( GLcontext *ctx )
|
||||||
{
|
{
|
||||||
GLuint i, j;
|
GLuint i, j;
|
||||||
|
|
||||||
|
@ -1355,7 +1264,8 @@ static void init_attrib_groups( GLcontext *ctx )
|
||||||
* the allocations clean up and return GL_FALSE.
|
* the allocations clean up and return GL_FALSE.
|
||||||
* Return: GL_TRUE=success, GL_FALSE=failure
|
* Return: GL_TRUE=success, GL_FALSE=failure
|
||||||
*/
|
*/
|
||||||
static GLboolean alloc_proxy_textures( GLcontext *ctx )
|
static GLboolean
|
||||||
|
alloc_proxy_textures( GLcontext *ctx )
|
||||||
{
|
{
|
||||||
GLboolean out_of_memory;
|
GLboolean out_of_memory;
|
||||||
GLint i;
|
GLint i;
|
||||||
|
@ -1416,11 +1326,12 @@ static GLboolean alloc_proxy_textures( GLcontext *ctx )
|
||||||
/*
|
/*
|
||||||
* Initialize a GLcontext struct.
|
* Initialize a GLcontext struct.
|
||||||
*/
|
*/
|
||||||
GLboolean gl_initialize_context_data( GLcontext *ctx,
|
GLboolean
|
||||||
GLvisual *visual,
|
_mesa_initialize_context( GLcontext *ctx,
|
||||||
GLcontext *share_list,
|
GLvisual *visual,
|
||||||
void *driver_ctx,
|
GLcontext *share_list,
|
||||||
GLboolean direct )
|
void *driver_ctx,
|
||||||
|
GLboolean direct )
|
||||||
{
|
{
|
||||||
(void) direct; /* not used */
|
(void) direct; /* not used */
|
||||||
|
|
||||||
|
@ -1484,10 +1395,6 @@ GLboolean gl_initialize_context_data( GLcontext *ctx,
|
||||||
ctx->Pixel.DriverReadBuffer = GL_FRONT_LEFT;
|
ctx->Pixel.DriverReadBuffer = GL_FRONT_LEFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PROFILE
|
|
||||||
init_timings( ctx );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!alloc_proxy_textures(ctx)) {
|
if (!alloc_proxy_textures(ctx)) {
|
||||||
free_shared_state(ctx, ctx->Shared);
|
free_shared_state(ctx, ctx->Shared);
|
||||||
FREE(ctx->VB);
|
FREE(ctx->VB);
|
||||||
|
@ -1523,18 +1430,18 @@ GLboolean gl_initialize_context_data( GLcontext *ctx,
|
||||||
* driver_ctx - pointer to device driver's context state struct
|
* driver_ctx - pointer to device driver's context state struct
|
||||||
* Return: pointer to a new gl_context struct or NULL if error.
|
* Return: pointer to a new gl_context struct or NULL if error.
|
||||||
*/
|
*/
|
||||||
GLcontext *gl_create_context( GLvisual *visual,
|
GLcontext *
|
||||||
GLcontext *share_list,
|
gl_create_context( GLvisual *visual,
|
||||||
void *driver_ctx,
|
GLcontext *share_list,
|
||||||
GLboolean direct )
|
void *driver_ctx,
|
||||||
|
GLboolean direct )
|
||||||
{
|
{
|
||||||
GLcontext *ctx = (GLcontext *) CALLOC( sizeof(GLcontext) );
|
GLcontext *ctx = (GLcontext *) CALLOC( sizeof(GLcontext) );
|
||||||
if (!ctx) {
|
if (!ctx) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gl_initialize_context_data(ctx, visual, share_list,
|
if (_mesa_initialize_context(ctx, visual, share_list, driver_ctx, direct)) {
|
||||||
driver_ctx, direct)) {
|
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1549,7 +1456,8 @@ GLcontext *gl_create_context( GLvisual *visual,
|
||||||
* Free the data associated with the given context.
|
* Free the data associated with the given context.
|
||||||
* But don't free() the GLcontext struct itself!
|
* But don't free() the GLcontext struct itself!
|
||||||
*/
|
*/
|
||||||
void gl_free_context_data( GLcontext *ctx )
|
void
|
||||||
|
gl_free_context_data( GLcontext *ctx )
|
||||||
{
|
{
|
||||||
struct gl_shine_tab *s, *tmps;
|
struct gl_shine_tab *s, *tmps;
|
||||||
GLuint i, j;
|
GLuint i, j;
|
||||||
|
@ -1559,12 +1467,6 @@ void gl_free_context_data( GLcontext *ctx )
|
||||||
gl_make_current(NULL, NULL);
|
gl_make_current(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PROFILE
|
|
||||||
if (getenv("MESA_PROFILE")) {
|
|
||||||
print_timings( ctx );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gl_matrix_dtr( &ctx->ModelView );
|
gl_matrix_dtr( &ctx->ModelView );
|
||||||
for (i = 0; i < MAX_MODELVIEW_STACK_DEPTH - 1; i++) {
|
for (i = 0; i < MAX_MODELVIEW_STACK_DEPTH - 1; i++) {
|
||||||
gl_matrix_dtr( &ctx->ModelViewStack[i] );
|
gl_matrix_dtr( &ctx->ModelViewStack[i] );
|
||||||
|
@ -1667,7 +1569,8 @@ void gl_free_context_data( GLcontext *ctx )
|
||||||
/*
|
/*
|
||||||
* Destroy a GLcontext structure.
|
* Destroy a GLcontext structure.
|
||||||
*/
|
*/
|
||||||
void gl_destroy_context( GLcontext *ctx )
|
void
|
||||||
|
gl_destroy_context( GLcontext *ctx )
|
||||||
{
|
{
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
gl_free_context_data(ctx);
|
gl_free_context_data(ctx);
|
||||||
|
@ -1681,7 +1584,8 @@ void gl_destroy_context( GLcontext *ctx )
|
||||||
* Called by the driver after both the context and driver are fully
|
* Called by the driver after both the context and driver are fully
|
||||||
* initialized. Currently just reads the config file.
|
* initialized. Currently just reads the config file.
|
||||||
*/
|
*/
|
||||||
void gl_context_initialize( GLcontext *ctx )
|
void
|
||||||
|
gl_context_initialize( GLcontext *ctx )
|
||||||
{
|
{
|
||||||
gl_read_config_file( ctx );
|
gl_read_config_file( ctx );
|
||||||
}
|
}
|
||||||
|
@ -1694,7 +1598,8 @@ void gl_context_initialize( GLcontext *ctx )
|
||||||
* dst - destination context
|
* dst - destination context
|
||||||
* mask - bitwise OR of GL_*_BIT flags
|
* mask - bitwise OR of GL_*_BIT flags
|
||||||
*/
|
*/
|
||||||
void gl_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask )
|
void
|
||||||
|
gl_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask )
|
||||||
{
|
{
|
||||||
if (mask & GL_ACCUM_BUFFER_BIT) {
|
if (mask & GL_ACCUM_BUFFER_BIT) {
|
||||||
MEMCPY( &dst->Accum, &src->Accum, sizeof(struct gl_accum_attrib) );
|
MEMCPY( &dst->Accum, &src->Accum, sizeof(struct gl_accum_attrib) );
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: context.h,v 1.15 2000/03/31 01:05:51 brianp Exp $ */
|
/* $Id: context.h,v 1.16 2000/04/22 01:05:00 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
|
@ -75,19 +75,39 @@ _mesa_create_visual( GLboolean rgbFlag,
|
||||||
GLint accumAlphaBits,
|
GLint accumAlphaBits,
|
||||||
GLint numSamples );
|
GLint numSamples );
|
||||||
|
|
||||||
|
extern GLboolean
|
||||||
|
_mesa_initialize_visual( GLvisual *v,
|
||||||
|
GLboolean rgbFlag,
|
||||||
|
GLboolean alphaFlag,
|
||||||
|
GLboolean dbFlag,
|
||||||
|
GLboolean stereoFlag,
|
||||||
|
GLint redBits,
|
||||||
|
GLint greenBits,
|
||||||
|
GLint blueBits,
|
||||||
|
GLint alphaBits,
|
||||||
|
GLint indexBits,
|
||||||
|
GLint depthBits,
|
||||||
|
GLint stencilBits,
|
||||||
|
GLint accumRedBits,
|
||||||
|
GLint accumGreenBits,
|
||||||
|
GLint accumBlueBits,
|
||||||
|
GLint accumAlphaBits,
|
||||||
|
GLint numSamples );
|
||||||
|
|
||||||
/* this function is obsolete */
|
/* this function is obsolete */
|
||||||
extern GLvisual *gl_create_visual( GLboolean rgbFlag,
|
extern GLvisual *
|
||||||
GLboolean alphaFlag,
|
gl_create_visual( GLboolean rgbFlag,
|
||||||
GLboolean dbFlag,
|
GLboolean alphaFlag,
|
||||||
GLboolean stereoFlag,
|
GLboolean dbFlag,
|
||||||
GLint depthBits,
|
GLboolean stereoFlag,
|
||||||
GLint stencilBits,
|
GLint depthBits,
|
||||||
GLint accumBits,
|
GLint stencilBits,
|
||||||
GLint indexBits,
|
GLint accumBits,
|
||||||
GLint redBits,
|
GLint indexBits,
|
||||||
GLint greenBits,
|
GLint redBits,
|
||||||
GLint blueBits,
|
GLint greenBits,
|
||||||
GLint alphaBits );
|
GLint blueBits,
|
||||||
|
GLint alphaBits );
|
||||||
|
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
|
@ -96,18 +116,29 @@ _mesa_destroy_visual( GLvisual *vis );
|
||||||
/*obsolete */ extern void gl_destroy_visual( GLvisual *vis );
|
/*obsolete */ extern void gl_destroy_visual( GLvisual *vis );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create/destroy a GLframebuffer. A GLframebuffer is like a GLX drawable.
|
* Create/destroy a GLframebuffer. A GLframebuffer is like a GLX drawable.
|
||||||
* It bundles up the depth buffer, stencil buffer and accum buffers into a
|
* It bundles up the depth buffer, stencil buffer and accum buffers into a
|
||||||
* single entity.
|
* single entity.
|
||||||
*/
|
*/
|
||||||
extern GLframebuffer *gl_create_framebuffer( GLvisual *visual,
|
extern GLframebuffer *
|
||||||
GLboolean softwareDepth,
|
gl_create_framebuffer( GLvisual *visual,
|
||||||
GLboolean softwareStencil,
|
GLboolean softwareDepth,
|
||||||
GLboolean softwareAccum,
|
GLboolean softwareStencil,
|
||||||
GLboolean softwareAlpha );
|
GLboolean softwareAccum,
|
||||||
|
GLboolean softwareAlpha );
|
||||||
|
|
||||||
extern void gl_destroy_framebuffer( GLframebuffer *buffer );
|
extern void
|
||||||
|
_mesa_initialize_framebuffer( GLframebuffer *fb,
|
||||||
|
GLvisual *visual,
|
||||||
|
GLboolean softwareDepth,
|
||||||
|
GLboolean softwareStencil,
|
||||||
|
GLboolean softwareAccum,
|
||||||
|
GLboolean softwareAlpha );
|
||||||
|
|
||||||
|
extern void
|
||||||
|
gl_destroy_framebuffer( GLframebuffer *buffer );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -115,36 +146,46 @@ extern void gl_destroy_framebuffer( GLframebuffer *buffer );
|
||||||
* Create/destroy a GLcontext. A GLcontext is like a GLX context. It
|
* Create/destroy a GLcontext. A GLcontext is like a GLX context. It
|
||||||
* contains the rendering state.
|
* contains the rendering state.
|
||||||
*/
|
*/
|
||||||
extern GLcontext *gl_create_context( GLvisual *visual,
|
extern GLcontext *
|
||||||
GLcontext *share_list,
|
gl_create_context( GLvisual *visual,
|
||||||
void *driver_ctx,
|
GLcontext *share_list,
|
||||||
GLboolean direct);
|
void *driver_ctx,
|
||||||
|
GLboolean direct);
|
||||||
|
|
||||||
extern GLboolean gl_initialize_context_data( GLcontext *ctx,
|
extern GLboolean
|
||||||
GLvisual *visual,
|
_mesa_initialize_context( GLcontext *ctx,
|
||||||
GLcontext *share_list,
|
GLvisual *visual,
|
||||||
void *driver_ctx,
|
GLcontext *share_list,
|
||||||
GLboolean direct );
|
void *driver_ctx,
|
||||||
|
GLboolean direct );
|
||||||
|
|
||||||
extern void gl_free_context_data( GLcontext *ctx );
|
extern void
|
||||||
|
gl_free_context_data( GLcontext *ctx );
|
||||||
|
|
||||||
extern void gl_destroy_context( GLcontext *ctx );
|
extern void
|
||||||
|
gl_destroy_context( GLcontext *ctx );
|
||||||
|
|
||||||
|
|
||||||
extern void gl_context_initialize( GLcontext *ctx );
|
extern void
|
||||||
|
gl_context_initialize( GLcontext *ctx );
|
||||||
|
|
||||||
|
|
||||||
extern void gl_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask);
|
extern void
|
||||||
|
gl_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask);
|
||||||
|
|
||||||
|
|
||||||
extern void gl_make_current( GLcontext *ctx, GLframebuffer *buffer );
|
extern void
|
||||||
|
gl_make_current( GLcontext *ctx, GLframebuffer *buffer );
|
||||||
|
|
||||||
|
|
||||||
extern void gl_make_current2( GLcontext *ctx, GLframebuffer *drawBuffer,
|
extern void
|
||||||
GLframebuffer *readBuffer );
|
gl_make_current2( GLcontext *ctx, GLframebuffer *drawBuffer,
|
||||||
|
GLframebuffer *readBuffer );
|
||||||
|
|
||||||
|
|
||||||
extern GLcontext *gl_get_current_context(void);
|
extern GLcontext *
|
||||||
|
gl_get_current_context(void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -192,13 +233,17 @@ _mesa_get_dispatch(GLcontext *ctx);
|
||||||
* Miscellaneous
|
* Miscellaneous
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern void gl_problem( const GLcontext *ctx, const char *s );
|
extern void
|
||||||
|
gl_problem( const GLcontext *ctx, const char *s );
|
||||||
|
|
||||||
extern void gl_warning( const GLcontext *ctx, const char *s );
|
extern void
|
||||||
|
gl_warning( const GLcontext *ctx, const char *s );
|
||||||
|
|
||||||
extern void gl_error( GLcontext *ctx, GLenum error, const char *s );
|
extern void
|
||||||
|
gl_error( GLcontext *ctx, GLenum error, const char *s );
|
||||||
|
|
||||||
extern void gl_compile_error( GLcontext *ctx, GLenum error, const char *s );
|
extern void
|
||||||
|
gl_compile_error( GLcontext *ctx, GLenum error, const char *s );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -217,10 +262,4 @@ extern void
|
||||||
_mesa_init_exec_table(struct _glapi_table *exec);
|
_mesa_init_exec_table(struct _glapi_table *exec);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PROFILE
|
|
||||||
extern GLdouble gl_time( void );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue