[Mesa-dev] [PATCH] draw: make sure key size is calculated consistently.

Jose Fonseca jfonseca at vmware.com
Tue Feb 19 09:54:11 PST 2013

----- Original Message -----
> Am 19.02.2013 15:57, schrieb Jose Fonseca:
> > There may be more vertex elements that used in the shader. But why should
> > the key contain those elements? Won't this cause needless recompilations
> > (e.g., in situations where the state tracker leaves unneeded elements from
> > previous draw?)?
> I don't think the state tracker would leave unneeded elements like that
> (that is I think the nr_elements would be adjusted if the state tracker
> has to figure it out on its own, causing recompiles in any case).
> But yes if you set different pipe_vertex_element which only differ in
> the unused elements then it will cause unnecessary recompile (I don't
> think that's really something which matters here).
> > 
> > That is, it seems to be that the key should have the number of elements
> > from pipe_vertex_element information, but only copy those that vertex
> > shader uses.
> That doesn't sound very good. If we want to dump the
> pipe_vertex_elements like we do now either we need to fix up the
> nr_elements or copy all of them. Also vs_generate function seems to
> create code for all pipe_vertex_elements, not just those used by the shader.
> I guess that instead of using nr_elements we could just use the
> information from the shader instead consistently, though I'm actually
> unsure this works always - is it somehow possible to only use
> vertex_element nr 2 and 4 for instance?

Fair enough. Let's get this is as is for now, and keep our eyes open for any performance regression.


> So I think you're suggesting instead of this fix that key->nr_elements
> wouldn't be used for anything except the key comparison itself, and
> everything else (calculating sampler offset in the key, tgsi dump, code
> generation) would use the shader information?

More information about the mesa-dev mailing list