Re: [Mesa-dev] [PATCH 1/2] st: fix st_choose_matching_format to ignore intensity

2014-03-30 Thread Chris Forbes
On Sun, Mar 30, 2014 at 12:36 AM, Brian Paul  wrote:
> Let's put that closing */ on the next line to match the format of other
> comments.

I keep doing that -- I guess I should fix my editor. :(

> For both, Reviewed-by: Brian PaulHowever, have you
> retested piglit with softpipe just to be safe?  I could do that on Monday
> otherwise.

I retested with piglit gpu.py against softpipe -- no regressions.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] st: fix st_choose_matching_format to ignore intensity

2014-03-30 Thread Marek Olšák
This patch:

Reviewed-by: Marek Olšák 

Marek

On Sat, Mar 29, 2014 at 12:02 AM, Chris Forbes  wrote:
> _mesa_format_matches_format_and_type() returns true for
> GL_RED/GL_RED_INTEGER (with an appropriate type) into an intensity
> mesa_format.
>
> We want the `red`-based format instead, regardless of the order we find
> them in our walk of the mesa formats list.
>
> Signed-off-by: Chris Forbes 
> ---
>  src/mesa/state_tracker/st_format.c | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/src/mesa/state_tracker/st_format.c 
> b/src/mesa/state_tracker/st_format.c
> index cd6b466..62cee1c 100644
> --- a/src/mesa/state_tracker/st_format.c
> +++ b/src/mesa/state_tracker/st_format.c
> @@ -1750,6 +1750,11 @@ st_choose_matching_format(struct pipe_screen *screen, 
> unsigned bind,
>if (_mesa_get_format_color_encoding(mesa_format) == GL_SRGB) {
>   continue;
>}
> +  if (_mesa_get_format_bits(mesa_format, GL_TEXTURE_INTENSITY_SIZE) > 0) 
> {
> + /* if `format` is GL_RED/GL_RED_INTEGER, then we might match some
> +  * intensity formats, which we don't want. */
> + continue;
> +  }
>
>if (_mesa_format_matches_format_and_type(mesa_format, format, type,
> swapBytes)) {
> --
> 1.9.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] glx: Do not advertise buffer_age on dri2

2014-03-30 Thread Adel Gadllah
Previously GLX_EXT_buffer_age has always been advertised as supported because
both client_glx_support and client_glx_only where set. So it did not matter
that direct_support is only set when running dri3 and we ended up always
advertising it.

Fix that by not setting client_glx_only for buffer_age in known_glx_extensions.

Signed-off-by: Adel Gadllah 
---
 src/glx/glxextensions.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glx/glxextensions.c b/src/glx/glxextensions.c
index ac1b4a7..ce5d66d 100644
--- a/src/glx/glxextensions.c
+++ b/src/glx/glxextensions.c
@@ -103,7 +103,7 @@ static const struct extension_info known_glx_extensions[] = 
{
{ GLX(SGIX_visual_select_group),VER(0,0), Y, Y, N, N },
{ GLX(EXT_texture_from_pixmap), VER(0,0), Y, N, N, N },
{ GLX(INTEL_swap_event),VER(0,0), Y, N, N, N },
-   { GLX(EXT_buffer_age),  VER(0,0), Y, N, Y, Y },
+   { GLX(EXT_buffer_age),  VER(0,0), Y, N, N, Y },
{ NULL }
 };
 
-- 
1.9.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 0/3] Sample shading support in gallium

2014-03-30 Thread Ilia Mirkin
This patch series adds enough support to gallium to make ARB_sample_shading
work. There's also an initial implementation for nv50 although it doesn't
actually to work. I've done some amount of debugging and don't see what's
going wrong yet. However all the TGSI (and nv50) shaders contain the expected
contents, so at least it does what I want :) Probably some subtlety in the
pushbuf method setup that I'm missing.

The only question is whether I'm handling gl_SampleMask reasonably. It doesn't
seem like any current driver supports over 32x MSAA, so treating it like an
array feels like it would just add unnecessary complication. (Also that whole
logic with setting up the mapping... I'm not 100% sure on it, please check
over it carefully.)

