- [Psy-X] some renames

This commit is contained in:
Ilya Shurumov 2020-12-27 21:13:57 +06:00
parent 344023f2b0
commit 0c05af3318
5 changed files with 41 additions and 44 deletions

View File

@ -35,20 +35,17 @@
#define TPAGE_HEIGHT (256)
#pragma pack(push,1)
struct Vertex
struct GrVertex
{
#if defined(USE_PGXP)
float x, y, page, clut;
float x, y, page, clut;
float z, scr_h, ofsX, ofsY;
#else
short x, y, page, clut;
short x, y, page, clut;
#endif
u_char u, v, bright, dither;
u_char r, g, b, a;
#if defined(USE_PGXP)
float z, scr_h, ofsX, ofsY;
#endif
u_char u, v, bright, dither;
u_char r, g, b, a;
};
#pragma pack(pop)
@ -113,7 +110,7 @@ extern void GR_SetWireframe(bool enable);
extern void GR_DestroyTexture(TextureID texture);
extern void GR_Clear(int x, int y, int w, int h, unsigned char r, unsigned char g, unsigned char b);
extern void GR_UpdateVertexBuffer(const Vertex* vertices, int count);
extern void GR_UpdateVertexBuffer(const GrVertex* vertices, int count);
extern void GR_DrawTriangles(int start_vertex, int triangles);
#endif

View File

