summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2014-07-04 23:01:39 -0400
committerIlia Mirkin <[email protected]>2014-07-09 19:26:32 -0400
commit6b92a06ea32492d2ff968038672d104b711b66f0 (patch)
treeef5a3bf1aef9374970b2c33f964f00f91140b0d1 /src/mesa
parent4c97ed4411e3653a082875b79587fb308c284a99 (diff)
mesa/st: add per sample shading state to fp key and set interpolation
This enables a gallium driver not to care about the semantics of ARB_sample_shading vs ARB_gpu_shader5 sample attributes. When ARB_sample_shading-style sample shading is enabled, all of the fp inputs are marked for interpolation at the sample location. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_atom_shader.c6
-rw-r--r--src/mesa/state_tracker/st_program.c3
-rw-r--r--src/mesa/state_tracker/st_program.h3
3 files changed, 11 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
index 67c6157135a..6515a98a3fb 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -89,6 +89,10 @@ update_fp( struct st_context *st )
key.clamp_color = st->clamp_frag_color_in_shader &&
st->ctx->Color._ClampFragmentColor;
+ /* Ignore sample qualifier while computing this flag. */
+ key.persample_shading =
+ _mesa_get_min_invocations_per_fragment(st->ctx, &stfp->Base, true) > 1;
+
st->fp_variant = st_get_fp_variant(st, stfp, &key);
st_reference_fragprog(st, &st->fp, stfp);
@@ -108,7 +112,7 @@ update_fp( struct st_context *st )
const struct st_tracked_state st_update_fp = {
"st_update_fp", /* name */
{ /* dirty */
- _NEW_BUFFERS, /* mesa */
+ _NEW_BUFFERS | _NEW_MULTISAMPLE, /* mesa */
ST_NEW_FRAGMENT_PROGRAM /* st */
},
update_fp /* update */
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index b603759f8f8..9d7b7c475a6 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -548,6 +548,9 @@ st_translate_fragment_program(struct st_context *st,
else
interpLocation[slot] = TGSI_INTERPOLATE_LOC_CENTER;
+ if (key->persample_shading)
+ interpLocation[slot] = TGSI_INTERPOLATE_LOC_SAMPLE;
+
switch (attr) {
case VARYING_SLOT_POS:
input_semantic_name[slot] = TGSI_SEMANTIC_POSITION;
diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h
index ce9174f67f8..9a5b6a847a5 100644
--- a/src/mesa/state_tracker/st_program.h
+++ b/src/mesa/state_tracker/st_program.h
@@ -58,6 +58,9 @@ struct st_fp_variant_key
/** for ARB_color_buffer_float */
GLuint clamp_color:1;
+
+ /** for ARB_sample_shading */
+ GLuint persample_shading:1;
};