mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-22 19:20:22 +01:00
mesa: move GLfixed type and related macros to swrast module
Fixed point is only used in swrast and sw-based drivers.
This commit is contained in:
parent
8bf25a17d2
commit
389d50baff
3 changed files with 34 additions and 32 deletions
|
|
@ -78,38 +78,6 @@
|
|||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Fixed point data type.
|
||||
*/
|
||||
typedef int GLfixed;
|
||||
/*
|
||||
* Fixed point arithmetic macros
|
||||
*/
|
||||
#ifndef FIXED_FRAC_BITS
|
||||
#define FIXED_FRAC_BITS 11
|
||||
#endif
|
||||
|
||||
#define FIXED_SHIFT FIXED_FRAC_BITS
|
||||
#define FIXED_ONE (1 << FIXED_SHIFT)
|
||||
#define FIXED_HALF (1 << (FIXED_SHIFT-1))
|
||||
#define FIXED_FRAC_MASK (FIXED_ONE - 1)
|
||||
#define FIXED_INT_MASK (~FIXED_FRAC_MASK)
|
||||
#define FIXED_EPSILON 1
|
||||
#define FIXED_SCALE ((float) FIXED_ONE)
|
||||
#define FIXED_DBL_SCALE ((double) FIXED_ONE)
|
||||
#define FloatToFixed(X) (IROUND((X) * FIXED_SCALE))
|
||||
#define FixedToDouble(X) ((X) * (1.0 / FIXED_DBL_SCALE))
|
||||
#define IntToFixed(I) ((I) << FIXED_SHIFT)
|
||||
#define FixedToInt(X) ((X) >> FIXED_SHIFT)
|
||||
#define FixedToUns(X) (((unsigned int)(X)) >> FIXED_SHIFT)
|
||||
#define FixedCeil(X) (((X) + FIXED_ONE - FIXED_EPSILON) & FIXED_INT_MASK)
|
||||
#define FixedFloor(X) ((X) & FIXED_INT_MASK)
|
||||
#define FixedToFloat(X) ((X) * (1.0F / FIXED_SCALE))
|
||||
#define PosFloatToFixed(X) FloatToFixed(X)
|
||||
#define SignedFloatToFixed(X) FloatToFixed(X)
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \name Some forward type declarations
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -288,6 +288,34 @@ swrast_render_finish(GLcontext *ctx)
|
|||
|
||||
|
||||
|
||||
/*
|
||||
* Fixed point arithmetic macros
|
||||
*/
|
||||
#ifndef FIXED_FRAC_BITS
|
||||
#define FIXED_FRAC_BITS 11
|
||||
#endif
|
||||
|
||||
#define FIXED_SHIFT FIXED_FRAC_BITS
|
||||
#define FIXED_ONE (1 << FIXED_SHIFT)
|
||||
#define FIXED_HALF (1 << (FIXED_SHIFT-1))
|
||||
#define FIXED_FRAC_MASK (FIXED_ONE - 1)
|
||||
#define FIXED_INT_MASK (~FIXED_FRAC_MASK)
|
||||
#define FIXED_EPSILON 1
|
||||
#define FIXED_SCALE ((float) FIXED_ONE)
|
||||
#define FIXED_DBL_SCALE ((double) FIXED_ONE)
|
||||
#define FloatToFixed(X) (IROUND((X) * FIXED_SCALE))
|
||||
#define FixedToDouble(X) ((X) * (1.0 / FIXED_DBL_SCALE))
|
||||
#define IntToFixed(I) ((I) << FIXED_SHIFT)
|
||||
#define FixedToInt(X) ((X) >> FIXED_SHIFT)
|
||||
#define FixedToUns(X) (((unsigned int)(X)) >> FIXED_SHIFT)
|
||||
#define FixedCeil(X) (((X) + FIXED_ONE - FIXED_EPSILON) & FIXED_INT_MASK)
|
||||
#define FixedFloor(X) ((X) & FIXED_INT_MASK)
|
||||
#define FixedToFloat(X) ((X) * (1.0F / FIXED_SCALE))
|
||||
#define PosFloatToFixed(X) FloatToFixed(X)
|
||||
#define SignedFloatToFixed(X) FloatToFixed(X)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* XXX these macros are just bandages for now in order to make
|
||||
* CHAN_BITS==32 compile cleanly.
|
||||
|
|
|
|||
|
|
@ -75,6 +75,12 @@ typedef struct {
|
|||
} SWvertex;
|
||||
|
||||
|
||||
/**
|
||||
* Fixed point data type.
|
||||
*/
|
||||
typedef int GLfixed;
|
||||
|
||||
|
||||
#define FRAG_ATTRIB_CI FRAG_ATTRIB_COL0
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue