gallium: add PIPE_CAP_TGSI_CAN_READ_OUTPUTS
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 18 Nov 2016 19:49:54 +0000 (20:49 +0100)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 30 Nov 2016 08:09:50 +0000 (09:09 +0100)
Drivers that support this benefit by saving one lowering pass in the
GLSL-to-TGSI conversion.

radeonsi already supports this because all outputs are stored in temporary
variables before the export (except for TCS outputs, which have always
been readable in TGSI anyway due to their special semantics).

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 33f233a4cb5ba0f7a86c5fef2eeb95c41745dcb5..7ac39ffc44ff540cdf186bb1313d82788bc63d9f 100644 (file)
@@ -364,6 +364,8 @@ The integer capabilities:
 * ``PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS``: Whether interleaved stream
   output mode is able to interleave across buffers. This is required for
   ARB_transform_feedback3.
+* ``PIPE_CAP_TGSI_CAN_READ_OUTPUTS``: Whether every TGSI shader stage can read
+  from the output file.
 
 
 .. _pipe_capf:
index 4fe9a36fa1ca957d076b6e46df5672b598e47c29..fb35742f2c04438a958d00099c98867df6e72c33 100644 (file)
@@ -288,6 +288,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
        case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
        case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
        case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
+       case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
                return 0;
 
        case PIPE_CAP_MAX_VIEWPORTS:
index bfadca320570d408141d9176afd9624426bc1638..fa19b8bb0e70f31048ef50da054dc59e7327cf32 100644 (file)
@@ -294,6 +294,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
    case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
    case PIPE_CAP_SAMPLER_VIEW_TARGET:
    case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
+   case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
       return 0;
 
    case PIPE_CAP_MAX_VIEWPORTS:
index f3f182cad5d15f36d73dd35c2086afe4f13082fe..3fce936cde228eb1001f236ccef50bf51830760b 100644 (file)
@@ -517,6 +517,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
    case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
    case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
+   case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
       return 0;
 
    case PIPE_CAP_VENDOR_ID:
index 4b502f0631d56e28e14e3839ee1a60e3098b436f..2d75f2d403cb7a2468294991a5ce0fe6df45cb1c 100644 (file)
@@ -338,6 +338,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_MAX_WINDOW_RECTANGLES:
    case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
    case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
+   case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
       return 0;
    }
    /* should only get here on unhandled cases */
index 126c2074bb67573c5be7f195c13ddd11db3760a0..b4b7a200b64b48c4a657ec9fe0cd335ad3645128 100644 (file)
@@ -203,6 +203,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
    case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
    case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
+   case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
       return 0;
 
    case PIPE_CAP_VENDOR_ID:
index 4cf4d2ad933aeefff497aed45c72921fa14e2a3d..60dfddc1552b764fc92d20f730fd3c83a61e8a6f 100644 (file)
@@ -255,6 +255,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
    case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
    case PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS:
+   case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
       return 0;
 
    case PIPE_CAP_VENDOR_ID:
index 68e3ab6851f591027b30b390b97de16ae37cd39e..67f1d6b7a0341468f0d31f8139043cae1b1ab3c2 100644 (file)
@@ -274,6 +274,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_PCI_DEVICE:
    case PIPE_CAP_PCI_FUNCTION:
    case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
+   case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
       return 0;
 
    case PIPE_CAP_VENDOR_ID:
index 13fe7afd5e076f0f1f1de555dec9bc66786b1fca..0cb817befc9f64ddaeb324d33f0c17d122f3b0b0 100644 (file)
@@ -225,6 +225,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
         case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
         case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
         case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
+        case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
             return 0;
 
         /* SWTCL-only features. */
index adcb694f6d01dc79dbe19c444d68219dce4caa1e..16c936f0905e8927908a3b060389d05276f2875c 100644 (file)
@@ -374,6 +374,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
        case PIPE_CAP_TGSI_VOTE:
        case PIPE_CAP_MAX_WINDOW_RECTANGLES:
        case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
+       case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
                return 0;
 
        case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
index c1442820a93b5750ebe9dd6bd991e572271bfc9f..4297a4fa57ff5b1aa39f3fd3df7b782c275df1aa 100644 (file)
@@ -409,6 +409,7 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
        case PIPE_CAP_CLEAR_TEXTURE:
        case PIPE_CAP_CULL_DISTANCE:
        case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
+       case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
                return 1;
 
        case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
index 275adabb14d5fbab6510a52b1e500e62765a5d48..4af1b00f83f4d53c2ac9aa938f274f6a115bdd74 100644 (file)
@@ -288,6 +288,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_MAX_WINDOW_RECTANGLES:
    case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
    case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
+   case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
       return 0;
    case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT:
       return 4;
index 677e6bf6a25a3882934bb4b06f97630084e01c96..4e0ebc376debda9fa5b74895c164979f19f25b4b 100644 (file)
@@ -419,6 +419,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
    case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
    case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
+   case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
       return 0;
    }
 
index 19bb102354e3e68cb72c1603d8b5019c00164445..6ee357ad7611002df3e21bf00818090bb3afc459 100644 (file)
@@ -311,6 +311,7 @@ swr_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
    case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
    case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
+   case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
       return 0;
 
    case PIPE_CAP_VENDOR_ID:
index 97510b621d45fa2eab59fda48375d17e245293df..5334453a18c8109ad6c80191a96b96915b235640 100644 (file)
@@ -239,6 +239,7 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
         case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
         case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
         case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
+        case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
                 return 0;
 
                 /* Stream output. */
index 3d71d7dc93553f99f1904e49b90f7204e0af488f..87c4ce26bf25f845773e6b28ec0d52368a874085 100644 (file)
@@ -250,6 +250,7 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
    case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
    case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
+   case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
       return 0;
    case PIPE_CAP_VENDOR_ID:
       return 0x1af4;
index 6dd299e2120a41377e908ff71cba2bc6bd97ad0a..46e9039a9eccda53c038e162e537df378fd31dfd 100644 (file)
@@ -740,6 +740,7 @@ enum pipe_cap
    PIPE_CAP_MIXED_COLOR_DEPTH_BITS,
    PIPE_CAP_TGSI_ARRAY_COMPONENTS,
    PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS,
+   PIPE_CAP_TGSI_CAN_READ_OUTPUTS,
 };
 
 #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)