st/mesa: set force_persample_interp if ARB_sample_shading is used
authorMarek Olšák <marek.olsak@amd.com>
Sun, 27 Sep 2015 17:43:00 +0000 (19:43 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Sat, 3 Oct 2015 20:06:09 +0000 (22:06 +0200)
This is only a half of the work. The next patch will handle
gl_SampleID/SamplePos, which is the other half of ARB_sample_shading.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/mesa/state_tracker/st_atom_rasterizer.c
src/mesa/state_tracker/st_atom_shader.c
src/mesa/state_tracker/st_context.c
src/mesa/state_tracker/st_context.h

index cceed42c828b8d2cefd7815b9b45aa4369dd5642..0f01e9939de21a625babfec1ecb8e4600eee51a5 100644 (file)
@@ -237,6 +237,14 @@ static void update_raster_state( struct st_context *st )
    /* _NEW_MULTISAMPLE */
    raster->multisample = ctx->Multisample._Enabled;
 
+   /* _NEW_MULTISAMPLE | _NEW_BUFFERS */
+   raster->force_persample_interp =
+         st->can_force_persample_interp &&
+         ctx->Multisample._Enabled &&
+         ctx->Multisample.SampleShading &&
+         ctx->Multisample.MinSampleShadingValue *
+         ctx->DrawBuffer->Visual.samples > 1;
+
    /* _NEW_SCISSOR */
    raster->scissor = ctx->Scissor.EnableFlags;
 
index fee15a980f30d60af729820825d45da0eb339548..dc0315698d8bed2081952aeee1f40e876f72ae4e 100644 (file)
@@ -72,6 +72,7 @@ update_fp( struct st_context *st )
 
    /* Ignore sample qualifier while computing this flag. */
    key.persample_shading =
+      !st->can_force_persample_interp &&
       _mesa_get_min_invocations_per_fragment(st->ctx, &stfp->Base, true) > 1;
 
    st->fp_variant = st_get_fp_variant(st, stfp, &key);
index f65aafa9d55756c0e6c89d0cb25d862d3d291d09..a9ab5edcf49cbb10f2e3a7aadc474813e813e60c 100644 (file)
@@ -237,6 +237,8 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
                                               PIPE_BIND_SAMPLER_VIEW);
    st->prefer_blit_based_texture_transfer = screen->get_param(screen,
                               PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER);
+   st->can_force_persample_interp = screen->get_param(screen,
+                                          PIPE_CAP_FORCE_PERSAMPLE_INTERP);
 
    st->needs_texcoord_semantic =
       screen->get_param(screen, PIPE_CAP_TGSI_TEXCOORD);
index 81d5480431aa27137ce4bab5302441a7c920c287..a4cda29059dbbff032184b49c7b9f69bd02b8634 100644 (file)
@@ -98,6 +98,7 @@ struct st_context
    boolean has_etc1;
    boolean has_etc2;
    boolean prefer_blit_based_texture_transfer;
+   boolean can_force_persample_interp;
 
    boolean needs_texcoord_semantic;
    boolean apply_texture_swizzle_to_border_color;