mirror of https://github.com/stella-emu/stella.git
Fixed huge performance issue in TV effects; CPU usage dropped from
26-27% to 11-12% on my test system. This is from a baseline of 8-9% for normal rendering, so the TV effects are now quite fast (only an extra 2-4% CPU usage). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2459 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
17d7b16be6
commit
090390b415
|
@ -133,13 +133,11 @@ void FBSurfaceTIA::update()
|
||||||
case FrameBufferGL::kBlarggNTSC:
|
case FrameBufferGL::kBlarggNTSC:
|
||||||
{
|
{
|
||||||
#ifdef HAVE_GL_BGRA
|
#ifdef HAVE_GL_BGRA
|
||||||
#define BLIT16 blit_1555
|
myFB.myNTSCFilter.blit_1555
|
||||||
#else
|
#else
|
||||||
#define BLIT16 blit_5551
|
myFB.myNTSCFilter.blit_5551
|
||||||
#endif
|
#endif
|
||||||
myFB.myNTSCFilter.BLIT16(currentFrame, width,
|
(currentFrame, width, height, buffer, myTexture->pitch);
|
||||||
myTexture->w, height,
|
|
||||||
buffer, myTexture->pitch);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -368,13 +368,15 @@ void FrameBufferGL::postFrameUpdate()
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void FrameBufferGL::enablePhosphor(bool enable, int blend)
|
void FrameBufferGL::enablePhosphor(bool enable, int blend)
|
||||||
|
{
|
||||||
|
if(myTiaSurface)
|
||||||
{
|
{
|
||||||
myUsePhosphor = enable;
|
myUsePhosphor = enable;
|
||||||
myPhosphorBlend = blend;
|
myPhosphorBlend = blend;
|
||||||
myFilterType = enable ? kPhosphor : kNone;
|
myFilterType = enable ? kPhosphor : kNone;
|
||||||
|
|
||||||
myRedrawEntireFrame = true;
|
myRedrawEntireFrame = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void FrameBufferGL::enableNTSC(bool enable)
|
void FrameBufferGL::enableNTSC(bool enable)
|
||||||
|
|
|
@ -83,19 +83,19 @@ class NTSCFilter
|
||||||
|
|
||||||
// Perform Blargg filtering on input buffer, place results in
|
// Perform Blargg filtering on input buffer, place results in
|
||||||
// output buffer
|
// output buffer
|
||||||
void blit_5551(uInt8* src_buf, long src_row_width,
|
// In the current implementation, the source pitch is always the
|
||||||
int src_width, int src_height,
|
// same as the actual width
|
||||||
|
void blit_5551(uInt8* src_buf, int src_width, int src_height,
|
||||||
uInt16* dest_buf, long dest_pitch)
|
uInt16* dest_buf, long dest_pitch)
|
||||||
{
|
{
|
||||||
atari_ntsc_blit_5551(&myFilter, src_buf, src_row_width,
|
atari_ntsc_blit_5551(&myFilter, src_buf, src_width,
|
||||||
src_width, src_height,
|
src_width, src_height,
|
||||||
dest_buf, dest_pitch);
|
dest_buf, dest_pitch);
|
||||||
}
|
}
|
||||||
void blit_1555(uInt8* src_buf, long src_row_width,
|
void blit_1555(uInt8* src_buf, int src_width, int src_height,
|
||||||
int src_width, int src_height,
|
|
||||||
uInt16* dest_buf, long dest_pitch)
|
uInt16* dest_buf, long dest_pitch)
|
||||||
{
|
{
|
||||||
atari_ntsc_blit_1555(&myFilter, src_buf, src_row_width,
|
atari_ntsc_blit_1555(&myFilter, src_buf, src_width,
|
||||||
src_width, src_height,
|
src_width, src_height,
|
||||||
dest_buf, dest_pitch);
|
dest_buf, dest_pitch);
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ void atari_ntsc_blit_5551( atari_ntsc_t const* ntsc, atari_ntsc_in_t const* atar
|
||||||
while ( in_height-- )
|
while ( in_height-- )
|
||||||
{
|
{
|
||||||
atari_ntsc_in_t const* line_in = atari_in;
|
atari_ntsc_in_t const* line_in = atari_in;
|
||||||
ATARI_NTSC_BEGIN_ROW( ntsc, atari_ntsc_black, ATARI_NTSC_ADJ_IN( line_in[0] ) );
|
ATARI_NTSC_BEGIN_ROW( ntsc, atari_ntsc_black, line_in[0] );
|
||||||
atari_ntsc_out_t* restrict line_out = (atari_ntsc_out_t*) rgb_out;
|
atari_ntsc_out_t* restrict line_out = (atari_ntsc_out_t*) rgb_out;
|
||||||
int n;
|
int n;
|
||||||
++line_in;
|
++line_in;
|
||||||
|
@ -122,13 +122,13 @@ void atari_ntsc_blit_5551( atari_ntsc_t const* ntsc, atari_ntsc_in_t const* atar
|
||||||
for ( n = chunk_count; n; --n )
|
for ( n = chunk_count; n; --n )
|
||||||
{
|
{
|
||||||
/* order of input and output pixels must not be altered */
|
/* order of input and output pixels must not be altered */
|
||||||
ATARI_NTSC_COLOR_IN( 0, ntsc, ATARI_NTSC_ADJ_IN( line_in[0] ) );
|
ATARI_NTSC_COLOR_IN( 0, ntsc, line_in[0] );
|
||||||
ATARI_NTSC_RGB_OUT_5551( 0, line_out[0] );
|
ATARI_NTSC_RGB_OUT_5551( 0, line_out[0] );
|
||||||
ATARI_NTSC_RGB_OUT_5551( 1, line_out[1] );
|
ATARI_NTSC_RGB_OUT_5551( 1, line_out[1] );
|
||||||
ATARI_NTSC_RGB_OUT_5551( 2, line_out[2] );
|
ATARI_NTSC_RGB_OUT_5551( 2, line_out[2] );
|
||||||
ATARI_NTSC_RGB_OUT_5551( 3, line_out[3] );
|
ATARI_NTSC_RGB_OUT_5551( 3, line_out[3] );
|
||||||
|
|
||||||
ATARI_NTSC_COLOR_IN( 1, ntsc, ATARI_NTSC_ADJ_IN( line_in[1] ) );
|
ATARI_NTSC_COLOR_IN( 1, ntsc, line_in[1] );
|
||||||
ATARI_NTSC_RGB_OUT_5551( 4, line_out[4] );
|
ATARI_NTSC_RGB_OUT_5551( 4, line_out[4] );
|
||||||
ATARI_NTSC_RGB_OUT_5551( 5, line_out[5] );
|
ATARI_NTSC_RGB_OUT_5551( 5, line_out[5] );
|
||||||
ATARI_NTSC_RGB_OUT_5551( 6, line_out[6] );
|
ATARI_NTSC_RGB_OUT_5551( 6, line_out[6] );
|
||||||
|
@ -162,7 +162,7 @@ void atari_ntsc_blit_1555( atari_ntsc_t const* ntsc, atari_ntsc_in_t const* atar
|
||||||
while ( in_height-- )
|
while ( in_height-- )
|
||||||
{
|
{
|
||||||
atari_ntsc_in_t const* line_in = atari_in;
|
atari_ntsc_in_t const* line_in = atari_in;
|
||||||
ATARI_NTSC_BEGIN_ROW( ntsc, atari_ntsc_black, ATARI_NTSC_ADJ_IN( line_in[0] ) );
|
ATARI_NTSC_BEGIN_ROW( ntsc, atari_ntsc_black, line_in[0] );
|
||||||
atari_ntsc_out_t* restrict line_out = (atari_ntsc_out_t*) rgb_out;
|
atari_ntsc_out_t* restrict line_out = (atari_ntsc_out_t*) rgb_out;
|
||||||
int n;
|
int n;
|
||||||
++line_in;
|
++line_in;
|
||||||
|
@ -170,13 +170,13 @@ void atari_ntsc_blit_1555( atari_ntsc_t const* ntsc, atari_ntsc_in_t const* atar
|
||||||
for ( n = chunk_count; n; --n )
|
for ( n = chunk_count; n; --n )
|
||||||
{
|
{
|
||||||
/* order of input and output pixels must not be altered */
|
/* order of input and output pixels must not be altered */
|
||||||
ATARI_NTSC_COLOR_IN( 0, ntsc, ATARI_NTSC_ADJ_IN( line_in[0] ) );
|
ATARI_NTSC_COLOR_IN( 0, ntsc, line_in[0] );
|
||||||
ATARI_NTSC_RGB_OUT_1555( 0, line_out[0] );
|
ATARI_NTSC_RGB_OUT_1555( 0, line_out[0] );
|
||||||
ATARI_NTSC_RGB_OUT_1555( 1, line_out[1] );
|
ATARI_NTSC_RGB_OUT_1555( 1, line_out[1] );
|
||||||
ATARI_NTSC_RGB_OUT_1555( 2, line_out[2] );
|
ATARI_NTSC_RGB_OUT_1555( 2, line_out[2] );
|
||||||
ATARI_NTSC_RGB_OUT_1555( 3, line_out[3] );
|
ATARI_NTSC_RGB_OUT_1555( 3, line_out[3] );
|
||||||
|
|
||||||
ATARI_NTSC_COLOR_IN( 1, ntsc, ATARI_NTSC_ADJ_IN( line_in[1] ) );
|
ATARI_NTSC_COLOR_IN( 1, ntsc, line_in[1] );
|
||||||
ATARI_NTSC_RGB_OUT_1555( 4, line_out[4] );
|
ATARI_NTSC_RGB_OUT_1555( 4, line_out[4] );
|
||||||
ATARI_NTSC_RGB_OUT_1555( 5, line_out[5] );
|
ATARI_NTSC_RGB_OUT_1555( 5, line_out[5] );
|
||||||
ATARI_NTSC_RGB_OUT_1555( 6, line_out[6] );
|
ATARI_NTSC_RGB_OUT_1555( 6, line_out[6] );
|
||||||
|
|
|
@ -30,10 +30,6 @@ typedef unsigned short atari_ntsc_out_t;
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Each raw pixel input value is passed through this. You might want to mask
|
|
||||||
the pixel index if you use the high bits as flags, etc. */
|
|
||||||
#define ATARI_NTSC_ADJ_IN( in ) in
|
|
||||||
|
|
||||||
/* Image parameters, ranging from -1.0 to 1.0. Actual internal values shown
|
/* Image parameters, ranging from -1.0 to 1.0. Actual internal values shown
|
||||||
in parenthesis and should remain fairly stable in future versions. */
|
in parenthesis and should remain fairly stable in future versions. */
|
||||||
typedef struct atari_ntsc_setup_t
|
typedef struct atari_ntsc_setup_t
|
||||||
|
|
Loading…
Reference in New Issue