mirror of
https://github.com/libretro/beetle-psx-libretro.git
synced 2024-11-23 08:49:47 +00:00
Video optimizations - ~4/~5fps speedup
This commit is contained in:
parent
c05011c393
commit
d69f53690d
@ -777,11 +777,15 @@ static void Emulate(EmulateSpecStruct *espec)
|
||||
{
|
||||
pscpu_timestamp_t timestamp = 0;
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
espec->skip = false;
|
||||
#else
|
||||
if(FIO->RequireNoFrameskip())
|
||||
{
|
||||
//puts("MEOW");
|
||||
espec->skip = false; //TODO: Save here, and restore at end of Emulate() ?
|
||||
}
|
||||
#endif
|
||||
|
||||
MDFNGameInfo->mouse_sensitivity = MDFN_GetSettingF("psx.input.mouse_sensitivity");
|
||||
|
||||
|
@ -121,6 +121,15 @@ void MDFN_Surface::Init(void *const p_pixels, const uint32 p_width, const uint32
|
||||
// to boot.
|
||||
void MDFN_Surface::SetFormat(const MDFN_PixelFormat &nf, bool convert)
|
||||
{
|
||||
#if (defined(WANT_PSX_EMU)) && defined(__LIBRETRO__)
|
||||
assert(format.bpp == 32);
|
||||
assert(nf.bpp == 32);
|
||||
|
||||
assert((nf.Rshift + nf.Gshift + nf.Bshift + nf.Ashift) == 48);
|
||||
assert(!((nf.Rshift | nf.Gshift | nf.Bshift | nf.Ashift) & 0x7));
|
||||
|
||||
format = nf;
|
||||
#else
|
||||
assert(format.bpp == 16 || format.bpp == 32);
|
||||
assert(nf.bpp == 16 || nf.bpp == 32);
|
||||
|
||||
@ -250,12 +259,21 @@ void MDFN_Surface::SetFormat(const MDFN_PixelFormat &nf, bool convert)
|
||||
}
|
||||
}
|
||||
format = nf;
|
||||
#endif
|
||||
}
|
||||
|
||||
void MDFN_Surface::Fill(uint8 r, uint8 g, uint8 b, uint8 a)
|
||||
{
|
||||
uint32 color = MakeColor(r, g, b, a);
|
||||
|
||||
#if (defined(WANT_PSX_EMU) && defined(__LIBRETRO__))
|
||||
/* 32bpp color */
|
||||
assert(pixels);
|
||||
|
||||
for(int32 i = 0; i < pitchinpix * h; i++)
|
||||
pixels[i] = color;
|
||||
#else
|
||||
/* 16bpp color */
|
||||
if(format.bpp == 16)
|
||||
{
|
||||
assert(pixels16);
|
||||
@ -270,6 +288,7 @@ void MDFN_Surface::Fill(uint8 r, uint8 g, uint8 b, uint8 a)
|
||||
for(int32 i = 0; i < pitchinpix * h; i++)
|
||||
pixels[i] = color;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
MDFN_Surface::~MDFN_Surface()
|
||||
|
@ -52,6 +52,12 @@ class MDFN_PixelFormat
|
||||
uint8 Aprec;
|
||||
|
||||
// Creates a color value for the surface corresponding to the 8-bit R/G/B/A color passed.
|
||||
#if (defined(WANT_PSX_EMU)) && defined(__LIBRETRO__)
|
||||
INLINE uint32 MakeColor(uint8 r, uint8 g, uint8 b, uint8 a = 0) const
|
||||
{
|
||||
return((r << Rshift) | (g << Gshift) | (b << Bshift) | (a << Ashift));
|
||||
}
|
||||
#else
|
||||
INLINE uint32 MakeColor(uint8 r, uint8 g, uint8 b, uint8 a = 0) const
|
||||
{
|
||||
if(colorspace == MDFN_COLORSPACE_YCbCr)
|
||||
@ -85,8 +91,18 @@ class MDFN_PixelFormat
|
||||
return((r << Rshift) | (g << Gshift) | (b << Bshift) | (a << Ashift));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Gets the R/G/B/A values for the passed 32-bit surface pixel value
|
||||
#if (defined(WANT_PSX_EMU)) && defined(__LIBRETRO__)
|
||||
INLINE void DecodeColor(uint32 value, int &r, int &g, int &b, int &a) const
|
||||
{
|
||||
r = (value >> Rshift) & 0xFF;
|
||||
g = (value >> Gshift) & 0xFF;
|
||||
b = (value >> Bshift) & 0xFF;
|
||||
a = (value >> Ashift) & 0xFF;
|
||||
}
|
||||
#else
|
||||
INLINE void DecodeColor(uint32 value, int &r, int &g, int &b, int &a) const
|
||||
{
|
||||
if(colorspace == MDFN_COLORSPACE_YCbCr)
|
||||
@ -140,6 +156,7 @@ class MDFN_PixelFormat
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}; // MDFN_PixelFormat;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user