MakeTexture fixed

This commit is contained in:
dborth 2009-05-22 21:17:06 +00:00
parent f9ffdcd948
commit f422631a79
2 changed files with 46 additions and 74 deletions

View File

@ -1,72 +0,0 @@
/*-------------------------------------------------------------
maketex.cpp - Helper functions for GX texture conversion
Modified for a buffer with an offset (border)
Copyright (C) 2008
softdev
Michael Wiedenbauer (shagkur)
Dave Murphy (WinterMute)
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you
must not claim that you wrote the original software. If you use
this software in a product, an acknowledgment in the product
documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
-------------------------------------------------------------*/
#include <gctypes.h>
void
MakeTexture (const void *src, void *dst, s32 width, s32 height)
{
register u32 tmp0=0,tmp1=0,tmp2=0,tmp3=0;
__asm__ __volatile__ (
" srwi %6,%6,2\n"
" srwi %7,%7,2\n"
" subi %3,%4,4\n"
" mr %4,%3\n"
" subi %4,%4,4\n"
"2: mtctr %6\n"
" mr %0,%5\n"
//
"1: lwz %1,0(%5)\n" //1
" stwu %1,8(%4)\n"
" lwz %2,4(%5)\n" //1
" stwu %2,8(%3)\n"
" lwz %1,1032(%5)\n" //2
" stwu %1,8(%4)\n"
" lwz %2,1036(%5)\n" //2
" stwu %2,8(%3)\n"
" lwz %1,2064(%5)\n" //3
" stwu %1,8(%4)\n"
" lwz %2,2068(%5)\n" //3
" stwu %2,8(%3)\n"
" lwz %1,3096(%5)\n" //4
" stwu %1,8(%4)\n"
" lwz %2,3100(%5)\n" //4
" stwu %2,8(%3)\n"
" addi %5,%5,8\n"
" bdnz 1b\n"
" addi %5,%0,4128\n" //5
" subic. %7,%7,1\n"
" bne 2b"
// 0 1 2 3 4 5 6 7
: "=&r"(tmp0), "=&r"(tmp1), "=&r"(tmp2), "=&r"(tmp3), "+r"(dst) : "r"(src), "r"(width), "r"(height)
);
}

View File

@ -32,8 +32,6 @@
#include "gui/gui.h" #include "gui/gui.h"
#include "input.h" #include "input.h"
extern void MakeTexture (const void *src, void *dst, s32 width, s32 height);
/*** Snes9x GFX Buffer ***/ /*** Snes9x GFX Buffer ***/
#define SNES9XGFX_SIZE EXT_PITCH*EXT_HEIGHT #define SNES9XGFX_SIZE EXT_PITCH*EXT_HEIGHT
#define FILTERMEM_SIZE 512*MAX_SNES_HEIGHT*4 #define FILTERMEM_SIZE 512*MAX_SNES_HEIGHT*4
@ -691,6 +689,52 @@ ResetVideo_Emu ()
draw_init (); draw_init ();
} }
/****************************************************************************
* MakeTexture
*
* Modified for a buffer with an offset (border)
***************************************************************************/
void
MakeTexture (const void *src, void *dst, s32 width, s32 height)
{
register u32 tmp0=0,tmp1=0,tmp2=0,tmp3=0;
__asm__ __volatile__ (
" srwi %6,%6,2\n"
" srwi %7,%7,2\n"
" subi %3,%4,4\n"
" mr %4,%3\n"
" subi %4,%4,4\n"
"2: mtctr %6\n"
" mr %0,%5\n"
//
"1: lwz %1,0(%5)\n" //1
" stwu %1,8(%4)\n"
" lwz %2,4(%5)\n" //1
" stwu %2,8(%3)\n"
" lwz %1,1032(%5)\n" //2
" stwu %1,8(%4)\n"
" lwz %2,1036(%5)\n" //2
" stwu %2,8(%3)\n"
" lwz %1,2064(%5)\n" //3
" stwu %1,8(%4)\n"
" lwz %2,2068(%5)\n" //3
" stwu %2,8(%3)\n"
" lwz %1,3096(%5)\n" //4
" stwu %1,8(%4)\n"
" lwz %2,3100(%5)\n" //4
" stwu %2,8(%3)\n"
" addi %5,%5,8\n"
" bdnz 1b\n"
" addi %5,%0,4128\n" //5
" subic. %7,%7,1\n"
" bne 2b"
// 0 1 2 3 4 5 6 7
: "=&b"(tmp0), "=&b"(tmp1), "=&b"(tmp2), "=&b"(tmp3), "+b"(dst) : "b"(src), "b"(width), "b"(height)
);
}
/**************************************************************************** /****************************************************************************
* Update Video * Update Video
***************************************************************************/ ***************************************************************************/