gallium: rename shader cap MAX_CONSTS to MAX_CONST_BUFFER_SIZE
authorMarek Olšák <marek.olsak@amd.com>
Thu, 24 Jul 2014 18:32:08 +0000 (20:32 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 28 Jul 2014 21:57:08 +0000 (23:57 +0200)
This new name isn't so confusing.

I also changed the gallivm limit, because it looked wrong.

Reviewed-by: Brian Paul <brianp@vmware.com>
v2: use sizeof(float[4])

18 files changed:
src/gallium/auxiliary/gallivm/lp_bld_limits.h
src/gallium/auxiliary/tgsi/tgsi_exec.h
src/gallium/auxiliary/util/u_caps.c
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/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/r600/r600_pipe.h
src/gallium/drivers/radeonsi/si_pipe.c
src/gallium/drivers/svga/svga_screen.c
src/gallium/include/pipe/p_defines.h
src/gallium/state_trackers/clover/core/device.cpp
src/mesa/state_tracker/st_extensions.c

index 9ccaf46ead229e896cfd95bedf970fdf285fcdba..eb83ea88516067da87d0aed39bc7aa57131f6ea4 100644 (file)
@@ -97,8 +97,8 @@ gallivm_get_shader_param(enum pipe_shader_cap param)
       return LP_MAX_TGSI_NESTING;
    case PIPE_SHADER_CAP_MAX_INPUTS:
       return PIPE_MAX_SHADER_INPUTS;
-   case PIPE_SHADER_CAP_MAX_CONSTS:
-      return 16 * 2024;
+   case PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE:
+      return sizeof(float[4]) * 4096;
    case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
       return PIPE_MAX_CONSTANT_BUFFERS;
    case PIPE_SHADER_CAP_MAX_TEMPS:
index 56a7034a313c36080041c3eb5f9d40c945bd35ec..c6fd3d7d112b79c6ada5f1e8f7c5d2f266570dbe 100644 (file)
@@ -215,9 +215,9 @@ struct tgsi_sampler
  */
 #define TGSI_EXEC_MAX_INPUT_ATTRIBS PIPE_MAX_SHADER_INPUTS
 
-/* The maximum number of constant vectors per constant buffer.
+/* The maximum number of bytes per constant buffer.
  */
-#define TGSI_EXEC_MAX_CONST_BUFFER  4096
+#define TGSI_EXEC_MAX_CONST_BUFFER_SIZE  (4096 * sizeof(float[4]))
 
 /* The maximum number of vertices per primitive */
 #define TGSI_MAX_PRIM_VERTICES 6
@@ -427,8 +427,8 @@ tgsi_exec_get_shader_param(enum pipe_shader_cap param)
       return TGSI_EXEC_MAX_NESTING;
    case PIPE_SHADER_CAP_MAX_INPUTS:
       return TGSI_EXEC_MAX_INPUT_ATTRIBS;
-   case PIPE_SHADER_CAP_MAX_CONSTS:
-      return TGSI_EXEC_MAX_CONST_BUFFER;
+   case PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE:
+      return TGSI_EXEC_MAX_CONST_BUFFER_SIZE;
    case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
       return PIPE_MAX_CONSTANT_BUFFERS;
    case PIPE_SHADER_CAP_MAX_TEMPS:
index 6230707552e87bdc537a989597ff61343ee55fe0..ec8938b374d511677d301ef4e8b7b62ba13a1968 100644 (file)
@@ -198,13 +198,13 @@ static unsigned caps_sm3[] = {
     UTIL_CHECK_SHADER(FRAGMENT, MAX_INPUTS, 10),
     UTIL_CHECK_SHADER(FRAGMENT, MAX_TEMPS, 32),
     UTIL_CHECK_SHADER(FRAGMENT, MAX_ADDRS, 1),
-    UTIL_CHECK_SHADER(FRAGMENT, MAX_CONSTS, 224),
+    UTIL_CHECK_SHADER(FRAGMENT, MAX_CONST_BUFFER_SIZE, 224 * 16),
 
     UTIL_CHECK_SHADER(VERTEX, MAX_INSTRUCTIONS, 512),
     UTIL_CHECK_SHADER(VERTEX, MAX_INPUTS, 16),
     UTIL_CHECK_SHADER(VERTEX, MAX_TEMPS, 32),
     UTIL_CHECK_SHADER(VERTEX, MAX_ADDRS, 2),
-    UTIL_CHECK_SHADER(VERTEX, MAX_CONSTS, 256),
+    UTIL_CHECK_SHADER(VERTEX, MAX_CONST_BUFFER_SIZE, 256 * 16),
 
     UTIL_CHECK_TERMINATE
 };
index 830a1a59393bcee8bd74ef57ab422846a94f42ae..74cecc23b0e3c68a38eff6ae48f060c5e8b256cb 100644 (file)
@@ -250,7 +250,7 @@ support different features.
 * ``PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS``: The maximum number of texture indirections.
 * ``PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH``: The maximum nested control flow depth.
 * ``PIPE_SHADER_CAP_MAX_INPUTS``: The maximum number of input registers.
-* ``PIPE_SHADER_CAP_MAX_CONSTS``: The maximum number of constants.
+* ``PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE``: The maximum size per constant buffer in bytes.
 * ``PIPE_SHADER_CAP_MAX_CONST_BUFFERS``: Maximum number of constant buffers that can be bound
   to any shader stage using ``set_constant_buffer``. If 0 or 1, the pipe will
   only permit binding one constant buffer per shader, and the shaders will
index d4a928a7c1a2d052a3430966d42a41fcfaacb9bf..8fae5dddabacb8e708375640e60d32e1947450ce 100644 (file)
@@ -329,8 +329,8 @@ fd_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
                return 64; /* Max native temporaries. */
        case PIPE_SHADER_CAP_MAX_ADDRS:
                return 1; /* Max native address registers */
-       case PIPE_SHADER_CAP_MAX_CONSTS:
-               return (screen->gpu_id >= 300) ? 1024 : 64;
+       case PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE:
+               return ((screen->gpu_id >= 300) ? 1024 : 64) * sizeof(float[4]);
        case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
                return 1;
        case PIPE_SHADER_CAP_MAX_PREDS:
index 86a7a6731f1795cc08704a41ab6d3d83078e6b31..133c773a0bedb27a45d7e158a78a1198c04ed8cd 100644 (file)
@@ -129,8 +129,8 @@ i915_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_sha
          return 0;
       case PIPE_SHADER_CAP_MAX_INPUTS:
          return 10;
-      case PIPE_SHADER_CAP_MAX_CONSTS:
-         return 32;
+      case PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE:
+         return 32 * sizeof(float[4]);
       case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
          return 1;
       case PIPE_SHADER_CAP_MAX_TEMPS:
index d22691101d94d865e8333fbfedbc828a07ef09a2..fde4cc4f34c9eed31560f46498700acf9c16b6f4 100644 (file)
@@ -116,8 +116,8 @@ ilo_get_shader_param(struct pipe_screen *screen, unsigned shader,
    case PIPE_SHADER_CAP_MAX_INPUTS:
       /* this is limited by how many attributes SF can remap */
       return 16;
-   case PIPE_SHADER_CAP_MAX_CONSTS:
-      return 1024;
+   case PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE:
+      return 1024 * sizeof(float[4]);
    case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
       return ILO_MAX_CONST_BUFFERS;
    case PIPE_SHADER_CAP_MAX_TEMPS:
index 32f55236c48152fa43b7dad1b01e893dbf6fc0d4..4fa34e372f779ceea11931c30f3026414df72206 100644 (file)
@@ -198,8 +198,8 @@ nv30_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
          return 0;
       case PIPE_SHADER_CAP_MAX_INPUTS:
          return 16;
-      case PIPE_SHADER_CAP_MAX_CONSTS:
-         return (eng3d->oclass >= NV40_3D_CLASS) ? (468 - 6): (256 - 6);
+      case PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE:
+         return ((eng3d->oclass >= NV40_3D_CLASS) ? (468 - 6): (256 - 6)) * sizeof(float[4]);
       case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
          return 1;
       case PIPE_SHADER_CAP_MAX_TEMPS:
@@ -235,8 +235,8 @@ nv30_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
          return 0;
       case PIPE_SHADER_CAP_MAX_INPUTS:
          return 8; /* should be possible to do 10 with nv4x */
-      case PIPE_SHADER_CAP_MAX_CONSTS:
-         return (eng3d->oclass >= NV40_3D_CLASS) ? 224 : 32;
+      case PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE:
+         return ((eng3d->oclass >= NV40_3D_CLASS) ? 224 : 32) * sizeof(float[4]);
       case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
          return 1;
       case PIPE_SHADER_CAP_MAX_TEMPS:
index fd63819c397c36a93ae2fa251473b988657d9cf0..677f688f4455676a4cdd0fc5b1a99b1cd9ee4cd9 100644 (file)
@@ -232,8 +232,8 @@ nv50_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
       if (shader == PIPE_SHADER_VERTEX)
          return 32;
       return 15;
-   case PIPE_SHADER_CAP_MAX_CONSTS:
-      return 65536 / 16;
+   case PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE:
+      return 65536;
    case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
       return NV50_MAX_PIPE_CONSTBUFS;
    case PIPE_SHADER_CAP_MAX_ADDRS:
index 3f444a4f57d79fed48cc0303e7e50e025a9b565c..24aee6b5ab7d378fee74ef5cab0374f6cd30416d 100644 (file)
@@ -238,8 +238,8 @@ nvc0_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
        * and excludes 0x60 per-patch inputs.
        */
       return 0x200 / 16;
-   case PIPE_SHADER_CAP_MAX_CONSTS:
-      return 65536 / 16;
+   case PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE:
+      return 65536;
    case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
       if (shader == PIPE_SHADER_COMPUTE && class_3d >= NVE4_3D_CLASS)
          return NVE4_MAX_PIPE_CONSTBUFS_COMPUTE;
index efa69d3575e4d127580af41a26a0634efcec8eb1..a2ac26ad79ccfad4d864443ef4e9245284384beb 100644 (file)
@@ -241,8 +241,8 @@ static int r300_get_shader_param(struct pipe_screen *pscreen, unsigned shader, e
              * additional texcoords but there is no two-sided color
              * selection then. However the facing bit can be used instead. */
             return 10;
-        case PIPE_SHADER_CAP_MAX_CONSTS:
-            return is_r500 ? 256 : 32;
+        case PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE:
+            return (is_r500 ? 256 : 32) * sizeof(float[4]);
         case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
             return 1;
         case PIPE_SHADER_CAP_MAX_TEMPS:
@@ -289,8 +289,8 @@ static int r300_get_shader_param(struct pipe_screen *pscreen, unsigned shader, e
             return is_r500 ? 4 : 0; /* For loops; not sure about conditionals. */
         case PIPE_SHADER_CAP_MAX_INPUTS:
             return 16;
-        case PIPE_SHADER_CAP_MAX_CONSTS:
-            return 256;
+        case PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE:
+            return 256 * sizeof(float[4]);
         case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
             return 1;
         case PIPE_SHADER_CAP_MAX_TEMPS:
index ee6a4160dd10463a534828e5e02ddf5edae609c8..f243159982e11fcd119da798b1a83129553a8a24 100644 (file)
@@ -419,7 +419,7 @@ static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, e
        case PIPE_SHADER_CAP_MAX_ADDRS:
                /* XXX Isn't this equal to TEMPS? */
                return 1; /* Max native address registers */
-       case PIPE_SHADER_CAP_MAX_CONSTS:
+       case PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE:
                return R600_MAX_CONST_BUFFER_SIZE;
        case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
                return R600_MAX_USER_CONST_BUFFERS;
index 4585ace155e5f55f0ce86d310a920ed43c0c43a3..6422e3ee70e0883bb31b2ca711b0b18cb12cb250 100644 (file)
@@ -54,7 +54,7 @@
 #define R600_BUFFER_INFO_CONST_BUFFER (R600_MAX_USER_CONST_BUFFERS + 2)
 #define R600_GS_RING_CONST_BUFFER (R600_MAX_USER_CONST_BUFFERS + 3)
 
-#define R600_MAX_CONST_BUFFER_SIZE 4096
+#define R600_MAX_CONST_BUFFER_SIZE (4096 * sizeof(float[4]))
 
 #ifdef PIPE_ARCH_BIG_ENDIAN
 #define R600_BIG_ENDIAN 1
index 4f1926872897f05edb9d6003cbb2b3c1e030e8bc..635b37d81c620b081a07cf262dc52712f716bf87 100644 (file)
@@ -350,8 +350,8 @@ static int si_get_shader_param(struct pipe_screen* pscreen, unsigned shader, enu
        case PIPE_SHADER_CAP_MAX_ADDRS:
                /* FIXME Isn't this equal to TEMPS? */
                return 1; /* Max native address registers */
-       case PIPE_SHADER_CAP_MAX_CONSTS:
-               return 4096; /* actually only memory limits this */
+       case PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE:
+               return 4096 * sizeof(float[4]); /* actually only memory limits this */
        case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
                return SI_NUM_USER_CONST_BUFFERS;
        case PIPE_SHADER_CAP_MAX_PREDS:
index b213b04bacd7b7f02636270c491890a388b89854..9326c777526a5c2732712c9ddce1d6d38b17aeb6 100644 (file)
@@ -313,8 +313,8 @@ static int svga_get_shader_param(struct pipe_screen *screen, unsigned shader, en
          return SVGA3D_MAX_NESTING_LEVEL;
       case PIPE_SHADER_CAP_MAX_INPUTS:
          return 10;
-      case PIPE_SHADER_CAP_MAX_CONSTS:
-         return 224;
+      case PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE:
+         return 224 * sizeof(float[4]);
       case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
          return 1;
       case PIPE_SHADER_CAP_MAX_TEMPS:
@@ -371,8 +371,8 @@ static int svga_get_shader_param(struct pipe_screen *screen, unsigned shader, en
          return SVGA3D_MAX_NESTING_LEVEL;
       case PIPE_SHADER_CAP_MAX_INPUTS:
          return 16;
-      case PIPE_SHADER_CAP_MAX_CONSTS:
-         return 256;
+      case PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE:
+         return 256 * sizeof(float[4]);
       case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
          return 1;
       case PIPE_SHADER_CAP_MAX_TEMPS:
index 43bb1f57670b70dadece2964b230ad6c1f793d29..2caacc4e635c89f6395b7c4b0529648e29de6abd 100644 (file)
@@ -604,7 +604,7 @@ enum pipe_shader_cap
    PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS,
    PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH,
    PIPE_SHADER_CAP_MAX_INPUTS,
-   PIPE_SHADER_CAP_MAX_CONSTS,
+   PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE,
    PIPE_SHADER_CAP_MAX_CONST_BUFFERS,
    PIPE_SHADER_CAP_MAX_TEMPS,
    PIPE_SHADER_CAP_MAX_ADDRS,
index 63aa1935c7f56182e8246868060ddbaacb2e498b..12c9584854b214a83cf77ebf1a62f5bdef4ad541 100644 (file)
@@ -136,7 +136,7 @@ device::max_mem_input() const {
 cl_ulong
 device::max_const_buffer_size() const {
    return pipe->get_shader_param(pipe, PIPE_SHADER_COMPUTE,
-                                 PIPE_SHADER_CAP_MAX_CONSTS) * 16;
+                                 PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE);
 }
 
 cl_uint
index aa59fbfa986834c328dae110257ae73862eb5235..7ac484056de7527af305f9cf70c14add08ecf80e 100644 (file)
@@ -146,7 +146,7 @@ void st_init_limits(struct st_context *st)
 
    c->MaxUniformBlockSize =
       screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT,
-                               PIPE_SHADER_CAP_MAX_CONSTS) * 16;
+                               PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE);
    if (c->MaxUniformBlockSize < 16384) {
       can_ubo = FALSE;
    }
@@ -194,7 +194,8 @@ void st_init_limits(struct st_context *st)
          _min(screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_ADDRS),
               MAX_PROGRAM_ADDRESS_REGS);
       pc->MaxParameters      = pc->MaxNativeParameters      =
-         screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_CONSTS);
+         screen->get_shader_param(screen, sh,
+                   PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE) / sizeof(float[4]);
 
       pc->MaxUniformComponents = 4 * MIN2(pc->MaxNativeParameters, MAX_UNIFORMS);