summaryrefslogtreecommitdiff
path: root/src/i915_render.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2008-03-18 14:08:19 -0700
committerKeith Packard <keithp@keithp.com>2008-03-18 14:19:12 -0700
commit4b9b7b007d729f94b01b0031d8ae478134b501da (patch)
tree6bc0a712f35720a9d83a2972d08cb6190862656f /src/i915_render.c
parentf699389818f1f11f3edddcdddcd0a43be21ba4c0 (diff)
Handle projective transforms on 9xx for Composite.
Projective transforms require un-normalized texture coordinates and the use of the texldp instruction. The coordinates are passed as x/y/z/w (the z is unused, but there isn't a vertext format for just x/y/w).
Diffstat (limited to 'src/i915_render.c')
-rw-r--r--src/i915_render.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/i915_render.c b/src/i915_render.c
index 8ac1b78e..9c6da095 100644
--- a/src/i915_render.c
+++ b/src/i915_render.c
@@ -320,6 +320,7 @@ i915_prepare_composite(int op, PicturePtr pSrcPicture,
uint32_t blendctl;
int out_reg = FS_OC;
FS_LOCALS(20);
+ Bool is_affine_src, is_affine_mask;
IntelEmitInvarientState(pScrn);
*pI830->last_3d = LAST_3D_RENDER;
@@ -339,6 +340,8 @@ i915_prepare_composite(int op, PicturePtr pSrcPicture,
pI830->scale_units[1][0] = -1;
pI830->scale_units[1][1] = -1;
}
+ is_affine_src = i830_transform_is_affine (pI830->transform[0]);
+ is_affine_mask = i830_transform_is_affine (pI830->transform[1]);
if (pMask == NULL) {
BEGIN_BATCH(10);
@@ -389,9 +392,9 @@ i915_prepare_composite(int op, PicturePtr pSrcPicture,
OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(2) |
I1_LOAD_S(4) | I1_LOAD_S(5) | I1_LOAD_S(6) | 3);
- ss2 = S2_TEXCOORD_FMT(0, TEXCOORDFMT_2D);
+ ss2 = S2_TEXCOORD_FMT(0, is_affine_src ? TEXCOORDFMT_2D : TEXCOORDFMT_4D);
if (pMask)
- ss2 |= S2_TEXCOORD_FMT(1, TEXCOORDFMT_2D);
+ ss2 |= S2_TEXCOORD_FMT(1, is_affine_mask ? TEXCOORDFMT_2D : TEXCOORDFMT_4D);
else
ss2 |= S2_TEXCOORD_FMT(1, TEXCOORDFMT_NOT_PRESENT);
ss2 |= S2_TEXCOORD_FMT(2, TEXCOORDFMT_NOT_PRESENT);
@@ -435,7 +438,12 @@ i915_prepare_composite(int op, PicturePtr pSrcPicture,
i915_fs_dcl(FS_T1);
/* Load the pSrcPicture texel */
- i915_fs_texld(FS_R0, FS_S0, FS_T0);
+ if (is_affine_src) {
+ i915_fs_texld(FS_R0, FS_S0, FS_T0);
+ } else {
+ i915_fs_texldp(FS_R0, FS_S0, FS_T0);
+ }
+
/* If the texture lacks an alpha channel, force the alpha to 1. */
if (PICT_FORMAT_A(pSrcPicture->format) == 0)
i915_fs_mov_masked(FS_R0, MASK_W, i915_fs_operand_one());
@@ -445,7 +453,11 @@ i915_prepare_composite(int op, PicturePtr pSrcPicture,
i915_fs_mov(out_reg, i915_fs_operand_reg(FS_R0));
} else {
/* Load the pMaskPicture texel */
- i915_fs_texld(FS_R1, FS_S1, FS_T1);
+ if (is_affine_mask) {
+ i915_fs_texld(FS_R1, FS_S1, FS_T1);
+ } else {
+ i915_fs_texldp(FS_R1, FS_S1, FS_T1);
+ }
/* If the texture lacks an alpha channel, force the alpha to 1. */
if (PICT_FORMAT_A(pMaskPicture->format) == 0)
i915_fs_mov_masked(FS_R1, MASK_W, i915_fs_operand_one());