This commit is contained in:
dborth 2009-07-22 07:01:09 +00:00
parent db61d23ca4
commit 07e87efe38
3 changed files with 14 additions and 26 deletions

View File

@ -54,6 +54,7 @@ static Mtx GXmodelView2D;
/*** Texture memory ***/ /*** Texture memory ***/
static unsigned char texturemem[TEX_WIDTH * TEX_HEIGHT * 4] ATTRIBUTE_ALIGN (32); static unsigned char texturemem[TEX_WIDTH * TEX_HEIGHT * 4] ATTRIBUTE_ALIGN (32);
unsigned char filtermem[TEX_WIDTH * TEX_HEIGHT * 4] ATTRIBUTE_ALIGN (32); unsigned char filtermem[TEX_WIDTH * TEX_HEIGHT * 4] ATTRIBUTE_ALIGN (32);
unsigned char filtermem2[TEX_WIDTH * TEX_HEIGHT * 4] ATTRIBUTE_ALIGN (32);
static int UpdateVideo = 1; static int UpdateVideo = 1;
static int vmode_60hz = 0; static int vmode_60hz = 0;
@ -669,6 +670,9 @@ ResetVideo_Emu ()
void RenderFrame(unsigned char *XBuf) void RenderFrame(unsigned char *XBuf)
{ {
if(!XBuf)
return;
// Ensure previous vb has complete // Ensure previous vb has complete
while ((LWP_ThreadIsSuspended (vbthread) == 0) || (copynow == GX_TRUE)) while ((LWP_ThreadIsSuspended (vbthread) == 0) || (copynow == GX_TRUE))
usleep (50); usleep (50);
@ -696,8 +700,16 @@ void RenderFrame(unsigned char *XBuf)
if (GCSettings.FilterMethod != FILTER_NONE) if (GCSettings.FilterMethod != FILTER_NONE)
{ {
FilterMethod ((uint8*) XBuf, 272, (uint8*) filtermem, TEX_WIDTH*fscale*2, TEX_WIDTH, TEX_HEIGHT); // convert to 16 bpp
MakeTexture565((char *)filtermem, (char *) texturemem, TEX_WIDTH*fscale, TEX_HEIGHT*fscale); uint8 *src = (uint8 *)XBuf;
uint16 * dst = (uint16 *)filtermem;
for (height = 0; height < TEX_HEIGHT; height++)
for (width = 0; width < TEX_WIDTH; width++)
*dst++ = rgb565[*src++];
FilterMethod ((uint8*) filtermem, TEX_WIDTH*2, (uint8*) filtermem2, TEX_WIDTH*fscale*2, TEX_WIDTH, TEX_HEIGHT);
MakeTexture565((char *)filtermem2, (char *) texturemem, TEX_WIDTH*fscale, TEX_HEIGHT*fscale);
} }
else else
{ {

View File

@ -34,19 +34,6 @@ TFilterMethod FilterMethod = RenderPlain;
// Functions: // Functions:
// //
bool
GetFilterHiResSupport (RenderFilter filterID)
{
switch(filterID)
{
case FILTER_NONE:
return true;
default:
return false;
}
}
const char* const char*
GetFilterName (RenderFilter filterID) GetFilterName (RenderFilter filterID)
{ {
@ -224,17 +211,10 @@ void InitLUTs(void)
for (c = 0 ; c < (1<<NUMBITS) ; c++) for (c = 0 ; c < (1<<NUMBITS) ; c++)
{ {
//#ifdef R5G6B5
b = (int)((c & 0x1F)) << 3; b = (int)((c & 0x1F)) << 3;
g = (int)((c & 0x7E0)) >> 3; g = (int)((c & 0x7E0)) >> 3;
r = (int)((c & 0xF800)) >> 8; r = (int)((c & 0xF800)) >> 8;
//#else
// b = (int)((c & 0x1F)) << 3;
// g = (int)((c & 0x3E0)) >> 2;
// r = (int)((c & 0x7C00)) >> 7;
//#endif
RGBtoBright[c] = r+r+r + g+g+g + b+b; RGBtoBright[c] = r+r+r + g+g+g + b+b;
y = (int)( 0.256788f*r + 0.504129f*g + 0.097906f*b + 0.5f) + 16; y = (int)( 0.256788f*r + 0.504129f*g + 0.097906f*b + 0.5f) + 16;
@ -242,7 +222,6 @@ void InitLUTs(void)
v = (int)( 0.439216f*r - 0.367788f*g - 0.071427f*b + 0.5f) + 128; v = (int)( 0.439216f*r - 0.367788f*g - 0.071427f*b + 0.5f) + 128;
RGBtoYUV[c] = (y << 16) + (u << 8) + v; RGBtoYUV[c] = (y << 16) + (u << 8) + v;
} }
} }

View File

@ -41,7 +41,6 @@ enum RenderFilter {
typedef void (*TFilterMethod)(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height); typedef void (*TFilterMethod)(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height);
extern TFilterMethod FilterMethod; extern TFilterMethod FilterMethod;
extern TFilterMethod FilterMethodHiRes;
extern unsigned char filtermem[]; extern unsigned char filtermem[];
@ -50,10 +49,8 @@ extern unsigned char filtermem[];
// //
void SelectFilterMethod (); void SelectFilterMethod ();
void RenderPlain (uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height); void RenderPlain (uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height);
void SelectFilterMethod ();
TFilterMethod FilterToMethod (RenderFilter filterID); TFilterMethod FilterToMethod (RenderFilter filterID);
const char* GetFilterName (RenderFilter filterID); const char* GetFilterName (RenderFilter filterID);
bool GetFilterHiResSupport (RenderFilter filterID);
int GetFilterScale(RenderFilter filterID); int GetFilterScale(RenderFilter filterID);
template<int GuiScale> void RenderHQ2X (uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height); template<int GuiScale> void RenderHQ2X (uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height);
void InitLUTs(); void InitLUTs();