summaryrefslogtreecommitdiff
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2010-09-01 04:59:22 +0200
committerMarek Olšák <maraeo@gmail.com>2010-09-04 18:56:21 +0200
commit3ba562e62af0db0318ecebb356d5a3c514f4d1c8 (patch)
tree0f32dca3b042fa156ef5c5b26f86962f5ba221b0 /src/mesa/drivers
parent0b9f8361470564563dc54e6b13879e73182d353b (diff)
r300/compiler: add new compiler parameter max_constants
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c11
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_compiler.c9
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_compiler.h2
-rw-r--r--src/mesa/drivers/dri/r300/r300_blit.c2
-rw-r--r--src/mesa/drivers/dri/r300/r300_fragprog_common.c1
-rw-r--r--src/mesa/drivers/dri/r300/r300_vertprog.c1
6 files changed, 16 insertions, 10 deletions
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 */
diff --git a/src/mesa/drivers/dri/r300/r300_blit.c b/src/mesa/drivers/dri/r300/r300_blit.c
index 91d715a716..c22890c29e 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 d6d41b4e42..cd0f6b3fe6 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 948517bd80..e7dcdef9b0 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) {