📄 blt.cpp
字号:
{
DEBUGMSG(0,(TEXT("GxVideo::Blt - Color SRCCOPY > BB0\n")));
}
#endif
}
//Handle Color Translations Here
else if ((pBltParms->pLookup) && (
(format == gpe1Bpp) ||
(format == gpe2Bpp) ||
(format == gpe4Bpp) ||
(format == gpe8Bpp)))
{
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *))AcceleratedBitmapScreenLookupBlt;
return S_OK;
}
//Handle Color Translations Here
else if ((pBltParms->pConvert) &&
(format == gpe24Bpp))
{
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *))AcceleratedBitmapScreenLookupBlt;
return S_OK;
}
#if CHEACK_ALL
else
{
DEBUGMSG(0,(TEXT("GxVideo::Blt - Color SRCCOPY != 8/16\n")));
}
#endif
}
}
break;
case 0xAAF0:
// CHECK IF SOLID COLOR
// No hardware acceleration otherwise.
if( pBltParms->solidColor != -1 )
{
// CHECK IF GLYPH DATA IS MONOCHROME
// No hardware acceleration otherwise.
if (pBltParms->pMask->Format() == gpe1Bpp)
{
// NORMAL TRANSPARENT TEXT
DEBUGMSG(0,(TEXT("GxVideo::Blt - 0xAAF0\n")));
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *))AcceleratedTextBlt;
return S_OK;
}
#if CHEACK_ALL
else
{
// ANTI-ALIASED TEXT
// No hardware acceleration.
DEBUGMSG(0,(TEXT("GxVideo::Blt - 0xAAF0 alpha\n")));
break;
}
#endif
}
#if CHEACK_ALL
else
{
DEBUGMSG(0,(TEXT("GxVideo::Blt - 0xAAF0 ! solidColor \n")));
//pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *))AcceleratedRedFill; //SAS
break;
}
#endif
break;
case 0xCCAA:
// CHECK IF VIDEO MEMORY IS THE SOURCE
DEBUGMSG(0,(TEXT("GxVideo::Blt - MaskCOPY Not Handled\n")));
// SCREEN TO SCREEN BLT
// Can't perform color translations in hardware.
if (pBltParms->pLookup || pBltParms->pConvert) break;
if(pBltParms->pSrc->InVideoMemory())
{
// SCREEN TO SCREEN BLT WITH MASK
// Check to see if too large for the BLT buffers. Destination
// data is read into BB1 for the AND mask. Eventually this
// routine should handle splitting the primitive.
if ((pBltParms->prclDst->right - pBltParms->prclDst->left) <= (int) BB0_Size_Pixels)
{
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *))AcceleratedMaskCopyBlt;
return S_OK;
}
}
break;
case 0x5555: // DSTINVERT
DEBUGMSG(0,(TEXT("GxVideo::Blt - DSTINVERT\n")));
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *))AcceleratedFillRectDst;
return S_OK;
case 0xAAAA: // SIMPLY DST
DEBUGMSG(0,(TEXT("GxVideo::Blt - WHITENESS\n")));
return S_OK;
default:
// CHECK IF MASK IS NOT USED
// The mask is not used if the upper byte of the rop4 equals the
// lower byte of the rop4. XOR them together and check if zero.
if ((rop & 0x00FF) == ((rop >> 8) & 0x00FF))
{
// CHECK IF PATTERN DATA ONLY (SOURCE DATA NOT USED)
// Source data is not used in the ROP if bits[1:0] equal
// bits[3:2] and bits[5:4] equal bits[7:6].
if ((rop & 0x33) == ((rop >> 2) & 0x33))
{
// CHECK IF PATTERN DATA OR SOLID COLOR
if( pBltParms->solidColor != -1 )
{
// NORMAL SOLID RECTANGLE FILL
DEBUGMSG(0,(TEXT("GxVideo::Blt - PAT with DST - solid brush\n")));
SelectSolidColor(GetBltSolidColor(pBltParms));
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *))AcceleratedFillRectDst;
return S_OK;
}
else
{
//CHECK TO SEE IF THE POINTER IS VALID
if(!pBltParms->pBrush)
return S_OK;
format = pBltParms->pBrush->Format();
//GX NEEDS ALL THE PATTERN TO BE OF 8x8 PATTERNS ONLY
#if 0
//Currently AcceleratedWxHPatternFill can handle output=pattern only.
//We need to find a mechanism to map all pattern opperations as
//source opperations and fill appropriate rop.
if((pBltParms->pBrush->Width() != 8) ||
(pBltParms->pBrush->Height() != 8))
{
DEBUGMSG(0,(TEXT("GxVideo::Blt - default width/height != 8\n")));
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *))AcceleratedWxHPatternFill;
return S_OK;
}
#endif
DEBUGMSG(0,(TEXT("Pat format2 = %d %X %X %X\n"),
format,pBltParms->pLookup, pBltParms->pConvert, pBltParms->pColorConverter));
if ((((format == gpe8Bpp) && (Display_BPP == 8)) ||
((format == gpe16Bpp) && (Display_BPP == 16))) &&
// CHECK IF COLOR TRANSLATION
(!(pBltParms->pLookup || pBltParms->pConvert)))
{
DEBUGMSG(0,(TEXT("GxVideo::Blt - PAT with DST - color pattern brush\n")));
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *))AcceleratedPatternFill;
return S_OK;
}
//Handle Color Translations Here
else if (pBltParms->pLookup || pBltParms->pConvert || pBltParms->pColorConverter)
{
DEBUGMSG(0,(TEXT("GxVideo::Blt - PATCOPY With Lookup\n")));
//pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *))AcceleratedPatternLookupFill;
return S_OK;
}
else if (format == gpe1Bpp)
{
DEBUGMSG(0,(TEXT("GxVideo::Blt - PAT with DST - mono pattern brush\n")));
}
#if CHEACK_ALL
else
{
DEBUGMSG(0,(TEXT("GxVideo::Blt - default Unknown Pat\n")));
}
#endif
}
}
// CHECK IF SOURCE DATA ONLY (PATTERN DATA NOT USED)
// The pattern is not used in the ROP if the upper nibble
// of the value is equal to the lower nibble of the value.
// (0x11, 0x22, 0x33, 0x44, etc).
else if ((rop & 0x0F) == ((rop >> 4) & 0x0F))
{
format = pBltParms->pSrc->Format();
// CHECK IF TRANSPARENT
#ifndef DURANGO
if (pBltParms->bltFlags & BLT_TRANSPARENT)
return S_OK;
#endif
// CHECK IF MONOCHROME OR COLOR
// Monochrome data can handle color translation.
if (format == gpe1Bpp)
{
// CHECK TO SEE IF TOO LARGE FOR THE BLT BUFFERS
// Eventually, the AcceleratedBitmapScreenBlt routine
// should be able to handle this case (split the
// scanlines as needed). It doesn't yet.
if ((pBltParms->prclDst->right - pBltParms->prclDst->left) <= (int) BB0_Size_Pixels)
{
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *))AcceleratedBitmapScreenBlt;
return S_OK;
}
#if CHEACK_ALL
else
{
DEBUGMSG(0,(TEXT("GxVideo::Blt - Defa mono > BB0\n")));
}
#endif
}
else
{
DEBUGMSG(0,(TEXT("Blt format2 = %d %X %X %X\n"),
format,pBltParms->pLookup, pBltParms->pConvert,pBltParms->pColorConverter));
if ((((format == gpe8Bpp) && (Display_BPP == 8)) ||
((format == gpe16Bpp) && (Display_BPP == 16))) &&
// CHECK FOR NO COLOR TRANSLATION
(!(pBltParms->pLookup || pBltParms->pConvert)))
{
// CHECK TO SEE IF TOO LARGE FOR THE BLT BUFFERS
if ((pBltParms->prclDst->right - pBltParms->prclDst->left) <= (int) BB0_Size_Pixels)
{
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *))AcceleratedBitmapScreenBlt;
return S_OK;
}
#if CHEACK_ALL
else
{
DEBUGMSG(0,(TEXT("GxVideo::Blt - Defa color > BB0\n")));
}
#endif
}
//Handle Color Translations Here
else if ((pBltParms->pLookup) && (
(format == gpe1Bpp) ||
(format == gpe2Bpp) ||
(format == gpe4Bpp) ||
(format == gpe8Bpp)))
{
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *))AcceleratedBitmapScreenLookupBlt;
return S_OK;
}
//Handle Color Translations Here
else if ((pBltParms->pConvert) &&
(format == gpe24Bpp))
{
pBltParms->pBlt = (SCODE (GPE::*)(struct GPEBltParms *))AcceleratedBitmapScreenLookupBlt;
return S_OK;
}
#if CHEACK_ALL
else
{
DEBUGMSG(0,(TEXT("GxVideo::Blt - Defa unsuported Depth\n")));
}
#endif
}
}
#if CHEACK_ALL
else
{
DEBUGMSG(0,(TEXT("GxVideo::Blt - Defa unsuported rop %X\n"),
(rop & 0x0F)));
}
#endif
}
#if CHEACK_ALL
else
{
DEBUGMSG(0,(TEXT("GxVideo::Blt - Default - not handled\n")));
}
#endif
break;
}
#endif // ENABLE_ACCELERATION
return S_OK;
}
//----------------------------------------------------------------------------
// BltComplete
//
// This routine is called after the BLT has been performed. No action is
// required for GX systems.
//----------------------------------------------------------------------------
SCODE GxVideo::BltComplete( GPEBltParms *pBltParms )
{
DEBUGMSG(0,(TEXT("GxVideo::BltComplete\n")));
return S_OK;
}
//----------------------------------------------------------------------------
// AcceleratedFillRect
//
// This routine is called to perform a solid rectangle fill. It should not
// be called when destination data is required for the raster operation.
// (pattern XOR destination) for example. It should only be called for
// PATCOPY, BLACKNESS, and WHITENESS.
//----------------------------------------------------------------------------
SCODE GxVideo::AcceleratedFillRect( GPEBltParms *pBltParms )
{
DEBUGMSG(0,(TEXT("AcceleratedFillRect\n")));
GxVideoSurf *dst = (GxVideoSurf *)(pBltParms->pDst);
int left = dst->Left();
int top = dst->Top();
int x1 = pBltParms->prclDst->left + left;
int y1 = pBltParms->prclDst->top + top;
int x2 = pBltParms->prclDst->right + left;
int y2 = pBltParms->prclDst->bottom + top;
unsigned int width, start_width;//, height;
width = x2 - x1;
#ifdef DURANGO
unsigned int height = y2 - y1;
unsigned short color;
start_width = 0; //for compiler options
// STILL IN THIS ROUTINE
color = (unsigned short)GetBltSolidColor(pBltParms);
gfx_set_solid_pattern(color);
gfx_set_raster_operation((unsigned char) pBltParms->rop4);
gfx_pattern_fill(x1,y1,width,height);
#else
//height = y2 -y1;
// Caller assures a well-ordered, non-empty rect
//ASSERT(width > 0 && height > 0);
// WORKAROUND FOR GXm GRAPHICS PIPELINE BUG
// The one and only graphics pipeline problem came when improving the
// performance of solid rectange fills from GXi to GXm. For this case,
// the graphics pipeline performs burst writes to the memory controller.
// A bug for certain alignment and width values forces this workaround
// in the driver - to render a rectangle on the left side up to 8 pixels
// wide (16 pixels in 8 BPP) to reach a 16 byte boundary (screen relative)
// and then render the remaining part of the rectangle.
// SETUP RECTANGLE PARAMETERS
// Must wait until there is not a primitive pending before writing to
// the registers.
WAIT_PENDING(GXregisters);
WRITE_REG32(GXregisters, GP_DST_XCOOR, (y1 << 16) | x1);
WRITE_REG16(GXregisters, GP_RASTER_MODE, pBltParms->rop4 & 0x00FF);
WRITE_REG16(GXregisters, GP_HEIGHT, y2-y1);//height);
// CHECK IF GXm WORKAROUND IS NEEDED
if (width <= 16)
{
// DRAW SINGLE RECTANGLE
WRITE_REG16(GXregisters, GP_WIDTH, width);
WRITE_REG16(GXregisters, GP_BLIT_MODE, 0);
}
else
{
start_width = 16 - (width & 15);
// DRAW RECTANGLE <= 16 PIXELS
WRITE_REG16(GXregisters, GP_WIDTH, start_width);
WRITE_REG16(GXregisters, GP_BLIT_MODE, 0);
// DRAW REMAINING PART OF RECTANGLE
WAIT_PENDING(GXregisters);
WRITE_REG32(GXregisters, GP_DST_XCOOR, (y1 << 16) | (x1+start_width));
WRITE_REG16(GXregisters, GP_WIDTH, width - start_width);
WRITE_REG16(GXregisters, GP_BLIT_MODE, 0);
}
// For MXi, this function should call the ARC_PATTERN_FILL request.
#endif //hrhr
return S_OK;
}
//----------------------------------------------------------------------------
// AcceleratedFillRectDst
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -