[Mesa-dev] RFC: mesa/st dynamic sampler support in tgsi

Roland Scheidegger sroland at vmware.com
Tue Aug 5 07:28:06 PDT 2014


Am 05.08.2014 06:54, schrieb Ilia Mirkin:
> Hello,
> 
> I'm in the process of working out the details of adding dynamic
> sampler support to mesa/st as part of ARB_gpu_shader5. Unfortunately
> I've run into a bit of a roadblock.
> 
> One approach I've tried is to load the indirect sampler index into an
> address register and then use that as the offset. However in order to
> realistically support that I need a 3rd address register, while right
> now tgsi_ureg limits it to 2 address registers. Would it be OK to
> relax the restriction to 3? (The reason I need a third is that if e.g.
> the dst has a reladdr, I'd have to change a bunch of stuff to make
> that function properly without a 3rd addr reg, since I can't just MOV
> the sampler to a temp like it does for all the other src's.)
I don't think using address regs is the right idea. This is essentially
just for old ARB_vp address reg, they aren't really needed otherwise.

> 
> Another apporach I've tried is to just use a TEMP register as the
> indirect offset here. Unfortunately this gets destroyed by
> st_glsl_to_tgsi's various optimizations which assume that temp
> registers can't be reladdr's and so messes up the values. I started
> adding support for that, but then quickly realized that was probably
> not the right thing to do.
> 
> So... should I increase the number of address registers to 1? Or is
> there some other simple approach that I'm missing?
> 
> Thanks,
> 
>   -ilia

As far as I understand, if you want to index samplers like that, you
have to declare the samplers as an array, then just index into it like
you'd do with other array types. So, my guess is that is what should be
done, but maybe I don't understand the problem.
Ideally it should also work for d3d11, I've got some feeling there you
can index into resources rather than samplers though I didn't really
look at it... I just know it's something (both the gl and d3d11 versions
whatever they look like) which is impossible to implement in llvmpipe
with the current sampling code...

Roland




More information about the mesa-dev mailing list