Skip to content

Commit

Permalink
- add shader binaries to .gitignore
Browse files Browse the repository at this point in the history
- fixes to vectormath
- cast intptr_t for pointer calculations
  • Loading branch information
Mike Wiedenbauer committed Jul 16, 2020
1 parent 46d18fd commit 83fc828
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
*.dll
*.task
*.elf.map
*.fpo*
*.vpo*
build/
.idea/
.vscode/
Expand Down
8 changes: 4 additions & 4 deletions common/vectormath/ppu/cpp/vectormath_aos.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class Vector3
public:
// Default constructor; does no initialization
//
inline Vector3( ) { };
inline Vector3( ) : mVec128((vec_float4){0.0f, 0.0f, 0.0f, 0.0f}) { };

// Construct a 3-D vector from x, y, and z elements
//
Expand Down Expand Up @@ -452,7 +452,7 @@ class Vector4
public:
// Default constructor; does no initialization
//
inline Vector4( ) { };
inline Vector4( ) : mVec128((vec_float4){0.0f, 0.0f, 0.0f, 0.0f}) { };

// Construct a 4-D vector from x, y, z, and w elements
//
Expand Down Expand Up @@ -839,7 +839,7 @@ class Point3
public:
// Default constructor; does no initialization
//
inline Point3( ) { };
inline Point3( ) : mVec128((vec_float4){0.0f, 0.0f, 0.0f, 0.0f}) { };

// Construct a 3-D point from x, y, and z elements
//
Expand Down Expand Up @@ -1145,7 +1145,7 @@ class Quat
public:
// Default constructor; does no initialization
//
inline Quat( ) { };
inline Quat( ) : mVec128((vec_float4){0.0f, 0.0f, 0.0f, 0.0f}) { };

// Construct a quaternion from x, y, z, and w elements
//
Expand Down
8 changes: 4 additions & 4 deletions common/vectormath/spu/cpp/vectormath_aos.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class Vector3
public:
// Default constructor; does no initialization
//
inline Vector3( ) { };
inline Vector3( ) : mVec128((vec_float4){0.0f, 0.0f, 0.0f, 0.0f}) { };

// Construct a 3-D vector from x, y, and z elements
//
Expand Down Expand Up @@ -363,7 +363,7 @@ class Vector4
public:
// Default constructor; does no initialization
//
inline Vector4( ) { };
inline Vector4( ) : mVec128((vec_float4){0.0f, 0.0f, 0.0f, 0.0f}) { };

// Construct a 4-D vector from x, y, z, and w elements
//
Expand Down Expand Up @@ -653,7 +653,7 @@ class Point3
public:
// Default constructor; does no initialization
//
inline Point3( ) { };
inline Point3( ) : mVec128((vec_float4){0.0f, 0.0f, 0.0f, 0.0f}) { };

// Construct a 3-D point from x, y, and z elements
//
Expand Down Expand Up @@ -894,7 +894,7 @@ class Quat
public:
// Default constructor; does no initialization
//
inline Quat( ) { };
inline Quat( ) : mVec128((vec_float4){0.0f, 0.0f, 0.0f, 0.0f}) { };

// Construct a quaternion from x, y, z, and w elements
//
Expand Down
28 changes: 27 additions & 1 deletion ppu/include/ppu-asm.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#define PPU_ALIGNMENT 8

#define __get_opd32(opd64) ((unsigned long long)((opd64) + 16))
#define __get_opd32(opd64) ((unsigned long long)(((intptr_t)(opd64)) + 16))

#define __get_addr32(addr) (unsigned int)((unsigned long long)(addr))

Expand Down Expand Up @@ -52,4 +52,30 @@
asm volatile("1: mftb %[current_tb]; cmpwi 7,%[current_tb],0; beq- 7,1b" : [current_tb] "=r"(tb) : : "cr7"); \
tb;})

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

static inline unsigned short bswap16(unsigned short val)
{
unsigned short tmp = val;
return __lhbrx(&tmp);
}

static inline unsigned int bswap32(unsigned int val)
{
unsigned int tmp = val;
return __lwbrx(&tmp);
}

static inline unsigned long long bswap64(unsigned long long val)
{
unsigned long long tmp = val;
return __ldbrx(&tmp);
}

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif

0 comments on commit 83fc828

Please sign in to comment.