Software: Apply static to some functions

This commit is contained in:
Lioncash 2014-08-10 21:51:05 -04:00
parent 568bdec598
commit 4129cdeb4d
7 changed files with 41 additions and 32 deletions

View File

@ -20,12 +20,12 @@ namespace EfbInterface
{
u32 perf_values[PQ_NUM_MEMBERS];
inline u32 GetColorOffset(u16 x, u16 y)
static inline u32 GetColorOffset(u16 x, u16 y)
{
return (x + y * EFB_WIDTH) * 3;
}
inline u32 GetDepthOffset(u16 x, u16 y)
static inline u32 GetDepthOffset(u16 x, u16 y)
{
return (x + y * EFB_WIDTH) * 3 + DEPTH_BUFFER_START;
}

View File

@ -83,11 +83,9 @@ void Init()
ZSlope.f0 = 1.f;
}
inline int iround(float x)
static inline int iround(float x)
{
int t;
t = (int)x;
int t = (int)x;
if ((x - t) >= 0.5)
return t + 1;
@ -208,7 +206,7 @@ static void InitSlope(Slope *slope, float f1, float f2, float f3, float DX31, fl
slope->f0 = f1;
}
inline void CalculateLOD(s32 &lod, bool &linear, u32 texmap, u32 texcoord)
static inline void CalculateLOD(s32 &lod, bool &linear, u32 texmap, u32 texcoord)
{
FourTexUnits& texUnit = bpmem.tex[(texmap >> 2) & 1];
u8 subTexmap = texmap & 3;

View File

@ -61,19 +61,30 @@ void DoState(PointerWrap &p)
}
// does it matter that there is no synchronization between threads during writes?
inline void WriteLow (u32& _reg, u16 lowbits) {_reg = (_reg & 0xFFFF0000) | lowbits;}
inline void WriteHigh(u32& _reg, u16 highbits) {_reg = (_reg & 0x0000FFFF) | ((u32)highbits << 16);}
inline u16 ReadLow (u32 _reg) {return (u16)(_reg & 0xFFFF);}
inline u16 ReadHigh (u32 _reg) {return (u16)(_reg >> 16);}
static inline void WriteLow (u32& _reg, u16 lowbits)
{
_reg = (_reg & 0xFFFF0000) | lowbits;
}
static inline void WriteHigh(u32& _reg, u16 highbits)
{
_reg = (_reg & 0x0000FFFF) | ((u32)highbits << 16);
}
static inline u16 ReadLow(u32 _reg)
{
return (u16)(_reg & 0xFFFF);
}
static inline u16 ReadHigh(u32 _reg)
{
return (u16)(_reg >> 16);
}
static void UpdateInterrupts_Wrapper(u64 userdata, int cyclesLate)
{
UpdateInterrupts(userdata);
}
inline bool AtBreakpoint()
static inline bool AtBreakpoint()
{
return cpreg.ctrl.BPEnable && (cpreg.readptr == cpreg.breakpt);
}

View File

@ -123,12 +123,12 @@ void Tev::Init()
m_ScaleRShiftLUT[3] = 1;
}
inline s16 Clamp255(s16 in)
static inline s16 Clamp255(s16 in)
{
return in>255?255:(in<0?0:in);
}
inline s16 Clamp1024(s16 in)
static inline s16 Clamp1024(s16 in)
{
return in>1023?1023:(in<-1024?-1024:in);
}
@ -366,7 +366,7 @@ static bool TevAlphaTest(int alpha)
return true;
}
inline s32 WrapIndirectCoord(s32 coord, int wrapMode)
static inline s32 WrapIndirectCoord(s32 coord, int wrapMode)
{
switch (wrapMode)
{

View File

@ -13,7 +13,7 @@
namespace TextureEncoder
{
inline void RGBA_to_RGBA8(u8 *src, u8 &r, u8 &g, u8 &b, u8 &a)
static inline void RGBA_to_RGBA8(u8 *src, u8 &r, u8 &g, u8 &b, u8 &a)
{
u32 srcColor = *(u32*)src;
a = Convert6To8(srcColor & 0x3f);
@ -22,7 +22,7 @@ inline void RGBA_to_RGBA8(u8 *src, u8 &r, u8 &g, u8 &b, u8 &a)
r = Convert6To8((srcColor >> 18)& 0x3f);
}
inline void RGBA_to_RGB8(u8 *src, u8 &r, u8 &g, u8 &b)
static inline void RGBA_to_RGB8(u8 *src, u8 &r, u8 &g, u8 &b)
{
u32 srcColor = *(u32*)src;
b = Convert6To8((srcColor >> 6) & 0x3f);
@ -30,7 +30,7 @@ inline void RGBA_to_RGB8(u8 *src, u8 &r, u8 &g, u8 &b)
r = Convert6To8((srcColor >> 18)& 0x3f);
}
inline u8 RGB8_to_I(u8 r, u8 g, u8 b)
static inline u8 RGB8_to_I(u8 r, u8 g, u8 b)
{
// values multiplied by 256 to keep math integer
u16 val = 4096 + 66 * r + 129 * g + 25 * b;
@ -40,7 +40,7 @@ inline u8 RGB8_to_I(u8 r, u8 g, u8 b)
// box filter sampling averages 4 samples with the source texel being the top left of the box
// components are scaled to the range 0-255 after all samples are taken
inline void BoxfilterRGBA_to_RGBA8(u8 *src, u8 &r, u8 &g, u8 &b, u8 &a)
static inline void BoxfilterRGBA_to_RGBA8(u8 *src, u8 &r, u8 &g, u8 &b, u8 &a)
{
u16 r16 = 0, g16 = 0, b16 = 0, a16 = 0;
@ -66,7 +66,7 @@ inline void BoxfilterRGBA_to_RGBA8(u8 *src, u8 &r, u8 &g, u8 &b, u8 &a)
a = a16 + (a16 >> 6);
}
inline void BoxfilterRGBA_to_RGB8(u8 *src, u8 &r, u8 &g, u8 &b)
static inline void BoxfilterRGBA_to_RGB8(u8 *src, u8 &r, u8 &g, u8 &b)
{
u16 r16 = 0, g16 = 0, b16 = 0;
@ -90,7 +90,7 @@ inline void BoxfilterRGBA_to_RGB8(u8 *src, u8 &r, u8 &g, u8 &b)
b = b16 + (b16 >> 6);
}
inline void BoxfilterRGBA_to_x8(u8 *src, u8 &x8, int shift)
static inline void BoxfilterRGBA_to_x8(u8 *src, u8 &x8, int shift)
{
u16 x16 = 0;
@ -110,7 +110,7 @@ inline void BoxfilterRGBA_to_x8(u8 *src, u8 &x8, int shift)
x8 = x16 + (x16 >> 6);
}
inline void BoxfilterRGBA_to_xx8(u8 *src, u8 &x1, u8 &x2, int shift1, int shift2)
static inline void BoxfilterRGBA_to_xx8(u8 *src, u8 &x1, u8 &x2, int shift1, int shift2)
{
u16 x16_1 = 0;
u16 x16_2 = 0;
@ -133,7 +133,7 @@ inline void BoxfilterRGBA_to_xx8(u8 *src, u8 &x1, u8 &x2, int shift1, int shift2
x2 = x16_2 + (x16_2 >> 6);
}
inline void BoxfilterRGB_to_RGB8(u8 *src, u8 &r, u8 &g, u8 &b)
static inline void BoxfilterRGB_to_RGB8(u8 *src, u8 &r, u8 &g, u8 &b)
{
u16 r16 = 0, g16 = 0, b16 = 0;
@ -155,7 +155,7 @@ inline void BoxfilterRGB_to_RGB8(u8 *src, u8 &r, u8 &g, u8 &b)
b = b16 >> 2;
}
inline void BoxfilterRGB_to_x8(u8 *src, u8 &x8, int comp)
static inline void BoxfilterRGB_to_x8(u8 *src, u8 &x8, int comp)
{
u16 x16 = 0;
@ -174,7 +174,7 @@ inline void BoxfilterRGB_to_x8(u8 *src, u8 &x8, int comp)
x8 = x16 >> 2;
}
inline void BoxfilterRGB_to_xx8(u8 *src, u8 &x1, u8 &x2, int comp1, int comp2)
static inline void BoxfilterRGB_to_xx8(u8 *src, u8 &x1, u8 &x2, int comp1, int comp2)
{
u16 x16_1 = 0;
u16 x16_2 = 0;

View File

@ -15,7 +15,7 @@
namespace TextureSampler
{
inline void WrapCoord(int &coord, int wrapMode, int imageSize)
static inline void WrapCoord(int &coord, int wrapMode, int imageSize)
{
switch (wrapMode)
{
@ -38,7 +38,7 @@ inline void WrapCoord(int &coord, int wrapMode, int imageSize)
}
}
inline void SetTexel(u8 *inTexel, u32 *outTexel, u32 fract)
static inline void SetTexel(u8 *inTexel, u32 *outTexel, u32 fract)
{
outTexel[0] = inTexel[0] * fract;
outTexel[1] = inTexel[1] * fract;
@ -46,7 +46,7 @@ inline void SetTexel(u8 *inTexel, u32 *outTexel, u32 fract)
outTexel[3] = inTexel[3] * fract;
}
inline void AddTexel(u8 *inTexel, u32 *outTexel, u32 fract)
static inline void AddTexel(u8 *inTexel, u32 *outTexel, u32 fract)
{
outTexel[0] += inTexel[0] * fract;
outTexel[1] += inTexel[1] * fract;

View File

@ -189,21 +189,21 @@ struct LightPointer
Vec3 dir;
};
inline void AddIntegerColor(const u8 *src, Vec3 &dst)
static inline void AddIntegerColor(const u8 *src, Vec3 &dst)
{
dst.x += src[1];
dst.y += src[2];
dst.z += src[3];
}
inline void AddScaledIntegerColor(const u8 *src, float scale, Vec3 &dst)
static inline void AddScaledIntegerColor(const u8 *src, float scale, Vec3 &dst)
{
dst.x += src[1] * scale;
dst.y += src[2] * scale;
dst.z += src[3] * scale;
}
inline float SafeDivide(float n, float d)
static inline float SafeDivide(float n, float d)
{
return (d==0) ? (n>0?1:0) : n/d;
}