Commit 1b765456 by Geoff Lang

Move display extension initialization to DisplayImpl.

BUG=angle:658 Change-Id: I44d95fad4e1be5cc76f443d724defd37da4a268f Reviewed-on: https://chromium-review.googlesource.com/234762Reviewed-by: 's avatarKenneth Russell <kbr@chromium.org> Reviewed-by: 's avatarBrandon Jones <bajones@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 74cafab1
...@@ -657,25 +657,7 @@ const std::string &Display::getClientExtensionString() ...@@ -657,25 +657,7 @@ const std::string &Display::getClientExtensionString()
void Display::initDisplayExtensions() void Display::initDisplayExtensions()
{ {
mDisplayExtensions.createContextRobustness = true; mDisplayExtensions = mImplementation->getExtensions();
// ANGLE-specific extensions
if (mRenderer->getShareHandleSupport())
{
mDisplayExtensions.d3dShareHandleClientBuffer = true;
mDisplayExtensions.surfaceD3DTexture2DShareHandle = true;
}
mDisplayExtensions.querySurfacePointer = true;
mDisplayExtensions.windowFixedSize = true;
if (mRenderer->getPostSubBufferSupport())
{
mDisplayExtensions.postSubBuffer = true;
}
mDisplayExtensions.createContext = true;
mDisplayExtensionString = GenerateExtensionsString(mDisplayExtensions); mDisplayExtensionString = GenerateExtensionsString(mDisplayExtensions);
} }
......
...@@ -13,6 +13,11 @@ ...@@ -13,6 +13,11 @@
namespace rx namespace rx
{ {
DisplayImpl::DisplayImpl()
: mExtensionsInitialized(false)
{
}
DisplayImpl::~DisplayImpl() DisplayImpl::~DisplayImpl()
{ {
while (!mSurfaceSet.empty()) while (!mSurfaceSet.empty())
...@@ -27,4 +32,15 @@ void DisplayImpl::destroySurface(egl::Surface *surface) ...@@ -27,4 +32,15 @@ void DisplayImpl::destroySurface(egl::Surface *surface)
SafeDelete(surface); SafeDelete(surface);
} }
const egl::DisplayExtensions &DisplayImpl::getExtensions() const
{
if (!mExtensionsInitialized)
{
generateExtensions(&mExtensions);
mExtensionsInitialized = true;
}
return mExtensions;
}
} }
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#define LIBANGLE_RENDERER_DISPLAYIMPL_H_ #define LIBANGLE_RENDERER_DISPLAYIMPL_H_
#include "common/angleutils.h" #include "common/angleutils.h"
#include "libANGLE/Caps.h"
#include "libANGLE/Error.h" #include "libANGLE/Error.h"
#include <set> #include <set>
...@@ -28,7 +29,7 @@ class SurfaceImpl; ...@@ -28,7 +29,7 @@ class SurfaceImpl;
class DisplayImpl class DisplayImpl
{ {
public: public:
DisplayImpl() {} DisplayImpl();
virtual ~DisplayImpl(); virtual ~DisplayImpl();
virtual SurfaceImpl *createWindowSurface(egl::Display *display, const egl::Config *config, virtual SurfaceImpl *createWindowSurface(egl::Display *display, const egl::Config *config,
...@@ -47,6 +48,8 @@ class DisplayImpl ...@@ -47,6 +48,8 @@ class DisplayImpl
void destroySurface(egl::Surface *surface); void destroySurface(egl::Surface *surface);
const egl::DisplayExtensions &getExtensions() const;
protected: protected:
// Place the surface set here so it can be accessible for handling // Place the surface set here so it can be accessible for handling
// context loss events. (It is shared between the Display and Impl.) // context loss events. (It is shared between the Display and Impl.)
...@@ -54,6 +57,11 @@ class DisplayImpl ...@@ -54,6 +57,11 @@ class DisplayImpl
private: private:
DISALLOW_COPY_AND_ASSIGN(DisplayImpl); DISALLOW_COPY_AND_ASSIGN(DisplayImpl);
virtual void generateExtensions(egl::DisplayExtensions *outExtensions) const = 0;
mutable bool mExtensionsInitialized;
mutable egl::DisplayExtensions mExtensions;
}; };
} }
......
...@@ -84,10 +84,6 @@ class Renderer ...@@ -84,10 +84,6 @@ class Renderer
const GLvoid *indices, GLsizei instances, const GLvoid *indices, GLsizei instances,
const RangeUI &indexRange) = 0; const RangeUI &indexRange) = 0;
// TODO(jmadill): caps? and virtual for egl::Display
virtual bool getShareHandleSupport() const = 0;
virtual bool getPostSubBufferSupport() const = 0;
// Shader creation // Shader creation
virtual CompilerImpl *createCompiler(const gl::Data &data) = 0; virtual CompilerImpl *createCompiler(const gl::Data &data) = 0;
virtual ShaderImpl *createShader(GLenum type) = 0; virtual ShaderImpl *createShader(GLenum type) = 0;
......
...@@ -75,4 +75,26 @@ bool DisplayD3D::isValidNativeWindow(EGLNativeWindowType window) const ...@@ -75,4 +75,26 @@ bool DisplayD3D::isValidNativeWindow(EGLNativeWindowType window) const
return NativeWindow::isValidNativeWindow(window); return NativeWindow::isValidNativeWindow(window);
} }
void DisplayD3D::generateExtensions(egl::DisplayExtensions *outExtensions) const
{
outExtensions->createContextRobustness = true;
// ANGLE-specific extensions
if (mRenderer->getShareHandleSupport())
{
outExtensions->d3dShareHandleClientBuffer = true;
outExtensions->surfaceD3DTexture2DShareHandle = true;
}
outExtensions->querySurfacePointer = true;
outExtensions->windowFixedSize = true;
if (mRenderer->getPostSubBufferSupport())
{
outExtensions->postSubBuffer = true;
}
outExtensions->createContext = true;
}
} }
...@@ -32,6 +32,8 @@ class DisplayD3D : public DisplayImpl ...@@ -32,6 +32,8 @@ class DisplayD3D : public DisplayImpl
private: private:
DISALLOW_COPY_AND_ASSIGN(DisplayD3D); DISALLOW_COPY_AND_ASSIGN(DisplayD3D);
void generateExtensions(egl::DisplayExtensions *outExtensions) const override;
rx::RendererD3D *mRenderer; rx::RendererD3D *mRenderer;
}; };
......
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