From 3ba562e62af0db0318ecebb356d5a3c514f4d1c8 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Wed, 1 Sep 2010 04:59:22 +0200 Subject: r300/compiler: add new compiler parameter max_constants --- src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c | 11 +---------- src/mesa/drivers/dri/r300/compiler/radeon_compiler.c | 9 +++++++++ src/mesa/drivers/dri/r300/compiler/radeon_compiler.h | 2 ++ 3 files changed, 12 insertions(+), 10 deletions(-) (limited to 'src/mesa/drivers/dri/r300/compiler') diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c index eb35265e37..4aed9ddd21 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c @@ -971,15 +971,6 @@ static struct rc_swizzle_caps r300_vertprog_swizzle_caps = { .Split = 0 /* should never be called */ }; -static void validate_final_shader(struct radeon_compiler *c, void *user) -{ - /* Check the number of constants. */ - if (c->Program.Constants.Count > 256) { - rc_error(c, "Too many constants. Max: 256, Got: %i\n", - c->Program.Constants.Count); - } -} - void r3xx_compile_vertex_program(struct r300_vertex_program_compiler *c) { int is_r500 = c->Base.is_r500; @@ -1027,7 +1018,7 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler *c) {"dataflow swizzles", 1, 1, rc_dataflow_swizzles, NULL}, {"register allocation", 1, 1, allocate_temporary_registers, NULL}, {"dead constants", 1, kill_consts, rc_remove_unused_constants, &c->code->constants_remap_table}, - {"final code validation", 0, 1, validate_final_shader, NULL}, + {"final code validation", 0, 1, rc_validate_final_shader, NULL}, {"machine code generation", 0, 1, translate_vertex_program, NULL}, {"dump machine code", 0,c->Base.Debug,r300_vertex_program_dump, NULL}, {NULL, 0, 0, NULL, NULL} diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.c b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.c index 4aff69c868..b410b2daf4 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.c @@ -374,3 +374,12 @@ void rc_run_compiler(struct radeon_compiler *c, struct radeon_compiler_pass *lis } } } + +void rc_validate_final_shader(struct radeon_compiler *c, void *user) +{ + /* Check the number of constants. */ + if (c->Program.Constants.Count > c->max_constants) { + rc_error(c, "Too many constants. Max: 256, Got: %i\n", + c->Program.Constants.Count); + } +} diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h index 0f6ad278b1..fcb0aee9f1 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h @@ -42,6 +42,7 @@ struct radeon_compiler { /* Hardware specification. */ unsigned is_r500:1; unsigned max_temp_regs; + unsigned max_constants; int max_alu_insts; /* Whether to remove unused constants and empty holes in constant space. */ @@ -136,5 +137,6 @@ struct radeon_compiler_pass { /* Executes a list of compiler passes given in the parameter 'list'. */ void rc_run_compiler(struct radeon_compiler *c, struct radeon_compiler_pass *list, const char *shader_name); +void rc_validate_final_shader(struct radeon_compiler *c, void *user); #endif /* RADEON_COMPILER_H */ -- cgit v1.2.3