[Mesa-dev] [PATCH 2/6] r600_shader.c: check validity of the value returned by eg_get_interpolator_index

Julien Isorce julien.isorce at gmail.com
Thu Mar 16 14:25:24 UTC 2017


Like done in another place in that same file.
Not sure if this should be an assert though.

CID 1250588

Signed-off-by: Julien Isorce <jisorce at oblong.com>
---
 src/gallium/drivers/r600/r600_shader.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index 8cb3f8b..55fd4ca 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -1113,7 +1113,8 @@ static int allocate_system_value_inputs(struct r600_shader_ctx *ctx, int gpr_off
 
 				interpolate = ctx->info.input_interpolate[inst->Src[0].Register.Index];
 				k = eg_get_interpolator_index(interpolate, location);
-				ctx->eg_interpolators[k].enabled = true;
+                                if (k >= 0)
+                                        ctx->eg_interpolators[k].enabled = true;
 			}
 		} else if (parse.FullToken.Token.Type == TGSI_TOKEN_TYPE_DECLARATION) {
 			struct tgsi_full_declaration *d = &parse.FullToken.FullDeclaration;
@@ -1209,7 +1210,8 @@ static int evergreen_gpr_count(struct r600_shader_ctx *ctx)
 
 				interpolate = ctx->info.input_interpolate[inst->Src[0].Register.Index];
 				k = eg_get_interpolator_index(interpolate, location);
-				ctx->eg_interpolators[k].enabled = true;
+                                if (k >= 0)
+                                        ctx->eg_interpolators[k].enabled = true;
 			}
 		}
 	}
-- 
2.7.4



More information about the mesa-dev mailing list