Commit c5f8dea4 by enne@chromium.org

Allow multisampling without enabling GL_SAMPLE_COVERAGE.

This setting is only used when an application wants to control which samples are written to. If it is disabled, multisampling should just write to all samples. BUG=38 Review URL: http://codereview.appspot.com/2194043 git-svn-id: https://angleproject.googlecode.com/svn/trunk@431 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 0fa74639
...@@ -1896,39 +1896,46 @@ void Context::applyState(GLenum drawMode) ...@@ -1896,39 +1896,46 @@ void Context::applyState(GLenum drawMode)
mPolygonOffsetStateDirty = false; mPolygonOffsetStateDirty = false;
} }
if (framebufferObject->isMultisample() && mSampleStateDirty) if (mSampleStateDirty)
{ {
if (mState.sampleAlphaToCoverage) if (framebufferObject->isMultisample())
{ {
FIXME("Sample alpha to coverage is unimplemented."); if (mState.sampleAlphaToCoverage)
} {
FIXME("Sample alpha to coverage is unimplemented.");
}
if (mState.sampleCoverage)
{
device->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, TRUE); device->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, TRUE);
unsigned int mask = 0; if (mState.sampleCoverage)
if (mState.sampleCoverageValue != 0)
{ {
float threshold = 0.5f; unsigned int mask = 0;
if (mState.sampleCoverageValue != 0)
for (int i = 0; i < framebufferObject->getSamples(); ++i)
{ {
mask <<= 1; float threshold = 0.5f;
if ((i + 1) * mState.sampleCoverageValue >= threshold) for (int i = 0; i < framebufferObject->getSamples(); ++i)
{ {
threshold += 1.0f; mask <<= 1;
mask |= 1;
if ((i + 1) * mState.sampleCoverageValue >= threshold)
{
threshold += 1.0f;
mask |= 1;
}
} }
} }
if (mState.sampleCoverageInvert)
{
mask = ~mask;
}
device->SetRenderState(D3DRS_MULTISAMPLEMASK, mask);
} }
else
if (mState.sampleCoverageInvert)
{ {
mask = ~mask; device->SetRenderState(D3DRS_MULTISAMPLEMASK, 0xFFFFFFFF);
} }
device->SetRenderState(D3DRS_MULTISAMPLEMASK, mask);
} }
else else
{ {
......
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