Commit 10547589 by Chris Forbes

Use sample count from multisample state, not from attachment 0

Color attachment 0 (or any color attachments!) may not exist; rasterizer behavior is supposed to be completely independent of this. Bug: b/126417154 Change-Id: If16307a7964c267af254e2a62822ac38cf58c48c Reviewed-on: https://swiftshader-review.googlesource.com/c/25809Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Tested-by: 's avatarChris Forbes <chrisforbes@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
parent bc63cf9c
......@@ -713,11 +713,6 @@ namespace sw
return true;
}
int Context::getMultiSampleCount() const
{
return renderTarget[0] ? renderTarget[0]->getSampleCount() : 1;
}
VkFormat Context::renderTargetInternalFormat(int index)
{
if(renderTarget[index])
......
......@@ -158,8 +158,6 @@ namespace sw
VkLogicOp colorLogicOp();
int getMultiSampleCount() const;
DrawType drawType;
bool stencilEnable;
......@@ -234,6 +232,7 @@ namespace sw
bool writeSRGB;
unsigned int sampleMask;
unsigned int multiSampleMask;
int sampleCount;
bool colorLogicOpEnabled;
VkLogicOp logicalOperation;
......
......@@ -382,7 +382,7 @@ namespace sw
if(context->alphaTestActive())
{
state.transparencyAntialiasing = context->getMultiSampleCount() > 1 ? transparencyAntialiasing : TRANSPARENCY_NONE;
state.transparencyAntialiasing = context->sampleCount > 1 ? transparencyAntialiasing : TRANSPARENCY_NONE;
}
state.depthWriteEnable = context->depthWriteActive();
......@@ -440,7 +440,7 @@ namespace sw
}
state.writeSRGB = context->writeSRGB && context->renderTarget[0] && Surface::isSRGBwritable(context->renderTarget[0]->getFormat());
state.multiSample = context->getMultiSampleCount();
state.multiSample = context->sampleCount;
state.multiSampleMask = context->multiSampleMask;
if(state.multiSample > 1 && context->pixelShader)
......
......@@ -224,7 +224,7 @@ namespace sw
updateConfiguration();
int ms = context->getMultiSampleCount();
int ms = context->sampleCount;
unsigned int oldMultiSampleMask = context->multiSampleMask;
context->multiSampleMask = context->sampleMask & ((unsigned)0xFFFFFFFF >> (32 - ms));
......
......@@ -88,7 +88,7 @@ namespace sw
state.slopeDepthBias = context->slopeDepthBias != 0.0f;
state.vFace = context->pixelShader && context->pixelShader->hasBuiltinInput(spv::BuiltInFrontFacing);
state.multiSample = context->getMultiSampleCount();
state.multiSample = context->sampleCount;
state.rasterizerDiscard = context->rasterizerDiscard;
for (int interpolant = 0; interpolant < MAX_INTERFACE_COMPONENTS; interpolant++)
......
......@@ -294,8 +294,18 @@ GraphicsPipeline::GraphicsPipeline(const VkGraphicsPipelineCreateInfo* pCreateIn
const VkPipelineMultisampleStateCreateInfo* multisampleState = pCreateInfo->pMultisampleState;
if(multisampleState)
{
switch (multisampleState->rasterizationSamples) {
case VK_SAMPLE_COUNT_1_BIT:
context.sampleCount = 1;
break;
case VK_SAMPLE_COUNT_4_BIT:
context.sampleCount = 4;
break;
default:
UNIMPLEMENTED("Unsupported sample count");
}
if((multisampleState->flags != 0) ||
(multisampleState->rasterizationSamples != VK_SAMPLE_COUNT_1_BIT) ||
(multisampleState->sampleShadingEnable != 0) ||
!((multisampleState->pSampleMask == nullptr) ||
(*(multisampleState->pSampleMask) == 0xFFFFFFFFu)) ||
......@@ -305,6 +315,10 @@ GraphicsPipeline::GraphicsPipeline(const VkGraphicsPipelineCreateInfo* pCreateIn
UNIMPLEMENTED();
}
}
else
{
context.sampleCount = 1;
}
const VkPipelineDepthStencilStateCreateInfo* depthStencilState = pCreateInfo->pDepthStencilState;
if(depthStencilState)
......
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