+ ureg_TEX(ureg, dst, ps1x_sampler_type(tx->info, m + 2), ureg_src(dst), sample);
+ break;
+ case D3DSIO_TEXM3x3VSPEC:
+ sample = ureg_DECL_sampler(ureg, m + 2);
+ tx->info->sampler_mask |= 1 << (m + 2);
+ E = tx_scratch(tx);
+ tmp = ureg_writemask(tx_scratch(tx), TGSI_WRITEMASK_XYZ);
+ ureg_MOV(ureg, ureg_writemask(E, TGSI_WRITEMASK_X), ureg_scalar(tx->regs.vT[m], TGSI_SWIZZLE_W));
+ ureg_MOV(ureg, ureg_writemask(E, TGSI_WRITEMASK_Y), ureg_scalar(tx->regs.vT[m+1], TGSI_SWIZZLE_W));
+ ureg_MOV(ureg, ureg_writemask(E, TGSI_WRITEMASK_Z), ureg_scalar(tx->regs.vT[m+2], TGSI_SWIZZLE_W));
+ /* At this step, dst = N = (u', w', z').
+ * We want dst to be the texture sampled at (u'', w'', z''), with
+ * (u'', w'', z'') = 2 * (N.E / N.N) * N - E */
+ ureg_DP3(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_X), ureg_src(dst), ureg_src(dst));
+ ureg_RCP(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_X), ureg_scalar(ureg_src(tmp), TGSI_SWIZZLE_X));
+ /* at this step tmp.x = 1/N.N */
+ ureg_DP3(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_Y), ureg_src(dst), ureg_src(E));
+ /* at this step tmp.y = N.E */
+ ureg_MUL(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_X), ureg_scalar(ureg_src(tmp), TGSI_SWIZZLE_X), ureg_scalar(ureg_src(tmp), TGSI_SWIZZLE_Y));
+ /* at this step tmp.x = N.E/N.N */
+ ureg_MUL(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_X), ureg_scalar(ureg_src(tmp), TGSI_SWIZZLE_X), ureg_imm1f(ureg, 2.0f));
+ ureg_MUL(ureg, tmp, ureg_scalar(ureg_src(tmp), TGSI_SWIZZLE_X), ureg_src(dst));
+ /* at this step tmp.xyz = 2 * (N.E / N.N) * N */
+ ureg_SUB(ureg, tmp, ureg_src(tmp), ureg_src(E));
+ ureg_TEX(ureg, dst, ps1x_sampler_type(tx->info, m + 2), ureg_src(tmp), sample);