Only libGLESv2 was clearing all the samples of a multisample buffer.
Since all known APIs always clear all the samples, this could be
handled in the Renderer.
Bug swiftshader:77
Change-Id: Ib9adc3c61d263420ed0a0ae4828a693bd360b076
Reviewed-on: https://swiftshader-review.googlesource.com/10788
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
for(unsigned int i = 0; i < count; i++)
{
- sw::SliceRect clearRect(rects[i].x1, rects[i].y1, rects[i].x2, rects[i].y2, 0);
+ sw::Rect clearRect(rects[i].x1, rects[i].y1, rects[i].x2, rects[i].y2);
clearRect.clip(viewport.X, viewport.Y, viewport.X + viewport.Width, viewport.Y + viewport.Height);
for(unsigned int i = 0; i < count; i++)
{
- sw::SliceRect clearRect(rects[i].x1, rects[i].y1, rects[i].x2, rects[i].y2, 0);
+ sw::Rect clearRect(rects[i].x1, rects[i].y1, rects[i].x2, rects[i].y2);
clearRect.clip(viewport.X, viewport.Y, viewport.X + viewport.Width, viewport.Y + viewport.Height);
return;
}
- sw::SliceRect clearRect = renderTarget->getRect();
+ sw::Rect clearRect = renderTarget->getRect();
if(scissorEnable)
{
}
z = clamp01(z);
- sw::SliceRect clearRect = depthStencil->getRect();
+ sw::Rect clearRect = depthStencil->getRect();
if(scissorEnable)
{
return;
}
- sw::SliceRect clearRect = depthStencil->getRect();
+ sw::Rect clearRect = depthStencil->getRect();
if(scissorEnable)
{
rgba[2] = blue;
rgba[3] = alpha;
- sw::SliceRect clearRect = renderTarget->getRect();
+ sw::Rect clearRect = renderTarget->getRect();
if(scissorEnable)
{
}
z = clamp01(z);
- sw::SliceRect clearRect = depthBuffer->getRect();
+ sw::Rect clearRect = depthBuffer->getRect();
if(scissorEnable)
{
return;
}
- sw::SliceRect clearRect = stencilBuffer->getRect();
+ sw::Rect clearRect = stencilBuffer->getRect();
if(scissorEnable)
{
if(colorbuffer)
{
- sw::SliceRect clearRect = colorbuffer->getRect();
+ sw::Rect clearRect = colorbuffer->getRect();
if(mState.scissorTestEnabled)
{
if(depthbuffer)
{
float depth = clamp01(value);
- sw::SliceRect clearRect = depthbuffer->getRect();
+ sw::Rect clearRect = depthbuffer->getRect();
if(mState.scissorTestEnabled)
{
if(stencilbuffer)
{
unsigned char stencil = value < 0 ? 0 : static_cast<unsigned char>(value & 0x000000FF);
- sw::SliceRect clearRect = stencilbuffer->getRect();
+ sw::Rect clearRect = stencilbuffer->getRect();
if(mState.scissorTestEnabled)
{
{
if(renderTarget[i])
{
- sw::SliceRect clearRect = renderTarget[i]->getRect();
+ sw::Rect clearRect = renderTarget[i]->getRect();
if(scissorEnable)
{
clearRect.clip(scissorRect.x0, scissorRect.y0, scissorRect.x1, scissorRect.y1);
}
- int depth = sw::max(renderTarget[i]->getDepth(), 1);
- for(clearRect.slice = 0; clearRect.slice < depth; clearRect.slice++)
- {
- clear(rgba, FORMAT_A32B32G32R32F, renderTarget[i], clearRect, rgbaMask);
- }
+ clear(rgba, FORMAT_A32B32G32R32F, renderTarget[i], clearRect, rgbaMask);
}
}
}
}
z = clamp01(z);
- sw::SliceRect clearRect = depthBuffer->getRect();
+ sw::Rect clearRect = depthBuffer->getRect();
if(scissorEnable)
{
return;
}
- sw::SliceRect clearRect = stencilBuffer->getRect();
+ sw::Rect clearRect = stencilBuffer->getRect();
if(scissorEnable)
{
}
}
- void Renderer::clear(void *pixel, Format format, Surface *dest, const SliceRect &dRect, unsigned int rgbaMask)
+ void Renderer::clear(void *value, Format format, Surface *dest, const Rect &clearRect, unsigned int rgbaMask)
{
- blitter->clear(pixel, format, dest, dRect, rgbaMask);
+ SliceRect rect = clearRect;
+ int samples = dest->getDepth();
+
+ for(rect.slice = 0; rect.slice < samples; rect.slice++)
+ {
+ blitter->clear(value, format, dest, rect, rgbaMask);
+ }
}
void Renderer::blit(Surface *source, const SliceRect &sRect, Surface *dest, const SliceRect &dRect, bool filter, bool isStencil)
void draw(DrawType drawType, unsigned int indexOffset, unsigned int count, bool update = true);
- void clear(void* pixel, Format format, Surface *dest, const SliceRect &dRect, unsigned int rgbaMask);
+ void clear(void *value, Format format, Surface *dest, const Rect &rect, unsigned int rgbaMask);
void blit(Surface *source, const SliceRect &sRect, Surface *dest, const SliceRect &dRect, bool filter, bool isStencil = false);
void blit3D(Surface *source, Surface *dest);
resource->unlock();
}
- bool Surface::isEntire(const SliceRect& rect) const
+ bool Surface::isEntire(const Rect& rect) const
{
return (rect.x0 == 0 && rect.y0 == 0 && rect.x1 == internal.width && rect.y1 == internal.height && internal.depth == 1);
}
- SliceRect Surface::getRect() const
+ Rect Surface::getRect() const
{
- return SliceRect(0, 0, internal.width, internal.height, 0);
+ return Rect(0, 0, internal.width, internal.height);
}
void Surface::clearDepth(float depth, int x0, int y0, int width, int height)
inline int getMultiSampleCount() const;
inline int getSuperSampleCount() const;
- bool isEntire(const SliceRect& rect) const;
- SliceRect getRect() const;
+ bool isEntire(const Rect& rect) const;
+ Rect getRect() const;
void clearDepth(float depth, int x0, int y0, int width, int height);
void clearStencil(unsigned char stencil, unsigned char mask, int x0, int y0, int width, int height);
void fill(const Color<float> &color, int x0, int y0, int width, int height);