Remove min/max swapinterval from Display. Get from Renderer if needed.

Trac #21810 Signed-off-by: Nicolas Capens Also have the Surface explicitly hang onto the Renderer git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1353 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 21cfaef3
......@@ -59,8 +59,6 @@ egl::Display *Display::getDisplay(EGLNativeDisplayType displayId)
Display::Display(EGLNativeDisplayType displayId, HDC deviceContext, bool software) : mDc(deviceContext)
{
mMinSwapInterval = 1;
mMaxSwapInterval = 1;
mSoftwareDevice = software;
mDisplayId = displayId;
mRenderer = NULL;
......@@ -110,16 +108,18 @@ bool Display::initialize()
return error(status, false);
}
mMinSwapInterval = mRenderer->getMinSwapInterval();
mMaxSwapInterval = mRenderer->getMaxSwapInterval();
EGLint minSwapInterval = mRenderer->getMinSwapInterval();
EGLint maxSwapInterval = mRenderer->getMaxSwapInterval();
EGLint maxTextureWidth = mRenderer->getMaxTextureWidth();
EGLint maxTextureHeight = mRenderer->getMaxTextureHeight();
renderer::ConfigDesc *descList;
int numConfigs = mRenderer->generateConfigs(&descList);
ConfigSet configSet;
for (int i = 0; i < numConfigs; ++i)
configSet.add(descList[i], mMinSwapInterval, mMaxSwapInterval,
mRenderer->getMaxTextureWidth(), mRenderer->getMaxTextureHeight());
configSet.add(descList[i], minSwapInterval, maxSwapInterval,
maxTextureWidth, maxTextureHeight);
// Give the sorted configs a unique ID and store them internally
EGLint index = 1;
......@@ -490,16 +490,6 @@ bool Display::hasExistingWindowSurface(HWND window)
return false;
}
EGLint Display::getMinSwapInterval()
{
return mMinSwapInterval;
}
EGLint Display::getMaxSwapInterval()
{
return mMaxSwapInterval;
}
void Display::initExtensionString()
{
HMODULE swiftShader = GetModuleHandle(TEXT("swiftshader_d3d9.dll"));
......
......@@ -54,9 +54,6 @@ class Display
bool isValidSurface(egl::Surface *surface);
bool hasExistingWindowSurface(HWND window);
EGLint getMinSwapInterval();
EGLint getMaxSwapInterval();
renderer::Renderer *getRenderer() { return mRenderer; };
virtual void notifyDeviceLost();
......@@ -73,8 +70,6 @@ class Display
EGLNativeDisplayType mDisplayId;
const HDC mDc;
EGLint mMaxSwapInterval;
EGLint mMinSwapInterval;
bool mSoftwareDevice;
typedef std::set<Surface*> SurfaceSet;
......
......@@ -27,6 +27,7 @@ namespace egl
Surface::Surface(Display *display, const Config *config, HWND window, EGLint postSubBufferSupported)
: mDisplay(display), mConfig(config), mWindow(window), mPostSubBufferSupported(postSubBufferSupported)
{
mRenderer = mDisplay->getRenderer();
mSwapChain = NULL;
mShareHandle = NULL;
mTexture = NULL;
......@@ -47,6 +48,7 @@ Surface::Surface(Display *display, const Config *config, HWND window, EGLint pos
Surface::Surface(Display *display, const Config *config, HANDLE shareHandle, EGLint width, EGLint height, EGLenum textureFormat, EGLenum textureType)
: mDisplay(display), mWindow(NULL), mConfig(config), mShareHandle(shareHandle), mWidth(width), mHeight(height), mPostSubBufferSupported(EGL_FALSE)
{
mRenderer = mDisplay->getRenderer();
mSwapChain = NULL;
mWindowSubclassed = false;
mTexture = NULL;
......@@ -132,7 +134,7 @@ bool Surface::resetSwapChain()
height = mHeight;
}
mSwapChain = glCreateSwapChain(mDisplay->getRenderer(), mWindow, mShareHandle,
mSwapChain = glCreateSwapChain(mRenderer, mWindow, mShareHandle,
mConfig->mRenderTargetFormat, mConfig->mDepthStencilFormat);
if (!mSwapChain)
{
......@@ -358,8 +360,8 @@ void Surface::setSwapInterval(EGLint interval)
}
mSwapInterval = interval;
mSwapInterval = std::max(mSwapInterval, mDisplay->getMinSwapInterval());
mSwapInterval = std::min(mSwapInterval, mDisplay->getMaxSwapInterval());
mSwapInterval = std::max(mSwapInterval, mRenderer->getMinSwapInterval());
mSwapInterval = std::min(mSwapInterval, mRenderer->getMaxSwapInterval());
mSwapIntervalDirty = true;
}
......
......@@ -22,6 +22,7 @@ class Texture2D;
}
namespace renderer
{
class Renderer;
class SwapChain;
}
......@@ -67,6 +68,7 @@ private:
DISALLOW_COPY_AND_ASSIGN(Surface);
Display *const mDisplay;
renderer::Renderer *mRenderer;
HANDLE mShareHandle;
renderer::SwapChain *mSwapChain;
......
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