@ -48,7 +48,7 @@ struct GPUDrawSplit
u_short numVerts;
};
struct Vertex g_vertexBuffer[MAX_NUM_POLY_BUFFER_VERTICES];
struct GrVertex g_vertexBuffer[MAX_NUM_POLY_BUFFER_VERTICES];
struct GPUDrawSplit g_splits[MAX_NUM_INDEX_BUFFERS];
int g_vertexIndex = 0;
@ -63,7 +63,7 @@ void ClearSplits()
// remaps screen coordinates to [0..1]
// without clamping
inline void ScreenCoordsToEmulator(Vertex* vertex, int count)
inline void ScreenCoordsToEmulator(GrVertex* vertex, int count)
{
#ifdef USE_PGXP
float curW;
@ -109,7 +109,7 @@ void LineSwapSourceVerts(VERTTYPE*& p0, VERTTYPE*& p1, unsigned char*& c0, unsig
}
}
void MakeLineArray(struct Vertex* vertex, VERTTYPE* p0, VERTTYPE* p1, ushort gteidx)
void MakeLineArray(struct GrVertex* vertex, VERTTYPE* p0, VERTTYPE* p1, ushort gteidx)
{
VERTTYPE dx = p1[0] - p0[0];
VERTTYPE dy = p1[1] - p0[1];
@ -162,7 +162,7 @@ void MakeLineArray(struct Vertex* vertex, VERTTYPE* p0, VERTTYPE* p1, ushort gte
ScreenCoordsToEmulator(vertex, 4);
}
inline void ApplyVertexPGXP(Vertex* v, VERTTYPE* p, float ofsX, float ofsY, ushort gteidx)
inline void ApplyVertexPGXP(GrVertex* v, VERTTYPE* p, float ofsX, float ofsY, ushort gteidx)
{
#ifdef USE_PGXP
uint lookup = PGXP_LOOKUP_VALUE(p[0], p[1]);
@ -197,7 +197,7 @@ inline void ApplyVertexPGXP(Vertex* v, VERTTYPE* p, float ofsX, float ofsY, usho
#endif
}
void MakeVertexTriangle(struct Vertex* vertex, VERTTYPE* p0, VERTTYPE* p1, VERTTYPE* p2, ushort gteidx)
void MakeVertexTriangle(struct GrVertex* vertex, VERTTYPE* p0, VERTTYPE* p1, VERTTYPE* p2, ushort gteidx)
{
assert(p0);
assert(p1);
@ -233,7 +233,7 @@ void MakeVertexTriangle(struct Vertex* vertex, VERTTYPE* p0, VERTTYPE* p1, VERTT
ScreenCoordsToEmulator(vertex, 3);
}
void MakeVertexQuad(struct Vertex* vertex, VERTTYPE* p0, VERTTYPE* p1, VERTTYPE* p2, VERTTYPE* p3, ushort gteidx)
void MakeVertexQuad(struct GrVertex* vertex, VERTTYPE* p0, VERTTYPE* p1, VERTTYPE* p2, VERTTYPE* p3, ushort gteidx)
{
assert(p0);
assert(p1);
@ -274,7 +274,7 @@ void MakeVertexQuad(struct Vertex* vertex, VERTTYPE* p0, VERTTYPE* p1, VERTTYPE*
ScreenCoordsToEmulator(vertex, 4);
}
void MakeVertexRect(struct Vertex* vertex, VERTTYPE* p0, short w, short h, ushort gteidx)
void MakeVertexRect(struct GrVertex* vertex, VERTTYPE* p0, short w, short h, ushort gteidx)
{
assert(p0);
@ -311,7 +311,7 @@ void MakeVertexRect(struct Vertex* vertex, VERTTYPE* p0, short w, short h, ushor
ScreenCoordsToEmulator(vertex, 4);
}
void MakeTexcoordQuad(struct Vertex* vertex, unsigned char* uv0, unsigned char* uv1, unsigned char* uv2, unsigned char* uv3, short page, short clut, unsigned char dither)
void MakeTexcoordQuad(struct GrVertex* vertex, unsigned char* uv0, unsigned char* uv1, unsigned char* uv2, unsigned char* uv3, short page, short clut, unsigned char dither)
{
assert(uv0);
assert(uv1);
@ -349,7 +349,7 @@ void MakeTexcoordQuad(struct Vertex* vertex, unsigned char* uv0, unsigned char*
vertex[3].clut = clut;
}
void MakeTexcoordTriangle(struct Vertex* vertex, unsigned char* uv0, unsigned char* uv1, unsigned char* uv2, short page, short clut, unsigned char dither)
void MakeTexcoordTriangle(struct GrVertex* vertex, unsigned char* uv0, unsigned char* uv1, unsigned char* uv2, short page, short clut, unsigned char dither)
{
assert(uv0);
assert(uv1);
@ -379,7 +379,7 @@ void MakeTexcoordTriangle(struct Vertex* vertex, unsigned char* uv0, unsigned ch
vertex[2].clut = clut;
}
void MakeTexcoordRect(struct Vertex* vertex, unsigned char* uv, short page, short clut, short w, short h)
void MakeTexcoordRect(struct GrVertex* vertex, unsigned char* uv, short page, short clut, short w, short h)
{
assert(uv);
//assert(int(uv[0]) + w <= 255);
@ -420,7 +420,7 @@ void MakeTexcoordRect(struct Vertex* vertex, unsigned char* uv, short page, shor
vertex[3].clut = clut;
}
void MakeTexcoordLineZero(struct Vertex* vertex, unsigned char dither)
void MakeTexcoordLineZero(struct GrVertex* vertex, unsigned char dither)
{
const unsigned char bright = 1;
@ -453,7 +453,7 @@ void MakeTexcoordLineZero(struct Vertex* vertex, unsigned char dither)
vertex[3].clut = 0;
}
void MakeTexcoordTriangleZero(struct Vertex* vertex, unsigned char dither)
void MakeTexcoordTriangleZero(struct GrVertex* vertex, unsigned char dither)
{
const unsigned char bright = 1;
@ -480,7 +480,7 @@ void MakeTexcoordTriangleZero(struct Vertex* vertex, unsigned char dither)
}
void MakeTexcoordQuadZero(struct Vertex* vertex, unsigned char dither)
void MakeTexcoordQuadZero(struct GrVertex* vertex, unsigned char dither)
{
const unsigned char bright = 1;
@ -513,7 +513,7 @@ void MakeTexcoordQuadZero(struct Vertex* vertex, unsigned char dither)
vertex[3].clut = 0;
}
void MakeColourLine(struct Vertex* vertex, unsigned char* col0, unsigned char* col1)
void MakeColourLine(struct GrVertex* vertex, unsigned char* col0, unsigned char* col1)
{
assert(col0);
assert(col1);
@ -539,7 +539,7 @@ void MakeColourLine(struct Vertex* vertex, unsigned char* col0, unsigned char* c
vertex[3].a = 255;
}
void MakeColourTriangle(struct Vertex* vertex, unsigned char* col0, unsigned char* col1, unsigned char* col2)
void MakeColourTriangle(struct GrVertex* vertex, unsigned char* col0, unsigned char* col1, unsigned char* col2)
{
assert(col0);
assert(col1);
@ -561,7 +561,7 @@ void MakeColourTriangle(struct Vertex* vertex, unsigned char* col0, unsigned cha
vertex[2].a = 255;
}
void MakeColourQuad(struct Vertex* vertex, unsigned char* col0, unsigned char* col1, unsigned char* col2, unsigned char* col3)
void MakeColourQuad(struct GrVertex* vertex, unsigned char* col0, unsigned char* col1, unsigned char* col2, unsigned char* col3)
{
assert(col0);
assert(col1);
@ -667,7 +667,7 @@ void DrawAllSplits()
{
for (int i = 0; i < 3; i++)
{
struct Vertex* vert = &g_vertexBuffer[g_polygonSelected + i];
struct GrVertex* vert = &g_vertexBuffer[g_polygonSelected + i];
vert->r = 255;
vert->g = 0;
vert->b = 0;

View File

@ -165,11 +165,11 @@ static void PsyX_Sys_InitialiseInput()
g_keyboard_mapping.kc_start = SDL_SCANCODE_RETURN;
}
int GR_InitialisePSX();
int GR_InitialiseRender(char* windowName, int width, int height, int fullscreen);
void GR_Shutdown();
void GR_BeginScene();
void GR_EndScene();
extern int GR_InitialisePSX();
extern int GR_InitialiseRender(char* windowName, int width, int height, int fullscreen);
extern void GR_Shutdown();
extern void GR_BeginScene();
extern void GR_EndScene();
void PsyX_Initialise(char* windowName, int width, int height, int fullscreen)
{
@ -300,6 +300,8 @@ void PsyX_EndScene()
assert(begin_scene_flag);
begin_scene_flag = false;
GR_EndScene();
GR_StoreFrameBuffer(activeDispEnv.disp.x, activeDispEnv.disp.y, activeDispEnv.disp.w, activeDispEnv.disp.h);
GR_SwapWindow();

View File

@ -770,23 +770,23 @@ int GR_InitialisePSX()
glBindVertexArray(g_glVertexArray);
glBindBuffer(GL_ARRAY_BUFFER, g_glVertexBuffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(Vertex) * MAX_NUM_POLY_BUFFER_VERTICES, NULL, GL_DYNAMIC_DRAW);
glBufferData(GL_ARRAY_BUFFER, sizeof(GrVertex) * MAX_NUM_POLY_BUFFER_VERTICES, NULL, GL_DYNAMIC_DRAW);
glEnableVertexAttribArray(a_position);
glEnableVertexAttribArray(a_texcoord);
glEnableVertexAttribArray(a_color);
#if defined(USE_PGXP)
glVertexAttribPointer(a_position, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), &((Vertex*)NULL)->x);
glVertexAttribPointer(a_zw, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), &((Vertex*)NULL)->z);
glVertexAttribPointer(a_position, 4, GL_FLOAT, GL_FALSE, sizeof(GrVertex), &((GrVertex*)NULL)->x);
glVertexAttribPointer(a_zw, 4, GL_FLOAT, GL_FALSE, sizeof(GrVertex), &((GrVertex*)NULL)->z);
glEnableVertexAttribArray(a_zw);
#else
glVertexAttribPointer(a_position, 4, GL_SHORT, GL_FALSE, sizeof(Vertex), &((Vertex*)NULL)->x);
glVertexAttribPointer(a_position, 4, GL_SHORT, GL_FALSE, sizeof(GrVertex), &((GrVertex*)NULL)->x);
#endif
glVertexAttribPointer(a_texcoord, 4, GL_UNSIGNED_BYTE, GL_FALSE, sizeof(Vertex), &((Vertex*)NULL)->u);
glVertexAttribPointer(a_color, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Vertex), &((Vertex*)NULL)->r);
glVertexAttribPointer(a_texcoord, 4, GL_UNSIGNED_BYTE, GL_FALSE, sizeof(GrVertex), &((GrVertex*)NULL)->u);
glVertexAttribPointer(a_color, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(GrVertex), &((GrVertex*)NULL)->r);
glBindVertexArray(0);
}
@ -1313,12 +1313,10 @@ void GR_EnableDepth(int enable)
if (enable && g_pgxpZBuffer)
{
glEnable(GL_DEPTH_TEST);
//glDepthMask(GL_TRUE);
}
else
{
glDisable(GL_DEPTH_TEST);
//glDepthMask(GL_FALSE);
}
#endif
}
@ -1414,11 +1412,11 @@ void GR_SetWireframe(bool enable)
#endif
}
void GR_UpdateVertexBuffer(const Vertex* vertices, int num_vertices)
void GR_UpdateVertexBuffer(const GrVertex* vertices, int num_vertices)
{
assert(num_vertices <= MAX_NUM_POLY_BUFFER_VERTICES);
#if defined(RENDERER_OGL) || defined(OGLES)
glBufferSubData(GL_ARRAY_BUFFER, 0, num_vertices * sizeof(Vertex), vertices);
glBufferSubData(GL_ARRAY_BUFFER, 0, num_vertices * sizeof(GrVertex), vertices);
#else
#error
#endif

View File

@ -187,7 +187,7 @@ void SetupMovieRectangle(int image_w, int image_h)
#ifdef USE_PGXP
GR_SetViewPort(0, 0, windowWidth, windowHeight);
Vertex blit_vertices[] =
GrVertex blit_vertices[] =
{
{ clipRectX+ clipRectW, clipRectY + clipRectH, 0, 0, r, t, 0, 0, 0, 0, 0, 0 },
{ clipRectX, clipRectY, 0, 0, l, b, 0, 0, 0, 0, 0, 0 },
@ -205,7 +205,7 @@ void SetupMovieRectangle(int image_w, int image_h)
clipRectW *= 2;
clipRectH *= 2;
Vertex blit_vertices[] =
GrVertex blit_vertices[] =
{
{ clipRectX+ clipRectW, clipRectY + clipRectH, 0, 0, r, t, 0, 0, 0, 0, 0, 0 },
{ clipRectX, clipRectY, 0, 0, l, b, 0, 0, 0, 0, 0, 0 },