Commit ab3241d8 by Alexis Hetu Committed by Alexis Hétu

Fixed color clear on multisampled rendertargets

Only the 1st sample's buffer of multisampled buffers was getting cleared instead of clearing all the samples' buffers, which led to incorrect results. Added a loop to fix the behavior. Change-Id: If22ebf2df61ae6afbc4c2975a9baee3c18a2492b Reviewed-on: https://swiftshader-review.googlesource.com/4910Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 05b3d665
...@@ -201,7 +201,11 @@ namespace es2 ...@@ -201,7 +201,11 @@ namespace es2
sw::SliceRect sliceRect; sw::SliceRect sliceRect;
if(renderTarget[i]->getClearRect(x0, y0, width, height, sliceRect)) if(renderTarget[i]->getClearRect(x0, y0, width, height, sliceRect))
{ {
clear(rgba, FORMAT_A32B32G32R32F, renderTarget[i], sliceRect, rgbaMask); int depth = renderTarget[i]->getDepth();
for(sliceRect.slice = 0; sliceRect.slice < depth; ++sliceRect.slice)
{
clear(rgba, FORMAT_A32B32G32R32F, renderTarget[i], sliceRect, rgbaMask);
}
} }
} }
} }
......
...@@ -32,7 +32,9 @@ namespace sw ...@@ -32,7 +32,9 @@ namespace sw
{ {
sw::Surface color(1, 1, 1, format, pixel, sw::Surface::bytes(format), sw::Surface::bytes(format)); sw::Surface color(1, 1, 1, format, pixel, sw::Surface::bytes(format), sw::Surface::bytes(format));
Blitter::Options clearOptions = static_cast<sw::Blitter::Options>((rgbaMask & 0xF) | CLEAR_OPERATION); Blitter::Options clearOptions = static_cast<sw::Blitter::Options>((rgbaMask & 0xF) | CLEAR_OPERATION);
blit(&color, dRect, dest, dRect, clearOptions); SliceRect sRect(dRect);
sRect.slice = 0;
blit(&color, sRect, dest, dRect, clearOptions);
} }
void Blitter::blit(Surface *source, const SliceRect &sRect, Surface *dest, const SliceRect &dRect, bool filter) void Blitter::blit(Surface *source, const SliceRect &sRect, Surface *dest, const SliceRect &dRect, bool filter)
......
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