diff options
author | Eric Anholt <[email protected]> | 2010-08-28 22:56:33 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2010-08-30 10:26:05 -0700 |
commit | b0a933a4d91c47e697459921073f8afe668bac31 (patch) | |
tree | 9bb2845c5980c50aab31878fd1728889d496c8b7 /src | |
parent | 4ff25c2106fb981334bdc1b032fcf37d8753ba62 (diff) |
i965: Add "discard" support to the new FS backend.
Fixes 3 testcases related to discard.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 0d29c86ce2a..fd65ab2fa77 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -70,6 +70,7 @@ enum fs_opcodes { FS_OPCODE_TEX, FS_OPCODE_TXB, FS_OPCODE_TXL, + FS_OPCODE_DISCARD, }; static int using_new_fs = -1; @@ -433,6 +434,7 @@ public: struct brw_reg *src); void generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src); void generate_math(fs_inst *inst, struct brw_reg dst, struct brw_reg *src); + void generate_discard(fs_inst *inst); void emit_dummy_fs(); void emit_interpolation(); @@ -995,7 +997,9 @@ fs_visitor::visit(ir_swizzle *ir) void fs_visitor::visit(ir_discard *ir) { - assert(!"FINISHME"); + assert(ir->condition == NULL); /* FINISHME */ + + emit(fs_inst(FS_OPCODE_DISCARD)); } void @@ -1460,6 +1464,17 @@ fs_visitor::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src) BRW_SAMPLER_SIMD_MODE_SIMD8); } +void +fs_visitor::generate_discard(fs_inst *inst) +{ + struct brw_reg g0 = retype(brw_vec1_grf(0, 0), BRW_REGISTER_TYPE_UW); + brw_push_insn_state(p); + brw_set_mask_control(p, BRW_MASK_DISABLE); + brw_NOT(p, c->emit_mask_reg, brw_mask_reg(1)); /* IMASK */ + brw_AND(p, g0, c->emit_mask_reg, g0); + brw_pop_insn_state(p); +} + static void trivial_assign_reg(int header_size, fs_reg *reg) { @@ -1694,6 +1709,9 @@ fs_visitor::generate_code() case FS_OPCODE_TXL: generate_tex(inst, dst, src[0]); break; + case FS_OPCODE_DISCARD: + generate_discard(inst); + break; case FS_OPCODE_FB_WRITE: generate_fb_write(inst); break; |