On Fri, Apr 24, 2015 at 5:08 PM, Axel Davy <axel.d...@ens.fr> wrote: > Le 24/04/2015 23:04, Ilia Mirkin a écrit : >> >> On Fri, Apr 24, 2015 at 4:09 PM, Axel Davy <axel.d...@ens.fr> wrote: >>> >>> Signed-off-by: Axel Davy <axel.d...@ens.fr> >>> --- >>> src/gallium/state_trackers/nine/nine_shader.c | 19 ++++++++++++++++++- >>> 1 file changed, 18 insertions(+), 1 deletion(-) >>> >>> diff --git a/src/gallium/state_trackers/nine/nine_shader.c >>> b/src/gallium/state_trackers/nine/nine_shader.c >>> index 2ba625e..0fd3d37 100644 >>> --- a/src/gallium/state_trackers/nine/nine_shader.c >>> +++ b/src/gallium/state_trackers/nine/nine_shader.c >>> @@ -2040,6 +2040,23 @@ DECL_SPECIAL(LOG) >>> return D3D_OK; >>> } >>> >>> +DECL_SPECIAL(LIT) >>> +{ >>> + struct ureg_program *ureg = tx->ureg; >>> + struct ureg_dst tmp = tx_scratch(tx); >>> + struct ureg_dst dst = tx_dst_param(tx, &tx->insn.dst[0]); >>> + struct ureg_src src = tx_src_param(tx, &tx->insn.src[0]); >>> + ureg_LIT(ureg, tmp, src); >>> + /* d3d9 LIT is the same than gallium LIT. One difference is that >>> d3d9 >>> + * states that dst.z is 0 when src.y <= 0. Gallium definition can >>> assign >>> + * it 0^0 if src.w=0, which value is driver dependent. */ >>> + ureg_CMP(ureg, ureg_writemask(dst, TGSI_WRITEMASK_Z), >>> + ureg_negate(ureg_scalar(src, TGSI_SWIZZLE_Y)), >>> + ureg_src(tmp), ureg_imm1f(ureg, 0.0f)); >>> + ureg_MOV(ureg, ureg_writemask(dst, TGSI_WRITEMASK_XYW), >>> ureg_src(tmp)); >> >> Why use a separate temp? Couldn't you just >> >> ureg_LIT(ureg, dst, src); >> ureg_CMP(ureg, writemask(dst, Z), -src.y, ureg_src(dst), ureg_imm1f(0.0)) >> ? >> > Isn't there a restriction in the case dst is an output register of the > shader ? Reading from it would be forbidden. > Also likely it is easier to optimiser for compilers with the temp version.
Ah yes. Usually that doesn't come in st/mesa, but I guess it can happen with d3d9. OK. Reviewed-by: Ilia Mirkin <imir...@alum.mit.edu> _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev