gallium: new shader cap bit for the amount of sampler views
authorRoland Scheidegger <sroland@vmware.com>
Tue, 26 Nov 2013 01:30:41 +0000 (02:30 +0100)
committerRoland Scheidegger <sroland@vmware.com>
Thu, 28 Nov 2013 03:02:18 +0000 (04:02 +0100)
Ever since introducing separate sampler and sampler view max this was really
missing.
Every driver but llvmpipe reports the same number as number of samplers for
now, so nothing should break.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
15 files changed:
src/gallium/auxiliary/gallivm/lp_bld_limits.h
src/gallium/docs/source/screen.rst
src/gallium/drivers/freedreno/freedreno_screen.c
src/gallium/drivers/i915/i915_screen.c
src/gallium/drivers/ilo/ilo_screen.c
src/gallium/drivers/llvmpipe/lp_screen.c
src/gallium/drivers/nouveau/nv30/nv30_screen.c
src/gallium/drivers/nouveau/nv50/nv50_screen.c
src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r600/r600_pipe.c
src/gallium/drivers/radeonsi/radeonsi_pipe.c
src/gallium/drivers/softpipe/sp_screen.c
src/gallium/drivers/svga/svga_screen.c
src/gallium/include/pipe/p_defines.h

index 5675e367c4e118f1dee9ab7ff3f774909a22e63c..521b45b360af92f7ac918613a393afb4c026a307 100644 (file)
@@ -112,6 +112,8 @@ gallivm_get_shader_param(enum pipe_shader_cap param)
       return 1;
    case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
       return PIPE_MAX_SAMPLERS;
+   case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
+      return PIPE_MAX_SHADER_SAMPLER_VIEWS;
    case PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED:
       return 1;
    default:
index a01f5480f52be5c42d52b4c66b057a6744d9c860..035309da816738724abd5692013c3239194e576e 100644 (file)
@@ -247,10 +247,12 @@ to be 0.
   BGNSUB, ENDSUB, CAL, and RET, including RET in the main block.
 * ``PIPE_SHADER_CAP_INTEGERS``: Whether integer opcodes are supported.
   If unsupported, only float opcodes are supported.
-* ``PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS``: THe maximum number of texture
+* ``PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS``: The maximum number of texture
   samplers.
 * ``PIPE_SHADER_CAP_PREFERRED_IR``: Preferred representation of the
   program.  It should be one of the ``pipe_shader_ir`` enum values.
+* ``PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS``: The maximum number of texture
+  sampler views. Must not be lower than PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS.
 
 
 .. _pipe_compute_cap:
index 20adf21eec6b974b91b85369e574fa451c725108..5dafa927aabc36694e63d96b4e1acb2d6a6eb8bb 100644 (file)
@@ -323,6 +323,7 @@ fd_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
                 */
                return 0;
        case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
+       case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
                return 16;
        case PIPE_SHADER_CAP_PREFERRED_IR:
                return PIPE_SHADER_IR_TGSI;
