summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2016-10-04 19:53:53 +0200
committerMarek Olšák <[email protected]>2016-10-05 21:03:23 +0200
commit300a8221e92b91c1c759cdd331052a53506d6e93 (patch)
treedbc260f067dcb17826756c97af97a52281c12f61
parentd4a8bf89ce357ef153e9a1f712f3c3ec3d8904d6 (diff)
radeonsi: add assertions to validate interpolation flags
Reviewed-by: Nicolai Hähnle <[email protected]>
-rw-r--r--src/gallium/drivers/radeonsi/si_state_shaders.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index 96626252d5e..f6bd12915cd 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -693,6 +693,40 @@ static void si_shader_ps(struct si_shader *shader)
G_0286CC_LINEAR_CENTER_ENA(input_ena) ||
G_0286CC_LINEAR_CENTROID_ENA(input_ena) ||
G_0286CC_LINE_STIPPLE_TEX_ENA(input_ena));
+ /* POS_W_FLOAT_ENA requires one of the perspective weights. */
+ assert(!G_0286CC_POS_W_FLOAT_ENA(input_ena) ||
+ G_0286CC_PERSP_SAMPLE_ENA(input_ena) ||
+ G_0286CC_PERSP_CENTER_ENA(input_ena) ||
+ G_0286CC_PERSP_CENTROID_ENA(input_ena) ||
+ G_0286CC_PERSP_PULL_MODEL_ENA(input_ena));
+
+ /* Validate interpolation optimization flags (read as implications). */
+ assert(!shader->key.ps.prolog.bc_optimize_for_persp ||
+ (G_0286CC_PERSP_CENTER_ENA(input_ena) &&
+ G_0286CC_PERSP_CENTROID_ENA(input_ena)));
+ assert(!shader->key.ps.prolog.bc_optimize_for_linear ||
+ (G_0286CC_LINEAR_CENTER_ENA(input_ena) &&
+ G_0286CC_LINEAR_CENTROID_ENA(input_ena)));
+ assert(!shader->key.ps.prolog.force_persp_center_interp ||
+ (!G_0286CC_PERSP_SAMPLE_ENA(input_ena) &&
+ !G_0286CC_PERSP_CENTROID_ENA(input_ena)));
+ assert(!shader->key.ps.prolog.force_linear_center_interp ||
+ (!G_0286CC_LINEAR_SAMPLE_ENA(input_ena) &&
+ !G_0286CC_LINEAR_CENTROID_ENA(input_ena)));
+ assert(!shader->key.ps.prolog.force_persp_sample_interp ||
+ (!G_0286CC_PERSP_CENTER_ENA(input_ena) &&
+ !G_0286CC_PERSP_CENTROID_ENA(input_ena)));
+ assert(!shader->key.ps.prolog.force_linear_sample_interp ||
+ (!G_0286CC_LINEAR_CENTER_ENA(input_ena) &&
+ !G_0286CC_LINEAR_CENTROID_ENA(input_ena)));
+
+ /* Validate cases when the optimizations are off (read as implications). */
+ assert(shader->key.ps.prolog.bc_optimize_for_persp ||
+ !G_0286CC_PERSP_CENTER_ENA(input_ena) ||
+ !G_0286CC_PERSP_CENTROID_ENA(input_ena));
+ assert(shader->key.ps.prolog.bc_optimize_for_linear ||
+ !G_0286CC_LINEAR_CENTER_ENA(input_ena) ||
+ !G_0286CC_LINEAR_CENTROID_ENA(input_ena));
pm4 = si_get_shader_pm4_state(shader);
if (!pm4)