gallium: Add a pipe cap for whether primitive restart works for patches.
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 21 May 2016 04:05:34 +0000 (21:05 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 23 May 2016 23:44:11 +0000 (16:44 -0700)
Some hardware supports primitive restart on patch primitives, and other
hardware does not.  Modern GL and ES include a query for this feature;
adding a capability bit will allow us to answer it.

As far as I know, AMD hardware does not support this feature, while
NVIDIA and Intel hardware does.  However, most Gallium drivers do not
appear to support tessellation shaders yet.  So, I've enabled it for
nvc0 and disabled it everywhere else.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
17 files changed:
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/si_pipe.c
src/gallium/drivers/softpipe/sp_screen.c
src/gallium/drivers/svga/svga_screen.c
src/gallium/drivers/swr/swr_screen.cpp
src/gallium/drivers/vc4/vc4_screen.c
src/gallium/drivers/virgl/virgl_screen.c
src/gallium/include/pipe/p_defines.h

index 315a6a1566aa0db03de3dc8e78d3ec34c46a10b6..920da42768d8a16fed47d74cec1af004371a358b 100644 (file)
@@ -338,6 +338,8 @@ The integer capabilities:
   and accesses to unbound resources.
 * ``PIPE_CAP_CULL_DISTANCE``: Whether the driver supports the arb_cull_distance
   extension and thus implements proper support for culling planes.
+* ``PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES``: Whether primitive restart is
+  supported for patch primitives.
 
 
 .. _pipe_capf:
index 32db3e2ed963db3ad075bb2234929eb913220209..ad15aab87c7df1709fffb37b00b2203375058f04 100644 (file)
@@ -261,6 +261,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
        case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
        case PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR:
        case PIPE_CAP_CULL_DISTANCE:
+       case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES:
                return 0;
 
        case PIPE_CAP_MAX_VIEWPORTS:
index 802b25f2468efdd0a2a1cb23eb1d7d3ac6177350..c0e06e5067c64818cedceaa515a1bb46b6288972 100644 (file)
@@ -272,6 +272,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
    case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
    case PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR:
    case PIPE_CAP_CULL_DISTANCE:
+   case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES:
       return 0;
 
    case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
index ddeebc982e626b9f0b18770ac441543cc0f22787..c847a9067fa1be884761ce159e7ebe7f23e5a93c 100644 (file)
@@ -501,6 +501,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
    case PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR:
    case PIPE_CAP_CULL_DISTANCE:
+   case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES:
       return 0;
 
    case PIPE_CAP_VENDOR_ID:
index 6aef5c97fd872a2a34297821a057fabc5f99564c..5371c4116304972bb7729f7d72a51f8a3fed829c 100644 (file)
@@ -323,6 +323,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_PCI_FUNCTION:
    case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
    case PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR:
+   case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES:
       return 0;
    }
    /* should only get here on unhandled cases */
index a615cdeac4608ec71b655af97f04d2996fcd3bd1..983221113eeef6cc4e0e953181779723269b6b5c 100644 (file)
@@ -195,6 +195,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
    case PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR:
    case PIPE_CAP_CULL_DISTANCE:
+   case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES:
       return 0;
 
    case PIPE_CAP_VENDOR_ID:
index bad19f301f466a1215cc87a4599cff0facf76334..8456d7e93ef1bc12aef65f09d4412715ff5c063e 100644 (file)
@@ -248,6 +248,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_PCI_FUNCTION:
    case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
    case PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR:
+   case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES:
       return 0;
 
    case PIPE_CAP_VENDOR_ID:
index 956b39d3393940886e3c01ec104953da439366c5..8c06061c620b7f605713743d6a0d1d491ef70d48 100644 (file)
@@ -228,6 +228,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_STRING_MARKER:
    case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
    case PIPE_CAP_CULL_DISTANCE:
+   case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES:
       return 1;
    case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE:
       return (class_3d >= NVE4_3D_CLASS) ? 1 : 0;
index 47dc275104ff81d9f9991289de1d837203888470..c4a8db3be77f1968595113af9908f0a761b566b0 100644 (file)
@@ -217,6 +217,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
         case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
        case PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR:
         case PIPE_CAP_CULL_DISTANCE:
+        case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES:
             return 0;
 
         /* SWTCL-only features. */
index 06207274502f3e791e738f35a091170f5786ebb9..846513b8199f3a4d55436ddc1731f1374574e997 100644 (file)
@@ -367,6 +367,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
        case PIPE_CAP_QUERY_BUFFER_OBJECT:
        case PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR:
        case PIPE_CAP_CULL_DISTANCE:
+       case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES:
                return 0;
 
        case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
index 74121946a7a618543c61a9ea2c8871e968fa3193..6700590dfacf903f9ed3910838033315e152e8de 100644 (file)
@@ -392,6 +392,7 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
        case PIPE_CAP_STRING_MARKER:
        case PIPE_CAP_QUERY_BUFFER_OBJECT:
        case PIPE_CAP_CULL_DISTANCE:
+       case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES:
                return 0;
 
        case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
index e7e89a4ea7f454fc6b5787d0e49d0339ee10184c..3a40ef7f86c22440b6ed97fda54d88bdc887d6a4 100644 (file)
@@ -273,6 +273,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_PCI_DEVICE:
    case PIPE_CAP_PCI_FUNCTION:
    case PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR:
+   case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES:
       return 0;
    case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT:
       return 4;
index 9f4dbb89489017f2e9aba2141f469dea1b54c78f..173873f35438788417108b6dd9968bfda8601d55 100644 (file)
@@ -407,6 +407,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_QUERY_BUFFER_OBJECT:
    case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
    case PIPE_CAP_CULL_DISTANCE:
+   case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES:
       return 0;
    }
 
index 196f6dc801b7ee2fcdae0f651c72bd2298205f58..07722746ea43e4465efdb40aebf6558dd3aa52ff 100644 (file)
@@ -359,6 +359,7 @@ swr_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_PCI_FUNCTION:
    case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
    case PIPE_CAP_CULL_DISTANCE:
+   case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES:
       return 0;
    }
 
index 1e311117ad33daa4eb3d131d6a9eb545353dc728..5ab1682b25a50f30c65dee8f4a4bf9c7e09bdc6d 100644 (file)
@@ -210,6 +210,7 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
         case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
         case PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR:
         case PIPE_CAP_CULL_DISTANCE:
+        case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES:
                 return 0;
 
                 /* Stream output. */
index cae937a9bf25d7374a3adf16d65ce03801ad5623..73f9f8d2ed11c7475caff5837716df1efb9f073a 100644 (file)
@@ -242,6 +242,7 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
    case PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR:
    case PIPE_CAP_CULL_DISTANCE:
+   case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES:
       return 0;
    case PIPE_CAP_VENDOR_ID:
       return 0x1af4;
index c23102258a944d62c54b0bca5112384d9a8f834a..aba5afb1eef0a5594e6a7ecdee9aa71aed949cbe 100644 (file)
@@ -727,6 +727,7 @@ enum pipe_cap
    PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT,
    PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR,
    PIPE_CAP_CULL_DISTANCE,
+   PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES,
 };
 
 #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)