diff options
author | Connor Abbott <[email protected]> | 2014-08-01 16:24:44 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2014-10-15 17:05:00 -0700 |
commit | eaadc431920fe31b13c11b0c78e7eb2226a920a0 (patch) | |
tree | c1bfe7b8416350e5c20454efa8b8ed575300eefd /src | |
parent | cbde5407c99d0bbd58d496d7ce01f5c0b5828d63 (diff) |
i965/fs: Don't use ir->lod_info.grad.dPd<x,y> in emit_texture_*.
This drops a dependency on ir_texture objects.
v2 (Ken): Rename lod_components to grad_components, as it only has a
meaningful value for ir_txd. We could set it to 1 for TXL,
but there's no real need.
Signed-off-by: Connor Abbott <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Chris Forbes <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.h | 9 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_fp.cpp | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 34 |
3 files changed, 31 insertions, 18 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index 961148721c0..54410313e9f 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -472,16 +472,19 @@ public: bool is_rect, uint32_t sampler, int texunit); fs_inst *emit_texture_gen4(ir_texture *ir, fs_reg dst, fs_reg coordinate, int coord_components, - fs_reg shadow_comp, fs_reg lod, fs_reg lod2, + fs_reg shadow_comp, + fs_reg lod, fs_reg lod2, int grad_components, uint32_t sampler); fs_inst *emit_texture_gen5(ir_texture *ir, fs_reg dst, fs_reg coordinate, int coord_components, - fs_reg shadow_comp, fs_reg lod, fs_reg lod2, + fs_reg shadow_comp, + fs_reg lod, fs_reg lod2, int grad_components, fs_reg sample_index, uint32_t sampler, bool has_offset); fs_inst *emit_texture_gen7(ir_texture *ir, fs_reg dst, fs_reg coordinate, int coord_components, - fs_reg shadow_comp, fs_reg lod, fs_reg lod2, + fs_reg shadow_comp, + fs_reg lod, fs_reg lod2, int grad_components, fs_reg sample_index, fs_reg mcs, fs_reg sampler, fs_reg offset_value); fs_reg emit_mcs_fetch(fs_reg coordinate, int components, fs_reg sampler); diff --git a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp index 27bc928fec3..a77769b2086 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp @@ -487,11 +487,11 @@ fs_visitor::emit_fragment_program_code() fs_inst *inst; if (brw->gen >= 7) { - inst = emit_texture_gen7(ir, dst, coordinate, coord_components, shadow_c, lod, dpdy, sample_index, fs_reg(0u), fs_reg(fpi->TexSrcUnit), texel_offset); + inst = emit_texture_gen7(ir, dst, coordinate, coord_components, shadow_c, lod, dpdy, 0, sample_index, fs_reg(0u), fs_reg(fpi->TexSrcUnit), texel_offset); } else if (brw->gen >= 5) { - inst = emit_texture_gen5(ir, dst, coordinate, coord_components, shadow_c, lod, dpdy, sample_index, fpi->TexSrcUnit, false); + inst = emit_texture_gen5(ir, dst, coordinate, coord_components, shadow_c, lod, dpdy, 0, sample_index, fpi->TexSrcUnit, false); } else { - inst = emit_texture_gen4(ir, dst, coordinate, coord_components, shadow_c, lod, dpdy, fpi->TexSrcUnit); + inst = emit_texture_gen4(ir, dst, coordinate, coord_components, shadow_c, lod, dpdy, 0, fpi->TexSrcUnit); } inst->shadow_compare = fpi->TexShadow; diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 4580527510c..3096e3fd8d6 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -1168,7 +1168,8 @@ fs_visitor::visit(ir_assignment *ir) fs_inst * fs_visitor::emit_texture_gen4(ir_texture *ir, fs_reg dst, fs_reg coordinate, int coord_components, - fs_reg shadow_c, fs_reg lod, fs_reg dPdy, + fs_reg shadow_c, + fs_reg lod, fs_reg dPdy, int grad_components, uint32_t sampler) { int mlen; @@ -1243,17 +1244,17 @@ fs_visitor::emit_texture_gen4(ir_texture *ir, fs_reg dst, * dPdx.x dPdx.y dPdx.z dPdy.x dPdy.y dPdy.z * m5 m6 m7 m8 m9 m10 */ - for (int i = 0; i < ir->lod_info.grad.dPdx->type->vector_elements; i++) { + for (int i = 0; i < grad_components; i++) { emit(MOV(fs_reg(MRF, base_mrf + mlen), dPdx)); dPdx = offset(dPdx, 1); } - mlen += MAX2(ir->lod_info.grad.dPdx->type->vector_elements, 2); + mlen += MAX2(grad_components, 2); - for (int i = 0; i < ir->lod_info.grad.dPdy->type->vector_elements; i++) { + for (int i = 0; i < grad_components; i++) { emit(MOV(fs_reg(MRF, base_mrf + mlen), dPdy)); dPdy = offset(dPdy, 1); } - mlen += MAX2(ir->lod_info.grad.dPdy->type->vector_elements, 2); + mlen += MAX2(grad_components, 2); } else if (ir->op == ir_txs) { /* There's no SIMD8 resinfo message on Gen4. Use SIMD16 instead. */ simd16 = true; @@ -1342,7 +1343,8 @@ fs_visitor::emit_texture_gen4(ir_texture *ir, fs_reg dst, fs_inst * fs_visitor::emit_texture_gen5(ir_texture *ir, fs_reg dst, fs_reg coordinate, int vector_elements, - fs_reg shadow_c, fs_reg lod, fs_reg lod2, + fs_reg shadow_c, + fs_reg lod, fs_reg lod2, int grad_components, fs_reg sample_index, uint32_t sampler, bool has_offset) { @@ -1402,7 +1404,7 @@ fs_visitor::emit_texture_gen5(ir_texture *ir, fs_reg dst, * - dPdx.x dPdy.x dPdx.y dPdy.y dPdx.z dPdy.z */ msg_end = msg_lod; - for (int i = 0; i < ir->lod_info.grad.dPdx->type->vector_elements; i++) { + for (int i = 0; i < grad_components; i++) { emit(MOV(msg_end, lod)); lod = offset(lod, 1); msg_end = offset(msg_end, 1); @@ -1482,7 +1484,8 @@ is_high_sampler(struct brw_context *brw, fs_reg sampler) fs_inst * fs_visitor::emit_texture_gen7(ir_texture *ir, fs_reg dst, fs_reg coordinate, int coord_components, - fs_reg shadow_c, fs_reg lod, fs_reg lod2, + fs_reg shadow_c, + fs_reg lod, fs_reg lod2, int grad_components, fs_reg sample_index, fs_reg mcs, fs_reg sampler, fs_reg offset_value) { @@ -1548,7 +1551,7 @@ fs_visitor::emit_texture_gen7(ir_texture *ir, fs_reg dst, /* For cube map array, the coordinate is (u,v,r,ai) but there are * only derivatives for (u, v, r). */ - if (i < ir->lod_info.grad.dPdx->type->vector_elements) { + if (i < grad_components) { emit(MOV(sources[length], lod)); lod = offset(lod, 1); length++; @@ -1957,6 +1960,7 @@ fs_visitor::visit(ir_texture *ir) } fs_reg lod, lod2, sample_index, mcs; + int grad_components = 0; switch (ir->op) { case ir_tex: case ir_lod: @@ -1973,6 +1977,8 @@ fs_visitor::visit(ir_texture *ir) ir->lod_info.grad.dPdy->accept(this); lod2 = this->result; + + grad_components = ir->lod_info.grad.dPdx->type->vector_elements; break; case ir_txf: case ir_txl: @@ -2002,16 +2008,20 @@ fs_visitor::visit(ir_texture *ir) if (brw->gen >= 7) { inst = emit_texture_gen7(ir, dst, coordinate, coord_components, shadow_comparitor, - lod, lod2, sample_index, mcs, sampler_reg, + lod, lod2, grad_components, + sample_index, mcs, sampler_reg, offset_value); } else if (brw->gen >= 5) { inst = emit_texture_gen5(ir, dst, coordinate, coord_components, shadow_comparitor, - lod, lod2, sample_index, sampler, + lod, lod2, grad_components, + sample_index, sampler, ir->offset != NULL); } else { inst = emit_texture_gen4(ir, dst, coordinate, coord_components, - shadow_comparitor, lod, lod2, sampler); + shadow_comparitor, + lod, lod2, grad_components, + sampler); } if (offset_value.file == IMM) |