gallium: Add MULTISAMPLE_Z_RESOLVE cap
authorAxel Davy <axel.davy@ens.fr>
Sat, 17 Jan 2015 13:30:17 +0000 (14:30 +0100)
committerAxel Davy <axel.davy@ens.fr>
Thu, 5 Feb 2015 23:07:18 +0000 (00:07 +0100)
Resolving a multisampled depth texture into
a single sampled texture is supported on >= SM4.1
hw. It is possible some previous hw support it.

The ability was tested on radeonsi and nvc0.
Apparently is is also supported for radeon >= r700.

This patch adds the MULTISAMPLE_Z_RESOLVE cap and
add it to the drivers. It is advertised for drivers
for which it is sure the ability is supported.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
15 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/vc4/vc4_screen.c
src/gallium/include/pipe/p_defines.h

index b72a372a6c3aeba5dae27d1f51f3e88587896c3f..5d80908057cd35581ae58a75b1202a801d3708c9 100644 (file)
@@ -243,6 +243,9 @@ The integer capabilities:
   this, at least BASEVERTEX should be exposed separately too).
 * ``PIPE_CAP_POLYGON_OFFSET_CLAMP``: If true, the driver implements support
   for ``pipe_rasterizer_state::offset_clamp``.
+* ``PIPE_CAP_MULTISAMPLE_Z_RESOLVE``: Whether the driver supports blitting
+  a multisampled depth buffer into a single-sampled texture (or depth buffer).
+  Only the first sampled should be copied.
 
 
 .. _pipe_capf:
index b7bb859327c69452fa3e7d77b7236ed576681cdc..1ce96d3ba95a9f7ac9d9b4499b8595a31b22d1cc 100644 (file)
@@ -230,6 +230,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
        case PIPE_CAP_CLIP_HALFZ:
        case PIPE_CAP_VERTEXID_NOBASE:
        case PIPE_CAP_POLYGON_OFFSET_CLAMP:
+       case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
                return 0;
 
        case PIPE_CAP_MAX_VIEWPORTS:
index bbc901eed846fd697f2cae620102e1064e08c856..2dcb50733523741375fc7c491eeb457b8e535c82 100644 (file)
@@ -228,6 +228,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
    case PIPE_CAP_CLIP_HALFZ:
    case PIPE_CAP_VERTEXID_NOBASE:
    case PIPE_CAP_POLYGON_OFFSET_CLAMP:
+   case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
       return 0;
 
    case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
index 5048ba1ac22b23b0e91c31d9d976b38956be078e..04c128352af8c40b000cb8136f498bf99098a671 100644 (file)
@@ -470,6 +470,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
    case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
    case PIPE_CAP_SAMPLER_VIEW_TARGET:
+   case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
       return 0;
 
    case PIPE_CAP_VENDOR_ID:
index 507cfcfaf98c6b4302a681bb0538ca14fa9d48bf..31c65df022ae270f8d77ce0691aa3afde958679b 100644 (file)
@@ -287,6 +287,8 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
       return 0;
    case PIPE_CAP_POLYGON_OFFSET_CLAMP:
       return 1;
+   case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
+      return 0;
    }
    /* should only get here on unhandled cases */
    debug_printf("Unexpected PIPE_CAP %d query\n", param);
index 0a403ba15ffe26fc56e10ed1a4919e615476c284..83cae7a173d7a80fd0227e4d57de3bb5c2294e1d 100644 (file)
@@ -159,6 +159,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_CLIP_HALFZ:
    case PIPE_CAP_VERTEXID_NOBASE:
    case PIPE_CAP_POLYGON_OFFSET_CLAMP:
+   case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
       return 0;
 
    case PIPE_CAP_VENDOR_ID:
index 072a7a240e450c5f046fa400529eee9198232fc5..222fa65b31f306f2daf63a8aea181505bafb4aaa 100644 (file)
@@ -207,6 +207,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_COMPUTE:
    case PIPE_CAP_DRAW_INDIRECT:
    case PIPE_CAP_VERTEXID_NOBASE:
