diff options
Diffstat (limited to 'src/mesa/main/macros.h')
-rw-r--r-- | src/mesa/main/macros.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index 029f609fd93..dbe5b867c29 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -54,6 +54,10 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256]; #define FLOAT_TO_BYTE(X) ( (((GLint) (255.0F * (X))) - 1) / 2 ) +/** Convert GLbyte to GLfloat while preserving zero */ +#define BYTE_TO_FLOATZ(B) ((B) == 0 ? 0.0F : BYTE_TO_FLOAT(B)) + + /** Convert GLbyte in [-128,127] to GLfloat in [-1.0,1.0], texture/fb data */ #define BYTE_TO_FLOAT_TEX(B) ((B) == -128 ? -1.0F : (B) * (1.0F/127.0F)) @@ -73,6 +77,9 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256]; /** Convert GLfloat in [-1.0,1.0] to GLshort in [-32768,32767] */ #define FLOAT_TO_SHORT(X) ( (((GLint) (65535.0F * (X))) - 1) / 2 ) +/** Convert GLshort to GLfloat while preserving zero */ +#define SHORT_TO_FLOATZ(S) ((S) == 0 ? 0.0F : SHORT_TO_FLOAT(S)) + /** Convert GLshort in [-32768,32767] to GLfloat in [-1.0,1.0], texture/fb data */ #define SHORT_TO_FLOAT_TEX(S) ((S) == -32768 ? -1.0F : (S) * (1.0F/32767.0F)) |