Ilia Mirkin (3):
  gallium: add basic support for ARB_sample_shading
  mesa/st: add support for ARB_sample_shading
  nv50: add support for PIPE_CAP_SAMPLE_SHADING

 src/gallium/auxiliary/cso_cache/cso_context.c  | 19 
 src/gallium/auxiliary/cso_cache/cso_context.h  |  4 ++
 src/gallium/auxiliary/tgsi/tgsi_strings.c  |  5 +-
 src/gallium/docs/source/context.rst|  3 ++
 src/gallium/docs/source/screen.rst |  3 ++
 src/gallium/docs/source/tgsi.rst   | 20 
 src/gallium/drivers/freedreno/freedreno_screen.c   |  1 +
 src/gallium/drivers/i915/i915_screen.c |  1 +
 src/gallium/drivers/ilo/ilo_screen.c   |  1 +
 src/gallium/drivers/llvmpipe/lp_screen.c   |  1 +
 src/gallium/drivers/nouveau/codegen/nv50_ir.h  |  1 +
 .../drivers/nouveau/codegen/nv50_ir_driver.h   |  1 +
 .../drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp  |  8 
 .../nouveau/codegen/nv50_ir_lowering_nv50.cpp  | 12 +
 .../drivers/nouveau/codegen/nv50_ir_print.cpp  |  1 +
 .../nouveau/codegen/nv50_ir_target_nv50.cpp|  2 +
 src/gallium/drivers/nouveau/nv30/nv30_screen.c |  1 +
 src/gallium/drivers/nouveau/nv50/nv50_context.h|  7 ++-
 src/gallium/drivers/nouveau/nv50/nv50_program.c|  5 +-
 src/gallium/drivers/nouveau/nv50/nv50_program.h|  1 +
 src/gallium/drivers/nouveau/nv50/nv50_screen.c |  2 +
 .../drivers/nouveau/nv50/nv50_shader_state.c   | 11 +
 src/gallium/drivers/nouveau/nv50/nv50_state.c  |  9 
 .../drivers/nouveau/nv50/nv50_state_validate.c | 53 +-
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c |  1 +
 src/gallium/drivers/r300/r300_screen.c |  1 +
 src/gallium/drivers/r600/r600_pipe.c   |  1 +
 src/gallium/drivers/radeonsi/si_pipe.c |  1 +
 src/gallium/drivers/softpipe/sp_screen.c   |  1 +
 src/gallium/drivers/svga/svga_screen.c |  1 +
 src/gallium/include/pipe/p_context.h   |  3 ++
 src/gallium/include/pipe/p_defines.h   |  3 +-
 src/gallium/include/pipe/p_shader_tokens.h |  5 +-
 src/mesa/program/program.c | 39 ++--
 src/mesa/program/program.h |  4 ++
 src/mesa/state_tracker/st_atom.c   |  1 +
 src/mesa/state_tracker/st_atom.h   |  1 +
 src/mesa/state_tracker/st_atom_msaa.c  | 24 ++
 src/mesa/state_tracker/st_extensions.c |  3 +-
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 16 ++-
 src/mesa/state_tracker/st_program.c| 21 +
 41 files changed, 266 insertions(+), 32 deletions(-)

-- 
1.8.3.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/3] gallium: add basic support for ARB_sample_shading

2014-03-30 Thread Ilia Mirkin
---
 src/gallium/auxiliary/tgsi/tgsi_strings.c  |  5 -
 src/gallium/docs/source/context.rst|  3 +++
 src/gallium/docs/source/screen.rst |  3 +++
 src/gallium/docs/source/tgsi.rst   | 20 
 src/gallium/include/pipe/p_context.h   |  3 +++
 src/gallium/include/pipe/p_defines.h   |  3 ++-
 src/gallium/include/pipe/p_shader_tokens.h |  5 -
 7 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c 
b/src/gallium/auxiliary/tgsi/tgsi_strings.c
index b0ba3ef..2be726c 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_strings.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c
@@ -81,7 +81,10 @@ const char *tgsi_semantic_names[TGSI_SEMANTIC_COUNT] =
"PCOORD",
"VIEWPORT_INDEX",
"LAYER",
-   "CULLDIST"
+   "CULLDIST",
+   "SAMPLEID",
+   "SAMPLEPOS",
+   "SAMPLEMASK"
 };
 
 const char *tgsi_texture_names[TGSI_TEXTURE_COUNT] =
diff --git a/src/gallium/docs/source/context.rst 
b/src/gallium/docs/source/context.rst
index 8e14522..505995f 100644
--- a/src/gallium/docs/source/context.rst
+++ b/src/gallium/docs/source/context.rst
@@ -67,6 +67,9 @@ objects. They all follow simple, one-method binding calls, 
e.g.
   which are used as comparison values in stencil test.
 * ``set_blend_color``
 * ``set_sample_mask``
