gallium: add per-sample interpolation control into rasterizer statOAe
authorMarek Olšák <marek.olsak@amd.com>
Sun, 27 Sep 2015 17:32:07 +0000 (19:32 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Sat, 3 Oct 2015 20:06:09 +0000 (22:06 +0200)
Required by ARB_sample_shading for drivers that don't want a shader variant
in st/mesa.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Roland Scheidegger <sroland@vmware.com>
16 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
src/gallium/include/pipe/p_state.h

index e7800472f4420ebf10c9129a44284fb6fcb4defc..e08844b2f0bfbbf0148273823dd6ba0bd5813d75 100644 (file)
@@ -268,6 +268,15 @@ The integer capabilities:
   bounds_max states of pipe_depth_stencil_alpha_state behave according
   to the GL_EXT_depth_bounds_test specification.
 * ``PIPE_CAP_TGSI_TXQS``: Whether the `TXQS` opcode is supported
+* ``PIPE_CAP_FORCE_PERSAMPLE_INTERP``: If the driver can force per-sample
+  interpolation for all fragment shader inputs if
+  pipe_rasterizer_state::force_persample_interp is set. This is only used
+  by GL3-level sample shading (ARB_sample_shading). GL4-level sample shading
+  (ARB_gpu_shader5) doesn't use this. While GL3 hardware has a state for it,
+  GL4 hardware will likely need to emulate it with a shader variant, or by
+  selecting the interpolation weights with a conditional assignment
+  in the shader.
+
 
 
 .. _pipe_capf:
index 9a684d4ffbb71a48c7c0e683b1ccf219ede05966..0d0100590d66f4f0356fb5224b5c1eccf5e46a11 100644 (file)
@@ -235,6 +235,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
        case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
        case PIPE_CAP_DEPTH_BOUNDS_TEST:
        case PIPE_CAP_TGSI_TXQS:
+       case PIPE_CAP_FORCE_PERSAMPLE_INTERP:
                return 0;
 
        case PIPE_CAP_MAX_VIEWPORTS:
index 51c64edda2204e898e47dce7feb4f6ce73f881f0..9d6b3d391839bb06fbd845d44f226fc30c3770d5 100644 (file)
@@ -248,6 +248,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
    case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
    case PIPE_CAP_DEPTH_BOUNDS_TEST:
    case PIPE_CAP_TGSI_TXQS:
+   case PIPE_CAP_FORCE_PERSAMPLE_INTERP:
       return 0;
 
    case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
index 9e37e24014a45d76a9a6021d965f506288747f90..76812a666a07d69977345104250745094c3617aa 100644 (file)
@@ -470,6 +470,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
    case PIPE_CAP_DEPTH_BOUNDS_TEST:
    case PIPE_CAP_TGSI_TXQS:
+   case PIPE_CAP_FORCE_PERSAMPLE_INTERP:
       return 0;
 
    case PIPE_CAP_VENDOR_ID:
index 697e3d97c19440af3d720fc2237ee30374aab590..50c3781f5f84b83e4a9fe4e02de75bd2c975a478 100644 (file)
@@ -297,6 +297,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
    case PIPE_CAP_DEPTH_BOUNDS_TEST:
    case PIPE_CAP_TGSI_TXQS:
+   case PIPE_CAP_FORCE_PERSAMPLE_INTERP:
       return 0;
    }
    /* should only get here on unhandled cases */
index 806d4e6b04f8f250baf64ff30c4f61972936c8ef..39267b354e3c148890ee4e0e3e1c86a1caaa112e 100644 (file)
@@ -170,6 +170,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
    case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
    case PIPE_CAP_TGSI_TXQS:
+   case PIPE_CAP_FORCE_PERSAMPLE_INTERP:
       return 0;
 
    case PIPE_CAP_VENDOR_ID:
index c3bbc833f5b157faa6ba6543c639bf1d253ecb83..6012ff6fcb74ca4d0630a0a61fe20a6589370171 100644 (file)
@@ -215,6 +215,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
    case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
    case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
+   case PIPE_CAP_FORCE_PERSAMPLE_INTERP:
       return 0;
 
    case PIPE_CAP_VENDOR_ID:
