From 78b4326f4c6fc2284fa2df9a2653da5a4d8c4033 Mon Sep 17 00:00:00 2001 From: Vadim Girlin Date: Mon, 9 Apr 2012 23:44:27 +0400 Subject: [PATCH] r600g: check gpr count limit Signed-off-by: Vadim Girlin --- src/gallium/drivers/r600/r600_shader.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 1adf344..04a80ee 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1266,9 +1266,18 @@ static int r600_shader_from_tgsi(struct r600_context * rctx, struct r600_pipe_sh if (ctx.bc->chip_class == CAYMAN) cm_bytecode_add_cf_end(ctx.bc); + /* check GPR limit - we have 124 = 128 - 4 + * (4 are reserved as alu clause temporary registers) */ + if (ctx.bc->ngpr > 124) { + R600_ERR("GPR limit exceeded - shader requires %d registers\n", ctx.bc->ngpr); + r = -ENOMEM; + goto out_err; + } + free(ctx.literals); tgsi_parse_free(&ctx.parse); return 0; + out_err: free(ctx.literals); tgsi_parse_free(&ctx.parse); -- 1.7.7.6