From afe627ea70af7e2d74f2e65f1bf629e70be028f4 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Tue, 29 Jun 2021 20:46:13 -0700 Subject: [PATCH] i915g: Delete redundant i915_hw_sampler_views atom. The i915_hw_samplers atom already updated both samplers and maps, since both samplers and maps depend on parts of both the gallium sampler state and the sampler view. Just move the samplers+views atom down to the bottom of the file for legibility, and delete the views-only one. Part-of: --- src/gallium/drivers/i915/i915_state_derived.c | 8 ++-- src/gallium/drivers/i915/i915_state_sampler.c | 62 +++++++-------------------- 2 files changed, 18 insertions(+), 52 deletions(-) diff --git a/src/gallium/drivers/i915/i915_state_derived.c b/src/gallium/drivers/i915/i915_state_derived.c index 76ef6ab..2402c55 100644 --- a/src/gallium/drivers/i915/i915_state_derived.c +++ b/src/gallium/drivers/i915/i915_state_derived.c @@ -186,11 +186,9 @@ struct i915_tracked_state i915_update_vertex_layout = { /*********************************************************************** */ static struct i915_tracked_state *atoms[] = { - &i915_update_vertex_layout, &i915_hw_samplers, - &i915_hw_sampler_views, &i915_hw_immediate, - &i915_hw_dynamic, &i915_hw_fs, - &i915_hw_framebuffer, &i915_hw_dst_buf_vars, - &i915_hw_constants, NULL, + &i915_update_vertex_layout, &i915_hw_samplers, &i915_hw_immediate, + &i915_hw_dynamic, &i915_hw_fs, &i915_hw_framebuffer, + &i915_hw_dst_buf_vars, &i915_hw_constants, NULL, }; void diff --git a/src/gallium/drivers/i915/i915_state_sampler.c b/src/gallium/drivers/i915/i915_state_sampler.c index 97d1d02..fdbc2e2 100644 --- a/src/gallium/drivers/i915/i915_state_sampler.c +++ b/src/gallium/drivers/i915/i915_state_sampler.c @@ -57,11 +57,6 @@ * changes. */ -static void update_map(struct i915_context *i915, uint32_t unit, - const struct i915_texture *tex, - const struct i915_sampler_state *sampler, - const struct pipe_sampler_view *view, uint32_t state[3]); - /*********************************************************************** * Samplers */ @@ -138,43 +133,6 @@ update_sampler(struct i915_context *i915, uint32_t unit, state[1] |= (unit << SS3_TEXTUREMAP_INDEX_SHIFT); } -static void -update_samplers(struct i915_context *i915) -{ - uint32_t unit; - - i915->current.sampler_enable_nr = 0; - i915->current.sampler_enable_flags = 0x0; - - for (unit = 0; - unit < i915->num_fragment_sampler_views && unit < i915->num_samplers; - unit++) { - /* determine unit enable/disable by looking for a bound texture */ - /* could also examine the fragment program? */ - if (i915->fragment_sampler_views[unit]) { - struct i915_texture *texture = - i915_texture(i915->fragment_sampler_views[unit]->texture); - - update_sampler(i915, unit, - i915->fragment_sampler[unit], /* sampler state */ - texture, /* texture */ - i915->current.sampler[unit]); /* the result */ - update_map(i915, unit, texture, /* texture */ - i915->fragment_sampler[unit], /* sampler state */ - i915->fragment_sampler_views[unit], /* sampler view */ - i915->current.texbuffer[unit]); /* the result */ - - i915->current.sampler_enable_nr++; - i915->current.sampler_enable_flags |= (1 << unit); - } - } - - i915->hardware_dirty |= I915_HW_SAMPLER | I915_HW_MAP; -} - -struct i915_tracked_state i915_hw_samplers = { - "samplers", update_samplers, I915_NEW_SAMPLER | I915_NEW_SAMPLER_VIEW}; - /*********************************************************************** * Sampler views */ @@ -347,10 +305,13 @@ update_map(struct i915_context *i915, uint32_t unit, } static void -update_maps(struct i915_context *i915) +update_samplers(struct i915_context *i915) { uint32_t unit; + i915->current.sampler_enable_nr = 0; + i915->current.sampler_enable_flags = 0x0; + for (unit = 0; unit < i915->num_fragment_sampler_views && unit < i915->num_samplers; unit++) { @@ -360,15 +321,22 @@ update_maps(struct i915_context *i915) struct i915_texture *texture = i915_texture(i915->fragment_sampler_views[unit]->texture); + update_sampler(i915, unit, + i915->fragment_sampler[unit], /* sampler state */ + texture, /* texture */ + i915->current.sampler[unit]); /* the result */ update_map(i915, unit, texture, /* texture */ i915->fragment_sampler[unit], /* sampler state */ i915->fragment_sampler_views[unit], /* sampler view */ - i915->current.texbuffer[unit]); + i915->current.texbuffer[unit]); /* the result */ + + i915->current.sampler_enable_nr++; + i915->current.sampler_enable_flags |= (1 << unit); } } - i915->hardware_dirty |= I915_HW_MAP; + i915->hardware_dirty |= I915_HW_SAMPLER | I915_HW_MAP; } -struct i915_tracked_state i915_hw_sampler_views = {"sampler_views", update_maps, - I915_NEW_SAMPLER_VIEW}; +struct i915_tracked_state i915_hw_samplers = { + "samplers", update_samplers, I915_NEW_SAMPLER | I915_NEW_SAMPLER_VIEW}; -- 2.7.4