Rename rsx functions to rsx_intf_

This commit is contained in:
twinaphex 2016-04-08 17:03:52 +02:00
parent e1f7c3809f
commit e5f02064cb
10 changed files with 136 additions and 138 deletions

View File

@ -146,7 +146,7 @@ SOURCES_CXX += \
SOURCES_C += \
$(MEDNAFEN_DIR)/file.c \
$(CORE_DIR)/rsx/rsx.c \
$(CORE_DIR)/rsx/rsx_intf.c \
$(MEDNAFEN_DIR)/md5.c \
$(MEDNAFEN_DIR)/mednafen-endian.c

View File

@ -24,7 +24,7 @@
#include "libretro-common/rthreads/rthreads.c"
#include "scrc32.c"
#include "rsx/rsx.c"
#include "rsx/rsx_intf.c"
#ifdef NEED_CD
#include "mednafen/cdrom/CDUtility.c"

View File

@ -11,7 +11,7 @@
#include "libretro.h"
#include <rthreads/rthreads.h>
#include <retro_stat.h>
#include "rsx.h"
#include "rsx/rsx_intf.h"
struct retro_perf_callback perf_cb;
retro_get_cpu_features_t perf_get_cpu_features_cb = NULL;
@ -2437,7 +2437,7 @@ void retro_init(void)
check_system_specs();
rsx_init();
rsx_intf_init(RSX_SOFTWARE);
}
void retro_reset(void)
@ -2513,7 +2513,7 @@ static void check_variables(void)
else
widescreen_hack = false;
rsx_refresh_variables();
rsx_intf_refresh_variables();
var.key = "beetle_psx_internal_resolution";
@ -3166,7 +3166,7 @@ bool retro_load_game(const struct retro_game_info *info)
frame_count = 0;
internal_frame_count = 0;
return rsx_open(is_pal);
return rsx_intf_open(is_pal);
}
void retro_unload_game(void)
@ -3174,7 +3174,7 @@ void retro_unload_game(void)
if(!MDFNGameInfo)
return;
rsx_close();
rsx_intf_close();
MDFN_FlushGameCheats(0);
@ -3309,7 +3309,7 @@ void retro_run(void)
{
bool updated = false;
rsx_prepare_frame();
rsx_intf_prepare_frame();
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
{
@ -3574,7 +3574,7 @@ void retro_run(void)
if (!allow_frame_duping)
fb = pix;
rsx_finalize_frame(fb, width, height,
rsx_intf_finalize_frame(fb, width, height,
MEDNAFEN_CORE_GEOMETRY_MAX_W << (2 + upscale_shift));
video_frames++;
@ -3614,7 +3614,7 @@ void retro_get_system_av_info(struct retro_system_av_info *info)
info->geometry.max_height = MEDNAFEN_CORE_GEOMETRY_MAX_H << psx_gpu_upscale_shift;
info->geometry.aspect_ratio = !widescreen_hack ? MEDNAFEN_CORE_GEOMETRY_ASPECT_RATIO : (float)16/9;
rsx_get_system_av_info(info);
rsx_intf_get_system_av_info(info);
}
void retro_deinit(void)
@ -3720,7 +3720,7 @@ void retro_set_environment(retro_environment_t cb)
cb(RETRO_ENVIRONMENT_SET_VARIABLES, (void*)vars);
environ_cb(RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, (void*)ports);
rsx_set_environment(cb);
rsx_intf_set_environment(cb);
}
void retro_set_audio_sample(retro_audio_sample_t cb)
@ -3747,7 +3747,7 @@ void retro_set_video_refresh(retro_video_refresh_t cb)
{
video_cb = cb;
rsx_set_video_refresh(cb);
rsx_intf_set_video_refresh(cb);
}
static size_t serialize_size;

View File

@ -17,7 +17,7 @@
#include "psx.h"
#include "timer.h"
#include "rsx.h"
#include "../../rsx/rsx_intf.h"
/*
GPU display timing master clock is nominally 53.693182 MHz for NTSC PlayStations, and 53.203425 MHz for PAL PlayStations.
@ -516,9 +516,7 @@ static void G_Command_FBFill(PS_GPU* gpu, const uint32 *cb)
}
}
rsx_fill_rect(cb[0],
destX, destY,
width, height);
rsx_intf_fill_rect(cb[0], destX, destY, width, height);
}
static void G_Command_FBCopy(PS_GPU* g, const uint32 *cb)
@ -568,9 +566,7 @@ static void G_Command_FBCopy(PS_GPU* g, const uint32 *cb)
}
}
rsx_copy_rect(sourceX, sourceY,
destX, destY,
width, height);
rsx_intf_copy_rect(sourceX, sourceY, destX, destY, width, height);
}
static void G_Command_FBWrite(PS_GPU* g, const uint32 *cb)
@ -864,7 +860,7 @@ void PS_GPU::ProcessFIFO(void)
if(FBRW_CurY == (FBRW_Y + FBRW_H))
{
/* Upload complete, send over to RSX */
rsx_load_image(FBRW_X, FBRW_Y,
rsx_intf_load_image(FBRW_X, FBRW_Y,
FBRW_W, FBRW_H,
this->vram);
InCmd = INCMD_NONE;
@ -983,7 +979,7 @@ void PS_GPU::ProcessFIFO(void)
{
case 0xe3: /* Clip 0 */
case 0xe4: /* Clip 1 */
rsx_set_draw_area(this->ClipX0, this->ClipY0,
rsx_intf_set_draw_area(this->ClipX0, this->ClipY0,
this->ClipX1, this->ClipY1);
break;
default:
@ -1057,7 +1053,7 @@ void PS_GPU::Write(const int32_t timestamp, uint32_t A, uint32_t V)
case 0x00: // Reset GPU
//printf("\n\n************ Soft Reset %u ********* \n\n", scanline);
SoftReset();
rsx_set_draw_area(this->ClipX0, this->ClipY0,
rsx_intf_set_draw_area(this->ClipX0, this->ClipY0,
this->ClipX1, this->ClipY1);
UpdateDisplayMode();
break;
@ -1872,10 +1868,10 @@ int PS_GPU::StateAction(StateMem *sm, int load, int data_only)
IRQ_Assert(IRQ_GPU, IRQPending);
}
rsx_set_draw_area(this->ClipX0, this->ClipY0,
rsx_intf_set_draw_area(this->ClipX0, this->ClipY0,
this->ClipX1, this->ClipY1);
rsx_load_image(0, 0,
rsx_intf_load_image(0, 0,
1024, 512,
this->vram);
@ -1910,7 +1906,7 @@ void PS_GPU::UpdateDisplayMode()
}
}
rsx_set_display_mode(DisplayFB_XStart, DisplayFB_YStart,
rsx_intf_set_display_mode(DisplayFB_XStart, DisplayFB_YStart,
xres, yres,
depth_24bpp);
}

View File

@ -222,11 +222,11 @@ INLINE void PS_GPU::Command_DrawLine(const uint32_t *cb)
}
}
rsx_push_line(points[0].x, points[0].y,
points[1].x, points[1].y,
((uint32_t)points[0].r) | ((uint32_t)points[0].g << 8) | ((uint32_t)points[0].b << 16),
((uint32_t)points[1].r) | ((uint32_t)points[1].g << 8) | ((uint32_t)points[1].b << 16),
DitherEnabled());
rsx_intf_push_line(points[0].x, points[0].y,
points[1].x, points[1].y,
((uint32_t)points[0].r) | ((uint32_t)points[0].g << 8) | ((uint32_t)points[0].b << 16),
((uint32_t)points[1].r) | ((uint32_t)points[1].g << 8) | ((uint32_t)points[1].b << 16),
DitherEnabled());
DrawLine<goraud, BlendMode, MaskEval_TA>(points);
}

View File

@ -539,20 +539,20 @@ INLINE void PS_GPU::Command_DrawPolygon(const uint32_t *cb)
blend_mode = 0;
}
rsx_push_triangle(vertices[0].x, vertices[0].y,
vertices[1].x, vertices[1].y,
vertices[2].x, vertices[2].y,
((uint32_t)vertices[0].r) | ((uint32_t)vertices[0].g << 8) | ((uint32_t)vertices[0].b << 16),
((uint32_t)vertices[1].r) | ((uint32_t)vertices[1].g << 8) | ((uint32_t)vertices[1].b << 16),
((uint32_t)vertices[2].r) | ((uint32_t)vertices[2].g << 8) | ((uint32_t)vertices[2].b << 16),
vertices[0].u, vertices[0].v,
vertices[1].u, vertices[1].v,
vertices[2].u, vertices[2].v,
this->TexPageX, this->TexPageY,
clut_x, clut_y,
blend_mode,
2 - TexMode_TA,
DitherEnabled());
rsx_intf_push_triangle(vertices[0].x, vertices[0].y,
vertices[1].x, vertices[1].y,
vertices[2].x, vertices[2].y,
((uint32_t)vertices[0].r) | ((uint32_t)vertices[0].g << 8) | ((uint32_t)vertices[0].b << 16),
((uint32_t)vertices[1].r) | ((uint32_t)vertices[1].g << 8) | ((uint32_t)vertices[1].b << 16),
((uint32_t)vertices[2].r) | ((uint32_t)vertices[2].g << 8) | ((uint32_t)vertices[2].b << 16),
vertices[0].u, vertices[0].v,
vertices[1].u, vertices[1].v,
vertices[2].u, vertices[2].v,
this->TexPageX, this->TexPageY,
clut_x, clut_y,
blend_mode,
2 - TexMode_TA,
DitherEnabled());
DrawTriangle<goraud, textured, BlendMode, TexMult, TexMode_TA, MaskEval_TA>(vertices, clut);

