Commit d6e903bd by Alexis Hetu Committed by Alexis Hétu

Support multisampled Bresenham lines

Multisampled Bresenham lines must be rendered the same way as non multisampled Bresenham lines, so use the same coverage mask for all samples in that case. Bug: b/142965928 Change-Id: Ifc0e141e4f1d9ae48c064896405164db3addd521 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/38788 Presubmit-Ready: Alexis Hétu <sugoi@google.com> Reviewed-by: 's avatarChris Forbes <chrisforbes@google.com> Tested-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 8a6dcf76
...@@ -192,6 +192,8 @@ namespace sw ...@@ -192,6 +192,8 @@ namespace sw
state.multiSample = static_cast<unsigned int>(context->sampleCount); state.multiSample = static_cast<unsigned int>(context->sampleCount);
state.multiSampleMask = context->multiSampleMask; state.multiSampleMask = context->multiSampleMask;
state.multiSampledBresenham = (state.multiSample > 1) && context->isDrawLine(true) &&
(context->lineRasterizationMode == VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT);
if(state.multiSample > 1 && context->pixelShader) if(state.multiSample > 1 && context->pixelShader)
{ {
......
...@@ -81,6 +81,7 @@ namespace sw ...@@ -81,6 +81,7 @@ namespace sw
VkFormat targetFormat[RENDERTARGETS]; VkFormat targetFormat[RENDERTARGETS];
unsigned int multiSample; unsigned int multiSample;
unsigned int multiSampleMask; unsigned int multiSampleMask;
bool multiSampledBresenham;
bool alphaToCoverage; bool alphaToCoverage;
bool centroid; bool centroid;
VkFrontFace frontFace; VkFrontFace frontFace;
......
...@@ -180,7 +180,8 @@ namespace sw ...@@ -180,7 +180,8 @@ namespace sw
{ {
if (state.multiSampleMask & (1<<q)) if (state.multiSampleMask & (1<<q))
{ {
Short4 mask = CmpGT(xxxx, xLeft[q]) & CmpGT(xRight[q], xxxx); unsigned int i = state.multiSampledBresenham ? 0 : q;
Short4 mask = CmpGT(xxxx, xLeft[i]) & CmpGT(xRight[i], xxxx);
cMask[q] = SignMask(PackSigned(mask, mask)) & 0x0000000F; cMask[q] = SignMask(PackSigned(mask, mask)) & 0x0000000F;
} }
else else
......
...@@ -814,14 +814,7 @@ namespace sw ...@@ -814,14 +814,7 @@ namespace sw
return false; return false;
} }
// We use rectangular lines for non-Bresenham lines (cf. 'strictLines'), if(draw.lineRasterizationMode != VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT)
// and for Bresenham lines when multiSampling is enabled.
// FIXME(b/142965928): Bresenham lines should render the same with or without
// multisampling, which will require a special case in the
// code when multisampling is on. For now, we just use
// rectangular lines when multisampling is enabled.
if((draw.setupState.multiSample > 1) ||
(draw.lineRasterizationMode != VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT))
{ {
// Rectangle centered on the line segment // Rectangle centered on the line segment
......
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