Skip to content

Commit f7eda89

Browse files
committed
rsx_Basic_Wallpaper fixed
1 parent fb147a6 commit f7eda89

File tree

4 files changed

+351
-226
lines changed

4 files changed

+351
-226
lines changed
Lines changed: 14 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
#ifndef __MESH_H__
22
#define __MESH_H__
33

4-
#include <ppu-types.h>
54
#include <vectormath/cpp/vectormath_aos.h>
65

7-
#include <rsx/rsx.h>
8-
9-
#include "irrarray.h"
10-
11-
using namespace irr;
126
using namespace Vectormath::Aos;
137

148
template< class T >
@@ -29,100 +23,41 @@ inline const T clamp(const T& val,const T& low,const T& high)
2923
return min_(max_(val,low),high);
3024
}
3125

32-
class SColor
33-
{
34-
public:
35-
SColor() : color(0) {};
36-
SColor(u32 c) : color(c) {};
37-
SColor(u8 a,u8 r,u8 g,u8 b) : R(r),G(g),B(b),A(a) {};
38-
SColor(const SColor& other) : color(other.color) {};
39-
40-
u8 getRed() const { return R; }
41-
u8 getGreen() const { return G; }
42-
u8 getBlue() const { return B; }
43-
u8 getAlpha() const { return A; }
44-
45-
union {
46-
u32 color;
47-
struct {
48-
u8 R,G,B,A;
49-
};
50-
};
51-
};
52-
5326
struct S3DVertex
5427
{
5528
S3DVertex() {};
56-
S3DVertex(f32 x,f32 y,f32 z,f32 nx,f32 ny,f32 nz,SColor c,f32 tu,f32 tv)
57-
: pos(x,y,z),nrm(nx,ny,nz),col(c),u(tu),v(tv) {};
58-
S3DVertex(const Vector3& _pos,const Vector3& _nrm,const SColor& c,f32 tu,f32 tv)
59-
: pos(_pos),nrm(_nrm),col(c),u(tu),v(tv) {};
29+
S3DVertex(f32 x,f32 y,f32 z,f32 nx,f32 ny,f32 nz,f32 tu,f32 tv, u32 c)
30+
: pos(x, y, z), nrm(nx, ny, nz), u(tu), v(tv), col(c) {};
6031

6132
inline S3DVertex& operator=(const S3DVertex& other)
6233
{
6334
pos = other.pos;
6435
nrm = other.nrm;
65-
col = other.col;
6636
u = other.u;
6737
v = other.v;
38+
col = other.col;
6839
return *this;
6940
}
7041

7142
Vector3 pos;
7243
Vector3 nrm;
73-
SColor col;
74-
75-
f32 u,v;
44+
f32 u, v;
45+
u32 col;
7646
};
7747

78-
79-
class SMeshBuffer
48+
template< class T >
49+
class CMeshBuffer
8050
{
8151
public:
82-
SMeshBuffer() : pos_off(0),nrm_off(0),col_off(0),uv_off(0),ind_off(0) {};
83-
virtual ~SMeshBuffer()
84-
{
85-
}
52+
CMeshBuffer() : indices(NULL),cnt_indices(0),vertices(NULL),cnt_vertices(0) {};
8653

87-
virtual const void* getVertices() const
88-
{
89-
return vertices.const_pointer();
90-
}
54+
u16 *indices;
55+
u32 cnt_indices;
9156

92-
virtual void* getVertices()
93-
{
94-
return vertices.pointer();
95-
}
96-
97-
virtual u32 getVertexCount() const
98-
{
99-
return vertices.size();
100-
}
101-
102-
virtual const u32* getIndices() const
103-
{
104-
return indices.const_pointer();
105-
}
106-
107-
virtual u32* getIndices()
108-
{
109-
return indices.pointer();
110-
}
111-
112-
virtual u32 getIndexCount() const
113-
{
114-
return indices.size();
115-
}
116-
117-
core::array< u32, core::allocatorRSX< u32 > > indices;
118-
core::array< S3DVertex, core::allocatorRSX< S3DVertex > > vertices;
119-
120-
u32 pos_off;
121-
u32 nrm_off;
122-
u32 col_off;
123-
u32 uv_off;
124-
125-
u32 ind_off;
57+
S3DVertex *vertices;
58+
u32 cnt_vertices;
12659
};
12760

61+
typedef CMeshBuffer<S3DVertex> SMeshBuffer;
62+
12863
#endif
Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
#ifndef __RSXUTIL_H__
22
#define __RSXUTIL_H__
33

4-
#include <ppu-types.h>
54
#include <rsx/rsx.h>
65

76
#include <debugfont.h>
87

9-
10-
#define DEFUALT_CB_SIZE 0x80000 // 512Kb default command buffer size
8+
#define DEFAULT_CB_SIZE 0x80000 // 512Kb default command buffer size
119
#define HOST_STATE_CB_SIZE 0x10000 // 64Kb state command buffer size (used for resetting certain default states)
1210
#define HOST_ADDR_ALIGNMENT (1024*1024)
13-
#define HOSTBUFFER_SIZE (128*1024*1024)
14-
#define CB_SIZE 0x100000
1511

16-
#define FRAME_BUFFER_COUNT 2
12+
#define GCM_PREPARED_BUFFER_INDEX 65
13+
#define GCM_BUFFER_STATUS_INDEX 66
14+
#define GCM_WAIT_LABEL_INDEX 255
15+
16+
#define MAX_BUFFER_QUEUE_SIZE 1
1717

18-
extern gcmContextData *context;
18+
#define BUFFER_IDLE 0
19+
#define BUFFER_BUSY 1
20+
21+
#define FRAME_BUFFER_COUNT 4
1922

2023
extern u32 curr_fb;
2124

@@ -24,17 +27,22 @@ extern u32 display_height;
2427

2528
extern u32 depth_pitch;
2629
extern u32 depth_offset;
27-
extern u32 *depth_buffer;
30+
extern void *depth_buffer;
2831

2932
extern u32 color_pitch;
3033
extern u32 color_offset[FRAME_BUFFER_COUNT];
31-
extern u32 *color_buffer[FRAME_BUFFER_COUNT];
34+
extern void *color_buffer[FRAME_BUFFER_COUNT];
35+
36+
extern void *state_buffer;
37+
extern u32 state_offset;
38+
3239

3340
extern f32 aspect_ratio;
3441

35-
void setRenderTarget(u32 index);
36-
void init_screen(void *host_addr,u32 size);
37-
void waitflip();
42+
void initScreen(u32 hostBufferSize);
3843
void flip();
44+
void finish();
45+
46+
void setRenderTarget(u32 index);
3947

40-
#endif
48+
#endif // __RSXUTIL_H__

0 commit comments

Comments
 (0)