View File

@ -184,7 +184,7 @@ INLINE void PS_GPU::Command_DrawSprite(const uint32_t *cb)
blend_mode = 0;
}
rsx_push_triangle(x, y,
rsx_intf_push_triangle(x, y,
x + w, y,
x, y + h,
color,
@ -199,7 +199,7 @@ INLINE void PS_GPU::Command_DrawSprite(const uint32_t *cb)
2 - TexMode_TA,
DitherEnabled());
rsx_push_triangle(x + w, y,
rsx_intf_push_triangle(x + w, y,
x, y + h,
x + w, y + h,
color,

68
rsx.h
View File

@ -1,68 +0,0 @@
#ifndef __RSX_H__
#define __RSX_H__
#include "libretro.h"
#ifdef __cplusplus
extern "C" {
#endif
void rsx_set_environment(retro_environment_t cb);
void rsx_set_video_refresh(retro_video_refresh_t cb);
void rsx_get_system_av_info(struct retro_system_av_info *info);
void rsx_init(void);
bool rsx_open(bool is_pal);
void rsx_close(void);
void rsx_refresh_variables(void);
void rsx_prepare_frame(void);
void rsx_finalize_frame(const void *data, unsigned width,
unsigned height, unsigned pitch);
void rsx_set_draw_offset(int16_t x, int16_t y);
void rsx_set_draw_area(uint16_t x, uint16_t y,
uint16_t w, uint16_t h);
void rsx_set_display_mode(uint16_t x, uint16_t y,
uint16_t w, uint16_t h,
bool depth_24bpp);
void rsx_push_triangle(int16_t p0x, int16_t p0y,
int16_t p1x, int16_t p1y,
int16_t p2x, int16_t p2y,
uint32_t c0,
uint32_t c1,
uint32_t c2,
uint16_t t0x, uint16_t t0y,
uint16_t t1x, uint16_t t1y,
uint16_t t2x, uint16_t t2y,
uint16_t texpage_x, uint16_t texpage_y,
uint16_t clut_x, uint16_t clut_y,
uint8_t texture_blend_mode,
uint8_t depth_shift,
bool dither);
void rsx_push_line(int16_t p0x, int16_t p0y,
int16_t p1x, int16_t p1y,
uint32_t c0,
uint32_t c1,
bool dither);
void rsx_load_image(uint16_t x, uint16_t y,
uint16_t w, uint16_t h,
uint16_t *vram);
void rsx_fill_rect(uint32_t color,
uint16_t x, uint16_t y,
uint16_t w, uint16_t h);
void rsx_copy_rect(uint16_t src_x, uint16_t src_y,
uint16_t dst_x, uint16_t dst_y,
uint16_t w, uint16_t h);
#ifdef __cplusplus
}
#endif
#endif /*__RSX_H__ */

View File

@ -7,13 +7,7 @@
#include <glsm/glsm.h>
#endif
#include "rsx.h"
enum rsx_renderer_type
{
RSX_SOFTWARE = 0,
RSX_OPENGL
};
#include "rsx_intf.h"
static enum rsx_renderer_type rsx_type = RSX_SOFTWARE;
static bool rsx_is_pal = false;
@ -46,25 +40,26 @@ static bool context_framebuffer_lock(void *data)
}
#endif
void rsx_set_environment(retro_environment_t cb)
void rsx_intf_set_environment(retro_environment_t cb)
{
rsx_environ_cb = cb;
}
void rsx_set_video_refresh(retro_video_refresh_t cb)
void rsx_intf_set_video_refresh(retro_video_refresh_t cb)
{
rsx_video_cb = cb;
}
void rsx_get_system_av_info(struct retro_system_av_info *info)
void rsx_intf_get_system_av_info(struct retro_system_av_info *info)
{
}
void rsx_init(void)
void rsx_intf_init(enum rsx_renderer_type type)
{
rsx_type = type;
}
bool rsx_open(bool is_pal)
bool rsx_intf_open(bool is_pal)
{
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES)
glsm_ctx_params_t params = {0};
@ -86,15 +81,15 @@ bool rsx_open(bool is_pal)
return true;
}
void rsx_close(void)
void rsx_intf_close(void)
{
}
void rsx_refresh_variables(void)
void rsx_intf_refresh_variables(void)
{
}
void rsx_prepare_frame(void)
void rsx_intf_prepare_frame(void)
{
switch (rsx_type)
{
@ -108,7 +103,7 @@ void rsx_prepare_frame(void)
}
}
void rsx_finalize_frame(const void *fb, unsigned width,
void rsx_intf_finalize_frame(const void *fb, unsigned width,
unsigned height, unsigned pitch)
{
switch (rsx_type)
@ -127,22 +122,22 @@ void rsx_finalize_frame(const void *fb, unsigned width,
}
}
void rsx_set_draw_offset(int16_t x, int16_t y)
void rsx_intf_set_draw_offset(int16_t x, int16_t y)
{
}
void rsx_set_draw_area(uint16_t x, uint16_t y,
void rsx_intf_set_draw_area(uint16_t x, uint16_t y,
uint16_t w, uint16_t h)
{
}
void rsx_set_display_mode(uint16_t x, uint16_t y,
void rsx_intf_set_display_mode(uint16_t x, uint16_t y,
uint16_t w, uint16_t h,
bool depth_24bpp)
{
}
void rsx_push_triangle(int16_t p0x, int16_t p0y,
void rsx_intf_push_triangle(int16_t p0x, int16_t p0y,
int16_t p1x, int16_t p1y,
int16_t p2x, int16_t p2y,
uint32_t c0,
@ -159,7 +154,7 @@ void rsx_push_triangle(int16_t p0x, int16_t p0y,
{
}
void rsx_push_line(int16_t p0x, int16_t p0y,
void rsx_intf_push_line(int16_t p0x, int16_t p0y,
int16_t p1x, int16_t p1y,
uint32_t c0,
uint32_t c1,
@ -167,19 +162,19 @@ void rsx_push_line(int16_t p0x, int16_t p0y,
{
}
void rsx_load_image(uint16_t x, uint16_t y,
void rsx_intf_load_image(uint16_t x, uint16_t y,
uint16_t w, uint16_t h,
uint16_t *vram)
{
}
void rsx_fill_rect(uint32_t color,
void rsx_intf_fill_rect(uint32_t color,
uint16_t x, uint16_t y,
uint16_t w, uint16_t h)
{
}
void rsx_copy_rect(uint16_t src_x, uint16_t src_y,
void rsx_intf_copy_rect(uint16_t src_x, uint16_t src_y,
uint16_t dst_x, uint16_t dst_y,
uint16_t w, uint16_t h)
{

75
rsx/rsx_intf.h Normal file
View File

@ -0,0 +1,75 @@
#ifndef __RSX_INTF_H__
#define __RSX_INTF_H__
#include "libretro.h"
enum rsx_renderer_type
{
RSX_SOFTWARE = 0,
RSX_OPENGL,
RSX_EXTERNAL_RUST
};
#ifdef __cplusplus
extern "C" {
#endif
void rsx_intf_set_environment(retro_environment_t cb);
void rsx_intf_set_video_refresh(retro_video_refresh_t cb);
void rsx_intf_get_system_av_info(struct retro_system_av_info *info);
void rsx_intf_init(enum rsx_renderer_type type);
bool rsx_intf_open(bool is_pal);
void rsx_intf_close(void);
void rsx_intf_refresh_variables(void);
void rsx_intf_prepare_frame(void);
void rsx_intf_finalize_frame(const void *data, unsigned width,
unsigned height, unsigned pitch);
void rsx_intf_set_draw_offset(int16_t x, int16_t y);
void rsx_intf_set_draw_area(uint16_t x, uint16_t y,
uint16_t w, uint16_t h);
void rsx_intf_set_display_mode(uint16_t x, uint16_t y,
uint16_t w, uint16_t h,
bool depth_24bpp);
void rsx_intf_push_triangle(int16_t p0x, int16_t p0y,
int16_t p1x, int16_t p1y,
int16_t p2x, int16_t p2y,
uint32_t c0,
uint32_t c1,
uint32_t c2,
uint16_t t0x, uint16_t t0y,
uint16_t t1x, uint16_t t1y,
uint16_t t2x, uint16_t t2y,
uint16_t texpage_x, uint16_t texpage_y,
uint16_t clut_x, uint16_t clut_y,
uint8_t texture_blend_mode,
uint8_t depth_shift,
bool dither);
void rsx_intf_push_line(int16_t p0x, int16_t p0y,
int16_t p1x, int16_t p1y,
uint32_t c0,
uint32_t c1,
bool dither);
void rsx_intf_load_image(uint16_t x, uint16_t y,
uint16_t w, uint16_t h,
uint16_t *vram);
void rsx_intf_fill_rect(uint32_t color,
uint16_t x, uint16_t y,
uint16_t w, uint16_t h);
void rsx_intf_copy_rect(uint16_t src_x, uint16_t src_y,
uint16_t dst_x, uint16_t dst_y,
uint16_t w, uint16_t h);
#ifdef __cplusplus
}
#endif
#endif /*__RSX_H__ */