Finish dummy driver

This commit is contained in:
Daniel Santos 2022-06-30 12:57:37 -03:00 committed by Sam Lantinga
parent 2660449c6c
commit 147a71b976
13 changed files with 28 additions and 30 deletions

View File

@ -2575,7 +2575,7 @@ elseif(PS2)
file(GLOB PS2_VIDEO_SOURCES
${SDL2_SOURCE_DIR}/src/video/ps2/*.c
${SDL2_SOURCE_DIR}/src/render/ps2/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${PS2_VIDEO_SOURCES})
list(APPEND SOURCE_FILES ${PS2_VIDEO_SOURCES})
set(SDL_VIDEO_OPENGL 0)
set(HAVE_SDL_VIDEO TRUE)
endif()

View File

@ -456,6 +456,7 @@
#cmakedefine SDL_VIDEO_RENDER_DIRECTFB @SDL_VIDEO_RENDER_DIRECTFB@
#cmakedefine SDL_VIDEO_RENDER_METAL @SDL_VIDEO_RENDER_METAL@
#cmakedefine SDL_VIDEO_RENDER_VITA_GXM @SDL_VIDEO_RENDER_VITA_GXM@
#cmakedefine SDL_VIDEO_RENDER_PS2 @SDL_VIDEO_RENDER_PS2@
#cmakedefine SDL_VIDEO_RENDER_PSP @SDL_VIDEO_RENDER_PSP@
/* Enable OpenGL support */

View File

@ -114,7 +114,7 @@ static const SDL_RenderDriver *render_drivers[] = {
#if SDL_VIDEO_RENDER_DIRECTFB
&DirectFB_RenderDriver,
#endif
#if SDL_VIDEO_RENDER_PS2
#if SDL_VIDEO_RENDER_PS2 && !SDL_RENDER_DISABLED
&PS2_RenderDriver,
#endif
#if SDL_VIDEO_RENDER_PSP

View File

@ -352,6 +352,6 @@ SDL_BlendFillRects(SDL_Surface * dst, const SDL_Rect * rects, int count,
return status;
}
#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */
#endif /* SDL_VIDEO_RENDER_SW */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -870,6 +870,6 @@ SDL_BlendLines(SDL_Surface * dst, const SDL_Point * points, int count,
return 0;
}
#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */
#endif /* SDL_VIDEO_RENDER_PS2 && !SDL_RENDER_DISABLED */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -357,6 +357,6 @@ SDL_BlendPoints(SDL_Surface * dst, const SDL_Point * points, int count,
return status;
}
#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */
#endif /* SDL_VIDEO_RENDER_PS2 && !SDL_RENDER_DISABLED */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -208,6 +208,6 @@ SDL_DrawLines(SDL_Surface * dst, const SDL_Point * points, int count,
return 0;
}
#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */
#endif /* SDL_VIDEO_RENDER_PS2 */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -109,6 +109,6 @@ SDL_DrawPoints(SDL_Surface * dst, const SDL_Point * points, int count,
return 0;
}
#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */
#endif /* SDL_VIDEO_RENDER_PS2 && !SDL_RENDER_DISABLED */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -23,7 +23,7 @@
#if SDL_VIDEO_RENDER_PS2 && !SDL_RENDER_DISABLED
#include "../SDL_sysrender.h"
#include "SDL_render_sw_c.h"
#include "SDL_render_ps2.h"
#include "SDL_hints.h"
#include "SDL_draw.h"
@ -1168,9 +1168,6 @@ PS2_CreateRenderer(SDL_Window * window, Uint32 flags)
dmaKit_init(D_CTRL_RELE_OFF, D_CTRL_MFD_OFF, D_CTRL_STS_UNSPEC, D_CTRL_STD_OFF, D_CTRL_RCYC_8, 1 << DMA_CHANNEL_GIF);
dmaKit_chan_init(DMA_CHANNEL_GIF);
printf("\nGraphics: created %ix%i video surface\n",
gsGlobal->Width, gsGlobal->Height);
gsKit_set_clamp(gsGlobal, GS_CMODE_REPEAT);
gsKit_vram_clear(gsGlobal);
@ -1224,6 +1221,6 @@ SDL_RenderDriver PS2_RenderDriver = {
.max_texture_height = 512,}
};
#endif /* SDL_VIDEO_RENDER_PS2 && !SDL_RENDER_DISABLED */
#endif /* SDL_VIDEO_RENDER_PS2 */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -19,8 +19,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef SDL_render_sw_c_h_
#define SDL_render_sw_c_h_
#ifndef SDL_render_ps2_h_
#define SDL_render_ps2_h_
#include <kernel.h>
@ -30,8 +30,8 @@
#include <gsToolkit.h>
#include <gsInline.h>
extern SDL_Renderer * SW_CreateRendererForSurface(SDL_Surface * surface);
extern SDL_Renderer * PS2_CreateRendererForSurface(SDL_Surface * surface);
#endif /* SDL_render_sw_c_h_ */
#endif /* SDL_render_ps2_ */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -574,4 +574,4 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int smooth, int flipx, int
return rz_dst;
}
#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */
#endif /* SDL_VIDEO_RENDER_PS2 && !SDL_RENDER_DISABLED */

