mesa: Branch 'glsl-compiler-1' - 2 commits
Brian Paul
brianp at kemper.freedesktop.org
Fri Dec 22 18:03:30 UTC 2006
src/mesa/shader/slang/slang_codegen.c | 13 +++++++++++--
src/mesa/shader/slang/slang_emit.c | 27 ++++++++-------------------
src/mesa/shader/slang/slang_ir.h | 4 ++--
3 files changed, 21 insertions(+), 23 deletions(-)
New commits:
diff-tree d8babcfc570ef97b284f88f01151f00eb188a2fd (from aa710c3e6b17a4af54f2243de8888da4844d5c75)
Author: Brian <brian at yutani.localnet.net>
Date: Fri Dec 22 10:26:22 2006 -0700
fix typos
diff --git a/src/mesa/shader/slang/slang_ir.h b/src/mesa/shader/slang/slang_ir.h
index 7c5e044..405d799 100644
--- a/src/mesa/shader/slang/slang_ir.h
+++ b/src/mesa/shader/slang/slang_ir.h
@@ -24,7 +24,7 @@
/**
* \file slang_ir.h
- * Mesa GLSL Itermediate Representation tree types and constants.
+ * Mesa GLSL Intermediate Representation tree types and constants.
* \author Brian Paul
*/
@@ -69,7 +69,7 @@ typedef enum
IR_EXP2, /* 2^x */
IR_LOG2, /* log base 2 */
IR_RSQ, /* 1/sqrt() */
- IR_RCP, /* recipricol */
+ IR_RCP, /* reciprocol */
IR_FLOOR,
IR_FRAC,
IR_ABS, /* absolute value */
diff-tree aa710c3e6b17a4af54f2243de8888da4844d5c75 (from 9b694589e9c47a777ce9f7fab6e4ef90d3c94c80)
Author: Brian <brian at yutani.localnet.net>
Date: Fri Dec 22 10:18:50 2006 -0700
implement unary +, -
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 0f7a5a4..3fca45c 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -84,7 +84,7 @@ static slang_asm_info AsmInfo[] = {
{ "vec4_floor", IR_FLOOR, 1, 1 },
{ "vec4_frac", IR_FRAC, 1, 1 },
{ "vec4_abs", IR_ABS, 1, 1 },
- { "vec4_neg", IR_NEG, 1, 1 },
+ { "vec4_negate", IR_NEG, 1, 1 },
/* float binary op */
{ "float_add", IR_ADD, 1, 2 },
{ "float_subtract", IR_SUB, 1, 2 },
@@ -1426,7 +1426,16 @@ _slang_gen_operation(slang_assemble_ctx
n = _slang_gen_function_call_name(A, "/", oper, NULL);
return n;
}
-
+ case slang_oper_minus:
+ {
+ slang_ir_node *n;
+ assert(oper->num_children == 1);
+ n = _slang_gen_function_call_name(A, "-", oper, NULL);
+ return n;
+ }
+ case slang_oper_plus:
+ /* +expr --> do nothing */
+ return _slang_gen_operation(A, &oper->children[0]);
case slang_oper_variable_decl:
return _slang_gen_declaration(A, oper);
case slang_oper_assign:
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c
index 2b631a3..8b0999d 100644
--- a/src/mesa/shader/slang/slang_emit.c
+++ b/src/mesa/shader/slang/slang_emit.c
@@ -78,7 +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_NEG, "IR_NEG", 0/*spec case*/, 4, 1 },
{ IR_SIN, "IR_SIN", OPCODE_SIN, 1, 1 },
{ IR_COS, "IR_COS", OPCODE_COS, 1, 1 },
/* other */
@@ -921,7 +921,6 @@ emit_unop(slang_gen_context *gc, slang_i
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);
@@ -940,34 +939,24 @@ emit_unop(slang_gen_context *gc, slang_i
static struct prog_instruction *
emit_negation(slang_gen_context *gc, slang_ir_node *n, struct gl_program *prog)
{
-#if 0
+ /* Implement as MOV dst, -src; */
+ /* XXX we could look at the previous instruction and in some circumstances
+ * modify it to accomplish the negation.
+ */
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);
+ slang_alloc_temp_storage(gc, n, n->Children[0]->Store->Size);
+ inst = new_instruction(prog, OPCODE_MOV);
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->SrcReg[0].NegateBase = NEGATE_XYZW;
inst->Comment = n->Comment;
-
return inst;
-#else
- /* XXX this is something we can optimize for, with a bit of work.*/
- abort();
- return NULL;
-#endif
}
More information about the mesa-commit
mailing list