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
diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp
index 672c91b..71e8f9b 100644
--- a/src/libGLESv2/Context.cpp
+++ b/src/libGLESv2/Context.cpp
@@ -1896,39 +1896,46 @@
mPolygonOffsetStateDirty = false;
}
- if (framebufferObject->isMultisample() && mSampleStateDirty)
+ if (mSampleStateDirty)
{
- if (mState.sampleAlphaToCoverage)
+ if (framebufferObject->isMultisample())
{
- FIXME("Sample alpha to coverage is unimplemented.");
- }
-
- if (mState.sampleCoverage)
- {
- device->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, TRUE);
- unsigned int mask = 0;
- if (mState.sampleCoverageValue != 0)
+ if (mState.sampleAlphaToCoverage)
{
- float threshold = 0.5f;
+ FIXME("Sample alpha to coverage is unimplemented.");
+ }
- for (int i = 0; i < framebufferObject->getSamples(); ++i)
+ device->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, TRUE);
+ if (mState.sampleCoverage)
+ {
+ unsigned int mask = 0;
+ if (mState.sampleCoverageValue != 0)
{
- 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;
- }
+
+ if (mState.sampleCoverageInvert)
+ {
+ mask = ~mask;
+ }
- device->SetRenderState(D3DRS_MULTISAMPLEMASK, mask);
+ device->SetRenderState(D3DRS_MULTISAMPLEMASK, mask);
+ }
+ else
+ {
+ device->SetRenderState(D3DRS_MULTISAMPLEMASK, 0xFFFFFFFF);
+ }
}
else
{