+* ``set_sample_shading`` sets the minimum percentage of samples that must be
+  run. 0 indicates per-fragment shading, while 1 should guarantee full
+  per-sample shading.
 * ``set_clip_state``
 * ``set_polygon_stipple``
 * ``set_scissor_states`` sets the bounds for the scissor test, which culls
diff --git a/src/gallium/docs/source/screen.rst 
b/src/gallium/docs/source/screen.rst
index 09f809d..8530eb4 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -191,6 +191,9 @@ The integer capabilities:
 * ``PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT``: Whether
   PIPE_TRANSFER_PERSISTENT and PIPE_TRANSFER_COHERENT are supported
   for buffers.
+* ``PIPE_CAP_SAMPLE_SHADING``: Whether there is support for per-sample
+  shading. The context->set_sample_shading function will be expected to be
+  implemented.
 
 
 .. _pipe_capf:
diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst
index e184b2f..fa30d08 100644
--- a/src/gallium/docs/source/tgsi.rst
+++ b/src/gallium/docs/source/tgsi.rst
@@ -2600,6 +2600,26 @@ distances and by the 
PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT
 which specifies the maximum number of registers which can be
 annotated with those semantics.
 
+TGSI_SEMANTIC_SAMPLEID
+""
+
+For fragment shaders, this semantic label indicates that a system value
+contains the current sample id (i.e. gl_SampleID). Only the X value is used.
+
+TGSI_SEMANTIC_SAMPLEPOS
+"""
+
+For fragment shaders, this semantic label indicates that a system value
+contains the current sample's position (i.e. gl_SamplePosition). Only the X
+and Y values are used.
+
+TGSI_SEMANTIC_SAMPLEMASK
+
+
+For fragment shaders, this semantic label indicates that an output contains
+the sample mask used to disable further sample processing
+(i.e. gl_SampleMask). Only the X value is used, up to 32x MS.
+
 
 Declaration Interpolate
 ^^^
diff --git a/src/gallium/include/pipe/p_context.h 
b/src/gallium/include/pipe/p_context.h
index fe3045a..b753def 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -190,6 +190,9 @@ struct pipe_context {
void (*set_sample_mask)( struct pipe_context *,
 unsigned sample_mask );
 
+   void (*set_sample_shading)( struct pipe_context *,
+   float samples );
+
void (*set_clip_state)( struct pipe_context *,
 const struct pipe_clip_state * );
 
diff --git a/src/gallium/include/pipe/p_defines.h 
b/src/gallium/include/pipe/p_defines.h
index a220de0..eb3bb98 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -551,7 +551,8 @@ enum pipe_cap {
PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS = 89,
PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS = 90,
PIPE_CAP_TEXTURE_GATHER_SM5 = 91,
-   PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT = 92
+   PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT = 92,
+   PIPE_CAP_SAMPLE_SHADING = 93
 };
 
 #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
diff --git a/src/gallium/include/pipe/p_shader_tokens.h 
b/src/gallium/include/pipe/p_shader_tokens.h
index 8fa6a0a..2ce8b96 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -167,7 +167,10 @@ struct tgsi_declaration_interp
 #define TGSI_SEMANTIC_VIEWPORT_INDEX 21 /**< viewport index */
 #define TGSI_SEMANTIC_LAYER  22 /**< layer (rendertarget index) */
 #define TGSI_SEMANTIC_CULLDIST   23
-#define TGSI_SEMANTIC_COUNT  24 /**< number of semantic values */
+#de

[Mesa-dev] [PATCH 3/3] nv50: add support for PIPE_CAP_SAMPLE_SHADING

2014-03-30 Thread Ilia Mirkin
---

This doesn't actually pass any tests (well, sample-id passes for texture, but
not renderbuffer attachments).

 src/gallium/drivers/nouveau/codegen/nv50_ir.h  |  1 +
 .../drivers/nouveau/codegen/nv50_ir_driver.h   |  1 +
 .../drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp  |  8 
 .../nouveau/codegen/nv50_ir_lowering_nv50.cpp  | 12 +
 .../drivers/nouveau/codegen/nv50_ir_print.cpp  |  1 +
 .../nouveau/codegen/nv50_ir_target_nv50.cpp|  2 +
 src/gallium/drivers/nouveau/nv50/nv50_context.h|  7 ++-
 src/gallium/drivers/nouveau/nv50/nv50_program.c|  5 +-
 src/gallium/drivers/nouveau/nv50/nv50_program.h|  1 +
 src/gallium/drivers/nouveau/nv50/nv50_screen.c |  3 +-
 .../drivers/nouveau/nv50/nv50_shader_state.c   | 11 +
 src/gallium/drivers/nouveau/nv50/nv50_state.c  |  9 
 .../drivers/nouveau/nv50/nv50_state_validate.c | 53 +-
 13 files changed, 109 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.h 
b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
index 857980d..9030cc3 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir.h
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
@@ -353,6 +353,7 @@ enum SVSemantic
SV_POINT_COORD,
SV_CLIP_DISTANCE,
SV_SAMPLE_INDEX,
+   SV_SAMPLE_POS,
SV_TESS_FACTOR,
SV_TESS_COORD,
SV_TID,
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h
index f2f4ead..7d35239 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h
@@ -187,6 +187,7 @@ struct nv50_ir_prog_info
   uint8_t resInfoCBSlot; /* cX[] used for tex handles, surface info */
   uint16_t texBindBase;  /* base address for tex handles (nve4) */
   uint16_t suInfoBase;   /* base address for surface info (nve4) */
+  uint16_t sampleInfoBase;   /* base address for sample positions */
   uint8_t msInfoCBSlot;  /* cX[] used for multisample info */
   uint16_t msInfoBase;   /* base address for multisample info */
} io;
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
index ccddb9a..4f5665a 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
@@ -345,6 +345,8 @@ static nv50_ir::SVSemantic translateSysVal(uint sysval)
case TGSI_SEMANTIC_BLOCK_ID:   return nv50_ir::SV_CTAID;
case TGSI_SEMANTIC_BLOCK_SIZE: return nv50_ir::SV_NTID;
case TGSI_SEMANTIC_THREAD_ID:  return nv50_ir::SV_TID;
+   case TGSI_SEMANTIC_SAMPLEID:   return nv50_ir::SV_SAMPLE_INDEX;
+   case TGSI_SEMANTIC_SAMPLEPOS:  return nv50_ir::SV_SAMPLE_POS;
default:
   assert(0);
   return nv50_ir::SV_CLOCK;
@@ -954,6 +956,9 @@ bool Source::scanDeclaration(const struct 
tgsi_full_declaration *decl)
decl->Declaration.UsageMask << (si * 4);
 info->io.genUserClip = -1;
 break;
+ case TGSI_SEMANTIC_SAMPLEMASK:
+info->io.sampleMask = i;
+break;
  default:
 break;
  }
@@ -970,6 +975,9 @@ bool Source::scanDeclaration(const struct 
tgsi_full_declaration *decl)
   case TGSI_SEMANTIC_VERTEXID:
  info->io.vertexId = first;
  break;
+  case TGSI_SEMANTIC_SAMPLEMASK:
+ info->io.sampleMask = first;
+ break;
   default:
  break;
   }
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp
index 0908447..110c2b0 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp
@@ -1011,6 +1011,18 @@ NV50LoweringPreSSA::handleRDSV(Instruction *i)
  bld.mkMov(def, bld.mkImm(0));
   }
   break;
+   case SV_SAMPLE_POS: {
+  Value *off = new_LValue(func, FILE_ADDRESS);
+  bld.mkOp1(OP_RDSV, TYPE_U32, def, bld.mkSysVal(SV_SAMPLE_INDEX, 0));
+  bld.mkOp2(OP_SHL, TYPE_U32, off, def, bld.mkImm(3));
+  bld.mkLoad(TYPE_F32,
+ def,
+ bld.mkSymbol(
+   FILE_MEMORY_CONST, prog->driver->io.resInfoCBSlot,
+   TYPE_U32, prog->driver->io.sampleInfoBase + 4 * idx),
+ off);
+  break;
+   }
default:
   bld.mkFetch(i->getDef(0), i->dType,
   FILE_SHADER_INPUT, addr, i->getIndirect(0, 0), NULL);
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp
index ae42d03..e31a393 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp
@@ -252,6 +252,7 @@ static const char *SemanticStr[SV_LAST + 1] =
"POINT_CO

[Mesa-dev] [PATCH 2/3] mesa/st: add support for ARB_sample_shading

2014-03-30 Thread Ilia Mirkin
---
 src/gallium/auxiliary/cso_cache/cso_context.c| 19 
 src/gallium/auxiliary/cso_cache/cso_context.h|  4 +++
 src/gallium/drivers/freedreno/freedreno_screen.c |  1 +
 src/gallium/drivers/i915/i915_screen.c   |  1 +
 src/gallium/drivers/ilo/ilo_screen.c |  1 +
 src/gallium/drivers/llvmpipe/lp_screen.c |  1 +
 src/gallium/drivers/nouveau/nv30/nv30_screen.c   |  1 +
 src/gallium/drivers/nouveau/nv50/nv50_screen.c   |  1 +
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c   |  1 +
 src/gallium/drivers/r300/r300_screen.c   |  1 +
 src/gallium/drivers/r600/r600_pipe.c |  1 +
 src/gallium/drivers/radeonsi/si_pipe.c   |  1 +
 src/gallium/drivers/softpipe/sp_screen.c |  1 +
 src/gallium/drivers/svga/svga_screen.c   |  1 +
 src/mesa/program/program.c   | 39 +++-
 src/mesa/program/program.h   |  4 +++
 src/mesa/state_tracker/st_atom.c |  1 +
 src/mesa/state_tracker/st_atom.h |  1 +
 src/mesa/state_tracker/st_atom_msaa.c| 24 +++
 src/mesa/state_tracker/st_extensions.c   |  3 +-
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp   | 16 --
 src/mesa/state_tracker/st_program.c  | 21 -
 22 files changed, 119 insertions(+), 25 deletions(-)

diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c 
b/src/gallium/auxiliary/cso_cache/cso_context.c
index 9146684..3e9c257 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -120,6 +120,7 @@ struct cso_context {
struct pipe_viewport_state vp, vp_saved;
struct pipe_blend_color blend_color;
unsigned sample_mask, sample_mask_saved;
+   float sample_shading, sample_shading_saved;
struct pipe_stencil_ref stencil_ref, stencil_ref_saved;
 };
 
@@ -716,6 +717,24 @@ void cso_restore_sample_mask(struct cso_context *ctx)
cso_set_sample_mask(ctx, ctx->sample_mask_saved);
 }
 
+void cso_set_sample_shading(struct cso_context *ctx, float sample_shading)
+{
+   if (ctx->sample_shading != sample_shading) {
+  ctx->sample_shading = sample_shading;
+  ctx->pipe->set_sample_shading(ctx->pipe, sample_shading);
+   }
+}
+
+void cso_save_sample_shading(struct cso_context *ctx)
+{
+   ctx->sample_shading_saved = ctx->sample_shading;
+}
+
+void cso_restore_sample_shading(struct cso_context *ctx)
+{
+   cso_set_sample_shading(ctx, ctx->sample_shading_saved);
+}
+
 void cso_set_stencil_ref(struct cso_context *ctx,
  const struct pipe_stencil_ref *sr)
 {
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h 
b/src/gallium/auxiliary/cso_cache/cso_context.h
index 1aa9998..4cae22d 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.h
+++ b/src/gallium/auxiliary/cso_cache/cso_context.h
@@ -164,6 +164,10 @@ void cso_set_sample_mask(struct cso_context *cso, unsigned 
stencil_mask);
 void cso_save_sample_mask(struct cso_context *ctx);
 void cso_restore_sample_mask(struct cso_context *ctx);
 
+void cso_set_sample_shading(struct cso_context *cso, float sample_shading);
+void cso_save_sample_shading(struct cso_context *ctx);
+void cso_restore_sample_shading(struct cso_context *ctx);
+
 void cso_set_stencil_ref(struct cso_context *cso,
  const struct pipe_stencil_ref *sr);
 void cso_save_stencil_ref(struct cso_context *cso);
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c 
b/src/gallium/drivers/freedreno/freedreno_screen.c
index 228ed18..79a5d89 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -206,6 +206,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum 
pipe_cap param)
case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
case PIPE_CAP_TEXTURE_GATHER_SM5:
 case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
+case PIPE_CAP_SAMPLE_SHADING:
return 0;
 
/* Stream output. */
diff --git a/src/gallium/drivers/i915/i915_screen.c 
b/src/gallium/drivers/i915/i915_screen.c
index 88b190b..813e91e 100644
--- a/src/gallium/drivers/i915/i915_screen.c
+++ b/src/gallium/drivers/i915/i915_screen.c
@@ -218,6 +218,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap 
cap)
case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER:
case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
case PIPE_CAP_TEXTURE_GATHER_SM5:
+   case PIPE_CAP_SAMPLE_SHADING:
   return 0;
 
case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
diff --git a/src/gallium/drivers/ilo/ilo_screen.c 
b/src/gallium/drivers/ilo/ilo_screen.c
index 4a04662..5c3b084 100644
--- a/src/gallium/drivers/ilo/ilo_screen.c
+++ b/src/gallium/drivers/ilo/ilo_screen.c
@@ -436,6 +436,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap 
param)
case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
case PIPE_CAP_TEXTURE_GATHER_SM5:
case PIPE_CAP_BUFFER_M