diff options
author | Marek Olšák <[email protected]> | 2010-04-11 23:00:16 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2010-04-12 04:16:08 +0200 |
commit | 953a309de9204490edcd011e700c06c7c25c0b9e (patch) | |
tree | ebb69c952ea4ca507a11c2e21bd2d51c75ad789f /src/gallium/drivers/r300/r300_fs.c | |
parent | 132a590d5e76de7ddfacdb0dcc160429c309d19d (diff) |
r300g: FS constants emission rework
* The constant buffer emission is separated from RC state variables emission.
* The immediates are emitted with FS code.
Diffstat (limited to 'src/gallium/drivers/r300/r300_fs.c')
-rw-r--r-- | src/gallium/drivers/r300/r300_fs.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c index c3f51ec932f..4969c1472b0 100644 --- a/src/gallium/drivers/r300/r300_fs.c +++ b/src/gallium/drivers/r300/r300_fs.c @@ -192,6 +192,7 @@ static void r300_translate_fragment_shader( struct r300_fragment_program_compiler compiler; struct tgsi_to_rc ttr; int wpos; + unsigned i; tgsi_scan_shader(tokens, &shader->info); r300_shader_read_fs_inputs(&shader->info, &shader->inputs); @@ -240,6 +241,7 @@ static void r300_translate_fragment_shader( /* Invoke the compiler */ r3xx_compile_fragment_program(&compiler); + if (compiler.Base.Error) { fprintf(stderr, "r300 FP: Compiler Error:\n%sUsing a dummy shader" " instead.\n", compiler.Base.ErrorMsg); @@ -252,6 +254,24 @@ static void r300_translate_fragment_shader( r300_dummy_fragment_shader(r300, shader); } + /* Initialize numbers of constants for each type. */ + shader->externals_count = ttr.immediate_offset; + shader->immediates_count = 0; + shader->rc_state_count = 0; + + for (i = shader->externals_count; i < shader->code.constants.Count; i++) { + switch (shader->code.constants.Constants[i].Type) { + case RC_CONSTANT_IMMEDIATE: + ++shader->immediates_count; + break; + case RC_CONSTANT_STATE: + ++shader->rc_state_count; + break; + default: + assert(0); + } + } + /* And, finally... */ rc_destroy(&compiler.Base); } |