st/mesa: s/varient/variant

This commit is contained in:
Brian Paul
2010-12-16 08:43:21 -07:00
parent c52adfc2e1
commit aa5ba96d29
10 changed files with 168 additions and 168 deletions

View File

@@ -74,7 +74,7 @@ static void
update_fp( struct st_context *st ) update_fp( struct st_context *st )
{ {
struct st_fragment_program *stfp; struct st_fragment_program *stfp;
struct st_fp_varient_key key; struct st_fp_variant_key key;
assert(st->ctx->FragmentProgram._Current); assert(st->ctx->FragmentProgram._Current);
stfp = st_fragment_program(st->ctx->FragmentProgram._Current); stfp = st_fragment_program(st->ctx->FragmentProgram._Current);
@@ -83,7 +83,7 @@ update_fp( struct st_context *st )
memset(&key, 0, sizeof(key)); memset(&key, 0, sizeof(key));
key.st = st; key.st = st;
st->fp_varient = st_get_fp_varient(st, stfp, &key); st->fp_variant = st_get_fp_variant(st, stfp, &key);
st_reference_fragprog(st, &st->fp, stfp); st_reference_fragprog(st, &st->fp, stfp);
@@ -94,7 +94,7 @@ update_fp( struct st_context *st )
} }
else { else {
cso_set_fragment_shader_handle(st->cso_context, cso_set_fragment_shader_handle(st->cso_context,
st->fp_varient->driver_shader); st->fp_variant->driver_shader);
} }
} }
@@ -118,7 +118,7 @@ static void
update_vp( struct st_context *st ) update_vp( struct st_context *st )
{ {
struct st_vertex_program *stvp; struct st_vertex_program *stvp;
struct st_vp_varient_key key; struct st_vp_variant_key key;
/* find active shader and params -- Should be covered by /* find active shader and params -- Should be covered by
* ST_NEW_VERTEX_PROGRAM * ST_NEW_VERTEX_PROGRAM
@@ -141,12 +141,12 @@ update_vp( struct st_context *st )
st->ctx->Polygon.FrontMode != GL_FILL || st->ctx->Polygon.FrontMode != GL_FILL ||
st->ctx->Polygon.BackMode != GL_FILL)); st->ctx->Polygon.BackMode != GL_FILL));
st->vp_varient = st_get_vp_varient(st, stvp, &key); st->vp_variant = st_get_vp_variant(st, stvp, &key);
st_reference_vertprog(st, &st->vp, stvp); st_reference_vertprog(st, &st->vp, stvp);
cso_set_vertex_shader_handle(st->cso_context, cso_set_vertex_shader_handle(st->cso_context,
st->vp_varient->driver_shader); st->vp_variant->driver_shader);
st->vertex_result_to_slot = stvp->result_to_output; st->vertex_result_to_slot = stvp->result_to_output;
} }
@@ -167,7 +167,7 @@ static void
update_gp( struct st_context *st ) update_gp( struct st_context *st )
{ {
struct st_geometry_program *stgp; struct st_geometry_program *stgp;
struct st_gp_varient_key key; struct st_gp_variant_key key;
if (!st->ctx->GeometryProgram._Current) { if (!st->ctx->GeometryProgram._Current) {
cso_set_geometry_shader_handle(st->cso_context, NULL); cso_set_geometry_shader_handle(st->cso_context, NULL);
@@ -180,12 +180,12 @@ update_gp( struct st_context *st )
memset(&key, 0, sizeof(key)); memset(&key, 0, sizeof(key));
key.st = st; key.st = st;
st->gp_varient = st_get_gp_varient(st, stgp, &key); st->gp_variant = st_get_gp_variant(st, stgp, &key);
st_reference_geomprog(st, &st->gp, stgp); st_reference_geomprog(st, &st->gp, stgp);
cso_set_geometry_shader_handle(st->cso_context, cso_set_geometry_shader_handle(st->cso_context,
st->gp_varient->driver_shader); st->gp_variant->driver_shader);
} }
const struct st_tracked_state st_update_gp = { const struct st_tracked_state st_update_gp = {

View File

@@ -412,8 +412,8 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
struct st_context *st = st_context(ctx); struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe; struct pipe_context *pipe = st->pipe;
struct cso_context *cso = st->cso_context; struct cso_context *cso = st->cso_context;
struct st_fp_varient *fpv; struct st_fp_variant *fpv;
struct st_fp_varient_key key; struct st_fp_variant_key key;
GLuint maxSize; GLuint maxSize;
GLuint offset; GLuint offset;
@@ -421,7 +421,7 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
key.st = st; key.st = st;
key.bitmap = GL_TRUE; key.bitmap = GL_TRUE;
fpv = st_get_fp_varient(st, st->fp, &key); fpv = st_get_fp_variant(st, st->fp, &key);
/* As an optimization, Mesa's fragment programs will sometimes get the /* As an optimization, Mesa's fragment programs will sometimes get the
* primary color from a statevar/constant rather than a varying variable. * primary color from a statevar/constant rather than a varying variable.

View File

@@ -846,12 +846,12 @@ draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
* Get fragment program variant for a glDrawPixels or glCopyPixels * Get fragment program variant for a glDrawPixels or glCopyPixels
* command for RGBA data. * command for RGBA data.
*/ */
static struct st_fp_varient * static struct st_fp_variant *
get_color_fp_varient(struct st_context *st) get_color_fp_variant(struct st_context *st)
{ {
struct gl_context *ctx = st->ctx; struct gl_context *ctx = st->ctx;
struct st_fp_varient_key key; struct st_fp_variant_key key;
struct st_fp_varient *fpv; struct st_fp_variant *fpv;
memset(&key, 0, sizeof(key)); memset(&key, 0, sizeof(key));
@@ -867,7 +867,7 @@ get_color_fp_varient(struct st_context *st)
ctx->Pixel.AlphaScale != 1.0); ctx->Pixel.AlphaScale != 1.0);
key.pixelMaps = ctx->Pixel.MapColorFlag; key.pixelMaps = ctx->Pixel.MapColorFlag;
fpv = st_get_fp_varient(st, st->fp, &key); fpv = st_get_fp_variant(st, st->fp, &key);
return fpv; return fpv;
} }
@@ -877,12 +877,12 @@ get_color_fp_varient(struct st_context *st)
* Get fragment program variant for a glDrawPixels or glCopyPixels * Get fragment program variant for a glDrawPixels or glCopyPixels
* command for depth/stencil data. * command for depth/stencil data.
*/ */
static struct st_fp_varient * static struct st_fp_variant *
get_depth_stencil_fp_varient(struct st_context *st, GLboolean write_depth, get_depth_stencil_fp_variant(struct st_context *st, GLboolean write_depth,
GLboolean write_stencil) GLboolean write_stencil)
{ {
struct st_fp_varient_key key; struct st_fp_variant_key key;
struct st_fp_varient *fpv; struct st_fp_variant *fpv;
memset(&key, 0, sizeof(key)); memset(&key, 0, sizeof(key));
@@ -891,7 +891,7 @@ get_depth_stencil_fp_varient(struct st_context *st, GLboolean write_depth,
key.drawpixels_z = write_depth; key.drawpixels_z = write_depth;
key.drawpixels_stencil = write_stencil; key.drawpixels_stencil = write_stencil;
fpv = st_get_fp_varient(st, st->fp, &key); fpv = st_get_fp_variant(st, st->fp, &key);
return fpv; return fpv;
} }
@@ -914,7 +914,7 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
struct pipe_sampler_view *sv[2]; struct pipe_sampler_view *sv[2];
int num_sampler_view = 1; int num_sampler_view = 1;
enum pipe_format stencil_format = PIPE_FORMAT_NONE; enum pipe_format stencil_format = PIPE_FORMAT_NONE;
struct st_fp_varient *fpv; struct st_fp_variant *fpv;
if (format == GL_DEPTH_STENCIL) if (format == GL_DEPTH_STENCIL)
write_stencil = write_depth = GL_TRUE; write_stencil = write_depth = GL_TRUE;
@@ -951,7 +951,7 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
* Get vertex/fragment shaders * Get vertex/fragment shaders
*/ */
if (write_depth || write_stencil) { if (write_depth || write_stencil) {
fpv = get_depth_stencil_fp_varient(st, write_depth, write_stencil); fpv = get_depth_stencil_fp_variant(st, write_depth, write_stencil);
driver_fp = fpv->driver_shader; driver_fp = fpv->driver_shader;
@@ -960,7 +960,7 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
color = ctx->Current.RasterColor; color = ctx->Current.RasterColor;
} }
else { else {
fpv = get_color_fp_varient(st); fpv = get_color_fp_variant(st);
driver_fp = fpv->driver_shader; driver_fp = fpv->driver_shader;
@@ -1156,7 +1156,7 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
GLint readX, readY, readW, readH; GLint readX, readY, readW, readH;
GLuint sample_count; GLuint sample_count;
struct gl_pixelstore_attrib pack = ctx->DefaultPacking; struct gl_pixelstore_attrib pack = ctx->DefaultPacking;
struct st_fp_varient *fpv; struct st_fp_variant *fpv;
st_validate_state(st); st_validate_state(st);
@@ -1173,7 +1173,7 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
rbRead = st_get_color_read_renderbuffer(ctx); rbRead = st_get_color_read_renderbuffer(ctx);
color = NULL; color = NULL;
fpv = get_color_fp_varient(st); fpv = get_color_fp_variant(st);
driver_fp = fpv->driver_shader; driver_fp = fpv->driver_shader;
driver_vp = make_passthrough_vertex_shader(st, GL_FALSE); driver_vp = make_passthrough_vertex_shader(st, GL_FALSE);
@@ -1188,7 +1188,7 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
rbRead = st_renderbuffer(ctx->ReadBuffer->_DepthBuffer); rbRead = st_renderbuffer(ctx->ReadBuffer->_DepthBuffer);
color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
fpv = get_depth_stencil_fp_varient(st, GL_TRUE, GL_FALSE); fpv = get_depth_stencil_fp_variant(st, GL_TRUE, GL_FALSE);
driver_fp = fpv->driver_shader; driver_fp = fpv->driver_shader;
driver_vp = make_passthrough_vertex_shader(st, GL_TRUE); driver_vp = make_passthrough_vertex_shader(st, GL_TRUE);

View File

@@ -128,7 +128,7 @@ st_delete_program(struct gl_context *ctx, struct gl_program *prog)
case GL_VERTEX_PROGRAM_ARB: case GL_VERTEX_PROGRAM_ARB:
{ {
struct st_vertex_program *stvp = (struct st_vertex_program *) prog; struct st_vertex_program *stvp = (struct st_vertex_program *) prog;
st_release_vp_varients( st, stvp ); st_release_vp_variants( st, stvp );
} }
break; break;
case MESA_GEOMETRY_PROGRAM: case MESA_GEOMETRY_PROGRAM:
@@ -136,7 +136,7 @@ st_delete_program(struct gl_context *ctx, struct gl_program *prog)
struct st_geometry_program *stgp = struct st_geometry_program *stgp =
(struct st_geometry_program *) prog; (struct st_geometry_program *) prog;
st_release_gp_varients(st, stgp); st_release_gp_variants(st, stgp);
if (stgp->tgsi.tokens) { if (stgp->tgsi.tokens) {
st_free_tokens((void *) stgp->tgsi.tokens); st_free_tokens((void *) stgp->tgsi.tokens);
@@ -149,7 +149,7 @@ st_delete_program(struct gl_context *ctx, struct gl_program *prog)
struct st_fragment_program *stfp = struct st_fragment_program *stfp =
(struct st_fragment_program *) prog; (struct st_fragment_program *) prog;
st_release_fp_varients(st, stfp); st_release_fp_variants(st, stfp);
if (stfp->tgsi.tokens) { if (stfp->tgsi.tokens) {
st_free_tokens(stfp->tgsi.tokens); st_free_tokens(stfp->tgsi.tokens);
@@ -181,7 +181,7 @@ st_is_program_native(struct gl_context *ctx,
/** /**
* Called via ctx->Driver.ProgramStringNotify() * Called via ctx->Driver.ProgramStringNotify()
* Called when the program's text/code is changed. We have to free * Called when the program's text/code is changed. We have to free
* all shader varients and corresponding gallium shaders when this happens. * all shader variants and corresponding gallium shaders when this happens.
*/ */
static GLboolean static GLboolean
st_program_string_notify( struct gl_context *ctx, st_program_string_notify( struct gl_context *ctx,
@@ -193,7 +193,7 @@ st_program_string_notify( struct gl_context *ctx,
if (target == GL_FRAGMENT_PROGRAM_ARB) { if (target == GL_FRAGMENT_PROGRAM_ARB) {
struct st_fragment_program *stfp = (struct st_fragment_program *) prog; struct st_fragment_program *stfp = (struct st_fragment_program *) prog;
st_release_fp_varients(st, stfp); st_release_fp_variants(st, stfp);
if (stfp->tgsi.tokens) { if (stfp->tgsi.tokens) {
st_free_tokens(stfp->tgsi.tokens); st_free_tokens(stfp->tgsi.tokens);
@@ -206,7 +206,7 @@ st_program_string_notify( struct gl_context *ctx,
else if (target == MESA_GEOMETRY_PROGRAM) { else if (target == MESA_GEOMETRY_PROGRAM) {
struct st_geometry_program *stgp = (struct st_geometry_program *) prog; struct st_geometry_program *stgp = (struct st_geometry_program *) prog;
st_release_gp_varients(st, stgp); st_release_gp_variants(st, stgp);
if (stgp->tgsi.tokens) { if (stgp->tgsi.tokens) {
st_free_tokens((void *) stgp->tgsi.tokens); st_free_tokens((void *) stgp->tgsi.tokens);
@@ -219,7 +219,7 @@ st_program_string_notify( struct gl_context *ctx,
else if (target == GL_VERTEX_PROGRAM_ARB) { else if (target == GL_VERTEX_PROGRAM_ARB) {
struct st_vertex_program *stvp = (struct st_vertex_program *) prog; struct st_vertex_program *stvp = (struct st_vertex_program *) prog;
st_release_vp_varients( st, stvp ); st_release_vp_variants( st, stvp );
if (st->vp == stvp) if (st->vp == stvp)
st->dirty.st |= ST_NEW_VERTEX_PROGRAM; st->dirty.st |= ST_NEW_VERTEX_PROGRAM;

View File

@@ -130,9 +130,9 @@ struct st_context
struct st_fragment_program *fp; /**< Currently bound fragment program */ struct st_fragment_program *fp; /**< Currently bound fragment program */
struct st_geometry_program *gp; /**< Currently bound geometry program */ struct st_geometry_program *gp; /**< Currently bound geometry program */
struct st_vp_varient *vp_varient; struct st_vp_variant *vp_variant;
struct st_fp_varient *fp_varient; struct st_fp_variant *fp_variant;
struct st_gp_varient *gp_varient; struct st_gp_variant *gp_variant;
struct gl_texture_object *default_texture; struct gl_texture_object *default_texture;

View File

@@ -89,8 +89,8 @@ st_print_current(void)
} }
#endif #endif
if (st->vp->varients) if (st->vp->variants)
tgsi_dump( st->vp->varients[0].tgsi.tokens, 0 ); tgsi_dump( st->vp->variants[0].tgsi.tokens, 0 );
if (st->vp->Base.Base.Parameters) if (st->vp->Base.Base.Parameters)
_mesa_print_parameter_list(st->vp->Base.Base.Parameters); _mesa_print_parameter_list(st->vp->Base.Base.Parameters);

View File

@@ -241,7 +241,7 @@ st_pipe_vertex_format(GLenum type, GLuint size, GLenum format,
*/ */
static GLboolean static GLboolean
is_interleaved_arrays(const struct st_vertex_program *vp, is_interleaved_arrays(const struct st_vertex_program *vp,
const struct st_vp_varient *vpv, const struct st_vp_variant *vpv,
const struct gl_client_array **arrays, const struct gl_client_array **arrays,
GLboolean *userSpace) GLboolean *userSpace)
{ {
@@ -297,7 +297,7 @@ is_interleaved_arrays(const struct st_vertex_program *vp,
*/ */
static void static void
get_arrays_bounds(const struct st_vertex_program *vp, get_arrays_bounds(const struct st_vertex_program *vp,
const struct st_vp_varient *vpv, const struct st_vp_variant *vpv,
const struct gl_client_array **arrays, const struct gl_client_array **arrays,
GLuint max_index, GLuint max_index,
const GLubyte **low, const GLubyte **high) const GLubyte **low, const GLubyte **high)
@@ -343,7 +343,7 @@ get_arrays_bounds(const struct st_vertex_program *vp,
static void static void
setup_interleaved_attribs(struct gl_context *ctx, setup_interleaved_attribs(struct gl_context *ctx,
const struct st_vertex_program *vp, const struct st_vertex_program *vp,
const struct st_vp_varient *vpv, const struct st_vp_variant *vpv,
const struct gl_client_array **arrays, const struct gl_client_array **arrays,
GLuint max_index, GLuint max_index,
GLboolean userSpace, GLboolean userSpace,
@@ -409,7 +409,7 @@ setup_interleaved_attribs(struct gl_context *ctx,
static void static void
setup_non_interleaved_attribs(struct gl_context *ctx, setup_non_interleaved_attribs(struct gl_context *ctx,
const struct st_vertex_program *vp, const struct st_vertex_program *vp,
const struct st_vp_varient *vpv, const struct st_vp_variant *vpv,
const struct gl_client_array **arrays, const struct gl_client_array **arrays,
GLuint max_index, GLuint max_index,
GLboolean *userSpace, GLboolean *userSpace,
@@ -617,7 +617,7 @@ st_draw_vbo(struct gl_context *ctx,
struct st_context *st = st_context(ctx); struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe; struct pipe_context *pipe = st->pipe;
const struct st_vertex_program *vp; const struct st_vertex_program *vp;
const struct st_vp_varient *vpv; const struct st_vp_variant *vpv;
struct pipe_vertex_buffer vbuffer[PIPE_MAX_SHADER_INPUTS]; struct pipe_vertex_buffer vbuffer[PIPE_MAX_SHADER_INPUTS];
GLuint attr; GLuint attr;
struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS]; struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS];
@@ -650,7 +650,7 @@ st_draw_vbo(struct gl_context *ctx,
/* must get these after state validation! */ /* must get these after state validation! */
vp = st->vp; vp = st->vp;
vpv = st->vp_varient; vpv = st->vp_variant;
#if 0 #if 0
if (MESA_VERBOSE & VERBOSE_GLSL) { if (MESA_VERBOSE & VERBOSE_GLSL) {

View File

@@ -123,10 +123,10 @@ st_feedback_draw_vbo(struct gl_context *ctx,
/* must get these after state validation! */ /* must get these after state validation! */
vp = st->vp; vp = st->vp;
vs = &st->vp_varient->tgsi; vs = &st->vp_variant->tgsi;
if (!st->vp_varient->draw_shader) { if (!st->vp_variant->draw_shader) {
st->vp_varient->draw_shader = draw_create_vertex_shader(draw, vs); st->vp_variant->draw_shader = draw_create_vertex_shader(draw, vs);
} }
/* /*
@@ -139,7 +139,7 @@ st_feedback_draw_vbo(struct gl_context *ctx,
draw_set_viewport_state(draw, &st->state.viewport); draw_set_viewport_state(draw, &st->state.viewport);
draw_set_clip_state(draw, &st->state.clip); draw_set_clip_state(draw, &st->state.clip);
draw_set_rasterizer_state(draw, &st->state.rasterizer, NULL); draw_set_rasterizer_state(draw, &st->state.rasterizer, NULL);
draw_bind_vertex_shader(draw, st->vp_varient->draw_shader); draw_bind_vertex_shader(draw, st->vp_variant->draw_shader);
set_feedback_vertex_format(ctx); set_feedback_vertex_format(ctx);
/* loop over TGSI shader inputs to determine vertex buffer /* loop over TGSI shader inputs to determine vertex buffer

View File

@@ -56,11 +56,11 @@
/** /**
* Delete a vertex program varient. Note the caller must unlink * Delete a vertex program variant. Note the caller must unlink
* the varient from the linked list. * the variant from the linked list.
*/ */
static void static void
delete_vp_varient(struct st_context *st, struct st_vp_varient *vpv) delete_vp_variant(struct st_context *st, struct st_vp_variant *vpv)
{ {
if (vpv->driver_shader) if (vpv->driver_shader)
cso_delete_vertex_shader(st->cso_context, vpv->driver_shader); cso_delete_vertex_shader(st->cso_context, vpv->driver_shader);
@@ -82,28 +82,28 @@ delete_vp_varient(struct st_context *st, struct st_vp_varient *vpv)
* Clean out any old compilations: * Clean out any old compilations:
*/ */
void void
st_release_vp_varients( struct st_context *st, st_release_vp_variants( struct st_context *st,
struct st_vertex_program *stvp ) struct st_vertex_program *stvp )
{ {
struct st_vp_varient *vpv; struct st_vp_variant *vpv;
for (vpv = stvp->varients; vpv; ) { for (vpv = stvp->variants; vpv; ) {
struct st_vp_varient *next = vpv->next; struct st_vp_variant *next = vpv->next;
delete_vp_varient(st, vpv); delete_vp_variant(st, vpv);
vpv = next; vpv = next;
} }
stvp->varients = NULL; stvp->variants = NULL;
} }
/** /**
* Delete a fragment program varient. Note the caller must unlink * Delete a fragment program variant. Note the caller must unlink
* the varient from the linked list. * the variant from the linked list.
*/ */
static void static void
delete_fp_varient(struct st_context *st, struct st_fp_varient *fpv) delete_fp_variant(struct st_context *st, struct st_fp_variant *fpv)
{ {
if (fpv->driver_shader) if (fpv->driver_shader)
cso_delete_fragment_shader(st->cso_context, fpv->driver_shader); cso_delete_fragment_shader(st->cso_context, fpv->driver_shader);
@@ -113,29 +113,29 @@ delete_fp_varient(struct st_context *st, struct st_fp_varient *fpv)
/** /**
* Free all varients of a fragment program. * Free all variants of a fragment program.
*/ */
void void
st_release_fp_varients(struct st_context *st, struct st_fragment_program *stfp) st_release_fp_variants(struct st_context *st, struct st_fragment_program *stfp)
{ {
struct st_fp_varient *fpv; struct st_fp_variant *fpv;
for (fpv = stfp->varients; fpv; ) { for (fpv = stfp->variants; fpv; ) {
struct st_fp_varient *next = fpv->next; struct st_fp_variant *next = fpv->next;
delete_fp_varient(st, fpv); delete_fp_variant(st, fpv);
fpv = next; fpv = next;
} }
stfp->varients = NULL; stfp->variants = NULL;
} }
/** /**
* Delete a geometry program varient. Note the caller must unlink * Delete a geometry program variant. Note the caller must unlink
* the varient from the linked list. * the variant from the linked list.
*/ */
static void static void
delete_gp_varient(struct st_context *st, struct st_gp_varient *gpv) delete_gp_variant(struct st_context *st, struct st_gp_variant *gpv)
{ {
if (gpv->driver_shader) if (gpv->driver_shader)
cso_delete_geometry_shader(st->cso_context, gpv->driver_shader); cso_delete_geometry_shader(st->cso_context, gpv->driver_shader);
@@ -145,20 +145,20 @@ delete_gp_varient(struct st_context *st, struct st_gp_varient *gpv)
/** /**
* Free all varients of a geometry program. * Free all variants of a geometry program.
*/ */
void void
st_release_gp_varients(struct st_context *st, struct st_geometry_program *stgp) st_release_gp_variants(struct st_context *st, struct st_geometry_program *stgp)
{ {
struct st_gp_varient *gpv; struct st_gp_variant *gpv;
for (gpv = stgp->varients; gpv; ) { for (gpv = stgp->variants; gpv; ) {
struct st_gp_varient *next = gpv->next; struct st_gp_variant *next = gpv->next;
delete_gp_varient(st, gpv); delete_gp_variant(st, gpv);
gpv = next; gpv = next;
} }
stgp->varients = NULL; stgp->variants = NULL;
} }
@@ -276,14 +276,14 @@ st_prepare_vertex_program(struct st_context *st,
/** /**
* Translate a vertex program to create a new varient. * Translate a vertex program to create a new variant.
*/ */
static struct st_vp_varient * static struct st_vp_variant *
st_translate_vertex_program(struct st_context *st, st_translate_vertex_program(struct st_context *st,
struct st_vertex_program *stvp, struct st_vertex_program *stvp,
const struct st_vp_varient_key *key) const struct st_vp_variant_key *key)
{ {
struct st_vp_varient *vpv = CALLOC_STRUCT(st_vp_varient); struct st_vp_variant *vpv = CALLOC_STRUCT(st_vp_variant);
struct pipe_context *pipe = st->pipe; struct pipe_context *pipe = st->pipe;
struct ureg_program *ureg; struct ureg_program *ureg;
enum pipe_error error; enum pipe_error error;
@@ -361,17 +361,17 @@ fail:
/** /**
* Find/create a vertex program varient. * Find/create a vertex program variant.
*/ */
struct st_vp_varient * struct st_vp_variant *
st_get_vp_varient(struct st_context *st, st_get_vp_variant(struct st_context *st,
struct st_vertex_program *stvp, struct st_vertex_program *stvp,
const struct st_vp_varient_key *key) const struct st_vp_variant_key *key)
{ {
struct st_vp_varient *vpv; struct st_vp_variant *vpv;
/* Search for existing varient */ /* Search for existing variant */
for (vpv = stvp->varients; vpv; vpv = vpv->next) { for (vpv = stvp->variants; vpv; vpv = vpv->next) {
if (memcmp(&vpv->key, key, sizeof(*key)) == 0) { if (memcmp(&vpv->key, key, sizeof(*key)) == 0) {
break; break;
} }
@@ -382,8 +382,8 @@ st_get_vp_varient(struct st_context *st,
vpv = st_translate_vertex_program(st, stvp, key); vpv = st_translate_vertex_program(st, stvp, key);
if (vpv) { if (vpv) {
/* insert into list */ /* insert into list */
vpv->next = stvp->varients; vpv->next = stvp->variants;
stvp->varients = vpv; stvp->variants = vpv;
} }
} }
@@ -396,15 +396,15 @@ st_get_vp_varient(struct st_context *st,
* the key. * the key.
* \return new fragment program variant * \return new fragment program variant
*/ */
static struct st_fp_varient * static struct st_fp_variant *
st_translate_fragment_program(struct st_context *st, st_translate_fragment_program(struct st_context *st,
struct st_fragment_program *stfp, struct st_fragment_program *stfp,
const struct st_fp_varient_key *key) const struct st_fp_variant_key *key)
{ {
struct pipe_context *pipe = st->pipe; struct pipe_context *pipe = st->pipe;
struct st_fp_varient *varient = CALLOC_STRUCT(st_fp_varient); struct st_fp_variant *variant = CALLOC_STRUCT(st_fp_variant);
if (!varient) if (!variant)
return NULL; return NULL;
assert(!(key->bitmap && key->drawpixels)); assert(!(key->bitmap && key->drawpixels));
@@ -414,9 +414,9 @@ st_translate_fragment_program(struct st_context *st,
struct gl_fragment_program *fp; struct gl_fragment_program *fp;
st_make_bitmap_fragment_program(st, &stfp->Base, st_make_bitmap_fragment_program(st, &stfp->Base,
&fp, &varient->bitmap_sampler); &fp, &variant->bitmap_sampler);
varient->parameters = _mesa_clone_parameter_list(fp->Base.Parameters); variant->parameters = _mesa_clone_parameter_list(fp->Base.Parameters);
stfp = st_fragment_program(fp); stfp = st_fragment_program(fp);
} }
else if (key->drawpixels) { else if (key->drawpixels) {
@@ -430,7 +430,7 @@ st_translate_fragment_program(struct st_context *st,
else { else {
/* RGBA */ /* RGBA */
st_make_drawpix_fragment_program(st, &stfp->Base, &fp); st_make_drawpix_fragment_program(st, &stfp->Base, &fp);
varient->parameters = _mesa_clone_parameter_list(fp->Base.Parameters); variant->parameters = _mesa_clone_parameter_list(fp->Base.Parameters);
} }
stfp = st_fragment_program(fp); stfp = st_fragment_program(fp);
} }
@@ -613,31 +613,31 @@ st_translate_fragment_program(struct st_context *st,
ureg_destroy( ureg ); ureg_destroy( ureg );
} }
/* fill in varient */ /* fill in variant */
varient->driver_shader = pipe->create_fs_state(pipe, &stfp->tgsi); variant->driver_shader = pipe->create_fs_state(pipe, &stfp->tgsi);
varient->key = *key; variant->key = *key;
if (ST_DEBUG & DEBUG_TGSI) { if (ST_DEBUG & DEBUG_TGSI) {
tgsi_dump( stfp->tgsi.tokens, 0/*TGSI_DUMP_VERBOSE*/ ); tgsi_dump( stfp->tgsi.tokens, 0/*TGSI_DUMP_VERBOSE*/ );
debug_printf("\n"); debug_printf("\n");
} }
return varient; return variant;
} }
/** /**
* Translate fragment program if needed. * Translate fragment program if needed.
*/ */
struct st_fp_varient * struct st_fp_variant *
st_get_fp_varient(struct st_context *st, st_get_fp_variant(struct st_context *st,
struct st_fragment_program *stfp, struct st_fragment_program *stfp,
const struct st_fp_varient_key *key) const struct st_fp_variant_key *key)
{ {
struct st_fp_varient *fpv; struct st_fp_variant *fpv;
/* Search for existing varient */ /* Search for existing variant */
for (fpv = stfp->varients; fpv; fpv = fpv->next) { for (fpv = stfp->variants; fpv; fpv = fpv->next) {
if (memcmp(&fpv->key, key, sizeof(*key)) == 0) { if (memcmp(&fpv->key, key, sizeof(*key)) == 0) {
break; break;
} }
@@ -648,8 +648,8 @@ st_get_fp_varient(struct st_context *st,
fpv = st_translate_fragment_program(st, stfp, key); fpv = st_translate_fragment_program(st, stfp, key);
if (fpv) { if (fpv) {
/* insert into list */ /* insert into list */
fpv->next = stfp->varients; fpv->next = stfp->variants;
stfp->varients = fpv; stfp->variants = fpv;
} }
} }
@@ -658,12 +658,12 @@ st_get_fp_varient(struct st_context *st,
/** /**
* Translate a geometry program to create a new varient. * Translate a geometry program to create a new variant.
*/ */
static struct st_gp_varient * static struct st_gp_variant *
st_translate_geometry_program(struct st_context *st, st_translate_geometry_program(struct st_context *st,
struct st_geometry_program *stgp, struct st_geometry_program *stgp,
const struct st_gp_varient_key *key) const struct st_gp_variant_key *key)
{ {
GLuint inputMapping[GEOM_ATTRIB_MAX]; GLuint inputMapping[GEOM_ATTRIB_MAX];
GLuint outputMapping[GEOM_RESULT_MAX]; GLuint outputMapping[GEOM_RESULT_MAX];
@@ -686,9 +686,9 @@ st_translate_geometry_program(struct st_context *st,
GLuint maxSlot = 0; GLuint maxSlot = 0;
struct ureg_program *ureg; struct ureg_program *ureg;
struct st_gp_varient *gpv; struct st_gp_variant *gpv;
gpv = CALLOC_STRUCT(st_gp_varient); gpv = CALLOC_STRUCT(st_gp_variant);
if (!gpv) if (!gpv)
return NULL; return NULL;
@@ -896,7 +896,7 @@ st_translate_geometry_program(struct st_context *st,
stgp->tgsi.tokens = ureg_get_tokens( ureg, NULL ); stgp->tgsi.tokens = ureg_get_tokens( ureg, NULL );
ureg_destroy( ureg ); ureg_destroy( ureg );
/* fill in new varient */ /* fill in new variant */
gpv->driver_shader = pipe->create_gs_state(pipe, &stgp->tgsi); gpv->driver_shader = pipe->create_gs_state(pipe, &stgp->tgsi);
gpv->key = *key; gpv->key = *key;
@@ -917,15 +917,15 @@ st_translate_geometry_program(struct st_context *st,
/** /**
* Get/create geometry program variant. * Get/create geometry program variant.
*/ */
struct st_gp_varient * struct st_gp_variant *
st_get_gp_varient(struct st_context *st, st_get_gp_variant(struct st_context *st,
struct st_geometry_program *stgp, struct st_geometry_program *stgp,
const struct st_gp_varient_key *key) const struct st_gp_variant_key *key)
{ {
struct st_gp_varient *gpv; struct st_gp_variant *gpv;
/* Search for existing varient */ /* Search for existing variant */
for (gpv = stgp->varients; gpv; gpv = gpv->next) { for (gpv = stgp->variants; gpv; gpv = gpv->next) {
if (memcmp(&gpv->key, key, sizeof(*key)) == 0) { if (memcmp(&gpv->key, key, sizeof(*key)) == 0) {
break; break;
} }
@@ -936,8 +936,8 @@ st_get_gp_varient(struct st_context *st,
gpv = st_translate_geometry_program(st, stgp, key); gpv = st_translate_geometry_program(st, stgp, key);
if (gpv) { if (gpv) {
/* insert into list */ /* insert into list */
gpv->next = stgp->varients; gpv->next = stgp->variants;
stgp->varients = gpv; stgp->variants = gpv;
} }
} }
@@ -1008,15 +1008,15 @@ destroy_program_variants(struct st_context *st, struct gl_program *program)
case GL_VERTEX_PROGRAM_ARB: case GL_VERTEX_PROGRAM_ARB:
{ {
struct st_vertex_program *stvp = (struct st_vertex_program *) program; struct st_vertex_program *stvp = (struct st_vertex_program *) program;
struct st_vp_varient *vpv, **prevPtr = &stvp->varients; struct st_vp_variant *vpv, **prevPtr = &stvp->variants;
for (vpv = stvp->varients; vpv; ) { for (vpv = stvp->variants; vpv; ) {
struct st_vp_varient *next = vpv->next; struct st_vp_variant *next = vpv->next;
if (vpv->key.st == st) { if (vpv->key.st == st) {
/* unlink from list */ /* unlink from list */
*prevPtr = next; *prevPtr = next;
/* destroy this variant */ /* destroy this variant */
delete_vp_varient(st, vpv); delete_vp_variant(st, vpv);
} }
else { else {
prevPtr = &vpv->next; prevPtr = &vpv->next;
@@ -1029,15 +1029,15 @@ destroy_program_variants(struct st_context *st, struct gl_program *program)
{ {
struct st_fragment_program *stfp = struct st_fragment_program *stfp =
(struct st_fragment_program *) program; (struct st_fragment_program *) program;
struct st_fp_varient *fpv, **prevPtr = &stfp->varients; struct st_fp_variant *fpv, **prevPtr = &stfp->variants;
for (fpv = stfp->varients; fpv; ) { for (fpv = stfp->variants; fpv; ) {
struct st_fp_varient *next = fpv->next; struct st_fp_variant *next = fpv->next;
if (fpv->key.st == st) { if (fpv->key.st == st) {
/* unlink from list */ /* unlink from list */
*prevPtr = next; *prevPtr = next;
/* destroy this variant */ /* destroy this variant */
delete_fp_varient(st, fpv); delete_fp_variant(st, fpv);
} }
else { else {
prevPtr = &fpv->next; prevPtr = &fpv->next;
@@ -1050,15 +1050,15 @@ destroy_program_variants(struct st_context *st, struct gl_program *program)
{ {
struct st_geometry_program *stgp = struct st_geometry_program *stgp =
(struct st_geometry_program *) program; (struct st_geometry_program *) program;
struct st_gp_varient *gpv, **prevPtr = &stgp->varients; struct st_gp_variant *gpv, **prevPtr = &stgp->variants;
for (gpv = stgp->varients; gpv; ) { for (gpv = stgp->variants; gpv; ) {
struct st_gp_varient *next = gpv->next; struct st_gp_variant *next = gpv->next;
if (gpv->key.st == st) { if (gpv->key.st == st) {
/* unlink from list */ /* unlink from list */
*prevPtr = next; *prevPtr = next;
/* destroy this variant */ /* destroy this variant */
delete_gp_varient(st, gpv); delete_gp_variant(st, gpv);
} }
else { else {
prevPtr = &gpv->next; prevPtr = &gpv->next;

View File

@@ -41,15 +41,15 @@
/** Fragment program variant key */ /** Fragment program variant key */
struct st_fp_varient_key struct st_fp_variant_key
{ {
struct st_context *st; /**< variants are per-context */ struct st_context *st; /**< variants are per-context */
/** for glBitmap */ /** for glBitmap */
GLuint bitmap:1; /**< glBitmap varient? */ GLuint bitmap:1; /**< glBitmap variant? */
/** for glDrawPixels */ /** for glDrawPixels */
GLuint drawpixels:1; /**< glDrawPixels varient */ GLuint drawpixels:1; /**< glDrawPixels variant */
GLuint scaleAndBias:1; /**< glDrawPixels w/ scale and/or bias? */ GLuint scaleAndBias:1; /**< glDrawPixels w/ scale and/or bias? */
GLuint pixelMaps:1; /**< glDrawPixels w/ pixel lookup map? */ GLuint pixelMaps:1; /**< glDrawPixels w/ pixel lookup map? */
GLuint drawpixels_z:1; /**< glDrawPixels(GL_DEPTH) */ GLuint drawpixels_z:1; /**< glDrawPixels(GL_DEPTH) */
@@ -60,10 +60,10 @@ struct st_fp_varient_key
/** /**
* Variant of a fragment program. * Variant of a fragment program.
*/ */
struct st_fp_varient struct st_fp_variant
{ {
/** Parameters which generated this version of fragment program */ /** Parameters which generated this version of fragment program */
struct st_fp_varient_key key; struct st_fp_variant_key key;
/** Driver's compiled shader */ /** Driver's compiled shader */
void *driver_shader; void *driver_shader;
@@ -73,7 +73,7 @@ struct st_fp_varient
uint bitmap_sampler; uint bitmap_sampler;
/** next in linked list */ /** next in linked list */
struct st_fp_varient *next; struct st_fp_variant *next;
}; };
@@ -86,13 +86,13 @@ struct st_fragment_program
struct pipe_shader_state tgsi; struct pipe_shader_state tgsi;
struct st_fp_varient *varients; struct st_fp_variant *variants;
}; };
/** Vertex program variant key */ /** Vertex program variant key */
struct st_vp_varient_key struct st_vp_variant_key
{ {
struct st_context *st; /**< variants are per-context */ struct st_context *st; /**< variants are per-context */
boolean passthrough_edgeflags; boolean passthrough_edgeflags;
@@ -103,12 +103,12 @@ struct st_vp_varient_key
* This represents a vertex program, especially translated to match * This represents a vertex program, especially translated to match
* the inputs of a particular fragment shader. * the inputs of a particular fragment shader.
*/ */
struct st_vp_varient struct st_vp_variant
{ {
/* Parameters which generated this translated version of a vertex /* Parameters which generated this translated version of a vertex
* shader: * shader:
*/ */
struct st_vp_varient_key key; struct st_vp_variant_key key;
/** /**
* TGSI tokens (to later generate a 'draw' module shader for * TGSI tokens (to later generate a 'draw' module shader for
@@ -123,7 +123,7 @@ struct st_vp_varient
struct draw_vertex_shader *draw_shader; struct draw_vertex_shader *draw_shader;
/** Next in linked list */ /** Next in linked list */
struct st_vp_varient *next; struct st_vp_variant *next;
/** similar to that in st_vertex_program, but with edgeflags info too */ /** similar to that in st_vertex_program, but with edgeflags info too */
GLuint num_inputs; GLuint num_inputs;
@@ -149,15 +149,15 @@ struct st_vertex_program
ubyte output_semantic_index[VERT_RESULT_MAX]; ubyte output_semantic_index[VERT_RESULT_MAX];
GLuint num_outputs; GLuint num_outputs;
/** List of translated varients of this vertex program. /** List of translated variants of this vertex program.
*/ */
struct st_vp_varient *varients; struct st_vp_variant *variants;
}; };
/** Geometry program varient key */ /** Geometry program variant key */
struct st_gp_varient_key struct st_gp_variant_key
{ {
struct st_context *st; /**< variants are per-context */ struct st_context *st; /**< variants are per-context */
/* no other fields yet */ /* no other fields yet */
@@ -167,14 +167,14 @@ struct st_gp_varient_key
/** /**
* Geometry program variant. * Geometry program variant.
*/ */
struct st_gp_varient struct st_gp_variant
{ {
/* Parameters which generated this translated version of a vertex */ /* Parameters which generated this translated version of a vertex */
struct st_gp_varient_key key; struct st_gp_variant_key key;
void *driver_shader; void *driver_shader;
struct st_gp_varient *next; struct st_gp_variant *next;
}; };
@@ -203,7 +203,7 @@ struct st_geometry_program
struct pipe_shader_state tgsi; struct pipe_shader_state tgsi;
struct st_gp_varient *varients; struct st_gp_variant *variants;
}; };
@@ -258,35 +258,35 @@ st_reference_fragprog(struct st_context *st,
} }
extern struct st_vp_varient * extern struct st_vp_variant *
st_get_vp_varient(struct st_context *st, st_get_vp_variant(struct st_context *st,
struct st_vertex_program *stvp, struct st_vertex_program *stvp,
const struct st_vp_varient_key *key); const struct st_vp_variant_key *key);
extern struct st_fp_varient * extern struct st_fp_variant *
st_get_fp_varient(struct st_context *st, st_get_fp_variant(struct st_context *st,
struct st_fragment_program *stfp, struct st_fragment_program *stfp,
const struct st_fp_varient_key *key); const struct st_fp_variant_key *key);
extern struct st_gp_varient * extern struct st_gp_variant *
st_get_gp_varient(struct st_context *st, st_get_gp_variant(struct st_context *st,
struct st_geometry_program *stgp, struct st_geometry_program *stgp,
const struct st_gp_varient_key *key); const struct st_gp_variant_key *key);
extern void extern void
st_release_vp_varients( struct st_context *st, st_release_vp_variants( struct st_context *st,
struct st_vertex_program *stvp ); struct st_vertex_program *stvp );
extern void extern void
st_release_fp_varients( struct st_context *st, st_release_fp_variants( struct st_context *st,
struct st_fragment_program *stfp ); struct st_fragment_program *stfp );
extern void extern void
st_release_gp_varients(struct st_context *st, st_release_gp_variants(struct st_context *st,
struct st_geometry_program *stgp); struct st_geometry_program *stgp);