diff options
author | Brian Paul <brianp@vmware.com> | 2009-07-09 07:58:50 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2009-07-09 07:58:50 -0600 |
commit | c86b0766681f986951e53ea852858eb8d6ce9e32 (patch) | |
tree | b2f10a30dab295f7009ce45bc3d147c5f05b2f90 | |
parent | abdb0fdcc05eb9ec87b3d5a3226c3c190e1fbbcd (diff) | |
download | external_mesa3d-c86b0766681f986951e53ea852858eb8d6ce9e32.zip external_mesa3d-c86b0766681f986951e53ea852858eb8d6ce9e32.tar.gz external_mesa3d-c86b0766681f986951e53ea852858eb8d6ce9e32.tar.bz2 |
glsl: do const parameter optimization for array element actual parameters
When a function parameter is const-qualified we can avoid making a copy
of the actual parameter (we basically do a search/replace when inlining).
This is now done for array element params too, resulting in better code
(fewer MOV instructions).
We should allow some other types of function arguments here but let's be
conservative for the moment.
-rw-r--r-- | src/mesa/shader/slang/slang_codegen.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 24e9952..2b7e781 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -1417,8 +1417,9 @@ slang_inline_function_call(slang_assemble_ctx * A, slang_function *fun, } else if (p->type.qualifier == SLANG_QUAL_CONST) { /* a constant input param */ - if (args[i].type == SLANG_OPER_IDENTIFIER || - args[i].type == SLANG_OPER_LITERAL_FLOAT) { + if (args[i].type == SLANG_OPER_IDENTIFIER || + args[i].type == SLANG_OPER_LITERAL_FLOAT || + args[i].type == SLANG_OPER_SUBSCRIPT) { /* replace all occurances of this parameter variable with the * actual argument variable or a literal. */ |