When NONPOW2CONDITIONAL is set, limit NPOTs to a single level.

TRAC #12250

Signed-off-by: Nicolas Capens
Signed-off-by: Daniel Koch

Author:    Andrew Lewycky

git-svn-id: https://angleproject.googlecode.com/svn/trunk@283 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp
index 6789c7f..10213da 100644
--- a/src/libGLESv2/Context.cpp
+++ b/src/libGLESv2/Context.cpp
@@ -214,12 +214,28 @@
 {
     IDirect3DDevice9 *device = display->getDevice();
 
-    if (!mBufferBackEnd)
+    if (!mHasBeenCurrent)
     {
+        device->GetDeviceCaps(&mDeviceCaps);
+
         mBufferBackEnd = new Dx9BackEnd(device);
         mVertexDataManager = new VertexDataManager(this, mBufferBackEnd);
         mIndexDataManager = new IndexDataManager(this, mBufferBackEnd);
         mBlit = new Blit(this);
+
+        initExtensionString();
+
+        mState.viewportX = 0;
+        mState.viewportY = 0;
+        mState.viewportWidth = surface->getWidth();
+        mState.viewportHeight = surface->getHeight();
+
+        mState.scissorX = 0;
+        mState.scissorY = 0;
+        mState.scissorWidth = surface->getWidth();
+        mState.scissorHeight = surface->getHeight();
+
+        mHasBeenCurrent = true;
     }
 
     // Wrap the existing Direct3D 9 resources into GL objects and assign them to the '0' names
@@ -240,23 +256,6 @@
     framebufferZero->setDepthbuffer(GL_RENDERBUFFER, 0);
     framebufferZero->setStencilbuffer(GL_RENDERBUFFER, 0);
 
-    if (!mHasBeenCurrent)
-    {
-        initExtensionString();
-
-        mState.viewportX = 0;
-        mState.viewportY = 0;
-        mState.viewportWidth = surface->getWidth();
-        mState.viewportHeight = surface->getHeight();
-
-        mState.scissorX = 0;
-        mState.scissorY = 0;
-        mState.scissorWidth = surface->getWidth();
-        mState.scissorHeight = surface->getHeight();
-
-        mHasBeenCurrent = true;
-    }
-
     defaultRenderTarget->Release();
 
     if (depthStencil)