mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Rasterizer: Get rid of a trivial pointer cast
This commit is contained in:
@ -3,6 +3,7 @@
|
|||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "VideoBackends/Software/BPMemLoader.h"
|
#include "VideoBackends/Software/BPMemLoader.h"
|
||||||
@ -15,22 +16,10 @@
|
|||||||
#include "VideoBackends/Software/XFMemLoader.h"
|
#include "VideoBackends/Software/XFMemLoader.h"
|
||||||
#include "VideoCommon/BoundingBox.h"
|
#include "VideoCommon/BoundingBox.h"
|
||||||
|
|
||||||
|
|
||||||
#define BLOCK_SIZE 2
|
#define BLOCK_SIZE 2
|
||||||
|
|
||||||
#define CLAMP(x, a, b) (x>b)?b:(x<a)?a:x
|
#define CLAMP(x, a, b) (x>b)?b:(x<a)?a:x
|
||||||
|
|
||||||
// returns approximation of log2(f) in s28.4
|
|
||||||
// results are close enough to use for LOD
|
|
||||||
static inline s32 FixedLog2(float f)
|
|
||||||
{
|
|
||||||
u32 *x = (u32*)&f;
|
|
||||||
s32 logInt = ((*x & 0x7F800000) >> 19) - 2032; // integer part
|
|
||||||
s32 logFract = (*x & 0x007fffff) >> 19; // approximate fractional part
|
|
||||||
|
|
||||||
return logInt + logFract;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Rasterizer
|
namespace Rasterizer
|
||||||
{
|
{
|
||||||
static Slope ZSlope;
|
static Slope ZSlope;
|
||||||
@ -83,6 +72,19 @@ void Init()
|
|||||||
ZSlope.f0 = 1.f;
|
ZSlope.f0 = 1.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns approximation of log2(f) in s28.4
|
||||||
|
// results are close enough to use for LOD
|
||||||
|
static s32 FixedLog2(float f)
|
||||||
|
{
|
||||||
|
u32 x;
|
||||||
|
std::memcpy(&x, &f, sizeof(u32));
|
||||||
|
|
||||||
|
s32 logInt = ((x & 0x7F800000) >> 19) - 2032; // integer part
|
||||||
|
s32 logFract = (x & 0x007fffff) >> 19; // approximate fractional part
|
||||||
|
|
||||||
|
return logInt + logFract;
|
||||||
|
}
|
||||||
|
|
||||||
static inline int iround(float x)
|
static inline int iround(float x)
|
||||||
{
|
{
|
||||||
int t = (int)x;
|
int t = (int)x;
|
||||||
|
Reference in New Issue
Block a user