From 300a8221e92b91c1c759cdd331052a53506d6e93 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 4 Oct 2016 19:53:53 +0200 Subject: [PATCH] radeonsi: add assertions to validate interpolation flags MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Nicolai Hähnle --- .../drivers/radeonsi/si_state_shaders.c | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) 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) -- 2.30.2