diff options
-rw-r--r-- | src/radeon_textured_videofuncs.c | 4 | ||||
-rw-r--r-- | src/radeon_video.h | 14 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/radeon_textured_videofuncs.c b/src/radeon_textured_videofuncs.c index 5b7b7875..ce500a1d 100644 --- a/src/radeon_textured_videofuncs.c +++ b/src/radeon_textured_videofuncs.c @@ -1147,13 +1147,13 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv OUT_VIDEO_REG(R500_GA_US_VECTOR_INDEX, (1 << 16)); /* const0 = {1 / texture[0].width, 0, 0, 0} */ - OUT_VIDEO_REG(R500_GA_US_VECTOR_DATA, (uint32_t)(1/pPriv->w)); + OUT_VIDEO_REG(R500_GA_US_VECTOR_DATA, r300PackFloat32(1.0/(float)pPriv->w)); OUT_VIDEO_REG(R500_GA_US_VECTOR_DATA, 0x0); OUT_VIDEO_REG(R500_GA_US_VECTOR_DATA, 0x0); OUT_VIDEO_REG(R500_GA_US_VECTOR_DATA, 0x0); /* const1 = {0, 1 / -texture[0].height, 0, 0) */ OUT_VIDEO_REG(R500_GA_US_VECTOR_DATA, 0x0); - OUT_VIDEO_REG(R500_GA_US_VECTOR_DATA, (uint32_t)(-1/pPriv->h)); + OUT_VIDEO_REG(R500_GA_US_VECTOR_DATA, r300PackFloat32(-1.0/(float)pPriv->h)); OUT_VIDEO_REG(R500_GA_US_VECTOR_DATA, 0x0); OUT_VIDEO_REG(R500_GA_US_VECTOR_DATA, 0x0); diff --git a/src/radeon_video.h b/src/radeon_video.h index b9ead1c5..34bfb307 100644 --- a/src/radeon_video.h +++ b/src/radeon_video.h @@ -15,6 +15,20 @@ #include "bicubic_table.h" +/* + * This function takes a float and packs it into a uint32_t. Thanks, Mesa! + */ +static inline uint32_t r300PackFloat32(float fl) +{ + union { + float fl; + uint32_t u; + } u; + + u.fl = fl; + return u.u; +} + /* Xvideo port struct */ typedef struct { uint32_t transform_index; |