Commit 5d65cd56 by Corentin Wallez

Surface: query swapBehavior from the Impl

All the previously implemented surfaces used to preserve the content of the surface on a swap but this is no longer the case with CGL. BUG=angleproject:891 Change-Id: I264c579bcbbd22b4eeb09e78aa95751d223694fc Reviewed-on: https://chromium-review.googlesource.com/289871Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent afe44c41
......@@ -32,7 +32,7 @@ Surface::Surface(rx::SurfaceImpl *impl, EGLint surfaceType, const egl::Config *c
// FIXME: Determine actual pixel aspect ratio
mPixelAspectRatio(static_cast<EGLint>(1.0 * EGL_DISPLAY_SCALING)),
mRenderBuffer(EGL_BACK_BUFFER),
mSwapBehavior(EGL_BUFFER_PRESERVED)
mSwapBehavior(impl->getSwapBehavior())
{
addRef();
......
......@@ -29,6 +29,7 @@ class MockSurfaceImpl : public rx::SurfaceImpl
MOCK_CONST_METHOD0(getWidth, EGLint());
MOCK_CONST_METHOD0(getHeight, EGLint());
MOCK_CONST_METHOD0(isPostSubBufferSupported, EGLint(void));
MOCK_CONST_METHOD0(getSwapBehavior, EGLint(void));
MOCK_METHOD2(getAttachmentRenderTarget, gl::Error(const gl::FramebufferAttachment::Target &, rx::FramebufferAttachmentRenderTarget **));
MOCK_METHOD0(destroy, void());
......
......@@ -41,6 +41,7 @@ class SurfaceImpl : public FramebufferAttachmentObjectImpl
virtual EGLint getHeight() const = 0;
virtual EGLint isPostSubBufferSupported() const = 0;
virtual EGLint getSwapBehavior() const = 0;
};
}
......
......@@ -295,6 +295,11 @@ EGLint SurfaceD3D::isPostSubBufferSupported() const
return EGL_TRUE;
}
EGLint SurfaceD3D::getSwapBehavior() const
{
return EGL_BUFFER_PRESERVED;
}
egl::Error SurfaceD3D::querySurfacePointerANGLE(EGLint attribute, void **value)
{
if (attribute == EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE)
......
......@@ -45,6 +45,7 @@ class SurfaceD3D : public SurfaceImpl
EGLint getHeight() const override;
EGLint isPostSubBufferSupported() const override;
EGLint getSwapBehavior() const override;
// D3D implementations
SwapChainD3D *getSwapChain() const;
......
......@@ -34,6 +34,7 @@ class WindowSurfaceCGL : public SurfaceGL
EGLint getHeight() const override;
EGLint isPostSubBufferSupported() const override;
EGLint getSwapBehavior() const override;
};
}
......
......@@ -87,4 +87,9 @@ EGLint WindowSurfaceCGL::isPostSubBufferSupported() const
return EGL_FALSE;
}
EGLint WindowSurfaceCGL::getSwapBehavior() const
{
return EGL_BUFFER_DESTROYED;
}
}
......@@ -117,4 +117,9 @@ EGLint PbufferSurfaceGLX::isPostSubBufferSupported() const
return EGL_FALSE;
}
EGLint PbufferSurfaceGLX::getSwapBehavior() const
{
return EGL_BUFFER_PRESERVED;
}
}
......@@ -38,6 +38,7 @@ class PbufferSurfaceGLX : public SurfaceGL
EGLint getHeight() const override;
EGLint isPostSubBufferSupported() const override;
EGLint getSwapBehavior() const override;
private:
unsigned mWidth;
......
......@@ -192,6 +192,11 @@ EGLint WindowSurfaceGLX::isPostSubBufferSupported() const
return EGL_FALSE;
}
EGLint WindowSurfaceGLX::getSwapBehavior() const
{
return EGL_BUFFER_PRESERVED;
}
bool WindowSurfaceGLX::getWindowDimensions(Window window, unsigned int *width, unsigned int *height) const
{
Window root;
......
......@@ -39,6 +39,8 @@ class WindowSurfaceGLX : public SurfaceGL
EGLint getHeight() const override;
EGLint isPostSubBufferSupported() const override;
EGLint getSwapBehavior() const override;
private:
bool getWindowDimensions(Window window, unsigned int *width, unsigned int *height) const;
......
......@@ -179,4 +179,9 @@ EGLint PbufferSurfaceWGL::isPostSubBufferSupported() const
return EGL_FALSE;
}
EGLint PbufferSurfaceWGL::getSwapBehavior() const
{
return EGL_BUFFER_PRESERVED;
}
}
......@@ -40,6 +40,7 @@ class PbufferSurfaceWGL : public SurfaceGL
EGLint getHeight() const override;
EGLint isPostSubBufferSupported() const override;
EGLint getSwapBehavior() const override;
private:
EGLint mWidth;
......
......@@ -145,4 +145,9 @@ EGLint WindowSurfaceWGL::isPostSubBufferSupported() const
return EGL_FALSE;
}
EGLint WindowSurfaceWGL::getSwapBehavior() const
{
return EGL_BUFFER_PRESERVED;
}
}
......@@ -38,6 +38,7 @@ class WindowSurfaceWGL : public SurfaceGL
EGLint getHeight() const override;
EGLint isPostSubBufferSupported() const override;
EGLint getSwapBehavior() const override;
private:
int mPixelFormat;
......
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