[Mesa-dev] [PATCH] gallium: add CAPs for indirect addressing and lower it in st/mesa when needed

José Fonseca jfonseca at vmware.com
Wed Nov 10 13:39:31 PST 2010


On Wed, 2010-11-10 at 13:24 -0800, Marek Olšák wrote:
> On Wed, Nov 10, 2010 at 9:48 PM, José Fonseca <jfonseca at vmware.com<mailto:jfonseca at vmware.com>> wrote:
> On Wed, 2010-11-10 at 12:29 -0800, Marek Olšák wrote:
> > Required because ATI and NVIDIA DX9 GPUs do not support indirect addressing
> > of temps, inputs, outputs, and consts (FS-only) or the hw support is so
> > limited that we cannot use it.
> >
> > This should make r300g and possibly nvfx more feature complete.
> >
> > Signed-off-by: Marek Olšák <maraeo at gmail.com<mailto:maraeo at gmail.com>>
> > ---
> >  src/gallium/include/pipe/p_defines.h   |    5 +++++
> >  src/mesa/state_tracker/st_extensions.c |    9 +++++++++
> >  2 files changed, 14 insertions(+), 0 deletions(-)
> >
> > diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
> > index 53f7b60..6cca301 100644
> > --- a/src/gallium/include/pipe/p_defines.h
> > +++ b/src/gallium/include/pipe/p_defines.h
> > @@ -483,7 +483,12 @@ enum pipe_shader_cap
> >     PIPE_SHADER_CAP_MAX_TEMPS,
> >     PIPE_SHADER_CAP_MAX_ADDRS,
> >     PIPE_SHADER_CAP_MAX_PREDS,
> > +   /* boolean caps */
> >     PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED,
> > +   PIPE_SHADER_CAP_INDIRECT_INPUT_ADDR,
> > +   PIPE_SHADER_CAP_INDIRECT_OUTPUT_ADDR,
> > +   PIPE_SHADER_CAP_INDIRECT_TEMP_ADDR,
> > +   PIPE_SHADER_CAP_INDIRECT_CONST_ADDR,
> >  };
> >
> >  /**
> > diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
> > index 2720f44..1327491 100644
> > --- a/src/mesa/state_tracker/st_extensions.c
> > +++ b/src/mesa/state_tracker/st_extensions.c
> > @@ -175,6 +175,15 @@ void st_init_limits(struct st_context *st)
> >
> >        options->EmitNoCont = !screen->get_shader_param(screen, i, PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED);
> >
> > +      options->EmitNoIndirectInput = !screen->get_shader_param(screen, i,
> > +                                        PIPE_SHADER_CAP_INDIRECT_INPUT_ADDR);
> > +      options->EmitNoIndirectOutput = !screen->get_shader_param(screen, i,
> > +                                        PIPE_SHADER_CAP_INDIRECT_OUTPUT_ADDR);
> > +      options->EmitNoIndirectTemp = !screveryeen->get_shader_param(screen, i,
> > +                                        PIPE_SHADER_CAP_INDIRECT_TEMP_ADDR);
> > +      options->EmitNoIndirectUniform = !screen->get_shader_param(screen, i,
> > +                                        PIPE_SHADER_CAP_INDIRECT_CONST_ADDR);
> > +
> >        if(options->EmitNoLoops)
> >           options->MaxUnrollIterations = MIN2(screen->get_shader_param(screen, i, PIPE_SHADER_CAP_MAX_INSTRUCTIONS), 65536);
> >     }
> 
> Marek,
> 
> I don't object the caps per se -- they seem unavoidable -- but this will
> change the current behavior for all existing drivers.  So either this
> change is immediately followed with one to implement handle these new
> caps on all pipe drivers (it's OK if you don't even build them), or the
> caps semantics should be negated, e.g,
> PIPE_SHADER_CAP_NO_INDIRECT_INPUT_ADDR.
> 
> I don't feel strongly either way, but it has happened too often for
> drivers nobody is currently looking at become broken due to new caps.
> 
> 
> I was going to fix get_shader_param in all the drivers afterwards to match the current behavior. I am well aware of the consequences the patch would have.

Great. Sorry for stating the obvious.

Looks good to me FWIW.

Jose



More information about the mesa-dev mailing list