Commit 6110763f by Geoff Lang Committed by Commit Bot

Refactor the GL surfaces and framebuffers to not hold renderer objects.

BUG=angleproject:2464 Change-Id: I20aabeef3de6cf1fc13a29b6220e040aa83184d7 Reviewed-on: https://chromium-review.googlesource.com/1039986 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarFrank Henigman <fjhenigman@chromium.org>
parent a932b6b5
...@@ -432,7 +432,11 @@ Context::Context(rx::EGLImplFactory *implFactory, ...@@ -432,7 +432,11 @@ Context::Context(rx::EGLImplFactory *implFactory,
egl::Error Context::onDestroy(const egl::Display *display) egl::Error Context::onDestroy(const egl::Display *display)
{ {
// Delete the Surface first to trigger a finish() in Vulkan. // Delete the Surface first to trigger a finish() in Vulkan.
if (mSurfacelessFramebuffer)
{
mSurfacelessFramebuffer->onDestroy(this);
SafeDelete(mSurfacelessFramebuffer); SafeDelete(mSurfacelessFramebuffer);
}
ANGLE_TRY(releaseSurface(display)); ANGLE_TRY(releaseSurface(display));
......
...@@ -65,8 +65,12 @@ ProgramImpl *ContextGL::createProgram(const gl::ProgramState &data) ...@@ -65,8 +65,12 @@ ProgramImpl *ContextGL::createProgram(const gl::ProgramState &data)
FramebufferImpl *ContextGL::createFramebuffer(const gl::FramebufferState &data) FramebufferImpl *ContextGL::createFramebuffer(const gl::FramebufferState &data)
{ {
return new FramebufferGL(data, getFunctions(), getStateManager(), getWorkaroundsGL(), const FunctionsGL *funcs = getFunctions();
mRenderer->getBlitter(), mRenderer->getMultiviewClearer(), false);
GLuint fbo = 0;
funcs->genFramebuffers(1, &fbo);
return new FramebufferGL(data, fbo, false);
} }
TextureImpl *ContextGL::createTexture(const gl::TextureState &state) TextureImpl *ContextGL::createTexture(const gl::TextureState &state)
...@@ -412,6 +416,16 @@ const WorkaroundsGL &ContextGL::getWorkaroundsGL() const ...@@ -412,6 +416,16 @@ const WorkaroundsGL &ContextGL::getWorkaroundsGL() const
return mRenderer->getWorkarounds(); return mRenderer->getWorkarounds();
} }
BlitGL *ContextGL::getBlitter() const
{
return mRenderer->getBlitter();
}
ClearMultiviewGL *ContextGL::getMultiviewClearer() const
{
return mRenderer->getMultiviewClearer();
}
gl::Error ContextGL::dispatchCompute(const gl::Context *context, gl::Error ContextGL::dispatchCompute(const gl::Context *context,
GLuint numGroupsX, GLuint numGroupsX,
GLuint numGroupsY, GLuint numGroupsY,
......
...@@ -19,6 +19,8 @@ struct BlockMemberInfo; ...@@ -19,6 +19,8 @@ struct BlockMemberInfo;
namespace rx namespace rx
{ {
class BlitGL;
class ClearMultiviewGL;
class FunctionsGL; class FunctionsGL;
class RendererGL; class RendererGL;
class StateManagerGL; class StateManagerGL;
...@@ -193,6 +195,8 @@ class ContextGL : public ContextImpl ...@@ -193,6 +195,8 @@ class ContextGL : public ContextImpl
const FunctionsGL *getFunctions() const; const FunctionsGL *getFunctions() const;
StateManagerGL *getStateManager(); StateManagerGL *getStateManager();
const WorkaroundsGL &getWorkaroundsGL() const; const WorkaroundsGL &getWorkaroundsGL() const;
BlitGL *getBlitter() const;
ClearMultiviewGL *getMultiviewClearer() const;
gl::Error dispatchCompute(const gl::Context *context, gl::Error dispatchCompute(const gl::Context *context,
GLuint numGroupsX, GLuint numGroupsX,
......
...@@ -23,25 +23,11 @@ struct WorkaroundsGL; ...@@ -23,25 +23,11 @@ struct WorkaroundsGL;
class FramebufferGL : public FramebufferImpl class FramebufferGL : public FramebufferImpl
{ {
public: public:
FramebufferGL(const gl::FramebufferState &data, FramebufferGL(const gl::FramebufferState &data, GLuint id, bool isDefault);
const FunctionsGL *functions,
StateManagerGL *stateManager,
const WorkaroundsGL &workarounds,
BlitGL *blitter,
ClearMultiviewGL *multiviewClearer,
bool isDefault);
// Constructor called when we need to create a FramebufferGL from an
// existing framebuffer name, for example for the default framebuffer
// on the Mac EGL CGL backend.
FramebufferGL(GLuint id,
const gl::FramebufferState &data,
const FunctionsGL *functions,
const WorkaroundsGL &workarounds,
BlitGL *blitter,
ClearMultiviewGL *multiviewClearer,
StateManagerGL *stateManager);
~FramebufferGL() override; ~FramebufferGL() override;
void destroy(const gl::Context *context) override;
gl::Error discard(const gl::Context *context, size_t count, const GLenum *attachments) override; gl::Error discard(const gl::Context *context, size_t count, const GLenum *attachments) override;
gl::Error invalidate(const gl::Context *context, gl::Error invalidate(const gl::Context *context,
size_t count, size_t count,
...@@ -97,7 +83,9 @@ class FramebufferGL : public FramebufferImpl ...@@ -97,7 +83,9 @@ class FramebufferGL : public FramebufferImpl
GLuint getFramebufferID() const; GLuint getFramebufferID() const;
bool isDefault() const; bool isDefault() const;
void maskOutInactiveOutputDrawBuffers(GLenum binding, gl::DrawBufferMask maxSet); void maskOutInactiveOutputDrawBuffers(const gl::Context *context,
GLenum binding,
gl::DrawBufferMask maxSet);
private: private:
void syncClearState(const gl::Context *context, GLbitfield mask); void syncClearState(const gl::Context *context, GLbitfield mask);
...@@ -123,12 +111,6 @@ class FramebufferGL : public FramebufferImpl ...@@ -123,12 +111,6 @@ class FramebufferGL : public FramebufferImpl
GLubyte *pixels, GLubyte *pixels,
bool readLastRowSeparately) const; bool readLastRowSeparately) const;
const FunctionsGL *mFunctions;
StateManagerGL *mStateManager;
const WorkaroundsGL &mWorkarounds;
BlitGL *mBlitter;
ClearMultiviewGL *mMultiviewClearer;
GLuint mFramebufferID; GLuint mFramebufferID;
bool mIsDefault; bool mIsDefault;
......
...@@ -1043,7 +1043,8 @@ gl::Error StateManagerGL::setGenericDrawState(const gl::Context *context) ...@@ -1043,7 +1043,8 @@ gl::Error StateManagerGL::setGenericDrawState(const gl::Context *context)
const gl::State &glState = context->getGLState(); const gl::State &glState = context->getGLState();
FramebufferGL *framebufferGL = GetImplAs<FramebufferGL>(glState.getDrawFramebuffer()); FramebufferGL *framebufferGL = GetImplAs<FramebufferGL>(glState.getDrawFramebuffer());
auto activeOutputs = glState.getProgram()->getState().getActiveOutputVariables(); auto activeOutputs = glState.getProgram()->getState().getActiveOutputVariables();
framebufferGL->maskOutInactiveOutputDrawBuffers(GL_DRAW_FRAMEBUFFER, activeOutputs); framebufferGL->maskOutInactiveOutputDrawBuffers(context, GL_DRAW_FRAMEBUFFER,
activeOutputs);
} }
ASSERT( ASSERT(
......
...@@ -8,16 +8,17 @@ ...@@ -8,16 +8,17 @@
#include "libANGLE/renderer/gl/SurfaceGL.h" #include "libANGLE/renderer/gl/SurfaceGL.h"
#include "libANGLE/Context.h"
#include "libANGLE/Surface.h" #include "libANGLE/Surface.h"
#include "libANGLE/renderer/gl/BlitGL.h" #include "libANGLE/renderer/gl/BlitGL.h"
#include "libANGLE/renderer/gl/ContextGL.h"
#include "libANGLE/renderer/gl/FramebufferGL.h" #include "libANGLE/renderer/gl/FramebufferGL.h"
#include "libANGLE/renderer/gl/RendererGL.h" #include "libANGLE/renderer/gl/RendererGL.h"
namespace rx namespace rx
{ {
SurfaceGL::SurfaceGL(const egl::SurfaceState &state, RendererGL *renderer) SurfaceGL::SurfaceGL(const egl::SurfaceState &state) : SurfaceImpl(state)
: SurfaceImpl(state), mRenderer(renderer)
{ {
} }
...@@ -27,9 +28,7 @@ SurfaceGL::~SurfaceGL() ...@@ -27,9 +28,7 @@ SurfaceGL::~SurfaceGL()
FramebufferImpl *SurfaceGL::createDefaultFramebuffer(const gl::FramebufferState &data) FramebufferImpl *SurfaceGL::createDefaultFramebuffer(const gl::FramebufferState &data)
{ {
return new FramebufferGL(data, mRenderer->getFunctions(), mRenderer->getStateManager(), return new FramebufferGL(data, 0, true);
mRenderer->getWorkarounds(), mRenderer->getBlitter(),
mRenderer->getMultiviewClearer(), true);
} }
egl::Error SurfaceGL::getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc) egl::Error SurfaceGL::getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc)
...@@ -46,8 +45,12 @@ egl::Error SurfaceGL::unMakeCurrent() ...@@ -46,8 +45,12 @@ egl::Error SurfaceGL::unMakeCurrent()
gl::Error SurfaceGL::initializeContents(const gl::Context *context, gl::Error SurfaceGL::initializeContents(const gl::Context *context,
const gl::ImageIndex &imageIndex) const gl::ImageIndex &imageIndex)
{ {
FramebufferGL *framebufferGL = GetImplAs<FramebufferGL>(mState.defaultFramebuffer); FramebufferGL *framebufferGL = GetImplAs<FramebufferGL>(context->getFramebuffer(0));
ANGLE_TRY(mRenderer->getBlitter()->clearFramebuffer(framebufferGL)); ASSERT(framebufferGL->isDefault());
BlitGL *blitter = GetBlitGL(context);
ANGLE_TRY(blitter->clearFramebuffer(framebufferGL));
return gl::NoError(); return gl::NoError();
} }
......
...@@ -14,12 +14,10 @@ ...@@ -14,12 +14,10 @@
namespace rx namespace rx
{ {
class RendererGL;
class SurfaceGL : public SurfaceImpl class SurfaceGL : public SurfaceImpl
{ {
public: public:
SurfaceGL(const egl::SurfaceState &state, RendererGL *renderer); SurfaceGL(const egl::SurfaceState &state);
~SurfaceGL() override; ~SurfaceGL() override;
FramebufferImpl *createDefaultFramebuffer(const gl::FramebufferState &data) override; FramebufferImpl *createDefaultFramebuffer(const gl::FramebufferState &data) override;
...@@ -30,9 +28,6 @@ class SurfaceGL : public SurfaceImpl ...@@ -30,9 +28,6 @@ class SurfaceGL : public SurfaceImpl
virtual egl::Error makeCurrent() = 0; virtual egl::Error makeCurrent() = 0;
virtual egl::Error unMakeCurrent(); virtual egl::Error unMakeCurrent();
private:
RendererGL *mRenderer;
}; };
} }
......
...@@ -134,7 +134,7 @@ SurfaceImpl *DisplayCGL::createPbufferFromClientBuffer(const egl::SurfaceState & ...@@ -134,7 +134,7 @@ SurfaceImpl *DisplayCGL::createPbufferFromClientBuffer(const egl::SurfaceState &
{ {
ASSERT(buftype == EGL_IOSURFACE_ANGLE); ASSERT(buftype == EGL_IOSURFACE_ANGLE);
return new IOSurfaceSurfaceCGL(state, this->getRenderer(), this, clientBuffer, attribs); return new IOSurfaceSurfaceCGL(state, mContext, clientBuffer, attribs);
} }
SurfaceImpl *DisplayCGL::createPixmapSurface(const egl::SurfaceState &state, SurfaceImpl *DisplayCGL::createPixmapSurface(const egl::SurfaceState &state,
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#define LIBANGLE_RENDERER_GL_CGL_IOSURFACESURFACECGL_H_ #define LIBANGLE_RENDERER_GL_CGL_IOSURFACESURFACECGL_H_
#include "libANGLE/renderer/gl/SurfaceGL.h" #include "libANGLE/renderer/gl/SurfaceGL.h"
#include "libANGLE/renderer/gl/cgl/DisplayCGL.h"
struct __IOSurface; struct __IOSurface;
typedef __IOSurface *IOSurfaceRef; typedef __IOSurface *IOSurfaceRef;
...@@ -31,8 +32,7 @@ class IOSurfaceSurfaceCGL : public SurfaceGL ...@@ -31,8 +32,7 @@ class IOSurfaceSurfaceCGL : public SurfaceGL
{ {
public: public:
IOSurfaceSurfaceCGL(const egl::SurfaceState &state, IOSurfaceSurfaceCGL(const egl::SurfaceState &state,
RendererGL *renderer, CGLContextObj cglContext,
DisplayCGL *display,
EGLClientBuffer buffer, EGLClientBuffer buffer,
const egl::AttributeMap &attribs); const egl::AttributeMap &attribs);
~IOSurfaceSurfaceCGL() override; ~IOSurfaceSurfaceCGL() override;
...@@ -62,9 +62,7 @@ class IOSurfaceSurfaceCGL : public SurfaceGL ...@@ -62,9 +62,7 @@ class IOSurfaceSurfaceCGL : public SurfaceGL
static bool validateAttributes(EGLClientBuffer buffer, const egl::AttributeMap &attribs); static bool validateAttributes(EGLClientBuffer buffer, const egl::AttributeMap &attribs);
private: private:
DisplayCGL *mDisplay; CGLContextObj mCGLContext;
RendererGL *mRenderer;
StateManagerGL *mStateManager;
IOSurfaceRef mIOSurface; IOSurfaceRef mIOSurface;
int mWidth; int mWidth;
int mHeight; int mHeight;
......
...@@ -65,14 +65,11 @@ int FindIOSurfaceFormatIndex(GLenum internalFormat, GLenum type) ...@@ -65,14 +65,11 @@ int FindIOSurfaceFormatIndex(GLenum internalFormat, GLenum type)
} // anonymous namespace } // anonymous namespace
IOSurfaceSurfaceCGL::IOSurfaceSurfaceCGL(const egl::SurfaceState &state, IOSurfaceSurfaceCGL::IOSurfaceSurfaceCGL(const egl::SurfaceState &state,
RendererGL *renderer, CGLContextObj cglContext,
DisplayCGL *display,
EGLClientBuffer buffer, EGLClientBuffer buffer,
const egl::AttributeMap &attribs) const egl::AttributeMap &attribs)
: SurfaceGL(state, renderer), : SurfaceGL(state),
mDisplay(display), mCGLContext(cglContext),
mRenderer(renderer),
mStateManager(renderer->getStateManager()),
mIOSurface(nullptr), mIOSurface(nullptr),
mWidth(0), mWidth(0),
mHeight(0), mHeight(0),
...@@ -140,14 +137,16 @@ egl::Error IOSurfaceSurfaceCGL::bindTexImage(const gl::Context *context, ...@@ -140,14 +137,16 @@ egl::Error IOSurfaceSurfaceCGL::bindTexImage(const gl::Context *context,
gl::Texture *texture, gl::Texture *texture,
EGLint buffer) EGLint buffer)
{ {
StateManagerGL *stateManager = GetStateManagerGL(context);
const TextureGL *textureGL = GetImplAs<TextureGL>(texture); const TextureGL *textureGL = GetImplAs<TextureGL>(texture);
GLuint textureID = textureGL->getTextureID(); GLuint textureID = textureGL->getTextureID();
mStateManager->bindTexture(gl::TextureType::Rectangle, textureID); stateManager->bindTexture(gl::TextureType::Rectangle, textureID);
const auto &format = kIOSurfaceFormats[mFormatIndex]; const auto &format = kIOSurfaceFormats[mFormatIndex];
auto error = CGLTexImageIOSurface2D( auto error = CGLTexImageIOSurface2D(mCGLContext, GL_TEXTURE_RECTANGLE, format.nativeFormat,
mDisplay->getCGLContext(), GL_TEXTURE_RECTANGLE, format.nativeFormat, mWidth, mHeight, mWidth, mHeight, format.nativeInternalFormat,
format.nativeInternalFormat, format.nativeType, mIOSurface, mPlane); format.nativeType, mIOSurface, mPlane);
if (error != kCGLNoError) if (error != kCGLNoError)
{ {
...@@ -159,11 +158,8 @@ egl::Error IOSurfaceSurfaceCGL::bindTexImage(const gl::Context *context, ...@@ -159,11 +158,8 @@ egl::Error IOSurfaceSurfaceCGL::bindTexImage(const gl::Context *context,
egl::Error IOSurfaceSurfaceCGL::releaseTexImage(const gl::Context *context, EGLint buffer) egl::Error IOSurfaceSurfaceCGL::releaseTexImage(const gl::Context *context, EGLint buffer)
{ {
gl::Error error = mRenderer->flush(); const FunctionsGL *functions = GetFunctionsGL(context);
if (error.isError()) functions->flush();
{
return egl::EglContextLost();
}
return egl::NoError(); return egl::NoError();
} }
......
...@@ -16,6 +16,7 @@ namespace rx ...@@ -16,6 +16,7 @@ namespace rx
{ {
class FunctionsGL; class FunctionsGL;
class RendererGL;
class StateManagerGL; class StateManagerGL;
struct WorkaroundsGL; struct WorkaroundsGL;
...@@ -57,9 +58,10 @@ class PbufferSurfaceCGL : public SurfaceGL ...@@ -57,9 +58,10 @@ class PbufferSurfaceCGL : public SurfaceGL
unsigned mWidth; unsigned mWidth;
unsigned mHeight; unsigned mHeight;
// TODO(geofflang): Don't store these, they are potentially specific to a single GL context.
// http://anglebug.com/2464
const FunctionsGL *mFunctions; const FunctionsGL *mFunctions;
StateManagerGL *mStateManager; StateManagerGL *mStateManager;
RendererGL *mRenderer;
GLuint mFramebuffer; GLuint mFramebuffer;
GLuint mColorRenderbuffer; GLuint mColorRenderbuffer;
......
...@@ -23,12 +23,11 @@ PbufferSurfaceCGL::PbufferSurfaceCGL(const egl::SurfaceState &state, ...@@ -23,12 +23,11 @@ PbufferSurfaceCGL::PbufferSurfaceCGL(const egl::SurfaceState &state,
EGLint width, EGLint width,
EGLint height, EGLint height,
const FunctionsGL *functions) const FunctionsGL *functions)
: SurfaceGL(state, renderer), : SurfaceGL(state),
mWidth(width), mWidth(width),
mHeight(height), mHeight(height),
mFunctions(functions), mFunctions(functions),
mStateManager(renderer->getStateManager()), mStateManager(renderer->getStateManager()),
mRenderer(renderer),
mFramebuffer(0), mFramebuffer(0),
mColorRenderbuffer(0), mColorRenderbuffer(0),
mDSRenderbuffer(0) mDSRenderbuffer(0)
...@@ -142,9 +141,7 @@ EGLint PbufferSurfaceCGL::getSwapBehavior() const ...@@ -142,9 +141,7 @@ EGLint PbufferSurfaceCGL::getSwapBehavior() const
FramebufferImpl *PbufferSurfaceCGL::createDefaultFramebuffer(const gl::FramebufferState &state) FramebufferImpl *PbufferSurfaceCGL::createDefaultFramebuffer(const gl::FramebufferState &state)
{ {
// TODO(cwallez) assert it happens only once? // TODO(cwallez) assert it happens only once?
return new FramebufferGL(mFramebuffer, state, mFunctions, mRenderer->getWorkarounds(), return new FramebufferGL(state, mFramebuffer, true);
mRenderer->getBlitter(), mRenderer->getMultiviewClearer(),
mStateManager);
} }
} // namespace rx } // namespace rx
...@@ -25,6 +25,7 @@ namespace rx ...@@ -25,6 +25,7 @@ namespace rx
class DisplayCGL; class DisplayCGL;
class FramebufferGL; class FramebufferGL;
class FunctionsGL; class FunctionsGL;
class RendererGL;
class StateManagerGL; class StateManagerGL;
struct WorkaroundsGL; struct WorkaroundsGL;
...@@ -94,8 +95,6 @@ class WindowSurfaceCGL : public SurfaceGL ...@@ -94,8 +95,6 @@ class WindowSurfaceCGL : public SurfaceGL
CGLContextObj mContext; CGLContextObj mContext;
const FunctionsGL *mFunctions; const FunctionsGL *mFunctions;
StateManagerGL *mStateManager; StateManagerGL *mStateManager;
RendererGL *mRenderer;
const WorkaroundsGL &mWorkarounds;
GLuint mFramebuffer; GLuint mFramebuffer;
GLuint mDSRenderbuffer; GLuint mDSRenderbuffer;
......
...@@ -147,15 +147,13 @@ ...@@ -147,15 +147,13 @@
EGLNativeWindowType layer, EGLNativeWindowType layer,
const FunctionsGL *functions, const FunctionsGL *functions,
CGLContextObj context) CGLContextObj context)
: SurfaceGL(state, renderer), : SurfaceGL(state),
mSwapLayer(nil), mSwapLayer(nil),
mCurrentSwapId(0), mCurrentSwapId(0),
mLayer(reinterpret_cast<CALayer *>(layer)), mLayer(reinterpret_cast<CALayer *>(layer)),
mContext(context), mContext(context),
mFunctions(functions), mFunctions(functions),
mStateManager(renderer->getStateManager()), mStateManager(renderer->getStateManager()),
mRenderer(renderer),
mWorkarounds(renderer->getWorkarounds()),
mFramebuffer(0), mFramebuffer(0),
mDSRenderbuffer(0) mDSRenderbuffer(0)
{ {
...@@ -331,8 +329,7 @@ EGLint WindowSurfaceCGL::getSwapBehavior() const ...@@ -331,8 +329,7 @@ EGLint WindowSurfaceCGL::getSwapBehavior() const
FramebufferImpl *WindowSurfaceCGL::createDefaultFramebuffer(const gl::FramebufferState &state) FramebufferImpl *WindowSurfaceCGL::createDefaultFramebuffer(const gl::FramebufferState &state)
{ {
// TODO(cwallez) assert it happens only once? // TODO(cwallez) assert it happens only once?
return new FramebufferGL(mFramebuffer, state, mFunctions, mWorkarounds, mRenderer->getBlitter(), return new FramebufferGL(state, mFramebuffer, true);
mRenderer->getMultiviewClearer(), mStateManager);
} }
} // namespace rx } // namespace rx
...@@ -16,9 +16,8 @@ namespace rx ...@@ -16,9 +16,8 @@ namespace rx
PbufferSurfaceEGL::PbufferSurfaceEGL(const egl::SurfaceState &state, PbufferSurfaceEGL::PbufferSurfaceEGL(const egl::SurfaceState &state,
const FunctionsEGL *egl, const FunctionsEGL *egl,
EGLConfig config, EGLConfig config)
RendererGL *renderer) : SurfaceEGL(state, egl, config)
: SurfaceEGL(state, egl, config, renderer)
{ {
} }
......
...@@ -20,10 +20,7 @@ namespace rx ...@@ -20,10 +20,7 @@ namespace rx
class PbufferSurfaceEGL : public SurfaceEGL class PbufferSurfaceEGL : public SurfaceEGL
{ {
public: public:
PbufferSurfaceEGL(const egl::SurfaceState &state, PbufferSurfaceEGL(const egl::SurfaceState &state, const FunctionsEGL *egl, EGLConfig config);
const FunctionsEGL *egl,
EGLConfig config,
RendererGL *renderer);
~PbufferSurfaceEGL() override; ~PbufferSurfaceEGL() override;
egl::Error initialize(const egl::Display *display) override; egl::Error initialize(const egl::Display *display) override;
......
...@@ -13,14 +13,8 @@ ...@@ -13,14 +13,8 @@
namespace rx namespace rx
{ {
SurfaceEGL::SurfaceEGL(const egl::SurfaceState &state, SurfaceEGL::SurfaceEGL(const egl::SurfaceState &state, const FunctionsEGL *egl, EGLConfig config)
const FunctionsEGL *egl, : SurfaceGL(state), mEGL(egl), mConfig(config), mSurface(EGL_NO_SURFACE)
EGLConfig config,
RendererGL *renderer)
: SurfaceGL(state, renderer),
mEGL(egl),
mConfig(config),
mSurface(EGL_NO_SURFACE)
{ {
} }
......
...@@ -20,10 +20,7 @@ namespace rx ...@@ -20,10 +20,7 @@ namespace rx
class SurfaceEGL : public SurfaceGL class SurfaceEGL : public SurfaceGL
{ {
public: public:
SurfaceEGL(const egl::SurfaceState &state, SurfaceEGL(const egl::SurfaceState &state, const FunctionsEGL *egl, EGLConfig config);
const FunctionsEGL *egl,
EGLConfig config,
RendererGL *renderer);
~SurfaceEGL() override; ~SurfaceEGL() override;
egl::Error makeCurrent() override; egl::Error makeCurrent() override;
......
...@@ -17,9 +17,8 @@ namespace rx ...@@ -17,9 +17,8 @@ namespace rx
WindowSurfaceEGL::WindowSurfaceEGL(const egl::SurfaceState &state, WindowSurfaceEGL::WindowSurfaceEGL(const egl::SurfaceState &state,
const FunctionsEGL *egl, const FunctionsEGL *egl,
EGLConfig config, EGLConfig config,
EGLNativeWindowType window, EGLNativeWindowType window)
RendererGL *renderer) : SurfaceEGL(state, egl, config), mWindow(window)
: SurfaceEGL(state, egl, config, renderer), mWindow(window)
{ {
} }
......
...@@ -20,8 +20,7 @@ class WindowSurfaceEGL : public SurfaceEGL ...@@ -20,8 +20,7 @@ class WindowSurfaceEGL : public SurfaceEGL
WindowSurfaceEGL(const egl::SurfaceState &state, WindowSurfaceEGL(const egl::SurfaceState &state,
const FunctionsEGL *egl, const FunctionsEGL *egl,
EGLConfig config, EGLConfig config,
EGLNativeWindowType window, EGLNativeWindowType window);
RendererGL *renderer);
~WindowSurfaceEGL() override; ~WindowSurfaceEGL() override;
egl::Error initialize(const egl::Display *display) override; egl::Error initialize(const egl::Display *display) override;
......
...@@ -201,7 +201,7 @@ SurfaceImpl *DisplayAndroid::createWindowSurface(const egl::SurfaceState &state, ...@@ -201,7 +201,7 @@ SurfaceImpl *DisplayAndroid::createWindowSurface(const egl::SurfaceState &state,
success = mEGL->chooseConfig(configAttribList, &config, 1, &numConfig); success = mEGL->chooseConfig(configAttribList, &config, 1, &numConfig);
ASSERT(success && numConfig == 1); ASSERT(success && numConfig == 1);
return new WindowSurfaceEGL(state, mEGL, config, window, getRenderer()); return new WindowSurfaceEGL(state, mEGL, config, window);
} }
SurfaceImpl *DisplayAndroid::createPbufferSurface(const egl::SurfaceState &state, SurfaceImpl *DisplayAndroid::createPbufferSurface(const egl::SurfaceState &state,
...@@ -215,7 +215,7 @@ SurfaceImpl *DisplayAndroid::createPbufferSurface(const egl::SurfaceState &state ...@@ -215,7 +215,7 @@ SurfaceImpl *DisplayAndroid::createPbufferSurface(const egl::SurfaceState &state
success = mEGL->chooseConfig(configAttribList, &config, 1, &numConfig); success = mEGL->chooseConfig(configAttribList, &config, 1, &numConfig);
ASSERT(success && numConfig == 1); ASSERT(success && numConfig == 1);
return new PbufferSurfaceEGL(state, mEGL, config, getRenderer()); return new PbufferSurfaceEGL(state, mEGL, config);
} }
SurfaceImpl *DisplayAndroid::createPbufferFromClientBuffer(const egl::SurfaceState &state, SurfaceImpl *DisplayAndroid::createPbufferFromClientBuffer(const egl::SurfaceState &state,
......
...@@ -307,10 +307,7 @@ uint32_t DisplayOzone::Buffer::getDRMFB() ...@@ -307,10 +307,7 @@ uint32_t DisplayOzone::Buffer::getDRMFB()
FramebufferGL *DisplayOzone::Buffer::framebufferGL(const gl::FramebufferState &state) FramebufferGL *DisplayOzone::Buffer::framebufferGL(const gl::FramebufferState &state)
{ {
return new FramebufferGL( return new FramebufferGL(state, mGLFB, true);
mGLFB, state, mDisplay->mFunctionsGL, mDisplay->getRenderer()->getWorkarounds(),
mDisplay->getRenderer()->getBlitter(), mDisplay->getRenderer()->getMultiviewClearer(),
mDisplay->getRenderer()->getStateManager());
} }
void DisplayOzone::Buffer::present() void DisplayOzone::Buffer::present()
...@@ -861,7 +858,7 @@ SurfaceImpl *DisplayOzone::createWindowSurface(const egl::SurfaceState &state, ...@@ -861,7 +858,7 @@ SurfaceImpl *DisplayOzone::createWindowSurface(const egl::SurfaceState &state,
{ {
return nullptr; return nullptr;
} }
return new SurfaceOzone(state, getRenderer(), buffer); return new SurfaceOzone(state, buffer);
} }
SurfaceImpl *DisplayOzone::createPbufferSurface(const egl::SurfaceState &state, SurfaceImpl *DisplayOzone::createPbufferSurface(const egl::SurfaceState &state,
...@@ -875,7 +872,7 @@ SurfaceImpl *DisplayOzone::createPbufferSurface(const egl::SurfaceState &state, ...@@ -875,7 +872,7 @@ SurfaceImpl *DisplayOzone::createPbufferSurface(const egl::SurfaceState &state,
{ {
return nullptr; return nullptr;
} }
return new SurfaceOzone(state, getRenderer(), buffer); return new SurfaceOzone(state, buffer);
} }
SurfaceImpl *DisplayOzone::createPbufferFromClientBuffer(const egl::SurfaceState &state, SurfaceImpl *DisplayOzone::createPbufferFromClientBuffer(const egl::SurfaceState &state,
......
...@@ -14,10 +14,8 @@ ...@@ -14,10 +14,8 @@
namespace rx namespace rx
{ {
SurfaceOzone::SurfaceOzone(const egl::SurfaceState &state, SurfaceOzone::SurfaceOzone(const egl::SurfaceState &state, DisplayOzone::Buffer *buffer)
RendererGL *renderer, : SurfaceGL(state), mBuffer(buffer)
DisplayOzone::Buffer *buffer)
: SurfaceGL(state, renderer), mBuffer(buffer)
{ {
} }
......
...@@ -19,7 +19,6 @@ class SurfaceOzone : public SurfaceGL ...@@ -19,7 +19,6 @@ class SurfaceOzone : public SurfaceGL
{ {
public: public:
SurfaceOzone(const egl::SurfaceState &state, SurfaceOzone(const egl::SurfaceState &state,
RendererGL *renderer,
DisplayOzone::Buffer *buffer); DisplayOzone::Buffer *buffer);
~SurfaceOzone() override; ~SurfaceOzone() override;
......
...@@ -359,8 +359,7 @@ SurfaceImpl *DisplayGLX::createWindowSurface(const egl::SurfaceState &state, ...@@ -359,8 +359,7 @@ SurfaceImpl *DisplayGLX::createWindowSurface(const egl::SurfaceState &state,
ASSERT(configIdToGLXConfig.count(state.config->configID) > 0); ASSERT(configIdToGLXConfig.count(state.config->configID) > 0);
glx::FBConfig fbConfig = configIdToGLXConfig[state.config->configID]; glx::FBConfig fbConfig = configIdToGLXConfig[state.config->configID];
return new WindowSurfaceGLX(state, mGLX, this, getRenderer(), window, mGLX.getDisplay(), return new WindowSurfaceGLX(state, mGLX, this, window, mGLX.getDisplay(), fbConfig);
fbConfig);
} }
SurfaceImpl *DisplayGLX::createPbufferSurface(const egl::SurfaceState &state, SurfaceImpl *DisplayGLX::createPbufferSurface(const egl::SurfaceState &state,
...@@ -373,7 +372,7 @@ SurfaceImpl *DisplayGLX::createPbufferSurface(const egl::SurfaceState &state, ...@@ -373,7 +372,7 @@ SurfaceImpl *DisplayGLX::createPbufferSurface(const egl::SurfaceState &state,
EGLint height = static_cast<EGLint>(attribs.get(EGL_HEIGHT, 0)); EGLint height = static_cast<EGLint>(attribs.get(EGL_HEIGHT, 0));
bool largest = (attribs.get(EGL_LARGEST_PBUFFER, EGL_FALSE) == EGL_TRUE); bool largest = (attribs.get(EGL_LARGEST_PBUFFER, EGL_FALSE) == EGL_TRUE);
return new PbufferSurfaceGLX(state, getRenderer(), width, height, largest, mGLX, fbConfig); return new PbufferSurfaceGLX(state, width, height, largest, mGLX, fbConfig);
} }
SurfaceImpl *DisplayGLX::createPbufferFromClientBuffer(const egl::SurfaceState &state, SurfaceImpl *DisplayGLX::createPbufferFromClientBuffer(const egl::SurfaceState &state,
......
...@@ -16,13 +16,12 @@ namespace rx ...@@ -16,13 +16,12 @@ namespace rx
{ {
PbufferSurfaceGLX::PbufferSurfaceGLX(const egl::SurfaceState &state, PbufferSurfaceGLX::PbufferSurfaceGLX(const egl::SurfaceState &state,
RendererGL *renderer,
EGLint width, EGLint width,
EGLint height, EGLint height,
bool largest, bool largest,
const FunctionsGLX &glx, const FunctionsGLX &glx,
glx::FBConfig fbConfig) glx::FBConfig fbConfig)
: SurfaceGLX(state, renderer), : SurfaceGLX(state),
mWidth(width), mWidth(width),
mHeight(height), mHeight(height),
mLargest(largest), mLargest(largest),
......
...@@ -21,7 +21,6 @@ class PbufferSurfaceGLX : public SurfaceGLX ...@@ -21,7 +21,6 @@ class PbufferSurfaceGLX : public SurfaceGLX
{ {
public: public:
PbufferSurfaceGLX(const egl::SurfaceState &state, PbufferSurfaceGLX(const egl::SurfaceState &state,
RendererGL *renderer,
EGLint width, EGLint width,
EGLint height, EGLint height,
bool largest, bool largest,
......
...@@ -17,7 +17,7 @@ namespace rx ...@@ -17,7 +17,7 @@ namespace rx
class SurfaceGLX : public SurfaceGL class SurfaceGLX : public SurfaceGL
{ {
public: public:
SurfaceGLX(const egl::SurfaceState &state, RendererGL *renderer) : SurfaceGL(state, renderer) {} SurfaceGLX(const egl::SurfaceState &state) : SurfaceGL(state) {}
virtual egl::Error checkForResize() = 0; virtual egl::Error checkForResize() = 0;
virtual glx::Drawable getDrawable() const = 0; virtual glx::Drawable getDrawable() const = 0;
......
...@@ -24,11 +24,10 @@ static int IgnoreX11Errors(Display *, XErrorEvent *) ...@@ -24,11 +24,10 @@ static int IgnoreX11Errors(Display *, XErrorEvent *)
WindowSurfaceGLX::WindowSurfaceGLX(const egl::SurfaceState &state, WindowSurfaceGLX::WindowSurfaceGLX(const egl::SurfaceState &state,
const FunctionsGLX &glx, const FunctionsGLX &glx,
DisplayGLX *glxDisplay, DisplayGLX *glxDisplay,
RendererGL *renderer,
Window window, Window window,
Display *display, Display *display,
glx::FBConfig fbConfig) glx::FBConfig fbConfig)
: SurfaceGLX(state, renderer), : SurfaceGLX(state),
mParent(window), mParent(window),
mWindow(0), mWindow(0),
mDisplay(display), mDisplay(display),
......
...@@ -25,7 +25,6 @@ class WindowSurfaceGLX : public SurfaceGLX ...@@ -25,7 +25,6 @@ class WindowSurfaceGLX : public SurfaceGLX
WindowSurfaceGLX(const egl::SurfaceState &state, WindowSurfaceGLX(const egl::SurfaceState &state,
const FunctionsGLX &glx, const FunctionsGLX &glx,
DisplayGLX *glxDisplay, DisplayGLX *glxDisplay,
RendererGL *renderer,
Window window, Window window,
Display *display, Display *display,
glx::FBConfig fbConfig); glx::FBConfig fbConfig);
......
...@@ -14,9 +14,11 @@ ...@@ -14,9 +14,11 @@
#include "common/mathutil.h" #include "common/mathutil.h"
#include "libANGLE/Buffer.h" #include "libANGLE/Buffer.h"
#include "libANGLE/Caps.h" #include "libANGLE/Caps.h"
#include "libANGLE/Context.h"
#include "libANGLE/Workarounds.h" #include "libANGLE/Workarounds.h"
#include "libANGLE/formatutils.h" #include "libANGLE/formatutils.h"
#include "libANGLE/queryconversions.h" #include "libANGLE/queryconversions.h"
#include "libANGLE/renderer/gl/ContextGL.h"
#include "libANGLE/renderer/gl/FunctionsGL.h" #include "libANGLE/renderer/gl/FunctionsGL.h"
#include "libANGLE/renderer/gl/QueryGL.h" #include "libANGLE/renderer/gl/QueryGL.h"
#include "libANGLE/renderer/gl/WorkaroundsGL.h" #include "libANGLE/renderer/gl/WorkaroundsGL.h"
...@@ -1251,6 +1253,31 @@ bool UseTexImage3D(gl::TextureType textureType) ...@@ -1251,6 +1253,31 @@ bool UseTexImage3D(gl::TextureType textureType)
} }
} }
const FunctionsGL *GetFunctionsGL(const gl::Context *context)
{
return GetImplAs<ContextGL>(context)->getFunctions();
}
StateManagerGL *GetStateManagerGL(const gl::Context *context)
{
return GetImplAs<ContextGL>(context)->getStateManager();
}
BlitGL *GetBlitGL(const gl::Context *context)
{
return GetImplAs<ContextGL>(context)->getBlitter();
}
ClearMultiviewGL *GetMultiviewClearer(const gl::Context *context)
{
return GetImplAs<ContextGL>(context)->getMultiviewClearer();
}
const WorkaroundsGL &GetWorkaroundsGL(const gl::Context *context)
{
return GetImplAs<ContextGL>(context)->getWorkaroundsGL();
}
bool CanMapBufferForRead(const FunctionsGL *functions) bool CanMapBufferForRead(const FunctionsGL *functions)
{ {
return (functions->mapBufferRange != nullptr) || return (functions->mapBufferRange != nullptr) ||
......
...@@ -30,7 +30,10 @@ struct Workarounds; ...@@ -30,7 +30,10 @@ struct Workarounds;
namespace rx namespace rx
{ {
class BlitGL;
class ClearMultiviewGL;
class FunctionsGL; class FunctionsGL;
class StateManagerGL;
struct WorkaroundsGL; struct WorkaroundsGL;
enum class MultiviewImplementationTypeGL enum class MultiviewImplementationTypeGL
{ {
...@@ -41,6 +44,13 @@ enum class MultiviewImplementationTypeGL ...@@ -41,6 +44,13 @@ enum class MultiviewImplementationTypeGL
VendorID GetVendorID(const FunctionsGL *functions); VendorID GetVendorID(const FunctionsGL *functions);
std::string GetDriverVersion(const FunctionsGL *functions); std::string GetDriverVersion(const FunctionsGL *functions);
// Helpers for extracting the GL helper objects out of a context
const FunctionsGL *GetFunctionsGL(const gl::Context *context);
StateManagerGL *GetStateManagerGL(const gl::Context *context);
BlitGL *GetBlitGL(const gl::Context *context);
ClearMultiviewGL *GetMultiviewClearer(const gl::Context *context);
const WorkaroundsGL &GetWorkaroundsGL(const gl::Context *context);
namespace nativegl_gl namespace nativegl_gl
{ {
......
...@@ -230,7 +230,7 @@ egl::Error GetD3DTextureInfo(EGLenum buftype, ...@@ -230,7 +230,7 @@ egl::Error GetD3DTextureInfo(EGLenum buftype,
} // anonymous namespace } // anonymous namespace
D3DTextureSurfaceWGL::D3DTextureSurfaceWGL(const egl::SurfaceState &state, D3DTextureSurfaceWGL::D3DTextureSurfaceWGL(const egl::SurfaceState &state,
RendererGL *renderer, StateManagerGL *stateManager,
EGLenum buftype, EGLenum buftype,
EGLClientBuffer clientBuffer, EGLClientBuffer clientBuffer,
DisplayWGL *display, DisplayWGL *display,
...@@ -238,14 +238,12 @@ D3DTextureSurfaceWGL::D3DTextureSurfaceWGL(const egl::SurfaceState &state, ...@@ -238,14 +238,12 @@ D3DTextureSurfaceWGL::D3DTextureSurfaceWGL(const egl::SurfaceState &state,
ID3D11Device *displayD3D11Device, ID3D11Device *displayD3D11Device,
const FunctionsGL *functionsGL, const FunctionsGL *functionsGL,
const FunctionsWGL *functionsWGL) const FunctionsWGL *functionsWGL)
: SurfaceWGL(state, renderer), : SurfaceWGL(state),
mBuftype(buftype), mBuftype(buftype),
mClientBuffer(clientBuffer), mClientBuffer(clientBuffer),
mRenderer(renderer),
mDisplayD3D11Device(displayD3D11Device), mDisplayD3D11Device(displayD3D11Device),
mDisplay(display), mDisplay(display),
mStateManager(renderer->getStateManager()), mStateManager(stateManager),
mWorkarounds(renderer->getWorkarounds()),
mFunctionsGL(functionsGL), mFunctionsGL(functionsGL),
mFunctionsWGL(functionsWGL), mFunctionsWGL(functionsWGL),
mDeviceContext(deviceContext), mDeviceContext(deviceContext),
...@@ -500,9 +498,7 @@ EGLint D3DTextureSurfaceWGL::getSwapBehavior() const ...@@ -500,9 +498,7 @@ EGLint D3DTextureSurfaceWGL::getSwapBehavior() const
FramebufferImpl *D3DTextureSurfaceWGL::createDefaultFramebuffer(const gl::FramebufferState &data) FramebufferImpl *D3DTextureSurfaceWGL::createDefaultFramebuffer(const gl::FramebufferState &data)
{ {
return new FramebufferGL(mFramebufferID, data, mFunctionsGL, mWorkarounds, return new FramebufferGL(data, mFramebufferID, true);
mRenderer->getBlitter(), mRenderer->getMultiviewClearer(),
mStateManager);
} }
HDC D3DTextureSurfaceWGL::getDC() const HDC D3DTextureSurfaceWGL::getDC() const
......
...@@ -26,7 +26,7 @@ class D3DTextureSurfaceWGL : public SurfaceWGL ...@@ -26,7 +26,7 @@ class D3DTextureSurfaceWGL : public SurfaceWGL
{ {
public: public:
D3DTextureSurfaceWGL(const egl::SurfaceState &state, D3DTextureSurfaceWGL(const egl::SurfaceState &state,
RendererGL *renderer, StateManagerGL *stateManager,
EGLenum buftype, EGLenum buftype,
EGLClientBuffer clientBuffer, EGLClientBuffer clientBuffer,
DisplayWGL *display, DisplayWGL *display,
...@@ -73,13 +73,10 @@ class D3DTextureSurfaceWGL : public SurfaceWGL ...@@ -73,13 +73,10 @@ class D3DTextureSurfaceWGL : public SurfaceWGL
EGLenum mBuftype; EGLenum mBuftype;
EGLClientBuffer mClientBuffer; EGLClientBuffer mClientBuffer;
RendererGL *mRenderer;
ID3D11Device *mDisplayD3D11Device; ID3D11Device *mDisplayD3D11Device;
DisplayWGL *mDisplay; DisplayWGL *mDisplay;
StateManagerGL *mStateManager; StateManagerGL *mStateManager;
const WorkaroundsGL &mWorkarounds;
const FunctionsGL *mFunctionsGL; const FunctionsGL *mFunctionsGL;
const FunctionsWGL *mFunctionsWGL; const FunctionsWGL *mFunctionsWGL;
......
...@@ -23,7 +23,7 @@ namespace rx ...@@ -23,7 +23,7 @@ namespace rx
{ {
DXGISwapChainWindowSurfaceWGL::DXGISwapChainWindowSurfaceWGL(const egl::SurfaceState &state, DXGISwapChainWindowSurfaceWGL::DXGISwapChainWindowSurfaceWGL(const egl::SurfaceState &state,
RendererGL *renderer, StateManagerGL *stateManager,
EGLNativeWindowType window, EGLNativeWindowType window,
ID3D11Device *device, ID3D11Device *device,
HANDLE deviceHandle, HANDLE deviceHandle,
...@@ -31,11 +31,9 @@ DXGISwapChainWindowSurfaceWGL::DXGISwapChainWindowSurfaceWGL(const egl::SurfaceS ...@@ -31,11 +31,9 @@ DXGISwapChainWindowSurfaceWGL::DXGISwapChainWindowSurfaceWGL(const egl::SurfaceS
const FunctionsGL *functionsGL, const FunctionsGL *functionsGL,
const FunctionsWGL *functionsWGL, const FunctionsWGL *functionsWGL,
EGLint orientation) EGLint orientation)
: SurfaceWGL(state, renderer), : SurfaceWGL(state),
mWindow(window), mWindow(window),
mStateManager(renderer->getStateManager()), mStateManager(stateManager),
mWorkarounds(renderer->getWorkarounds()),
mRenderer(renderer),
mFunctionsGL(functionsGL), mFunctionsGL(functionsGL),
mFunctionsWGL(functionsWGL), mFunctionsWGL(functionsWGL),
mDevice(device), mDevice(device),
...@@ -272,9 +270,7 @@ EGLint DXGISwapChainWindowSurfaceWGL::getSwapBehavior() const ...@@ -272,9 +270,7 @@ EGLint DXGISwapChainWindowSurfaceWGL::getSwapBehavior() const
FramebufferImpl *DXGISwapChainWindowSurfaceWGL::createDefaultFramebuffer( FramebufferImpl *DXGISwapChainWindowSurfaceWGL::createDefaultFramebuffer(
const gl::FramebufferState &data) const gl::FramebufferState &data)
{ {
return new FramebufferGL(mFramebufferID, data, mFunctionsGL, mWorkarounds, return new FramebufferGL(data, mFramebufferID, true);
mRenderer->getBlitter(), mRenderer->getMultiviewClearer(),
mStateManager);
} }
HDC DXGISwapChainWindowSurfaceWGL::getDC() const HDC DXGISwapChainWindowSurfaceWGL::getDC() const
......
...@@ -27,7 +27,7 @@ class DXGISwapChainWindowSurfaceWGL : public SurfaceWGL ...@@ -27,7 +27,7 @@ class DXGISwapChainWindowSurfaceWGL : public SurfaceWGL
{ {
public: public:
DXGISwapChainWindowSurfaceWGL(const egl::SurfaceState &state, DXGISwapChainWindowSurfaceWGL(const egl::SurfaceState &state,
RendererGL *renderer, StateManagerGL *stateManager,
EGLNativeWindowType window, EGLNativeWindowType window,
ID3D11Device *device, ID3D11Device *device,
HANDLE deviceHandle, HANDLE deviceHandle,
...@@ -72,8 +72,6 @@ class DXGISwapChainWindowSurfaceWGL : public SurfaceWGL ...@@ -72,8 +72,6 @@ class DXGISwapChainWindowSurfaceWGL : public SurfaceWGL
EGLNativeWindowType mWindow; EGLNativeWindowType mWindow;
StateManagerGL *mStateManager; StateManagerGL *mStateManager;
const WorkaroundsGL &mWorkarounds;
RendererGL *mRenderer;
const FunctionsGL *mFunctionsGL; const FunctionsGL *mFunctionsGL;
const FunctionsWGL *mFunctionsWGL; const FunctionsWGL *mFunctionsWGL;
......
...@@ -385,14 +385,13 @@ SurfaceImpl *DisplayWGL::createWindowSurface(const egl::SurfaceState &state, ...@@ -385,14 +385,13 @@ SurfaceImpl *DisplayWGL::createWindowSurface(const egl::SurfaceState &state,
return nullptr; return nullptr;
} }
return new DXGISwapChainWindowSurfaceWGL(state, getRenderer(), window, mD3D11Device, return new DXGISwapChainWindowSurfaceWGL(state, getRenderer()->getStateManager(), window,
mD3D11DeviceHandle, mDeviceContext, mFunctionsGL, mD3D11Device, mD3D11DeviceHandle, mDeviceContext,
mFunctionsWGL, orientation); mFunctionsGL, mFunctionsWGL, orientation);
} }
else else
{ {
return new WindowSurfaceWGL(state, getRenderer(), window, mPixelFormat, mFunctionsWGL, return new WindowSurfaceWGL(state, window, mPixelFormat, mFunctionsWGL, orientation);
orientation);
} }
} }
...@@ -405,8 +404,8 @@ SurfaceImpl *DisplayWGL::createPbufferSurface(const egl::SurfaceState &state, ...@@ -405,8 +404,8 @@ SurfaceImpl *DisplayWGL::createPbufferSurface(const egl::SurfaceState &state,
EGLenum textureFormat = static_cast<EGLenum>(attribs.get(EGL_TEXTURE_FORMAT, EGL_NO_TEXTURE)); EGLenum textureFormat = static_cast<EGLenum>(attribs.get(EGL_TEXTURE_FORMAT, EGL_NO_TEXTURE));
EGLenum textureTarget = static_cast<EGLenum>(attribs.get(EGL_TEXTURE_TARGET, EGL_NO_TEXTURE)); EGLenum textureTarget = static_cast<EGLenum>(attribs.get(EGL_TEXTURE_TARGET, EGL_NO_TEXTURE));
return new PbufferSurfaceWGL(state, getRenderer(), width, height, textureFormat, textureTarget, return new PbufferSurfaceWGL(state, width, height, textureFormat, textureTarget, largest,
largest, mPixelFormat, mDeviceContext, mFunctionsWGL); mPixelFormat, mDeviceContext, mFunctionsWGL);
} }
SurfaceImpl *DisplayWGL::createPbufferFromClientBuffer(const egl::SurfaceState &state, SurfaceImpl *DisplayWGL::createPbufferFromClientBuffer(const egl::SurfaceState &state,
...@@ -420,8 +419,9 @@ SurfaceImpl *DisplayWGL::createPbufferFromClientBuffer(const egl::SurfaceState & ...@@ -420,8 +419,9 @@ SurfaceImpl *DisplayWGL::createPbufferFromClientBuffer(const egl::SurfaceState &
return nullptr; return nullptr;
} }
return new D3DTextureSurfaceWGL(state, getRenderer(), buftype, clientBuffer, this, return new D3DTextureSurfaceWGL(state, getRenderer()->getStateManager(), buftype, clientBuffer,
mDeviceContext, mD3D11Device, mFunctionsGL, mFunctionsWGL); this, mDeviceContext, mD3D11Device, mFunctionsGL,
mFunctionsWGL);
} }
SurfaceImpl *DisplayWGL::createPixmapSurface(const egl::SurfaceState &state, SurfaceImpl *DisplayWGL::createPixmapSurface(const egl::SurfaceState &state,
......
...@@ -17,7 +17,6 @@ namespace rx ...@@ -17,7 +17,6 @@ namespace rx
{ {
PbufferSurfaceWGL::PbufferSurfaceWGL(const egl::SurfaceState &state, PbufferSurfaceWGL::PbufferSurfaceWGL(const egl::SurfaceState &state,
RendererGL *renderer,
EGLint width, EGLint width,
EGLint height, EGLint height,
EGLenum textureFormat, EGLenum textureFormat,
...@@ -26,7 +25,7 @@ PbufferSurfaceWGL::PbufferSurfaceWGL(const egl::SurfaceState &state, ...@@ -26,7 +25,7 @@ PbufferSurfaceWGL::PbufferSurfaceWGL(const egl::SurfaceState &state,
int pixelFormat, int pixelFormat,
HDC deviceContext, HDC deviceContext,
const FunctionsWGL *functions) const FunctionsWGL *functions)
: SurfaceWGL(state, renderer), : SurfaceWGL(state),
mWidth(width), mWidth(width),
mHeight(height), mHeight(height),
mLargest(largest), mLargest(largest),
......
...@@ -22,7 +22,6 @@ class PbufferSurfaceWGL : public SurfaceWGL ...@@ -22,7 +22,6 @@ class PbufferSurfaceWGL : public SurfaceWGL
{ {
public: public:
PbufferSurfaceWGL(const egl::SurfaceState &state, PbufferSurfaceWGL(const egl::SurfaceState &state,
RendererGL *renderer,
EGLint width, EGLint width,
EGLint height, EGLint height,
EGLenum textureFormat, EGLenum textureFormat,
......
...@@ -16,7 +16,7 @@ namespace rx ...@@ -16,7 +16,7 @@ namespace rx
class SurfaceWGL : public SurfaceGL class SurfaceWGL : public SurfaceGL
{ {
public: public:
SurfaceWGL(const egl::SurfaceState &state, RendererGL *renderer) : SurfaceGL(state, renderer) {} SurfaceWGL(const egl::SurfaceState &state) : SurfaceGL(state) {}
~SurfaceWGL() override {} ~SurfaceWGL() override {}
......
...@@ -17,12 +17,11 @@ namespace rx ...@@ -17,12 +17,11 @@ namespace rx
{ {
WindowSurfaceWGL::WindowSurfaceWGL(const egl::SurfaceState &state, WindowSurfaceWGL::WindowSurfaceWGL(const egl::SurfaceState &state,
RendererGL *renderer,
EGLNativeWindowType window, EGLNativeWindowType window,
int pixelFormat, int pixelFormat,
const FunctionsWGL *functions, const FunctionsWGL *functions,
EGLint orientation) EGLint orientation)
: SurfaceWGL(state, renderer), : SurfaceWGL(state),
mPixelFormat(pixelFormat), mPixelFormat(pixelFormat),
mWindow(window), mWindow(window),
mDeviceContext(nullptr), mDeviceContext(nullptr),
......
...@@ -22,7 +22,6 @@ class WindowSurfaceWGL : public SurfaceWGL ...@@ -22,7 +22,6 @@ class WindowSurfaceWGL : public SurfaceWGL
{ {
public: public:
WindowSurfaceWGL(const egl::SurfaceState &state, WindowSurfaceWGL(const egl::SurfaceState &state,
RendererGL *renderer,
EGLNativeWindowType window, EGLNativeWindowType window,
int pixelFormat, int pixelFormat,
const FunctionsWGL *functions, const FunctionsWGL *functions,
......
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