Windows Port:
- Fix crashing bug with the OAM Viewer tool. - Improve the sprite drawing performance of the OAM Viewer tool.
This commit is contained in:
parent
3c85700c5c
commit
11403180db
|
@ -1577,6 +1577,7 @@ void GPUEngineBase::_LineExtRot(u16 *__restrict dstColorLine, const u16 lineInde
|
||||||
/* if i understand it correct, and it fixes some sprite problems in chameleon shot */
|
/* if i understand it correct, and it fixes some sprite problems in chameleon shot */
|
||||||
/* we have a 15 bit color, and should use the pal entry bits as alpha ?*/
|
/* we have a 15 bit color, and should use the pal entry bits as alpha ?*/
|
||||||
/* http://nocash.emubase.de/gbatek.htm#dsvideoobjs */
|
/* http://nocash.emubase.de/gbatek.htm#dsvideoobjs */
|
||||||
|
template<bool ISDEBUGRENDER>
|
||||||
void GPUEngineBase::_RenderSpriteBMP(const u8 spriteNum, const u16 l, u16 *__restrict dst, const u32 srcadr, u8 *__restrict dst_alpha, u8 *__restrict typeTab, u8 *__restrict prioTab, const u8 prio, const size_t lg, size_t sprX, size_t x, const s32 xdir, const u8 alpha)
|
void GPUEngineBase::_RenderSpriteBMP(const u8 spriteNum, const u16 l, u16 *__restrict dst, const u32 srcadr, u8 *__restrict dst_alpha, u8 *__restrict typeTab, u8 *__restrict prioTab, const u8 prio, const size_t lg, size_t sprX, size_t x, const s32 xdir, const u8 alpha)
|
||||||
{
|
{
|
||||||
const u16 *__restrict bmpBuffer = (u16 *)MMU_gpu_map(srcadr);
|
const u16 *__restrict bmpBuffer = (u16 *)MMU_gpu_map(srcadr);
|
||||||
|
@ -1584,6 +1585,21 @@ void GPUEngineBase::_RenderSpriteBMP(const u8 spriteNum, const u16 l, u16 *__res
|
||||||
|
|
||||||
#ifdef ENABLE_SSE2
|
#ifdef ENABLE_SSE2
|
||||||
if (xdir == 1)
|
if (xdir == 1)
|
||||||
|
{
|
||||||
|
if (ISDEBUGRENDER)
|
||||||
|
{
|
||||||
|
const size_t ssePixCount = lg - (lg % 8);
|
||||||
|
for (; i < ssePixCount; i += 8, x += 8, sprX += 8)
|
||||||
|
{
|
||||||
|
__m128i color_vec128 = _mm_loadu_si128((__m128i *)(bmpBuffer + x));
|
||||||
|
const __m128i colorAlpha_vec128 = _mm_and_si128(color_vec128, _mm_set1_epi16(0x8000));
|
||||||
|
const __m128i colorAlphaCompare = _mm_cmpeq_epi16(colorAlpha_vec128, _mm_set1_epi16(0x8000));
|
||||||
|
color_vec128 = _mm_or_si128( _mm_and_si128(colorAlphaCompare, color_vec128), _mm_andnot_si128(colorAlphaCompare, _mm_loadu_si128((__m128i *)(dst + sprX))) );
|
||||||
|
|
||||||
|
_mm_storeu_si128((__m128i *)(dst + sprX), color_vec128);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
const __m128i prio_vec128 = _mm_set1_epi8(prio);
|
const __m128i prio_vec128 = _mm_set1_epi8(prio);
|
||||||
|
|
||||||
|
@ -1622,6 +1638,7 @@ void GPUEngineBase::_RenderSpriteBMP(const u8 spriteNum, const u16 l, u16 *__res
|
||||||
_mm_storeu_si128((__m128i *)(this->_sprNum + sprX), sprNum_vec128);
|
_mm_storeu_si128((__m128i *)(this->_sprNum + sprX), sprNum_vec128);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (; i < lg; i++, sprX++, x += xdir)
|
for (; i < lg; i++, sprX++, x += xdir)
|
||||||
|
@ -1629,6 +1646,15 @@ void GPUEngineBase::_RenderSpriteBMP(const u8 spriteNum, const u16 l, u16 *__res
|
||||||
const u16 color = LE_TO_LOCAL_16(bmpBuffer[x]);
|
const u16 color = LE_TO_LOCAL_16(bmpBuffer[x]);
|
||||||
|
|
||||||
//a cleared alpha bit suppresses the pixel from processing entirely; it doesnt exist
|
//a cleared alpha bit suppresses the pixel from processing entirely; it doesnt exist
|
||||||
|
if (ISDEBUGRENDER)
|
||||||
|
{
|
||||||
|
if (color & 0x8000)
|
||||||
|
{
|
||||||
|
dst[sprX] = color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if ((color & 0x8000) && (prio < prioTab[sprX]))
|
if ((color & 0x8000) && (prio < prioTab[sprX]))
|
||||||
{
|
{
|
||||||
dst[sprX] = color;
|
dst[sprX] = color;
|
||||||
|
@ -1639,7 +1665,9 @@ void GPUEngineBase::_RenderSpriteBMP(const u8 spriteNum, const u16 l, u16 *__res
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<bool ISDEBUGRENDER>
|
||||||
void GPUEngineBase::_RenderSprite256(const u8 spriteNum, const u16 l, u16 *__restrict dst, const u32 srcadr, const u16 *__restrict pal, u8 *__restrict dst_alpha, u8 *__restrict typeTab, u8 *__restrict prioTab, const u8 prio, const size_t lg, size_t sprX, size_t x, const s32 xdir, const u8 alpha)
|
void GPUEngineBase::_RenderSprite256(const u8 spriteNum, const u16 l, u16 *__restrict dst, const u32 srcadr, const u16 *__restrict pal, u8 *__restrict dst_alpha, u8 *__restrict typeTab, u8 *__restrict prioTab, const u8 prio, const size_t lg, size_t sprX, size_t x, const s32 xdir, const u8 alpha)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < lg; i++, ++sprX, x += xdir)
|
for (size_t i = 0; i < lg; i++, ++sprX, x += xdir)
|
||||||
|
@ -1649,10 +1677,18 @@ void GPUEngineBase::_RenderSprite256(const u8 spriteNum, const u16 l, u16 *__res
|
||||||
const u8 palette_entry = *src;
|
const u8 palette_entry = *src;
|
||||||
|
|
||||||
//a zero value suppresses the pixel from processing entirely; it doesnt exist
|
//a zero value suppresses the pixel from processing entirely; it doesnt exist
|
||||||
|
if (ISDEBUGRENDER)
|
||||||
|
{
|
||||||
|
if (palette_entry > 0)
|
||||||
|
{
|
||||||
|
dst[sprX] = LE_TO_LOCAL_16(pal[palette_entry]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if ((palette_entry > 0) && (prio < prioTab[sprX]))
|
if ((palette_entry > 0) && (prio < prioTab[sprX]))
|
||||||
{
|
{
|
||||||
const u16 color = LE_TO_LOCAL_16(pal[palette_entry]);
|
dst[sprX] = LE_TO_LOCAL_16(pal[palette_entry]);
|
||||||
dst[sprX] = color;
|
|
||||||
dst_alpha[sprX] = 0xFF;
|
dst_alpha[sprX] = 0xFF;
|
||||||
typeTab[sprX] = (alpha ? OBJMode_Transparent : OBJMode_Normal);
|
typeTab[sprX] = (alpha ? OBJMode_Transparent : OBJMode_Normal);
|
||||||
prioTab[sprX] = prio;
|
prioTab[sprX] = prio;
|
||||||
|
@ -1660,8 +1696,10 @@ void GPUEngineBase::_RenderSprite256(const u8 spriteNum, const u16 l, u16 *__res
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GPUEngineBase::_RenderSprite16(const u16 l, u16 *__restrict dst, const u32 srcadr, const u16 *__restrict pal, u8 *__restrict dst_alpha, u8 *__restrict typeTab, u8 *__restrict prioTab, const u8 prio, const size_t lg, size_t sprX, size_t x, const s32 xdir, const u8 alpha)
|
template<bool ISDEBUGRENDER>
|
||||||
|
void GPUEngineBase::_RenderSprite16(const u8 spriteNum, const u16 l, u16 *__restrict dst, const u32 srcadr, const u16 *__restrict pal, u8 *__restrict dst_alpha, u8 *__restrict typeTab, u8 *__restrict prioTab, const u8 prio, const size_t lg, size_t sprX, size_t x, const s32 xdir, const u8 alpha)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < lg; i++, ++sprX, x += xdir)
|
for (size_t i = 0; i < lg; i++, ++sprX, x += xdir)
|
||||||
{
|
{
|
||||||
|
@ -1672,13 +1710,23 @@ void GPUEngineBase::_RenderSprite16(const u16 l, u16 *__restrict dst, const u32
|
||||||
const u8 palette_entry = (x & 1) ? palette >> 4 : palette & 0xF;
|
const u8 palette_entry = (x & 1) ? palette >> 4 : palette & 0xF;
|
||||||
|
|
||||||
//a zero value suppresses the pixel from processing entirely; it doesnt exist
|
//a zero value suppresses the pixel from processing entirely; it doesnt exist
|
||||||
|
if (ISDEBUGRENDER)
|
||||||
|
{
|
||||||
|
if (palette_entry > 0)
|
||||||
|
{
|
||||||
|
dst[sprX] = LE_TO_LOCAL_16(pal[palette_entry]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if ((palette_entry > 0) && (prio < prioTab[sprX]))
|
if ((palette_entry > 0) && (prio < prioTab[sprX]))
|
||||||
{
|
{
|
||||||
const u16 color = LE_TO_LOCAL_16(pal[palette_entry]);
|
dst[sprX] = LE_TO_LOCAL_16(pal[palette_entry]);
|
||||||
dst[sprX] = color;
|
|
||||||
dst_alpha[sprX] = 0xFF;
|
dst_alpha[sprX] = 0xFF;
|
||||||
typeTab[sprX] = (alpha ? OBJMode_Transparent : OBJMode_Normal);
|
typeTab[sprX] = (alpha ? OBJMode_Transparent : OBJMode_Normal);
|
||||||
prioTab[sprX] = prio;
|
prioTab[sprX] = prio;
|
||||||
|
this->_sprNum[sprX] = spriteNum;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1793,20 +1841,21 @@ u32 GPUEngineBase::_SpriteAddressBMP(const OAMAttributes &spriteInfo, const Spri
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPUEngineBase::SpriteRender(const u16 lineIndex, u16 *__restrict dst, u8 *__restrict dst_alpha, u8 *__restrict typeTab, u8 *__restrict prioTab)
|
template <bool ISDEBUGRENDER>
|
||||||
|
void GPUEngineBase::_SpriteRender(const u16 lineIndex, u16 *__restrict dst, u8 *__restrict dst_alpha, u8 *__restrict typeTab, u8 *__restrict prioTab)
|
||||||
{
|
{
|
||||||
if (this->_spriteRenderMode == SpriteRenderMode_Sprite1D)
|
if (this->_spriteRenderMode == SpriteRenderMode_Sprite1D)
|
||||||
this->_SpriteRenderPerform<SpriteRenderMode_Sprite1D>(lineIndex, dst, dst_alpha, typeTab, prioTab);
|
this->_SpriteRenderPerform<SpriteRenderMode_Sprite1D, ISDEBUGRENDER>(lineIndex, dst, dst_alpha, typeTab, prioTab);
|
||||||
else
|
else
|
||||||
this->_SpriteRenderPerform<SpriteRenderMode_Sprite2D>(lineIndex, dst, dst_alpha, typeTab, prioTab);
|
this->_SpriteRenderPerform<SpriteRenderMode_Sprite2D, ISDEBUGRENDER>(lineIndex, dst, dst_alpha, typeTab, prioTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPUEngineBase::SpriteRenderDebug(const u16 lineIndex, u16 *__restrict dst, u8 *__restrict dst_alpha, u8 *__restrict typeTab, u8 *__restrict prioTab)
|
void GPUEngineBase::SpriteRenderDebug(const u16 lineIndex, u16 *dst)
|
||||||
{
|
{
|
||||||
this->SpriteRender(lineIndex, dst, dst_alpha, typeTab, prioTab);
|
this->_SpriteRender<true>(lineIndex, dst, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<SpriteRenderMode MODE>
|
template <SpriteRenderMode MODE, bool ISDEBUGRENDER>
|
||||||
void GPUEngineBase::_SpriteRenderPerform(const u16 lineIndex, u16 *__restrict dst, u8 *__restrict dst_alpha, u8 *__restrict typeTab, u8 *__restrict prioTab)
|
void GPUEngineBase::_SpriteRenderPerform(const u16 lineIndex, u16 *__restrict dst, u8 *__restrict dst_alpha, u8 *__restrict typeTab, u8 *__restrict prioTab)
|
||||||
{
|
{
|
||||||
const IOREG_DISPCNT &DISPCNT = this->_IORegisterMap->DISPCNT;
|
const IOREG_DISPCNT &DISPCNT = this->_IORegisterMap->DISPCNT;
|
||||||
|
@ -1940,6 +1989,15 @@ void GPUEngineBase::_SpriteRenderPerform(const u16 lineIndex, u16 *__restrict ds
|
||||||
|
|
||||||
colour = src[offset];
|
colour = src[offset];
|
||||||
|
|
||||||
|
if (ISDEBUGRENDER)
|
||||||
|
{
|
||||||
|
if (colour)
|
||||||
|
{
|
||||||
|
dst[sprX] = LE_TO_LOCAL_16(pal[colour]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (colour && (prio < prioTab[sprX]))
|
if (colour && (prio < prioTab[sprX]))
|
||||||
{
|
{
|
||||||
dst[sprX] = LE_TO_LOCAL_16(pal[colour]);
|
dst[sprX] = LE_TO_LOCAL_16(pal[colour]);
|
||||||
|
@ -1948,6 +2006,7 @@ void GPUEngineBase::_SpriteRenderPerform(const u16 lineIndex, u16 *__restrict ds
|
||||||
prioTab[sprX] = prio;
|
prioTab[sprX] = prio;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add the rotation/scale coefficients, here the rotation/scaling is performed
|
// Add the rotation/scale coefficients, here the rotation/scaling is performed
|
||||||
realX += dx;
|
realX += dx;
|
||||||
|
@ -1985,6 +2044,15 @@ void GPUEngineBase::_SpriteRenderPerform(const u16 lineIndex, u16 *__restrict ds
|
||||||
u16* mem = (u16*)MMU_gpu_map(srcadr + (offset<<1));
|
u16* mem = (u16*)MMU_gpu_map(srcadr + (offset<<1));
|
||||||
colour = LE_TO_LOCAL_16(*mem);
|
colour = LE_TO_LOCAL_16(*mem);
|
||||||
|
|
||||||
|
if (ISDEBUGRENDER)
|
||||||
|
{
|
||||||
|
if (colour & 0x8000)
|
||||||
|
{
|
||||||
|
dst[sprX] = colour;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if ((colour & 0x8000) && (prio < prioTab[sprX]))
|
if ((colour & 0x8000) && (prio < prioTab[sprX]))
|
||||||
{
|
{
|
||||||
dst[sprX] = colour;
|
dst[sprX] = colour;
|
||||||
|
@ -1993,6 +2061,7 @@ void GPUEngineBase::_SpriteRenderPerform(const u16 lineIndex, u16 *__restrict ds
|
||||||
prioTab[sprX] = prio;
|
prioTab[sprX] = prio;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add the rotation/scale coefficients, here the rotation/scaling is performed
|
// Add the rotation/scale coefficients, here the rotation/scaling is performed
|
||||||
realX += dx;
|
realX += dx;
|
||||||
|
@ -2032,6 +2101,15 @@ void GPUEngineBase::_SpriteRenderPerform(const u16 lineIndex, u16 *__restrict ds
|
||||||
if (auxX&1) colour >>= 4;
|
if (auxX&1) colour >>= 4;
|
||||||
else colour &= 0xF;
|
else colour &= 0xF;
|
||||||
|
|
||||||
|
if (ISDEBUGRENDER)
|
||||||
|
{
|
||||||
|
if (colour)
|
||||||
|
{
|
||||||
|
dst[sprX] = LE_TO_LOCAL_16(pal[colour]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (colour && (prio < prioTab[sprX]))
|
if (colour && (prio < prioTab[sprX]))
|
||||||
{
|
{
|
||||||
if (objMode == OBJMode_Window)
|
if (objMode == OBJMode_Window)
|
||||||
|
@ -2047,6 +2125,7 @@ void GPUEngineBase::_SpriteRenderPerform(const u16 lineIndex, u16 *__restrict ds
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add the rotation/scale coeficients, here the rotation/scaling is performed
|
// Add the rotation/scale coeficients, here the rotation/scaling is performed
|
||||||
realX += dx;
|
realX += dx;
|
||||||
|
@ -2088,7 +2167,7 @@ void GPUEngineBase::_SpriteRenderPerform(const u16 lineIndex, u16 *__restrict ds
|
||||||
if (spriteInfo.PaletteIndex == 0)
|
if (spriteInfo.PaletteIndex == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
this->_RenderSpriteBMP(i, lineIndex, dst, srcadr, dst_alpha, typeTab, prioTab, prio, lg, sprX, x, xdir, spriteInfo.PaletteIndex);
|
this->_RenderSpriteBMP<ISDEBUGRENDER>(i, lineIndex, dst, srcadr, dst_alpha, typeTab, prioTab, prio, lg, sprX, x, xdir, spriteInfo.PaletteIndex);
|
||||||
}
|
}
|
||||||
else if (spriteInfo.PaletteMode == PaletteMode_1x256) //256 colors
|
else if (spriteInfo.PaletteMode == PaletteMode_1x256) //256 colors
|
||||||
{
|
{
|
||||||
|
@ -2098,7 +2177,7 @@ void GPUEngineBase::_SpriteRenderPerform(const u16 lineIndex, u16 *__restrict ds
|
||||||
srcadr = this->_sprMem + (spriteInfo.TileIndex<<this->_sprBoundary) + ((y>>3)*sprSize.width*8) + ((y&0x7)*8);
|
srcadr = this->_sprMem + (spriteInfo.TileIndex<<this->_sprBoundary) + ((y>>3)*sprSize.width*8) + ((y&0x7)*8);
|
||||||
|
|
||||||
pal = (DISPCNT.ExOBJPalette_Enable) ? (u16 *)(MMU.ObjExtPal[this->_engineID][0]+(spriteInfo.PaletteIndex*ADDRESS_STEP_512B)) : this->_paletteOBJ;
|
pal = (DISPCNT.ExOBJPalette_Enable) ? (u16 *)(MMU.ObjExtPal[this->_engineID][0]+(spriteInfo.PaletteIndex*ADDRESS_STEP_512B)) : this->_paletteOBJ;
|
||||||
this->_RenderSprite256(i, lineIndex, dst, srcadr, pal, dst_alpha, typeTab, prioTab, prio, lg, sprX, x, xdir, (objMode == OBJMode_Transparent));
|
this->_RenderSprite256<ISDEBUGRENDER>(i, lineIndex, dst, srcadr, pal, dst_alpha, typeTab, prioTab, prio, lg, sprX, x, xdir, (objMode == OBJMode_Transparent));
|
||||||
}
|
}
|
||||||
else // 16 colors
|
else // 16 colors
|
||||||
{
|
{
|
||||||
|
@ -2112,7 +2191,7 @@ void GPUEngineBase::_SpriteRenderPerform(const u16 lineIndex, u16 *__restrict ds
|
||||||
}
|
}
|
||||||
|
|
||||||
pal = this->_paletteOBJ + (spriteInfo.PaletteIndex << 4);
|
pal = this->_paletteOBJ + (spriteInfo.PaletteIndex << 4);
|
||||||
this->_RenderSprite16(lineIndex, dst, srcadr, pal, dst_alpha, typeTab, prioTab, prio, lg, sprX, x, xdir, (objMode == OBJMode_Transparent));
|
this->_RenderSprite16<ISDEBUGRENDER>(i, lineIndex, dst, srcadr, pal, dst_alpha, typeTab, prioTab, prio, lg, sprX, x, xdir, (objMode == OBJMode_Transparent));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2840,7 +2919,7 @@ void GPUEngineA::_RenderLine_Layer(const u16 l, u16 *dstColorLine, const size_t
|
||||||
//zero 06-may-09: I properly supported window color effects for backdrop, but I am not sure
|
//zero 06-may-09: I properly supported window color effects for backdrop, but I am not sure
|
||||||
//how it interacts with this. I wish we knew why we needed this
|
//how it interacts with this. I wish we knew why we needed this
|
||||||
|
|
||||||
this->SpriteRender(l, this->_sprColor, this->_sprAlpha, this->_sprType, this->_sprPrio);
|
this->_SpriteRender<false>(l, this->_sprColor, this->_sprAlpha, this->_sprType, this->_sprPrio);
|
||||||
this->_MosaicSpriteLine(l, this->_sprColor, this->_sprAlpha, this->_sprType, this->_sprPrio);
|
this->_MosaicSpriteLine(l, this->_sprColor, this->_sprAlpha, this->_sprType, this->_sprPrio);
|
||||||
|
|
||||||
for (size_t i = 0; i < GPU_FRAMEBUFFER_NATIVE_WIDTH; i++)
|
for (size_t i = 0; i < GPU_FRAMEBUFFER_NATIVE_WIDTH; i++)
|
||||||
|
@ -3744,7 +3823,7 @@ void GPUEngineB::_RenderLine_Layer(const u16 l, u16 *dstColorLine, const size_t
|
||||||
//zero 06-may-09: I properly supported window color effects for backdrop, but I am not sure
|
//zero 06-may-09: I properly supported window color effects for backdrop, but I am not sure
|
||||||
//how it interacts with this. I wish we knew why we needed this
|
//how it interacts with this. I wish we knew why we needed this
|
||||||
|
|
||||||
this->SpriteRender(l, this->_sprColor, this->_sprAlpha, this->_sprType, this->_sprPrio);
|
this->_SpriteRender<false>(l, this->_sprColor, this->_sprAlpha, this->_sprType, this->_sprPrio);
|
||||||
this->_MosaicSpriteLine(l, this->_sprColor, this->_sprAlpha, this->_sprType, this->_sprPrio);
|
this->_MosaicSpriteLine(l, this->_sprColor, this->_sprAlpha, this->_sprType, this->_sprPrio);
|
||||||
|
|
||||||
for (size_t i = 0; i < GPU_FRAMEBUFFER_NATIVE_WIDTH; i++)
|
for (size_t i = 0; i < GPU_FRAMEBUFFER_NATIVE_WIDTH; i++)
|
||||||
|
|
|
@ -1220,15 +1220,16 @@ protected:
|
||||||
FORCEINLINE u16 _ColorEffectBlend(const u16 colA, const u16 colB, const TBlendTable *blendTable);
|
FORCEINLINE u16 _ColorEffectBlend(const u16 colA, const u16 colB, const TBlendTable *blendTable);
|
||||||
FORCEINLINE FragmentColor _ColorEffectBlend(const FragmentColor colA, const FragmentColor colB);
|
FORCEINLINE FragmentColor _ColorEffectBlend(const FragmentColor colA, const FragmentColor colB);
|
||||||
|
|
||||||
void _RenderSpriteBMP(const u8 spriteNum, const u16 l, u16 *__restrict dst, const u32 srcadr, u8 *__restrict dst_alpha, u8 *__restrict typeTab, u8 *__restrict prioTab, const u8 prio, const size_t lg, size_t sprX, size_t x, const s32 xdir, const u8 alpha);
|
template<bool ISDEBUGRENDER> void _RenderSpriteBMP(const u8 spriteNum, const u16 l, u16 *__restrict dst, const u32 srcadr, u8 *__restrict dst_alpha, u8 *__restrict typeTab, u8 *__restrict prioTab, const u8 prio, const size_t lg, size_t sprX, size_t x, const s32 xdir, const u8 alpha);
|
||||||
void _RenderSprite256(const u8 spriteNum, const u16 l, u16 *__restrict dst, const u32 srcadr, const u16 *__restrict pal, u8 *__restrict dst_alpha, u8 *__restrict typeTab, u8 *__restrict prioTab, const u8 prio, const size_t lg, size_t sprX, size_t x, const s32 xdir, const u8 alpha);
|
template<bool ISDEBUGRENDER> void _RenderSprite256(const u8 spriteNum, const u16 l, u16 *__restrict dst, const u32 srcadr, const u16 *__restrict pal, u8 *__restrict dst_alpha, u8 *__restrict typeTab, u8 *__restrict prioTab, const u8 prio, const size_t lg, size_t sprX, size_t x, const s32 xdir, const u8 alpha);
|
||||||
void _RenderSprite16(const u16 l, u16 *__restrict dst, const u32 srcadr, const u16 *__restrict pal, u8 *__restrict dst_alpha, u8 *__restrict typeTab, u8 *__restrict prioTab, const u8 prio, const size_t lg, size_t sprX, size_t x, const s32 xdir, const u8 alpha);
|
template<bool ISDEBUGRENDER> void _RenderSprite16(const u8 spriteNum, const u16 l, u16 *__restrict dst, const u32 srcadr, const u16 *__restrict pal, u8 *__restrict dst_alpha, u8 *__restrict typeTab, u8 *__restrict prioTab, const u8 prio, const size_t lg, size_t sprX, size_t x, const s32 xdir, const u8 alpha);
|
||||||
void _RenderSpriteWin(const u8 *src, const bool col256, const size_t lg, size_t sprX, size_t x, const s32 xdir);
|
void _RenderSpriteWin(const u8 *src, const bool col256, const size_t lg, size_t sprX, size_t x, const s32 xdir);
|
||||||
bool _ComputeSpriteVars(const OAMAttributes &spriteInfo, const u16 l, SpriteSize &sprSize, s32 &sprX, s32 &sprY, s32 &x, s32 &y, s32 &lg, s32 &xdir);
|
bool _ComputeSpriteVars(const OAMAttributes &spriteInfo, const u16 l, SpriteSize &sprSize, s32 &sprX, s32 &sprY, s32 &x, s32 &y, s32 &lg, s32 &xdir);
|
||||||
|
|
||||||
u32 _SpriteAddressBMP(const OAMAttributes &spriteInfo, const SpriteSize sprSize, const s32 y);
|
u32 _SpriteAddressBMP(const OAMAttributes &spriteInfo, const SpriteSize sprSize, const s32 y);
|
||||||
|
|
||||||
template<SpriteRenderMode MODE> void _SpriteRenderPerform(const u16 lineIndex, u16 *__restrict dst, u8 *__restrict dst_alpha, u8 *__restrict typeTab, u8 *__restrict prioTab);
|
template<bool ISDEBUGRENDER> void _SpriteRender(const u16 lineIndex, u16 *__restrict dst, u8 *__restrict dst_alpha, u8 *__restrict typeTab, u8 *__restrict prioTab);
|
||||||
|
template<SpriteRenderMode MODE, bool ISDEBUGRENDER> void _SpriteRenderPerform(const u16 lineIndex, u16 *__restrict dst, u8 *__restrict dst_alpha, u8 *__restrict typeTab, u8 *__restrict prioTab);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GPUEngineBase();
|
GPUEngineBase();
|
||||||
|
@ -1293,8 +1294,7 @@ public:
|
||||||
void UpdateVRAM3DUsageProperties_BGLayer(const size_t bankIndex, VRAM3DUsageProperties &outProperty);
|
void UpdateVRAM3DUsageProperties_BGLayer(const size_t bankIndex, VRAM3DUsageProperties &outProperty);
|
||||||
void UpdateVRAM3DUsageProperties_OBJLayer(const size_t bankIndex, VRAM3DUsageProperties &outProperty);
|
void UpdateVRAM3DUsageProperties_OBJLayer(const size_t bankIndex, VRAM3DUsageProperties &outProperty);
|
||||||
|
|
||||||
void SpriteRender(const u16 lineIndex, u16 *__restrict dst, u8 *__restrict dst_alpha, u8 *__restrict typeTab, u8 *__restrict prioTab);
|
void SpriteRenderDebug(const u16 lineIndex, u16 *dst);
|
||||||
void SpriteRenderDebug(const u16 lineIndex, u16 *__restrict dst, u8 *__restrict dst_alpha, u8 *__restrict typeTab, u8 *__restrict prioTab);
|
|
||||||
template<GPULayerID LAYERID> void RenderLayerBG(u16 *dstLineColor);
|
template<GPULayerID LAYERID> void RenderLayerBG(u16 *dstLineColor);
|
||||||
|
|
||||||
NDSDisplayID GetDisplayByID() const;
|
NDSDisplayID GetDisplayByID() const;
|
||||||
|
|
|
@ -112,9 +112,6 @@ LRESULT OamView_OnPaint(HWND hwnd, oamview_struct *win, WPARAM wParam, LPARAM lP
|
||||||
{
|
{
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
PAINTSTRUCT ps;
|
PAINTSTRUCT ps;
|
||||||
//_OAM_ _oam;
|
|
||||||
//_OAM_* oam = &_oam;
|
|
||||||
//SlurpOAM(oam,win->oam,win->num);
|
|
||||||
|
|
||||||
struct MyOam
|
struct MyOam
|
||||||
{
|
{
|
||||||
|
@ -126,9 +123,6 @@ LRESULT OamView_OnPaint(HWND hwnd, oamview_struct *win, WPARAM wParam, LPARAM lP
|
||||||
|
|
||||||
char text[80];
|
char text[80];
|
||||||
u16 bitmap[256*192];
|
u16 bitmap[256*192];
|
||||||
u8 bitmap_alpha[256*192];
|
|
||||||
u8 type[256*192];
|
|
||||||
u8 prio[256*192];
|
|
||||||
BITMAPV4HEADER bmi;
|
BITMAPV4HEADER bmi;
|
||||||
u16 i;
|
u16 i;
|
||||||
s16 x = 0, y = 0;
|
s16 x = 0, y = 0;
|
||||||
|
@ -148,9 +142,6 @@ LRESULT OamView_OnPaint(HWND hwnd, oamview_struct *win, WPARAM wParam, LPARAM lP
|
||||||
for(i = 0; i < 256*192; ++i)
|
for(i = 0; i < 256*192; ++i)
|
||||||
{
|
{
|
||||||
bitmap[i] = 0x7F0F;
|
bitmap[i] = 0x7F0F;
|
||||||
bitmap_alpha[i] = 0;
|
|
||||||
type[i] = 0;
|
|
||||||
prio[i] = 4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hdc = BeginPaint(hwnd, &ps);
|
hdc = BeginPaint(hwnd, &ps);
|
||||||
|
@ -220,10 +211,9 @@ LRESULT OamView_OnPaint(HWND hwnd, oamview_struct *win, WPARAM wParam, LPARAM lP
|
||||||
SetWindowText(GetDlgItem(hwnd, IDC_PROP1), "");
|
SetWindowText(GetDlgItem(hwnd, IDC_PROP1), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
GPUEngineBase copy = *win->gpu;
|
|
||||||
for(i = 0; i < 192; ++i)
|
for(i = 0; i < 192; ++i)
|
||||||
{
|
{
|
||||||
copy.SpriteRenderDebug(i, (u16*)(bitmap + i*256), bitmap_alpha + i*256, type + i*256, prio + i*256);
|
win->gpu->SpriteRenderDebug(i, (u16*)(bitmap + i*256));
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 width = dimm_int[(oam->attr1>>14)][(oam->attr0>>14)][0];
|
u32 width = dimm_int[(oam->attr1>>14)][(oam->attr0>>14)][0];
|
||||||
|
|
Loading…
Reference in New Issue