summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCorbin Simpson <MostAwesomeDude@gmail.com>2008-07-28 19:50:10 -0700
committerAlex Deucher <alexdeucher@gmail.com>2008-08-25 06:22:19 -0400
commitf3b81c7582aed307fa44e134ee161cd8a3158657 (patch)
tree0ae564a7edbc3b2048c0633a957fd8e913981cb9 /src
parent7dbb7023ba023ec1a38be63af9c9f49e40222b7b (diff)
Fix constants.
Diffstat (limited to 'src')
-rw-r--r--src/radeon_textured_videofuncs.c4
-rw-r--r--src/radeon_video.h14
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;