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