/* calculate the texture offsets
* t_tc.x = i_tc.x
- * t_tc.y = (round(i_tc.y) + 0.5) / height * 2
+ * t_tc.y = (round(i_tc.y - 0.5) + 0.5) / height * 2
*/
for (i = 0; i < 2; ++i) {
ureg_MOV(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_X), i_tc[i]);
- ureg_ROUND(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_YZ), i_tc[i]);
+ ureg_SUB(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_YZ),
+ i_tc[i], ureg_imm1f(shader, 0.5f));
+ ureg_ROUND(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_YZ), ureg_src(t_tc[i]));
ureg_MOV(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_W),
- ureg_imm1f(shader, i ? 0.75f : 0.25f));
+ ureg_imm1f(shader, i ? -0.25f : 0.25f));
ureg_ADD(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_YZ),
ureg_src(t_tc[i]), ureg_imm1f(shader, 0.5f));
ureg_MUL(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_Y),
ureg_ROUND(shader, ureg_writemask(t_tc[0], TGSI_WRITEMASK_YZ), i_tc[0]);
ureg_ADD(shader, ureg_writemask(t_tc[0], TGSI_WRITEMASK_YZ),
ureg_src(t_tc[0]), ureg_negate(i_tc[0]));
- ureg_MUL(shader, ureg_writemask(t_tc[0], TGSI_WRITEMASK_XY),
+ ureg_MUL(shader, ureg_writemask(t_tc[0], TGSI_WRITEMASK_YZ),
ureg_abs(ureg_src(t_tc[0])), ureg_imm1f(shader, 2.0f));
ureg_LRP(shader, t_texel[0], ureg_swizzle(ureg_src(t_tc[0]),
TGSI_SWIZZLE_Y, TGSI_SWIZZLE_Z, TGSI_SWIZZLE_Z, TGSI_SWIZZLE_Z),
- ureg_src(t_texel[1]), ureg_src(t_texel[0]));
+ ureg_src(t_texel[0]), ureg_src(t_texel[1]));
/* and finally do colour space transformation
* fragment = csc * texel