View File

@ -67,9 +67,9 @@ int SDL_BlitTriangle(SDL_Surface *src, const SDL_Point srcpoints[3], SDL_Surface
points[4] = srcpoints[2];
points[5] = dstpoints[2];
for (i = 0; i < 3; i++) {
trianglepoint_2_fixedpoint(&points[2 * i + 1]);
PS2_trianglepoint_2_fixedpoint(&points[2 * i + 1]);
}
return SDL_SW_BlitTriangle(src, dst, points);
return SDL_PS2_BlitTriangle(src, dst, points);
}
int SDL_FillTriangle(SDL_Surface *dst, const SDL_Point points[3], Uint32 color)
@ -81,9 +81,9 @@ int SDL_FillTriangle(SDL_Surface *dst, const SDL_Point points[3], Uint32 color)
}
for (i = 0; i < 3; i++) {
points_tmp[i] = points[i];
trianglepoint_2_fixedpoint(&points_tmp[i]);
PS2_trianglepoint_2_fixedpoint(&points_tmp[i]);
}
return SDL_SW_FillTriangle(dst, points_tmp, SDL_BLENDMODE_NONE, color);
return SDL_PS2_FillTriangle(dst, points_tmp, SDL_BLENDMODE_NONE, color);
}
#endif
@ -114,7 +114,7 @@ static int is_top_left(const SDL_Point *a, const SDL_Point *b, int is_clockwise)
return 0;
}
void trianglepoint_2_fixedpoint(SDL_Point *a) {
void PS2_trianglepoint_2_fixedpoint(SDL_Point *a) {
a->x <<= FP_BITS;
a->y <<= FP_BITS;
}
@ -202,7 +202,7 @@ static void bounding_rect(const SDL_Point *a, const SDL_Point *b, const SDL_Poin
} \
} \
int SDL_SW_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Point *d2, SDL_BlendMode blend, SDL_Color c0, SDL_Color c1, SDL_Color c2)
int SDL_PS2_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Point *d2, SDL_BlendMode blend, SDL_Color c0, SDL_Color c1, SDL_Color c2)
{
int ret = 0;
int dst_locked = 0;
@ -314,7 +314,7 @@ int SDL_SW_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Poin
SDL_Point p;
p.x = dstrect.x;
p.y = dstrect.y;
trianglepoint_2_fixedpoint(&p);
PS2_trianglepoint_2_fixedpoint(&p);
p.x += (1 << FP_BITS) / 2;
p.y += (1 << FP_BITS) / 2;
w0_row = cross_product(d1, d2, p.x, p.y);
@ -439,7 +439,7 @@ end:
int SDL_SW_BlitTriangle(
int SDL_PS2_BlitTriangle(
SDL_Surface *src,
SDL_Point *s0, SDL_Point *s1, SDL_Point *s2,
SDL_Surface *dst,
@ -587,7 +587,7 @@ int SDL_SW_BlitTriangle(
SDL_Point p;
p.x = dstrect.x;
p.y = dstrect.y;
trianglepoint_2_fixedpoint(&p);
PS2_trianglepoint_2_fixedpoint(&p);
p.x += (1 << FP_BITS) / 2;
p.y += (1 << FP_BITS) / 2;
w0_row = cross_product(d1, d2, p.x, p.y);
@ -883,6 +883,6 @@ SDL_BlitTriangle_Slow(SDL_BlitInfo *info,
TRIANGLE_END_LOOP
}
#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */
#endif /* SDL_VIDEO_RENDER_PS2 && !SDL_RENDER_DISABLED */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -24,18 +24,18 @@
#include "../../SDL_internal.h"
extern int SDL_SW_FillTriangle(SDL_Surface *dst,
extern int SDL_PS2_FillTriangle(SDL_Surface *dst,
SDL_Point *d0, SDL_Point *d1, SDL_Point *d2,
SDL_BlendMode blend, SDL_Color c0, SDL_Color c1, SDL_Color c2);
extern int SDL_SW_BlitTriangle(
extern int SDL_PS2_BlitTriangle(
SDL_Surface *src,
SDL_Point *s0, SDL_Point *s1, SDL_Point *s2,
SDL_Surface *dst,
SDL_Point *d0, SDL_Point *d1, SDL_Point *d2,
SDL_Color c0, SDL_Color c1, SDL_Color c2);
extern void trianglepoint_2_fixedpoint(SDL_Point *a);
extern void PS2_trianglepoint_2_fixedpoint(SDL_Point *a);
#endif /* SDL_triangle_h_ */