+   case PIPE_CAP_MULTISAMPLE_Z_RESOLVE: /* potentially supported on some hw */
       return 0;
 
    case PIPE_CAP_VENDOR_ID:
index cba19db71174ca2ed41c859efd05a7b2005f0403..63fbad7a09599148ae3a628ea3fc0bc2d935103d 100644 (file)
@@ -173,6 +173,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_SAMPLER_VIEW_TARGET:
    case PIPE_CAP_CLIP_HALFZ:
    case PIPE_CAP_POLYGON_OFFSET_CLAMP:
+   case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
       return 1;
    case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE:
       return (class_3d >= NVE4_3D_CLASS) ? 1 : 0;
index 434f4c439426b0e3ae45e5c90cc6dc68cf6c0292..640d54723bf8f05814995de63d7bb2fba7ab160d 100644 (file)
@@ -183,6 +183,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
         case PIPE_CAP_SAMPLER_VIEW_TARGET:
         case PIPE_CAP_VERTEXID_NOBASE:
         case PIPE_CAP_POLYGON_OFFSET_CLAMP:
+        case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
             return 0;
 
         /* SWTCL-only features. */
index e3df024b0efca28ce854ff7e9e781d0082bc0227..60bed0e65f2de4e03531bd690c4b0716b4016c6a 100644 (file)
@@ -401,6 +401,8 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
                return rscreen->b.info.vram_size >> 20;
        case PIPE_CAP_UMA:
                return 0;
+       case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
+               return rscreen->b.chip_class >= R700;
        }
        return 0;
 }
index aac3363b1068c0a311b3dadc0ab8609f9f3b76e9..26182c25a41793ec159d2051d73e18aec2814e35 100644 (file)
@@ -229,6 +229,7 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
        case PIPE_CAP_CLIP_HALFZ:
        case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
        case PIPE_CAP_POLYGON_OFFSET_CLAMP:
+       case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
                return 1;
 
        case PIPE_CAP_TEXTURE_MULTISAMPLE:
index 9aefb882b1332de342da20a4ce46807d8f40daf7..365fc0a1db9ebd7b29a9dcc7b01bcfafefd91df3 100644 (file)
@@ -235,6 +235,8 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
       return 0;
    case PIPE_CAP_POLYGON_OFFSET_CLAMP:
       return 0;
+   case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
+      return 0;
    }
    /* should only get here on unhandled cases */
    debug_printf("Unexpected PIPE_CAP %d query\n", param);
index 9e190e2b014f5f7d33b9f689fc21719a8ff7c6d6..e3db4a8b447c03876c8cab415a9cfac19117c587 100644 (file)
@@ -284,6 +284,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_CLIP_HALFZ:
    case PIPE_CAP_VERTEXID_NOBASE:
    case PIPE_CAP_POLYGON_OFFSET_CLAMP:
+   case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
       return 0;
    case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
       return 64;
index 9b5d7ba166c93c3e832a02b89691c7b0ffe6a8e6..db88eaa5bb46e1d9732bd60b10ea47b7cbc8629a 100644 (file)
@@ -171,6 +171,7 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
         case PIPE_CAP_CLIP_HALFZ:
         case PIPE_CAP_VERTEXID_NOBASE:
         case PIPE_CAP_POLYGON_OFFSET_CLAMP:
+        case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
                 return 0;
 
                 /* Stream output. */
index fd32c4aaeafacd56eda4bc59ad0a32873eab2067..7ce25af20c85b345af2db03d6a5f33a9c798ea36 100644 (file)
@@ -574,6 +574,7 @@ enum pipe_cap {
    PIPE_CAP_CLIP_HALFZ = 111,
    PIPE_CAP_VERTEXID_NOBASE = 112,
    PIPE_CAP_POLYGON_OFFSET_CLAMP = 113,
+   PIPE_CAP_MULTISAMPLE_Z_RESOLVE = 114,
 };
 
 #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)