index 77607d0621dbaf60c3eeb91c75a0b4ed297574f4..5e1e18def9161a00a11be8cf3a107d27508111ef 100644 (file)
@@ -106,6 +106,7 @@ i915_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_sha
    case PIPE_SHADER_VERTEX:
       switch (cap) {
       case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
+      case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
          if (debug_get_bool_option("DRAW_USE_LLVM", TRUE))
             return PIPE_MAX_SAMPLERS;
          else
@@ -151,6 +152,7 @@ i915_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_sha
       case PIPE_SHADER_CAP_INTEGERS:
          return 0;
       case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
+      case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
          return I915_TEX_UNITS;
       default:
          debug_printf("%s: Unknown cap %u.\n", __FUNCTION__, cap);
index a345b70b658048e09dae5bb8ade45f67f26cf13d..d6e3f94fb1883225e95ca7c264f1f3c49ab45e65 100644 (file)
@@ -141,6 +141,8 @@ ilo_get_shader_param(struct pipe_screen *screen, unsigned shader,
       return 1;
    case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
       return ILO_MAX_SAMPLERS;
+   case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
+      return ILO_MAX_SAMPLER_VIEWS;
    case PIPE_SHADER_CAP_PREFERRED_IR:
       return PIPE_SHADER_IR_TGSI;
    case PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED:
index f61df98fb9443045d2d01284a37e9887d0650097..81ebc69f4f5bbf97d70b61c5b52de52ee8cfab75 100644 (file)
@@ -262,6 +262,11 @@ llvmpipe_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe
             return PIPE_MAX_SAMPLERS;
          else
             return 0;
+      case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
+         if (debug_get_bool_option("DRAW_USE_LLVM", TRUE))
+            return PIPE_MAX_SHADER_SAMPLER_VIEWS;
+         else
+            return 0;
       default:
          return draw_get_shader_param(shader, param);
       }
index 807100ee0d087c79c930bc168837f8e1e910b295..26ff6812e50c44d1e8df5c3398c86724455624b2 100644 (file)
@@ -190,6 +190,7 @@ nv30_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
       case PIPE_SHADER_CAP_MAX_TEMPS:
          return (eng3d->oclass >= NV40_3D_CLASS) ? 32 : 13;
       case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
+      case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
          return 0;
       case PIPE_SHADER_CAP_MAX_ADDRS:
          return 2;
@@ -228,6 +229,7 @@ nv30_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
       case PIPE_SHADER_CAP_MAX_ADDRS:
          return (eng3d->oclass >= NV40_3D_CLASS) ? 1 : 0;
       case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
+      case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
          return 16;
       case PIPE_SHADER_CAP_MAX_PREDS:
       case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
index 0ce9e34f5e59100b797fb5f070a28177731e3052..f7dfc98b70bdbaa8f0a885cb4aa543c9a6a520f0 100644 (file)
@@ -250,6 +250,8 @@ nv50_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
    case PIPE_SHADER_CAP_INTEGERS:
       return 1;
    case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
+      /* The chip could handle more sampler views than samplers */
+   case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
       return MIN2(32, PIPE_MAX_SAMPLERS);
    default:
       NOUVEAU_ERR("unknown PIPE_SHADER_CAP %d\n", param);
index b203089ec08a19459b4948eb592fb07d7c518e02..cc5814e1f3e649f5a3353858dcd52ce0f29d29c0 100644 (file)
@@ -253,10 +253,8 @@ nvc0_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
       return 1;
    case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
       return 16; /* would be 32 in linked (OpenGL-style) mode */
-      /*
-   case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLER_VIEWS:
-      return 32;
-      */
+   case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
+      return 16; /* XXX not sure if more are really safe */
    default:
       NOUVEAU_ERR("unknown PIPE_SHADER_CAP %d\n", param);
       return 0;
index 476770afe449c47c925ef991dc2c410cc1c2c56c..c21ee68348bb1260405eb79dfccbc24d13af474c 100644 (file)
@@ -238,6 +238,7 @@ static int r300_get_shader_param(struct pipe_screen *pscreen, unsigned shader, e
         case PIPE_SHADER_CAP_MAX_PREDS:
             return is_r500 ? 1 : 0;
         case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
+        case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
            return r300screen->caps.num_tex_units;
         case PIPE_SHADER_CAP_MAX_ADDRS:
         case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
@@ -257,6 +258,7 @@ static int r300_get_shader_param(struct pipe_screen *pscreen, unsigned shader, e
         switch (param)
         {
         case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
+        case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
         case PIPE_SHADER_CAP_SUBROUTINES:
             return 0;
         default:;
@@ -297,6 +299,7 @@ static int r300_get_shader_param(struct pipe_screen *pscreen, unsigned shader, e
         case PIPE_SHADER_CAP_SUBROUTINES:
         case PIPE_SHADER_CAP_INTEGERS:
         case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
+        case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
             return 0;
         case PIPE_SHADER_CAP_PREFERRED_IR:
             return PIPE_SHADER_IR_TGSI;
index 633c22a1cce4ac33aad09add0272b7df429e97eb..5e1d26216acf025b38a9b6fb57a4d1de29012b72 100644 (file)
@@ -597,6 +597,7 @@ static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, e
        case PIPE_SHADER_CAP_INTEGERS:
                return 1;
        case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
+       case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
                return 16;
         case PIPE_SHADER_CAP_PREFERRED_IR:
                if (shader == PIPE_SHADER_COMPUTE) {
index e662e7886b44588c6a23aa5dc35545cd8bc0688f..1ff8c14369da5e2f25fb0fdbeb383d1714273a10 100644 (file)
@@ -492,6 +492,7 @@ static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, e
        case PIPE_SHADER_CAP_SUBROUTINES:
                return 0;
        case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
+       case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
                return 16;
        case PIPE_SHADER_CAP_PREFERRED_IR:
                return PIPE_SHADER_IR_TGSI;
index 47ef20ec59a179dd3e620034435f58d8a3b5683a..0ec0aad6714dede37974fb9aff69154c8dc24ef4 100644 (file)
@@ -204,13 +204,14 @@ softpipe_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe
    case PIPE_SHADER_GEOMETRY:
       switch (param) {
       case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
+      case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
          if (sp_screen->use_llvm)
             /* Softpipe doesn't yet know how to tell draw/llvm about textures */
             return 0;
-        else
+         else
             return PIPE_MAX_SAMPLERS;
       default:
-        if (sp_screen->use_llvm)
+         if (sp_screen->use_llvm)
             return draw_get_shader_param(shader, param);
          else
             return draw_get_shader_param_no_llvm(shader, param);
index c16be16a59f1248a01f6c81336df8e06d3f48089..977dec53dfe611b7dd1586342edb955a134faa9a 100644 (file)
@@ -332,6 +332,7 @@ static int svga_get_shader_param(struct pipe_screen *screen, unsigned shader, en
       case PIPE_SHADER_CAP_INTEGERS:
          return 0;
       case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
+      case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
          return 16;
       default:
          debug_printf("Unexpected fragment shader query %u\n", param);
@@ -382,6 +383,7 @@ static int svga_get_shader_param(struct pipe_screen *screen, unsigned shader, en
       case PIPE_SHADER_CAP_INTEGERS:
          return 0;
       case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
+      case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
          return 0;
       default:
          debug_printf("Unexpected vertex shader query %u\n", param);
index db6db32e744bc4062412e0185c48c5e1d2ef2fc3..7e71e7711827eef6e1e8290caba1fb1030e18c9b 100644 (file)
@@ -571,7 +571,8 @@ enum pipe_shader_cap
    PIPE_SHADER_CAP_INTEGERS = 17,
    PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS = 18,
    PIPE_SHADER_CAP_PREFERRED_IR = 19,
-   PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED = 20
+   PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED = 20,
+   PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS = 21
 };
 
 /**