Commit 7622b96a by Alexis Hetu Committed by Alexis Hétu

Allow Blitter::fastClear to directly write to external buffer

When the external buffer is the one that is dirty, avoid a useless copy from external to internal before fast clearing the buffer by clearing the external buffer directly. Change-Id: I469243ba8a2b8617f9a0f8b6e2a089f667b8ae63 Reviewed-on: https://swiftshader-review.googlesource.com/18033Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 53e83aa8
......@@ -99,7 +99,8 @@ namespace sw
return false;
}
uint8_t *slice = (uint8_t*)dest->lockInternal(dRect.x0, dRect.y0, dRect.slice, sw::LOCK_WRITEONLY, sw::PUBLIC);
bool useDestInternal = !dest->isExternalDirty();
uint8_t *slice = (uint8_t*)dest->lock(dRect.x0, dRect.y0, dRect.slice, sw::LOCK_WRITEONLY, sw::PUBLIC, useDestInternal);
for(int j = 0; j < dest->getSamples(); j++)
{
......@@ -111,24 +112,24 @@ namespace sw
for(int i = dRect.y0; i < dRect.y1; i++)
{
sw::clear((uint16_t*)d, packed, dRect.x1 - dRect.x0);
d += dest->getInternalPitchB();
d += dest->getPitchB(useDestInternal);
}
break;
case 4:
for(int i = dRect.y0; i < dRect.y1; i++)
{
sw::clear((uint32_t*)d, packed, dRect.x1 - dRect.x0);
d += dest->getInternalPitchB();
d += dest->getPitchB(useDestInternal);
}
break;
default:
assert(false);
}
slice += dest->getInternalSliceB();
slice += dest->getSliceB(useDestInternal);
}
dest->unlockInternal();
dest->unlock(useDestInternal);
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment