[Mesa-dev] [PATCH 1/9] gallium: Add PIPE_CAP_BUFFER_SAMPLER_VIEW_RGBA_ONLY

Fredrik Höglund fredrik at kde.org
Tue Jan 26 13:31:55 PST 2016


On Wednesday 20 January 2016, Fredrik Höglund wrote:
> On Tuesday 19 January 2016, Nicolai Hähnle wrote:
> > On 19.01.2016 10:45, Fredrik Höglund wrote:
> > > On Tuesday 19 January 2016, Nicolai Hähnle wrote:
> > >>
> > >> On 18.01.2016 18:50, Ilia Mirkin wrote:
> > >>> On Mon, Jan 18, 2016 at 5:22 PM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
> > >>>> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> > >>>> index 933330f..1ae557d 100644
> > >>>> --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> > >>>> +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> > >>>> @@ -75,6 +75,8 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> > >>>>          return 1;
> > >>>>       case PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE:
> > >>>>          return 2048;
> > >>>> +   case PIPE_CAP_BUFFER_SAMPLER_VIEW_RGBA_ONLY:
> > >>>> +      return 0;
> > >>>>       /* supported capabilities */
> > >>>>       case PIPE_CAP_TWO_SIDED_STENCIL:
> > >>>>       case PIPE_CAP_ANISOTROPIC_FILTER:
> > >>>> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> > >>>> index 712835c..99d7ae6 100644
> > >>>> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> > >>>> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> > >>>> @@ -121,6 +121,8 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> > >>>>          return 256;
> > >>>>       case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT:
> > >>>>          return 1; /* 256 for binding as RT, but that's not possible in GL */
> > >>>> +   case PIPE_CAP_BUFFER_SAMPLER_VIEW_RGBA_ONLY:
> > >>>> +      return 0;
> > >>>>       case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
> > >>>>          return NOUVEAU_MIN_BUFFER_MAP_ALIGN;
> > >>>>       case PIPE_CAP_MAX_VIEWPORTS:
> > >>>> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> > >>>> index 7211df9..612f1c0 100644
> > >>>> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> > >>>> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> > >>>> @@ -111,6 +111,8 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> > >>>>          return 256;
> > >>>>       case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT:
> > >>>>          return 1; /* 256 for binding as RT, but that's not possible in GL */
> > >>>> +   case PIPE_CAP_BUFFER_SAMPLER_VIEW_RGBA_ONLY:
> > >>>> +      return 0;
> > >>>>       case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
> > >>>>          return NOUVEAU_MIN_BUFFER_MAP_ALIGN;
> > >>>>       case PIPE_CAP_MAX_VIEWPORTS:
> > >>>
> > >>> I would greatly appreciate it if you could stick these into the
> > >>> "unsupported" list of caps -- each of nv30/nv50/nvc0 should have one,
> > >>> of varying length. (Same applies to the other cap you're adding.)
> > >>
> > >> Do you really want that? I actually put them aside on purpose, because
> > >> the somewhat unusual sense of the cap means that the return value of 1
> > >> is something unsupported. Of course, one might argue that I should have
> > >> changed the boolean sense and renamed it to something like
> > >> PIPE_CAP_BUFFER_SAMPLER_VIEW_SWIZZLES.
> > >
> > > That is actually the name I was going to use at first (minus the s).
> > > But then it occurred to me that it would be misleading, since this
> > > is not about pipe_sampler_view::swizzle_r/g/b/a.
> > 
> > It's about both the swizzles and the formats, isn't it? If it were only 
> > the formats, the deficiency could be fixed by using the swizzles.
> 
> Yeah, it's about both.  The whole issue could probably be avoided
> by rewriting the texture-buffer implementation in r600g to use
> texture fetches instead of vertex fetches.  But it was easier to
> just work around it in the state tracker.

Another option that just occurred to me: make r600g return false
in is_format_supported() when the format is non-rgba ordered and the
target is PIPE_BUFFER.  Then when the call fails in the state tracker,
reinterpret the formats and try again.

Fredrik



More information about the mesa-dev mailing list