[CHG] Remove the "trash" occurence to a clean way to clear EFB

This commit is contained in:
N0NameN0 2009-12-05 23:43:13 +00:00
parent 8ede687af8
commit bf8a78ffac
3 changed files with 5 additions and 13 deletions

View file

@ -161,8 +161,6 @@ int GRRLIB_Init (void) {
// Initialise the filing system // Initialise the filing system
if (!fatInitDefault()) error_code = -2; if (!fatInitDefault()) error_code = -2;
TrashTex = memalign(32, rmode->fbWidth * rmode->efbHeight * 4);
VIDEO_SetBlack(false); // Enable video output VIDEO_SetBlack(false); // Enable video output
return error_code; return error_code;
} }
@ -191,8 +189,6 @@ void GRRLIB_Exit (void) {
GX_DrawDone(); GX_DrawDone();
GX_AbortFrame(); GX_AbortFrame();
// free the temp Texture (allocated for compositing)
free(TrashTex);
// Free up memory allocated for frame buffers & FIFOs // Free up memory allocated for frame buffers & FIFOs
if (xfb[0] != NULL) { free(MEM_K1_TO_K0(xfb[0])); xfb[0] = NULL; } if (xfb[0] != NULL) { free(MEM_K1_TO_K0(xfb[0])); xfb[0] = NULL; }
if (xfb[1] != NULL) { free(MEM_K1_TO_K0(xfb[1])); xfb[1] = NULL; } if (xfb[1] != NULL) { free(MEM_K1_TO_K0(xfb[1])); xfb[1] = NULL; }

View file

@ -27,15 +27,17 @@ THE SOFTWARE.
* @param posx top left corner of the grabbed part. * @param posx top left corner of the grabbed part.
* @param posy top left corner of the grabbed part. * @param posy top left corner of the grabbed part.
* @param tex A pointer to a texture representing the screen or NULL if an error occurs. * @param tex A pointer to a texture representing the screen or NULL if an error occurs.
* @param clear When this flag is set to true, the grabbed part is cleared while copying. * @param clear When this flag is set to true, the screen is cleared after copy.
*/ */
void GRRLIB_Screen2Texture (int posx, int posy, GRRLIB_texImg *tex, bool clear) { void GRRLIB_Screen2Texture (int posx, int posy, GRRLIB_texImg *tex, bool clear) {
if(tex->data != NULL) { if(tex->data != NULL) {
GX_SetTexCopySrc(posx, posy, tex->w, tex->h); GX_SetTexCopySrc(posx, posy, tex->w, tex->h);
GX_SetTexCopyDst(tex->w, tex->h, GX_TF_RGBA8, GX_FALSE); GX_SetTexCopyDst(tex->w, tex->h, GX_TF_RGBA8, GX_FALSE);
GX_CopyTex(tex->data, clear); GX_CopyTex(tex->data, GX_FALSE);
GX_PixModeSync(); GX_PixModeSync();
GRRLIB_FlushTex(tex); GRRLIB_FlushTex(tex);
if(clear)
GX_CopyDisp (xfb[!fb], GX_TRUE);
} }
} }
@ -57,12 +59,7 @@ void GRRLIB_CompoStart (void) {
* @param tex A pointer to a texture representing the screen or NULL if an error occurs. * @param tex A pointer to a texture representing the screen or NULL if an error occurs.
*/ */
void GRRLIB_CompoEnd(int posx, int posy, GRRLIB_texImg *tex) { void GRRLIB_CompoEnd(int posx, int posy, GRRLIB_texImg *tex) {
GRRLIB_Screen2Texture(posx, posy, tex, FALSE); GRRLIB_Screen2Texture(posx, posy, tex, GX_TRUE);
GX_SetTexCopySrc(0, 0, rmode->fbWidth, rmode->efbHeight);
GX_SetTexCopyDst(rmode->fbWidth, rmode->efbHeight, GX_TF_RGBA8, GX_FALSE);
GX_CopyTex(TrashTex, GX_TRUE);
GX_PixModeSync();
if (rmode->aa) GX_SetPixelFmt(GX_PF_RGB565_Z16, GX_ZC_LINEAR) ; if (rmode->aa) GX_SetPixelFmt(GX_PF_RGB565_Z16, GX_ZC_LINEAR) ;
else GX_SetPixelFmt(GX_PF_RGB8_Z24 , GX_ZC_LINEAR) ; else GX_SetPixelFmt(GX_PF_RGB8_Z24 , GX_ZC_LINEAR) ;

View file

@ -202,7 +202,6 @@ typedef struct tagRGBQUAD {
GRR_EXTERN GXRModeObj *rmode; GRR_EXTERN GXRModeObj *rmode;
GRR_EXTERN void *xfb[2] GRR_INITS(NULL, NULL); GRR_EXTERN void *xfb[2] GRR_INITS(NULL, NULL);
GRR_EXTERN u32 fb GRR_INIT(0); GRR_EXTERN u32 fb GRR_INIT(0);
GRR_EXTERN void *TrashTex;
//============================================================================== //==============================================================================
// procedure and function prototypes // procedure and function prototypes
// Inline function handling - http://www.greenend.org.uk/rjk/2003/03/inline.html // Inline function handling - http://www.greenend.org.uk/rjk/2003/03/inline.html