summaryrefslogtreecommitdiff
path: root/src/r600_shader.h
diff options
context:
space:
mode:
authorYang Zhao <yang@yangman.ca>2009-03-12 18:50:32 -0400
committerAlex Deucher <alexdeucher@gmail.com>2009-03-12 18:50:32 -0400
commit1fe0dcfe98dfe30499ba53c1f208c4ef10bef001 (patch)
treed5716df817fefa32e0a54d9ab4582a9e712fdd0e /src/r600_shader.h
parentf356ca7795531e0c080775efb598141eb7db44ba (diff)
R6xx/R7xx shader: Fix OFFSET_[XYZ] macro for TEX_DWORD2 to accept floats
Values for OFFSET_[XYZ] are 5-bits two's-complement fixed-point with one-bit after decimal point. Values in [-8.0, 7.5] are valid. Inputs that do not exactly land on 0.5 increments are rounded towards 0 to the nearest increment.
Diffstat (limited to 'src/r600_shader.h')
-rw-r--r--src/r600_shader.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/r600_shader.h b/src/r600_shader.h
index ffb50c34..67b64ff6 100644
--- a/src/r600_shader.h
+++ b/src/r600_shader.h
@@ -326,9 +326,9 @@
#define COORD_TYPE_W(x) (x)
#define TEX_UNNORMALIZED 0
#define TEX_NORMALIZED 1
-#define OFFSET_X(x) (x)
-#define OFFSET_Y(x) (x)
-#define OFFSET_Z(x) (x)
+#define OFFSET_X(x) (((int)(x) * 2) & 0x1f) /* 4:1-bits 2's-complement fixed-point: [-8.0..7.5] */
+#define OFFSET_Y(x) (((int)(x) * 2) & 0x1f)
+#define OFFSET_Z(x) (((int)(x) * 2) & 0x1f)
#define SAMPLER_ID(x) (x)
// R7xx has an additional parameter ALT_CONST. We always expose it, but ALT_CONST is R7xx only