[Mesa-dev] Splitting a texture between multiple samplers in Gallium

Ilia Mirkin imirkin at alum.mit.edu
Mon May 21 12:34:45 UTC 2018

So ... what do you do when someone attaches max_samplers' worth of
RGBA32F textures to a single stage? My guess is that you just fail to
render and tell the application author, "don't do that". The
alternative is to expose 1/4th of the true maximum, which is probably

Normally these kinds of quirks are handled directly in the driver.
Have a look at e.g. how ASTC SRGB quirks are handled in freedreno --
on A420.0 the alpha channel gets srgb conversion as well (even though
it shouldn't), so one has to bind the texture twice -- once for rgb,
once for alpha. The compiler needs to be aware of this as well.

Hope this helps,


On Mon, May 21, 2018 at 8:15 AM, Konstantin P. <ria.freelander at gmail.com> wrote:
> We are writing a driver for some proprietary hardware using Gallium. And
> this hardware supports GL_ARB_texture_float, but requires to change texture
> format from PIPE_FORMAT_R32G32B32A32_FLOAT to PIPE_FORMAT_R8G8B8A8_UNORM and
> use four samplers (one R8G8B8A8_UNORM texture for each original color). How
> we should do it in a Gallium properly? If we will create multiple samplers
> in create_sampler_view - it can cause a crash, when we have a
> PIPE_MAX_SAMPLERS num of "large" textures. We want to use something similar
> to u_transfer_helper, but for this format. So, I have some questions
> regarding Gallium architecture, which affects this situation:
> 1. Where we should write a splitter? In a pipe_resource, or in a
> pipe_transfer, or in a sampler_view?
> 2. Do you have something related to this case in Gallium already to not to
> reinvent a bicycle? (If you have, we will use internal functions and not
> write our own).
> 3. Do you even support this kind of hardware which splits textures? Because
> I cannot found any example except u_transfer_helper (but it is only for one
> specific case, not for general).
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev

More information about the mesa-dev mailing list