[Mesa-dev] [PATCH 07/13] r600g: fix texture array filtering
Marek Olšák
maraeo at gmail.com
Tue Sep 6 21:02:50 PDT 2011
On Tue, Sep 6, 2011 at 8:29 AM, Dave Airlie <airlied at gmail.com> wrote:
> On Mon, Sep 5, 2011 at 10:44 PM, Marek Olšák <maraeo at gmail.com> wrote:
>> This fixes piglit/fbo-generatemipmap-array.
>>
>> It looks like SQ_TEX_SAMPLER_WORD0_0.TEX_ARRAY_OVERRIDE should be set
>> for array textures in order to disable filtering between slices,
>> which adds a dependency between sampler views and sampler states.
>>
>> This patch reworks sampler state updates such that they are postponed until
>> draw time. TEX_ARRAY_OVERRIDE is updated according to bound sampler views.
>>
>> This also consolidates setting the texture state between vertex and
>> pixel shaders.
>
> Have you measured the impact of this on framerate? I spent a lot of
> time making sure we didn't do things in the draw_vbo path that we
> didn't need to.
>
> It might be better to attempt these sort of updates at bind time if we
> can, even if its a bit uglier, though hopefully the dirty flag
> mitigates this I'd rather know for sure.
Well, I didn't test the performance. However if an app does not use
texture arrays, this may be either as fast as the old code or faster.
The dirty flag ensures sampler states are not updated needlessly, so
basically it just postpones the state update, it doesn't add more CPU
work.
The things are different when bind_fragment_sampler_states is called
twice (imagine cso_cache or u_blitter restoring the state, then an app
changes it; or vice versa, an app changes the state, then u_blit or
u_blitter change it again). In that case, the new code would be
faster, because the bind_*_sampler_states functions don't set
anything, they just copy the parameters. The state update is done only
once in draw_vbo.
I originally did this at bind time and not only was it ugly, it was
less efficient overall. The thing was the sampler states would have
had to be updated TWICE whenever a sampler view was changed from
non-array to array or vice versa. One state update was in
set_*_sampler_states and the other one in set_*_sampler_views, trying
to update TEX_ARRAY_OVERRIDE in sampler states.
I hope that makes sense.
Marek
More information about the mesa-dev
mailing list