gsdx hw: OI_GSMemClear supports various frame formats

Could help #1267
This commit is contained in:
Gregory Hainaut 2016-03-28 10:43:34 +02:00
parent 587c0ea339
commit f6ee94589f
1 changed files with 38 additions and 7 deletions

View File

@ -766,6 +766,9 @@ void GSRendererHW::OI_GsMemClear()
GSOffset* off = m_context->offset.fb; GSOffset* off = m_context->offset.fb;
GSVector4i r = GSVector4i(m_vt.m_min.p.xyxy(m_vt.m_max.p)).rintersect(GSVector4i(m_context->scissor.in)); GSVector4i r = GSVector4i(m_vt.m_min.p.xyxy(m_vt.m_max.p)).rintersect(GSVector4i(m_context->scissor.in));
int format = GSLocalMemory::m_psm[m_context->FRAME.PSM].fmt;
if (format == 0) {
// Based on WritePixel32 // Based on WritePixel32
for(int y = r.top; y < r.bottom; y++) for(int y = r.top; y < r.bottom; y++)
{ {
@ -777,6 +780,34 @@ void GSRendererHW::OI_GsMemClear()
d[col[x]] = 0; // Here the constant color d[col[x]] = 0; // Here the constant color
} }
} }
} else if (format == 1) {
// Based on WritePixel24
for(int y = r.top; y < r.bottom; y++)
{
uint32* RESTRICT d = &m_mem.m_vm32[off->pixel.row[y]];
int* RESTRICT col = off->pixel.col[0];
for(int x = r.left; x < r.right; x++)
{
d[col[x]] &= 0xff000000; // Clear the color
}
}
} else if (format == 2) {
; // Hack is used for FMV which are likely 24/32 bits. Let's keep the for reference
#if 0
// Based on WritePixel16
for(int y = r.top; y < r.bottom; y++)
{
uint32* RESTRICT d = &m_mem.m_vm16[off->pixel.row[y]];
int* RESTRICT col = off->pixel.col[0];
for(int x = r.left; x < r.right; x++)
{
d[col[x]] = 0; // Here the constant color
}
}
#endif
}
} }
} }