Browse Source

Restore more code lost during last big merge.

Rename colortable-related functions.
tags/vtx-0-2-21112003-freeze
Brian Paul 22 years ago
parent
commit
05944c031c

+ 33
- 0
src/mesa/main/arbprogram.c View File

@@ -60,6 +60,39 @@ _mesa_parse_arb_fragment_program(GLcontext *ctx, GLenum target,
}


/*
* Init context's program state
*/
void
_mesa_init_program(GLcontext *ctx)
{
GLuint i;

ctx->Program.ErrorPos = -1;
ctx->Program.ErrorString = _mesa_strdup("");

#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program
ctx->VertexProgram.Enabled = GL_FALSE;
ctx->VertexProgram.PointSizeEnabled = GL_FALSE;
ctx->VertexProgram.TwoSideEnabled = GL_FALSE;
ctx->VertexProgram.Current = NULL;
ctx->VertexProgram.Current = (struct vertex_program *) ctx->Shared->DefaultVertexProgram;
assert(ctx->VertexProgram.Current);
ctx->VertexProgram.Current->Base.RefCount++;
for (i = 0; i < VP_NUM_PROG_REGS / 4; i++) {
ctx->VertexProgram.TrackMatrix[i] = GL_NONE;
ctx->VertexProgram.TrackMatrixTransform[i] = GL_IDENTITY_NV;
}
#endif

#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program
ctx->FragmentProgram.Enabled = GL_FALSE;
ctx->FragmentProgram.Current = (struct fragment_program *) ctx->Shared->DefaultFragmentProgram;
assert(ctx->FragmentProgram.Current);
ctx->FragmentProgram.Current->Base.RefCount++;
#endif
}


void
_mesa_EnableVertexAttribArrayARB(GLuint index)

+ 5
- 0
src/mesa/main/arbprogram.h View File

@@ -26,6 +26,11 @@
#ifndef ARBPROGRAM_H
#define ARBPROGRAM_H

#include "mtypes.h"

extern void
_mesa_init_program(GLcontext *ctx);


extern void
_mesa_EnableVertexAttribArrayARB(GLuint index);

+ 24
- 16
src/mesa/main/colortab.c View File

@@ -1332,7 +1332,7 @@ _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params )


void
_mesa_init_one_colortable( struct gl_color_table *p )
_mesa_init_colortable( struct gl_color_table *p )
{
p->FloatTable = GL_FALSE;
p->Table = NULL;
@@ -1343,7 +1343,7 @@ _mesa_init_one_colortable( struct gl_color_table *p )


void
_mesa_free_one_colortable( struct gl_color_table *p )
_mesa_free_colortable_data( struct gl_color_table *p )
{
if (p->Table) {
FREE(p->Table);
@@ -1351,23 +1351,31 @@ _mesa_free_one_colortable( struct gl_color_table *p )
}
}

void _mesa_init_colortable( GLcontext * ctx )

/*
* Initialize all colortables for a context.
*/
void _mesa_init_colortables( GLcontext * ctx )
{
/* Color tables */
_mesa_init_one_colortable(&ctx->ColorTable);
_mesa_init_one_colortable(&ctx->ProxyColorTable);
_mesa_init_one_colortable(&ctx->PostConvolutionColorTable);
_mesa_init_one_colortable(&ctx->ProxyPostConvolutionColorTable);
_mesa_init_one_colortable(&ctx->PostColorMatrixColorTable);
_mesa_init_one_colortable(&ctx->ProxyPostColorMatrixColorTable);
_mesa_init_colortable(&ctx->ColorTable);
_mesa_init_colortable(&ctx->ProxyColorTable);
_mesa_init_colortable(&ctx->PostConvolutionColorTable);
_mesa_init_colortable(&ctx->ProxyPostConvolutionColorTable);
_mesa_init_colortable(&ctx->PostColorMatrixColorTable);
_mesa_init_colortable(&ctx->ProxyPostColorMatrixColorTable);
}

void _mesa_free_colortable_data( GLcontext *ctx )

/*
* Free all colortable data for a context
*/
void _mesa_free_colortables_data( GLcontext *ctx )
{
_mesa_free_one_colortable( &ctx->ColorTable );
_mesa_free_one_colortable( &ctx->ProxyColorTable );
_mesa_free_one_colortable( &ctx->PostConvolutionColorTable );
_mesa_free_one_colortable( &ctx->ProxyPostConvolutionColorTable );
_mesa_free_one_colortable( &ctx->PostColorMatrixColorTable );
_mesa_free_one_colortable( &ctx->ProxyPostColorMatrixColorTable );
_mesa_free_colortable_data(&ctx->ColorTable);
_mesa_free_colortable_data(&ctx->ProxyColorTable);
_mesa_free_colortable_data(&ctx->PostConvolutionColorTable);
_mesa_free_colortable_data(&ctx->ProxyPostConvolutionColorTable);
_mesa_free_colortable_data(&ctx->PostColorMatrixColorTable);
_mesa_free_colortable_data(&ctx->ProxyPostColorMatrixColorTable);
}

+ 14
- 9
src/mesa/main/colortab.h View File

@@ -77,28 +77,33 @@ _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params );
extern void
_mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params );

extern void
_mesa_init_colortable( GLcontext * ctx );

extern void
_mesa_free_colortable_data( GLcontext * ctx );

extern void
_mesa_free_one_colortable( struct gl_color_table *p );
_mesa_init_colortable( struct gl_color_table *table );

extern void
_mesa_init_one_colortable( struct gl_color_table *p );
_mesa_free_colortable_data( struct gl_color_table *table );

extern void
_mesa_init_colortables( GLcontext *ctx );

extern void
_mesa_free_colortables_data( GLcontext *ctx );

#else

/** No-op */
#define _mesa_init_one_colortable( p ) ((void)0)
#define _mesa_init_colortable( p ) ((void) 0)

/** No-op */
#define _mesa_free_colortable_data( p ) ((void) 0)

/** No-op */
#define _mesa_init_colortable( p ) ((void)0)
#define _mesa_init_colortables( p ) ((void)0)

/** No-op */
#define _mesa_free_colortable_data( p ) ((void)0)
#define _mesa_free_colortables_data( p ) ((void)0)

#endif


+ 6
- 3
src/mesa/main/context.c View File

@@ -74,6 +74,7 @@
#include "glheader.h"
#include "imports.h"
#include "accum.h"
#include "arbprogram.h"
#include "attrib.h"
#include "blend.h"
#include "buffers.h"
@@ -97,6 +98,7 @@
#include "lines.h"
#include "macros.h"
#include "matrix.h"
#include "occlude.h"
#include "pixel.h"
#include "points.h"
#include "polygon.h"
@@ -1089,7 +1091,7 @@ init_attrib_groups( GLcontext *ctx )
_mesa_init_attrib( ctx );
_mesa_init_buffers( ctx );
_mesa_init_color( ctx );
_mesa_init_colortable( ctx );
_mesa_init_colortables( ctx );
_mesa_init_current( ctx );
_mesa_init_depth( ctx );
_mesa_init_debug( ctx );
@@ -1102,10 +1104,11 @@ init_attrib_groups( GLcontext *ctx )
_mesa_init_line( ctx );
_mesa_init_lighting( ctx );
_mesa_init_matrix( ctx );
_mesa_init_occlude( ctx );
_mesa_init_pixel( ctx );
_mesa_init_point( ctx );
_mesa_init_polygon( ctx );
/* XXX _mesa_init_program( ctx ); */
_mesa_init_program( ctx );
_mesa_init_rastpos( ctx );
_mesa_init_stencil( ctx );
_mesa_init_transform( ctx );
@@ -1473,7 +1476,7 @@ _mesa_free_context_data( GLcontext *ctx )
_mesa_free_texture_data( ctx );
_mesa_free_matrix_data( ctx );
_mesa_free_viewport_data( ctx );
_mesa_free_colortable_data( ctx );
_mesa_free_colortables_data( ctx );
#if FEATURE_NV_vertex_program
if (ctx->VertexProgram.Current) {
ctx->VertexProgram.Current->Base.RefCount--;

+ 14
- 0
src/mesa/main/occlude.c View File

@@ -53,6 +53,20 @@ struct occlusion_query
};



void
_mesa_init_occlude(GLcontext *ctx)
{
#if FEATURE_ARB_occlusion_query
ctx->Occlusion.QueryObjects = _mesa_NewHashTable();
#endif

ctx->OcclusionResult = GL_FALSE;
ctx->OcclusionResultSaved = GL_FALSE;
}



/**
* Allocate a new occlusion query object.
* \param target - must be GL_SAMPLES_PASSED_ARB at this time

+ 3
- 0
src/mesa/main/occlude.h View File

@@ -27,6 +27,9 @@
#define OCCLUDE_H


extern void
_mesa_init_occlude(GLcontext *ctx);

extern void
_mesa_GenQueriesARB(GLsizei n, GLuint *ids);


+ 2
- 2
src/mesa/main/texobj.c View File

@@ -123,7 +123,7 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj,
obj->CompareFunc = GL_LEQUAL; /* ARB_shadow */
obj->DepthMode = GL_LUMINANCE; /* ARB_depth_texture */
obj->ShadowAmbient = 0.0F; /* ARB/SGIX_shadow_ambient */
_mesa_init_one_colortable(&obj->Palette);
_mesa_init_colortable(&obj->Palette);
}


@@ -147,7 +147,7 @@ _mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *texObj )

assert(texObj);

_mesa_free_one_colortable(&texObj->Palette);
_mesa_free_colortable_data(&texObj->Palette);

/* free the texture images */
for (i = 0; i < MAX_TEXTURE_LEVELS; i++) {

+ 2
- 2
src/mesa/main/texstate.c View File

@@ -2966,7 +2966,7 @@ GLboolean _mesa_init_texture( GLcontext * ctx )
for (i=0; i<MAX_TEXTURE_UNITS; i++)
init_texture_unit( ctx, i );
ctx->Texture.SharedPalette = GL_FALSE;
_mesa_init_one_colortable(&ctx->Texture.Palette);
_mesa_init_colortable(&ctx->Texture.Palette);

/* Allocate proxy textures */
if (!alloc_proxy_textures( ctx ))
@@ -2987,5 +2987,5 @@ void _mesa_free_texture_data( GLcontext *ctx )
(ctx->Driver.DeleteTexture)(ctx, ctx->Texture.ProxyRect );

for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++)
_mesa_free_one_colortable( &ctx->Texture.Unit[i].ColorTable );
_mesa_free_colortable_data( &ctx->Texture.Unit[i].ColorTable );
}

Loading…
Cancel
Save