Add semi-transparency to frankenbeetlte

This commit is contained in:
Lionel Flandrin 2016-04-16 14:27:47 +02:00 committed by twinaphex
parent 886a9f1bf5
commit 3f1096ad2a
7 changed files with 68 additions and 51 deletions

View File

@ -1,6 +1,6 @@
DEBUG = 0
FRONTEND_SUPPORTS_RGB565 = 1
HAVE_RUST=0
HAVE_RUST=1
HAVE_OPENGL=0
CORE_DIR := .

View File

@ -223,10 +223,11 @@ INLINE void PS_GPU::Command_DrawLine(const uint32_t *cb)
}
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());
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(),
BlendMode);
DrawLine<goraud, BlendMode, MaskEval_TA>(points);
}

View File

@ -545,7 +545,7 @@ INLINE void PS_GPU::Command_DrawPolygon(const uint32_t *cb)
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),
((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,
@ -553,7 +553,8 @@ INLINE void PS_GPU::Command_DrawPolygon(const uint32_t *cb)
clut_x, clut_y,
blend_mode,
2 - TexMode_TA,
DitherEnabled());
DitherEnabled(),
BlendMode);
DrawTriangle<goraud, textured, BlendMode, TexMult, TexMode_TA, MaskEval_TA>(vertices, clut);

View File

@ -197,7 +197,8 @@ INLINE void PS_GPU::Command_DrawSprite(const uint32_t *cb)
clut_x, clut_y,
blend_mode,
2 - TexMode_TA,
DitherEnabled());
DitherEnabled(),
BlendMode > 0);
rsx_intf_push_triangle(x + w, y,
x, y + h,
@ -212,7 +213,8 @@ INLINE void PS_GPU::Command_DrawSprite(const uint32_t *cb)
clut_x, clut_y,
blend_mode,
2 - TexMode_TA,
DitherEnabled());
DitherEnabled(),
BlendMode > 0);
#if 0
printf("SPRITE: %d %d %d -- %d %d\n", raw_size, x, y, w, h);

View File

@ -7,26 +7,16 @@
extern "C" {
#endif
enum blending_modes
{
BLEND_MODE_AVERAGE = 0,
BLEND_MODE_ADD,
BLEND_MODE_SUBTRACT,
BLEND_MODE_ADD_FOURTH
};
void rsx_set_environment(retro_environment_t);
void rsx_set_video_refresh(retro_video_refresh_t);
void rsx_get_system_av_info(struct retro_system_av_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(void);
void rsx_set_blend_mode(enum blending_modes mode);
void rsx_close();
void rsx_refresh_variables();
void rsx_prepare_frame();
void rsx_finalize_frame();
void rsx_set_draw_offset(int16_t x, int16_t y);
void rsx_set_draw_area(uint16_t x, uint16_t y,
@ -48,13 +38,15 @@ extern "C" {
uint16_t clut_x, uint16_t clut_y,
uint8_t texture_blend_mode,
uint8_t depth_shift,
bool dither);
bool dither,
int blend_mode);
void rsx_push_line(int16_t p0x, int16_t p0y,
int16_t p1x, int16_t p1y,
uint32_t c0,
uint32_t c1,
bool dither);
bool dither,
int blend_mode);
void rsx_load_image(uint16_t x, uint16_t y,
uint16_t w, uint16_t h,

View File

@ -296,7 +296,8 @@ void rsx_intf_push_triangle(int16_t p0x, int16_t p0y,
uint16_t clut_x, uint16_t clut_y,
uint8_t texture_blend_mode,
uint8_t depth_shift,
bool dither)
bool dither,
int blend_mode)
{
switch (rsx_type)
{
@ -309,7 +310,8 @@ void rsx_intf_push_triangle(int16_t p0x, int16_t p0y,
texpage_x, texpage_y, clut_x, clut_y,
texture_blend_mode,
depth_shift,
dither);
dither,
blend_mode);
#endif
break;
case RSX_EXTERNAL_RUST:
@ -319,7 +321,8 @@ void rsx_intf_push_triangle(int16_t p0x, int16_t p0y,
texpage_x, texpage_y, clut_x, clut_y,
texture_blend_mode,
depth_shift,
dither);
dither,
blend_mode);
#endif
break;
}
@ -329,7 +332,8 @@ 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)
bool dither,
int blend_mode)
{
switch (rsx_type)
{
@ -337,12 +341,12 @@ void rsx_intf_push_line(int16_t p0x, int16_t p0y,
break;
case RSX_OPENGL:
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES)
rsx_gl_push_line(p0x, p0y, p1x, p1y, c0, c1, dither);
rsx_gl_push_line(p0x, p0y, p1x, p1y, c0, c1, dither, blend_mode);
#endif
break;
case RSX_EXTERNAL_RUST:
#ifdef HAVE_RUST
rsx_push_line(p0x, p0y, p1x, p1y, c0, c1, dither);
rsx_push_line(p0x, p0y, p1x, p1y, c0, c1, dither, blend_mode);
#endif
break;
}

View File

@ -22,6 +22,15 @@ enum rsx_renderer_type
RSX_EXTERNAL_RUST
};
enum blending_modes
{
BLEND_MODE_OPAQUE = -1,
BLEND_MODE_AVERAGE = 0,
BLEND_MODE_ADD = 1,
BLEND_MODE_SUBTRACT = 2,
BLEND_MODE_ADD_FOURTH = 3,
};
#ifdef __cplusplus
extern "C" {
#endif
@ -42,31 +51,39 @@ extern "C" {
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);
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);
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);
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,
// This is really an `enum blending_modes`
// but I don't want to deal with enums in the
// FFI
int blend_mode);
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);
int16_t p1x, int16_t p1y,
uint32_t c0,
uint32_t c1,
bool dither,
// This is really an `enum blending_modes`
// but I don't want to deal with enums in the
// FFI
int blend_mode);
void rsx_intf_load_image(uint16_t x, uint16_t y,
uint16_t w, uint16_t h,