gallium: add PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE for GL
authorMarek Olšák <maraeo@gmail.com>
Thu, 2 May 2013 01:24:33 +0000 (03:24 +0200)
committerMarek Olšák <maraeo@gmail.com>
Sat, 11 May 2013 21:45:01 +0000 (23:45 +0200)
v2: fix typo 65535 -> 65536

Reviewed-by: Brian Paul <brianp@vmware.com>
12 files changed:
src/gallium/docs/source/screen.rst
src/gallium/drivers/llvmpipe/lp_screen.c
src/gallium/drivers/nv30/nv30_screen.c
src/gallium/drivers/nv50/nv50_screen.c
src/gallium/drivers/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
src/mesa/state_tracker/st_extensions.c

index 3ab7e9e6906d49cdcf68602829a135537c152691..2630491d0615547b3271b7734633e2b055d5b935 100644 (file)
@@ -162,6 +162,8 @@ The integer capabilities:
   state should be swizzled manually according to the swizzle in the sampler
   view it is intended to be used with, or herein undefined results may occur
   for permutational swizzles.
+* ``PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE``: The maximum accessible size with
+  a buffer sampler view, in bytes.
 
 
 .. _pipe_capf:
index 667ade1e66790176db2fa55277ec61720024276c..04493529f91c3dd6be105e43f9728bbae9180aca 100644 (file)
@@ -224,6 +224,8 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
       return 0;
    case PIPE_CAP_TEXTURE_BUFFER_OBJECTS:
       return 1;
+   case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE:
+      return 65536;
    case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT:
       return 1;
    case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER:
index d9b824d6df981a9ce9a4dc7c3d787975b3bc46fa..c9943e0a9cff29513496445a2cf589fa0cc51166 100644 (file)
@@ -124,6 +124,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT:
    case PIPE_CAP_QUERY_PIPELINE_STATISTICS:
    case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
+   case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE:
       return 0;
    case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY:
    case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
index 9575c454a55e0bb9fcd4689e0d55f5e2579f6ea9..b6da3034ad0e50ccc648a574f1a808b8be6588e1 100644 (file)
@@ -105,6 +105,8 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_SCALED_RESOLVE:
    case PIPE_CAP_TEXTURE_BUFFER_OBJECTS:
       return 1;
+   case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE:
+      return 65536;
    case PIPE_CAP_SEAMLESS_CUBE_MAP:
       return nv50_screen(pscreen)->tesla->oclass >= NVA0_3D_CLASS;
    case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE:
index 046dd6bee61e6246732bc5629187d0799ede5a00..97ce82cfc850e8182bdc2f962e5d4f9609c8360d 100644 (file)
@@ -104,6 +104,8 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_TEXTURE_BUFFER_OBJECTS:
    case PIPE_CAP_TEXTURE_MULTISAMPLE:
       return 1;
+   case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE:
+      return 65536;
    case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE:
       return (class_3d >= NVE4_3D_CLASS) ? 1 : 0;
    case PIPE_CAP_TWO_SIDED_STENCIL:
index a932be9b41d54b9582552a7435e9a2c1aee49b09..e58916b3022daf900a0fa732975af605ce746a01 100644 (file)
@@ -163,6 +163,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
         case PIPE_CAP_TEXTURE_BUFFER_OBJECTS:
         case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT:
         case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
+        case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE:
             return 0;
 
         /* SWTCL-only features. */
index e7b515234538e481ceb83c801a5c2302ad4cd31a..47cdb9e49265c34aad73cc111b892eb6ad63c975 100644 (file)
@@ -595,6 +595,9 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
        case PIPE_CAP_TGSI_TEXCOORD:
                return 0;
 
+       case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE:
+               return MIN2(rscreen->info.vram_size, 0xFFFFFFFF);
+
         case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
                 return R600_MAP_BUFFER_ALIGNMENT;
 
index 4f4c1448056c8805550497bb652152e4252b3b50..0e6b94176526626c6e99a62917df916b3d1e8274 100644 (file)
@@ -381,6 +381,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
        case PIPE_CAP_TEXTURE_BUFFER_OBJECTS:
        case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT:
        case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
+        case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE:
                return 0;
 
        /* Stream output. */
index 53ee7d31cab6b2952b1235bae03400545ed51df7..fe5de17ff6599eaffb94019c937f60abe31ee052 100644 (file)
@@ -175,6 +175,8 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
       return 1;
    case PIPE_CAP_TEXTURE_BUFFER_OBJECTS:
       return 1;
+   case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE:
+      return 65536;
    case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT:
       return 0;
    case PIPE_CAP_TGSI_TEXCOORD:
index 60e0442944b67859588e29cb18f5bbf07883238e..cdd462e8d9aa36ac25677d42dc3874807dd8ad39 100644 (file)
@@ -265,6 +265,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_TEXTURE_BUFFER_OBJECTS:
    case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT:
    case PIPE_CAP_QUERY_PIPELINE_STATISTICS:
+   case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE:
       return 0;
    case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY:
       return 1;
index 2d38ce1a8c4a8edfc9f0a14504730039a2eb5cc5..bb8696895fb2921d15de3bb239dd54d11da89f7e 100644 (file)
@@ -506,7 +506,8 @@ enum pipe_cap {
    PIPE_CAP_TGSI_TEXCOORD = 79,
    PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER = 80,
    PIPE_CAP_QUERY_PIPELINE_STATISTICS = 81,
-   PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK = 82
+   PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK = 82,
+   PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE = 83
 };
 
 #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
index 0aac086cf432c628dc201d89c11767623e035750..43fba0105e95dcbe8be025404cbab633c63105cf 100644 (file)
@@ -39,7 +39,7 @@
 #include "st_extensions.h"
 #include "st_format.h"
 
-static int _min(int a, int b)
+static unsigned _min(unsigned a, unsigned b)
 {
    return (a < b) ? a : b;
 }
@@ -744,6 +744,9 @@ void st_init_extensions(struct st_context *st)
    if (screen->get_param(screen, PIPE_CAP_TEXTURE_BUFFER_OBJECTS)) {
       ctx->Extensions.ARB_texture_buffer_object = GL_TRUE;
 
+      ctx->Const.MaxTextureBufferSize =
+         _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE),
+              (1u << 31) - 1);
       ctx->Const.TextureBufferOffsetAlignment =
          screen->get_param(screen, PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT);