diff options
author | Marek Olšák <[email protected]> | 2015-07-05 16:32:49 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2015-07-22 23:56:00 +0200 |
commit | b7492a1f45866a01b00263f9e252ddc3835304e9 (patch) | |
tree | 48d8a07763e6b2c6303edc319775a4a5163d7a71 /src/gallium/auxiliary | |
parent | 4e8bbed926729fe280701412d85aff64ab79856c (diff) |
cso: only allow saving and restoring fragment sampler states
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/cso_cache/cso_context.c | 28 | ||||
-rw-r--r-- | src/gallium/auxiliary/cso_cache/cso_context.h | 4 | ||||
-rw-r--r-- | src/gallium/auxiliary/hud/hud_context.c | 4 | ||||
-rw-r--r-- | src/gallium/auxiliary/postprocess/pp_run.c | 4 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_blit.c | 4 |
5 files changed, 24 insertions, 20 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index 969a9a41650..46055a099dc 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -58,9 +58,6 @@ struct sampler_info { void *samplers[PIPE_MAX_SAMPLERS]; unsigned nr_samplers; - - void *samplers_saved[PIPE_MAX_SAMPLERS]; - unsigned nr_samplers_saved; }; @@ -80,6 +77,9 @@ struct cso_context { struct pipe_sampler_view *fragment_views_saved[PIPE_MAX_SHADER_SAMPLER_VIEWS]; unsigned nr_fragment_views_saved; + void *fragment_samplers_saved[PIPE_MAX_SAMPLERS]; + unsigned nr_fragment_samplers_saved; + struct sampler_info samplers[PIPE_SHADER_TYPES]; struct pipe_vertex_buffer aux_vertex_buffer_current; @@ -1229,21 +1229,25 @@ cso_set_samplers(struct cso_context *ctx, } void -cso_save_samplers(struct cso_context *ctx, unsigned shader_stage) +cso_save_fragment_samplers(struct cso_context *ctx) { - struct sampler_info *info = &ctx->samplers[shader_stage]; - info->nr_samplers_saved = info->nr_samplers; - memcpy(info->samplers_saved, info->samplers, sizeof(info->samplers)); + struct sampler_info *info = &ctx->samplers[PIPE_SHADER_FRAGMENT]; + + ctx->nr_fragment_samplers_saved = info->nr_samplers; + memcpy(ctx->fragment_samplers_saved, info->samplers, + sizeof(info->samplers)); } void -cso_restore_samplers(struct cso_context *ctx, unsigned shader_stage) +cso_restore_fragment_samplers(struct cso_context *ctx) { - struct sampler_info *info = &ctx->samplers[shader_stage]; - info->nr_samplers = info->nr_samplers_saved; - memcpy(info->samplers, info->samplers_saved, sizeof(info->samplers)); - single_sampler_done(ctx, shader_stage); + struct sampler_info *info = &ctx->samplers[PIPE_SHADER_FRAGMENT]; + + info->nr_samplers = ctx->nr_fragment_samplers_saved; + memcpy(info->samplers, ctx->fragment_samplers_saved, + sizeof(info->samplers)); + single_sampler_done(ctx, PIPE_SHADER_FRAGMENT); } diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h index 9d12aaf45be..c9a422698a2 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.h +++ b/src/gallium/auxiliary/cso_cache/cso_context.h @@ -72,10 +72,10 @@ cso_set_samplers(struct cso_context *cso, const struct pipe_sampler_state **states); void -cso_save_samplers(struct cso_context *cso, unsigned shader_stage); +cso_save_fragment_samplers(struct cso_context *cso); void -cso_restore_samplers(struct cso_context *cso, unsigned shader_stage); +cso_restore_fragment_samplers(struct cso_context *cso); /* Alternate interface to support state trackers that like to modify * samplers one at a time: diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c index 4602b7c23c9..4631cd3b323 100644 --- a/src/gallium/auxiliary/hud/hud_context.c +++ b/src/gallium/auxiliary/hud/hud_context.c @@ -438,7 +438,7 @@ hud_draw(struct hud_context *hud, struct pipe_resource *tex) cso_save_depth_stencil_alpha(cso); cso_save_fragment_shader(cso); cso_save_fragment_sampler_views(cso); - cso_save_samplers(cso, PIPE_SHADER_FRAGMENT); + cso_save_fragment_samplers(cso); cso_save_rasterizer(cso); cso_save_viewport(cso); cso_save_stream_outputs(cso); @@ -568,7 +568,7 @@ hud_draw(struct hud_context *hud, struct pipe_resource *tex) cso_restore_depth_stencil_alpha(cso); cso_restore_fragment_shader(cso); cso_restore_fragment_sampler_views(cso); - cso_restore_samplers(cso, PIPE_SHADER_FRAGMENT); + cso_restore_fragment_samplers(cso); cso_restore_rasterizer(cso); cso_restore_viewport(cso); cso_restore_stream_outputs(cso); diff --git a/src/gallium/auxiliary/postprocess/pp_run.c b/src/gallium/auxiliary/postprocess/pp_run.c index 04f92c99236..caa2062f4cf 100644 --- a/src/gallium/auxiliary/postprocess/pp_run.c +++ b/src/gallium/auxiliary/postprocess/pp_run.c @@ -125,7 +125,7 @@ pp_run(struct pp_queue_t *ppq, struct pipe_resource *in, cso_save_rasterizer(cso); cso_save_sample_mask(cso); cso_save_min_samples(cso); - cso_save_samplers(cso, PIPE_SHADER_FRAGMENT); + cso_save_fragment_samplers(cso); cso_save_fragment_sampler_views(cso); cso_save_stencil_ref(cso); cso_save_stream_outputs(cso); @@ -196,7 +196,7 @@ pp_run(struct pp_queue_t *ppq, struct pipe_resource *in, cso_restore_rasterizer(cso); cso_restore_sample_mask(cso); cso_restore_min_samples(cso); - cso_restore_samplers(cso, PIPE_SHADER_FRAGMENT); + cso_restore_fragment_samplers(cso); cso_restore_fragment_sampler_views(cso); cso_restore_stencil_ref(cso); cso_restore_stream_outputs(cso); diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index 049ab35955a..70782a1aea9 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -546,7 +546,7 @@ util_blit_pixels_tex(struct blit_state *ctx, cso_save_rasterizer(ctx->cso); cso_save_sample_mask(ctx->cso); cso_save_min_samples(ctx->cso); - cso_save_samplers(ctx->cso, PIPE_SHADER_FRAGMENT); + cso_save_fragment_samplers(ctx->cso); cso_save_fragment_sampler_views(ctx->cso); cso_save_stream_outputs(ctx->cso); cso_save_viewport(ctx->cso); @@ -628,7 +628,7 @@ util_blit_pixels_tex(struct blit_state *ctx, cso_restore_rasterizer(ctx->cso); cso_restore_sample_mask(ctx->cso); cso_restore_min_samples(ctx->cso); - cso_restore_samplers(ctx->cso, PIPE_SHADER_FRAGMENT); + cso_restore_fragment_samplers(ctx->cso); cso_restore_fragment_sampler_views(ctx->cso); cso_restore_viewport(ctx->cso); cso_restore_framebuffer(ctx->cso); |