Fix non-multisampled line rasterization.

#23334
Signed-off-by: Geoff Lang
Signed-off-by: Shannon Woods
Author: Nicolas Capens
diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp
index 70add35..007e9f3 100644
--- a/src/libGLESv2/Context.cpp
+++ b/src/libGLESv2/Context.cpp
@@ -63,6 +63,7 @@
     mState.rasterizer.polygonOffsetFactor = 0.0f;
     mState.rasterizer.polygonOffsetUnits = 0.0f;
     mState.rasterizer.pointDrawMode = false;
+    mState.rasterizer.multiSample = false;
     mState.scissorTest = false;
     mState.scissor.x = 0;
     mState.scissor.y = 0;
@@ -1991,7 +1992,11 @@
 // Applies the fixed-function state (culling, depth test, alpha blending, stenciling, etc) to the Direct3D 9 device
 void Context::applyState(GLenum drawMode)
 {
+    Framebuffer *framebufferObject = getDrawFramebuffer();
+    int samples = framebufferObject->getSamples();
+
     mState.rasterizer.pointDrawMode = (drawMode == GL_POINTS);
+    mState.rasterizer.multiSample = (samples != 0);
     mRenderer->setRasterizerState(mState.rasterizer);
 
     unsigned int mask = 0;
@@ -1999,10 +2004,10 @@
     {
         if (mState.sampleCoverageValue != 0)
         {
-            Framebuffer *framebufferObject = getDrawFramebuffer();
+            
             float threshold = 0.5f;
 
-            for (int i = 0; i < framebufferObject->getSamples(); ++i)
+            for (int i = 0; i < samples; ++i)
             {
                 mask <<= 1;
 
diff --git a/src/libGLESv2/angletypes.h b/src/libGLESv2/angletypes.h
index ac15290..d2bf87e 100644
--- a/src/libGLESv2/angletypes.h
+++ b/src/libGLESv2/angletypes.h
@@ -1,5 +1,5 @@
 //
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
@@ -66,6 +66,7 @@
     GLfloat polygonOffsetUnits;
 
     bool pointDrawMode;
+    bool multiSample;
 };
 
 struct BlendState
diff --git a/src/libGLESv2/renderer/RenderStateCache.cpp b/src/libGLESv2/renderer/RenderStateCache.cpp
index 172f018..970f379 100644
--- a/src/libGLESv2/renderer/RenderStateCache.cpp
+++ b/src/libGLESv2/renderer/RenderStateCache.cpp
@@ -231,7 +231,7 @@
         rasterDesc.SlopeScaledDepthBias = rasterState.polygonOffsetFactor;
         rasterDesc.DepthClipEnable = TRUE;
         rasterDesc.ScissorEnable = scissorEnabled ? TRUE : FALSE;
-        rasterDesc.MultisampleEnable = TRUE;
+        rasterDesc.MultisampleEnable = rasterState.multiSample;
         rasterDesc.AntialiasedLineEnable = FALSE;
 
         ID3D11RasterizerState *dx11RasterizerState = NULL;