From 5f30e0b2316c5d0a50f1b331e7cdb4c46882e918 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 2 Feb 2011 18:14:46 -0700 Subject: [PATCH] cso: rename fragment sampler-related fields To better distinguish from vertex sampler fields. --- src/gallium/auxiliary/cso_cache/cso_context.c | 47 ++++++++++--------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index b983fa61c12..0fce278db3d 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -52,21 +52,21 @@ struct cso_context { struct cso_cache *cache; struct { - void *samplers[PIPE_MAX_SAMPLERS]; - unsigned nr_samplers; + void *fragment_samplers[PIPE_MAX_SAMPLERS]; + unsigned nr_fragment_samplers; void *vertex_samplers[PIPE_MAX_VERTEX_SAMPLERS]; unsigned nr_vertex_samplers; } hw; - void *samplers[PIPE_MAX_SAMPLERS]; - unsigned nr_samplers; + void *fragment_samplers[PIPE_MAX_SAMPLERS]; + unsigned nr_fragment_samplers; void *vertex_samplers[PIPE_MAX_VERTEX_SAMPLERS]; unsigned nr_vertex_samplers; - unsigned nr_samplers_saved; - void *samplers_saved[PIPE_MAX_SAMPLERS]; + unsigned nr_fragment_samplers_saved; + void *fragment_samplers_saved[PIPE_MAX_SAMPLERS]; unsigned nr_vertex_samplers_saved; void *vertex_samplers_saved[PIPE_MAX_VERTEX_SAMPLERS]; @@ -431,7 +431,7 @@ enum pipe_error cso_single_sampler(struct cso_context *ctx, } } - ctx->samplers[idx] = handle; + ctx->fragment_samplers[idx] = handle; return PIPE_OK; } @@ -482,21 +482,24 @@ void cso_single_sampler_done( struct cso_context *ctx ) /* find highest non-null sampler */ for (i = PIPE_MAX_SAMPLERS; i > 0; i--) { - if (ctx->samplers[i - 1] != NULL) + if (ctx->fragment_samplers[i - 1] != NULL) break; } - ctx->nr_samplers = i; + ctx->nr_fragment_samplers = i; - if (ctx->hw.nr_samplers != ctx->nr_samplers || - memcmp(ctx->hw.samplers, - ctx->samplers, - ctx->nr_samplers * sizeof(void *)) != 0) + if (ctx->hw.nr_fragment_samplers != ctx->nr_fragment_samplers || + memcmp(ctx->hw.fragment_samplers, + ctx->fragment_samplers, + ctx->nr_fragment_samplers * sizeof(void *)) != 0) { - memcpy(ctx->hw.samplers, ctx->samplers, ctx->nr_samplers * sizeof(void *)); - ctx->hw.nr_samplers = ctx->nr_samplers; + memcpy(ctx->hw.fragment_samplers, ctx->fragment_samplers, + ctx->nr_fragment_samplers * sizeof(void *)); + ctx->hw.nr_fragment_samplers = ctx->nr_fragment_samplers; - ctx->pipe->bind_fragment_sampler_states(ctx->pipe, ctx->nr_samplers, ctx->samplers); + ctx->pipe->bind_fragment_sampler_states(ctx->pipe, + ctx->nr_fragment_samplers, + ctx->fragment_samplers); } } @@ -550,7 +553,7 @@ enum pipe_error cso_set_samplers( struct cso_context *ctx, error = temp; } - for ( ; i < ctx->nr_samplers; i++) { + for ( ; i < ctx->nr_fragment_samplers; i++) { temp = cso_single_sampler( ctx, i, NULL ); if (temp != PIPE_OK) error = temp; @@ -563,14 +566,16 @@ enum pipe_error cso_set_samplers( struct cso_context *ctx, void cso_save_samplers(struct cso_context *ctx) { - ctx->nr_samplers_saved = ctx->nr_samplers; - memcpy(ctx->samplers_saved, ctx->samplers, sizeof(ctx->samplers)); + ctx->nr_fragment_samplers_saved = ctx->nr_fragment_samplers; + memcpy(ctx->fragment_samplers_saved, ctx->fragment_samplers, + sizeof(ctx->fragment_samplers)); } void cso_restore_samplers(struct cso_context *ctx) { - ctx->nr_samplers = ctx->nr_samplers_saved; - memcpy(ctx->samplers, ctx->samplers_saved, sizeof(ctx->samplers)); + ctx->nr_fragment_samplers = ctx->nr_fragment_samplers_saved; + memcpy(ctx->fragment_samplers, ctx->fragment_samplers_saved, + sizeof(ctx->fragment_samplers)); cso_single_sampler_done( ctx ); } -- 2.30.2