summaryrefslogtreecommitdiff
path: root/src/mesa/shader/slang/slang_emit.c
AgeCommit message (Collapse)Author
2007-03-23Fix issues related to the 'continue' statement.Brian
IR_LOOP now has two children: the body code, and the tail code. Tail code is the "i++" part of a for-loop, or the expression at the end of a "do {} while(expr);" loop. "continue" translates into: "execute tail code; CONT;" Also, the test for infinite do/while loops was incorrect.
2007-03-23Add the ability to generate programs that doesn't use condition codes.Brian
ctx->Shader.EmitCondCodes determines if we use condition codes. If not, IF statement uses first operand's X component as the condition. Added OPCODE_BRK0, OPCODE_BRK1, OPCODE_CONT0, OPCODE_CONT1 to handle the common cases of conditional break/continue.
2007-03-23updated commentBrian
2007-03-22Overhaul emit_compare() function.Brian
Previously, comparing vec2, vec3, vec4 was broken. Added IR_EQUAL, IR_NOTEQUAL nodes/operators to compute boolean equality/inequality vs. IR_SEQUAL/IR_SNEQUAL which work component-wise. Use IR_EQUAL/IR_NOTEQUAL for the == and != operators. To compute vec4 equality, use SNE, DP4, SEQ instruction sequence.
2007-03-22First pass at implementing structure compares.Brian
Need to improve this. There may be holes in a structure so we can't just blindly compare the full 4-float registers.
2007-03-21Support for user-defined structures.Brian
struct == and != operators not finished yet. Struct assignment works though.
2007-03-14remove old assertionBrian
2007-03-13disable some debug outputBrian
2007-03-13Shuffle some code around in the emit_tex() and emit_move() instructions.Brian
Note that the inst ptr returned by new_instruction() may become invalid after calling emit_() since the emit functions may allocate new instructions which is done vial realloc(). Also, add some new assertions to try to catch this kind of bug.
2007-03-10add NULL ptr check in emit_cond()Brian
2007-03-08Added IR_SLE and IR_SLT for <= and < operations.Brian
Using IR_SGE and IR_SGT with transposed args doesn't work since the __asm calls don't do argument matching by name, but by position. This fixes the broken lessThan() and lessThanEqual() functions.
2007-03-08fix tmp storage problem for IR_I_TO_FBrian
2007-03-08fix assertionBrian
2007-03-08IR_CJUMP0/1 no longer used/neededBrian
2007-03-08remove old assertionBrian
2007-03-07remove unneeded return stmtBrian
2007-03-07Fix problem with nested function calls such as y = f(f(x))Brian
Replace CurFunction with curFuncEndLabel.
2007-03-06fix some int arithmetic problemsBrian
2007-02-26Add EmitHighLevelInstructions, EmitComments booleans to gl_shader_state.Brian
These control code generation options. May be overridden by drivers, debuggers, etc.
2007-02-26Overhaul of error handling.Brian
2007-02-26Use new slang_emit_info struct for passing context info around.Brian
2007-02-23comments, clean-upBrian
2007-02-23Replace slang_ir_node::Target w/ Field. Remove Comment field. Clean-up.Brian
2007-02-23Re-implement branching with slang_labels.Brian
This eliminates the NOP instructions that had been used as placeholders for branch targets. Also, fix "return" statement bug.
2007-02-22debug code for emitting variable allocation commentsBrian
2007-02-21remove dead codeBrian
2007-02-21adjustments to STATE_ token layout/format so token[1] is always the array indexBrian
2007-02-21checkpoint overhaul of pre-defined uniform codeBrian
2007-02-20clean-up, move IR_ELEMENT codeBrian
2007-02-20alloc IR_FIELD's Storage in codegen, like IR_ELEMENTBrian
2007-02-20implement support for pre-defined uniform structs (state vars)Brian
2007-02-16implement IR_I_TO_FBrian
2007-02-09comments, etcBrian
2007-02-08optimize conditional breaks/continuesBrian
2007-02-08cont at top of loop, little clean-upsBrian
2007-02-08fix broken BRA for return stmtsBrian
2007-02-08Use conditional break in for/do/while loops.Brian
2007-02-07high vs. low level if/then/else code emitBrian
2007-02-07Use IR_LOOP to represent do-while and for-loops.Brian
Also, start moving high vs. low-level instruction selection into slang_emit.c
2007-02-06Implement CONT, improve BRK.Brian
IR_LOOP's BranchNode ptr is the head of a linked list of CONT and BRK nodes. After emitting loop, walk over the linked list, filling in the CONT/BRK instruction's BranchTarget field (location of the ENDLOOP instruction, or one past).
2007-02-06replace IR_BEGIN_LOOP/IR_END_LOOP with IR_LOOPBrian
2007-02-06redo IR_IF node, removing IR_ELSE, IR_ENDIFBrian
2007-02-05BRK instruction's BranchTarget field now used for efficiently breaking out ↵Brian
of loops. BRK's BranchTarget field actually points to the top of the loop, not the bottom, since we don't know the later's location yet. In the interpreter, basically do an indirect jump to update the PC.
2007-02-05Use IR node's BranchNode field for IF/ELSE/ENDIF instructions.Brian
This allows us to back-patch the IF/ELSE instruction's BranchTarget field to point to the location of the ELSE/ENDIF instructions. No longer have to search for ELSE/ENDIF in the interpreter. Also makes it trivial to translate IF/ELSE instructions into conditional/unconditional BRA instructions.
2007-02-05Initial implementation of high-level flow-control instructions.Brian
IF/ELSE/ENDIF and BEGIN_LOOP/END_LOOP/BREAK instructions seem to work. Disabled by default though until better tested. Implemented IR_NOT, but needs optimization.
2007-02-05Initial support of loop and subroutine instructions.Brian
New high-level flow-control instructions, both at IR level and GPU instructions for looping and subroutines.
2007-02-02fix emit_tex() breakageBrian
2007-01-31Overhaul handling of writemasks/swizzling. This fixes two problem cases:Brian
vec2 v; v.x = v.y = 1.0; // chained assignment vec4 v; v.zx = vec2(a,b); // swizzled writemask
2007-01-31New asm instruction and IR_CLAMP node type to allow clamping to [0,1] with ↵Brian
instruction saturate-write option. Not finished yet.
2007-01-28noise functionsBrian