[Mesa-dev] [PATCH 30/30] mesa/st: require linear interpolation for ARB_texture_float

Erik Faye-Lund erik.faye-lund at collabora.com
Mon Nov 19 15:40:01 UTC 2018


On Mon, 2018-11-19 at 10:02 -0500, Ilia Mirkin wrote:
> Unfortunately this will drop GL 3.0 from Adreno A3xx. I think we'd
> rather fake linear interpolation with F32 textures which are never
> used than lose GL 3.0 there...

Right...

I guess this means that this GPU never really did support OpenGL 3.0,
and will make some applications misbehave. There's definately
applications out there that will lead to surprisingly bad problems when
features like these are not supported.

For instance if an application tries to take a local gradient by
sampling a texture twice with a tiny epsilon (a common trick in
tangent-free normal mapping, for instance), it will essentially get
garbage, which can cause close to useless rendering.

I've worked on applications that would have had problems like these if
drivers report the wrong version, but could work correctly if they
report the right version.

Either way, I don't believe faking like that belongs in core Mesa. So
if the Freedreno developers really want this kind of behavior, perhaps
something like this could be a better move?

---8<---
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c
b/src/gallium/drivers/freedreno/freedreno_screen.c
index 88d91a91234..de811371f05 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -260,6 +260,11 @@ fd_screen_get_param(struct pipe_screen *pscreen,
enum pipe_cap param)
 		return 0;
 
 	case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
+		/* HACK: A330 doesn't support linear interpolation of
FP32 textures, but
+		 * to keep OpenGL 3.0 support, we lie about it here.
+		 */
+		return is_a3xx(screen) || is_a4xx(screen) ||
is_a5xx(screen) || is_a6xx(screen);
+
 	case PIPE_CAP_CUBE_MAP_ARRAY:
 	case PIPE_CAP_SAMPLER_VIEW_TARGET:
 	case PIPE_CAP_TEXTURE_QUERY_LOD:
---8<---

Alternatively, they could ask users to override the GL-version for
applications that need GL 3.0, but doesn't have problems with the lack
of FP32-interpolation...

> On Mon, Nov 19, 2018 at 7:16 AM Erik Faye-Lund
> <erik.faye-lund at collabora.com> wrote:
> > There's nothing in the ARB_texture_float specification that limits
> > filterability for floating-point textures, so we need to ensure
> > that
> > this is required to enable this extension. Luckily, we have just
> > the
> > right bits ready.
> > 
> > Signed-off-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
> > ---
> >  src/mesa/state_tracker/st_extensions.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/mesa/state_tracker/st_extensions.c
> > b/src/mesa/state_tracker/st_extensions.c
> > index b0fc824e30c..244934f7588 100644
> > --- a/src/mesa/state_tracker/st_extensions.c
> > +++ b/src/mesa/state_tracker/st_extensions.c
> > @@ -1459,7 +1459,9 @@ void st_init_extensions(struct pipe_screen
> > *screen,
> > 
> >     extensions->ARB_texture_float =
> >        extensions->OES_texture_half_float &&
> > -      extensions->OES_texture_float;
> > +      extensions->OES_texture_half_float_linear &&
> > +      extensions->OES_texture_float &&
> > +      extensions->OES_texture_float_linear;
> > 
> >     if (extensions->EXT_texture_filter_anisotropic &&
> >         screen->get_paramf(screen,
> > PIPE_CAPF_MAX_TEXTURE_ANISOTROPY) >= 16.0)
> > --
> > 2.19.1
> > 
> > _______________________________________________
> > 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