diff options
author | Marek Olšák <[email protected]> | 2010-09-01 04:59:22 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2010-09-04 18:56:21 +0200 |
commit | 3ba562e62af0db0318ecebb356d5a3c514f4d1c8 (patch) | |
tree | 0f32dca3b042fa156ef5c5b26f86962f5ba221b0 /src | |
parent | 0b9f8361470564563dc54e6b13879e73182d353b (diff) |
r300/compiler: add new compiler parameter max_constants
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/r300/r300_fs.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_vs.c | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c | 11 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/compiler/radeon_compiler.c | 9 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/compiler/radeon_compiler.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_blit.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_fragprog_common.c | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_vertprog.c | 1 |
8 files changed, 18 insertions, 10 deletions
diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c index 485faefc6ac..7a5ed1b03bc 100644 --- a/src/gallium/drivers/r300/r300_fs.c +++ b/src/gallium/drivers/r300/r300_fs.c @@ -386,6 +386,7 @@ static void r300_translate_fragment_shader( compiler.state = shader->compare_state; compiler.Base.is_r500 = r300->screen->caps.is_r500; compiler.Base.max_temp_regs = compiler.Base.is_r500 ? 128 : 32; + compiler.Base.max_constants = compiler.Base.is_r500 ? 256 : 32; compiler.Base.max_alu_insts = compiler.Base.is_r500 ? 512 : 64; compiler.Base.remove_unused_constants = TRUE; compiler.AllocateHwInputs = &allocate_hardware_inputs; diff --git a/src/gallium/drivers/r300/r300_vs.c b/src/gallium/drivers/r300/r300_vs.c index 29569d92f59..4df6464224c 100644 --- a/src/gallium/drivers/r300/r300_vs.c +++ b/src/gallium/drivers/r300/r300_vs.c @@ -206,6 +206,7 @@ void r300_translate_vertex_shader(struct r300_context *r300, compiler.UserData = vs; compiler.Base.is_r500 = r300->screen->caps.is_r500; compiler.Base.max_temp_regs = 32; + compiler.Base.max_constants = 256; compiler.Base.max_alu_insts = r300->screen->caps.is_r500 ? 1024 : 256; compiler.Base.remove_unused_constants = TRUE; diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c index eb35265e37e..4aed9ddd216 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 4aff69c8683..b410b2daf42 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 0f6ad278b10..fcb0aee9f1b 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 */ diff --git a/src/mesa/drivers/dri/r300/r300_blit.c b/src/mesa/drivers/dri/r300/r300_blit.c index 91d715a7169..c22890c29e9 100644 --- a/src/mesa/drivers/dri/r300/r300_blit.c +++ b/src/mesa/drivers/dri/r300/r300_blit.c @@ -90,6 +90,7 @@ static void create_vertex_program(struct r300_context *r300) compiler.code = &r300->blit.vp_code; compiler.Base.is_r500 = r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515; compiler.Base.max_temp_regs = 32; + compiler.Base.max_constants = 256; compiler.Base.max_alu_insts = compiler.Base.is_r500 ? 1024 : 256; r3xx_compile_vertex_program(&compiler); @@ -123,6 +124,7 @@ static void create_fragment_program(struct r300_context *r300) compiler.enable_shadow_ambient = GL_TRUE; compiler.Base.is_r500 = (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515); compiler.Base.max_temp_regs = (compiler.Base.is_r500) ? 128 : 32; + compiler.Base.max_constants = compiler.Base.is_r500 ? 256 : 32; compiler.Base.max_alu_insts = compiler.Base.is_r500 ? 512 : 64; compiler.code = &r300->blit.fp_code; compiler.AllocateHwInputs = fp_allocate_hw_inputs; diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c index d6d41b4e42c..cd0f6b3fe64 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c @@ -221,6 +221,7 @@ static void translate_fragment_program(GLcontext *ctx, struct r300_fragment_prog compiler.enable_shadow_ambient = GL_TRUE; compiler.Base.is_r500 = (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) ? GL_TRUE : GL_FALSE; compiler.Base.max_temp_regs = (compiler.Base.is_r500) ? 128 : 32; + compiler.Base.max_constants = compiler.Base.is_r500 ? 256 : 32; compiler.Base.max_alu_insts = compiler.Base.is_r500 ? 512 : 64; compiler.OutputDepth = FRAG_RESULT_DEPTH; memset(compiler.OutputColor, 0, 4 * sizeof(unsigned)); diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 948517bd807..e7dcdef9b00 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -246,6 +246,7 @@ static struct r300_vertex_program *build_program(GLcontext *ctx, compiler.SetHwInputOutput = &t_inputs_outputs; compiler.Base.is_r500 = R300_CONTEXT(ctx)->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515; compiler.Base.max_temp_regs = 32; + compiler.Base.max_constants = 256; compiler.Base.max_alu_insts = compiler.Base.is_r500 ? 1024 : 256; if (compiler.Base.Debug) { |