index 1909b914d0283e66e709320e9481c717516551dc..32da76c88f6810fcb1008e1057f3cd4b9319922c 100644 (file)
@@ -201,6 +201,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_VERTEXID_NOBASE:
    case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
    case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
+   case PIPE_CAP_FORCE_PERSAMPLE_INTERP:
       return 0;
 
    case PIPE_CAP_VENDOR_ID:
index e669ba2edde0d582f7af8021c2fefd811b5db4cf..1165ac8a9c02d201101d167ef24a92c8954e60e0 100644 (file)
@@ -196,6 +196,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
         case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
         case PIPE_CAP_DEPTH_BOUNDS_TEST:
         case PIPE_CAP_TGSI_TXQS:
+        case PIPE_CAP_FORCE_PERSAMPLE_INTERP:
             return 0;
 
         /* SWTCL-only features. */
index 36d7e68a8f2243a53720bade6acc516d68572bba..efb4889e5625ecc35dc920f2ef07ffce7dc0001e 100644 (file)
@@ -342,6 +342,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
        case PIPE_CAP_VERTEXID_NOBASE:
        case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
        case PIPE_CAP_DEPTH_BOUNDS_TEST:
+       case PIPE_CAP_FORCE_PERSAMPLE_INTERP:
                return 0;
 
        /* Stream output. */
index cdd33aa0831c722a4eb9ee86f93b8dd5eb2c2383..a784db624e3a6c84500012607de0e9a7ba0ab480 100644 (file)
@@ -336,6 +336,7 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
        case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
        case PIPE_CAP_SAMPLER_VIEW_TARGET:
        case PIPE_CAP_VERTEXID_NOBASE:
+       case PIPE_CAP_FORCE_PERSAMPLE_INTERP:
                return 0;
 
        case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
index d8606f3c07e478e920387be684cb0a8ea6549246..d468cf4de5485158bd37c7823a84f8111871e125 100644 (file)
@@ -247,6 +247,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
    case PIPE_CAP_DEPTH_BOUNDS_TEST:
    case PIPE_CAP_TGSI_TXQS:
+   case PIPE_CAP_FORCE_PERSAMPLE_INTERP:
       return 0;
    }
    /* should only get here on unhandled cases */
index 44b6f4a42607103244c05d296a3005aeec02c5bb..e0a28788238b578dbcb7e1dce7634d3369e0a066 100644 (file)
@@ -380,6 +380,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
    case PIPE_CAP_DEPTH_BOUNDS_TEST:
    case PIPE_CAP_TGSI_TXQS:
+   case PIPE_CAP_FORCE_PERSAMPLE_INTERP:
       return 0;
    }
 
index c4b52e1e61d750e775ff15a20fd5295092f04839..739ac86193a2be049ed3131bb03e8e8515ad883f 100644 (file)
@@ -181,6 +181,7 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
        case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
        case PIPE_CAP_DEPTH_BOUNDS_TEST:
        case PIPE_CAP_TGSI_TXQS:
+       case PIPE_CAP_FORCE_PERSAMPLE_INTERP:
                 return 0;
 
                 /* Stream output. */
index 47fa82a1e2014dc88f4030031fd86b053b308f93..a4947154f17e1c283ff9697bef0d3738cc7be278 100644 (file)
@@ -631,6 +631,7 @@ enum pipe_cap
    PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR,
    PIPE_CAP_DEPTH_BOUNDS_TEST,
    PIPE_CAP_TGSI_TXQS,
+   PIPE_CAP_FORCE_PERSAMPLE_INTERP,
 };
 
 #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
index 266ebbafe36b0d4cfd114af1b65681aee97aa0fd..4bf8d46c68691946096f30ee501bb89c8d059296 100644 (file)
@@ -103,6 +103,7 @@ struct pipe_rasterizer_state
    unsigned point_tri_clip:1; /** large points clipped as tris or points */
    unsigned point_size_per_vertex:1; /**< size computed in vertex shader */
    unsigned multisample:1;         /* XXX maybe more ms state in future */
+   unsigned force_persample_interp:1;
    unsigned line_smooth:1;
    unsigned line_stipple_enable:1;
    unsigned line_last_pixel:1;