[Mesa-dev] Mesa (master): mesa/st: Fill in native program limits.

José Fonseca jfonseca at vmware.com
Wed May 5 08:39:51 PDT 2010


FYI, this commit causes piglit fp-indirections2 to take forever in
gallium drivers that expose GLSL cpas.

IMO the best way to tackle this in master is just to workout the
interface changes for detailed shader caps and export real limits.

Any suggestions for the stable branches?

Jose

On Tue, 2010-05-04 at 07:41 -0700, Jose Fonseca wrote:
> Module: Mesa
> Branch: master
> Commit: dad962bafe8ffd7fdb35c28cfb8bbd5a297c8083
> URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=dad962bafe8ffd7fdb35c28cfb8bbd5a297c8083
> 
> Author: José Fonseca <jfonseca at vmware.com>
> Date:   Tue May  4 15:41:19 2010 +0100
> 
> mesa/st: Fill in native program limits.
> 
> In the lack of more fine grained capabilities in Gallium, assume that if
> the pipe driver supports GLSL then native limits match Mesa software
> limits.
> (cherry picked from commit 40a90cd11234a09c2477f5c9984dd6d9fac3f52c)
> 
> ---
> 
>  src/mesa/state_tracker/st_extensions.c |   91 ++++++++++++++++++++++++++++++++
>  1 files changed, 91 insertions(+), 0 deletions(-)
> 
> diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
> index b2045cf..5b2e49c 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -67,6 +67,7 @@ void st_init_limits(struct st_context *st)
>  {
>     struct pipe_screen *screen = st->pipe->screen;
>     struct gl_constants *c = &st->ctx->Const;
> +   struct gl_program_constants *pc;
>  
>     c->MaxTextureLevels
>        = _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS),
> @@ -140,6 +141,96 @@ void st_init_limits(struct st_context *st)
>  
>     /* Quads always follow GL provoking rules. */
>     c->QuadsFollowProvokingVertexConvention = GL_FALSE;
> +
> +   if (screen->get_param(screen, PIPE_CAP_GLSL)) {
> +      /*
> +       * In the lack of more fine grained capabilities, if the pipe driver supports
> +       * GLSL then assume native limits match Mesa software limits.
> +       */
> +
> +      pc = &c->FragmentProgram;
> +      pc->MaxNativeInstructions      = pc->MaxInstructions;
> +      pc->MaxNativeAluInstructions   = pc->MaxAluInstructions;
> +      pc->MaxNativeTexInstructions   = pc->MaxTexInstructions;
> +      pc->MaxNativeTexIndirections   = pc->MaxTexIndirections;
> +      pc->MaxNativeAttribs           = pc->MaxAttribs;
> +      pc->MaxNativeTemps             = pc->MaxTemps;
> +      pc->MaxNativeAddressRegs       = pc->MaxAddressRegs;
> +      pc->MaxNativeParameters        = pc->MaxParameters;
> +
> +      pc = &c->VertexProgram;
> +      pc->MaxNativeInstructions      = pc->MaxInstructions;
> +      pc->MaxNativeAluInstructions   = pc->MaxAluInstructions;
> +      pc->MaxNativeTexInstructions   = pc->MaxTexInstructions;
> +      pc->MaxNativeTexIndirections   = pc->MaxTexIndirections;
> +      pc->MaxNativeAttribs           = pc->MaxAttribs;
> +      pc->MaxNativeTemps             = pc->MaxTemps;
> +      pc->MaxNativeAddressRegs       = pc->MaxAddressRegs;
> +      pc->MaxNativeParameters        = pc->MaxParameters;
> +   } else if (screen->get_param(screen, PIPE_CAP_SM3)) {
> +      /*
> +       * Assume the hardware meets the minimum requirements
> +       * for Shader Model 3.
> +       *
> +       * See also:
> +       * - http://msdn.microsoft.com/en-us/library/bb172920(VS.85).aspx
> +       * - http://msdn.microsoft.com/en-us/library/bb172963(VS.85).aspx
> +       */
> +
> +      pc = &c->FragmentProgram;
> +      pc->MaxNativeInstructions      = 512; /* D3DMIN30SHADERINSTRUCTIONS */
> +      pc->MaxNativeAluInstructions   = pc->MaxNativeInstructions;
> +      pc->MaxNativeTexInstructions   = pc->MaxNativeInstructions;
> +      pc->MaxNativeTexIndirections   = pc->MaxNativeTexInstructions;
> +      pc->MaxNativeAttribs           = 10;
> +      pc->MaxNativeTemps             = 32;
> +      pc->MaxNativeAddressRegs       = 1; /* aL */
> +      pc->MaxNativeParameters        = 224;
> +
> +      pc = &c->VertexProgram;
> +      pc->MaxNativeInstructions      = 512; /* D3DMIN30SHADERINSTRUCTIONS */
> +      pc->MaxNativeAluInstructions   = pc->MaxNativeInstructions;
> +      pc->MaxNativeTexInstructions   = pc->MaxNativeInstructions;
> +      pc->MaxNativeTexIndirections   = pc->MaxNativeTexInstructions;
> +      pc->MaxNativeAttribs           = 16;
> +      pc->MaxNativeTemps             = 32;
> +      pc->MaxNativeAddressRegs       = 2; /* a0 and aL */
> +      pc->MaxNativeParameters        = 256;
> +   } else {
> +      /*
> +       * Assume the hardware meets the minimum requirements
> +       * for Shader Model 2.
> +       *
> +       * See also:
> +       * - http://msdn.microsoft.com/en-us/library/bb172918(VS.85).aspx
> +       * - http://msdn.microsoft.com/en-us/library/bb172961(VS.85).aspx
> +       */
> +
> +      pc = &c->FragmentProgram;
> +      pc->MaxNativeInstructions      = 96; /* D3DPS20_MIN_NUMINSTRUCTIONSLOTS */
> +      pc->MaxNativeAluInstructions   = 64;
> +      pc->MaxNativeTexInstructions   = 32;
> +      pc->MaxNativeTexIndirections   = pc->MaxNativeTexInstructions;
> +      pc->MaxNativeAttribs           = 10; /* 2 color + 8 texture coord */
> +      pc->MaxNativeTemps             = 12; /* D3DPS20_MIN_NUMTEMPS */
> +      pc->MaxNativeAddressRegs       = 0;
> +      pc->MaxNativeParameters        = 16;
> +
> +      pc = &c->VertexProgram;
> +      pc->MaxNativeInstructions      = 256;
> +      pc->MaxNativeAluInstructions   = 256;
> +      pc->MaxNativeTexInstructions   = 0;
> +      pc->MaxNativeTexIndirections   = 0;
> +      pc->MaxNativeAttribs           = 16;
> +      pc->MaxNativeTemps             = 12; /* D3DVS20_MIN_NUMTEMPS */
> +      pc->MaxNativeAddressRegs       = 2; /* a0 and aL */
> +      pc->MaxNativeParameters        = 256;
> +   }
> +
> +   if (!screen->get_param(screen, PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS)) {
> +      c->VertexProgram.MaxNativeTexInstructions = 0;
> +      c->VertexProgram.MaxNativeTexIndirections = 0;
> +   }
>  }
>  
> 
> 
> _______________________________________________
> mesa-commit mailing list
> mesa-commit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-commit




More information about the mesa-dev mailing list