diff options
author | Yang Zhao <yang@yangman.ca> | 2009-03-12 13:01:06 +0100 |
---|---|---|
committer | Matthias Hopf <mhopf@suse.de> | 2009-03-12 13:01:06 +0100 |
commit | 2beb24c9676cfbfc08a7c999868248c04bdc49f6 (patch) | |
tree | cc5c1717c21848ee12e4fdd021c03efd40dd9485 | |
parent | 6ac4d31eb4ac67fcc6cf6c9e04419b60d2c7d80c (diff) |
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.
-rw-r--r-- | r600_shader.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/r600_shader.h b/r600_shader.h index 03f6416..51e5275 100644 --- a/r600_shader.h +++ b/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 |