Minimize BeginScene / EndScene calls
TRAC #12139
Signed-off-by: Shannon Woods
Signed-off-by: Daniel Koch
Author: Nicolas Capens
git-svn-id: https://angleproject.googlecode.com/svn/trunk@231 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libEGL/Display.cpp b/src/libEGL/Display.cpp
index 2eedcde..4d69167 100644
--- a/src/libEGL/Display.cpp
+++ b/src/libEGL/Display.cpp
@@ -26,6 +26,8 @@
mAdapter = D3DADAPTER_DEFAULT;
mDeviceType = D3DDEVTYPE_HAL;
+
+ mSceneStarted = false;
}
Display::~Display()
@@ -166,6 +168,26 @@
}
}
+void Display::startScene()
+{
+ if (!mSceneStarted)
+ {
+ long result = mDevice->BeginScene();
+ ASSERT(SUCCEEDED(result));
+ mSceneStarted = true;
+ }
+}
+
+void Display::endScene()
+{
+ if (mSceneStarted)
+ {
+ long result = mDevice->EndScene();
+ ASSERT(SUCCEEDED(result));
+ mSceneStarted = false;
+ }
+}
+
bool Display::getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig)
{
return mConfigSet.getConfigs(configs, attribList, configSize, numConfig);
@@ -323,7 +345,7 @@
if (swapChain)
{
- surface = new Surface(mDevice, swapChain, depthStencilSurface, configuration->mConfigID);
+ surface = new Surface(this, swapChain, depthStencilSurface, configuration->mConfigID);
mSurfaceSet.insert(surface);
swapChain->Release();