diff options
author | Brian <[email protected]> | 2006-12-21 10:47:28 -0700 |
---|---|---|
committer | Brian <[email protected]> | 2006-12-21 10:47:28 -0700 |
commit | a0d6b506cdb1faa74d53fcb9d93de49985bc3e95 (patch) | |
tree | f0d418a56e647afb817dd26af704975127e4727a /src/mesa/shader/slang/slang_emit.c | |
parent | 356f8ea2132ca8b7a19869e5ff6d7c59a12bd5f0 (diff) |
added IR_NEG for negation
Diffstat (limited to 'src/mesa/shader/slang/slang_emit.c')
-rw-r--r-- | src/mesa/shader/slang/slang_emit.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index 39f470046b7..cc522131cef 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -78,6 +78,7 @@ static slang_ir_info IrInfo[] = { { IR_FLOOR, "IR_FLOOR", OPCODE_FLR, 4, 1 }, { IR_FRAC, "IR_FRAC", OPCODE_FRC, 4, 1 }, { IR_ABS, "IR_ABS", OPCODE_ABS, 4, 1 }, + { IR_NEG, "IR_NEG", OPCODE_NOP, 4, 1 }, /* XXX fix!!!! */ { IR_SIN, "IR_SIN", OPCODE_SIN, 1, 1 }, { IR_COS, "IR_COS", OPCODE_COS, 1, 1 }, /* other */ @@ -937,6 +938,40 @@ emit_unop(slang_gen_context *gc, slang_ir_node *n, struct gl_program *prog) static struct prog_instruction * +emit_negation(slang_gen_context *gc, slang_ir_node *n, struct gl_program *prog) +{ +#if 0 + struct prog_instruction *inst; + const slang_ir_info *info = slang_find_ir_info(n->Opcode); + assert(info); + + assert(info->NumParams == 1); + + emit(gc, n->Children[0], prog); + + inst = new_instruction(prog, info->InstOpcode); + /*slang_resolve_storage(gc, n, prog);*/ + + if (!n->Store) + slang_alloc_temp_storage(gc, n, info->ResultSize); + + storage_to_dst_reg(&inst->DstReg, n->Store, n->Writemask); + + storage_to_src_reg(&inst->SrcReg[0], n->Children[0]->Store, + n->Children[0]->Swizzle); + + inst->Comment = n->Comment; + + return inst; +#endif + /* XXX this is something we can optimize for, with a bit of work.*/ + abort(); + return NULL; +#endif +} + + +static struct prog_instruction * emit_label(const char *target, struct gl_program *prog) { struct prog_instruction *inst; @@ -1084,6 +1119,8 @@ emit(slang_gen_context *gc, slang_ir_node *n, struct gl_program *prog) case IR_SIN: case IR_COS: return emit_unop(gc, n, prog); + case IR_NEG: + return emit_negation(gc, n, prog): case IR_LABEL: return emit_label(n->Target, prog); case IR_FLOAT: |